Skip to content

Commit

Permalink
fix: track finished proposals in corejs3-finished-proposals.json
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Dec 26, 2019
1 parent c742cf3 commit 408ab24
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
@@ -0,0 +1,5 @@
[
"esnext.global-this",
"esnext.promise.all-settled",
"esnext.string.match-all"
]
11 changes: 8 additions & 3 deletions packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js
@@ -1,7 +1,8 @@
// @flow

import corejs3Polyfills from "core-js-compat/data";
import corejs3ShippedProposalsList from "./shipped-proposals";
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";
import {
Expand Down Expand Up @@ -33,13 +34,17 @@ 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."))
.filter(
name =>
!name.startsWith("esnext.") ||
(corejs3FinishedProposalsList: string[]).includes(name),
)
.reduce((memo, key) => {
memo[key] = corejs3Polyfills[key];
return memo;
}, {});

const corejs3PolyfillsWithShippedProposals = corejs3ShippedProposalsList.reduce(
const corejs3PolyfillsWithShippedProposals = (corejs3ShippedProposalsList: string[]).reduce(
(memo, key) => {
memo[key] = corejs3Polyfills[key];
return memo;
Expand Down

0 comments on commit 408ab24

Please sign in to comment.