Skip to content

Commit 450f481

Browse files
nodejs-github-bottargos
authored andcommitted
deps: update amaro to 1.0.0
PR-URL: #58639 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
1 parent 839964e commit 450f481

File tree

5 files changed

+39
-16
lines changed

5 files changed

+39
-16
lines changed

deps/amaro/README.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Amaro
22

33
Amaro is a wrapper around `@swc/wasm-typescript`, a WebAssembly port of the SWC TypeScript parser.
4-
It's currently used as an internal in Node.js for [Type Stripping](https://github.com/nodejs/loaders/issues/208), but in the future it will be possible to be upgraded separately by users.
5-
The main goal of this package is to provide a stable API for TypeScript parser, which is unstable and subject to change.
4+
It's used as an internal in Node.js for [Type Stripping](https://nodejs.org/api/typescript.html#type-stripping) but can also be used as a standalone package.
65

76
> Amaro means "bitter" in Italian. It's a reference to [Mount Amaro](https://en.wikipedia.org/wiki/Monte_Amaro_(Abruzzo)) on whose slopes this package was conceived.
87
8+
This package provides a stable API for the TypeScript parser and allows users to upgrade to the latest version of TypeScript transpiler independently from the one used internally in Node.js.
9+
910
## How to Install
1011

1112
To install Amaro, run:
@@ -31,25 +32,48 @@ It is possible to use Amaro as an external loader to execute TypeScript files.
3132
This allows the installed Amaro to override the Amaro version used by Node.js.
3233
In order to use Amaro as an external loader, type stripping needs to be enabled.
3334

34-
```bash
35-
node --experimental-strip-types --import="amaro/register" script.ts
36-
```
37-
38-
Or with the alias:
35+
In node v23 and later you can omit the `--experimental-strip-types` flag, as it is enabled by default.
3936

4037
```bash
41-
node --experimental-strip-types --import="amaro/strip" script.ts
38+
node --experimental-strip-types --import="amaro/strip" file.ts
4239
```
4340

4441
Enabling TypeScript feature transformation:
4542

4643
```bash
47-
node --experimental-transform-types --import="amaro/transform" script.ts
44+
node --experimental-transform-types --import="amaro/transform" file.ts
4845
```
4946

5047
> Note that the "amaro/transform" loader should be used with `--experimental-transform-types` flag, or
5148
> at least with `--enable-source-maps` flag, to preserve the original source maps.
5249
50+
#### Type stripping in dependencies
51+
52+
Contrary to the Node.js [TypeScript support](https://nodejs.org/docs/latest/api/typescript.html#type-stripping-in-dependencies), when used as a loader, Amaro handles TypeScript files inside folders under a `node_modules` path.
53+
54+
### Monorepo usage
55+
56+
Amaro makes working in monorepos smoother by removing the need to rebuild internal packages during development. When used with the [`--conditions`](https://nodejs.org/docs/latest/api/cli.html#-c-condition---conditionscondition) flag, you can reference TypeScript source files directly in exports:
57+
58+
```json
59+
"exports": {
60+
".": {
61+
"typescript": "./src/index.ts",
62+
"types": "./dist/index.d.ts",
63+
"require": "./dist/index.js",
64+
"import": "./dist/index.js"
65+
}
66+
}
67+
```
68+
69+
Then run your app with:
70+
71+
```bash
72+
node --watch --import="amaro/strip" --conditions=typescript ./src/index.ts
73+
```
74+
75+
This setup allows Node.js to load TypeScript files from linked packages without a build step. Changes to any package are picked up immediately, speeding up and simplifying local development in monorepos.
76+
5377
### TypeScript Version
5478

5579
The supported TypeScript version is 5.8.

deps/amaro/dist/index.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps/amaro/dist/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"강동윤 <kdy1997.dev@gmail.com>"
55
],
66
"description": "wasm module for swc",
7-
"version": "1.11.24",
7+
"version": "1.11.31",
88
"license": "Apache-2.0",
99
"repository": {
1010
"type": "git",

deps/amaro/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "amaro",
3-
"version": "0.5.3",
3+
"version": "1.0.0",
44
"description": "Node.js TypeScript wrapper",
55
"license": "MIT",
66
"type": "commonjs",
@@ -37,7 +37,6 @@
3737
},
3838
"exports": {
3939
".": "./dist/index.js",
40-
"./register": "./dist/register-strip.mjs",
4140
"./strip": "./dist/register-strip.mjs",
4241
"./transform": "./dist/register-transform.mjs"
4342
},

src/amaro_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
// Refer to tools/dep_updaters/update-amaro.sh
33
#ifndef SRC_AMARO_VERSION_H_
44
#define SRC_AMARO_VERSION_H_
5-
#define AMARO_VERSION "0.5.3"
5+
#define AMARO_VERSION "1.0.0"
66
#endif // SRC_AMARO_VERSION_H_

0 commit comments

Comments
 (0)