Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3477492

Browse filesBrowse files
nodejs-github-botRafaelGSS
authored andcommitted
deps: update amaro to 0.2.0
PR-URL: #55601 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 5de2567 commit 3477492
Copy full SHA for 3477492

File tree

Expand file treeCollapse file tree

10 files changed

+112
-49
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

10 files changed

+112
-49
lines changed
Open diff view settings
Collapse file

‎deps/amaro/README.md‎

Copy file name to clipboardExpand all lines: deps/amaro/README.md
+15Lines changed: 15 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ This allows the installed Amaro to override the Amaro version used by Node.js.
3434
node --experimental-strip-types --import="amaro/register" script.ts
3535
```
3636

37+
Or with the alias:
38+
39+
```bash
40+
node --experimental-strip-types --import="amaro/strip" script.ts
41+
```
42+
43+
Enabling TypeScript feature transformation:
44+
45+
```bash
46+
node --experimental-transform-types --import="amaro/transform" script.ts
47+
```
48+
49+
> Note that the "amaro/transform" loader should be used with `--experimental-transform-types` flag, or
50+
> at least with `--enable-source-maps` flag, to preserve the original source maps.
51+
3752
### How to update SWC
3853

3954
To update the SWC version, run:
Collapse file

‎deps/amaro/dist/index.js‎

Copy file name to clipboardExpand all lines: deps/amaro/dist/index.js
+16-39Lines changed: 16 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎deps/amaro/dist/package.json‎

Copy file name to clipboardExpand all lines: deps/amaro/dist/package.json
+1-1Lines 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.7.35",
7+
"version": "1.7.40",
88
"license": "Apache-2.0",
99
"repository": {
1010
"type": "git",
Collapse file

‎deps/amaro/dist/register-strip.mjs‎

Copy file name to clipboard
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { register } from "node:module";
2+
3+
register("./strip-loader.js", import.meta.url);
Collapse file
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { register } from "node:module";
2+
import { emitWarning, env, execArgv } from "node:process";
3+
4+
const hasSourceMaps =
5+
execArgv.includes("--enable-source-maps") ||
6+
env.NODE_OPTIONS?.includes("--enable-source-maps");
7+
8+
if (!hasSourceMaps) {
9+
emitWarning("Source maps are disabled, stack traces will not accurate");
10+
}
11+
12+
register("./transform-loader.js", import.meta.url);
Collapse file

‎deps/amaro/dist/register.mjs‎

Copy file name to clipboardExpand all lines: deps/amaro/dist/register.mjs
-3Lines changed: 0 additions & 3 deletions
This file was deleted.
Collapse file

‎deps/amaro/dist/strip-loader.js‎

Copy file name to clipboard
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"use strict";
2+
import { transformSync } from "./index.js";
3+
export async function load(url, context, nextLoad) {
4+
const { format } = context;
5+
if (format.endsWith("-typescript")) {
6+
const { source } = await nextLoad(url, {
7+
...context,
8+
format: "module"
9+
});
10+
const { code } = transformSync(source.toString(), {
11+
mode: "strip-only"
12+
});
13+
return {
14+
format: format.replace("-typescript", ""),
15+
// Source map is not necessary in strip-only mode. However, to map the source
16+
// file in debuggers to the original TypeScript source, add a sourceURL magic
17+
// comment to hint that it is a generated source.
18+
source: `${code}
19+
20+
//# sourceURL=${url}`
21+
};
22+
}
23+
return nextLoad(url, context);
24+
}
Collapse file
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"use strict";
2+
import { transformSync } from "./index.js";
3+
export async function load(url, context, nextLoad) {
4+
const { format } = context;
5+
if (format.endsWith("-typescript")) {
6+
const { source } = await nextLoad(url, {
7+
...context,
8+
format: "module"
9+
});
10+
const { code, map } = transformSync(source.toString(), {
11+
mode: "transform",
12+
sourceMap: true,
13+
filename: url
14+
});
15+
let output = code;
16+
if (map) {
17+
const base64SourceMap = Buffer.from(map).toString("base64");
18+
output = `${code}
19+
20+
//# sourceMappingURL=data:application/json;base64,${base64SourceMap}`;
21+
}
22+
return {
23+
format: format.replace("-typescript", ""),
24+
source: `${output}
25+
26+
//# sourceURL=${url}`
27+
};
28+
}
29+
return nextLoad(url, context);
30+
}
Collapse file

‎deps/amaro/package.json‎

Copy file name to clipboardExpand all lines: deps/amaro/package.json
+10-5Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "amaro",
3-
"version": "0.1.9",
3+
"version": "0.2.0",
44
"description": "Node.js TypeScript wrapper",
55
"license": "MIT",
66
"type": "commonjs",
@@ -21,22 +21,27 @@
2121
"ci:fix": "biome check --write",
2222
"prepack": "npm run build",
2323
"postpack": "npm run clean",
24-
"build": "node esbuild.config.js",
24+
"build": "node esbuild.config.mjs",
2525
"typecheck": "tsc --noEmit",
2626
"test": "node --test --experimental-test-snapshots \"**/*.test.js\"",
2727
"test:regenerate": "node --test --experimental-test-snapshots --test-update-snapshots \"**/*.test.js\""
2828
},
2929
"devDependencies": {
3030
"@biomejs/biome": "1.8.3",
31-
"@types/node": "^20.14.11",
31+
"@types/node": "^22.0.0",
3232
"esbuild": "^0.23.0",
3333
"esbuild-plugin-copy": "^2.1.1",
3434
"rimraf": "^6.0.1",
3535
"typescript": "^5.5.3"
3636
},
3737
"exports": {
3838
".": "./dist/index.js",
39-
"./register": "./dist/register.mjs"
39+
"./register": "./dist/register-strip.mjs",
40+
"./strip": "./dist/register-strip.mjs",
41+
"./transform": "./dist/register-transform.mjs"
4042
},
41-
"files": ["dist", "LICENSE.md"]
43+
"files": ["dist", "LICENSE.md"],
44+
"engines": {
45+
"node": ">=22"
46+
}
4247
}
Collapse file

‎src/amaro_version.h‎

Copy file name to clipboardExpand all lines: src/amaro_version.h
+1-1Lines 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.1.9"
5+
#define AMARO_VERSION "0.2.0"
66
#endif // SRC_AMARO_VERSION_H_

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.