babel-plugin-polyfill-corejs2
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -20,3 +20,4 @@ "use strict"; | ||
const presetEnvCompat = "#__secret_key__@babel/preset-env__compatibility"; // $FlowIgnore | ||
const presetEnvCompat = "#__secret_key__@babel/preset-env__compatibility"; | ||
const runtimeCompat = "#__secret_key__@babel/runtime__compatibility"; // $FlowIgnore | ||
@@ -26,5 +27,8 @@ const has = Function.call.bind(Object.hasOwnProperty); | ||
var _default = (0, _helperDefinePolyfillProvider.default)(function (api, { | ||
version: runtimeVersion = "7.0.0-beta.0", | ||
[presetEnvCompat]: { | ||
entryInjectRegenerator | ||
} = {}, | ||
[runtimeCompat]: { | ||
useBabelRuntime, | ||
runtimeVersion | ||
} = {} | ||
@@ -43,3 +47,3 @@ }) { | ||
const polyfills = (0, _addPlatformSpecificPolyfills.default)(api.targets, method, _corejs2BuiltIns.default); | ||
const coreJSBase = method === "usage-pure" ? "core-js/library/fn" : "core-js/modules"; | ||
const coreJSBase = useBabelRuntime ? "@babel/runtime-corejs2/core-js" : method === "usage-pure" ? "core-js/library/fn" : "core-js/modules"; | ||
@@ -71,4 +75,5 @@ function inject(name, utils) { | ||
} = desc; | ||
if (!pure || !shouldInjectPolyfill(name)) return; | ||
if (!pure || !(0, _helpers.hasMinVersion)(meta && meta.minRuntimeVersion, runtimeVersion) || !shouldInjectPolyfill(name)) { | ||
if (runtimeVersion && meta && meta.minRuntimeVersion && !(0, _helpers.hasMinVersion)(meta && meta.minRuntimeVersion, runtimeVersion)) { | ||
return; | ||
@@ -119,2 +124,6 @@ } | ||
if (path.parentPath.isUnaryExpression({ | ||
operator: "delete" | ||
})) return; | ||
if (meta.kind === "property") { | ||
@@ -121,0 +130,0 @@ // We can't compile destructuring. |
{ | ||
"name": "babel-plugin-polyfill-corejs2", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A Babel plugin to inject imports to core-js@2 polyfills", | ||
@@ -32,3 +32,3 @@ "repository": { | ||
}, | ||
"gitHead": "440228dfbaff5d0632a02f295002579fe862e614" | ||
"gitHead": "57edac90ba049d5ac2386cfaa0be131a68030d21" | ||
} |
21374
388