@babel/helper-define-polyfill-provider
Advanced tools
Comparing version 0.3.3 to 0.4.0
@@ -136,3 +136,3 @@ "use strict"; | ||
if (!polyfillsNames.has(name)) { | ||
console.warn(`Internal error in the ${provider.name} provider: ` + `unknown polyfill "${name}".`); | ||
console.warn(`Internal error in the ${providerName} provider: ` + `unknown polyfill "${name}".`); | ||
} | ||
@@ -163,3 +163,3 @@ | ||
if (!debug || !name) return; | ||
if (debugLog().polyfills.has(provider.name)) return; | ||
if (debugLog().polyfills.has(providerName)) return; | ||
debugLog().polyfills.add(name); | ||
@@ -189,5 +189,6 @@ (_debugLog$polyfillsSu = (_debugLog = debugLog()).polyfillsSupport) != null ? _debugLog$polyfillsSu : _debugLog.polyfillsSupport = polyfillsSupport; | ||
const provider = factory(api, providerOptions, dirname); | ||
const providerName = provider.name || factory.name; | ||
if (typeof provider[methodName] !== "function") { | ||
throw new Error(`The "${provider.name || factory.name}" provider doesn't ` + `support the "${method}" polyfilling method.`); | ||
throw new Error(`The "${providerName}" provider doesn't support the "${method}" polyfilling method.`); | ||
} | ||
@@ -209,3 +210,3 @@ | ||
exclude | ||
} = (0, _normalizeOptions.validateIncludeExclude)(provider.name || factory.name, polyfillsNames, providerOptions.include || [], providerOptions.exclude || [])); | ||
} = (0, _normalizeOptions.validateIncludeExclude)(providerName, polyfillsNames, providerOptions.include || [], providerOptions.exclude || [])); | ||
return { | ||
@@ -216,2 +217,3 @@ debug, | ||
provider, | ||
providerName, | ||
@@ -239,2 +241,3 @@ callProvider(payload, path) { | ||
provider, | ||
providerName, | ||
callProvider | ||
@@ -246,3 +249,3 @@ } = instantiateProvider(factory, options, missingDependencies, dirname, () => debugLog, babelApi); | ||
if (debug && debug !== _debugUtils.presetEnvSilentDebugHeader) { | ||
console.log(`${provider.name}: \`DEBUG\` option`); | ||
console.log(`${providerName}: \`DEBUG\` option`); | ||
console.log(`\nUsing targets: ${(0, _debugUtils.stringifyTargetsMultiline)(targets)}`); | ||
@@ -252,2 +255,5 @@ console.log(`\nUsing polyfills with \`${method}\` method:`); | ||
const { | ||
runtimeName | ||
} = provider; | ||
return { | ||
@@ -257,5 +263,14 @@ name: "inject-polyfills", | ||
pre() { | ||
pre(file) { | ||
var _provider$pre; | ||
if (runtimeName) { | ||
if (file.get("runtimeHelpersModuleName") && file.get("runtimeHelpersModuleName") !== runtimeName) { | ||
console.warn(`Two different polyfill providers` + ` (${file.get("runtimeHelpersModuleProvider")}` + ` and ${providerName}) are trying to define two` + ` conflicting @babel/runtime alternatives:` + ` ${file.get("runtimeHelpersModuleName")} and ${runtimeName}.` + ` The second one will be ignored.`); | ||
} else { | ||
file.set("runtimeHelpersModuleName", runtimeName); | ||
file.set("runtimeHelpersModuleProvider", providerName); | ||
} | ||
} | ||
debugLog = { | ||
@@ -288,3 +303,3 @@ polyfills: new Set(), | ||
if (debugLog.polyfills.size === 0) { | ||
console.log(method === "entry-global" ? debugLog.found ? `Based on your targets, the ${provider.name} polyfill did not add any polyfill.` : `The entry point for the ${provider.name} polyfill has not been found.` : `Based on your code and targets, the ${provider.name} polyfill did not add any polyfill.`); | ||
console.log(method === "entry-global" ? debugLog.found ? `Based on your targets, the ${providerName} polyfill did not add any polyfill.` : `The entry point for the ${providerName} polyfill has not been found.` : `Based on your code and targets, the ${providerName} polyfill did not add any polyfill.`); | ||
return; | ||
@@ -294,5 +309,5 @@ } | ||
if (method === "entry-global") { | ||
console.log(`The ${provider.name} polyfill entry has been replaced with ` + `the following polyfills:`); | ||
console.log(`The ${providerName} polyfill entry has been replaced with ` + `the following polyfills:`); | ||
} else { | ||
console.log(`The ${provider.name} polyfill added the following polyfills:`); | ||
console.log(`The ${providerName} polyfill added the following polyfills:`); | ||
} | ||
@@ -299,0 +314,0 @@ |
{ | ||
"name": "@babel/helper-define-polyfill-provider", | ||
"version": "0.3.3", | ||
"version": "0.4.0", | ||
"description": "Babel helper to create your own polyfill provider", | ||
@@ -59,3 +59,3 @@ "repository": { | ||
}, | ||
"gitHead": "42b9477c199c0c5420b45cfa8c9bb892d94a64af" | ||
"gitHead": "391a1f4049fe1d6943ca8e91cf7e2e23f3f1ef73" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
201230
2347