From d4e842d4eb17df3455209821cf69aeac766a4c89 Mon Sep 17 00:00:00 2001 From: Jan Olaf Krems Date: Tue, 30 May 2017 16:28:51 -0700 Subject: [PATCH] Add plugin for import.meta proposal (#544) * Add plugin for import.meta proposal Fixes https://github.com/babel/babylon/issues/539 * Tests for assignment/mutation of import.meta * Use correct identifier in failure message * Simpler & more consistent script errors for import.meta --- README.md | 1 + src/parser/expression.js | 16 +- src/parser/statement.js | 3 +- .../import-meta/error-in-script/actual.js | 1 + .../import-meta/error-in-script/options.json | 5 + .../import-meta/no-other-prop-names/actual.js | 1 + .../no-other-prop-names/options.json | 5 + .../import-meta/not-assignable/actual.js | 1 + .../import-meta/not-assignable/options.json | 5 + .../import-meta/valid-in-module/actual.js | 5 + .../import-meta/valid-in-module/expected.json | 555 ++++++++++++++++++ .../import-meta/valid-in-module/options.json | 4 + .../without-dynamic-import/actual.js | 5 + .../without-dynamic-import/expected.json | 555 ++++++++++++++++++ .../without-dynamic-import/options.json | 4 + 15 files changed, 1164 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/experimental/import-meta/error-in-script/actual.js create mode 100644 test/fixtures/experimental/import-meta/error-in-script/options.json create mode 100644 test/fixtures/experimental/import-meta/no-other-prop-names/actual.js create mode 100644 test/fixtures/experimental/import-meta/no-other-prop-names/options.json create mode 100644 test/fixtures/experimental/import-meta/not-assignable/actual.js create mode 100644 test/fixtures/experimental/import-meta/not-assignable/options.json create mode 100644 test/fixtures/experimental/import-meta/valid-in-module/actual.js create mode 100644 test/fixtures/experimental/import-meta/valid-in-module/expected.json create mode 100644 test/fixtures/experimental/import-meta/valid-in-module/options.json create mode 100644 test/fixtures/experimental/import-meta/without-dynamic-import/actual.js create mode 100644 test/fixtures/experimental/import-meta/without-dynamic-import/expected.json create mode 100644 test/fixtures/experimental/import-meta/without-dynamic-import/options.json diff --git a/README.md b/README.md index be6f771feb..8e92625e34 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ require("babylon").parse("code", { - `functionSent` - `dynamicImport` ([proposal](https://github.com/tc39/proposal-dynamic-import)) - `numericSeparator` ([proposal](https://github.com/samuelgoto/proposal-numeric-separator)) + - `importMeta` ([proposal](https://github.com/tc39/proposal-import-meta)) ### FAQ diff --git a/src/parser/expression.js b/src/parser/expression.js index b097be7e10..13b2371fae 100644 --- a/src/parser/expression.js +++ b/src/parser/expression.js @@ -427,6 +427,10 @@ export default class ExpressionParser extends LValParser { return this.finishNode(node, "Super"); case tt._import: + if (this.hasPlugin("importMeta") && this.lookahead().type === tt.dot) { + return this.parseImportMetaProperty(); + } + if (!this.hasPlugin("dynamicImport")) this.unexpected(); node = this.startNode(); @@ -588,12 +592,22 @@ export default class ExpressionParser extends LValParser { node.property = this.parseIdentifier(true); if (node.property.name !== propertyName) { - this.raise(node.property.start, `The only valid meta property for new is ${meta.name}.${propertyName}`); + this.raise(node.property.start, `The only valid meta property for ${meta.name} is ${meta.name}.${propertyName}`); } return this.finishNode(node, "MetaProperty"); } + parseImportMetaProperty(): N.MetaProperty { + const node = this.startNode(); + const id = this.parseIdentifier(true); + this.expect(tt.dot); + if (!this.inModule) { + this.raise(id.start, "import.meta may appear only with 'sourceType: module'"); + } + return this.parseMetaProperty(node, id, "meta"); + } + parseLiteral(value: any, type: /*T["kind"]*/string, startPos?: number, startLoc?: Position): T { startPos = startPos || this.state.start; startLoc = startLoc || this.state.startLoc; diff --git a/src/parser/statement.js b/src/parser/statement.js index 080b3a0e02..012066d822 100644 --- a/src/parser/statement.js +++ b/src/parser/statement.js @@ -106,7 +106,8 @@ export default class StatementParser extends ExpressionParser { case tt.semi: return this.parseEmptyStatement(node); case tt._export: case tt._import: - if (this.hasPlugin("dynamicImport") && this.lookahead().type === tt.parenL) break; + if ((this.hasPlugin("dynamicImport") && this.lookahead().type === tt.parenL) || + (this.hasPlugin("importMeta") && this.lookahead().type === tt.dot)) break; if (!this.options.allowImportExportEverywhere) { if (!topLevel) { diff --git a/test/fixtures/experimental/import-meta/error-in-script/actual.js b/test/fixtures/experimental/import-meta/error-in-script/actual.js new file mode 100644 index 0000000000..e1cfc5468e --- /dev/null +++ b/test/fixtures/experimental/import-meta/error-in-script/actual.js @@ -0,0 +1 @@ +const x = import.meta; diff --git a/test/fixtures/experimental/import-meta/error-in-script/options.json b/test/fixtures/experimental/import-meta/error-in-script/options.json new file mode 100644 index 0000000000..8fc6ce37a5 --- /dev/null +++ b/test/fixtures/experimental/import-meta/error-in-script/options.json @@ -0,0 +1,5 @@ +{ + "throws": "import.meta may appear only with 'sourceType: module' (1:10)", + "plugins": ["dynamicImport", "importMeta"], + "sourceType": "script" +} diff --git a/test/fixtures/experimental/import-meta/no-other-prop-names/actual.js b/test/fixtures/experimental/import-meta/no-other-prop-names/actual.js new file mode 100644 index 0000000000..cfa01aa85e --- /dev/null +++ b/test/fixtures/experimental/import-meta/no-other-prop-names/actual.js @@ -0,0 +1 @@ +import.notMeta; diff --git a/test/fixtures/experimental/import-meta/no-other-prop-names/options.json b/test/fixtures/experimental/import-meta/no-other-prop-names/options.json new file mode 100644 index 0000000000..97ba83ec46 --- /dev/null +++ b/test/fixtures/experimental/import-meta/no-other-prop-names/options.json @@ -0,0 +1,5 @@ +{ + "throws": "The only valid meta property for import is import.meta (1:7)", + "sourceType": "module", + "plugins": ["dynamicImport", "importMeta"] +} diff --git a/test/fixtures/experimental/import-meta/not-assignable/actual.js b/test/fixtures/experimental/import-meta/not-assignable/actual.js new file mode 100644 index 0000000000..d1f20b1c0a --- /dev/null +++ b/test/fixtures/experimental/import-meta/not-assignable/actual.js @@ -0,0 +1 @@ +import.meta = true; diff --git a/test/fixtures/experimental/import-meta/not-assignable/options.json b/test/fixtures/experimental/import-meta/not-assignable/options.json new file mode 100644 index 0000000000..647ad9f65d --- /dev/null +++ b/test/fixtures/experimental/import-meta/not-assignable/options.json @@ -0,0 +1,5 @@ +{ + "throws": "Invalid left-hand side in assignment expression (1:0)", + "sourceType": "module", + "plugins": ["dynamicImport", "importMeta"] +} diff --git a/test/fixtures/experimental/import-meta/valid-in-module/actual.js b/test/fixtures/experimental/import-meta/valid-in-module/actual.js new file mode 100644 index 0000000000..fd4422fc6f --- /dev/null +++ b/test/fixtures/experimental/import-meta/valid-in-module/actual.js @@ -0,0 +1,5 @@ +const x = import.meta; +const url = import.meta.url; +import.meta; +import.meta.url; +import.meta.couldBeMutable = true; diff --git a/test/fixtures/experimental/import-meta/valid-in-module/expected.json b/test/fixtures/experimental/import-meta/valid-in-module/expected.json new file mode 100644 index 0000000000..dc33442309 --- /dev/null +++ b/test/fixtures/experimental/import-meta/valid-in-module/expected.json @@ -0,0 +1,555 @@ +{ + "type": "File", + "start": 0, + "end": 116, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 34 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 116, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 34 + } + }, + "sourceType": "module", + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "MetaProperty", + "start": 10, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "meta": { + "type": "Identifier", + "start": 10, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 17, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "meta" + }, + "name": "meta" + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 23, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 29, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "url" + }, + "name": "url" + }, + "init": { + "type": "MemberExpression", + "start": 35, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "object": { + "type": "MetaProperty", + "start": 35, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "meta": { + "type": "Identifier", + "start": 35, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "meta" + }, + "name": "meta" + } + }, + "property": { + "type": "Identifier", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 27 + }, + "identifierName": "url" + }, + "name": "url" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 52, + "end": 64, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "expression": { + "type": "MetaProperty", + "start": 52, + "end": 63, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "meta": { + "type": "Identifier", + "start": 52, + "end": 58, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 59, + "end": 63, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "meta" + }, + "name": "meta" + } + } + }, + { + "type": "ExpressionStatement", + "start": 65, + "end": 81, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "expression": { + "type": "MemberExpression", + "start": 65, + "end": 80, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "object": { + "type": "MetaProperty", + "start": 65, + "end": 76, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "meta": { + "type": "Identifier", + "start": 65, + "end": 71, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 72, + "end": 76, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + }, + "identifierName": "meta" + }, + "name": "meta" + } + }, + "property": { + "type": "Identifier", + "start": 77, + "end": 80, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 15 + }, + "identifierName": "url" + }, + "name": "url" + }, + "computed": false + } + }, + { + "type": "ExpressionStatement", + "start": 82, + "end": 116, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 34 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 82, + "end": 115, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 33 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 82, + "end": 108, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 26 + } + }, + "object": { + "type": "MetaProperty", + "start": 82, + "end": 93, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "meta": { + "type": "Identifier", + "start": 82, + "end": 88, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 89, + "end": 93, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + }, + "identifierName": "meta" + }, + "name": "meta" + } + }, + "property": { + "type": "Identifier", + "start": 94, + "end": 108, + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 26 + }, + "identifierName": "couldBeMutable" + }, + "name": "couldBeMutable" + }, + "computed": false + }, + "right": { + "type": "BooleanLiteral", + "start": 111, + "end": 115, + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 33 + } + }, + "value": true + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/experimental/import-meta/valid-in-module/options.json b/test/fixtures/experimental/import-meta/valid-in-module/options.json new file mode 100644 index 0000000000..be1070ffed --- /dev/null +++ b/test/fixtures/experimental/import-meta/valid-in-module/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["dynamicImport", "importMeta"] +} diff --git a/test/fixtures/experimental/import-meta/without-dynamic-import/actual.js b/test/fixtures/experimental/import-meta/without-dynamic-import/actual.js new file mode 100644 index 0000000000..fd4422fc6f --- /dev/null +++ b/test/fixtures/experimental/import-meta/without-dynamic-import/actual.js @@ -0,0 +1,5 @@ +const x = import.meta; +const url = import.meta.url; +import.meta; +import.meta.url; +import.meta.couldBeMutable = true; diff --git a/test/fixtures/experimental/import-meta/without-dynamic-import/expected.json b/test/fixtures/experimental/import-meta/without-dynamic-import/expected.json new file mode 100644 index 0000000000..dc33442309 --- /dev/null +++ b/test/fixtures/experimental/import-meta/without-dynamic-import/expected.json @@ -0,0 +1,555 @@ +{ + "type": "File", + "start": 0, + "end": 116, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 34 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 116, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 34 + } + }, + "sourceType": "module", + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "MetaProperty", + "start": 10, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "meta": { + "type": "Identifier", + "start": 10, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 17, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "meta" + }, + "name": "meta" + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 23, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 29, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "url" + }, + "name": "url" + }, + "init": { + "type": "MemberExpression", + "start": 35, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "object": { + "type": "MetaProperty", + "start": 35, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "meta": { + "type": "Identifier", + "start": 35, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "meta" + }, + "name": "meta" + } + }, + "property": { + "type": "Identifier", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 27 + }, + "identifierName": "url" + }, + "name": "url" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 52, + "end": 64, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "expression": { + "type": "MetaProperty", + "start": 52, + "end": 63, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "meta": { + "type": "Identifier", + "start": 52, + "end": 58, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 59, + "end": 63, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "meta" + }, + "name": "meta" + } + } + }, + { + "type": "ExpressionStatement", + "start": 65, + "end": 81, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "expression": { + "type": "MemberExpression", + "start": 65, + "end": 80, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "object": { + "type": "MetaProperty", + "start": 65, + "end": 76, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "meta": { + "type": "Identifier", + "start": 65, + "end": 71, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 72, + "end": 76, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + }, + "identifierName": "meta" + }, + "name": "meta" + } + }, + "property": { + "type": "Identifier", + "start": 77, + "end": 80, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 15 + }, + "identifierName": "url" + }, + "name": "url" + }, + "computed": false + } + }, + { + "type": "ExpressionStatement", + "start": 82, + "end": 116, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 34 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 82, + "end": 115, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 33 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 82, + "end": 108, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 26 + } + }, + "object": { + "type": "MetaProperty", + "start": 82, + "end": 93, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "meta": { + "type": "Identifier", + "start": 82, + "end": 88, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 89, + "end": 93, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + }, + "identifierName": "meta" + }, + "name": "meta" + } + }, + "property": { + "type": "Identifier", + "start": 94, + "end": 108, + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 26 + }, + "identifierName": "couldBeMutable" + }, + "name": "couldBeMutable" + }, + "computed": false + }, + "right": { + "type": "BooleanLiteral", + "start": 111, + "end": 115, + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 33 + } + }, + "value": true + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/experimental/import-meta/without-dynamic-import/options.json b/test/fixtures/experimental/import-meta/without-dynamic-import/options.json new file mode 100644 index 0000000000..a6638b6528 --- /dev/null +++ b/test/fixtures/experimental/import-meta/without-dynamic-import/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["importMeta"] +}