From 2fd422278bfad826d601795670004f9d6da72ef7 Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Tue, 29 Oct 2024 18:49:32 +0900 Subject: [PATCH] feat: add support for Import Attributes and RegExp Modifiers (#639) * feat: add support for import attributes and RegExp modifiers * test: fix test case * test: add test case to eslint-scope --- .../eslint-scope/tests/import-attributes.js | 185 + .../eslint-visitor-keys/lib/visitor-keys.js | 16 +- packages/espree/package.json | 2 +- ...-attributes-with-dupe-key.module-result.js | 6 + ...-import-attributes-with-dupe-key.result.js | 6 + ...lid-import-attributes-with-dupe-key.src.js | 1 + ...mic-with-multiple-trailing-comma.result.js | 6 + ...ynamic-with-multiple-trailing-comma.src.js | 1 + ...h-multiple-trailing-comma.module-result.js | 6 + ...tes-with-multiple-trailing-comma.result.js | 6 + ...ibutes-with-multiple-trailing-comma.src.js | 1 + ...ttributes-with-number-key.module-result.js | 6 + ...mport-attributes-with-number-key.result.js | 6 + ...d-import-attributes-with-number-key.src.js | 1 + ...ributes-with-number-value.module-result.js | 6 + ...ort-attributes-with-number-value.result.js | 6 + ...import-attributes-with-number-value.src.js | 1 + .../valid-import-attributes.module-result.js | 4157 +++++++++++++++++ .../valid-import-attributes.result.js | 6 + .../valid-import-attributes.src.js | 12 + ...nvalid-regexp-dupe-add-modifiers.result.js | 6 + .../invalid-regexp-dupe-add-modifiers.src.js | 1 + .../invalid-regexp-dupe-modifiers.result.js | 6 + .../invalid-regexp-dupe-modifiers.src.js | 1 + ...lid-regexp-dupe-remove-modifiers.result.js | 6 + ...nvalid-regexp-dupe-remove-modifiers.src.js | 1 + .../invalid-regexp-empty-modifiers.result.js | 6 + .../invalid-regexp-empty-modifiers.src.js | 1 + ...invalid-regexp-unknown-modifiers.result.js | 6 + .../invalid-regexp-unknown-modifiers.src.js | 1 + .../valid-regexp-modifiers.result.js | 424 ++ .../valid-regexp-modifiers.src.js | 5 + 32 files changed, 4896 insertions(+), 5 deletions(-) create mode 100644 packages/eslint-scope/tests/import-attributes.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.module-result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.src.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.src.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.module-result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.src.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.module-result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.src.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.module-result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.src.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.module-result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.src.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.src.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.src.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.src.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.src.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.src.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.result.js create mode 100644 packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.src.js diff --git a/packages/eslint-scope/tests/import-attributes.js b/packages/eslint-scope/tests/import-attributes.js new file mode 100644 index 00000000..b76cfb77 --- /dev/null +++ b/packages/eslint-scope/tests/import-attributes.js @@ -0,0 +1,185 @@ +/** + * @fileoverview Tests for ES2025 Import Attributes. + * @author Yosuke Ota + */ + +import assert from "node:assert"; +import * as espree from "espree"; +import { KEYS } from "eslint-visitor-keys"; +import { analyze } from "../lib/index.js"; + +describe("Import Attributes", () => { + + describe("const type = \"json\"; import pkg from \"./package.json\" with { type: \"json\" };", () => { + let ast; + let scopeManager; + let globalScope; + + beforeEach(() => { + ast = espree.parse("const type = \"json\"; import pkg from \"./package.json\" with { type: \"json\" };", { ecmaVersion: 16, sourceType: "module" }); + scopeManager = analyze(ast, { ecmaVersion: 16, sourceType: "module", childVisitorKeys: KEYS }); + ({ globalScope } = scopeManager); + }); + + it("the global scope should not have any variables", () => { + assert.strictEqual(globalScope.variables.length, 0); + }); + + it("the global scope should have one child scope, a module scope", () => { + assert.strictEqual(globalScope.childScopes.length, 1); + assert.strictEqual(globalScope.childScopes[0].type, "module"); + }); + + it("the module scope should not have any child scopes", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.childScopes.length, 0); + }); + + it("the module scope should have two variables", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.variables.length, 2); + assert.strictEqual(moduleScope.variables[0].name, "type"); + assert.strictEqual(moduleScope.variables[1].name, "pkg"); + }); + + it("the type variable should have one reference, a variable declaration", () => { + const moduleScope = globalScope.childScopes[0]; + const typeVariable = moduleScope.variables[0]; + + assert.strictEqual(typeVariable.references.length, 1); + assert.strictEqual(typeVariable.references[0].identifier, ast.body[0].declarations[0].id); + }); + }); + + describe("const type = \"json\"; export * from \"./package.json\" with { type: \"json\" };", () => { + let ast; + let scopeManager; + let globalScope; + + beforeEach(() => { + ast = espree.parse("const type = \"json\"; export * from \"./package.json\" with { type: \"json\" };", { ecmaVersion: 16, sourceType: "module" }); + scopeManager = analyze(ast, { ecmaVersion: 16, sourceType: "module", childVisitorKeys: KEYS }); + ({ globalScope } = scopeManager); + }); + + it("the global scope should not have any variables", () => { + assert.strictEqual(globalScope.variables.length, 0); + }); + + it("the global scope should have one child scope, a module scope", () => { + assert.strictEqual(globalScope.childScopes.length, 1); + assert.strictEqual(globalScope.childScopes[0].type, "module"); + }); + + it("the module scope should not have any child scopes", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.childScopes.length, 0); + }); + + it("the module scope should have one variable, a type variable", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.variables.length, 1); + assert.strictEqual(moduleScope.variables[0].name, "type"); + }); + + it("the type variable should have one reference, a variable declaration", () => { + const moduleScope = globalScope.childScopes[0]; + const typeVariable = moduleScope.variables[0]; + + assert.strictEqual(typeVariable.references.length, 1); + assert.strictEqual(typeVariable.references[0].identifier, ast.body[0].declarations[0].id); + }); + }); + + + describe("const type = \"json\"; export { default } from \"./package.json\" with { type: \"json\" };", () => { + let ast; + let scopeManager; + let globalScope; + + beforeEach(() => { + ast = espree.parse("const type = \"json\"; export { default } from \"./package.json\" with { type: \"json\" };", { ecmaVersion: 16, sourceType: "module" }); + scopeManager = analyze(ast, { ecmaVersion: 16, sourceType: "module", childVisitorKeys: KEYS }); + ({ globalScope } = scopeManager); + }); + + it("the global scope should not have any variables", () => { + assert.strictEqual(globalScope.variables.length, 0); + }); + + it("the global scope should have one child scope, a module scope", () => { + assert.strictEqual(globalScope.childScopes.length, 1); + assert.strictEqual(globalScope.childScopes[0].type, "module"); + }); + + it("the module scope should not have any child scopes", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.childScopes.length, 0); + }); + + it("the module scope should have one variable, a type variable", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.variables.length, 1); + assert.strictEqual(moduleScope.variables[0].name, "type"); + }); + + it("the type variable should have one reference, a variable declaration", () => { + const moduleScope = globalScope.childScopes[0]; + const typeVariable = moduleScope.variables[0]; + + assert.strictEqual(typeVariable.references.length, 1); + assert.strictEqual(typeVariable.references[0].identifier, ast.body[0].declarations[0].id); + }); + }); + + + describe("const type = \"json\"; import(\"./package.json\", { with: { type } });", () => { + let ast; + let scopeManager; + let globalScope; + + beforeEach(() => { + ast = espree.parse("const type = \"json\"; import(\"./package.json\", { with: { type } });", { ecmaVersion: 16, sourceType: "module" }); + scopeManager = analyze(ast, { ecmaVersion: 16, sourceType: "module", childVisitorKeys: KEYS }); + ({ globalScope } = scopeManager); + }); + + it("the global scope should not have any variables", () => { + assert.strictEqual(globalScope.variables.length, 0); + }); + + it("the global scope should have one child scope, a module scope", () => { + assert.strictEqual(globalScope.childScopes.length, 1); + assert.strictEqual(globalScope.childScopes[0].type, "module"); + }); + + it("the module scope should not have any child scopes", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.childScopes.length, 0); + }); + + it("the module scope should have one variable, a type variable", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.variables.length, 1); + assert.strictEqual(moduleScope.variables[0].name, "type"); + }); + + + it("the type variable should have two references, a variable declaration and import options", () => { + const moduleScope = globalScope.childScopes[0]; + const typeVariable = moduleScope.variables[0]; + + assert.strictEqual(typeVariable.references.length, 2); + assert.strictEqual(typeVariable.references[0].identifier, ast.body[0].declarations[0].id); + assert.strictEqual(typeVariable.references[1].identifier, ast.body[1].expression.options.properties[0].value.properties[0].value); + }); + }); +}); diff --git a/packages/eslint-visitor-keys/lib/visitor-keys.js b/packages/eslint-visitor-keys/lib/visitor-keys.js index f54a3474..41feb4b2 100644 --- a/packages/eslint-visitor-keys/lib/visitor-keys.js +++ b/packages/eslint-visitor-keys/lib/visitor-keys.js @@ -87,7 +87,8 @@ const KEYS = { ], ExportAllDeclaration: [ "exported", - "source" + "source", + "attributes" ], ExportDefaultDeclaration: [ "declaration" @@ -95,7 +96,8 @@ const KEYS = { ExportNamedDeclaration: [ "declaration", "specifiers", - "source" + "source", + "attributes" ], ExportSpecifier: [ "exported", @@ -136,15 +138,21 @@ const KEYS = { "consequent", "alternate" ], + ImportAttribute: [ + "key", + "value" + ], ImportDeclaration: [ "specifiers", - "source" + "source", + "attributes" ], ImportDefaultSpecifier: [ "local" ], ImportExpression: [ - "source" + "source", + "options" ], ImportNamespaceSpecifier: [ "local" diff --git a/packages/espree/package.json b/packages/espree/package.json index 17d075d0..f8db9429 100644 --- a/packages/espree/package.json +++ b/packages/espree/package.json @@ -32,7 +32,7 @@ "funding": "https://opencollective.com/eslint", "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.12.0", + "acorn": "^8.14.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^4.1.0" }, diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.module-result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.module-result.js new file mode 100644 index 00000000..d325af7b --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Duplicate attribute key 'type'" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.result.js new file mode 100644 index 00000000..521323ed --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.result.js @@ -0,0 +1,6 @@ +export default { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "'import' and 'export' may appear only with 'sourceType: module'" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.src.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.src.js new file mode 100644 index 00000000..b0e54b16 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.src.js @@ -0,0 +1 @@ +import "./foo.json" with { type: "json", type: "html" }; diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.result.js new file mode 100644 index 00000000..094f16ff --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.result.js @@ -0,0 +1,6 @@ +export default { + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.src.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.src.js new file mode 100644 index 00000000..497bf31e --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.src.js @@ -0,0 +1 @@ +import("foo.json", , ); diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.module-result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.module-result.js new file mode 100644 index 00000000..7e321e96 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.result.js new file mode 100644 index 00000000..521323ed --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.result.js @@ -0,0 +1,6 @@ +export default { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "'import' and 'export' may appear only with 'sourceType: module'" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.src.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.src.js new file mode 100644 index 00000000..829b2008 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.src.js @@ -0,0 +1 @@ +import "./foo.json" with { type: "json", , }; diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.module-result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.module-result.js new file mode 100644 index 00000000..857f4294 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 27, + "lineNumber": 1, + "column": 28, + "message": "Unexpected token 42" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.result.js new file mode 100644 index 00000000..521323ed --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.result.js @@ -0,0 +1,6 @@ +export default { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "'import' and 'export' may appear only with 'sourceType: module'" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.src.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.src.js new file mode 100644 index 00000000..e027bc72 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.src.js @@ -0,0 +1 @@ +import "./foo.json" with { 42: "s" }; diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.module-result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.module-result.js new file mode 100644 index 00000000..93a8baf7 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 33, + "lineNumber": 1, + "column": 34, + "message": "Unexpected token 42" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.result.js new file mode 100644 index 00000000..521323ed --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.result.js @@ -0,0 +1,6 @@ +export default { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "'import' and 'export' may appear only with 'sourceType: module'" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.src.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.src.js new file mode 100644 index 00000000..24a34555 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.src.js @@ -0,0 +1 @@ +import "./foo.json" with { type: 42 }; diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.module-result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.module-result.js new file mode 100644 index 00000000..afabbb96 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.module-result.js @@ -0,0 +1,4157 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 46 + } + }, + "range": [ + 0, + 670 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 0, + 52 + ], + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 7, + 11 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 7, + 11 + ], + "name": "json" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 17, + 29 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "range": [ + 37, + 49 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 37, + 41 + ], + "name": "type" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "range": [ + 43, + 49 + ], + "value": "json", + "raw": "\"json\"" + } + } + ] + }, + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "range": [ + 53, + 95 + ], + "specifiers": [], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "range": [ + 60, + 72 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "range": [ + 80, + 92 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "range": [ + 80, + 84 + ], + "name": "type" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "range": [ + 86, + 92 + ], + "value": "json", + "raw": "\"json\"" + } + } + ] + }, + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 51 + } + }, + "range": [ + 96, + 147 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 104, + 105 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 104, + 105 + ], + "name": "v" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 104, + 105 + ], + "name": "v" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "range": [ + 112, + 124 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 48 + } + }, + "range": [ + 132, + 144 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 40 + } + }, + "range": [ + 132, + 136 + ], + "name": "type" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 3, + "column": 42 + }, + "end": { + "line": 3, + "column": 48 + } + }, + "range": [ + 138, + 144 + ], + "value": "json", + "raw": "\"json\"" + } + } + ] + }, + { + "type": "ExportAllDeclaration", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 57 + } + }, + "range": [ + 148, + 205 + ], + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "range": [ + 160, + 164 + ], + "name": "json" + }, + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 34 + } + }, + "range": [ + 170, + 182 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 4, + "column": 42 + }, + "end": { + "line": 4, + "column": 54 + } + }, + "range": [ + 190, + 202 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 4, + "column": 42 + }, + "end": { + "line": 4, + "column": 46 + } + }, + "range": [ + 190, + 194 + ], + "name": "type" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 4, + "column": 48 + }, + "end": { + "line": 4, + "column": 54 + } + }, + "range": [ + 196, + 202 + ], + "value": "json", + "raw": "\"json\"" + } + } + ] + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 57 + } + }, + "range": [ + 206, + 263 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 56 + } + }, + "range": [ + 212, + 262 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + }, + "range": [ + 212, + 213 + ], + "name": "a" + }, + "init": { + "type": "ImportExpression", + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 56 + } + }, + "range": [ + 216, + 262 + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 27 + } + }, + "range": [ + 223, + 233 + ], + "value": "foo.json", + "raw": "\"foo.json\"" + }, + "options": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 55 + } + }, + "range": [ + 235, + 261 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 53 + } + }, + "range": [ + 237, + 259 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 35 + } + }, + "range": [ + 237, + 241 + ], + "name": "with" + }, + "value": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 5, + "column": 53 + } + }, + "range": [ + 243, + 259 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 51 + } + }, + "range": [ + 245, + 257 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 43 + } + }, + "range": [ + 245, + 249 + ], + "name": "type" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 5, + "column": 45 + }, + "end": { + "line": 5, + "column": 51 + } + }, + "range": [ + 251, + 257 + ], + "value": "json", + "raw": "\"json\"" + }, + "kind": "init" + } + ] + }, + "kind": "init" + } + ] + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 31 + } + }, + "range": [ + 264, + 295 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 30 + } + }, + "range": [ + 270, + 294 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 270, + 271 + ], + "name": "b" + }, + "init": { + "type": "ImportExpression", + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 30 + } + }, + "range": [ + 274, + 294 + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 27 + } + }, + "range": [ + 281, + 291 + ], + "value": "foo.json", + "raw": "\"foo.json\"" + }, + "options": null + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 59 + } + }, + "range": [ + 320, + 379 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 58 + } + }, + "range": [ + 326, + 378 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 326, + 327 + ], + "name": "c" + }, + "init": { + "type": "ImportExpression", + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 58 + } + }, + "range": [ + 330, + 378 + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 27 + } + }, + "range": [ + 337, + 347 + ], + "value": "foo.json", + "raw": "\"foo.json\"" + }, + "options": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 7, + "column": 29 + }, + "end": { + "line": 7, + "column": 55 + } + }, + "range": [ + 349, + 375 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 53 + } + }, + "range": [ + 351, + 373 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 35 + } + }, + "range": [ + 351, + 355 + ], + "name": "with" + }, + "value": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 7, + "column": 37 + }, + "end": { + "line": 7, + "column": 53 + } + }, + "range": [ + 357, + 373 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 7, + "column": 39 + }, + "end": { + "line": 7, + "column": 51 + } + }, + "range": [ + 359, + 371 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 39 + }, + "end": { + "line": 7, + "column": 43 + } + }, + "range": [ + 359, + 363 + ], + "name": "type" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 7, + "column": 45 + }, + "end": { + "line": 7, + "column": 51 + } + }, + "range": [ + 365, + 371 + ], + "value": "json", + "raw": "\"json\"" + }, + "kind": "init" + } + ] + }, + "kind": "init" + } + ] + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 35 + } + }, + "range": [ + 380, + 415 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 34 + } + }, + "range": [ + 386, + 414 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "range": [ + 386, + 387 + ], + "name": "d" + }, + "init": { + "type": "ImportExpression", + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 34 + } + }, + "range": [ + 390, + 414 + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 27 + } + }, + "range": [ + 397, + 407 + ], + "value": "foo.json", + "raw": "\"foo.json\"" + }, + "options": { + "type": "Identifier", + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 32 + } + }, + "range": [ + 409, + 412 + ], + "name": "foo" + } + } + } + ], + "kind": "const" + }, + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 40 + } + }, + "range": [ + 416, + 456 + ], + "specifiers": [], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 19 + } + }, + "range": [ + 423, + 435 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 37 + } + }, + "range": [ + 443, + 453 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 30 + } + }, + "range": [ + 443, + 446 + ], + "name": "foo" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 9, + "column": 32 + }, + "end": { + "line": 9, + "column": 37 + } + }, + "range": [ + 448, + 453 + ], + "value": "bar", + "raw": "\"bar\"" + } + } + ] + }, + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 44 + } + }, + "range": [ + 485, + 529 + ], + "specifiers": [], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 19 + } + }, + "range": [ + 492, + 504 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 10, + "column": 27 + }, + "end": { + "line": 10, + "column": 41 + } + }, + "range": [ + 512, + 526 + ], + "key": { + "type": "Literal", + "loc": { + "start": { + "line": 10, + "column": 27 + }, + "end": { + "line": 10, + "column": 33 + } + }, + "range": [ + 512, + 518 + ], + "value": "type", + "raw": "\"type\"" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 10, + "column": 35 + }, + "end": { + "line": 10, + "column": 41 + } + }, + "range": [ + 520, + 526 + ], + "value": "json", + "raw": "\"json\"" + } + } + ] + }, + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 44 + } + }, + "range": [ + 550, + 594 + ], + "specifiers": [], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 19 + } + }, + "range": [ + 557, + 569 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 11, + "column": 33 + } + }, + "range": [ + 577, + 583 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 11, + "column": 28 + } + }, + "range": [ + 577, + 578 + ], + "name": "a" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 11, + "column": 30 + }, + "end": { + "line": 11, + "column": 33 + } + }, + "range": [ + 580, + 583 + ], + "value": "a", + "raw": "\"a\"" + } + }, + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 11, + "column": 35 + }, + "end": { + "line": 11, + "column": 41 + } + }, + "range": [ + 585, + 591 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 11, + "column": 35 + }, + "end": { + "line": 11, + "column": 36 + } + }, + "range": [ + 585, + 586 + ], + "name": "b" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 11, + "column": 38 + }, + "end": { + "line": 11, + "column": 41 + } + }, + "range": [ + 588, + 591 + ], + "value": "b", + "raw": "\"b\"" + } + } + ] + }, + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 46 + } + }, + "range": [ + 624, + 670 + ], + "specifiers": [], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 19 + } + }, + "range": [ + 631, + 643 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 12, + "column": 27 + }, + "end": { + "line": 12, + "column": 41 + } + }, + "range": [ + 651, + 665 + ], + "key": { + "type": "Literal", + "loc": { + "start": { + "line": 12, + "column": 27 + }, + "end": { + "line": 12, + "column": 33 + } + }, + "range": [ + 651, + 657 + ], + "value": "type", + "raw": "\"type\"" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 12, + "column": 35 + }, + "end": { + "line": 12, + "column": 41 + } + }, + "range": [ + 659, + 665 + ], + "value": "json", + "raw": "\"json\"" + } + } + ] + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Identifier", + "value": "json", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 7, + 11 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 12, + 16 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 17, + 29 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 30, + 34 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 37, + 41 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 41, + 42 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "range": [ + 43, + 49 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "range": [ + 50, + 51 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 51, + 52 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 53, + 59 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "range": [ + 60, + 72 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "range": [ + 73, + 77 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "range": [ + 78, + 79 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "range": [ + 80, + 84 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "range": [ + 84, + 85 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "range": [ + 86, + 92 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 41 + } + }, + "range": [ + 93, + 94 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "range": [ + 94, + 95 + ] + }, + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "range": [ + 96, + 102 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 103, + 104 + ] + }, + { + "type": "Identifier", + "value": "v", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 104, + 105 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 105, + 106 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "range": [ + 107, + 111 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "range": [ + 112, + 124 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "range": [ + 125, + 129 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 3, + "column": 34 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "range": [ + 130, + 131 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 40 + } + }, + "range": [ + 132, + 136 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "range": [ + 136, + 137 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 3, + "column": 42 + }, + "end": { + "line": 3, + "column": 48 + } + }, + "range": [ + 138, + 144 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 49 + }, + "end": { + "line": 3, + "column": 50 + } + }, + "range": [ + 145, + 146 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 50 + }, + "end": { + "line": 3, + "column": 51 + } + }, + "range": [ + 146, + 147 + ] + }, + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + }, + "range": [ + 148, + 154 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + }, + "range": [ + 155, + 156 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "range": [ + 157, + 159 + ] + }, + { + "type": "Identifier", + "value": "json", + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "range": [ + 160, + 164 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "range": [ + 165, + 169 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 34 + } + }, + "range": [ + 170, + 182 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 39 + } + }, + "range": [ + 183, + 187 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 4, + "column": 40 + }, + "end": { + "line": 4, + "column": 41 + } + }, + "range": [ + 188, + 189 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 4, + "column": 42 + }, + "end": { + "line": 4, + "column": 46 + } + }, + "range": [ + 190, + 194 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 4, + "column": 46 + }, + "end": { + "line": 4, + "column": 47 + } + }, + "range": [ + 194, + 195 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 4, + "column": 48 + }, + "end": { + "line": 4, + "column": 54 + } + }, + "range": [ + 196, + 202 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 55 + }, + "end": { + "line": 4, + "column": 56 + } + }, + "range": [ + 203, + 204 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 56 + }, + "end": { + "line": 4, + "column": 57 + } + }, + "range": [ + 204, + 205 + ] + }, + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 206, + 211 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + }, + "range": [ + 212, + 213 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "range": [ + 214, + 215 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 16 + } + }, + "range": [ + 216, + 222 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + }, + "range": [ + 222, + 223 + ] + }, + { + "type": "String", + "value": "\"foo.json\"", + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 27 + } + }, + "range": [ + 223, + 233 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 28 + } + }, + "range": [ + 233, + 234 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + }, + "range": [ + 235, + 236 + ] + }, + { + "type": "Identifier", + "value": "with", + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 35 + } + }, + "range": [ + 237, + 241 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + }, + "range": [ + 241, + 242 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 5, + "column": 38 + } + }, + "range": [ + 243, + 244 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 43 + } + }, + "range": [ + 245, + 249 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 44 + } + }, + "range": [ + 249, + 250 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 5, + "column": 45 + }, + "end": { + "line": 5, + "column": 51 + } + }, + "range": [ + 251, + 257 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 52 + }, + "end": { + "line": 5, + "column": 53 + } + }, + "range": [ + 258, + 259 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 54 + }, + "end": { + "line": 5, + "column": 55 + } + }, + "range": [ + 260, + 261 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 5, + "column": 55 + }, + "end": { + "line": 5, + "column": 56 + } + }, + "range": [ + 261, + 262 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 5, + "column": 56 + }, + "end": { + "line": 5, + "column": 57 + } + }, + "range": [ + 262, + 263 + ] + }, + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 5 + } + }, + "range": [ + 264, + 269 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 270, + 271 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + }, + "range": [ + 272, + 273 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 16 + } + }, + "range": [ + 274, + 280 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + }, + "range": [ + 280, + 281 + ] + }, + { + "type": "String", + "value": "\"foo.json\"", + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 27 + } + }, + "range": [ + 281, + 291 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 28 + } + }, + "range": [ + 291, + 292 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 6, + "column": 29 + }, + "end": { + "line": 6, + "column": 30 + } + }, + "range": [ + 293, + 294 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 31 + } + }, + "range": [ + 294, + 295 + ] + }, + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 5 + } + }, + "range": [ + 320, + 325 + ] + }, + { + "type": "Identifier", + "value": "c", + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 326, + 327 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + }, + "range": [ + 328, + 329 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 16 + } + }, + "range": [ + 330, + 336 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + }, + "range": [ + 336, + 337 + ] + }, + { + "type": "String", + "value": "\"foo.json\"", + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 27 + } + }, + "range": [ + 337, + 347 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 7, + "column": 27 + }, + "end": { + "line": 7, + "column": 28 + } + }, + "range": [ + 347, + 348 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 7, + "column": 29 + }, + "end": { + "line": 7, + "column": 30 + } + }, + "range": [ + 349, + 350 + ] + }, + { + "type": "Identifier", + "value": "with", + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 35 + } + }, + "range": [ + 351, + 355 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 7, + "column": 35 + }, + "end": { + "line": 7, + "column": 36 + } + }, + "range": [ + 355, + 356 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 7, + "column": 37 + }, + "end": { + "line": 7, + "column": 38 + } + }, + "range": [ + 357, + 358 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 7, + "column": 39 + }, + "end": { + "line": 7, + "column": 43 + } + }, + "range": [ + 359, + 363 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 7, + "column": 43 + }, + "end": { + "line": 7, + "column": 44 + } + }, + "range": [ + 363, + 364 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 7, + "column": 45 + }, + "end": { + "line": 7, + "column": 51 + } + }, + "range": [ + 365, + 371 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 7, + "column": 52 + }, + "end": { + "line": 7, + "column": 53 + } + }, + "range": [ + 372, + 373 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 7, + "column": 54 + }, + "end": { + "line": 7, + "column": 55 + } + }, + "range": [ + 374, + 375 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 7, + "column": 55 + }, + "end": { + "line": 7, + "column": 56 + } + }, + "range": [ + 375, + 376 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 7, + "column": 57 + }, + "end": { + "line": 7, + "column": 58 + } + }, + "range": [ + 377, + 378 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 7, + "column": 58 + }, + "end": { + "line": 7, + "column": 59 + } + }, + "range": [ + 378, + 379 + ] + }, + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 5 + } + }, + "range": [ + 380, + 385 + ] + }, + { + "type": "Identifier", + "value": "d", + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "range": [ + 386, + 387 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + }, + "range": [ + 388, + 389 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 16 + } + }, + "range": [ + 390, + 396 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + }, + "range": [ + 396, + 397 + ] + }, + { + "type": "String", + "value": "\"foo.json\"", + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 27 + } + }, + "range": [ + 397, + 407 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 8, + "column": 27 + }, + "end": { + "line": 8, + "column": 28 + } + }, + "range": [ + 407, + 408 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 32 + } + }, + "range": [ + 409, + 412 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 8, + "column": 34 + } + }, + "range": [ + 413, + 414 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 8, + "column": 34 + }, + "end": { + "line": 8, + "column": 35 + } + }, + "range": [ + 414, + 415 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 6 + } + }, + "range": [ + 416, + 422 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 19 + } + }, + "range": [ + 423, + 435 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 24 + } + }, + "range": [ + 436, + 440 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 26 + } + }, + "range": [ + 441, + 442 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 30 + } + }, + "range": [ + 443, + 446 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 9, + "column": 30 + }, + "end": { + "line": 9, + "column": 31 + } + }, + "range": [ + 446, + 447 + ] + }, + { + "type": "String", + "value": "\"bar\"", + "loc": { + "start": { + "line": 9, + "column": 32 + }, + "end": { + "line": 9, + "column": 37 + } + }, + "range": [ + 448, + 453 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 9, + "column": 38 + }, + "end": { + "line": 9, + "column": 39 + } + }, + "range": [ + 454, + 455 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 9, + "column": 39 + }, + "end": { + "line": 9, + "column": 40 + } + }, + "range": [ + 455, + 456 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 6 + } + }, + "range": [ + 485, + 491 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 19 + } + }, + "range": [ + 492, + 504 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 24 + } + }, + "range": [ + 505, + 509 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 26 + } + }, + "range": [ + 510, + 511 + ] + }, + { + "type": "String", + "value": "\"type\"", + "loc": { + "start": { + "line": 10, + "column": 27 + }, + "end": { + "line": 10, + "column": 33 + } + }, + "range": [ + 512, + 518 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 10, + "column": 33 + }, + "end": { + "line": 10, + "column": 34 + } + }, + "range": [ + 518, + 519 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 10, + "column": 35 + }, + "end": { + "line": 10, + "column": 41 + } + }, + "range": [ + 520, + 526 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 10, + "column": 42 + }, + "end": { + "line": 10, + "column": 43 + } + }, + "range": [ + 527, + 528 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 10, + "column": 43 + }, + "end": { + "line": 10, + "column": 44 + } + }, + "range": [ + 528, + 529 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 6 + } + }, + "range": [ + 550, + 556 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 19 + } + }, + "range": [ + 557, + 569 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 11, + "column": 20 + }, + "end": { + "line": 11, + "column": 24 + } + }, + "range": [ + 570, + 574 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 26 + } + }, + "range": [ + 575, + 576 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 11, + "column": 28 + } + }, + "range": [ + 577, + 578 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 29 + } + }, + "range": [ + 578, + 579 + ] + }, + { + "type": "String", + "value": "\"a\"", + "loc": { + "start": { + "line": 11, + "column": 30 + }, + "end": { + "line": 11, + "column": 33 + } + }, + "range": [ + 580, + 583 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 11, + "column": 33 + }, + "end": { + "line": 11, + "column": 34 + } + }, + "range": [ + 583, + 584 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 11, + "column": 35 + }, + "end": { + "line": 11, + "column": 36 + } + }, + "range": [ + 585, + 586 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 11, + "column": 36 + }, + "end": { + "line": 11, + "column": 37 + } + }, + "range": [ + 586, + 587 + ] + }, + { + "type": "String", + "value": "\"b\"", + "loc": { + "start": { + "line": 11, + "column": 38 + }, + "end": { + "line": 11, + "column": 41 + } + }, + "range": [ + 588, + 591 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 11, + "column": 42 + }, + "end": { + "line": 11, + "column": 43 + } + }, + "range": [ + 592, + 593 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 11, + "column": 43 + }, + "end": { + "line": 11, + "column": 44 + } + }, + "range": [ + 593, + 594 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 6 + } + }, + "range": [ + 624, + 630 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 19 + } + }, + "range": [ + 631, + 643 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 12, + "column": 20 + }, + "end": { + "line": 12, + "column": 24 + } + }, + "range": [ + 644, + 648 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 12, + "column": 25 + }, + "end": { + "line": 12, + "column": 26 + } + }, + "range": [ + 649, + 650 + ] + }, + { + "type": "String", + "value": "\"type\"", + "loc": { + "start": { + "line": 12, + "column": 27 + }, + "end": { + "line": 12, + "column": 33 + } + }, + "range": [ + 651, + 657 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 12, + "column": 34 + } + }, + "range": [ + 657, + 658 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 12, + "column": 35 + }, + "end": { + "line": 12, + "column": 41 + } + }, + "range": [ + 659, + 665 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 12, + "column": 41 + }, + "end": { + "line": 12, + "column": 42 + } + }, + "range": [ + 665, + 666 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 12, + "column": 44 + }, + "end": { + "line": 12, + "column": 45 + } + }, + "range": [ + 668, + 669 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 12, + "column": 45 + }, + "end": { + "line": 12, + "column": 46 + } + }, + "range": [ + 669, + 670 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.result.js new file mode 100644 index 00000000..521323ed --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.result.js @@ -0,0 +1,6 @@ +export default { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "'import' and 'export' may appear only with 'sourceType: module'" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.src.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.src.js new file mode 100644 index 00000000..eef7bd04 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.src.js @@ -0,0 +1,12 @@ +import json from "./foo.json" with { type: "json" }; +import "./foo.json" with { type: "json" }; +export {v} from "./foo.json" with { type: "json" }; +export * as json from "./foo.json" with { type: "json" }; +const a = import("foo.json", { with: { type: "json" } }); +const b = import("foo.json", ); // Allow trailing comma +const c = import("foo.json", { with: { type: "json" } }, ); +const d = import("foo.json", foo ); +import "./foo.json" with { foo: "bar" }; // Allow unknown attributes +import "./foo.json" with { "type": "json" }; // Allow string key +import "./foo.json" with { a: "a", b: "b" }; // Allow multiple attributes +import "./foo.json" with { "type": "json", }; // Allow trailing comma diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.result.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.result.js new file mode 100644 index 00000000..240ddc09 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.result.js @@ -0,0 +1,6 @@ +export default { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Invalid regular expression: /(?ii:p)?/: Duplicate regular expression modifiers" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.src.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.src.js new file mode 100644 index 00000000..b3d74b51 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.src.js @@ -0,0 +1 @@ +/(?ii:p)?/; diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.result.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.result.js new file mode 100644 index 00000000..e8c0f982 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.result.js @@ -0,0 +1,6 @@ +export default { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Invalid regular expression: /(?i-i:p)?/: Duplicate regular expression modifiers" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.src.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.src.js new file mode 100644 index 00000000..d98be680 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.src.js @@ -0,0 +1 @@ +/(?i-i:p)?/; diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.result.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.result.js new file mode 100644 index 00000000..e2b0b179 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.result.js @@ -0,0 +1,6 @@ +export default { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Invalid regular expression: /(?-ii:p)?/: Duplicate regular expression modifiers" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.src.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.src.js new file mode 100644 index 00000000..6100af90 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.src.js @@ -0,0 +1 @@ +/(?-ii:p)?/; diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.result.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.result.js new file mode 100644 index 00000000..38ead2b6 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.result.js @@ -0,0 +1,6 @@ +export default { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Invalid regular expression: /(?-:p)?/: Invalid regular expression modifiers" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.src.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.src.js new file mode 100644 index 00000000..f9ace52b --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.src.js @@ -0,0 +1 @@ +/(?-:p)?/; diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.result.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.result.js new file mode 100644 index 00000000..d1299850 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.result.js @@ -0,0 +1,6 @@ +export default { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Invalid regular expression: /(?u:p)?/: Invalid group" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.src.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.src.js new file mode 100644 index 00000000..1f828c14 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.src.js @@ -0,0 +1 @@ +/(?u:p)?/; diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.result.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.result.js new file mode 100644 index 00000000..dc0a7ae8 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.result.js @@ -0,0 +1,424 @@ +import conditionalRegex from "../../../../lib/conditional-regex-value.js"; + +export default { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "range": [ + 0, + 67 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "expression": conditionalRegex({ + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "value": null, + "raw": "/(?i-m:p)?/", + "regex": { + "pattern": "(?i-m:p)?", + "flags": "" + } + }) + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "range": [ + 13, + 26 + ], + "expression": conditionalRegex({ + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 13, + 25 + ], + "value": null, + "raw": "/(?i-m:p)?/u", + "regex": { + "pattern": "(?i-m:p)?", + "flags": "u" + } + }) + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "range": [ + 27, + 39 + ], + "expression": conditionalRegex({ + "type": "Literal", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "range": [ + 27, + 38 + ], + "value": null, + "raw": "/(?ims:p)?/", + "regex": { + "pattern": "(?ims:p)?", + "flags": "" + } + }) + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "range": [ + 40, + 53 + ], + "expression": conditionalRegex({ + "type": "Literal", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "range": [ + 40, + 52 + ], + "value": null, + "raw": "/(?ims-:p)?/", + "regex": { + "pattern": "(?ims-:p)?", + "flags": "" + } + }) + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "range": [ + 54, + 67 + ], + "expression": conditionalRegex({ + "type": "Literal", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 12 + } + }, + "range": [ + 54, + 66 + ], + "value": null, + "raw": "/(?-ims:p)?/", + "regex": { + "pattern": "(?-ims:p)?", + "flags": "" + } + }) + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "RegularExpression", + "value": "/(?i-m:p)?/", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "regex": { + "flags": "", + "pattern": "(?i-m:p)?" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "RegularExpression", + "value": "/(?i-m:p)?/u", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 13, + 25 + ], + "regex": { + "flags": "u", + "pattern": "(?i-m:p)?" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "RegularExpression", + "value": "/(?ims:p)?/", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "range": [ + 27, + 38 + ], + "regex": { + "flags": "", + "pattern": "(?ims:p)?" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "range": [ + 38, + 39 + ] + }, + { + "type": "RegularExpression", + "value": "/(?ims-:p)?/", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "range": [ + 40, + 52 + ], + "regex": { + "flags": "", + "pattern": "(?ims-:p)?" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "range": [ + 52, + 53 + ] + }, + { + "type": "RegularExpression", + "value": "/(?-ims:p)?/", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 12 + } + }, + "range": [ + 54, + 66 + ], + "regex": { + "flags": "", + "pattern": "(?-ims:p)?" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "range": [ + 66, + 67 + ] + } + ] +}; diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.src.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.src.js new file mode 100644 index 00000000..5ae7ebf7 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.src.js @@ -0,0 +1,5 @@ +/(?i-m:p)?/; +/(?i-m:p)?/u; +/(?ims:p)?/; +/(?ims-:p)?/; +/(?-ims:p)?/;