Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add optional-chaining and nullish-coalescing to preset-env (#10811)
* Add support for optional-chaining (stage 4) in present-env * revert babel-preset-env built-in-modules.json * add shipped proposal syntax map entry, optional chaining * update remaining syntax plugin references, proposal description * Add support for nullish coalescing operator in preset-env * selectively enable sort-keys rule * enforce sort-keys on shipped-proposals * don't use Object.entries() * Update fixtures
- Loading branch information
1 parent
4cb2148
commit 80aa7dc
Showing
99 changed files
with
315 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/babel-preset-env-standalone/src/available-plugins.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
/* eslint sort-keys: "error" */ | ||
// These mappings represent the syntax proposals that have been | ||
// shipped by browsers, and are enabled by the `shippedProposals` option. | ||
|
||
const proposalPlugins = {}; | ||
|
||
const pluginSyntaxMap = new Map([ | ||
["proposal-async-generator-functions", "syntax-async-generators"], | ||
["proposal-object-rest-spread", "syntax-object-rest-spread"], | ||
["proposal-optional-catch-binding", "syntax-optional-catch-binding"], | ||
["proposal-unicode-property-regex", null], | ||
["proposal-json-strings", "syntax-json-strings"], | ||
]); | ||
// use intermediary object to enforce alphabetical key order | ||
const pluginSyntaxObject = { | ||
"proposal-async-generator-functions": "syntax-async-generators", | ||
"proposal-json-strings": "syntax-json-strings", | ||
"proposal-nullish-coalescing-operator": "syntax-nullish-coalescing-operator", | ||
"proposal-object-rest-spread": "syntax-object-rest-spread", | ||
"proposal-optional-catch-binding": "syntax-optional-catch-binding", | ||
"proposal-optional-chaining": "syntax-optional-chaining", | ||
"proposal-unicode-property-regex": null, | ||
}; | ||
|
||
module.exports = { proposalPlugins, pluginSyntaxMap }; | ||
const pluginSyntaxEntries = Object.keys(pluginSyntaxObject).map(function (key) { | ||
return [key, pluginSyntaxObject[key]]; | ||
}); | ||
|
||
const pluginSyntaxMap = new Map(pluginSyntaxEntries); | ||
|
||
module.exports = { pluginSyntaxMap, proposalPlugins }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.