| 1 | import compatData from "../packages/babel-plugin-polyfill-corejs3/core-js-compat/data.js"; |
| 2 | import fs from "node:fs"; |
| 3 | |
| 4 | const path = new URL( |
| 5 | "../packages/babel-plugin-polyfill-corejs3/src/shipped-proposals.ts", |
| 6 | import.meta.url |
| 7 | ); |
| 8 | |
| 9 | const template = features => `// This file is automatically generated by scripts/build-corejs3-shipped-proposals.mjs |
| 10 | |
| 11 | export default new Set<string>([ |
| 12 | ${features.map(f => ` "${f}",\n`).join("")}]); |
| 13 | `; |
| 14 | |
| 15 | const shippedProposals = []; |
| 16 | |
| 17 | for (const feature in compatData) { |
| 18 | if (!feature.startsWith("esnext.")) continue; |
| 19 | const esName = "es." + feature.slice(7); |
| 20 | if (esName in compatData) continue; |
| 21 | if (Object.keys(compatData[feature]).length === 0) continue; |
| 22 | shippedProposals.push(feature); |
| 23 | } |
| 24 | |
| 25 | fs.writeFileSync(path, template(shippedProposals)); |