Support Import Attributes (#14863)

* Print import attributes

* Update visitor keys for import attributes

* Update snapshots for visitor-keys

* Update `babel-plugins` tests

* Update import attributes tests

* Update misc tests

* Add changelog

* Enable `importAttributes` and `importAssertions`

* Print ImportAssertion syntax

* Add `babel-plugins` tests

* Add import assertions tests

* Add misc tests for import assertions

* Update changelog

* Fix words

* Use `deprecatedAssertSyntax`

* Update `@babel/parser`

* Use deprecatedAssertSyntax

* Remove needless tests

* Update `@babel/types`

* Update visitor-keys

* Run `yarn dedupe`

* Update src/language-js/print/module.js

Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>

* Address review

---------

Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>
This commit is contained in:
SUZUKI SosukeandNicolò Ribaudo authored and GitHub committed 2023-05-31 00:47:12 +09:00
1 parent 7ba38c250d
commit 7ad852636d
30 files changed
+688 -28

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
#### Support Import Attributes (#14861, #14863 by @sosukesuzuki)
Support [Import Attributes](https://github.com/tc39/proposal-import-attributes) proposal.
<!-- prettier-ignore -->
```jsx
import json from "./foo.json" with { type: "json" };
import("./foo.json", { with: { type: "json" } });
```
+2 -2
View File
@@ -32,8 +32,8 @@
"dependencies": { "dependencies": {
"@angular/compiler": "16.0.3", "@angular/compiler": "16.0.3",
"@babel/code-frame": "7.21.4", "@babel/code-frame": "7.21.4",
"@babel/parser": "7.22.3", "@babel/parser": "7.22.4",
"@babel/types": "7.22.3", "@babel/types": "7.22.4",
"@glimmer/syntax": "0.84.3", "@glimmer/syntax": "0.84.3",
"@iarna/toml": "2.2.5", "@iarna/toml": "2.2.5",
"@prettier/is-es5-identifier-name": "0.1.0", "@prettier/is-es5-identifier-name": "0.1.0",
+2 -1
View File
@@ -36,7 +36,6 @@ const parseOptions = {
"throwExpressions", "throwExpressions",
"partialApplication", "partialApplication",
"decorators", "decorators",
"importAssertions",
"decimal", "decimal",
"moduleBlocks", "moduleBlocks",
"asyncDoExpressions", "asyncDoExpressions",
@@ -45,6 +44,7 @@ const parseOptions = {
"decoratorAutoAccessors", "decoratorAutoAccessors",
"importReflection", "importReflection",
"explicitResourceManagement", "explicitResourceManagement",
["importAttributes", { deprecatedAssertSyntax: true }],
], ],
tokens: true, tokens: true,
ranges: true, ranges: true,
@@ -62,6 +62,7 @@ const pipelineOperatorPlugins = [
["pipelineOperator", { proposal: "minimal" }], ["pipelineOperator", { proposal: "minimal" }],
["pipelineOperator", { proposal: "fsharp" }], ["pipelineOperator", { proposal: "fsharp" }],
]; ];
const appendPlugins = (plugins, options = parseOptions) => ({ const appendPlugins = (plugins, options = parseOptions) => ({
...options, ...options,
plugins: [...options.plugins, ...plugins], plugins: [...options.plugins, ...plugins],
+21 -6
View File
@@ -37,7 +37,7 @@ function printImportDeclaration(path, options, print) {
printImportKind(node), printImportKind(node),
printModuleSpecifiers(path, options, print), printModuleSpecifiers(path, options, print),
printModuleSource(path, options, print), printModuleSource(path, options, print),
printImportAssertions(path, options, print), printImportAttributes(path, options, print),
options.semi ? ";" : "", options.semi ? ";" : "",
]; ];
} }
@@ -93,7 +93,7 @@ function printExportDeclaration(path, options, print) {
parts.push( parts.push(
printModuleSource(path, options, print), printModuleSource(path, options, print),
printImportAssertions(path, options, print) printImportAttributes(path, options, print)
); );
} }
@@ -246,16 +246,31 @@ function shouldNotPrintSpecifiers(node, options) {
); );
} }
function printImportAssertions(path, options, print) { /**
* Print Import Attributes syntax.
* If old ImportAssertions syntax is used, print them here.
*/
function printImportAttributes(path, options, print) {
const { node } = path; const { node } = path;
if (!isNonEmptyArray(node.assertions)) {
const property = isNonEmptyArray(node.attributes)
? "attributes"
: isNonEmptyArray(node.assertions)
? "assertions"
: undefined;
if (!property) {
return ""; return "";
} }
const keyword =
property === "assertions" || node.extra?.deprecatedAssertSyntax
? "assert"
: "with";
return [ return [
" assert {", ` ${keyword} {`,
options.bracketSpacing ? " " : "", options.bracketSpacing ? " " : "",
join(", ", path.map(print, "assertions")), join(", ", path.map(print, property)),
options.bracketSpacing ? " " : "", options.bracketSpacing ? " " : "",
"}", "}",
]; ];
@@ -1239,6 +1239,76 @@ import json from "./foo.json" assert { type: "json" };
================================================================================ ================================================================================
`; `;
exports[`import-attributes-dynamic.js [acorn] format 1`] = `
"Unexpected token (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
2 |"
`;
exports[`import-attributes-dynamic.js [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
2 |"
`;
exports[`import-attributes-dynamic.js [meriyah] format 1`] = `
"Expected ')' (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
2 |"
`;
exports[`import-attributes-dynamic.js format 1`] = `
====================================options=====================================
parsers: ["babel", "babel-ts", "babel-flow"]
printWidth: 80
| printWidth
=====================================input======================================
import("./foo.json", { with: { type: "json" } });
=====================================output=====================================
import("./foo.json", { with: { type: "json" } });
================================================================================
`;
exports[`import-attributes-static.js [acorn] format 1`] = `
"Unexpected token (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`import-attributes-static.js [espree] format 1`] = `
"Unexpected token with (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`import-attributes-static.js [meriyah] format 1`] = `
"Unexpected token: 'with' (1:34)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`import-attributes-static.js format 1`] = `
====================================options=====================================
parsers: ["babel", "babel-ts", "babel-flow"]
printWidth: 80
| printWidth
=====================================input======================================
import json from "./foo.json" with { type: "json" };
=====================================output=====================================
import json from "./foo.json" with { type: "json" };
================================================================================
`;
exports[`import-meta.js format 1`] = ` exports[`import-meta.js format 1`] = `
====================================options===================================== ====================================options=====================================
parsers: ["babel", "babel-ts", "babel-flow"] parsers: ["babel", "babel-ts", "babel-flow"]
@@ -0,0 +1 @@
import("./foo.json", { with: { type: "json" } });
@@ -0,0 +1 @@
import json from "./foo.json" with { type: "json" };
@@ -14,6 +14,8 @@ run_spec(import.meta, ["babel", "babel-ts", "babel-flow"], {
"function-sent.js", "function-sent.js",
"import-assertions-dynamic.js", "import-assertions-dynamic.js",
"import-assertions-static.js", "import-assertions-static.js",
"import-attributes-dynamic.js",
"import-attributes-static.js",
"partial-application.js", "partial-application.js",
"pipeline-operator-fsharp.js", "pipeline-operator-fsharp.js",
"pipeline-operator-minimal.js", "pipeline-operator-minimal.js",
@@ -42,6 +44,8 @@ run_spec(import.meta, ["babel", "babel-ts", "babel-flow"], {
"function-sent.js", "function-sent.js",
"import-assertions-dynamic.js", "import-assertions-dynamic.js",
"import-assertions-static.js", "import-assertions-static.js",
"import-attributes-dynamic.js",
"import-attributes-static.js",
"partial-application.js", "partial-application.js",
"pipeline-operator-fsharp.js", "pipeline-operator-fsharp.js",
"pipeline-operator-minimal.js", "pipeline-operator-minimal.js",
@@ -80,6 +84,8 @@ run_spec(import.meta, ["babel", "babel-ts", "babel-flow"], {
"v8intrinsic.js", "v8intrinsic.js",
"import-assertions-dynamic.js", "import-assertions-dynamic.js",
"import-assertions-static.js", "import-assertions-static.js",
"import-attributes-dynamic.js",
"import-attributes-static.js",
"module-string-names.js", "module-string-names.js",
"module-blocks.js", "module-blocks.js",
"async-do-expressions.js", "async-do-expressions.js",
@@ -0,0 +1,324 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`dynamic-import.js [acorn] format 1`] = `
"Unexpected token (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
2 |"
`;
exports[`dynamic-import.js [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
2 |"
`;
exports[`dynamic-import.js [meriyah] format 1`] = `
"Expected ')' (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
2 |"
`;
exports[`dynamic-import.js format 1`] = `
====================================options=====================================
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
import("./foo.json", { with: { type: "json" } });
=====================================output=====================================
import("./foo.json", { with: { type: "json" } });
================================================================================
`;
exports[`empty.js [acorn] format 1`] = `
"Unexpected token (2:33)
1 | export * as foo from "foo.json"
> 2 | export * as bar from "bar.json" with { }
| ^
3 | export * as baz from "baz.json" with { /* comment */ }
4 |
5 | import * as foo from "foo.json""
`;
exports[`empty.js [espree] format 1`] = `
"Unexpected token with (2:33)
1 | export * as foo from "foo.json"
> 2 | export * as bar from "bar.json" with { }
| ^
3 | export * as baz from "baz.json" with { /* comment */ }
4 |
5 | import * as foo from "foo.json""
`;
exports[`empty.js [meriyah] format 1`] = `
"Unexpected token: 'with' (2:36)
1 | export * as foo from "foo.json"
> 2 | export * as bar from "bar.json" with { }
| ^
3 | export * as baz from "baz.json" with { /* comment */ }
4 |
5 | import * as foo from "foo.json""
`;
exports[`empty.js [typescript] format 1`] = `
"';' expected. (2:33)
1 | export * as foo from "foo.json"
> 2 | export * as bar from "bar.json" with { }
| ^
3 | export * as baz from "baz.json" with { /* comment */ }
4 |
5 | import * as foo from "foo.json""
`;
exports[`empty.js format 1`] = `
====================================options=====================================
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
export * as foo from "foo.json"
export * as bar from "bar.json" with { }
export * as baz from "baz.json" with { /* comment */ }
import * as foo from "foo.json"
import * as bar from "bar.json" with { }
import * as baz from "baz.json" with { /* comment */ }
=====================================output=====================================
export * as foo from "foo.json";
export * as bar from "bar.json";
export * as baz from "baz.json" /* comment */;
import * as foo from "foo.json";
import * as bar from "bar.json";
import * as baz from "baz.json" /* comment */;
================================================================================
`;
exports[`multi-types.js [acorn] format 1`] = `
"Unexpected token (1:31)
> 1 | import json from "./foo.json" with { type: "json", type: "bar" };
| ^
2 |"
`;
exports[`multi-types.js [espree] format 1`] = `
"Unexpected token with (1:31)
> 1 | import json from "./foo.json" with { type: "json", type: "bar" };
| ^
2 |"
`;
exports[`multi-types.js [meriyah] format 1`] = `
"Unexpected token: 'with' (1:34)
> 1 | import json from "./foo.json" with { type: "json", type: "bar" };
| ^
2 |"
`;
exports[`multi-types.js [typescript] format 1`] = `
"';' expected. (1:31)
> 1 | import json from "./foo.json" with { type: "json", type: "bar" };
| ^
2 |"
`;
exports[`multi-types.js format 1`] = `
====================================options=====================================
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
import json from "./foo.json" with { type: "json", type: "bar" };
=====================================output=====================================
import json from "./foo.json" with { type: "json", type: "bar" };
================================================================================
`;
exports[`non-type.js [acorn] format 1`] = `
"Unexpected token (1:28)
> 1 | import foo from "foo.json" with { lazy: "true" };
| ^
2 |"
`;
exports[`non-type.js [espree] format 1`] = `
"Unexpected token with (1:28)
> 1 | import foo from "foo.json" with { lazy: "true" };
| ^
2 |"
`;
exports[`non-type.js [meriyah] format 1`] = `
"Unexpected token: 'with' (1:31)
> 1 | import foo from "foo.json" with { lazy: "true" };
| ^
2 |"
`;
exports[`non-type.js [typescript] format 1`] = `
"';' expected. (1:28)
> 1 | import foo from "foo.json" with { lazy: "true" };
| ^
2 |"
`;
exports[`non-type.js format 1`] = `
====================================options=====================================
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
import foo from "foo.json" with { lazy: "true" };
=====================================output=====================================
import foo from "foo.json" with { lazy: "true" };
================================================================================
`;
exports[`re-export.js [acorn] format 1`] = `
"Unexpected token (1:44)
> 1 | export { default as foo2 } from "foo.json" with { type: "json" };
| ^
2 | export * from "foo.json" with { type: "json" };
3 | export * as foo3 from "foo.json" with { type: "json" };
4 |"
`;
exports[`re-export.js [espree] format 1`] = `
"Unexpected token with (1:44)
> 1 | export { default as foo2 } from "foo.json" with { type: "json" };
| ^
2 | export * from "foo.json" with { type: "json" };
3 | export * as foo3 from "foo.json" with { type: "json" };
4 |"
`;
exports[`re-export.js [meriyah] format 1`] = `
"Unexpected token: 'with' (1:47)
> 1 | export { default as foo2 } from "foo.json" with { type: "json" };
| ^
2 | export * from "foo.json" with { type: "json" };
3 | export * as foo3 from "foo.json" with { type: "json" };
4 |"
`;
exports[`re-export.js [typescript] format 1`] = `
"';' expected. (1:44)
> 1 | export { default as foo2 } from "foo.json" with { type: "json" };
| ^
2 | export * from "foo.json" with { type: "json" };
3 | export * as foo3 from "foo.json" with { type: "json" };
4 |"
`;
exports[`re-export.js format 1`] = `
====================================options=====================================
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
export { default as foo2 } from "foo.json" with { type: "json" };
export * from "foo.json" with { type: "json" };
export * as foo3 from "foo.json" with { type: "json" };
=====================================output=====================================
export { default as foo2 } from "foo.json" with { type: "json" };
export * from "foo.json" with { type: "json" };
export * as foo3 from "foo.json" with { type: "json" };
================================================================================
`;
exports[`static-import.js [acorn] format 1`] = `
"Unexpected token (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`static-import.js [espree] format 1`] = `
"Unexpected token with (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`static-import.js [meriyah] format 1`] = `
"Unexpected token: 'with' (1:34)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`static-import.js [typescript] format 1`] = `
"';' expected. (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`static-import.js format 1`] = `
====================================options=====================================
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
import json from "./foo.json" with { type: "json" };
=====================================output=====================================
import json from "./foo.json" with { type: "json" };
================================================================================
`;
exports[`without-from.js [acorn] format 1`] = `
"Unexpected token (1:14)
> 1 | import "foo" with { type: "json" }
| ^
2 |"
`;
exports[`without-from.js [espree] format 1`] = `
"Unexpected token with (1:14)
> 1 | import "foo" with { type: "json" }
| ^
2 |"
`;
exports[`without-from.js [meriyah] format 1`] = `
"Unexpected token: 'with' (1:17)
> 1 | import "foo" with { type: "json" }
| ^
2 |"
`;
exports[`without-from.js [typescript] format 1`] = `
"';' expected. (1:14)
> 1 | import "foo" with { type: "json" }
| ^
2 |"
`;
exports[`without-from.js format 1`] = `
====================================options=====================================
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
import "foo" with { type: "json" }
=====================================output=====================================
import "foo" with { type: "json" };
================================================================================
`;
@@ -0,0 +1,141 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`dynamic-import.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Unexpected token (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
2 |"
`;
exports[`dynamic-import.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token , (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
2 |"
`;
exports[`dynamic-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"Expected ')' (1:20)
> 1 | import("./foo.json", { with: { type: "json" } });
| ^
2 |"
`;
exports[`dynamic-import.js - {"bracketSpacing":false} format 1`] = `
====================================options=====================================
bracketSpacing: false
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
import("./foo.json", { with: { type: "json" } });
=====================================output=====================================
import("./foo.json", {with: {type: "json"}});
================================================================================
`;
exports[`empty.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Unexpected token (1:33)
> 1 | export * as bar from "bar.json" with { }
| ^"
`;
exports[`empty.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token with (1:33)
> 1 | export * as bar from "bar.json" with { }
| ^"
`;
exports[`empty.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"Unexpected token: 'with' (1:36)
> 1 | export * as bar from "bar.json" with { }
| ^"
`;
exports[`empty.js - {"bracketSpacing":false} format 1`] = `
====================================options=====================================
bracketSpacing: false
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
export * as bar from "bar.json" with { }
=====================================output=====================================
export * as bar from "bar.json";
================================================================================
`;
exports[`re-export.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Unexpected token (1:44)
> 1 | export { default as foo2 } from "foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`re-export.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token with (1:44)
> 1 | export { default as foo2 } from "foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`re-export.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"Unexpected token: 'with' (1:47)
> 1 | export { default as foo2 } from "foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`re-export.js - {"bracketSpacing":false} format 1`] = `
====================================options=====================================
bracketSpacing: false
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
export { default as foo2 } from "foo.json" with { type: "json" };
=====================================output=====================================
export {default as foo2} from "foo.json" with {type: "json"};
================================================================================
`;
exports[`static-import.js - {"bracketSpacing":false} [acorn] format 1`] = `
"Unexpected token (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`static-import.js - {"bracketSpacing":false} [espree] format 1`] = `
"Unexpected token with (1:31)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`static-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
"Unexpected token: 'with' (1:34)
> 1 | import json from "./foo.json" with { type: "json" };
| ^
2 |"
`;
exports[`static-import.js - {"bracketSpacing":false} format 1`] = `
====================================options=====================================
bracketSpacing: false
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
import json from "./foo.json" with { type: "json" };
=====================================output=====================================
import json from "./foo.json" with {type: "json"};
================================================================================
`;
@@ -0,0 +1 @@
import("./foo.json", { with: { type: "json" } });
@@ -0,0 +1 @@
export * as bar from "bar.json" with { }
@@ -0,0 +1,23 @@
run_spec(import.meta, ["babel"], {
bracketSpacing: false,
errors: {
acorn: [
"dynamic-import.js",
"static-import.js",
"re-export.js",
"empty.js",
],
espree: [
"dynamic-import.js",
"static-import.js",
"re-export.js",
"empty.js",
],
meriyah: [
"dynamic-import.js",
"static-import.js",
"re-export.js",
"empty.js",
],
},
});
@@ -0,0 +1 @@
export { default as foo2 } from "foo.json" with { type: "json" };
@@ -0,0 +1 @@
import json from "./foo.json" with { type: "json" };
@@ -0,0 +1 @@
import("./foo.json", { with: { type: "json" } });
@@ -0,0 +1,7 @@
export * as foo from "foo.json"
export * as bar from "bar.json" with { }
export * as baz from "baz.json" with { /* comment */ }
import * as foo from "foo.json"
import * as bar from "bar.json" with { }
import * as baz from "baz.json" with { /* comment */ }
@@ -0,0 +1,39 @@
run_spec(import.meta, ["babel", "typescript"], {
errors: {
acorn: [
"dynamic-import.js",
"empty.js",
"multi-types.js",
"static-import.js",
"re-export.js",
"without-from.js",
"non-type.js",
],
espree: [
"dynamic-import.js",
"empty.js",
"multi-types.js",
"static-import.js",
"re-export.js",
"without-from.js",
"non-type.js",
],
meriyah: [
"dynamic-import.js",
"empty.js",
"multi-types.js",
"static-import.js",
"re-export.js",
"without-from.js",
"non-type.js",
],
typescript: [
"empty.js",
"multi-types.js",
"static-import.js",
"re-export.js",
"without-from.js",
"non-type.js",
],
},
});
@@ -0,0 +1 @@
import json from "./foo.json" with { type: "json", type: "bar" };
@@ -0,0 +1 @@
import foo from "foo.json" with { lazy: "true" };
@@ -0,0 +1,3 @@
export { default as foo2 } from "foo.json" with { type: "json" };
export * from "foo.json" with { type: "json" };
export * as foo3 from "foo.json" with { type: "json" };
@@ -0,0 +1 @@
import json from "./foo.json" with { type: "json" };
@@ -0,0 +1 @@
import "foo" with { type: "json" }
@@ -25,6 +25,20 @@ exports[`import-assertions-with-parens.js [babel] format 1`] = `
2 |" 2 |"
`; `;
exports[`import-attributes-for-export-without-from.js [babel] format 1`] = `
"Unexpected token, expected "(" (1:32)
> 1 | export { default as foo } with { type: "json" };
| ^
2 |"
`;
exports[`import-attributes-with-parens.js [babel] format 1`] = `
"Unexpected token, expected "{" (1:17)
> 1 | import "x" with ({type: 'json'});
| ^
2 |"
`;
exports[`invalid-escape-in-identifier.js [babel] format 1`] = ` exports[`invalid-escape-in-identifier.js [babel] format 1`] = `
"Invalid Unicode escape. (1:7) "Invalid Unicode escape. (1:7)
> 1 | const \\u{20} = 1 > 1 | const \\u{20} = 1
@@ -1,12 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`invalid-assertions.mjs [babel] format 1`] = `
"\`import module x\` cannot have assertions. (1:15)
> 1 | import module foo from "./module.json" assert { type: "json" }
| ^
2 |"
`;
exports[`invalid-default-named-import.mjs [babel] format 1`] = ` exports[`invalid-default-named-import.mjs [babel] format 1`] = `
"Only \`import module x from "./module"\` is valid. (1:15) "Only \`import module x from "./module"\` is valid. (1:15)
> 1 | import module foo, {bar} from "./module.wasm"; > 1 | import module foo, {bar} from "./module.wasm";
@@ -1 +0,0 @@
import module foo from "./module.json" assert { type: "json" }
@@ -0,0 +1 @@
export { default as foo } with { type: "json" };
@@ -0,0 +1 @@
import "x" with ({type: 'json'});
@@ -263,8 +263,9 @@ exports[`visitor keys estree 1`] = `
], ],
"ExportAllDeclaration": [ "ExportAllDeclaration": [
"source", "source",
"exported", "attributes",
"assertions", "assertions",
"exported",
], ],
"ExportDefaultDeclaration": [ "ExportDefaultDeclaration": [
"declaration", "declaration",
@@ -276,6 +277,7 @@ exports[`visitor keys estree 1`] = `
"declaration", "declaration",
"specifiers", "specifiers",
"source", "source",
"attributes",
"assertions", "assertions",
], ],
"ExportNamespaceSpecifier": [ "ExportNamespaceSpecifier": [
@@ -354,6 +356,7 @@ exports[`visitor keys estree 1`] = `
"ImportDeclaration": [ "ImportDeclaration": [
"specifiers", "specifiers",
"source", "source",
"attributes",
"assertions", "assertions",
], ],
"ImportDefaultSpecifier": [ "ImportDefaultSpecifier": [
+10 -10
View File
@@ -230,12 +230,12 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@babel/parser@npm:7.22.3, @babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.5, @babel/parser@npm:^7.21.8": "@babel/parser@npm:7.22.4, @babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.5, @babel/parser@npm:^7.21.8":
version: 7.22.3 version: 7.22.4
resolution: "@babel/parser@npm:7.22.3" resolution: "@babel/parser@npm:7.22.4"
bin: bin:
parser: ./bin/babel-parser.js parser: ./bin/babel-parser.js
checksum: 016f2960212fd86817e15d90b9b3450d2b51af189b1c17a20ade5735d9ec69e76e29def317e09188ecd5fa6eab4f9ab72d88b8b829c1b2994400a6a2c2dc1958 checksum: 0ca6d3a2d9aae2504ba1bc494704b64a83140884f7379f609de69bd39b60adb58a4f8ec692fe53fef8657dd82705d01b7e6efb65e18296326bdd66f71d52d9a9
languageName: node languageName: node
linkType: hard linkType: hard
@@ -422,14 +422,14 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@babel/types@npm:7.22.3, @babel/types@npm:^7.0.0, @babel/types@npm:^7.18.6, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.0, @babel/types@npm:^7.21.4, @babel/types@npm:^7.21.5, @babel/types@npm:^7.22.3, @babel/types@npm:^7.3.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.8.3": "@babel/types@npm:7.22.4, @babel/types@npm:^7.0.0, @babel/types@npm:^7.18.6, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.0, @babel/types@npm:^7.21.4, @babel/types@npm:^7.21.5, @babel/types@npm:^7.22.3, @babel/types@npm:^7.3.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.8.3":
version: 7.22.3 version: 7.22.4
resolution: "@babel/types@npm:7.22.3" resolution: "@babel/types@npm:7.22.4"
dependencies: dependencies:
"@babel/helper-string-parser": ^7.21.5 "@babel/helper-string-parser": ^7.21.5
"@babel/helper-validator-identifier": ^7.19.1 "@babel/helper-validator-identifier": ^7.19.1
to-fast-properties: ^2.0.0 to-fast-properties: ^2.0.0
checksum: 6111fa5990635dfba8812a84bb4889429feb41a2c03c89de2654724e88a85b5740d4795c64a480d188d2f7109e7b47f3f0ba3d56da1b697cd31c65922f4decf7 checksum: ffe36bb4f4a99ad13c426a98c3b508d70736036cae4e471d9c862e3a579847ed4f480686af0fce2633f6f7c0f0d3bf02da73da36e7edd3fde0b2061951dcba9a
languageName: node languageName: node
linkType: hard linkType: hard
@@ -6784,8 +6784,8 @@ __metadata:
"@angular/compiler": 16.0.3 "@angular/compiler": 16.0.3
"@babel/code-frame": 7.21.4 "@babel/code-frame": 7.21.4
"@babel/generator": 7.22.3 "@babel/generator": 7.22.3
"@babel/parser": 7.22.3 "@babel/parser": 7.22.4
"@babel/types": 7.22.3 "@babel/types": 7.22.4
"@esbuild-plugins/node-modules-polyfill": 0.2.2 "@esbuild-plugins/node-modules-polyfill": 0.2.2
"@glimmer/reference": 0.84.3 "@glimmer/reference": 0.84.3
"@glimmer/syntax": 0.84.3 "@glimmer/syntax": 0.84.3