Skip to content

Commit

Permalink
refactor: remove unused finished proposals json
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jan 7, 2020
1 parent 7e76e07 commit c69c141
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.

This file was deleted.

15 changes: 12 additions & 3 deletions packages/babel-preset-env/scripts/build-corejs3-proposals.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ const finishedProposals = shippedProposals.filter(feature => {
return features.includes(feature.replace("esnext.", "es."));
});

fs.writeFileSync(
path.join(__dirname, "../data/corejs3-finished-proposals.json"),
JSON.stringify(finishedProposals, undefined, 2) + "\n"
const builtInDefinitions = fs.readFileSync(
path.join(__dirname, "../src/polyfills/corejs3/built-in-definitions.js"),
"utf-8"
);

for (const feature of finishedProposals) {
const standarizedName = feature.replace("esnext.", "es.");
if (!builtInDefinitions.includes(standarizedName)) {
console.log(
`${feature} is now standarized as ${standarizedName}, please add "${standarizedName}" to src/polyfills/corejs3/built-in-definitions`
);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @flow

import corejs3Polyfills from "core-js-compat/data";
import corejs3FinishedProposalsList from "../../../data/corejs3-finished-proposals.json";
import corejs3ShippedProposalsList from "../../../data/corejs3-shipped-proposals.json";
import getModulesListForTargetVersion from "core-js-compat/get-modules-list-for-target-version";
import filterItems from "../../filter-items";
Expand Down Expand Up @@ -34,11 +33,7 @@ const NO_DIRECT_POLYFILL_IMPORT = `
Please remove the direct import of \`core-js\` or use \`useBuiltIns: 'entry'\` instead.`;

const corejs3PolyfillsWithoutProposals = Object.keys(corejs3Polyfills)
.filter(
name =>
!name.startsWith("esnext.") ||
(corejs3FinishedProposalsList: string[]).includes(name),
)
.filter(name => !name.startsWith("esnext."))
.reduce((memo, key) => {
memo[key] = corejs3Polyfills[key];
return memo;
Expand Down

0 comments on commit c69c141

Please sign in to comment.