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 support for nullish coalescing operator in preset-env #10815

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 2 additions & 0 deletions packages/babel-preset-env-standalone/package.json
Expand Up @@ -14,7 +14,9 @@
"devDependencies": {
"@babel/plugin-proposal-dynamic-import": "^7.7.4",
"@babel/plugin-proposal-json-strings": "^7.7.4",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4",
"@babel/plugin-syntax-json-strings": "^7.7.4",
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.7.4",
"@babel/plugin-syntax-top-level-await": "^7.7.4",
"@babel/plugin-transform-named-capturing-groups-regex": "^7.7.4",
"@babel/plugin-transform-new-target": "^7.7.4",
Expand Down
2 changes: 2 additions & 0 deletions packages/babel-preset-env-standalone/src/available-plugins.js
Expand Up @@ -5,8 +5,10 @@ const notIncludedPlugins = {
"transform-new-target": require("@babel/plugin-transform-new-target"),
"proposal-json-strings": require("@babel/plugin-proposal-json-strings"),
"proposal-dynamic-import": require("@babel/plugin-proposal-dynamic-import"),
"proposal-nullish-coalescing-operator": require("@babel/plugin-proposal-nullish-coalescing-operator"),
"syntax-json-strings": require("@babel/plugin-syntax-json-strings"),
"syntax-top-level-await": require("@babel/plugin-syntax-top-level-await"),
"syntax-nullish-coalescing-operator": require("@babel/plugin-syntax-nullish-coalescing-operator"),
};

Object.keys(notIncludedPlugins).forEach(pluginName => {
Expand Down
1 change: 1 addition & 0 deletions packages/babel-preset-env/data/plugin-features.js
Expand Up @@ -101,6 +101,7 @@ const es = {
"transform-member-expression-literals": "Object/array literal extensions / Reserved words as property names",
"transform-property-literals": "Object/array literal extensions / Reserved words as property names",
"transform-reserved-words": "Miscellaneous / Unreserved words",
"proposal-nullish-coalescing-operator": "nullish coalescing operator (??)",
};

const proposals = require("./shipped-proposals").features;
Expand Down
5 changes: 5 additions & 0 deletions packages/babel-preset-env/data/plugins.json
Expand Up @@ -349,5 +349,10 @@
"phantom": "2",
"samsung": "2.1",
"electron": "0.2"
},
"proposal-nullish-coalescing-operator": {
"chrome": "80",
"firefox": "72",
"opera": "67"
}
}
1 change: 1 addition & 0 deletions packages/babel-preset-env/data/shipped-proposals.js
Expand Up @@ -9,6 +9,7 @@ const pluginSyntaxMap = new Map([
["proposal-optional-catch-binding", "syntax-optional-catch-binding"],
["proposal-unicode-property-regex", null],
["proposal-json-strings", "syntax-json-strings"],
["proposal-nullish-coalescing-operator", "syntax-nullish-coalescing-operator"],
]);

module.exports = { proposalPlugins, pluginSyntaxMap };
2 changes: 2 additions & 0 deletions packages/babel-preset-env/package.json
Expand Up @@ -19,12 +19,14 @@
"@babel/plugin-proposal-async-generator-functions": "^7.7.4",
"@babel/plugin-proposal-dynamic-import": "^7.7.4",
"@babel/plugin-proposal-json-strings": "^7.7.4",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4",
"@babel/plugin-proposal-object-rest-spread": "^7.7.4",
"@babel/plugin-proposal-optional-catch-binding": "^7.7.4",
"@babel/plugin-proposal-unicode-property-regex": "^7.7.4",
"@babel/plugin-syntax-async-generators": "^7.7.4",
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/plugin-syntax-json-strings": "^7.7.4",
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.7.4",
"@babel/plugin-syntax-object-rest-spread": "^7.7.4",
"@babel/plugin-syntax-optional-catch-binding": "^7.7.4",
"@babel/plugin-syntax-top-level-await": "^7.7.4",
Expand Down
2 changes: 2 additions & 0 deletions packages/babel-preset-env/src/available-plugins.js
Expand Up @@ -7,6 +7,7 @@ export default {
"syntax-object-rest-spread": require("@babel/plugin-syntax-object-rest-spread"),
"syntax-optional-catch-binding": require("@babel/plugin-syntax-optional-catch-binding"),
"syntax-top-level-await": require("@babel/plugin-syntax-top-level-await"),
"syntax-nullish-coalescing-operator": require("@babel/plugin-syntax-nullish-coalescing-operator"),
"transform-async-to-generator": require("@babel/plugin-transform-async-to-generator"),
"proposal-async-generator-functions": require("@babel/plugin-proposal-async-generator-functions"),
"proposal-dynamic-import": require("@babel/plugin-proposal-dynamic-import"),
Expand Down Expand Up @@ -44,4 +45,5 @@ export default {
"proposal-optional-catch-binding": require("@babel/plugin-proposal-optional-catch-binding"),
"transform-regenerator": require("@babel/plugin-transform-regenerator"),
"proposal-unicode-property-regex": require("@babel/plugin-proposal-unicode-property-regex"),
"proposal-nullish-coalescing-operator": require("@babel/plugin-proposal-nullish-coalescing-operator"),
};
Expand Up @@ -26,6 +26,7 @@ Using plugins:
proposal-json-strings { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" }
proposal-optional-catch-binding { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" }
transform-named-capturing-groups-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" }
proposal-nullish-coalescing-operator { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" }
syntax-dynamic-import { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" }

Using polyfills with `usage` option:
Expand Down
Expand Up @@ -26,6 +26,7 @@ Using plugins:
proposal-json-strings { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" }
proposal-optional-catch-binding { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" }
transform-named-capturing-groups-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" }
proposal-nullish-coalescing-operator { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" }
syntax-dynamic-import { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" }

Using polyfills with `usage` option:
Expand Down
Expand Up @@ -39,6 +39,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator {}
transform-modules-commonjs {}
proposal-dynamic-import {}

Expand Down
Expand Up @@ -37,6 +37,7 @@ Using plugins:
proposal-optional-catch-binding { "android":"4" }
transform-named-capturing-groups-regex { "android":"4" }
transform-reserved-words { "android":"4" }
proposal-nullish-coalescing-operator { "android":"4" }
transform-modules-commonjs { "android":"4" }
proposal-dynamic-import { "android":"4" }

Expand Down
Expand Up @@ -33,6 +33,7 @@ Using plugins:
transform-named-capturing-groups-regex { "electron":"0.36" }
transform-member-expression-literals { "electron":"0.36" }
transform-property-literals { "electron":"0.36" }
proposal-nullish-coalescing-operator { "electron":"0.36" }
transform-modules-commonjs { "electron":"0.36" }
proposal-dynamic-import { "electron":"0.36" }

Expand Down
Expand Up @@ -39,6 +39,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator { "chrome":"55" }
syntax-dynamic-import { "chrome":"55" }

Using polyfills with `entry` option:
Expand Down
Expand Up @@ -20,6 +20,7 @@ Using plugins:
proposal-json-strings { "node":"6" }
proposal-optional-catch-binding { "node":"6" }
transform-named-capturing-groups-regex { "node":"6" }
proposal-nullish-coalescing-operator { "node":"6" }
transform-modules-commonjs { "node":"6" }
proposal-dynamic-import { "node":"6" }

Expand Down
Expand Up @@ -12,6 +12,7 @@ Using plugins:
syntax-object-rest-spread { "chrome":"71" }
syntax-json-strings { "chrome":"71" }
syntax-optional-catch-binding { "chrome":"71" }
proposal-nullish-coalescing-operator { "chrome":"71" }
transform-modules-commonjs { "chrome":"71" }
proposal-dynamic-import { "chrome":"71" }

Expand Down
Expand Up @@ -37,6 +37,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator {}
transform-modules-commonjs {}
proposal-dynamic-import {}

Expand Down
Expand Up @@ -12,6 +12,7 @@ Using plugins:
syntax-object-rest-spread { "chrome":"71" }
syntax-json-strings { "chrome":"71" }
syntax-optional-catch-binding { "chrome":"71" }
proposal-nullish-coalescing-operator { "chrome":"71" }
transform-modules-commonjs { "chrome":"71" }
proposal-dynamic-import { "chrome":"71" }

Expand Down
Expand Up @@ -37,6 +37,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator {}
transform-modules-commonjs {}
proposal-dynamic-import {}

Expand Down
Expand Up @@ -41,6 +41,7 @@ Using plugins:
proposal-json-strings { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
proposal-optional-catch-binding { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
transform-named-capturing-groups-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
proposal-nullish-coalescing-operator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
transform-modules-commonjs { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
proposal-dynamic-import { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }

Expand Down
Expand Up @@ -49,6 +49,7 @@ Using plugins:
transform-named-capturing-groups-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
transform-member-expression-literals { "electron":"0.36" }
transform-property-literals { "electron":"0.36" }
proposal-nullish-coalescing-operator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
transform-modules-commonjs { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
proposal-dynamic-import { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }

Expand Down
Expand Up @@ -38,6 +38,7 @@ Using plugins:
proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" }
proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" }
transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" }
proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6.10" }
transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6.10" }
proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6.10" }

Expand Down
Expand Up @@ -38,6 +38,7 @@ Using plugins:
proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" }
proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" }
transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" }
proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6" }
transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6" }
proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6" }

Expand Down
Expand Up @@ -12,6 +12,7 @@ Using plugins:
syntax-object-rest-spread { "chrome":"71" }
syntax-json-strings { "chrome":"71" }
syntax-optional-catch-binding { "chrome":"71" }
proposal-nullish-coalescing-operator { "chrome":"71" }
transform-modules-commonjs { "chrome":"71" }
proposal-dynamic-import { "chrome":"71" }

Expand Down
Expand Up @@ -37,6 +37,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator {}
transform-modules-commonjs {}
proposal-dynamic-import {}

Expand Down
Expand Up @@ -37,6 +37,7 @@ Using plugins:
proposal-optional-catch-binding { "android":"4" }
transform-named-capturing-groups-regex { "android":"4" }
transform-reserved-words { "android":"4" }
proposal-nullish-coalescing-operator { "android":"4" }
transform-modules-commonjs { "android":"4" }
proposal-dynamic-import { "android":"4" }

Expand Down
Expand Up @@ -37,6 +37,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator {}
transform-modules-commonjs {}
proposal-dynamic-import {}

Expand Down
Expand Up @@ -33,6 +33,7 @@ Using plugins:
transform-named-capturing-groups-regex { "electron":"0.36" }
transform-member-expression-literals { "electron":"0.36" }
transform-property-literals { "electron":"0.36" }
proposal-nullish-coalescing-operator { "electron":"0.36" }
transform-modules-commonjs { "electron":"0.36" }
proposal-dynamic-import { "electron":"0.36" }

Expand Down
Expand Up @@ -12,6 +12,7 @@ Using plugins:
syntax-object-rest-spread { "chrome":"71" }
syntax-json-strings { "chrome":"71" }
syntax-optional-catch-binding { "chrome":"71" }
proposal-nullish-coalescing-operator { "chrome":"71" }
transform-modules-commonjs { "chrome":"71" }
proposal-dynamic-import { "chrome":"71" }

Expand Down
Expand Up @@ -12,6 +12,7 @@ Using plugins:
syntax-object-rest-spread { "chrome":"71" }
syntax-json-strings { "chrome":"71" }
syntax-optional-catch-binding { "chrome":"71" }
proposal-nullish-coalescing-operator { "chrome":"71" }
transform-modules-commonjs { "chrome":"71" }
proposal-dynamic-import { "chrome":"71" }

Expand Down
Expand Up @@ -37,6 +37,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator {}
transform-modules-commonjs {}
proposal-dynamic-import {}

Expand Down
Expand Up @@ -37,6 +37,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator {}
transform-modules-commonjs {}
proposal-dynamic-import {}

Expand Down
Expand Up @@ -39,6 +39,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator { "chrome":"55" }
syntax-dynamic-import { "chrome":"55" }

Using polyfills with `entry` option:
Expand Down
Expand Up @@ -20,6 +20,7 @@ Using plugins:
proposal-json-strings { "node":"6" }
proposal-optional-catch-binding { "node":"6" }
transform-named-capturing-groups-regex { "node":"6" }
proposal-nullish-coalescing-operator { "node":"6" }
transform-modules-commonjs { "node":"6" }
proposal-dynamic-import { "node":"6" }

Expand Down
Expand Up @@ -12,6 +12,7 @@ Using plugins:
syntax-object-rest-spread { "chrome":"71" }
syntax-json-strings { "chrome":"71" }
syntax-optional-catch-binding { "chrome":"71" }
proposal-nullish-coalescing-operator { "chrome":"71" }
transform-modules-commonjs { "chrome":"71" }
proposal-dynamic-import { "chrome":"71" }

Expand Down
Expand Up @@ -37,6 +37,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator {}
transform-modules-commonjs {}
proposal-dynamic-import {}

Expand Down
Expand Up @@ -12,6 +12,7 @@ Using plugins:
syntax-object-rest-spread { "chrome":"71" }
syntax-json-strings { "chrome":"71" }
syntax-optional-catch-binding { "chrome":"71" }
proposal-nullish-coalescing-operator { "chrome":"71" }
transform-modules-commonjs { "chrome":"71" }
proposal-dynamic-import { "chrome":"71" }

Expand Down
Expand Up @@ -12,6 +12,7 @@ Using plugins:
syntax-object-rest-spread { "chrome":"71" }
syntax-json-strings { "chrome":"71" }
syntax-optional-catch-binding { "chrome":"71" }
proposal-nullish-coalescing-operator { "chrome":"71" }
transform-modules-commonjs { "chrome":"71" }
proposal-dynamic-import { "chrome":"71" }

Expand Down
Expand Up @@ -12,6 +12,7 @@ Using plugins:
syntax-object-rest-spread { "chrome":"71" }
syntax-json-strings { "chrome":"71" }
syntax-optional-catch-binding { "chrome":"71" }
proposal-nullish-coalescing-operator { "chrome":"71" }
transform-modules-commonjs { "chrome":"71" }
proposal-dynamic-import { "chrome":"71" }

Expand Down
Expand Up @@ -37,6 +37,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator {}
transform-modules-commonjs {}
proposal-dynamic-import {}

Expand Down
Expand Up @@ -41,6 +41,7 @@ Using plugins:
proposal-json-strings { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
proposal-optional-catch-binding { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
transform-named-capturing-groups-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
proposal-nullish-coalescing-operator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
transform-modules-commonjs { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
proposal-dynamic-import { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }

Expand Down
Expand Up @@ -12,6 +12,7 @@ Using plugins:
syntax-object-rest-spread { "chrome":"71" }
syntax-json-strings { "chrome":"71" }
syntax-optional-catch-binding { "chrome":"71" }
proposal-nullish-coalescing-operator { "chrome":"71" }
transform-modules-commonjs { "chrome":"71" }
proposal-dynamic-import { "chrome":"71" }

Expand Down
Expand Up @@ -14,6 +14,7 @@ Using plugins:
proposal-json-strings { "samsung":"8.2" }
proposal-optional-catch-binding { "samsung":"8.2" }
transform-named-capturing-groups-regex { "samsung":"8.2" }
proposal-nullish-coalescing-operator { "samsung":"8.2" }
transform-modules-commonjs { "samsung":"8.2" }
proposal-dynamic-import { "samsung":"8.2" }

Expand Down
Expand Up @@ -37,6 +37,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator {}
transform-modules-commonjs {}
proposal-dynamic-import {}

Expand Down
Expand Up @@ -12,6 +12,7 @@ Using plugins:
syntax-object-rest-spread { "chrome":"71" }
syntax-json-strings { "chrome":"71" }
syntax-optional-catch-binding { "chrome":"71" }
proposal-nullish-coalescing-operator { "chrome":"71" }
transform-modules-commonjs { "chrome":"71" }
proposal-dynamic-import { "chrome":"71" }

Expand Down
Expand Up @@ -37,6 +37,7 @@ Using plugins:
transform-member-expression-literals {}
transform-property-literals {}
transform-reserved-words {}
proposal-nullish-coalescing-operator {}
transform-modules-commonjs {}
proposal-dynamic-import {}

Expand Down
Expand Up @@ -49,6 +49,7 @@ Using plugins:
transform-named-capturing-groups-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
transform-member-expression-literals { "electron":"0.36" }
transform-property-literals { "electron":"0.36" }
proposal-nullish-coalescing-operator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
transform-modules-commonjs { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
proposal-dynamic-import { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }

Expand Down
Expand Up @@ -38,6 +38,7 @@ Using plugins:
proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" }
proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" }
transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" }
proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6.10" }
transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6.10" }
proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6.10" }

Expand Down