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

Add syntax import meta to preset env #15580

Merged
merged 6 commits into from Apr 22, 2023
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
1 change: 1 addition & 0 deletions packages/babel-preset-env/package.json
Expand Up @@ -43,6 +43,7 @@
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-export-namespace-from": "^7.8.3",
"@babel/plugin-syntax-import-assertions": "workspace:^",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-syntax-json-strings": "^7.8.3",
"@babel/plugin-syntax-logical-assignment-operators": "^7.10.4",
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
Expand Down
2 changes: 2 additions & 0 deletions packages/babel-preset-env/src/available-plugins.ts
Expand Up @@ -6,6 +6,7 @@ import syntaxClassStaticBlock from "@babel/plugin-syntax-class-static-block";
import syntaxDynamicImport from "@babel/plugin-syntax-dynamic-import";
import syntaxExportNamespaceFrom from "@babel/plugin-syntax-export-namespace-from";
import syntaxImportAssertions from "@babel/plugin-syntax-import-assertions";
import syntaxImportMeta from "@babel/plugin-syntax-import-meta";
import syntaxJsonStrings from "@babel/plugin-syntax-json-strings";
import syntaxLogicalAssignmentOperators from "@babel/plugin-syntax-logical-assignment-operators";
import syntaxNullishCoalescingOperator from "@babel/plugin-syntax-nullish-coalescing-operator";
Expand Down Expand Up @@ -89,6 +90,7 @@ export default {
"syntax-dynamic-import": () => syntaxDynamicImport,
"syntax-export-namespace-from": () => syntaxExportNamespaceFrom,
"syntax-import-assertions": () => syntaxImportAssertions,
"syntax-import-meta": () => syntaxImportMeta,
"syntax-json-strings": () => syntaxJsonStrings,
"syntax-logical-assignment-operators": () => syntaxLogicalAssignmentOperators,
"syntax-nullish-coalescing-operator": () => syntaxNullishCoalescingOperator,
Expand Down
3 changes: 3 additions & 0 deletions packages/babel-preset-env/src/index.ts
Expand Up @@ -170,6 +170,9 @@ export const getModulesPluginNames = ({
modulesPluginNames.push("syntax-top-level-await");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other syntax plugins can also be removed in Babel 8, since we can't disable them anyway, regardless of whether the caller actually supports certain features or not.

}

// Enable import meta for @babel/core < 7.10
modulesPluginNames.push("syntax-import-meta");
Copy link
Contributor Author

@JLHwung JLHwung Apr 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's defer the changes to Babel 8.0.1 so we don't have to maintain more Babel 7 vs Babel 8 cases. The change can be safely landed within 8.0 to 8.0.1, at that time we can update test fixtures in batch without duplicating Babel 7 cases from Babel 8.


return modulesPluginNames;
};

Expand Down
Expand Up @@ -42,5 +42,6 @@ Using plugins:
bugfix/transform-tagged-template-caching { ios < 13, safari < 13 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -40,5 +40,6 @@ Using plugins:
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios, opera < 60, safari, samsung < 11.0 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -40,5 +40,6 @@ Using plugins:
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios, opera < 60, safari, samsung < 11.0 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -42,5 +42,6 @@ Using plugins:
bugfix/transform-tagged-template-caching { ios < 13, safari < 13 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -46,5 +46,6 @@ Using plugins:
transform-export-namespace-from { chrome < 72 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -23,5 +23,6 @@ Using plugins:
transform-export-namespace-from { chrome < 72 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -31,5 +31,6 @@ Using plugins:
bugfix/transform-edge-function-name { edge < 79 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -28,5 +28,6 @@ Using plugins:
bugfix/transform-edge-function-name { edge < 79 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -28,5 +28,6 @@ Using plugins:
transform-export-namespace-from { edge < 79 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -28,5 +28,6 @@ Using plugins:
bugfix/transform-edge-function-name { edge < 79 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -27,5 +27,6 @@ Using plugins:
bugfix/transform-edge-function-name { edge < 79 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -31,5 +31,6 @@ Using plugins:
transform-export-namespace-from { edge < 79 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -31,5 +31,6 @@ Using plugins:
bugfix/transform-edge-function-name { edge < 79 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -28,5 +28,6 @@ Using plugins:
bugfix/transform-edge-function-name { edge < 79 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -32,5 +32,6 @@ Using plugins:
transform-export-namespace-from { safari }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -33,5 +33,6 @@ Using plugins:
bugfix/transform-tagged-template-caching { safari < 13 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -29,5 +29,6 @@ Using plugins:
bugfix/transform-tagged-template-caching { safari < 13 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -41,5 +41,6 @@ Using plugins:
bugfix/transform-tagged-template-caching { safari < 13 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -22,5 +22,6 @@ Using plugins:
bugfix/transform-safari-id-destructuring-collision-in-function-expression { safari }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -22,5 +22,6 @@ Using plugins:
transform-export-namespace-from { safari }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -21,5 +21,6 @@ Using plugins:
transform-modules-commonjs
transform-dynamic-import
transform-export-namespace-from { }
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -22,5 +22,6 @@ Using plugins:
transform-modules-commonjs
transform-dynamic-import
transform-export-namespace-from { }
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -39,6 +39,7 @@ Using plugins:
transform-block-scoping { ios < 11, safari < 11 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios, opera < 60, safari, samsung < 11.0 }
syntax-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -41,6 +41,7 @@ Using plugins:
bugfix/transform-safari-id-destructuring-collision-in-function-expression { ios, safari }
bugfix/transform-tagged-template-caching { ios < 13, safari < 13 }
syntax-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -39,6 +39,7 @@ Using plugins:
transform-block-scoping { ios < 11, safari < 11 }
transform-export-namespace-from { android < 72, chrome < 72, edge < 79, firefox < 80, ios, opera < 60, safari, samsung < 11.0 }
syntax-dynamic-import
syntax-import-meta
corejs3: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -41,6 +41,7 @@ Using plugins:
bugfix/transform-safari-id-destructuring-collision-in-function-expression { ios, safari }
bugfix/transform-tagged-template-caching { ios < 13, safari < 13 }
syntax-dynamic-import
syntax-import-meta
corejs3: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -48,5 +48,6 @@ Using plugins:
transform-export-namespace-from { ie }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -52,5 +52,6 @@ Using plugins:
transform-export-namespace-from { android < 72 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -30,5 +30,6 @@ Using plugins:
transform-export-namespace-from { ios, safari }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -30,5 +30,6 @@ Using plugins:
transform-export-namespace-from { ios, safari }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -29,5 +29,6 @@ Using plugins:
transform-export-namespace-from { ios, safari }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -52,5 +52,6 @@ Using plugins:
transform-export-namespace-from { ie }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta

Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
Expand Up @@ -50,6 +50,7 @@ Using plugins:
transform-export-namespace-from { android < 72 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -36,6 +36,7 @@ Using plugins:
transform-export-namespace-from { electron < 5.0 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -51,6 +51,7 @@ Using plugins:
transform-reserved-words { }
transform-export-namespace-from { chrome < 72 }
syntax-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -31,6 +31,7 @@ Using plugins:
transform-export-namespace-from { node < 13.2 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -23,6 +23,7 @@ Using plugins:
transform-export-namespace-from { chrome < 72 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -52,6 +52,7 @@ Using plugins:
transform-export-namespace-from { ie }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -23,6 +23,7 @@ Using plugins:
transform-export-namespace-from { chrome < 72 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
syntax-import-assertions
corejs2: `DEBUG` option

Expand Down
Expand Up @@ -52,6 +52,7 @@ Using plugins:
transform-export-namespace-from { ie }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
syntax-import-assertions
corejs2: `DEBUG` option

Expand Down
Expand Up @@ -54,6 +54,7 @@ Using plugins:
transform-export-namespace-from { chrome < 72, edge < 79, firefox < 80, ie, ios, safari }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -52,6 +52,7 @@ Using plugins:
transform-export-namespace-from { chrome < 72, electron < 5.0, ie, node < 13.2 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -51,6 +51,7 @@ Using plugins:
transform-export-namespace-from { chrome < 72, ie, node < 13.2 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -51,6 +51,7 @@ Using plugins:
transform-export-namespace-from { chrome < 72, ie, node < 13.2 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
corejs2: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -23,6 +23,7 @@ Using plugins:
transform-export-namespace-from { chrome < 72 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
syntax-import-assertions
corejs3: `DEBUG` option

Expand Down
Expand Up @@ -52,6 +52,7 @@ Using plugins:
transform-export-namespace-from { ie }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
syntax-import-assertions
corejs3: `DEBUG` option

Expand Down
Expand Up @@ -50,6 +50,7 @@ Using plugins:
transform-export-namespace-from { android < 72 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
corejs3: `DEBUG` option

Using targets: {
Expand Down
Expand Up @@ -52,6 +52,7 @@ Using plugins:
transform-export-namespace-from { ie }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
syntax-import-assertions
corejs3: `DEBUG` option

Expand Down
Expand Up @@ -36,6 +36,7 @@ Using plugins:
transform-export-namespace-from { electron < 5.0 }
transform-modules-commonjs
transform-dynamic-import
syntax-import-meta
corejs3: `DEBUG` option

Using targets: {
Expand Down