mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
* Remove corejs2 and legacy files from compat-data * Suppress wrong linting errors * Update eslint comment
30 lines
988 B
JavaScript
30 lines
988 B
JavaScript
import data from "core-js-compat/data.json" with { type: "json" };
|
|
import fs from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const features = Object.keys(data);
|
|
|
|
const shippedProposals = features.filter(feature => {
|
|
return feature.startsWith("esnext.") && Object.keys(data[feature]).length > 0;
|
|
});
|
|
|
|
const finishedProposals = shippedProposals.filter(feature => {
|
|
return features.includes(feature.replace("esnext.", "es."));
|
|
});
|
|
|
|
const builtinDefinitionsURL = new URL(
|
|
"../../babel-preset-env/src/polyfills/corejs3/built-in-definitions.js",
|
|
import.meta.url
|
|
);
|
|
|
|
const builtInDefinitions = fs.readFileSync(builtinDefinitionsURL, "utf-8");
|
|
|
|
for (const feature of finishedProposals) {
|
|
const standardizedName = feature.replace("esnext.", "es.");
|
|
if (!builtInDefinitions.includes(standardizedName)) {
|
|
console.log(
|
|
`${feature} is now standardized as ${standardizedName}, please add "${standardizedName}" to "${fileURLToPath(builtinDefinitionsURL)}"`
|
|
);
|
|
}
|
|
}
|