deps: update amaro to 1.0.0
PR-URL: https://github.com/nodejs/node/pull/58639 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
This commit is contained in:
parent
5f7dbf45a3
commit
bb991716c6
42
deps/amaro/README.md
vendored
42
deps/amaro/README.md
vendored
@ -1,11 +1,12 @@
|
|||||||
# Amaro
|
# Amaro
|
||||||
|
|
||||||
Amaro is a wrapper around `@swc/wasm-typescript`, a WebAssembly port of the SWC TypeScript parser.
|
Amaro is a wrapper around `@swc/wasm-typescript`, a WebAssembly port of the SWC TypeScript parser.
|
||||||
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.
|
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.
|
||||||
The main goal of this package is to provide a stable API for TypeScript parser, which is unstable and subject to change.
|
|
||||||
|
|
||||||
> 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.
|
> 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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
## How to Install
|
## How to Install
|
||||||
|
|
||||||
To install Amaro, run:
|
To install Amaro, run:
|
||||||
@ -31,25 +32,48 @@ It is possible to use Amaro as an external loader to execute TypeScript files.
|
|||||||
This allows the installed Amaro to override the Amaro version used by Node.js.
|
This allows the installed Amaro to override the Amaro version used by Node.js.
|
||||||
In order to use Amaro as an external loader, type stripping needs to be enabled.
|
In order to use Amaro as an external loader, type stripping needs to be enabled.
|
||||||
|
|
||||||
```bash
|
In node v23 and later you can omit the `--experimental-strip-types` flag, as it is enabled by default.
|
||||||
node --experimental-strip-types --import="amaro/register" script.ts
|
|
||||||
```
|
|
||||||
|
|
||||||
Or with the alias:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
node --experimental-strip-types --import="amaro/strip" script.ts
|
node --experimental-strip-types --import="amaro/strip" file.ts
|
||||||
```
|
```
|
||||||
|
|
||||||
Enabling TypeScript feature transformation:
|
Enabling TypeScript feature transformation:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
node --experimental-transform-types --import="amaro/transform" script.ts
|
node --experimental-transform-types --import="amaro/transform" file.ts
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note that the "amaro/transform" loader should be used with `--experimental-transform-types` flag, or
|
> Note that the "amaro/transform" loader should be used with `--experimental-transform-types` flag, or
|
||||||
> at least with `--enable-source-maps` flag, to preserve the original source maps.
|
> at least with `--enable-source-maps` flag, to preserve the original source maps.
|
||||||
|
|
||||||
|
#### Type stripping in dependencies
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
### Monorepo usage
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```json
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"typescript": "./src/index.ts",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"require": "./dist/index.js",
|
||||||
|
"import": "./dist/index.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run your app with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node --watch --import="amaro/strip" --conditions=typescript ./src/index.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
### TypeScript Version
|
### TypeScript Version
|
||||||
|
|
||||||
The supported TypeScript version is 5.8.
|
The supported TypeScript version is 5.8.
|
||||||
|
6
deps/amaro/dist/index.js
vendored
6
deps/amaro/dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
deps/amaro/dist/package.json
vendored
2
deps/amaro/dist/package.json
vendored
@ -4,7 +4,7 @@
|
|||||||
"강동윤 <kdy1997.dev@gmail.com>"
|
"강동윤 <kdy1997.dev@gmail.com>"
|
||||||
],
|
],
|
||||||
"description": "wasm module for swc",
|
"description": "wasm module for swc",
|
||||||
"version": "1.11.24",
|
"version": "1.11.31",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
3
deps/amaro/package.json
vendored
3
deps/amaro/package.json
vendored
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "amaro",
|
"name": "amaro",
|
||||||
"version": "0.5.3",
|
"version": "1.0.0",
|
||||||
"description": "Node.js TypeScript wrapper",
|
"description": "Node.js TypeScript wrapper",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
@ -37,7 +37,6 @@
|
|||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./dist/index.js",
|
".": "./dist/index.js",
|
||||||
"./register": "./dist/register-strip.mjs",
|
|
||||||
"./strip": "./dist/register-strip.mjs",
|
"./strip": "./dist/register-strip.mjs",
|
||||||
"./transform": "./dist/register-transform.mjs"
|
"./transform": "./dist/register-transform.mjs"
|
||||||
},
|
},
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
// Refer to tools/dep_updaters/update-amaro.sh
|
// Refer to tools/dep_updaters/update-amaro.sh
|
||||||
#ifndef SRC_AMARO_VERSION_H_
|
#ifndef SRC_AMARO_VERSION_H_
|
||||||
#define SRC_AMARO_VERSION_H_
|
#define SRC_AMARO_VERSION_H_
|
||||||
#define AMARO_VERSION "0.5.3"
|
#define AMARO_VERSION "1.0.0"
|
||||||
#endif // SRC_AMARO_VERSION_H_
|
#endif // SRC_AMARO_VERSION_H_
|
||||||
|
Loading…
x
Reference in New Issue
Block a user