amaro 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,6 +29,7 @@ console.log(code); // "const foo = 'bar';"
29
29
 
30
30
  It is possible to use Amaro as an external loader to execute TypeScript files.
31
31
  This allows the installed Amaro to override the Amaro version used by Node.js.
32
+ In order to use Amaro as an external loader, type stripping needs to be enabled.
32
33
 
33
34
  ```bash
34
35
  node --experimental-strip-types --import="amaro/register" script.ts
@@ -51,7 +52,7 @@ node --experimental-transform-types --import="amaro/transform" script.ts
51
52
 
52
53
  ### TypeScript Version
53
54
 
54
- The supported TypeScript version is 5.5.4, except the stage 3 decorator proposal.
55
+ The supported TypeScript version is 5.8.
55
56
 
56
57
  ## License (MIT)
57
58
 
package/dist/errors.js CHANGED
@@ -3,14 +3,19 @@ export function isSwcError(error) {
3
3
  return error.code !== void 0;
4
4
  }
5
5
  export function wrapAndReThrowSwcError(error) {
6
+ const errorHints = `${error.filename}:${error.startLine}${error.snippet}`;
6
7
  switch (error.code) {
7
8
  case "UnsupportedSyntax": {
8
9
  const unsupportedSyntaxError = new Error(error.message);
9
10
  unsupportedSyntaxError.name = "UnsupportedSyntaxError";
11
+ unsupportedSyntaxError.stack = `${errorHints}${unsupportedSyntaxError.stack}`;
10
12
  throw unsupportedSyntaxError;
11
13
  }
12
- case "InvalidSyntax":
13
- throw new SyntaxError(error.message);
14
+ case "InvalidSyntax": {
15
+ const syntaxError = new SyntaxError(error.message);
16
+ syntaxError.stack = `${errorHints}${syntaxError.stack}`;
17
+ throw syntaxError;
18
+ }
14
19
  default:
15
20
  throw new Error(error.message);
16
21
  }