diff --git a/babel.config.json b/babel.config.json index 7c6968e..7503dc8 100644 --- a/babel.config.json +++ b/babel.config.json @@ -1,6 +1,6 @@ { "plugins": [ - "@babel/plugin-syntax-import-assertions", + "@babel/plugin-syntax-import-attributes", "@babel/plugin-transform-flow-strip-types" ] } diff --git a/package-lock.json b/package-lock.json index 94f7611..b145736 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "": { "devDependencies": { "@babel/eslint-parser": "7.23.10", - "@babel/plugin-syntax-import-assertions": "7.23.3", + "@babel/plugin-syntax-import-attributes": "7.23.3", "@babel/plugin-transform-flow-strip-types": "7.23.3", "@typescript-eslint/parser": "6.21.0", "@vitest/coverage-v8": "^1.2.2", @@ -338,10 +338,10 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-import-assertions": { + "node_modules/@babel/plugin-syntax-import-attributes": { "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.23.3.tgz", - "integrity": "sha512-lPgDSU+SJLK3xmFDTV2ZRQAiM7UuUjGidwBywFavObCiZc1BeAAcMtHJKUya92hPHO+at63JJPLygilZard8jw==", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.23.3.tgz", + "integrity": "sha512-pawnE0P9g10xgoP7yKr6CK63K2FMsTE+FZidZO/1PwRdzmAPVs+HS1mAURUsgaoxammTJvULUdIkEK0gOcU2tA==", "dev": true, "dependencies": { "@babel/helper-plugin-utils": "^7.22.5" diff --git a/package.json b/package.json index 62e897c..1afe188 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "@babel/eslint-parser": "7.23.10", - "@babel/plugin-syntax-import-assertions": "7.23.3", + "@babel/plugin-syntax-import-attributes": "7.23.3", "@babel/plugin-transform-flow-strip-types": "7.23.3", "@typescript-eslint/parser": "6.21.0", "@vitest/coverage-v8": "^1.2.2", diff --git a/test/imports.test.js b/test/imports.test.js index 4073b0d..c37771d 100644 --- a/test/imports.test.js +++ b/test/imports.test.js @@ -1584,7 +1584,7 @@ const flowTests = { `import type a, {b} from "a"`, `import type {} from "a"`, `import type { } from "a"`, - `import json from "./foo.json" assert { type: "json" };`, + `import json from "./foo.json" with { type: "json" };`, // typeof `import typeof a from "a"`, @@ -1681,11 +1681,11 @@ const flowTests = { errors: 1, }, - // Import assertions. + // Import attributes. { code: input` - |import json from "./foo.json" assert { type: "json" }; - |import {default as b} from "./bar.json" assert { + |import json from "./foo.json" with { type: "json" }; + |import {default as b} from "./bar.json" with { | // json | type: "json", | a: "b", @@ -1695,12 +1695,12 @@ const flowTests = { `, output: (actual) => { expect(actual).toMatchInlineSnapshot(` - |import {default as b} from "./bar.json" assert { + |import {default as b} from "./bar.json" with { | // json | type: "json", | a: "b", |} /* bar */ - |import json from "./foo.json" assert { type: "json" };/* end + |import json from "./foo.json" with { type: "json" };/* end | comment */ |;[].forEach() `); @@ -1977,11 +1977,11 @@ const typescriptTests = { errors: 1, }, - // Import assertions. + // Import attributes. { code: input` - |import json from "./foo.json" assert { type: "json" }; - |import {b, a} from "./bar.json" assert { + |import json from "./foo.json" with { type: "json" }; + |import {b, a} from "./bar.json" with { | // json | type: "json", | a: "b", @@ -1991,12 +1991,12 @@ const typescriptTests = { `, output: (actual) => { expect(actual).toMatchInlineSnapshot(` - |import {a,b} from "./bar.json" assert { + |import {a,b} from "./bar.json" with { | // json | type: "json", | a: "b", |} /* bar */ - |import json from "./foo.json" assert { type: "json" };/* end + |import json from "./foo.json" with { type: "json" };/* end | comment */ |;[].forEach() `);