| 1 |
"use strict"; |
| 2 |
|
| 3 |
const path = require("path"); |
| 4 |
|
| 5 |
const { generateData, environments, writeFile } = require("./utils-build-data"); |
| 6 |
|
| 7 |
const newData = generateData(environments, require(`./es-shims-features`)); |
| 8 |
|
| 9 |
|
| 10 |
const missing = [ |
| 11 |
"Array.prototype.toReversed", |
| 12 |
"Array.prototype.toSorted", |
| 13 |
"Array.prototype.toSpliced", |
| 14 |
"Array.prototype.with", |
| 15 |
]; |
| 16 |
for (const name of missing) { |
| 17 |
if (newData[name]) throw new Error(`Missing feature is present: ${name}`); |
| 18 |
newData[name] = {}; |
| 19 |
} |
| 20 |
|
| 21 |
const dataPath = path.join( |
| 22 |
__dirname, |
| 23 |
`../../packages/babel-plugin-polyfill-es-shims/data/polyfills.json` |
| 24 |
); |
| 25 |
|
| 26 |
if (!writeFile(newData, dataPath, "es-shims")) { |
| 27 |
process.exitCode = 1; |
| 28 |
} |