Debian Codegraph @

packages/babel-preset-env/src/shipped-proposals.ts

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
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 "transform-unicode-property-regex": null as null,
27 } as const;
28
29 const pluginSyntaxEntries = Object.keys(pluginSyntaxObject).map<
30 [string, string | null]
31 >(function (key) {
32 return [
33 key,
34 // @ts-expect-error key has been guarded
35 pluginSyntaxObject[key],
36 ];
37 });
38
39 const pluginSyntaxMap = new Map(pluginSyntaxEntries);
40
41 export { proposalPlugins, proposalSyntaxPlugins, pluginSyntaxMap };