Skip to content

Commit 0dc4725

Browse files
deps: update amaro to 0.5.1
PR-URL: #57704 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 10cff7b commit 0dc4725

File tree

9 files changed

+20
-17
lines changed

9 files changed

+20
-17
lines changed

deps/amaro/dist/errors.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ export function isSwcError(error) {
33
return error.code !== void 0;
44
}
55
export function wrapAndReThrowSwcError(error) {
6-
const errorHints = `${error.filename}:${error.startLine}${error.snippet}`;
6+
const errorHints = `${error.filename}:${error.startLine}
7+
${error.snippet}
8+
`;
79
switch (error.code) {
810
case "UnsupportedSyntax": {
911
const unsupportedSyntaxError = new Error(error.message);

deps/amaro/dist/index.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps/amaro/dist/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"강동윤 <[email protected]>"
55
],
66
"description": "wasm module for swc",
7-
"version": "1.11.12",
7+
"version": "1.11.15",
88
"license": "Apache-2.0",
99
"repository": {
1010
"type": "git",

deps/amaro/dist/strip-loader.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"use strict";
2+
import { fileURLToPath } from "node:url";
23
import { isSwcError, wrapAndReThrowSwcError } from "./errors.js";
34
import { transformSync } from "./index.js";
45
export async function load(url, context, nextLoad) {
@@ -10,7 +11,8 @@ export async function load(url, context, nextLoad) {
1011
format: "module"
1112
});
1213
const { code } = transformSync(source.toString(), {
13-
mode: "strip-only"
14+
mode: "strip-only",
15+
filename: fileURLToPath(url)
1416
});
1517
return {
1618
format: format.replace("-typescript", ""),

deps/amaro/dist/transform-loader.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"use strict";
2+
import { fileURLToPath } from "node:url";
23
import { isSwcError, wrapAndReThrowSwcError } from "./errors.js";
34
import { transformSync } from "./index.js";
45
export async function load(url, context, nextLoad) {
@@ -12,7 +13,7 @@ export async function load(url, context, nextLoad) {
1213
const { code, map } = transformSync(source.toString(), {
1314
mode: "transform",
1415
sourceMap: true,
15-
filename: url
16+
filename: fileURLToPath(url)
1617
});
1718
let output = code;
1819
if (map) {

deps/amaro/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "amaro",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"description": "Node.js TypeScript wrapper",
55
"license": "MIT",
66
"type": "commonjs",

lib/internal/modules/typescript.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ function parseTypeScript(source, options) {
8787
* @returns {Error} the decorated error
8888
*/
8989
function decorateErrorWithSnippet(error, amaroError) {
90-
const errorHints = `${amaroError.filename}:${amaroError.startLine}${amaroError.snippet}`;
91-
error.stack = `${errorHints}${error.stack}`;
90+
const errorHints = `${amaroError.filename}:${amaroError.startLine}\n${amaroError.snippet}`;
91+
error.stack = `${errorHints}\n${error.stack}`;
9292
return error;
9393
}
9494

src/amaro_version.h

+1-1
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.5.0"
5+
#define AMARO_VERSION "0.5.1"
66
#endif // SRC_AMARO_VERSION_H_

test/es-module/test-typescript-eval.mjs

+4-6
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,10 @@ test('the error message should not contain extra padding', async () => {
273273
strictEqual(result.stdout, '');
274274
// Windows uses \r\n as line endings
275275
const lines = result.stderr.replace(/\r\n/g, '\n').split('\n');
276-
// The extra padding at the end should not be present
277-
strictEqual(lines[0], '[eval]:1 ');
278-
// The extra padding at the beginning should not be present
279-
strictEqual(lines[2], ' declare module F { export type x = number }');
280-
strictEqual(lines[3], ' ^^^^^^^^');
281-
strictEqual(lines[5], 'SyntaxError [ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX]:' +
276+
strictEqual(lines[0], '[eval]:1');
277+
strictEqual(lines[1], 'declare module F { export type x = number }');
278+
strictEqual(lines[2], ' ^^^^^^^^');
279+
strictEqual(lines[4], 'SyntaxError [ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX]:' +
282280
' `module` keyword is not supported. Use `namespace` instead.');
283281
strictEqual(result.code, 1);
284282
});

0 commit comments

Comments
 (0)