babel-plugin-polyfill-corejs3
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -46,3 +46,4 @@ "use strict"; | ||
[runtimeCompat]: { | ||
useBabelRuntime | ||
useBabelRuntime, | ||
ext = ".js" | ||
} = {} | ||
@@ -57,3 +58,3 @@ }) { | ||
const available = new Set((0, _getModulesListForTargetVersion.default)(version)); | ||
const coreJSPureBase = useBabelRuntime ? proposals ? "@babel/runtime-corejs3/core-js" : "@babel/runtime-corejs3/core-js-stable" : proposals ? "core-js-pure/features" : "core-js-pure/stable"; | ||
const coreJSPureBase = useBabelRuntime ? proposals ? `${useBabelRuntime}/core-js` : `${useBabelRuntime}/core-js-stable` : proposals ? "core-js-pure/features" : "core-js-pure/stable"; | ||
@@ -82,3 +83,3 @@ function maybeInjectGlobalImpl(name, utils) { | ||
if (desc.pure && !(object && desc.exclude && desc.exclude.includes(object)) && esnextFallback(desc.name, shouldInjectPolyfill)) { | ||
return utils.injectDefaultImport(`${coreJSPureBase}/${desc.pure}.js`, hint); | ||
return utils.injectDefaultImport(`${coreJSPureBase}/${desc.pure}${ext}`, hint); | ||
} | ||
@@ -134,3 +135,3 @@ } | ||
if (meta.key === "Symbol.iterator") { | ||
path.replaceWith(_core.types.callExpression(utils.injectDefaultImport((0, _utils.coreJSPureHelper)("is-iterable", useBabelRuntime), "isIterable"), [path.node.right])); | ||
path.replaceWith(_core.types.callExpression(utils.injectDefaultImport((0, _utils.coreJSPureHelper)("is-iterable", useBabelRuntime, ext), "isIterable"), [path.node.right])); | ||
} | ||
@@ -159,9 +160,9 @@ | ||
if (path.parent.arguments.length === 0) { | ||
path.parentPath.replaceWith(_core.types.callExpression(utils.injectDefaultImport((0, _utils.coreJSPureHelper)("get-iterator", useBabelRuntime), "getIterator"), [path.node.object])); | ||
path.parentPath.replaceWith(_core.types.callExpression(utils.injectDefaultImport((0, _utils.coreJSPureHelper)("get-iterator", useBabelRuntime, ext), "getIterator"), [path.node.object])); | ||
path.skip(); | ||
} else { | ||
(0, _utils.callMethod)(path, utils.injectDefaultImport((0, _utils.coreJSPureHelper)("get-iterator-method", useBabelRuntime), "getIteratorMethod")); | ||
(0, _utils.callMethod)(path, utils.injectDefaultImport((0, _utils.coreJSPureHelper)("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod")); | ||
} | ||
} else { | ||
path.replaceWith(_core.types.callExpression(utils.injectDefaultImport((0, _utils.coreJSPureHelper)("get-iterator-method", useBabelRuntime), "getIteratorMethod"), [path.node.object])); | ||
path.replaceWith(_core.types.callExpression(utils.injectDefaultImport((0, _utils.coreJSPureHelper)("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"), [path.node.object])); | ||
} | ||
@@ -168,0 +169,0 @@ |
@@ -45,4 +45,4 @@ "use strict"; | ||
function coreJSPureHelper(name, useBabelRuntime) { | ||
return useBabelRuntime ? `@babel/runtime-corejs3/core-js/${name}.js` : `core-js-pure/features/${name}.js`; | ||
function coreJSPureHelper(name, useBabelRuntime, ext) { | ||
return useBabelRuntime ? `${useBabelRuntime}/core-js/${name}${ext}` : `core-js-pure/features/${name}.js`; | ||
} |
{ | ||
"name": "babel-plugin-polyfill-corejs3", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A Babel plugin to inject imports to core-js@3 polyfills", | ||
@@ -33,3 +33,3 @@ "repository": { | ||
}, | ||
"gitHead": "57edac90ba049d5ac2386cfaa0be131a68030d21" | ||
"gitHead": "b1a6b262d1de56486a2ab662ecc25834be6d2ad5" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32159
556