mirror of https://github.com/nodejs/node.git
deps: update amaro to 0.3.0
PR-URL: https://github.com/nodejs/node/pull/56568 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>pull/56613/head
parent
e52440bc3b
commit
d1a3f30642
|
@ -0,0 +1,17 @@
|
||||||
|
"use strict";
|
||||||
|
export function isSwcError(error) {
|
||||||
|
return error.code !== void 0;
|
||||||
|
}
|
||||||
|
export function wrapAndReThrowSwcError(error) {
|
||||||
|
switch (error.code) {
|
||||||
|
case "UnsupportedSyntax": {
|
||||||
|
const unsupportedSyntaxError = new Error(error.message);
|
||||||
|
unsupportedSyntaxError.name = "UnsupportedSyntaxError";
|
||||||
|
throw unsupportedSyntaxError;
|
||||||
|
}
|
||||||
|
case "InvalidSyntax":
|
||||||
|
throw new SyntaxError(error.message);
|
||||||
|
default:
|
||||||
|
throw new Error(error.message);
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
||||||
"강동윤 <kdy1997.dev@gmail.com>"
|
"강동윤 <kdy1997.dev@gmail.com>"
|
||||||
],
|
],
|
||||||
"description": "wasm module for swc",
|
"description": "wasm module for swc",
|
||||||
"version": "1.10.4",
|
"version": "1.10.7",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
import { isSwcError, wrapAndReThrowSwcError } from "./errors.js";
|
||||||
import { transformSync } from "./index.js";
|
import { transformSync } from "./index.js";
|
||||||
export async function load(url, context, nextLoad) {
|
export async function load(url, context, nextLoad) {
|
||||||
const { format } = context;
|
const { format } = context;
|
||||||
if (format.endsWith("-typescript")) {
|
if (format.endsWith("-typescript")) {
|
||||||
|
try {
|
||||||
const { source } = await nextLoad(url, {
|
const { source } = await nextLoad(url, {
|
||||||
...context,
|
...context,
|
||||||
format: "module"
|
format: "module"
|
||||||
|
@ -19,6 +21,12 @@ export async function load(url, context, nextLoad) {
|
||||||
|
|
||||||
//# sourceURL=${url}`
|
//# sourceURL=${url}`
|
||||||
};
|
};
|
||||||
|
} catch (error) {
|
||||||
|
if (isSwcError(error)) {
|
||||||
|
wrapAndReThrowSwcError(error);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nextLoad(url, context);
|
return nextLoad(url, context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
import { isSwcError, wrapAndReThrowSwcError } from "./errors.js";
|
||||||
import { transformSync } from "./index.js";
|
import { transformSync } from "./index.js";
|
||||||
export async function load(url, context, nextLoad) {
|
export async function load(url, context, nextLoad) {
|
||||||
const { format } = context;
|
const { format } = context;
|
||||||
if (format.endsWith("-typescript")) {
|
if (format.endsWith("-typescript")) {
|
||||||
|
try {
|
||||||
const { source } = await nextLoad(url, {
|
const { source } = await nextLoad(url, {
|
||||||
...context,
|
...context,
|
||||||
format: "module"
|
format: "module"
|
||||||
|
@ -25,6 +27,12 @@ export async function load(url, context, nextLoad) {
|
||||||
|
|
||||||
//# sourceURL=${url}`
|
//# sourceURL=${url}`
|
||||||
};
|
};
|
||||||
|
} catch (error) {
|
||||||
|
if (isSwcError(error)) {
|
||||||
|
wrapAndReThrowSwcError(error);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nextLoad(url, context);
|
return nextLoad(url, context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "amaro",
|
"name": "amaro",
|
||||||
"version": "0.2.2",
|
"version": "0.3.0",
|
||||||
"description": "Node.js TypeScript wrapper",
|
"description": "Node.js TypeScript wrapper",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
// Refer to tools/dep_updaters/update-amaro.sh
|
// Refer to tools/dep_updaters/update-amaro.sh
|
||||||
#ifndef SRC_AMARO_VERSION_H_
|
#ifndef SRC_AMARO_VERSION_H_
|
||||||
#define SRC_AMARO_VERSION_H_
|
#define SRC_AMARO_VERSION_H_
|
||||||
#define AMARO_VERSION "0.2.2"
|
#define AMARO_VERSION "0.3.0"
|
||||||
#endif // SRC_AMARO_VERSION_H_
|
#endif // SRC_AMARO_VERSION_H_
|
||||||
|
|
Loading…
Reference in New Issue