babel-plugin-polyfill-corejs2
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -31,3 +31,4 @@ "use strict"; | ||
useBabelRuntime, | ||
runtimeVersion | ||
runtimeVersion, | ||
ext = ".js" | ||
} = {} | ||
@@ -46,3 +47,3 @@ }) { | ||
const polyfills = (0, _addPlatformSpecificPolyfills.default)(api.targets, method, _corejs2BuiltIns.default); | ||
const coreJSBase = useBabelRuntime ? "@babel/runtime-corejs2/core-js" : method === "usage-pure" ? "core-js/library/fn" : "core-js/modules"; | ||
const coreJSBase = useBabelRuntime ? `${useBabelRuntime}/core-js` : method === "usage-pure" ? "core-js/library/fn" : "core-js/modules"; | ||
@@ -80,3 +81,3 @@ function inject(name, utils) { | ||
return utils.injectDefaultImport(`${coreJSBase}/${pure}.js`, hint); | ||
return utils.injectDefaultImport(`${coreJSBase}/${pure}${ext}`, hint); | ||
} | ||
@@ -117,3 +118,3 @@ | ||
if (meta.key === "Symbol.iterator") { | ||
path.replaceWith(_core.types.callExpression(utils.injectDefaultImport(`${coreJSBase}/is-iterable.js`, "isIterable"), [path.node.right])); | ||
path.replaceWith(_core.types.callExpression(utils.injectDefaultImport(`${coreJSBase}/is-iterable${ext}`, "isIterable"), [path.node.right])); | ||
} | ||
@@ -136,3 +137,3 @@ | ||
}) && path.parent.arguments.length === 0) { | ||
path.parentPath.replaceWith(_core.types.callExpression(utils.injectDefaultImport(`${coreJSBase}/get-iterator.js`, "getIterator"), [path.node.object])); | ||
path.parentPath.replaceWith(_core.types.callExpression(utils.injectDefaultImport(`${coreJSBase}/get-iterator${ext}`, "getIterator"), [path.node.object])); | ||
path.skip(); | ||
@@ -139,0 +140,0 @@ return; |
{ | ||
"name": "babel-plugin-polyfill-corejs2", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A Babel plugin to inject imports to core-js@2 polyfills", | ||
@@ -32,3 +32,3 @@ "repository": { | ||
}, | ||
"gitHead": "57edac90ba049d5ac2386cfaa0be131a68030d21" | ||
"gitHead": "b1a6b262d1de56486a2ab662ecc25834be6d2ad5" | ||
} |
21396
389