| 1 |
// TODO(Babel 8): Remove this file |
| 2 |
/* eslint sort-keys: "error" */ |
| 3 |
// These mappings represent the transform plugins that have been |
| 4 |
// shipped by browsers, and are enabled by the `shippedProposals` option. |
| 5 |
|
| 6 |
const proposalPlugins = new Set<string>(); |
| 7 |
|
| 8 |
// proposal syntax plugins enabled by the `shippedProposals` option. |
| 9 |
// Unlike proposalPlugins above, they are independent of compiler targets. |
| 10 |
const proposalSyntaxPlugins = ["syntax-import-assertions"] as const; |
| 11 |
|
| 12 |
// use intermediary object to enforce alphabetical key order |
| 13 |
const pluginSyntaxObject = { |
| 14 |
"transform-async-generator-functions": "syntax-async-generators", |
| 15 |
"transform-class-properties": "syntax-class-properties", |
| 16 |
"transform-class-static-block": "syntax-class-static-block", |
| 17 |
"transform-json-strings": "syntax-json-strings", |
| 18 |
"transform-nullish-coalescing-operator": "syntax-nullish-coalescing-operator", |
| 19 |
"transform-numeric-separator": "syntax-numeric-separator", |
| 20 |
"transform-object-rest-spread": "syntax-object-rest-spread", |
| 21 |
"transform-optional-catch-binding": "syntax-optional-catch-binding", |
| 22 |
"transform-optional-chaining": "syntax-optional-chaining", |
| 23 |
// note: we don't have syntax-private-methods |
| 24 |
"transform-private-methods": "syntax-class-properties", |
| 25 |
"transform-private-property-in-object": "syntax-private-property-in-object", |
| •26 |
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion |
| 27 |
"transform-unicode-property-regex": null as null, |
| 28 |
} as const; |
| 29 |
|
| •30 |
type PluginSyntaxObjectKeys = keyof typeof pluginSyntaxObject; |
| 31 |
|
| 32 |
const pluginSyntaxEntries = Object.keys(pluginSyntaxObject).map< |
| •33 |
[PluginSyntaxObjectKeys, string | null] |
| 34 |
>(function (key: PluginSyntaxObjectKeys) { |
| 35 |
return [key, pluginSyntaxObject[key]]; |
| 36 |
}); |
| 37 |
|
| 38 |
const pluginSyntaxMap = new Map(pluginSyntaxEntries); |
| 39 |
|
| 40 |
export { proposalPlugins, proposalSyntaxPlugins, pluginSyntaxMap }; |