Skip to content

Commit 81a10a6

Browse files
marco-ippolitoRafaelGSS
authored andcommitted
deps: update amaro to 0.5.1
PR-URL: #57704 Backport-PR-URL: #57298 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #56350Fixes: nodejs/typescript#17
1 parent 25f8682 commit 81a10a6

9 files changed

Lines changed: 20 additions & 17 deletions

File tree

‎deps/amaro/dist/errors.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ export function isSwcError(error) {
33
returnerror.code!==void0;
44
}
55
exportfunctionwrapAndReThrowSwcError(error){
6-
consterrorHints=`${error.filename}:${error.startLine}${error.snippet}`;
6+
consterrorHints=`${error.filename}:${error.startLine}
7+
${error.snippet}
8+
`;
79
switch(error.code){
810
case"UnsupportedSyntax": {
911
constunsupportedSyntaxError=newError(error.message);

‎deps/amaro/dist/index.js‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎deps/amaro/dist/package.json‎

Lines 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.11.12",
7+
"version": "1.11.15",
88
"license": "Apache-2.0",
99
"repository": {
1010
"type": "git",

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

Lines changed: 3 additions & 1 deletion
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
exportasyncfunctionload(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‎

Lines changed: 2 additions & 1 deletion
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
exportasyncfunctionload(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
letoutput=code;
1819
if(map){

‎deps/amaro/package.json‎

Lines changed: 1 addition & 1 deletion
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‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ function parseTypeScript(source, options) {
8383
* @returns {Error} the decorated error
8484
*/
8585
functiondecorateErrorWithSnippet(error,amaroError){
86-
consterrorHints=`${amaroError.filename}:${amaroError.startLine}${amaroError.snippet}`;
87-
error.stack=`${errorHints}${error.stack}`;
86+
consterrorHints=`${amaroError.filename}:${amaroError.startLine}\n${amaroError.snippet}`;
87+
error.stack=`${errorHints}\n${error.stack}`;
8888
returnerror;
8989
}
9090

‎src/amaro_version.h‎

Lines 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
#ifndefSRC_AMARO_VERSION_H_
44
#defineSRC_AMARO_VERSION_H_
5-
#defineAMARO_VERSION "0.5.0"
5+
#defineAMARO_VERSION "0.5.1"
66
#endif// SRC_AMARO_VERSION_H_

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

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

0 commit comments

Comments
 (0)