Skip to content

deps: update amaro to 1.0.0 #58639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 33 additions & 9 deletions deps/amaro/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Amaro

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.
The main goal of this package is to provide a stable API for TypeScript parser, which is unstable and subject to change.
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.

> 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

To install Amaro, run:
Expand All @@ -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.
In order to use Amaro as an external loader, type stripping needs to be enabled.

```bash
node --experimental-strip-types --import="amaro/register" script.ts
```

Or with the alias:
In node v23 and later you can omit the `--experimental-strip-types` flag, as it is enabled by default.

```bash
node --experimental-strip-types --import="amaro/strip" script.ts
node --experimental-strip-types --import="amaro/strip" file.ts
```

Enabling TypeScript feature transformation:

```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
> 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

The supported TypeScript version is 5.8.
Expand Down
6 changes: 3 additions & 3 deletions deps/amaro/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deps/amaro/dist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"강동윤 <[email protected]>"
],
"description": "wasm module for swc",
"version": "1.11.24",
"version": "1.11.31",
"license": "Apache-2.0",
"repository": {
"type": "git",
Expand Down
3 changes: 1 addition & 2 deletions deps/amaro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amaro",
"version": "0.5.3",
"version": "1.0.0",
"description": "Node.js TypeScript wrapper",
"license": "MIT",
"type": "commonjs",
Expand Down Expand Up @@ -37,7 +37,6 @@
},
"exports": {
".": "./dist/index.js",
"./register": "./dist/register-strip.mjs",
"./strip": "./dist/register-strip.mjs",
"./transform": "./dist/register-transform.mjs"
},
Expand Down
2 changes: 1 addition & 1 deletion src/amaro_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
// Refer to tools/dep_updaters/update-amaro.sh
#ifndef 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_
Loading