Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable import.meta by default in @babel/parser (#11364) #11406

Merged
merged 3 commits into from May 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/babel-parser/src/parser/expression.js
Expand Up @@ -1227,8 +1227,6 @@ export default class ExpressionParser extends LValParser {
this.expect(tt.dot);

if (this.isContextual("meta")) {
this.expectPlugin("importMeta");

if (!this.inModule) {
this.raiseWithData(
id.start,
Expand All @@ -1237,8 +1235,6 @@ export default class ExpressionParser extends LValParser {
);
}
this.sawUnambiguousESM = true;
} else if (!this.hasPlugin("importMeta")) {
this.raise(id.start, Errors.ImportCallArityLtOne);
kik-o marked this conversation as resolved.
Show resolved Hide resolved
}

return this.parseMetaProperty(node, id, "meta");
Expand Down
1 change: 0 additions & 1 deletion packages/babel-parser/src/parser/location.js
Expand Up @@ -68,7 +68,6 @@ export const Errors = Object.freeze({
ImportCallArgumentTrailingComma:
"Trailing comma is disallowed inside import(...) arguments",
ImportCallArity: "import() requires exactly one argument",
ImportCallArityLtOne: "Dynamic imports require a parameter: import('a.js')",
ImportCallNotNewExpression: "Cannot use new with import(...)",
ImportCallSpreadArgument: "... is not allowed in import()",
ImportMetaOutsideModule: `import.meta may appear only with 'sourceType: "module"'`,
Expand Down
Expand Up @@ -49,4 +49,4 @@
],
"directives": []
}
}
}
Expand Up @@ -2,7 +2,6 @@
"type": "File",
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"errors": [
"SyntaxError: Dynamic imports require a parameter: import('a.js') (2:9)",
"SyntaxError: The only valid meta property for import is import.meta (2:16)"
],
"program": {
Expand Down
@@ -1,4 +1,3 @@
{
"plugins": ["importMeta"],
"sourceType": "script"
}
@@ -0,0 +1,3 @@
{
"sourceType": "module"
}
@@ -0,0 +1,3 @@
{
"sourceType": "module"
}
@@ -0,0 +1,3 @@
{
"sourceType": "module"
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.