diff --git a/package-lock.json b/package-lock.json index 101c6a5f..2adf5272 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@mapbox/node-pre-gyp": "^1.0.5", "@rollup/pluginutils": "^4.0.0", "acorn": "^8.6.0", - "acorn-import-attributes": "^1.9.2", + "acorn-import-attributes": "^1.9.5", "async-sema": "^3.1.1", "bindings": "^1.4.0", "estree-walker": "2.0.2", @@ -5766,9 +5766,9 @@ } }, "node_modules/acorn-import-attributes": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.2.tgz", - "integrity": "sha512-O+nfJwNolEA771IYJaiLWK1UAwjNsQmZbTRqqwBYxCgVQTmpFEMvBw6LOIQV0Me339L5UMVYFyRohGnGlQDdIQ==", + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", + "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", "peerDependencies": { "acorn": "^8" } diff --git a/package.json b/package.json index d8c1b8f7..d3cc9433 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@mapbox/node-pre-gyp": "^1.0.5", "@rollup/pluginutils": "^4.0.0", "acorn": "^8.6.0", - "acorn-import-attributes": "^1.9.2", + "acorn-import-attributes": "^1.9.5", "async-sema": "^3.1.1", "bindings": "^1.4.0", "estree-walker": "2.0.2", diff --git a/src/analyze.ts b/src/analyze.ts index 39150d14..4af46c71 100644 --- a/src/analyze.ts +++ b/src/analyze.ts @@ -33,7 +33,7 @@ const acorn = Parser.extend( //require("acorn-class-fields"), //require("acorn-static-class-features"), //require("acorn-private-class-elements") - require('acorn-import-attributes').importAttributes, + require('acorn-import-attributes').importAttributesOrAssertions, ); import os from 'os'; diff --git a/test/unit/import-assertions/foo.js b/test/unit/import-assertions/foo.js new file mode 100644 index 00000000..e69de29b diff --git a/test/unit/import-assertions/info.json b/test/unit/import-assertions/info.json new file mode 100644 index 00000000..b42f309e --- /dev/null +++ b/test/unit/import-assertions/info.json @@ -0,0 +1,3 @@ +{ + "foo": "bar" +} \ No newline at end of file diff --git a/test/unit/import-assertions/input.js b/test/unit/import-assertions/input.js new file mode 100644 index 00000000..63895fd5 --- /dev/null +++ b/test/unit/import-assertions/input.js @@ -0,0 +1,4 @@ +import foo from "./foo" +import info from "./info.json" assert { type: "json" } + +export default info \ No newline at end of file diff --git a/test/unit/import-assertions/output.js b/test/unit/import-assertions/output.js new file mode 100644 index 00000000..31bc9583 --- /dev/null +++ b/test/unit/import-assertions/output.js @@ -0,0 +1,6 @@ +[ + "package.json", + "test/unit/import-assertions/foo.js", + "test/unit/import-assertions/info.json", + "test/unit/import-assertions/input.js" +]