deps: update amaro to 0.5.0

PR-URL: https://github.com/nodejs/node/pull/57687
Fixes: https://github.com/nodejs/node/issues/56830
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
nodejs-github-bot 2025-03-30 00:36:34 +00:00 committed by Node.js GitHub Bot
parent 0d910706ef
commit e5ff73133a
6 changed files with 35 additions and 14 deletions

View File

@ -29,6 +29,7 @@ console.log(code); // "const foo = 'bar';"
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
@ -51,7 +52,7 @@ node --experimental-transform-types --import="amaro/transform" script.ts
### TypeScript Version
The supported TypeScript version is 5.5.4, except the stage 3 decorator proposal.
The supported TypeScript version is 5.8.
## License (MIT)

View File

@ -3,14 +3,19 @@ export function isSwcError(error) {
return error.code !== void 0;
}
export function wrapAndReThrowSwcError(error) {
const errorHints = `${error.filename}:${error.startLine}${error.snippet}`;
switch (error.code) {
case "UnsupportedSyntax": {
const unsupportedSyntaxError = new Error(error.message);
unsupportedSyntaxError.name = "UnsupportedSyntaxError";
unsupportedSyntaxError.stack = `${errorHints}${unsupportedSyntaxError.stack}`;
throw unsupportedSyntaxError;
}
case "InvalidSyntax":
throw new SyntaxError(error.message);
case "InvalidSyntax": {
const syntaxError = new SyntaxError(error.message);
syntaxError.stack = `${errorHints}${syntaxError.stack}`;
throw syntaxError;
}
default:
throw new Error(error.message);
}

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
"강동윤 <kdy1997.dev@gmail.com>"
],
"description": "wasm module for swc",
"version": "1.11.5",
"version": "1.11.12",
"license": "Apache-2.0",
"repository": {
"type": "git",

View File

@ -1,6 +1,6 @@
{
"name": "amaro",
"version": "0.4.1",
"version": "0.5.0",
"description": "Node.js TypeScript wrapper",
"license": "MIT",
"type": "commonjs",
@ -24,8 +24,8 @@
"build": "node esbuild.config.mjs",
"build:wasm": "node tools/build-wasm.js",
"typecheck": "tsc --noEmit",
"test": "node --test --experimental-test-snapshots \"**/*.test.js\"",
"test:regenerate": "node --test --experimental-test-snapshots --test-update-snapshots \"**/*.test.js\""
"test": "node --test \"**/*.test.js\"",
"test:regenerate": "node --test --test-update-snapshots \"**/*.test.js\""
},
"devDependencies": {
"@biomejs/biome": "1.8.3",

View File

@ -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.4.1"
#define AMARO_VERSION "0.5.0"
#endif // SRC_AMARO_VERSION_H_