You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: deps/amaro/README.md
+33-9Lines changed: 33 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,12 @@
1
1
# Amaro
2
2
3
3
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.
6
5
7
6
> 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.
8
7
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
+
9
10
## How to Install
10
11
11
12
To install Amaro, run:
@@ -31,25 +32,48 @@ It is possible to use Amaro as an external loader to execute TypeScript files.
31
32
This allows the installed Amaro to override the Amaro version used by Node.js.
32
33
In order to use Amaro as an external loader, type stripping needs to be enabled.
> Note that the "amaro/transform" loader should be used with `--experimental-transform-types` flag, or
51
48
> at least with `--enable-source-maps` flag, to preserve the original source maps.
52
49
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:
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.
0 commit comments