Commit 4e362378 authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

Merge branch 'MLAB-671' into 'testing'

Mlab 671

See merge request !158
parents 3d0c87b0 bde9ccfd
Pipeline #6646 passed with stage
in 11 seconds
# @babel/helper-define-polyfill-provider
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-define-polyfill-provider
```
or using yarn:
```sh
yarn add @babel/helper-define-polyfill-provider --dev
```
import { declare } from '@babel/helper-plugin-utils';
import _getTargets, { prettifyTargets, getInclusionReasons, isRequired } from '@babel/helper-compilation-targets';
import * as babel from '@babel/core';
const {
types: t$1,
template
} = babel.default || babel;
function intersection(a, b) {
const result = new Set();
a.forEach(v => b.has(v) && result.add(v));
return result;
}
function has$1(object, key) {
return Object.prototype.hasOwnProperty.call(object, key);
}
function getType(target) {
return Object.prototype.toString.call(target).slice(8, -1);
}
function resolveId(path) {
if (path.isIdentifier() && !path.scope.hasBinding(path.node.name,
/* noGlobals */
true)) {
return path.node.name;
}
const {
deopt
} = path.evaluate();
if (deopt && deopt.isIdentifier()) {
return deopt.node.name;
}
}
function resolveKey(path, computed = false) {
const {
node,
parent,
scope
} = path;
if (path.isStringLiteral()) return node.value;
const {
name
} = node;
const isIdentifier = path.isIdentifier();
if (isIdentifier && !(computed || parent.computed)) return name;
if (computed && path.isMemberExpression() && path.get("object").isIdentifier({
name: "Symbol"
}) && !scope.hasBinding("Symbol",
/* noGlobals */
true)) {
const sym = resolveKey(path.get("property"), path.node.computed);
if (sym) return "Symbol." + sym;
}
if (!isIdentifier || scope.hasBinding(name,
/* noGlobals */
true)) {
const {
value
} = path.evaluate();
if (typeof value === "string") return value;
}
}
function resolveSource(obj) {
if (obj.isMemberExpression() && obj.get("property").isIdentifier({
name: "prototype"
})) {
const id = resolveId(obj.get("object"));
if (id) {
return {
id,
placement: "prototype"
};
}
return {
id: null,
placement: null
};
}
const id = resolveId(obj);
if (id) {
return {
id,
placement: "static"
};
}
const {
value
} = obj.evaluate();
if (value !== undefined) {
return {
id: getType(value),
placement: "prototype"
};
} else if (obj.isRegExpLiteral()) {
return {
id: "RegExp",
placement: "prototype"
};
} else if (obj.isFunction()) {
return {
id: "Function",
placement: "prototype"
};
}
return {
id: null,
placement: null
};
}
function getImportSource({
node
}) {
if (node.specifiers.length === 0) return node.source.value;
}
function getRequireSource({
node
}) {
if (!t$1.isExpressionStatement(node)) return;
const {
expression
} = node;
const isRequire = t$1.isCallExpression(expression) && t$1.isIdentifier(expression.callee) && expression.callee.name === "require" && expression.arguments.length === 1 && t$1.isStringLiteral(expression.arguments[0]);
if (isRequire) return expression.arguments[0].value;
}
function hoist(node) {
node._blockHoist = 3;
return node;
}
function createUtilsGetter(cache) {
return path => {
const prog = path.findParent(p => p.isProgram());
return {
injectGlobalImport(url) {
cache.storeAnonymous(prog, url, (isScript, source) => {
return isScript ? template.statement.ast`require(${source})` : t$1.importDeclaration([], source);
});
},
injectNamedImport(url, name, hint = name) {
return cache.storeNamed(prog, url, name, (isScript, source, name) => {
const id = prog.scope.generateUidIdentifier(hint);
return {
node: isScript ? hoist(template.statement.ast`
var ${id} = require(${source}).${name}
`) : t$1.importDeclaration([t$1.importSpecifier(id, name)], source),
name: id.name
};
});
},
injectDefaultImport(url, hint = url) {
return cache.storeNamed(prog, url, "default", (isScript, source) => {
const id = prog.scope.generateUidIdentifier(hint);
return {
node: isScript ? hoist(template.statement.ast`var ${id} = require(${source})`) : t$1.importDeclaration([t$1.importDefaultSpecifier(id)], source),
name: id.name
};
});
}
};
};
}
const {
types: t
} = babel.default || babel;
class ImportsCache {
constructor(resolver) {
this._imports = new WeakMap();
this._anonymousImports = new WeakMap();
this._lastImports = new WeakMap();
this._resolver = resolver;
}
storeAnonymous(programPath, url, // eslint-disable-next-line no-undef
getVal) {
const key = this._normalizeKey(programPath, url);
const imports = this._ensure(this._anonymousImports, programPath, Set);
if (imports.has(key)) return;
const node = getVal(programPath.node.sourceType === "script", t.stringLiteral(this._resolver(url)));
imports.add(key);
this._injectImport(programPath, node);
}
storeNamed(programPath, url, name, getVal) {
const key = this._normalizeKey(programPath, url, name);
const imports = this._ensure(this._imports, programPath, Map);
if (!imports.has(key)) {
const {
node,
name: id
} = getVal(programPath.node.sourceType === "script", t.stringLiteral(this._resolver(url)), t.identifier(name));
imports.set(key, id);
this._injectImport(programPath, node);
}
return t.identifier(imports.get(key));
}
_injectImport(programPath, node) {
let lastImport = this._lastImports.get(programPath);
if (lastImport && lastImport.node && // Sometimes the AST is modified and the "last import"
// we have has been replaced
lastImport.parent === programPath.node && lastImport.container === programPath.node.body) {
lastImport = lastImport.insertAfter(node);
} else {
lastImport = programPath.unshiftContainer("body", node);
}
lastImport = lastImport[lastImport.length - 1];
this._lastImports.set(programPath, lastImport);
/*
let lastImport;
programPath.get("body").forEach(path => {
if (path.isImportDeclaration()) lastImport = path;
if (
path.isExpressionStatement() &&
isRequireCall(path.get("expression"))
) {
lastImport = path;
}
if (
path.isVariableDeclaration() &&
path.get("declarations").length === 1 &&
(isRequireCall(path.get("declarations.0.init")) ||
(path.get("declarations.0.init").isMemberExpression() &&
isRequireCall(path.get("declarations.0.init.object"))))
) {
lastImport = path;
}
});*/
}
_ensure(map, programPath, Collection) {
let collection = map.get(programPath);
if (!collection) {
collection = new Collection();
map.set(programPath, collection);
}
return collection;
}
_normalizeKey(programPath, url, name = "") {
const {
sourceType
} = programPath.node; // If we rely on the imported binding (the "name" parameter), we also need to cache
// based on the sourceType. This is because the module transforms change the names
// of the import variables.
return `${name && sourceType}::${url}::${name}`;
}
}
const presetEnvSilentDebugHeader = "#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets";
function stringifyTargetsMultiline(targets) {
return JSON.stringify(prettifyTargets(targets), null, 2);
}
function patternToRegExp(pattern) {
if (pattern instanceof RegExp) return pattern;
try {
return new RegExp(`^${pattern}$`);
} catch {
return null;
}
}
function buildUnusedError(label, unused) {
if (!unused.length) return "";
return ` - The following "${label}" patterns didn't match any polyfill:\n` + unused.map(original => ` ${String(original)}\n`).join("");
}
function buldDuplicatesError(duplicates) {
if (!duplicates.size) return "";
return ` - The following polyfills were matched both by "include" and "exclude" patterns:\n` + Array.from(duplicates, name => ` ${name}\n`).join("");
}
function validateIncludeExclude(provider, polyfills, includePatterns, excludePatterns) {
let current;
const filter = pattern => {
const regexp = patternToRegExp(pattern);
if (!regexp) return false;
let matched = false;
for (const polyfill of polyfills) {
if (regexp.test(polyfill)) {
matched = true;
current.add(polyfill);
}
}
return !matched;
}; // prettier-ignore
const include = current = new Set();
const unusedInclude = Array.from(includePatterns).filter(filter); // prettier-ignore
const exclude = current = new Set();
const unusedExclude = Array.from(excludePatterns).filter(filter);
const duplicates = intersection(include, exclude);
if (duplicates.size > 0 || unusedInclude.length > 0 || unusedExclude.length > 0) {
throw new Error(`Error while validating the "${provider}" provider options:\n` + buildUnusedError("include", unusedInclude) + buildUnusedError("exclude", unusedExclude) + buldDuplicatesError(duplicates));
}
return {
include,
exclude
};
}
function applyMissingDependenciesDefaults(options, babelApi) {
const {
missingDependencies = {}
} = options;
if (missingDependencies === false) return false;
const caller = babelApi.caller(caller => caller == null ? void 0 : caller.name);
const {
log = "deferred",
inject = caller === "rollup-plugin-babel" ? "throw" : "import",
all = false
} = missingDependencies;
return {
log,
inject,
all
};
}
var usage = (callProvider => {
function property(object, key, placement, path) {
return callProvider({
kind: "property",
object,
key,
placement
}, path);
}
return {
// Symbol(), new Promise
ReferencedIdentifier(path) {
const {
node: {
name
},
scope
} = path;
if (scope.getBindingIdentifier(name)) return;
callProvider({
kind: "global",
name
}, path);
},
MemberExpression(path) {
const key = resolveKey(path.get("property"), path.node.computed);
if (!key || key === "prototype") return;
const object = path.get("object");
const binding = object.scope.getBinding(object.node.name);
if (binding && binding.path.isImportNamespaceSpecifier()) return;
const source = resolveSource(object);
return property(source.id, key, source.placement, path);
},
ObjectPattern(path) {
const {
parentPath,
parent
} = path;
let obj; // const { keys, values } = Object
if (parentPath.isVariableDeclarator()) {
obj = parentPath.get("init"); // ({ keys, values } = Object)
} else if (parentPath.isAssignmentExpression()) {
obj = parentPath.get("right"); // !function ({ keys, values }) {...} (Object)
// resolution does not work after properties transform :-(
} else if (parentPath.isFunction()) {
const grand = parentPath.parentPath;
if (grand.isCallExpression() || grand.isNewExpression()) {
if (grand.node.callee === parent) {
obj = grand.get("arguments")[path.key];
}
}
}
let id = null;
let placement = null;
if (obj) ({
id,
placement
} = resolveSource(obj));
for (const prop of path.get("properties")) {
if (prop.isObjectProperty()) {
const key = resolveKey(prop.get("key"));
if (key) property(id, key, placement, prop);
}
}
},
BinaryExpression(path) {
if (path.node.operator !== "in") return;
const source = resolveSource(path.get("right"));
const key = resolveKey(path.get("left"), true);
if (!key) return;
callProvider({
kind: "in",
object: source.id,
key,
placement: source.placement
}, path);
}
};
});
var entry = (callProvider => ({
ImportDeclaration(path) {
const source = getImportSource(path);
if (!source) return;
callProvider({
kind: "import",
source
}, path);
},
Program(path) {
path.get("body").forEach(bodyPath => {
const source = getRequireSource(bodyPath);
if (!source) return;
callProvider({
kind: "import",
source
}, bodyPath);
});
}
}));
function resolve(dirname, moduleName, absoluteImports) {
if (absoluteImports === false) return moduleName;
throw new Error(`"absoluteImports" is not supported in bundles prepared for the browser.`);
} // eslint-disable-next-line no-unused-vars
function has(basedir, name) {
return true;
} // eslint-disable-next-line no-unused-vars
function logMissing(missingDeps) {} // eslint-disable-next-line no-unused-vars
function laterLogMissing(missingDeps) {}
const PossibleGlobalObjects = new Set(["global", "globalThis", "self", "window"]);
function createMetaResolver(polyfills) {
const {
static: staticP,
instance: instanceP,
global: globalP
} = polyfills;
return meta => {
if (meta.kind === "global" && globalP && has$1(globalP, meta.name)) {
return {
kind: "global",
desc: globalP[meta.name],
name: meta.name
};
}
if (meta.kind === "property" || meta.kind === "in") {
const {
placement,
object,
key
} = meta;
if (object && placement === "static") {
if (globalP && PossibleGlobalObjects.has(object) && has$1(globalP, key)) {
return {
kind: "global",
desc: globalP[key],
name: key
};
}
if (staticP && has$1(staticP, object) && has$1(staticP[object], key)) {
return {
kind: "static",
desc: staticP[object][key],
name: `${object}$${key}`
};
}
}
if (instanceP && has$1(instanceP, key)) {
return {
kind: "instance",
desc: instanceP[key],
name: `${key}`
};
}
}
};
}
const getTargets = _getTargets.default || _getTargets;
function resolveOptions(options, babelApi) {
const {
method,
targets: targetsOption,
ignoreBrowserslistConfig,
configPath,
debug,
shouldInjectPolyfill,
absoluteImports,
...providerOptions
} = options;
let methodName;
if (method === "usage-global") methodName = "usageGlobal";else if (method === "entry-global") methodName = "entryGlobal";else if (method === "usage-pure") methodName = "usagePure";else if (typeof method !== "string") {
throw new Error(".method must be a string");
} else {
throw new Error(`.method must be one of "entry-global", "usage-global"` + ` or "usage-pure" (received ${JSON.stringify(method)})`);
}
if (typeof shouldInjectPolyfill === "function") {
if (options.include || options.exclude) {
throw new Error(`.include and .exclude are not supported when using the` + ` .shouldInjectPolyfill function.`);
}
} else if (shouldInjectPolyfill != null) {
throw new Error(`.shouldInjectPolyfill must be a function, or undefined` + ` (received ${JSON.stringify(shouldInjectPolyfill)})`);
}
if (absoluteImports != null && typeof absoluteImports !== "boolean" && typeof absoluteImports !== "string") {
throw new Error(`.absoluteImports must be a boolean, a string, or undefined` + ` (received ${JSON.stringify(absoluteImports)})`);
}
let targets;
if ( // If any browserslist-related option is specified, fallback to the old
// behavior of not using the targets specified in the top-level options.
targetsOption || configPath || ignoreBrowserslistConfig) {
const targetsObj = typeof targetsOption === "string" || Array.isArray(targetsOption) ? {
browsers: targetsOption
} : targetsOption;
targets = getTargets(targetsObj, {
ignoreBrowserslistConfig,
configPath
});
} else {
targets = babelApi.targets();
}
return {
method,
methodName,
targets,
absoluteImports: absoluteImports != null ? absoluteImports : false,
shouldInjectPolyfill,
debug: !!debug,
providerOptions: providerOptions
};
}
function instantiateProvider(factory, options, missingDependencies, dirname, debugLog, babelApi) {
const {
method,
methodName,
targets,
debug,
shouldInjectPolyfill,
providerOptions,
absoluteImports
} = resolveOptions(options, babelApi);
const getUtils = createUtilsGetter(new ImportsCache(moduleName => resolve(dirname, moduleName, absoluteImports))); // eslint-disable-next-line prefer-const
let include, exclude;
let polyfillsSupport;
let polyfillsNames;
let filterPolyfills;
const depsCache = new Map();
const api = {
babel: babelApi,
getUtils,
method: options.method,
targets,
createMetaResolver,
shouldInjectPolyfill(name) {
if (polyfillsNames === undefined) {
throw new Error(`Internal error in the ${factory.name} provider: ` + `shouldInjectPolyfill() can't be called during initialization.`);
}
if (!polyfillsNames.has(name)) {
console.warn(`Internal error in the ${provider.name} provider: ` + `unknown polyfill "${name}".`);
}
if (filterPolyfills && !filterPolyfills(name)) return false;
let shouldInject = isRequired(name, targets, {
compatData: polyfillsSupport,
includes: include,
excludes: exclude
});
if (shouldInjectPolyfill) {
shouldInject = shouldInjectPolyfill(name, shouldInject);
if (typeof shouldInject !== "boolean") {
throw new Error(`.shouldInjectPolyfill must return a boolean.`);
}
}
return shouldInject;
},
debug(name) {
debugLog().found = true;
if (!debug || !name) return;
if (debugLog().polyfills.has(provider.name)) return;
debugLog().polyfills.set(name, polyfillsSupport && name && polyfillsSupport[name]);
},
assertDependency(name, version = "*") {
if (missingDependencies === false) return;
if (absoluteImports) {
// If absoluteImports is not false, we will try resolving
// the dependency and throw if it's not possible. We can
// skip the check here.
return;
}
const dep = version === "*" ? name : `${name}@^${version}`;
const found = missingDependencies.all ? false : mapGetOr(depsCache, `${name} :: ${dirname}`, () => has());
if (!found) {
debugLog().missingDeps.add(dep);
}
}
};
const provider = factory(api, providerOptions, dirname);
if (typeof provider[methodName] !== "function") {
throw new Error(`The "${provider.name || factory.name}" provider doesn't ` + `support the "${method}" polyfilling method.`);
}
if (Array.isArray(provider.polyfills)) {
polyfillsNames = new Set(provider.polyfills);
filterPolyfills = provider.filterPolyfills;
} else if (provider.polyfills) {
polyfillsNames = new Set(Object.keys(provider.polyfills));
polyfillsSupport = provider.polyfills;
filterPolyfills = provider.filterPolyfills;
} else {
polyfillsNames = new Set();
}
({
include,
exclude
} = validateIncludeExclude(provider.name || factory.name, polyfillsNames, providerOptions.include || [], providerOptions.exclude || []));
return {
debug,
method,
targets,
provider,
callProvider(payload, path) {
const utils = getUtils(path); // $FlowIgnore
provider[methodName](payload, utils, path);
}
};
}
function definePolyfillProvider(factory) {
return declare((babelApi, options, dirname) => {
babelApi.assertVersion(7);
const {
traverse
} = babelApi;
let debugLog;
const missingDependencies = applyMissingDependenciesDefaults(options, babelApi);
const {
debug,
method,
targets,
provider,
callProvider
} = instantiateProvider(factory, options, missingDependencies, dirname, () => debugLog, babelApi);
const createVisitor = method === "entry-global" ? entry : usage;
const visitor = provider.visitor ? traverse.visitors.merge([createVisitor(callProvider), provider.visitor]) : createVisitor(callProvider);
if (debug && debug !== presetEnvSilentDebugHeader) {
console.log(`${provider.name}: \`DEBUG\` option`);
console.log(`\nUsing targets: ${stringifyTargetsMultiline(targets)}`);
console.log(`\nUsing polyfills with \`${method}\` method:`);
}
return {
name: "inject-polyfills",
visitor,
pre() {
var _provider$pre;
debugLog = {
polyfills: new Map(),
found: false,
providers: new Set(),
missingDeps: new Set()
}; // $FlowIgnore - Flow doesn't support optional calls
(_provider$pre = provider.pre) == null ? void 0 : _provider$pre.apply(this, arguments);
},
post() {
var _provider$post;
// $FlowIgnore - Flow doesn't support optional calls
(_provider$post = provider.post) == null ? void 0 : _provider$post.apply(this, arguments);
if (missingDependencies !== false) {
if (missingDependencies.log === "per-file") {
logMissing(debugLog.missingDeps);
} else {
laterLogMissing(debugLog.missingDeps);
}
}
if (!debug) return;
if (this.filename) console.log(`\n[${this.filename}]`);
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.`);
return;
}
if (method === "entry-global") {
console.log(`The ${provider.name} polyfill entry has been replaced with ` + `the following polyfills:`);
} else {
console.log(`The ${provider.name} polyfill added the following polyfills:`);
}
for (const [name, support] of debugLog.polyfills) {
if (support) {
const filteredTargets = getInclusionReasons(name, targets, support);
const formattedTargets = JSON.stringify(filteredTargets).replace(/,/g, ", ").replace(/^\{"/, '{ "').replace(/"\}$/, '" }');
console.log(` ${name} ${formattedTargets}`);
} else {
console.log(` ${name}`);
}
}
}
};
});
}
function mapGetOr(map, key, getDefault) {
let val = map.get(key);
if (val === undefined) {
val = getDefault();
map.set(key, val);
}
return val;
}
export default definePolyfillProvider;
//# sourceMappingURL=index.browser.mjs.map
{"version":3,"file":"index.browser.mjs","sources":["../src/utils.js","../src/imports-cache.js","../src/debug-utils.js","../src/normalize-options.js","../src/visitors/usage.js","../src/visitors/entry.js","../src/browser/dependencies.js","../src/meta-resolver.js","../src/index.js"],"sourcesContent":["// @flow\n\nimport * as babel from \"@babel/core\";\nconst { types: t, template } = babel.default || babel;\nimport type NodePath from \"@babel/traverse\";\nimport type { Utils } from \"./types\";\nimport type ImportsCache from \"./imports-cache\";\n\nexport function intersection<T>(a: Set<T>, b: Set<T>): Set<T> {\n const result = new Set();\n a.forEach(v => b.has(v) && result.add(v));\n return result;\n}\n\nexport function has(object: Object, key: string) {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\nfunction getType(target: any): string {\n return Object.prototype.toString.call(target).slice(8, -1);\n}\n\nfunction resolveId(path) {\n if (\n path.isIdentifier() &&\n !path.scope.hasBinding(path.node.name, /* noGlobals */ true)\n ) {\n return path.node.name;\n }\n\n const { deopt } = path.evaluate();\n if (deopt && deopt.isIdentifier()) {\n return deopt.node.name;\n }\n}\n\nexport function resolveKey(path: NodePath, computed: boolean = false) {\n const { node, parent, scope } = path;\n if (path.isStringLiteral()) return node.value;\n const { name } = node;\n const isIdentifier = path.isIdentifier();\n if (isIdentifier && !(computed || parent.computed)) return name;\n\n if (\n computed &&\n path.isMemberExpression() &&\n path.get(\"object\").isIdentifier({ name: \"Symbol\" }) &&\n !scope.hasBinding(\"Symbol\", /* noGlobals */ true)\n ) {\n const sym = resolveKey(path.get(\"property\"), path.node.computed);\n if (sym) return \"Symbol.\" + sym;\n }\n\n if (!isIdentifier || scope.hasBinding(name, /* noGlobals */ true)) {\n const { value } = path.evaluate();\n if (typeof value === \"string\") return value;\n }\n}\n\nexport function resolveSource(obj: NodePath) {\n if (\n obj.isMemberExpression() &&\n obj.get(\"property\").isIdentifier({ name: \"prototype\" })\n ) {\n const id = resolveId(obj.get(\"object\"));\n\n if (id) {\n return { id, placement: \"prototype\" };\n }\n return { id: null, placement: null };\n }\n\n const id = resolveId(obj);\n if (id) {\n return { id, placement: \"static\" };\n }\n\n const { value } = obj.evaluate();\n if (value !== undefined) {\n return { id: getType(value), placement: \"prototype\" };\n } else if (obj.isRegExpLiteral()) {\n return { id: \"RegExp\", placement: \"prototype\" };\n } else if (obj.isFunction()) {\n return { id: \"Function\", placement: \"prototype\" };\n }\n\n return { id: null, placement: null };\n}\n\nexport function getImportSource({ node }: NodePath) {\n if (node.specifiers.length === 0) return node.source.value;\n}\n\nexport function getRequireSource({ node }: NodePath) {\n if (!t.isExpressionStatement(node)) return;\n const { expression } = node;\n const isRequire =\n t.isCallExpression(expression) &&\n t.isIdentifier(expression.callee) &&\n expression.callee.name === \"require\" &&\n expression.arguments.length === 1 &&\n t.isStringLiteral(expression.arguments[0]);\n if (isRequire) return expression.arguments[0].value;\n}\n\nfunction hoist(node: t.Node) {\n node._blockHoist = 3;\n return node;\n}\n\nexport function createUtilsGetter(cache: ImportsCache) {\n return (path: NodePath): Utils => {\n const prog = path.findParent(p => p.isProgram());\n\n return {\n injectGlobalImport(url) {\n cache.storeAnonymous(prog, url, (isScript, source) => {\n return isScript\n ? template.statement.ast`require(${source})`\n : t.importDeclaration([], source);\n });\n },\n injectNamedImport(url, name, hint = name) {\n return cache.storeNamed(prog, url, name, (isScript, source, name) => {\n const id = prog.scope.generateUidIdentifier(hint);\n return {\n node: isScript\n ? hoist(template.statement.ast`\n var ${id} = require(${source}).${name}\n `)\n : t.importDeclaration([t.importSpecifier(id, name)], source),\n name: id.name,\n };\n });\n },\n injectDefaultImport(url, hint = url) {\n return cache.storeNamed(prog, url, \"default\", (isScript, source) => {\n const id = prog.scope.generateUidIdentifier(hint);\n return {\n node: isScript\n ? hoist(template.statement.ast`var ${id} = require(${source})`)\n : t.importDeclaration([t.importDefaultSpecifier(id)], source),\n name: id.name,\n };\n });\n },\n };\n };\n}\n","// @flow\n\nimport type { NodePath } from \"@babel/traverse\";\nimport * as babel from \"@babel/core\";\nconst { types: t } = babel.default || babel;\n\ntype StrMap<K> = Map<string, K>;\n\nexport default class ImportsCache {\n _imports: WeakMap<NodePath, StrMap<string>>;\n _anonymousImports: WeakMap<NodePath, Set<string>>;\n _lastImports: WeakMap<NodePath, NodePath>;\n _resolver: (url: string) => string;\n\n constructor(resolver: (url: string) => string) {\n this._imports = new WeakMap();\n this._anonymousImports = new WeakMap();\n this._lastImports = new WeakMap();\n this._resolver = resolver;\n }\n\n storeAnonymous(\n programPath: NodePath,\n url: string,\n // eslint-disable-next-line no-undef\n getVal: (isScript: boolean, source: t.StringLiteral) => t.Node,\n ) {\n const key = this._normalizeKey(programPath, url);\n const imports = this._ensure(this._anonymousImports, programPath, Set);\n\n if (imports.has(key)) return;\n\n const node = getVal(\n programPath.node.sourceType === \"script\",\n t.stringLiteral(this._resolver(url)),\n );\n imports.add(key);\n this._injectImport(programPath, node);\n }\n\n storeNamed(\n programPath: NodePath,\n url: string,\n name: string,\n getVal: (\n isScript: boolean,\n // eslint-disable-next-line no-undef\n source: t.StringLiteral,\n // eslint-disable-next-line no-undef\n name: t.Identifier,\n ) => { node: t.Node, name: string },\n ) {\n const key = this._normalizeKey(programPath, url, name);\n const imports = this._ensure(this._imports, programPath, Map);\n\n if (!imports.has(key)) {\n const { node, name: id } = getVal(\n programPath.node.sourceType === \"script\",\n t.stringLiteral(this._resolver(url)),\n t.identifier(name),\n );\n imports.set(key, id);\n this._injectImport(programPath, node);\n }\n\n return t.identifier(imports.get(key));\n }\n\n _injectImport(programPath: NodePath, node: t.Node) {\n let lastImport = this._lastImports.get(programPath);\n if (\n lastImport &&\n lastImport.node &&\n // Sometimes the AST is modified and the \"last import\"\n // we have has been replaced\n lastImport.parent === programPath.node &&\n lastImport.container === programPath.node.body\n ) {\n lastImport = lastImport.insertAfter(node);\n } else {\n lastImport = programPath.unshiftContainer(\"body\", node);\n }\n lastImport = lastImport[lastImport.length - 1];\n this._lastImports.set(programPath, lastImport);\n\n /*\n let lastImport;\n\n programPath.get(\"body\").forEach(path => {\n if (path.isImportDeclaration()) lastImport = path;\n if (\n path.isExpressionStatement() &&\n isRequireCall(path.get(\"expression\"))\n ) {\n lastImport = path;\n }\n if (\n path.isVariableDeclaration() &&\n path.get(\"declarations\").length === 1 &&\n (isRequireCall(path.get(\"declarations.0.init\")) ||\n (path.get(\"declarations.0.init\").isMemberExpression() &&\n isRequireCall(path.get(\"declarations.0.init.object\"))))\n ) {\n lastImport = path;\n }\n });*/\n }\n\n _ensure<C: Map<*, *> | Set<*>>(\n map: WeakMap<NodePath, C>,\n programPath: NodePath,\n Collection: Class<C>,\n ): C {\n let collection = map.get(programPath);\n if (!collection) {\n collection = new Collection();\n map.set(programPath, collection);\n }\n return collection;\n }\n\n _normalizeKey(programPath: NodePath, url: string, name: string = \"\"): string {\n const { sourceType } = programPath.node;\n\n // If we rely on the imported binding (the \"name\" parameter), we also need to cache\n // based on the sourceType. This is because the module transforms change the names\n // of the import variables.\n return `${name && sourceType}::${url}::${name}`;\n }\n}\n","// @flow\n\nimport { prettifyTargets } from \"@babel/helper-compilation-targets\";\n\nimport type { Targets } from \"./types\";\n\nexport const presetEnvSilentDebugHeader =\n \"#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets\";\n\nexport function stringifyTargetsMultiline(targets: Targets): string {\n return JSON.stringify(prettifyTargets(targets), null, 2);\n}\n\nexport function stringifyTargets(targets: Targets): string {\n return JSON.stringify(targets)\n .replace(/,/g, \", \")\n .replace(/^\\{\"/, '{ \"')\n .replace(/\"\\}$/, '\" }');\n}\n","// @flow\n\nimport { intersection } from \"./utils\";\nimport type {\n Pattern,\n PluginOptions,\n MissingDependenciesOption,\n} from \"./types\";\n\nfunction patternToRegExp(pattern: Pattern): ?RegExp {\n if (pattern instanceof RegExp) return pattern;\n\n try {\n return new RegExp(`^${pattern}$`);\n } catch {\n return null;\n }\n}\n\nfunction buildUnusedError(label, unused) {\n if (!unused.length) return \"\";\n return (\n ` - The following \"${label}\" patterns didn't match any polyfill:\\n` +\n unused.map(original => ` ${String(original)}\\n`).join(\"\")\n );\n}\n\nfunction buldDuplicatesError(duplicates) {\n if (!duplicates.size) return \"\";\n return (\n ` - The following polyfills were matched both by \"include\" and \"exclude\" patterns:\\n` +\n Array.from(duplicates, name => ` ${name}\\n`).join(\"\")\n );\n}\n\nexport function validateIncludeExclude(\n provider: string,\n polyfills: Set<string>,\n includePatterns: Pattern[],\n excludePatterns: Pattern[],\n) {\n let current;\n const filter = pattern => {\n const regexp = patternToRegExp(pattern);\n if (!regexp) return false;\n\n let matched = false;\n for (const polyfill of polyfills) {\n if (regexp.test(polyfill)) {\n matched = true;\n current.add(polyfill);\n }\n }\n return !matched;\n };\n\n // prettier-ignore\n const include = current = new Set<string> ();\n const unusedInclude = Array.from(includePatterns).filter(filter);\n\n // prettier-ignore\n const exclude = current = new Set<string> ();\n const unusedExclude = Array.from(excludePatterns).filter(filter);\n\n const duplicates = intersection(include, exclude);\n\n if (\n duplicates.size > 0 ||\n unusedInclude.length > 0 ||\n unusedExclude.length > 0\n ) {\n throw new Error(\n `Error while validating the \"${provider}\" provider options:\\n` +\n buildUnusedError(\"include\", unusedInclude) +\n buildUnusedError(\"exclude\", unusedExclude) +\n buldDuplicatesError(duplicates),\n );\n }\n\n return { include, exclude };\n}\n\nexport function applyMissingDependenciesDefaults(\n options: PluginOptions,\n babelApi: Object,\n): MissingDependenciesOption {\n const { missingDependencies = {} } = options;\n if (missingDependencies === false) return false;\n\n const caller = babelApi.caller(caller => caller?.name);\n\n const {\n log = \"deferred\",\n inject = caller === \"rollup-plugin-babel\" ? \"throw\" : \"import\",\n all = false,\n } = missingDependencies;\n\n return { log, inject, all };\n}\n","// @flow\n\nimport type { NodePath } from \"@babel/traverse\";\nimport type { MetaDescriptor } from \"../types\";\n\nimport { resolveKey, resolveSource } from \"../utils\";\n\nexport default (\n callProvider: (payload: MetaDescriptor, path: NodePath) => void,\n) => {\n function property(object, key, placement, path) {\n return callProvider({ kind: \"property\", object, key, placement }, path);\n }\n\n return {\n // Symbol(), new Promise\n ReferencedIdentifier(path: NodePath) {\n const {\n node: { name },\n scope,\n } = path;\n if (scope.getBindingIdentifier(name)) return;\n\n callProvider({ kind: \"global\", name }, path);\n },\n\n MemberExpression(path: NodePath) {\n const key = resolveKey(path.get(\"property\"), path.node.computed);\n if (!key || key === \"prototype\") return;\n\n const object = path.get(\"object\");\n const binding = object.scope.getBinding(object.node.name);\n if (binding && binding.path.isImportNamespaceSpecifier()) return;\n\n const source = resolveSource(object);\n return property(source.id, key, source.placement, path);\n },\n\n ObjectPattern(path: NodePath) {\n const { parentPath, parent } = path;\n let obj;\n\n // const { keys, values } = Object\n if (parentPath.isVariableDeclarator()) {\n obj = parentPath.get(\"init\");\n // ({ keys, values } = Object)\n } else if (parentPath.isAssignmentExpression()) {\n obj = parentPath.get(\"right\");\n // !function ({ keys, values }) {...} (Object)\n // resolution does not work after properties transform :-(\n } else if (parentPath.isFunction()) {\n const grand = parentPath.parentPath;\n if (grand.isCallExpression() || grand.isNewExpression()) {\n if (grand.node.callee === parent) {\n obj = grand.get(\"arguments\")[path.key];\n }\n }\n }\n\n let id = null;\n let placement = null;\n if (obj) ({ id, placement } = resolveSource(obj));\n\n for (const prop of path.get(\"properties\")) {\n if (prop.isObjectProperty()) {\n const key = resolveKey(prop.get(\"key\"));\n if (key) property(id, key, placement, prop);\n }\n }\n },\n\n BinaryExpression(path: NodePath) {\n if (path.node.operator !== \"in\") return;\n\n const source = resolveSource(path.get(\"right\"));\n const key = resolveKey(path.get(\"left\"), true);\n\n if (!key) return;\n\n callProvider(\n {\n kind: \"in\",\n object: source.id,\n key,\n placement: source.placement,\n },\n path,\n );\n },\n };\n};\n","// @flow\n\nimport type { NodePath } from \"@babel/traverse\";\nimport type { MetaDescriptor } from \"../types\";\n\nimport { getImportSource, getRequireSource } from \"../utils\";\n\nexport default (\n callProvider: (payload: MetaDescriptor, path: NodePath) => void,\n) => ({\n ImportDeclaration(path: NodePath) {\n const source = getImportSource(path);\n if (!source) return;\n callProvider({ kind: \"import\", source }, path);\n },\n Program(path: NodePath) {\n path.get(\"body\").forEach(bodyPath => {\n const source = getRequireSource(bodyPath);\n if (!source) return;\n callProvider({ kind: \"import\", source }, bodyPath);\n });\n },\n});\n","// @flow\n\nexport function resolve(\n dirname: string,\n moduleName: string,\n absoluteImports: boolean | string,\n): string {\n if (absoluteImports === false) return moduleName;\n\n throw new Error(\n `\"absoluteImports\" is not supported in bundles prepared for the browser.`,\n );\n}\n\n// eslint-disable-next-line no-unused-vars\nexport function has(basedir: string, name: string) {\n return true;\n}\n\n// eslint-disable-next-line no-unused-vars\nexport function logMissing(missingDeps: Set<string>) {}\n\n// eslint-disable-next-line no-unused-vars\nexport function laterLogMissing(missingDeps: Set<string>) {}\n","// @flow\n\nimport type {\n MetaDescriptor,\n ResolverPolyfills,\n ResolvedPolyfill,\n} from \"./types\";\n\nimport { has } from \"./utils\";\n\ntype ResolverFn<T> = (meta: MetaDescriptor) => void | ResolvedPolyfill<T>;\n\nconst PossibleGlobalObjects = new Set<string>([\n \"global\",\n \"globalThis\",\n \"self\",\n \"window\",\n]);\n\nexport default function createMetaResolver<T>(\n polyfills: ResolverPolyfills<T>,\n): ResolverFn<T> {\n const { static: staticP, instance: instanceP, global: globalP } = polyfills;\n\n return meta => {\n if (meta.kind === \"global\" && globalP && has(globalP, meta.name)) {\n return { kind: \"global\", desc: globalP[meta.name], name: meta.name };\n }\n\n if (meta.kind === \"property\" || meta.kind === \"in\") {\n const { placement, object, key } = meta;\n\n if (object && placement === \"static\") {\n if (globalP && PossibleGlobalObjects.has(object) && has(globalP, key)) {\n return { kind: \"global\", desc: globalP[key], name: key };\n }\n\n if (staticP && has(staticP, object) && has(staticP[object], key)) {\n return {\n kind: \"static\",\n desc: staticP[object][key],\n name: `${object}$${key}`,\n };\n }\n }\n\n if (instanceP && has(instanceP, key)) {\n return { kind: \"instance\", desc: instanceP[key], name: `${key}` };\n }\n }\n };\n}\n","// @flow\n\nimport { declare } from \"@babel/helper-plugin-utils\";\nimport type { NodePath } from \"@babel/traverse\";\n\nimport _getTargets, {\n isRequired,\n getInclusionReasons,\n} from \"@babel/helper-compilation-targets\";\nconst getTargets = _getTargets.default || _getTargets;\n\nimport { createUtilsGetter } from \"./utils\";\nimport ImportsCache from \"./imports-cache\";\nimport {\n stringifyTargetsMultiline,\n presetEnvSilentDebugHeader,\n} from \"./debug-utils\";\nimport {\n validateIncludeExclude,\n applyMissingDependenciesDefaults,\n} from \"./normalize-options\";\n\nimport type {\n ProviderApi,\n MethodString,\n Targets,\n MetaDescriptor,\n PolyfillProvider,\n PluginOptions,\n ProviderOptions,\n} from \"./types\";\n\nimport * as v from \"./visitors\";\nimport * as deps from \"./node/dependencies\";\n\nimport createMetaResolver from \"./meta-resolver\";\n\nexport type { PolyfillProvider, MetaDescriptor, Utils, Targets } from \"./types\";\n\nfunction resolveOptions<Options>(\n options: PluginOptions,\n babelApi,\n): {\n method: MethodString,\n methodName: \"usageGlobal\" | \"entryGlobal\" | \"usagePure\",\n targets: Targets,\n debug: boolean,\n shouldInjectPolyfill: ?(name: string, shouldInject: boolean) => boolean,\n providerOptions: ProviderOptions<Options>,\n absoluteImports: string | boolean,\n} {\n const {\n method,\n targets: targetsOption,\n ignoreBrowserslistConfig,\n configPath,\n debug,\n shouldInjectPolyfill,\n absoluteImports,\n ...providerOptions\n } = options;\n\n let methodName;\n if (method === \"usage-global\") methodName = \"usageGlobal\";\n else if (method === \"entry-global\") methodName = \"entryGlobal\";\n else if (method === \"usage-pure\") methodName = \"usagePure\";\n else if (typeof method !== \"string\") {\n throw new Error(\".method must be a string\");\n } else {\n throw new Error(\n `.method must be one of \"entry-global\", \"usage-global\"` +\n ` or \"usage-pure\" (received ${JSON.stringify(method)})`,\n );\n }\n\n if (typeof shouldInjectPolyfill === \"function\") {\n if (options.include || options.exclude) {\n throw new Error(\n `.include and .exclude are not supported when using the` +\n ` .shouldInjectPolyfill function.`,\n );\n }\n } else if (shouldInjectPolyfill != null) {\n throw new Error(\n `.shouldInjectPolyfill must be a function, or undefined` +\n ` (received ${JSON.stringify(shouldInjectPolyfill)})`,\n );\n }\n\n if (\n absoluteImports != null &&\n typeof absoluteImports !== \"boolean\" &&\n typeof absoluteImports !== \"string\"\n ) {\n throw new Error(\n `.absoluteImports must be a boolean, a string, or undefined` +\n ` (received ${JSON.stringify(absoluteImports)})`,\n );\n }\n\n let targets;\n\n if (\n // If any browserslist-related option is specified, fallback to the old\n // behavior of not using the targets specified in the top-level options.\n targetsOption ||\n configPath ||\n ignoreBrowserslistConfig\n ) {\n const targetsObj =\n typeof targetsOption === \"string\" || Array.isArray(targetsOption)\n ? { browsers: targetsOption }\n : targetsOption;\n\n targets = getTargets(targetsObj, {\n ignoreBrowserslistConfig,\n configPath,\n });\n } else {\n targets = babelApi.targets();\n }\n\n return {\n method,\n methodName,\n targets,\n absoluteImports: absoluteImports ?? false,\n shouldInjectPolyfill,\n debug: !!debug,\n providerOptions: ((providerOptions: Object): ProviderOptions<Options>),\n };\n}\n\nfunction instantiateProvider<Options>(\n factory: PolyfillProvider<Options>,\n options: PluginOptions,\n missingDependencies,\n dirname,\n debugLog,\n babelApi,\n) {\n const {\n method,\n methodName,\n targets,\n debug,\n shouldInjectPolyfill,\n providerOptions,\n absoluteImports,\n } = resolveOptions<Options>(options, babelApi);\n\n const getUtils = createUtilsGetter(\n new ImportsCache(moduleName =>\n deps.resolve(dirname, moduleName, absoluteImports),\n ),\n );\n\n // eslint-disable-next-line prefer-const\n let include, exclude;\n let polyfillsSupport;\n let polyfillsNames;\n let filterPolyfills;\n\n const depsCache = new Map();\n\n const api: ProviderApi = {\n babel: babelApi,\n getUtils,\n method: options.method,\n targets,\n createMetaResolver,\n shouldInjectPolyfill(name) {\n if (polyfillsNames === undefined) {\n throw new Error(\n `Internal error in the ${factory.name} provider: ` +\n `shouldInjectPolyfill() can't be called during initialization.`,\n );\n }\n if (!polyfillsNames.has(name)) {\n console.warn(\n `Internal error in the ${provider.name} provider: ` +\n `unknown polyfill \"${name}\".`,\n );\n }\n\n if (filterPolyfills && !filterPolyfills(name)) return false;\n\n let shouldInject = isRequired(name, targets, {\n compatData: polyfillsSupport,\n includes: include,\n excludes: exclude,\n });\n\n if (shouldInjectPolyfill) {\n shouldInject = shouldInjectPolyfill(name, shouldInject);\n if (typeof shouldInject !== \"boolean\") {\n throw new Error(`.shouldInjectPolyfill must return a boolean.`);\n }\n }\n\n return shouldInject;\n },\n debug(name) {\n debugLog().found = true;\n\n if (!debug || !name) return;\n\n if (debugLog().polyfills.has(provider.name)) return;\n debugLog().polyfills.set(\n name,\n polyfillsSupport && name && polyfillsSupport[name],\n );\n },\n assertDependency(name, version = \"*\") {\n if (missingDependencies === false) return;\n if (absoluteImports) {\n // If absoluteImports is not false, we will try resolving\n // the dependency and throw if it's not possible. We can\n // skip the check here.\n return;\n }\n\n const dep = version === \"*\" ? name : `${name}@^${version}`;\n\n const found = missingDependencies.all\n ? false\n : mapGetOr(depsCache, `${name} :: ${dirname}`, () =>\n deps.has(dirname, name),\n );\n\n if (!found) {\n debugLog().missingDeps.add(dep);\n }\n },\n };\n\n const provider = factory(api, providerOptions, dirname);\n\n if (typeof provider[methodName] !== \"function\") {\n throw new Error(\n `The \"${provider.name || factory.name}\" provider doesn't ` +\n `support the \"${method}\" polyfilling method.`,\n );\n }\n\n if (Array.isArray(provider.polyfills)) {\n polyfillsNames = new Set(provider.polyfills);\n filterPolyfills = provider.filterPolyfills;\n } else if (provider.polyfills) {\n polyfillsNames = new Set(Object.keys(provider.polyfills));\n polyfillsSupport = provider.polyfills;\n filterPolyfills = provider.filterPolyfills;\n } else {\n polyfillsNames = new Set();\n }\n\n ({ include, exclude } = validateIncludeExclude(\n provider.name || factory.name,\n polyfillsNames,\n providerOptions.include || [],\n providerOptions.exclude || [],\n ));\n\n return {\n debug,\n method,\n targets,\n provider,\n callProvider(payload: MetaDescriptor, path: NodePath) {\n const utils = getUtils(path);\n // $FlowIgnore\n provider[methodName](payload, utils, path);\n },\n };\n}\n\nexport default function definePolyfillProvider<Options>(\n factory: PolyfillProvider<Options>,\n) {\n return declare((babelApi, options: PluginOptions, dirname: string) => {\n babelApi.assertVersion(7);\n const { traverse } = babelApi;\n\n let debugLog;\n\n const missingDependencies = applyMissingDependenciesDefaults(\n options,\n babelApi,\n );\n\n const {\n debug,\n method,\n targets,\n provider,\n callProvider,\n } = instantiateProvider<Options>(\n factory,\n options,\n missingDependencies,\n dirname,\n () => debugLog,\n babelApi,\n );\n\n const createVisitor = method === \"entry-global\" ? v.entry : v.usage;\n\n const visitor = provider.visitor\n ? traverse.visitors.merge([createVisitor(callProvider), provider.visitor])\n : createVisitor(callProvider);\n\n if (debug && debug !== presetEnvSilentDebugHeader) {\n console.log(`${provider.name}: \\`DEBUG\\` option`);\n console.log(`\\nUsing targets: ${stringifyTargetsMultiline(targets)}`);\n console.log(`\\nUsing polyfills with \\`${method}\\` method:`);\n }\n\n return {\n name: \"inject-polyfills\",\n visitor,\n\n pre() {\n debugLog = {\n polyfills: new Map(),\n found: false,\n providers: new Set(),\n missingDeps: new Set(),\n };\n\n // $FlowIgnore - Flow doesn't support optional calls\n provider.pre?.apply(this, arguments);\n },\n post() {\n // $FlowIgnore - Flow doesn't support optional calls\n provider.post?.apply(this, arguments);\n\n if (missingDependencies !== false) {\n if (missingDependencies.log === \"per-file\") {\n deps.logMissing(debugLog.missingDeps);\n } else {\n deps.laterLogMissing(debugLog.missingDeps);\n }\n }\n\n if (!debug) return;\n\n if (this.filename) console.log(`\\n[${this.filename}]`);\n\n if (debugLog.polyfills.size === 0) {\n console.log(\n method === \"entry-global\"\n ? debugLog.found\n ? `Based on your targets, the ${provider.name} polyfill did not add any polyfill.`\n : `The entry point for the ${provider.name} polyfill has not been found.`\n : `Based on your code and targets, the ${provider.name} polyfill did not add any polyfill.`,\n );\n\n return;\n }\n\n if (method === \"entry-global\") {\n console.log(\n `The ${provider.name} polyfill entry has been replaced with ` +\n `the following polyfills:`,\n );\n } else {\n console.log(\n `The ${provider.name} polyfill added the following polyfills:`,\n );\n }\n\n for (const [name, support] of debugLog.polyfills) {\n if (support) {\n const filteredTargets = getInclusionReasons(name, targets, support);\n\n const formattedTargets = JSON.stringify(filteredTargets)\n .replace(/,/g, \", \")\n .replace(/^\\{\"/, '{ \"')\n .replace(/\"\\}$/, '\" }');\n\n console.log(` ${name} ${formattedTargets}`);\n } else {\n console.log(` ${name}`);\n }\n }\n },\n };\n });\n}\n\nfunction mapGetOr(map, key, getDefault) {\n let val = map.get(key);\n if (val === undefined) {\n val = getDefault();\n map.set(key, val);\n }\n return val;\n}\n"],"names":["types","t","template","babel","default","intersection","a","b","result","Set","forEach","v","has","add","object","key","Object","prototype","hasOwnProperty","call","getType","target","toString","slice","resolveId","path","isIdentifier","scope","hasBinding","node","name","deopt","evaluate","resolveKey","computed","parent","isStringLiteral","value","isMemberExpression","get","sym","resolveSource","obj","id","placement","undefined","isRegExpLiteral","isFunction","getImportSource","specifiers","length","source","getRequireSource","isExpressionStatement","expression","isRequire","isCallExpression","callee","arguments","hoist","_blockHoist","createUtilsGetter","cache","prog","findParent","p","isProgram","injectGlobalImport","url","storeAnonymous","isScript","statement","ast","importDeclaration","injectNamedImport","hint","storeNamed","generateUidIdentifier","importSpecifier","injectDefaultImport","importDefaultSpecifier","ImportsCache","constructor","resolver","_imports","WeakMap","_anonymousImports","_lastImports","_resolver","programPath","getVal","_normalizeKey","imports","_ensure","sourceType","stringLiteral","_injectImport","Map","identifier","set","lastImport","container","body","insertAfter","unshiftContainer","map","Collection","collection","presetEnvSilentDebugHeader","stringifyTargetsMultiline","targets","JSON","stringify","prettifyTargets","patternToRegExp","pattern","RegExp","buildUnusedError","label","unused","original","String","join","buldDuplicatesError","duplicates","size","Array","from","validateIncludeExclude","provider","polyfills","includePatterns","excludePatterns","current","filter","regexp","matched","polyfill","test","include","unusedInclude","exclude","unusedExclude","Error","applyMissingDependenciesDefaults","options","babelApi","missingDependencies","caller","log","inject","all","callProvider","property","kind","ReferencedIdentifier","getBindingIdentifier","MemberExpression","binding","getBinding","isImportNamespaceSpecifier","ObjectPattern","parentPath","isVariableDeclarator","isAssignmentExpression","grand","isNewExpression","prop","isObjectProperty","BinaryExpression","operator","ImportDeclaration","Program","bodyPath","resolve","dirname","moduleName","absoluteImports","basedir","logMissing","missingDeps","laterLogMissing","PossibleGlobalObjects","createMetaResolver","static","staticP","instance","instanceP","global","globalP","meta","desc","getTargets","_getTargets","resolveOptions","method","targetsOption","ignoreBrowserslistConfig","configPath","debug","shouldInjectPolyfill","providerOptions","methodName","targetsObj","isArray","browsers","instantiateProvider","factory","debugLog","getUtils","deps","polyfillsSupport","polyfillsNames","filterPolyfills","depsCache","api","console","warn","shouldInject","isRequired","compatData","includes","excludes","found","assertDependency","version","dep","mapGetOr","keys","payload","utils","definePolyfillProvider","declare","assertVersion","traverse","createVisitor","visitor","visitors","merge","pre","providers","apply","post","filename","support","filteredTargets","getInclusionReasons","formattedTargets","replace","getDefault","val"],"mappings":";;;;AAGA,MAAM;AAAEA,EAAAA,KAAK,EAAEC,GAAT;AAAYC,EAAAA;AAAZ,IAAyBC,KAAK,CAACC,OAAN,IAAiBD,KAAhD;AAKO,SAASE,YAAT,CAAyBC,CAAzB,EAAoCC,CAApC,EAAuD;AAC5D,QAAMC,MAAM,GAAG,IAAIC,GAAJ,EAAf;AACAH,EAAAA,CAAC,CAACI,OAAF,CAAUC,CAAC,IAAIJ,CAAC,CAACK,GAAF,CAAMD,CAAN,KAAYH,MAAM,CAACK,GAAP,CAAWF,CA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argets, { prettifyTargets, getInclusionReasons, isRequired } from '@babel/helper-compilation-targets';
import * as babel from '@babel/core';
import path from 'path';
import debounce from 'lodash.debounce';
import requireResolve from 'resolve';
import { createRequire } from 'module';
const {
types: t$1,
template
} = babel.default || babel;
function intersection(a, b) {
const result = new Set();
a.forEach(v => b.has(v) && result.add(v));
return result;
}
function has$1(object, key) {
return Object.prototype.hasOwnProperty.call(object, key);
}
function getType(target) {
return Object.prototype.toString.call(target).slice(8, -1);
}
function resolveId(path) {
if (path.isIdentifier() && !path.scope.hasBinding(path.node.name,
/* noGlobals */
true)) {
return path.node.name;
}
const {
deopt
} = path.evaluate();
if (deopt && deopt.isIdentifier()) {
return deopt.node.name;
}
}
function resolveKey(path, computed = false) {
const {
node,
parent,
scope
} = path;
if (path.isStringLiteral()) return node.value;
const {
name
} = node;
const isIdentifier = path.isIdentifier();
if (isIdentifier && !(computed || parent.computed)) return name;
if (computed && path.isMemberExpression() && path.get("object").isIdentifier({
name: "Symbol"
}) && !scope.hasBinding("Symbol",
/* noGlobals */
true)) {
const sym = resolveKey(path.get("property"), path.node.computed);
if (sym) return "Symbol." + sym;
}
if (!isIdentifier || scope.hasBinding(name,
/* noGlobals */
true)) {
const {
value
} = path.evaluate();
if (typeof value === "string") return value;
}
}
function resolveSource(obj) {
if (obj.isMemberExpression() && obj.get("property").isIdentifier({
name: "prototype"
})) {
const id = resolveId(obj.get("object"));
if (id) {
return {
id,
placement: "prototype"
};
}
return {
id: null,
placement: null
};
}
const id = resolveId(obj);
if (id) {
return {
id,
placement: "static"
};
}
const {
value
} = obj.evaluate();
if (value !== undefined) {
return {
id: getType(value),
placement: "prototype"
};
} else if (obj.isRegExpLiteral()) {
return {
id: "RegExp",
placement: "prototype"
};
} else if (obj.isFunction()) {
return {
id: "Function",
placement: "prototype"
};
}
return {
id: null,
placement: null
};
}
function getImportSource({
node
}) {
if (node.specifiers.length === 0) return node.source.value;
}
function getRequireSource({
node
}) {
if (!t$1.isExpressionStatement(node)) return;
const {
expression
} = node;
const isRequire = t$1.isCallExpression(expression) && t$1.isIdentifier(expression.callee) && expression.callee.name === "require" && expression.arguments.length === 1 && t$1.isStringLiteral(expression.arguments[0]);
if (isRequire) return expression.arguments[0].value;
}
function hoist(node) {
node._blockHoist = 3;
return node;
}
function createUtilsGetter(cache) {
return path => {
const prog = path.findParent(p => p.isProgram());
return {
injectGlobalImport(url) {
cache.storeAnonymous(prog, url, (isScript, source) => {
return isScript ? template.statement.ast`require(${source})` : t$1.importDeclaration([], source);
});
},
injectNamedImport(url, name, hint = name) {
return cache.storeNamed(prog, url, name, (isScript, source, name) => {
const id = prog.scope.generateUidIdentifier(hint);
return {
node: isScript ? hoist(template.statement.ast`
var ${id} = require(${source}).${name}
`) : t$1.importDeclaration([t$1.importSpecifier(id, name)], source),
name: id.name
};
});
},
injectDefaultImport(url, hint = url) {
return cache.storeNamed(prog, url, "default", (isScript, source) => {
const id = prog.scope.generateUidIdentifier(hint);
return {
node: isScript ? hoist(template.statement.ast`var ${id} = require(${source})`) : t$1.importDeclaration([t$1.importDefaultSpecifier(id)], source),
name: id.name
};
});
}
};
};
}
const {
types: t
} = babel.default || babel;
class ImportsCache {
constructor(resolver) {
this._imports = new WeakMap();
this._anonymousImports = new WeakMap();
this._lastImports = new WeakMap();
this._resolver = resolver;
}
storeAnonymous(programPath, url, // eslint-disable-next-line no-undef
getVal) {
const key = this._normalizeKey(programPath, url);
const imports = this._ensure(this._anonymousImports, programPath, Set);
if (imports.has(key)) return;
const node = getVal(programPath.node.sourceType === "script", t.stringLiteral(this._resolver(url)));
imports.add(key);
this._injectImport(programPath, node);
}
storeNamed(programPath, url, name, getVal) {
const key = this._normalizeKey(programPath, url, name);
const imports = this._ensure(this._imports, programPath, Map);
if (!imports.has(key)) {
const {
node,
name: id
} = getVal(programPath.node.sourceType === "script", t.stringLiteral(this._resolver(url)), t.identifier(name));
imports.set(key, id);
this._injectImport(programPath, node);
}
return t.identifier(imports.get(key));
}
_injectImport(programPath, node) {
let lastImport = this._lastImports.get(programPath);
if (lastImport && lastImport.node && // Sometimes the AST is modified and the "last import"
// we have has been replaced
lastImport.parent === programPath.node && lastImport.container === programPath.node.body) {
lastImport = lastImport.insertAfter(node);
} else {
lastImport = programPath.unshiftContainer("body", node);
}
lastImport = lastImport[lastImport.length - 1];
this._lastImports.set(programPath, lastImport);
/*
let lastImport;
programPath.get("body").forEach(path => {
if (path.isImportDeclaration()) lastImport = path;
if (
path.isExpressionStatement() &&
isRequireCall(path.get("expression"))
) {
lastImport = path;
}
if (
path.isVariableDeclaration() &&
path.get("declarations").length === 1 &&
(isRequireCall(path.get("declarations.0.init")) ||
(path.get("declarations.0.init").isMemberExpression() &&
isRequireCall(path.get("declarations.0.init.object"))))
) {
lastImport = path;
}
});*/
}
_ensure(map, programPath, Collection) {
let collection = map.get(programPath);
if (!collection) {
collection = new Collection();
map.set(programPath, collection);
}
return collection;
}
_normalizeKey(programPath, url, name = "") {
const {
sourceType
} = programPath.node; // If we rely on the imported binding (the "name" parameter), we also need to cache
// based on the sourceType. This is because the module transforms change the names
// of the import variables.
return `${name && sourceType}::${url}::${name}`;
}
}
const presetEnvSilentDebugHeader = "#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets";
function stringifyTargetsMultiline(targets) {
return JSON.stringify(prettifyTargets(targets), null, 2);
}
function patternToRegExp(pattern) {
if (pattern instanceof RegExp) return pattern;
try {
return new RegExp(`^${pattern}$`);
} catch {
return null;
}
}
function buildUnusedError(label, unused) {
if (!unused.length) return "";
return ` - The following "${label}" patterns didn't match any polyfill:\n` + unused.map(original => ` ${String(original)}\n`).join("");
}
function buldDuplicatesError(duplicates) {
if (!duplicates.size) return "";
return ` - The following polyfills were matched both by "include" and "exclude" patterns:\n` + Array.from(duplicates, name => ` ${name}\n`).join("");
}
function validateIncludeExclude(provider, polyfills, includePatterns, excludePatterns) {
let current;
const filter = pattern => {
const regexp = patternToRegExp(pattern);
if (!regexp) return false;
let matched = false;
for (const polyfill of polyfills) {
if (regexp.test(polyfill)) {
matched = true;
current.add(polyfill);
}
}
return !matched;
}; // prettier-ignore
const include = current = new Set();
const unusedInclude = Array.from(includePatterns).filter(filter); // prettier-ignore
const exclude = current = new Set();
const unusedExclude = Array.from(excludePatterns).filter(filter);
const duplicates = intersection(include, exclude);
if (duplicates.size > 0 || unusedInclude.length > 0 || unusedExclude.length > 0) {
throw new Error(`Error while validating the "${provider}" provider options:\n` + buildUnusedError("include", unusedInclude) + buildUnusedError("exclude", unusedExclude) + buldDuplicatesError(duplicates));
}
return {
include,
exclude
};
}
function applyMissingDependenciesDefaults(options, babelApi) {
const {
missingDependencies = {}
} = options;
if (missingDependencies === false) return false;
const caller = babelApi.caller(caller => caller == null ? void 0 : caller.name);
const {
log = "deferred",
inject = caller === "rollup-plugin-babel" ? "throw" : "import",
all = false
} = missingDependencies;
return {
log,
inject,
all
};
}
var usage = (callProvider => {
function property(object, key, placement, path) {
return callProvider({
kind: "property",
object,
key,
placement
}, path);
}
return {
// Symbol(), new Promise
ReferencedIdentifier(path) {
const {
node: {
name
},
scope
} = path;
if (scope.getBindingIdentifier(name)) return;
callProvider({
kind: "global",
name
}, path);
},
MemberExpression(path) {
const key = resolveKey(path.get("property"), path.node.computed);
if (!key || key === "prototype") return;
const object = path.get("object");
const binding = object.scope.getBinding(object.node.name);
if (binding && binding.path.isImportNamespaceSpecifier()) return;
const source = resolveSource(object);
return property(source.id, key, source.placement, path);
},
ObjectPattern(path) {
const {
parentPath,
parent
} = path;
let obj; // const { keys, values } = Object
if (parentPath.isVariableDeclarator()) {
obj = parentPath.get("init"); // ({ keys, values } = Object)
} else if (parentPath.isAssignmentExpression()) {
obj = parentPath.get("right"); // !function ({ keys, values }) {...} (Object)
// resolution does not work after properties transform :-(
} else if (parentPath.isFunction()) {
const grand = parentPath.parentPath;
if (grand.isCallExpression() || grand.isNewExpression()) {
if (grand.node.callee === parent) {
obj = grand.get("arguments")[path.key];
}
}
}
let id = null;
let placement = null;
if (obj) ({
id,
placement
} = resolveSource(obj));
for (const prop of path.get("properties")) {
if (prop.isObjectProperty()) {
const key = resolveKey(prop.get("key"));
if (key) property(id, key, placement, prop);
}
}
},
BinaryExpression(path) {
if (path.node.operator !== "in") return;
const source = resolveSource(path.get("right"));
const key = resolveKey(path.get("left"), true);
if (!key) return;
callProvider({
kind: "in",
object: source.id,
key,
placement: source.placement
}, path);
}
};
});
var entry = (callProvider => ({
ImportDeclaration(path) {
const source = getImportSource(path);
if (!source) return;
callProvider({
kind: "import",
source
}, path);
},
Program(path) {
path.get("body").forEach(bodyPath => {
const source = getRequireSource(bodyPath);
if (!source) return;
callProvider({
kind: "import",
source
}, bodyPath);
});
}
}));
const nativeRequireResolve = parseFloat(process.versions.node) >= 8.9; // $FlowIgnore
const require = createRequire(import
/*::(_)*/
.meta.url); // eslint-disable-line
function resolve(dirname, moduleName, absoluteImports) {
if (absoluteImports === false) return moduleName;
let basedir = dirname;
if (typeof absoluteImports === "string") {
basedir = path.resolve(basedir, absoluteImports);
}
try {
if (nativeRequireResolve) {
return require.resolve(moduleName, {
paths: [basedir]
});
} else {
return requireResolve.sync(moduleName, {
basedir
});
}
} catch (err) {
if (err.code !== "MODULE_NOT_FOUND") throw err; // $FlowIgnore
throw Object.assign(new Error(`Failed to resolve "${moduleName}" relative to "${dirname}"`), {
code: "BABEL_POLYFILL_NOT_FOUND",
polyfill: moduleName,
dirname
});
}
}
function has(basedir, name) {
try {
if (nativeRequireResolve) {
require.resolve(name, {
paths: [basedir]
});
} else {
requireResolve.sync(name, {
basedir
});
}
return true;
} catch {
return false;
}
}
function logMissing(missingDeps) {
if (missingDeps.size === 0) return;
const deps = Array.from(missingDeps).sort().join(" ");
console.warn("\nSome polyfills have been added but are not present in your dependencies.\n" + "Please run one of the following commands:\n" + `\tnpm install --save ${deps}\n` + `\tyarn add ${deps}\n`);
process.exitCode = 1;
}
let allMissingDeps = new Set();
const laterLogMissingDependencies = debounce(() => {
logMissing(allMissingDeps);
allMissingDeps = new Set();
}, 100);
function laterLogMissing(missingDeps) {
if (missingDeps.size === 0) return;
missingDeps.forEach(name => allMissingDeps.add(name));
laterLogMissingDependencies();
}
const PossibleGlobalObjects = new Set(["global", "globalThis", "self", "window"]);
function createMetaResolver(polyfills) {
const {
static: staticP,
instance: instanceP,
global: globalP
} = polyfills;
return meta => {
if (meta.kind === "global" && globalP && has$1(globalP, meta.name)) {
return {
kind: "global",
desc: globalP[meta.name],
name: meta.name
};
}
if (meta.kind === "property" || meta.kind === "in") {
const {
placement,
object,
key
} = meta;
if (object && placement === "static") {
if (globalP && PossibleGlobalObjects.has(object) && has$1(globalP, key)) {
return {
kind: "global",
desc: globalP[key],
name: key
};
}
if (staticP && has$1(staticP, object) && has$1(staticP[object], key)) {
return {
kind: "static",
desc: staticP[object][key],
name: `${object}$${key}`
};
}
}
if (instanceP && has$1(instanceP, key)) {
return {
kind: "instance",
desc: instanceP[key],
name: `${key}`
};
}
}
};
}
const getTargets = _getTargets.default || _getTargets;
function resolveOptions(options, babelApi) {
const {
method,
targets: targetsOption,
ignoreBrowserslistConfig,
configPath,
debug,
shouldInjectPolyfill,
absoluteImports,
...providerOptions
} = options;
let methodName;
if (method === "usage-global") methodName = "usageGlobal";else if (method === "entry-global") methodName = "entryGlobal";else if (method === "usage-pure") methodName = "usagePure";else if (typeof method !== "string") {
throw new Error(".method must be a string");
} else {
throw new Error(`.method must be one of "entry-global", "usage-global"` + ` or "usage-pure" (received ${JSON.stringify(method)})`);
}
if (typeof shouldInjectPolyfill === "function") {
if (options.include || options.exclude) {
throw new Error(`.include and .exclude are not supported when using the` + ` .shouldInjectPolyfill function.`);
}
} else if (shouldInjectPolyfill != null) {
throw new Error(`.shouldInjectPolyfill must be a function, or undefined` + ` (received ${JSON.stringify(shouldInjectPolyfill)})`);
}
if (absoluteImports != null && typeof absoluteImports !== "boolean" && typeof absoluteImports !== "string") {
throw new Error(`.absoluteImports must be a boolean, a string, or undefined` + ` (received ${JSON.stringify(absoluteImports)})`);
}
let targets;
if ( // If any browserslist-related option is specified, fallback to the old
// behavior of not using the targets specified in the top-level options.
targetsOption || configPath || ignoreBrowserslistConfig) {
const targetsObj = typeof targetsOption === "string" || Array.isArray(targetsOption) ? {
browsers: targetsOption
} : targetsOption;
targets = getTargets(targetsObj, {
ignoreBrowserslistConfig,
configPath
});
} else {
targets = babelApi.targets();
}
return {
method,
methodName,
targets,
absoluteImports: absoluteImports != null ? absoluteImports : false,
shouldInjectPolyfill,
debug: !!debug,
providerOptions: providerOptions
};
}
function instantiateProvider(factory, options, missingDependencies, dirname, debugLog, babelApi) {
const {
method,
methodName,
targets,
debug,
shouldInjectPolyfill,
providerOptions,
absoluteImports
} = resolveOptions(options, babelApi);
const getUtils = createUtilsGetter(new ImportsCache(moduleName => resolve(dirname, moduleName, absoluteImports))); // eslint-disable-next-line prefer-const
let include, exclude;
let polyfillsSupport;
let polyfillsNames;
let filterPolyfills;
const depsCache = new Map();
const api = {
babel: babelApi,
getUtils,
method: options.method,
targets,
createMetaResolver,
shouldInjectPolyfill(name) {
if (polyfillsNames === undefined) {
throw new Error(`Internal error in the ${factory.name} provider: ` + `shouldInjectPolyfill() can't be called during initialization.`);
}
if (!polyfillsNames.has(name)) {
console.warn(`Internal error in the ${provider.name} provider: ` + `unknown polyfill "${name}".`);
}
if (filterPolyfills && !filterPolyfills(name)) return false;
let shouldInject = isRequired(name, targets, {
compatData: polyfillsSupport,
includes: include,
excludes: exclude
});
if (shouldInjectPolyfill) {
shouldInject = shouldInjectPolyfill(name, shouldInject);
if (typeof shouldInject !== "boolean") {
throw new Error(`.shouldInjectPolyfill must return a boolean.`);
}
}
return shouldInject;
},
debug(name) {
debugLog().found = true;
if (!debug || !name) return;
if (debugLog().polyfills.has(provider.name)) return;
debugLog().polyfills.set(name, polyfillsSupport && name && polyfillsSupport[name]);
},
assertDependency(name, version = "*") {
if (missingDependencies === false) return;
if (absoluteImports) {
// If absoluteImports is not false, we will try resolving
// the dependency and throw if it's not possible. We can
// skip the check here.
return;
}
const dep = version === "*" ? name : `${name}@^${version}`;
const found = missingDependencies.all ? false : mapGetOr(depsCache, `${name} :: ${dirname}`, () => has(dirname, name));
if (!found) {
debugLog().missingDeps.add(dep);
}
}
};
const provider = factory(api, providerOptions, dirname);
if (typeof provider[methodName] !== "function") {
throw new Error(`The "${provider.name || factory.name}" provider doesn't ` + `support the "${method}" polyfilling method.`);
}
if (Array.isArray(provider.polyfills)) {
polyfillsNames = new Set(provider.polyfills);
filterPolyfills = provider.filterPolyfills;
} else if (provider.polyfills) {
polyfillsNames = new Set(Object.keys(provider.polyfills));
polyfillsSupport = provider.polyfills;
filterPolyfills = provider.filterPolyfills;
} else {
polyfillsNames = new Set();
}
({
include,
exclude
} = validateIncludeExclude(provider.name || factory.name, polyfillsNames, providerOptions.include || [], providerOptions.exclude || []));
return {
debug,
method,
targets,
provider,
callProvider(payload, path) {
const utils = getUtils(path); // $FlowIgnore
provider[methodName](payload, utils, path);
}
};
}
function definePolyfillProvider(factory) {
return declare((babelApi, options, dirname) => {
babelApi.assertVersion(7);
const {
traverse
} = babelApi;
let debugLog;
const missingDependencies = applyMissingDependenciesDefaults(options, babelApi);
const {
debug,
method,
targets,
provider,
callProvider
} = instantiateProvider(factory, options, missingDependencies, dirname, () => debugLog, babelApi);
const createVisitor = method === "entry-global" ? entry : usage;
const visitor = provider.visitor ? traverse.visitors.merge([createVisitor(callProvider), provider.visitor]) : createVisitor(callProvider);
if (debug && debug !== presetEnvSilentDebugHeader) {
console.log(`${provider.name}: \`DEBUG\` option`);
console.log(`\nUsing targets: ${stringifyTargetsMultiline(targets)}`);
console.log(`\nUsing polyfills with \`${method}\` method:`);
}
return {
name: "inject-polyfills",
visitor,
pre() {
var _provider$pre;
debugLog = {
polyfills: new Map(),
found: false,
providers: new Set(),
missingDeps: new Set()
}; // $FlowIgnore - Flow doesn't support optional calls
(_provider$pre = provider.pre) == null ? void 0 : _provider$pre.apply(this, arguments);
},
post() {
var _provider$post;
// $FlowIgnore - Flow doesn't support optional calls
(_provider$post = provider.post) == null ? void 0 : _provider$post.apply(this, arguments);
if (missingDependencies !== false) {
if (missingDependencies.log === "per-file") {
logMissing(debugLog.missingDeps);
} else {
laterLogMissing(debugLog.missingDeps);
}
}
if (!debug) return;
if (this.filename) console.log(`\n[${this.filename}]`);
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.`);
return;
}
if (method === "entry-global") {
console.log(`The ${provider.name} polyfill entry has been replaced with ` + `the following polyfills:`);
} else {
console.log(`The ${provider.name} polyfill added the following polyfills:`);
}
for (const [name, support] of debugLog.polyfills) {
if (support) {
const filteredTargets = getInclusionReasons(name, targets, support);
const formattedTargets = JSON.stringify(filteredTargets).replace(/,/g, ", ").replace(/^\{"/, '{ "').replace(/"\}$/, '" }');
console.log(` ${name} ${formattedTargets}`);
} else {
console.log(` ${name}`);
}
}
}
};
});
}
function mapGetOr(map, key, getDefault) {
let val = map.get(key);
if (val === undefined) {
val = getDefault();
map.set(key, val);
}
return val;
}
export default definePolyfillProvider;
//# sourceMappingURL=index.node.mjs.map
{"version":3,"file":"index.node.mjs","sources":["../src/utils.js","../src/imports-cache.js","../src/debug-utils.js","../src/normalize-options.js","../src/visitors/usage.js","../src/visitors/entry.js","../src/node/dependencies.js","../src/meta-resolver.js","../src/index.js"],"sourcesContent":["// @flow\n\nimport * as babel from \"@babel/core\";\nconst { types: t, template } = babel.default || babel;\nimport type NodePath from \"@babel/traverse\";\nimport type { Utils } from \"./types\";\nimport type ImportsCache from \"./imports-cache\";\n\nexport function intersection<T>(a: Set<T>, b: Set<T>): Set<T> {\n const result = new Set();\n a.forEach(v => b.has(v) && result.add(v));\n return result;\n}\n\nexport function has(object: Object, key: string) {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\nfunction getType(target: any): string {\n return Object.prototype.toString.call(target).slice(8, -1);\n}\n\nfunction resolveId(path) {\n if (\n path.isIdentifier() &&\n !path.scope.hasBinding(path.node.name, /* noGlobals */ true)\n ) {\n return path.node.name;\n }\n\n const { deopt } = path.evaluate();\n if (deopt && deopt.isIdentifier()) {\n return deopt.node.name;\n }\n}\n\nexport function resolveKey(path: NodePath, computed: boolean = false) {\n const { node, parent, scope } = path;\n if (path.isStringLiteral()) return node.value;\n const { name } = node;\n const isIdentifier = path.isIdentifier();\n if (isIdentifier && !(computed || parent.computed)) return name;\n\n if (\n computed &&\n path.isMemberExpression() &&\n path.get(\"object\").isIdentifier({ name: \"Symbol\" }) &&\n !scope.hasBinding(\"Symbol\", /* noGlobals */ true)\n ) {\n const sym = resolveKey(path.get(\"property\"), path.node.computed);\n if (sym) return \"Symbol.\" + sym;\n }\n\n if (!isIdentifier || scope.hasBinding(name, /* noGlobals */ true)) {\n const { value } = path.evaluate();\n if (typeof value === \"string\") return value;\n }\n}\n\nexport function resolveSource(obj: NodePath) {\n if (\n obj.isMemberExpression() &&\n obj.get(\"property\").isIdentifier({ name: \"prototype\" })\n ) {\n const id = resolveId(obj.get(\"object\"));\n\n if (id) {\n return { id, placement: \"prototype\" };\n }\n return { id: null, placement: null };\n }\n\n const id = resolveId(obj);\n if (id) {\n return { id, placement: \"static\" };\n }\n\n const { value } = obj.evaluate();\n if (value !== undefined) {\n return { id: getType(value), placement: \"prototype\" };\n } else if (obj.isRegExpLiteral()) {\n return { id: \"RegExp\", placement: \"prototype\" };\n } else if (obj.isFunction()) {\n return { id: \"Function\", placement: \"prototype\" };\n }\n\n return { id: null, placement: null };\n}\n\nexport function getImportSource({ node }: NodePath) {\n if (node.specifiers.length === 0) return node.source.value;\n}\n\nexport function getRequireSource({ node }: NodePath) {\n if (!t.isExpressionStatement(node)) return;\n const { expression } = node;\n const isRequire =\n t.isCallExpression(expression) &&\n t.isIdentifier(expression.callee) &&\n expression.callee.name === \"require\" &&\n expression.arguments.length === 1 &&\n t.isStringLiteral(expression.arguments[0]);\n if (isRequire) return expression.arguments[0].value;\n}\n\nfunction hoist(node: t.Node) {\n node._blockHoist = 3;\n return node;\n}\n\nexport function createUtilsGetter(cache: ImportsCache) {\n return (path: NodePath): Utils => {\n const prog = path.findParent(p => p.isProgram());\n\n return {\n injectGlobalImport(url) {\n cache.storeAnonymous(prog, url, (isScript, source) => {\n return isScript\n ? template.statement.ast`require(${source})`\n : t.importDeclaration([], source);\n });\n },\n injectNamedImport(url, name, hint = name) {\n return cache.storeNamed(prog, url, name, (isScript, source, name) => {\n const id = prog.scope.generateUidIdentifier(hint);\n return {\n node: isScript\n ? hoist(template.statement.ast`\n var ${id} = require(${source}).${name}\n `)\n : t.importDeclaration([t.importSpecifier(id, name)], source),\n name: id.name,\n };\n });\n },\n injectDefaultImport(url, hint = url) {\n return cache.storeNamed(prog, url, \"default\", (isScript, source) => {\n const id = prog.scope.generateUidIdentifier(hint);\n return {\n node: isScript\n ? hoist(template.statement.ast`var ${id} = require(${source})`)\n : t.importDeclaration([t.importDefaultSpecifier(id)], source),\n name: id.name,\n };\n });\n },\n };\n };\n}\n","// @flow\n\nimport type { NodePath } from \"@babel/traverse\";\nimport * as babel from \"@babel/core\";\nconst { types: t } = babel.default || babel;\n\ntype StrMap<K> = Map<string, K>;\n\nexport default class ImportsCache {\n _imports: WeakMap<NodePath, StrMap<string>>;\n _anonymousImports: WeakMap<NodePath, Set<string>>;\n _lastImports: WeakMap<NodePath, NodePath>;\n _resolver: (url: string) => string;\n\n constructor(resolver: (url: string) => string) {\n this._imports = new WeakMap();\n this._anonymousImports = new WeakMap();\n this._lastImports = new WeakMap();\n this._resolver = resolver;\n }\n\n storeAnonymous(\n programPath: NodePath,\n url: string,\n // eslint-disable-next-line no-undef\n getVal: (isScript: boolean, source: t.StringLiteral) => t.Node,\n ) {\n const key = this._normalizeKey(programPath, url);\n const imports = this._ensure(this._anonymousImports, programPath, Set);\n\n if (imports.has(key)) return;\n\n const node = getVal(\n programPath.node.sourceType === \"script\",\n t.stringLiteral(this._resolver(url)),\n );\n imports.add(key);\n this._injectImport(programPath, node);\n }\n\n storeNamed(\n programPath: NodePath,\n url: string,\n name: string,\n getVal: (\n isScript: boolean,\n // eslint-disable-next-line no-undef\n source: t.StringLiteral,\n // eslint-disable-next-line no-undef\n name: t.Identifier,\n ) => { node: t.Node, name: string },\n ) {\n const key = this._normalizeKey(programPath, url, name);\n const imports = this._ensure(this._imports, programPath, Map);\n\n if (!imports.has(key)) {\n const { node, name: id } = getVal(\n programPath.node.sourceType === \"script\",\n t.stringLiteral(this._resolver(url)),\n t.identifier(name),\n );\n imports.set(key, id);\n this._injectImport(programPath, node);\n }\n\n return t.identifier(imports.get(key));\n }\n\n _injectImport(programPath: NodePath, node: t.Node) {\n let lastImport = this._lastImports.get(programPath);\n if (\n lastImport &&\n lastImport.node &&\n // Sometimes the AST is modified and the \"last import\"\n // we have has been replaced\n lastImport.parent === programPath.node &&\n lastImport.container === programPath.node.body\n ) {\n lastImport = lastImport.insertAfter(node);\n } else {\n lastImport = programPath.unshiftContainer(\"body\", node);\n }\n lastImport = lastImport[lastImport.length - 1];\n this._lastImports.set(programPath, lastImport);\n\n /*\n let lastImport;\n\n programPath.get(\"body\").forEach(path => {\n if (path.isImportDeclaration()) lastImport = path;\n if (\n path.isExpressionStatement() &&\n isRequireCall(path.get(\"expression\"))\n ) {\n lastImport = path;\n }\n if (\n path.isVariableDeclaration() &&\n path.get(\"declarations\").length === 1 &&\n (isRequireCall(path.get(\"declarations.0.init\")) ||\n (path.get(\"declarations.0.init\").isMemberExpression() &&\n isRequireCall(path.get(\"declarations.0.init.object\"))))\n ) {\n lastImport = path;\n }\n });*/\n }\n\n _ensure<C: Map<*, *> | Set<*>>(\n map: WeakMap<NodePath, C>,\n programPath: NodePath,\n Collection: Class<C>,\n ): C {\n let collection = map.get(programPath);\n if (!collection) {\n collection = new Collection();\n map.set(programPath, collection);\n }\n return collection;\n }\n\n _normalizeKey(programPath: NodePath, url: string, name: string = \"\"): string {\n const { sourceType } = programPath.node;\n\n // If we rely on the imported binding (the \"name\" parameter), we also need to cache\n // based on the sourceType. This is because the module transforms change the names\n // of the import variables.\n return `${name && sourceType}::${url}::${name}`;\n }\n}\n","// @flow\n\nimport { prettifyTargets } from \"@babel/helper-compilation-targets\";\n\nimport type { Targets } from \"./types\";\n\nexport const presetEnvSilentDebugHeader =\n \"#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets\";\n\nexport function stringifyTargetsMultiline(targets: Targets): string {\n return JSON.stringify(prettifyTargets(targets), null, 2);\n}\n\nexport function stringifyTargets(targets: Targets): string {\n return JSON.stringify(targets)\n .replace(/,/g, \", \")\n .replace(/^\\{\"/, '{ \"')\n .replace(/\"\\}$/, '\" }');\n}\n","// @flow\n\nimport { intersection } from \"./utils\";\nimport type {\n Pattern,\n PluginOptions,\n MissingDependenciesOption,\n} from \"./types\";\n\nfunction patternToRegExp(pattern: Pattern): ?RegExp {\n if (pattern instanceof RegExp) return pattern;\n\n try {\n return new RegExp(`^${pattern}$`);\n } catch {\n return null;\n }\n}\n\nfunction buildUnusedError(label, unused) {\n if (!unused.length) return \"\";\n return (\n ` - The following \"${label}\" patterns didn't match any polyfill:\\n` +\n unused.map(original => ` ${String(original)}\\n`).join(\"\")\n );\n}\n\nfunction buldDuplicatesError(duplicates) {\n if (!duplicates.size) return \"\";\n return (\n ` - The following polyfills were matched both by \"include\" and \"exclude\" patterns:\\n` +\n Array.from(duplicates, name => ` ${name}\\n`).join(\"\")\n );\n}\n\nexport function validateIncludeExclude(\n provider: string,\n polyfills: Set<string>,\n includePatterns: Pattern[],\n excludePatterns: Pattern[],\n) {\n let current;\n const filter = pattern => {\n const regexp = patternToRegExp(pattern);\n if (!regexp) return false;\n\n let matched = false;\n for (const polyfill of polyfills) {\n if (regexp.test(polyfill)) {\n matched = true;\n current.add(polyfill);\n }\n }\n return !matched;\n };\n\n // prettier-ignore\n const include = current = new Set<string> ();\n const unusedInclude = Array.from(includePatterns).filter(filter);\n\n // prettier-ignore\n const exclude = current = new Set<string> ();\n const unusedExclude = Array.from(excludePatterns).filter(filter);\n\n const duplicates = intersection(include, exclude);\n\n if (\n duplicates.size > 0 ||\n unusedInclude.length > 0 ||\n unusedExclude.length > 0\n ) {\n throw new Error(\n `Error while validating the \"${provider}\" provider options:\\n` +\n buildUnusedError(\"include\", unusedInclude) +\n buildUnusedError(\"exclude\", unusedExclude) +\n buldDuplicatesError(duplicates),\n );\n }\n\n return { include, exclude };\n}\n\nexport function applyMissingDependenciesDefaults(\n options: PluginOptions,\n babelApi: Object,\n): MissingDependenciesOption {\n const { missingDependencies = {} } = options;\n if (missingDependencies === false) return false;\n\n const caller = babelApi.caller(caller => caller?.name);\n\n const {\n log = \"deferred\",\n inject = caller === \"rollup-plugin-babel\" ? \"throw\" : \"import\",\n all = false,\n } = missingDependencies;\n\n return { log, inject, all };\n}\n","// @flow\n\nimport type { NodePath } from \"@babel/traverse\";\nimport type { MetaDescriptor } from \"../types\";\n\nimport { resolveKey, resolveSource } from \"../utils\";\n\nexport default (\n callProvider: (payload: MetaDescriptor, path: NodePath) => void,\n) => {\n function property(object, key, placement, path) {\n return callProvider({ kind: \"property\", object, key, placement }, path);\n }\n\n return {\n // Symbol(), new Promise\n ReferencedIdentifier(path: NodePath) {\n const {\n node: { name },\n scope,\n } = path;\n if (scope.getBindingIdentifier(name)) return;\n\n callProvider({ kind: \"global\", name }, path);\n },\n\n MemberExpression(path: NodePath) {\n const key = resolveKey(path.get(\"property\"), path.node.computed);\n if (!key || key === \"prototype\") return;\n\n const object = path.get(\"object\");\n const binding = object.scope.getBinding(object.node.name);\n if (binding && binding.path.isImportNamespaceSpecifier()) return;\n\n const source = resolveSource(object);\n return property(source.id, key, source.placement, path);\n },\n\n ObjectPattern(path: NodePath) {\n const { parentPath, parent } = path;\n let obj;\n\n // const { keys, values } = Object\n if (parentPath.isVariableDeclarator()) {\n obj = parentPath.get(\"init\");\n // ({ keys, values } = Object)\n } else if (parentPath.isAssignmentExpression()) {\n obj = parentPath.get(\"right\");\n // !function ({ keys, values }) {...} (Object)\n // resolution does not work after properties transform :-(\n } else if (parentPath.isFunction()) {\n const grand = parentPath.parentPath;\n if (grand.isCallExpression() || grand.isNewExpression()) {\n if (grand.node.callee === parent) {\n obj = grand.get(\"arguments\")[path.key];\n }\n }\n }\n\n let id = null;\n let placement = null;\n if (obj) ({ id, placement } = resolveSource(obj));\n\n for (const prop of path.get(\"properties\")) {\n if (prop.isObjectProperty()) {\n const key = resolveKey(prop.get(\"key\"));\n if (key) property(id, key, placement, prop);\n }\n }\n },\n\n BinaryExpression(path: NodePath) {\n if (path.node.operator !== \"in\") return;\n\n const source = resolveSource(path.get(\"right\"));\n const key = resolveKey(path.get(\"left\"), true);\n\n if (!key) return;\n\n callProvider(\n {\n kind: \"in\",\n object: source.id,\n key,\n placement: source.placement,\n },\n path,\n );\n },\n };\n};\n","// @flow\n\nimport type { NodePath } from \"@babel/traverse\";\nimport type { MetaDescriptor } from \"../types\";\n\nimport { getImportSource, getRequireSource } from \"../utils\";\n\nexport default (\n callProvider: (payload: MetaDescriptor, path: NodePath) => void,\n) => ({\n ImportDeclaration(path: NodePath) {\n const source = getImportSource(path);\n if (!source) return;\n callProvider({ kind: \"import\", source }, path);\n },\n Program(path: NodePath) {\n path.get(\"body\").forEach(bodyPath => {\n const source = getRequireSource(bodyPath);\n if (!source) return;\n callProvider({ kind: \"import\", source }, bodyPath);\n });\n },\n});\n","// @flow\n\nimport path from \"path\";\nimport debounce from \"lodash.debounce\";\nimport requireResolve from \"resolve\";\n\nconst nativeRequireResolve = parseFloat(process.versions.node) >= 8.9;\n\n// $FlowIgnore\nimport { createRequire } from \"module\";\n// $FlowIgnore\nconst require = createRequire(import/*::(_)*/.meta.url); // eslint-disable-line\n\nexport function resolve(\n dirname: string,\n moduleName: string,\n absoluteImports: boolean | string,\n): string {\n if (absoluteImports === false) return moduleName;\n\n let basedir = dirname;\n if (typeof absoluteImports === \"string\") {\n basedir = path.resolve(basedir, absoluteImports);\n }\n\n try {\n if (nativeRequireResolve) {\n return require.resolve(moduleName, {\n paths: [basedir],\n });\n } else {\n return requireResolve.sync(moduleName, { basedir });\n }\n } catch (err) {\n if (err.code !== \"MODULE_NOT_FOUND\") throw err;\n\n // $FlowIgnore\n throw Object.assign(\n new Error(`Failed to resolve \"${moduleName}\" relative to \"${dirname}\"`),\n {\n code: \"BABEL_POLYFILL_NOT_FOUND\",\n polyfill: moduleName,\n dirname,\n },\n );\n }\n}\n\nexport function has(basedir: string, name: string) {\n try {\n if (nativeRequireResolve) {\n require.resolve(name, { paths: [basedir] });\n } else {\n requireResolve.sync(name, { basedir });\n }\n return true;\n } catch {\n return false;\n }\n}\n\nexport function logMissing(missingDeps: Set<string>) {\n if (missingDeps.size === 0) return;\n\n const deps = Array.from(missingDeps)\n .sort()\n .join(\" \");\n\n console.warn(\n \"\\nSome polyfills have been added but are not present in your dependencies.\\n\" +\n \"Please run one of the following commands:\\n\" +\n `\\tnpm install --save ${deps}\\n` +\n `\\tyarn add ${deps}\\n`,\n );\n\n process.exitCode = 1;\n}\n\nlet allMissingDeps = new Set();\n\nconst laterLogMissingDependencies = debounce(() => {\n logMissing(allMissingDeps);\n allMissingDeps = new Set();\n}, 100);\n\nexport function laterLogMissing(missingDeps: Set<string>) {\n if (missingDeps.size === 0) return;\n\n missingDeps.forEach(name => allMissingDeps.add(name));\n laterLogMissingDependencies();\n}\n","// @flow\n\nimport type {\n MetaDescriptor,\n ResolverPolyfills,\n ResolvedPolyfill,\n} from \"./types\";\n\nimport { has } from \"./utils\";\n\ntype ResolverFn<T> = (meta: MetaDescriptor) => void | ResolvedPolyfill<T>;\n\nconst PossibleGlobalObjects = new Set<string>([\n \"global\",\n \"globalThis\",\n \"self\",\n \"window\",\n]);\n\nexport default function createMetaResolver<T>(\n polyfills: ResolverPolyfills<T>,\n): ResolverFn<T> {\n const { static: staticP, instance: instanceP, global: globalP } = polyfills;\n\n return meta => {\n if (meta.kind === \"global\" && globalP && has(globalP, meta.name)) {\n return { kind: \"global\", desc: globalP[meta.name], name: meta.name };\n }\n\n if (meta.kind === \"property\" || meta.kind === \"in\") {\n const { placement, object, key } = meta;\n\n if (object && placement === \"static\") {\n if (globalP && PossibleGlobalObjects.has(object) && has(globalP, key)) {\n return { kind: \"global\", desc: globalP[key], name: key };\n }\n\n if (staticP && has(staticP, object) && has(staticP[object], key)) {\n return {\n kind: \"static\",\n desc: staticP[object][key],\n name: `${object}$${key}`,\n };\n }\n }\n\n if (instanceP && has(instanceP, key)) {\n return { kind: \"instance\", desc: instanceP[key], name: `${key}` };\n }\n }\n };\n}\n","// @flow\n\nimport { declare } from \"@babel/helper-plugin-utils\";\nimport type { NodePath } from \"@babel/traverse\";\n\nimport _getTargets, {\n isRequired,\n getInclusionReasons,\n} from \"@babel/helper-compilation-targets\";\nconst getTargets = _getTargets.default || _getTargets;\n\nimport { createUtilsGetter } from \"./utils\";\nimport ImportsCache from \"./imports-cache\";\nimport {\n stringifyTargetsMultiline,\n presetEnvSilentDebugHeader,\n} from \"./debug-utils\";\nimport {\n validateIncludeExclude,\n applyMissingDependenciesDefaults,\n} from \"./normalize-options\";\n\nimport type {\n ProviderApi,\n MethodString,\n Targets,\n MetaDescriptor,\n PolyfillProvider,\n PluginOptions,\n ProviderOptions,\n} from \"./types\";\n\nimport * as v from \"./visitors\";\nimport * as deps from \"./node/dependencies\";\n\nimport createMetaResolver from \"./meta-resolver\";\n\nexport type { PolyfillProvider, MetaDescriptor, Utils, Targets } from \"./types\";\n\nfunction resolveOptions<Options>(\n options: PluginOptions,\n babelApi,\n): {\n method: MethodString,\n methodName: \"usageGlobal\" | \"entryGlobal\" | \"usagePure\",\n targets: Targets,\n debug: boolean,\n shouldInjectPolyfill: ?(name: string, shouldInject: boolean) => boolean,\n providerOptions: ProviderOptions<Options>,\n absoluteImports: string | boolean,\n} {\n const {\n method,\n targets: targetsOption,\n ignoreBrowserslistConfig,\n configPath,\n debug,\n shouldInjectPolyfill,\n absoluteImports,\n ...providerOptions\n } = options;\n\n let methodName;\n if (method === \"usage-global\") methodName = \"usageGlobal\";\n else if (method === \"entry-global\") methodName = \"entryGlobal\";\n else if (method === \"usage-pure\") methodName = \"usagePure\";\n else if (typeof method !== \"string\") {\n throw new Error(\".method must be a string\");\n } else {\n throw new Error(\n `.method must be one of \"entry-global\", \"usage-global\"` +\n ` or \"usage-pure\" (received ${JSON.stringify(method)})`,\n );\n }\n\n if (typeof shouldInjectPolyfill === \"function\") {\n if (options.include || options.exclude) {\n throw new Error(\n `.include and .exclude are not supported when using the` +\n ` .shouldInjectPolyfill function.`,\n );\n }\n } else if (shouldInjectPolyfill != null) {\n throw new Error(\n `.shouldInjectPolyfill must be a function, or undefined` +\n ` (received ${JSON.stringify(shouldInjectPolyfill)})`,\n );\n }\n\n if (\n absoluteImports != null &&\n typeof absoluteImports !== \"boolean\" &&\n typeof absoluteImports !== \"string\"\n ) {\n throw new Error(\n `.absoluteImports must be a boolean, a string, or undefined` +\n ` (received ${JSON.stringify(absoluteImports)})`,\n );\n }\n\n let targets;\n\n if (\n // If any browserslist-related option is specified, fallback to the old\n // behavior of not using the targets specified in the top-level options.\n targetsOption ||\n configPath ||\n ignoreBrowserslistConfig\n ) {\n const targetsObj =\n typeof targetsOption === \"string\" || Array.isArray(targetsOption)\n ? { browsers: targetsOption }\n : targetsOption;\n\n targets = getTargets(targetsObj, {\n ignoreBrowserslistConfig,\n configPath,\n });\n } else {\n targets = babelApi.targets();\n }\n\n return {\n method,\n methodName,\n targets,\n absoluteImports: absoluteImports ?? false,\n shouldInjectPolyfill,\n debug: !!debug,\n providerOptions: ((providerOptions: Object): ProviderOptions<Options>),\n };\n}\n\nfunction instantiateProvider<Options>(\n factory: PolyfillProvider<Options>,\n options: PluginOptions,\n missingDependencies,\n dirname,\n debugLog,\n babelApi,\n) {\n const {\n method,\n methodName,\n targets,\n debug,\n shouldInjectPolyfill,\n providerOptions,\n absoluteImports,\n } = resolveOptions<Options>(options, babelApi);\n\n const getUtils = createUtilsGetter(\n new ImportsCache(moduleName =>\n deps.resolve(dirname, moduleName, absoluteImports),\n ),\n );\n\n // eslint-disable-next-line prefer-const\n let include, exclude;\n let polyfillsSupport;\n let polyfillsNames;\n let filterPolyfills;\n\n const depsCache = new Map();\n\n const api: ProviderApi = {\n babel: babelApi,\n getUtils,\n method: options.method,\n targets,\n createMetaResolver,\n shouldInjectPolyfill(name) {\n if (polyfillsNames === undefined) {\n throw new Error(\n `Internal error in the ${factory.name} provider: ` +\n `shouldInjectPolyfill() can't be called during initialization.`,\n );\n }\n if (!polyfillsNames.has(name)) {\n console.warn(\n `Internal error in the ${provider.name} provider: ` +\n `unknown polyfill \"${name}\".`,\n );\n }\n\n if (filterPolyfills && !filterPolyfills(name)) return false;\n\n let shouldInject = isRequired(name, targets, {\n compatData: polyfillsSupport,\n includes: include,\n excludes: exclude,\n });\n\n if (shouldInjectPolyfill) {\n shouldInject = shouldInjectPolyfill(name, shouldInject);\n if (typeof shouldInject !== \"boolean\") {\n throw new Error(`.shouldInjectPolyfill must return a boolean.`);\n }\n }\n\n return shouldInject;\n },\n debug(name) {\n debugLog().found = true;\n\n if (!debug || !name) return;\n\n if (debugLog().polyfills.has(provider.name)) return;\n debugLog().polyfills.set(\n name,\n polyfillsSupport && name && polyfillsSupport[name],\n );\n },\n assertDependency(name, version = \"*\") {\n if (missingDependencies === false) return;\n if (absoluteImports) {\n // If absoluteImports is not false, we will try resolving\n // the dependency and throw if it's not possible. We can\n // skip the check here.\n return;\n }\n\n const dep = version === \"*\" ? name : `${name}@^${version}`;\n\n const found = missingDependencies.all\n ? false\n : mapGetOr(depsCache, `${name} :: ${dirname}`, () =>\n deps.has(dirname, name),\n );\n\n if (!found) {\n debugLog().missingDeps.add(dep);\n }\n },\n };\n\n const provider = factory(api, providerOptions, dirname);\n\n if (typeof provider[methodName] !== \"function\") {\n throw new Error(\n `The \"${provider.name || factory.name}\" provider doesn't ` +\n `support the \"${method}\" polyfilling method.`,\n );\n }\n\n if (Array.isArray(provider.polyfills)) {\n polyfillsNames = new Set(provider.polyfills);\n filterPolyfills = provider.filterPolyfills;\n } else if (provider.polyfills) {\n polyfillsNames = new Set(Object.keys(provider.polyfills));\n polyfillsSupport = provider.polyfills;\n filterPolyfills = provider.filterPolyfills;\n } else {\n polyfillsNames = new Set();\n }\n\n ({ include, exclude } = validateIncludeExclude(\n provider.name || factory.name,\n polyfillsNames,\n providerOptions.include || [],\n providerOptions.exclude || [],\n ));\n\n return {\n debug,\n method,\n targets,\n provider,\n callProvider(payload: MetaDescriptor, path: NodePath) {\n const utils = getUtils(path);\n // $FlowIgnore\n provider[methodName](payload, utils, path);\n },\n };\n}\n\nexport default function definePolyfillProvider<Options>(\n factory: PolyfillProvider<Options>,\n) {\n return declare((babelApi, options: PluginOptions, dirname: string) => {\n babelApi.assertVersion(7);\n const { traverse } = babelApi;\n\n let debugLog;\n\n const missingDependencies = applyMissingDependenciesDefaults(\n options,\n babelApi,\n );\n\n const {\n debug,\n method,\n targets,\n provider,\n callProvider,\n } = instantiateProvider<Options>(\n factory,\n options,\n missingDependencies,\n dirname,\n () => debugLog,\n babelApi,\n );\n\n const createVisitor = method === \"entry-global\" ? v.entry : v.usage;\n\n const visitor = provider.visitor\n ? traverse.visitors.merge([createVisitor(callProvider), provider.visitor])\n : createVisitor(callProvider);\n\n if (debug && debug !== presetEnvSilentDebugHeader) {\n console.log(`${provider.name}: \\`DEBUG\\` option`);\n console.log(`\\nUsing targets: ${stringifyTargetsMultiline(targets)}`);\n console.log(`\\nUsing polyfills with \\`${method}\\` method:`);\n }\n\n return {\n name: \"inject-polyfills\",\n visitor,\n\n pre() {\n debugLog = {\n polyfills: new Map(),\n found: false,\n providers: new Set(),\n missingDeps: new Set(),\n };\n\n // $FlowIgnore - Flow doesn't support optional calls\n provider.pre?.apply(this, arguments);\n },\n post() {\n // $FlowIgnore - Flow doesn't support optional calls\n provider.post?.apply(this, arguments);\n\n if (missingDependencies !== false) {\n if (missingDependencies.log === \"per-file\") {\n deps.logMissing(debugLog.missingDeps);\n } else {\n deps.laterLogMissing(debugLog.missingDeps);\n }\n }\n\n if (!debug) return;\n\n if (this.filename) console.log(`\\n[${this.filename}]`);\n\n if (debugLog.polyfills.size === 0) {\n console.log(\n method === \"entry-global\"\n ? debugLog.found\n ? `Based on your targets, the ${provider.name} polyfill did not add any polyfill.`\n : `The entry point for the ${provider.name} polyfill has not been found.`\n : `Based on your code and targets, the ${provider.name} polyfill did not add any polyfill.`,\n );\n\n return;\n }\n\n if (method === \"entry-global\") {\n console.log(\n `The ${provider.name} polyfill entry has been replaced with ` +\n `the following polyfills:`,\n );\n } else {\n console.log(\n `The ${provider.name} polyfill added the following polyfills:`,\n );\n }\n\n for (const [name, support] of debugLog.polyfills) {\n if (support) {\n const filteredTargets = getInclusionReasons(name, targets, support);\n\n const formattedTargets = JSON.stringify(filteredTargets)\n .replace(/,/g, \", \")\n .replace(/^\\{\"/, '{ \"')\n .replace(/\"\\}$/, '\" }');\n\n console.log(` ${name} ${formattedTargets}`);\n } else {\n console.log(` ${name}`);\n }\n }\n },\n };\n });\n}\n\nfunction mapGetOr(map, key, getDefault) {\n let val = map.get(key);\n if (val === undefined) {\n val = getDefault();\n map.set(key, val);\n }\n return val;\n}\n"],"names":["types","t","template","babel","default","intersection","a","b","result","Set","forEach","v","has","add","object","key","Object","prototype","hasOwnProperty","call","getType","target","toString","slice","resolveId","path","isIdentifier","scope","hasBinding","node","name","deopt","evaluate","resolveKey","computed","parent","isStringLiteral","value","isMemberExpression","get","sym","resolveSource","obj","id","placement","undefined","isRegExpLiteral","isFunction","getImportSource","specifiers","length","source","getRequireSource","isExpressionStatement","expression","isRequire","isCallExpression","callee","arguments","hoist","_blockHoist","createUtilsGetter","cache","prog","findParent","p","isProgram","injectGlobalImport","url","storeAnonymous","isScript","statement","ast","importDeclaration","injectNamedImport","hint","storeNamed","generateUidIdentifier","importSpecifier","injectDefaultImport","importDefaultSpecifier","ImportsCache","constructor","resolver","_imports","WeakMap","_anonymousImports","_lastImports","_resolver","programPath","getVal","_normalizeKey","imports","_ensure","sourceType","stringLiteral","_injectImport","Map","identifier","set","lastImport","container","body","insertAfter","unshiftContainer","map","Collection","collection","presetEnvSilentDebugHeader","stringifyTargetsMultiline","targets","JSON","stringify","prettifyTargets","patternToRegExp","pattern","RegExp","buildUnusedError","label","unused","original","String","join","buldDuplicatesError","duplicates","size","Array","from","validateIncludeExclude","provider","polyfills","includePatterns","excludePatterns","current","filter","regexp","matched","polyfill","test","include","unusedInclude","exclude","unusedExclude","Error","applyMissingDependenciesDefaults","options","babelApi","missingDependencies","caller","log","inject","all","callProvider","property","kind","ReferencedIdentifier","getBindingIdentifier","MemberExpression","binding","getBinding","isImportNamespaceSpecifier","ObjectPattern","parentPath","isVariableDeclarator","isAssignmentExpression","grand","isNewExpression","prop","isObjectProperty","BinaryExpression","operator","ImportDeclaration","Program","bodyPath","nativeRequireResolve","parseFloat","process","versions","require","createRequire","import","meta","resolve","dirname","moduleName","absoluteImports","basedir","paths","requireResolve","sync","err","code","assign","logMissing","missingDeps","deps","sort","console","warn","exitCode","allMissingDeps","laterLogMissingDependencies","debounce","laterLogMissing","PossibleGlobalObjects","createMetaResolver","static","staticP","instance","instanceP","global","globalP","desc","getTargets","_getTargets","resolveOptions","method","targetsOption","ignoreBrowserslistConfig","configPath","debug","shouldInjectPolyfill","providerOptions","methodName","targetsObj","isArray","browsers","instantiateProvider","factory","debugLog","getUtils","polyfillsSupport","polyfillsNames","filterPolyfills","depsCache","api","shouldInject","isRequired","compatData","includes","excludes","found","assertDependency","version","dep","mapGetOr","keys","payload","utils","definePolyfillProvider","declare","assertVersion","traverse","createVisitor","visitor","visitors","merge","pre","providers","apply","post","filename","support","filteredTargets","getInclusionReasons","formattedTargets","replace","getDefault","val"],"mappings":";;;;;;;;AAGA,MAAM;AAAEA,EAAAA,KAAK,EAAEC,GAAT;AAAYC,EAAAA;AAAZ,IAAyBC,KAAK,CAACC,OAAN,IAAiBD,K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,MAAM,CAACA,IAAD,EAAOwO,OAAP,CAAX,IAA8BjC,QAAQ,CAACnG,SAAvC,EAAkD;AAChD,cAAIoI,OAAJ,EAAa;AACX,kBAAMC,eAAe,GAAGC,mBAAmB,CAAC1O,IAAD,EAAOgF,OAAP,EAAgBwJ,OAAhB,CAA3C;AAEA,kBAAMG,gBAAgB,GAAG1J,IAAI,CAACC,SAAL,CAAeuJ,eAAf,EACtBG,OADsB,CACd,IADc,EACR,IADQ,EAEtBA,OAFsB,CAEd,MAFc,EAEN,KAFM,EAGtBA,OAHsB,CAGd,MAHc,EAGN,KAHM,CAAzB;AAKArE,YAAAA,OAAO,CAAChD,GAAR,CAAa,KAAIvH,IAAK,IAAG2O,gBAAiB,EAA1C;AACD,WATD,MASO;AACLpE,YAAAA,OAAO,CAAChD,GAAR,CAAa,KAAIvH,IAAK,EAAtB;AACD;AACF;AACF;;AApEI,KAAP;AAsED,GA5Ga,CAAd;AA6GD;;AAED,SAASuN,QAAT,CAAkB5I,GAAlB,EAAuB1F,GAAvB,EAA4B4P,UAA5B,EAAwC;AACtC,MAAIC,GAAG,GAAGnK,GAAG,CAAClE,GAAJ,CAAQxB,GAAR,CAAV;;AACA,MAAI6P,GAAG,KAAK/N,SAAZ,EAAuB;AACrB+N,IAAAA,GAAG,GAAGD,UAAU,EAAhB;AACAlK,IAAAA,GAAG,CAACN,GAAJ,CAAQpF,GAAR,EAAa6P,GAAb;AACD;;AACD,SAAOA,GAAP;AACD;;;;"}
\ No newline at end of file
"use strict";
exports.__esModule = true;
exports.resolve = resolve;
exports.has = has;
exports.logMissing = logMissing;
exports.laterLogMissing = laterLogMissing;
function resolve(dirname, moduleName, absoluteImports) {
if (absoluteImports === false) return moduleName;
throw new Error(`"absoluteImports" is not supported in bundles prepared for the browser.`);
} // eslint-disable-next-line no-unused-vars
function has(basedir, name) {
return true;
} // eslint-disable-next-line no-unused-vars
function logMissing(missingDeps) {} // eslint-disable-next-line no-unused-vars
function laterLogMissing(missingDeps) {}
\ No newline at end of file
"use strict";
exports.__esModule = true;
exports.stringifyTargetsMultiline = stringifyTargetsMultiline;
exports.stringifyTargets = stringifyTargets;
exports.presetEnvSilentDebugHeader = void 0;
var _helperCompilationTargets = require("@babel/helper-compilation-targets");
const presetEnvSilentDebugHeader = "#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets";
exports.presetEnvSilentDebugHeader = presetEnvSilentDebugHeader;
function stringifyTargetsMultiline(targets) {
return JSON.stringify((0, _helperCompilationTargets.prettifyTargets)(targets), null, 2);
}
function stringifyTargets(targets) {
return JSON.stringify(targets).replace(/,/g, ", ").replace(/^\{"/, '{ "').replace(/"\}$/, '" }');
}
\ No newline at end of file
"use strict";
exports.__esModule = true;
exports.defineProvider = defineProvider;
function defineProvider(factory) {
// This will allow us to do some things
return factory;
}
\ No newline at end of file
"use strict";
exports.__esModule = true;
exports.default = void 0;
var babel = _interopRequireWildcard(require("@babel/core"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const {
types: t
} = babel.default || babel;
class ImportsCache {
constructor(resolver) {
this._imports = new WeakMap();
this._anonymousImports = new WeakMap();
this._lastImports = new WeakMap();
this._resolver = resolver;
}
storeAnonymous(programPath, url, // eslint-disable-next-line no-undef
getVal) {
const key = this._normalizeKey(programPath, url);
const imports = this._ensure(this._anonymousImports, programPath, Set);
if (imports.has(key)) return;
const node = getVal(programPath.node.sourceType === "script", t.stringLiteral(this._resolver(url)));
imports.add(key);
this._injectImport(programPath, node);
}
storeNamed(programPath, url, name, getVal) {
const key = this._normalizeKey(programPath, url, name);
const imports = this._ensure(this._imports, programPath, Map);
if (!imports.has(key)) {
const {
node,
name: id
} = getVal(programPath.node.sourceType === "script", t.stringLiteral(this._resolver(url)), t.identifier(name));
imports.set(key, id);
this._injectImport(programPath, node);
}
return t.identifier(imports.get(key));
}
_injectImport(programPath, node) {
let lastImport = this._lastImports.get(programPath);
if (lastImport && lastImport.node && // Sometimes the AST is modified and the "last import"
// we have has been replaced
lastImport.parent === programPath.node && lastImport.container === programPath.node.body) {
lastImport = lastImport.insertAfter(node);
} else {
lastImport = programPath.unshiftContainer("body", node);
}
lastImport = lastImport[lastImport.length - 1];
this._lastImports.set(programPath, lastImport);
/*
let lastImport;
programPath.get("body").forEach(path => {
if (path.isImportDeclaration()) lastImport = path;
if (
path.isExpressionStatement() &&
isRequireCall(path.get("expression"))
) {
lastImport = path;
}
if (
path.isVariableDeclaration() &&
path.get("declarations").length === 1 &&
(isRequireCall(path.get("declarations.0.init")) ||
(path.get("declarations.0.init").isMemberExpression() &&
isRequireCall(path.get("declarations.0.init.object"))))
) {
lastImport = path;
}
});*/
}
_ensure(map, programPath, Collection) {
let collection = map.get(programPath);
if (!collection) {
collection = new Collection();
map.set(programPath, collection);
}
return collection;
}
_normalizeKey(programPath, url, name = "") {
const {
sourceType
} = programPath.node; // If we rely on the imported binding (the "name" parameter), we also need to cache
// based on the sourceType. This is because the module transforms change the names
// of the import variables.
return `${name && sourceType}::${url}::${name}`;
}
}
exports.default = ImportsCache;
\ No newline at end of file
"use strict";
exports.__esModule = true;
exports.default = definePolyfillProvider;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _helperCompilationTargets = _interopRequireWildcard(require("@babel/helper-compilation-targets"));
var _utils = require("./utils");
var _importsCache = _interopRequireDefault(require("./imports-cache"));
var _debugUtils = require("./debug-utils");
var _normalizeOptions = require("./normalize-options");
var v = _interopRequireWildcard(require("./visitors"));
var deps = _interopRequireWildcard(require("./node/dependencies"));
var _metaResolver = _interopRequireDefault(require("./meta-resolver"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
const getTargets = _helperCompilationTargets.default.default || _helperCompilationTargets.default;
function resolveOptions(options, babelApi) {
const {
method,
targets: targetsOption,
ignoreBrowserslistConfig,
configPath,
debug,
shouldInjectPolyfill,
absoluteImports
} = options,
providerOptions = _objectWithoutPropertiesLoose(options, ["method", "targets", "ignoreBrowserslistConfig", "configPath", "debug", "shouldInjectPolyfill", "absoluteImports"]);
let methodName;
if (method === "usage-global") methodName = "usageGlobal";else if (method === "entry-global") methodName = "entryGlobal";else if (method === "usage-pure") methodName = "usagePure";else if (typeof method !== "string") {
throw new Error(".method must be a string");
} else {
throw new Error(`.method must be one of "entry-global", "usage-global"` + ` or "usage-pure" (received ${JSON.stringify(method)})`);
}
if (typeof shouldInjectPolyfill === "function") {
if (options.include || options.exclude) {
throw new Error(`.include and .exclude are not supported when using the` + ` .shouldInjectPolyfill function.`);
}
} else if (shouldInjectPolyfill != null) {
throw new Error(`.shouldInjectPolyfill must be a function, or undefined` + ` (received ${JSON.stringify(shouldInjectPolyfill)})`);
}
if (absoluteImports != null && typeof absoluteImports !== "boolean" && typeof absoluteImports !== "string") {
throw new Error(`.absoluteImports must be a boolean, a string, or undefined` + ` (received ${JSON.stringify(absoluteImports)})`);
}
let targets;
if ( // If any browserslist-related option is specified, fallback to the old
// behavior of not using the targets specified in the top-level options.
targetsOption || configPath || ignoreBrowserslistConfig) {
const targetsObj = typeof targetsOption === "string" || Array.isArray(targetsOption) ? {
browsers: targetsOption
} : targetsOption;
targets = getTargets(targetsObj, {
ignoreBrowserslistConfig,
configPath
});
} else {
targets = babelApi.targets();
}
return {
method,
methodName,
targets,
absoluteImports: absoluteImports != null ? absoluteImports : false,
shouldInjectPolyfill,
debug: !!debug,
providerOptions: providerOptions
};
}
function instantiateProvider(factory, options, missingDependencies, dirname, debugLog, babelApi) {
const {
method,
methodName,
targets,
debug,
shouldInjectPolyfill,
providerOptions,
absoluteImports
} = resolveOptions(options, babelApi);
const getUtils = (0, _utils.createUtilsGetter)(new _importsCache.default(moduleName => deps.resolve(dirname, moduleName, absoluteImports))); // eslint-disable-next-line prefer-const
let include, exclude;
let polyfillsSupport;
let polyfillsNames;
let filterPolyfills;
const depsCache = new Map();
const api = {
babel: babelApi,
getUtils,
method: options.method,
targets,
createMetaResolver: _metaResolver.default,
shouldInjectPolyfill(name) {
if (polyfillsNames === undefined) {
throw new Error(`Internal error in the ${factory.name} provider: ` + `shouldInjectPolyfill() can't be called during initialization.`);
}
if (!polyfillsNames.has(name)) {
console.warn(`Internal error in the ${provider.name} provider: ` + `unknown polyfill "${name}".`);
}
if (filterPolyfills && !filterPolyfills(name)) return false;
let shouldInject = (0, _helperCompilationTargets.isRequired)(name, targets, {
compatData: polyfillsSupport,
includes: include,
excludes: exclude
});
if (shouldInjectPolyfill) {
shouldInject = shouldInjectPolyfill(name, shouldInject);
if (typeof shouldInject !== "boolean") {
throw new Error(`.shouldInjectPolyfill must return a boolean.`);
}
}
return shouldInject;
},
debug(name) {
debugLog().found = true;
if (!debug || !name) return;
if (debugLog().polyfills.has(provider.name)) return;
debugLog().polyfills.set(name, polyfillsSupport && name && polyfillsSupport[name]);
},
assertDependency(name, version = "*") {
if (missingDependencies === false) return;
if (absoluteImports) {
// If absoluteImports is not false, we will try resolving
// the dependency and throw if it's not possible. We can
// skip the check here.
return;
}
const dep = version === "*" ? name : `${name}@^${version}`;
const found = missingDependencies.all ? false : mapGetOr(depsCache, `${name} :: ${dirname}`, () => deps.has(dirname, name));
if (!found) {
debugLog().missingDeps.add(dep);
}
}
};
const provider = factory(api, providerOptions, dirname);
if (typeof provider[methodName] !== "function") {
throw new Error(`The "${provider.name || factory.name}" provider doesn't ` + `support the "${method}" polyfilling method.`);
}
if (Array.isArray(provider.polyfills)) {
polyfillsNames = new Set(provider.polyfills);
filterPolyfills = provider.filterPolyfills;
} else if (provider.polyfills) {
polyfillsNames = new Set(Object.keys(provider.polyfills));
polyfillsSupport = provider.polyfills;
filterPolyfills = provider.filterPolyfills;
} else {
polyfillsNames = new Set();
}
({
include,
exclude
} = (0, _normalizeOptions.validateIncludeExclude)(provider.name || factory.name, polyfillsNames, providerOptions.include || [], providerOptions.exclude || []));
return {
debug,
method,
targets,
provider,
callProvider(payload, path) {
const utils = getUtils(path); // $FlowIgnore
provider[methodName](payload, utils, path);
}
};
}
function definePolyfillProvider(factory) {
return (0, _helperPluginUtils.declare)((babelApi, options, dirname) => {
babelApi.assertVersion(7);
const {
traverse
} = babelApi;
let debugLog;
const missingDependencies = (0, _normalizeOptions.applyMissingDependenciesDefaults)(options, babelApi);
const {
debug,
method,
targets,
provider,
callProvider
} = instantiateProvider(factory, options, missingDependencies, dirname, () => debugLog, babelApi);
const createVisitor = method === "entry-global" ? v.entry : v.usage;
const visitor = provider.visitor ? traverse.visitors.merge([createVisitor(callProvider), provider.visitor]) : createVisitor(callProvider);
if (debug && debug !== _debugUtils.presetEnvSilentDebugHeader) {
console.log(`${provider.name}: \`DEBUG\` option`);
console.log(`\nUsing targets: ${(0, _debugUtils.stringifyTargetsMultiline)(targets)}`);
console.log(`\nUsing polyfills with \`${method}\` method:`);
}
return {
name: "inject-polyfills",
visitor,
pre() {
var _provider$pre;
debugLog = {
polyfills: new Map(),
found: false,
providers: new Set(),
missingDeps: new Set()
}; // $FlowIgnore - Flow doesn't support optional calls
(_provider$pre = provider.pre) == null ? void 0 : _provider$pre.apply(this, arguments);
},
post() {
var _provider$post;
// $FlowIgnore - Flow doesn't support optional calls
(_provider$post = provider.post) == null ? void 0 : _provider$post.apply(this, arguments);
if (missingDependencies !== false) {
if (missingDependencies.log === "per-file") {
deps.logMissing(debugLog.missingDeps);
} else {
deps.laterLogMissing(debugLog.missingDeps);
}
}
if (!debug) return;
if (this.filename) console.log(`\n[${this.filename}]`);
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.`);
return;
}
if (method === "entry-global") {
console.log(`The ${provider.name} polyfill entry has been replaced with ` + `the following polyfills:`);
} else {
console.log(`The ${provider.name} polyfill added the following polyfills:`);
}
for (const [name, support] of debugLog.polyfills) {
if (support) {
const filteredTargets = (0, _helperCompilationTargets.getInclusionReasons)(name, targets, support);
const formattedTargets = JSON.stringify(filteredTargets).replace(/,/g, ", ").replace(/^\{"/, '{ "').replace(/"\}$/, '" }');
console.log(` ${name} ${formattedTargets}`);
} else {
console.log(` ${name}`);
}
}
}
};
});
}
function mapGetOr(map, key, getDefault) {
let val = map.get(key);
if (val === undefined) {
val = getDefault();
map.set(key, val);
}
return val;
}
\ No newline at end of file
"use strict";
exports.__esModule = true;
exports.default = createMetaResolver;
var _utils = require("./utils");
const PossibleGlobalObjects = new Set(["global", "globalThis", "self", "window"]);
function createMetaResolver(polyfills) {
const {
static: staticP,
instance: instanceP,
global: globalP
} = polyfills;
return meta => {
if (meta.kind === "global" && globalP && (0, _utils.has)(globalP, meta.name)) {
return {
kind: "global",
desc: globalP[meta.name],
name: meta.name
};
}
if (meta.kind === "property" || meta.kind === "in") {
const {
placement,
object,
key
} = meta;
if (object && placement === "static") {
if (globalP && PossibleGlobalObjects.has(object) && (0, _utils.has)(globalP, key)) {
return {
kind: "global",
desc: globalP[key],
name: key
};
}
if (staticP && (0, _utils.has)(staticP, object) && (0, _utils.has)(staticP[object], key)) {
return {
kind: "static",
desc: staticP[object][key],
name: `${object}$${key}`
};
}
}
if (instanceP && (0, _utils.has)(instanceP, key)) {
return {
kind: "instance",
desc: instanceP[key],
name: `${key}`
};
}
}
};
}
\ No newline at end of file
"use strict";
exports.__esModule = true;
exports.resolve = resolve;
exports.has = has;
exports.logMissing = logMissing;
exports.laterLogMissing = laterLogMissing;
var _path = _interopRequireDefault(require("path"));
var _lodash = _interopRequireDefault(require("lodash.debounce"));
var _resolve = _interopRequireDefault(require("resolve"));
var _module = require("module");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const nativeRequireResolve = parseFloat(process.versions.node) >= 8.9; // $FlowIgnore
// eslint-disable-line
function resolve(dirname, moduleName, absoluteImports) {
if (absoluteImports === false) return moduleName;
let basedir = dirname;
if (typeof absoluteImports === "string") {
basedir = _path.default.resolve(basedir, absoluteImports);
}
try {
if (nativeRequireResolve) {
return require.resolve(moduleName, {
paths: [basedir]
});
} else {
return _resolve.default.sync(moduleName, {
basedir
});
}
} catch (err) {
if (err.code !== "MODULE_NOT_FOUND") throw err; // $FlowIgnore
throw Object.assign(new Error(`Failed to resolve "${moduleName}" relative to "${dirname}"`), {
code: "BABEL_POLYFILL_NOT_FOUND",
polyfill: moduleName,
dirname
});
}
}
function has(basedir, name) {
try {
if (nativeRequireResolve) {
require.resolve(name, {
paths: [basedir]
});
} else {
_resolve.default.sync(name, {
basedir
});
}
return true;
} catch (_unused) {
return false;
}
}
function logMissing(missingDeps) {
if (missingDeps.size === 0) return;
const deps = Array.from(missingDeps).sort().join(" ");
console.warn("\nSome polyfills have been added but are not present in your dependencies.\n" + "Please run one of the following commands:\n" + `\tnpm install --save ${deps}\n` + `\tyarn add ${deps}\n`);
process.exitCode = 1;
}
let allMissingDeps = new Set();
const laterLogMissingDependencies = (0, _lodash.default)(() => {
logMissing(allMissingDeps);
allMissingDeps = new Set();
}, 100);
function laterLogMissing(missingDeps) {
if (missingDeps.size === 0) return;
missingDeps.forEach(name => allMissingDeps.add(name));
laterLogMissingDependencies();
}
\ No newline at end of file
"use strict";
exports.__esModule = true;
exports.validateIncludeExclude = validateIncludeExclude;
exports.applyMissingDependenciesDefaults = applyMissingDependenciesDefaults;
var _utils = require("./utils");
function patternToRegExp(pattern) {
if (pattern instanceof RegExp) return pattern;
try {
return new RegExp(`^${pattern}$`);
} catch (_unused) {
return null;
}
}
function buildUnusedError(label, unused) {
if (!unused.length) return "";
return ` - The following "${label}" patterns didn't match any polyfill:\n` + unused.map(original => ` ${String(original)}\n`).join("");
}
function buldDuplicatesError(duplicates) {
if (!duplicates.size) return "";
return ` - The following polyfills were matched both by "include" and "exclude" patterns:\n` + Array.from(duplicates, name => ` ${name}\n`).join("");
}
function validateIncludeExclude(provider, polyfills, includePatterns, excludePatterns) {
let current;
const filter = pattern => {
const regexp = patternToRegExp(pattern);
if (!regexp) return false;
let matched = false;
for (const polyfill of polyfills) {
if (regexp.test(polyfill)) {
matched = true;
current.add(polyfill);
}
}
return !matched;
}; // prettier-ignore
const include = current = new Set();
const unusedInclude = Array.from(includePatterns).filter(filter); // prettier-ignore
const exclude = current = new Set();
const unusedExclude = Array.from(excludePatterns).filter(filter);
const duplicates = (0, _utils.intersection)(include, exclude);
if (duplicates.size > 0 || unusedInclude.length > 0 || unusedExclude.length > 0) {
throw new Error(`Error while validating the "${provider}" provider options:\n` + buildUnusedError("include", unusedInclude) + buildUnusedError("exclude", unusedExclude) + buldDuplicatesError(duplicates));
}
return {
include,
exclude
};
}
function applyMissingDependenciesDefaults(options, babelApi) {
const {
missingDependencies = {}
} = options;
if (missingDependencies === false) return false;
const caller = babelApi.caller(caller => caller == null ? void 0 : caller.name);
const {
log = "deferred",
inject = caller === "rollup-plugin-babel" ? "throw" : "import",
all = false
} = missingDependencies;
return {
log,
inject,
all
};
}
\ No newline at end of file
"use strict";
var babel = _interopRequireWildcard(require("@babel/core"));
var _metaResolver = _interopRequireDefault(require("./meta-resolver"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const {
types: t
} = babel.default || babel;
\ No newline at end of file
"use strict";
exports.__esModule = true;
exports.intersection = intersection;
exports.has = has;
exports.resolveKey = resolveKey;
exports.resolveSource = resolveSource;
exports.getImportSource = getImportSource;
exports.getRequireSource = getRequireSource;
exports.createUtilsGetter = createUtilsGetter;
var babel = _interopRequireWildcard(require("@babel/core"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const {
types: t,
template
} = babel.default || babel;
function intersection(a, b) {
const result = new Set();
a.forEach(v => b.has(v) && result.add(v));
return result;
}
function has(object, key) {
return Object.prototype.hasOwnProperty.call(object, key);
}
function getType(target) {
return Object.prototype.toString.call(target).slice(8, -1);
}
function resolveId(path) {
if (path.isIdentifier() && !path.scope.hasBinding(path.node.name,
/* noGlobals */
true)) {
return path.node.name;
}
const {
deopt
} = path.evaluate();
if (deopt && deopt.isIdentifier()) {
return deopt.node.name;
}
}
function resolveKey(path, computed = false) {
const {
node,
parent,
scope
} = path;
if (path.isStringLiteral()) return node.value;
const {
name
} = node;
const isIdentifier = path.isIdentifier();
if (isIdentifier && !(computed || parent.computed)) return name;
if (computed && path.isMemberExpression() && path.get("object").isIdentifier({
name: "Symbol"
}) && !scope.hasBinding("Symbol",
/* noGlobals */
true)) {
const sym = resolveKey(path.get("property"), path.node.computed);
if (sym) return "Symbol." + sym;
}
if (!isIdentifier || scope.hasBinding(name,
/* noGlobals */
true)) {
const {
value
} = path.evaluate();
if (typeof value === "string") return value;
}
}
function resolveSource(obj) {
if (obj.isMemberExpression() && obj.get("property").isIdentifier({
name: "prototype"
})) {
const id = resolveId(obj.get("object"));
if (id) {
return {
id,
placement: "prototype"
};
}
return {
id: null,
placement: null
};
}
const id = resolveId(obj);
if (id) {
return {
id,
placement: "static"
};
}
const {
value
} = obj.evaluate();
if (value !== undefined) {
return {
id: getType(value),
placement: "prototype"
};
} else if (obj.isRegExpLiteral()) {
return {
id: "RegExp",
placement: "prototype"
};
} else if (obj.isFunction()) {
return {
id: "Function",
placement: "prototype"
};
}
return {
id: null,
placement: null
};
}
function getImportSource({
node
}) {
if (node.specifiers.length === 0) return node.source.value;
}
function getRequireSource({
node
}) {
if (!t.isExpressionStatement(node)) return;
const {
expression
} = node;
const isRequire = t.isCallExpression(expression) && t.isIdentifier(expression.callee) && expression.callee.name === "require" && expression.arguments.length === 1 && t.isStringLiteral(expression.arguments[0]);
if (isRequire) return expression.arguments[0].value;
}
function hoist(node) {
node._blockHoist = 3;
return node;
}
function createUtilsGetter(cache) {
return path => {
const prog = path.findParent(p => p.isProgram());
return {
injectGlobalImport(url) {
cache.storeAnonymous(prog, url, (isScript, source) => {
return isScript ? template.statement.ast`require(${source})` : t.importDeclaration([], source);
});
},
injectNamedImport(url, name, hint = name) {
return cache.storeNamed(prog, url, name, (isScript, source, name) => {
const id = prog.scope.generateUidIdentifier(hint);
return {
node: isScript ? hoist(template.statement.ast`
var ${id} = require(${source}).${name}
`) : t.importDeclaration([t.importSpecifier(id, name)], source),
name: id.name
};
});
},
injectDefaultImport(url, hint = url) {
return cache.storeNamed(prog, url, "default", (isScript, source) => {
const id = prog.scope.generateUidIdentifier(hint);
return {
node: isScript ? hoist(template.statement.ast`var ${id} = require(${source})`) : t.importDeclaration([t.importDefaultSpecifier(id)], source),
name: id.name
};
});
}
};
};
}
\ No newline at end of file
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _utils = require("../utils");
var _default = callProvider => ({
ImportDeclaration(path) {
const source = (0, _utils.getImportSource)(path);
if (!source) return;
callProvider({
kind: "import",
source
}, path);
},
Program(path) {
path.get("body").forEach(bodyPath => {
const source = (0, _utils.getRequireSource)(bodyPath);
if (!source) return;
callProvider({
kind: "import",
source
}, bodyPath);
});
}
});
exports.default = _default;
\ No newline at end of file
"use strict";
exports.__esModule = true;
exports.entry = exports.usage = void 0;
var _usage = _interopRequireDefault(require("./usage"));
exports.usage = _usage.default;
var _entry = _interopRequireDefault(require("./entry"));
exports.entry = _entry.default;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
\ No newline at end of file
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _utils = require("../utils");
var _default = callProvider => {
function property(object, key, placement, path) {
return callProvider({
kind: "property",
object,
key,
placement
}, path);
}
return {
// Symbol(), new Promise
ReferencedIdentifier(path) {
const {
node: {
name
},
scope
} = path;
if (scope.getBindingIdentifier(name)) return;
callProvider({
kind: "global",
name
}, path);
},
MemberExpression(path) {
const key = (0, _utils.resolveKey)(path.get("property"), path.node.computed);
if (!key || key === "prototype") return;
const object = path.get("object");
const binding = object.scope.getBinding(object.node.name);
if (binding && binding.path.isImportNamespaceSpecifier()) return;
const source = (0, _utils.resolveSource)(object);
return property(source.id, key, source.placement, path);
},
ObjectPattern(path) {
const {
parentPath,
parent
} = path;
let obj; // const { keys, values } = Object
if (parentPath.isVariableDeclarator()) {
obj = parentPath.get("init"); // ({ keys, values } = Object)
} else if (parentPath.isAssignmentExpression()) {
obj = parentPath.get("right"); // !function ({ keys, values }) {...} (Object)
// resolution does not work after properties transform :-(
} else if (parentPath.isFunction()) {
const grand = parentPath.parentPath;
if (grand.isCallExpression() || grand.isNewExpression()) {
if (grand.node.callee === parent) {
obj = grand.get("arguments")[path.key];
}
}
}
let id = null;
let placement = null;
if (obj) ({
id,
placement
} = (0, _utils.resolveSource)(obj));
for (const prop of path.get("properties")) {
if (prop.isObjectProperty()) {
const key = (0, _utils.resolveKey)(prop.get("key"));
if (key) property(id, key, placement, prop);
}
}
},
BinaryExpression(path) {
if (path.node.operator !== "in") return;
const source = (0, _utils.resolveSource)(path.get("right"));
const key = (0, _utils.resolveKey)(path.get("left"), true);
if (!key) return;
callProvider({
kind: "in",
object: source.id,
key,
placement: source.placement
}, path);
}
};
};
exports.default = _default;
\ No newline at end of file
(The MIT License)
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
Copyright (c) 2018-2021 Josh Junon
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the 'Software'), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# debug
[![Build Status](https://travis-ci.org/debug-js/debug.svg?branch=master)](https://travis-ci.org/debug-js/debug) [![Coverage Status](https://coveralls.io/repos/github/debug-js/debug/badge.svg?branch=master)](https://coveralls.io/github/debug-js/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
A tiny JavaScript debugging utility modelled after Node.js core's debugging
technique. Works in Node.js and web browsers.
## Installation
```bash
$ npm install debug
```
## Usage
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
Example [_app.js_](./examples/node/app.js):
```js
var debug = require('debug')('http')
, http = require('http')
, name = 'My App';
// fake app
debug('booting %o', name);
http.createServer(function(req, res){
debug(req.method + ' ' + req.url);
res.end('hello\n');
}).listen(3000, function(){
debug('listening');
});
// fake worker of some kind
require('./worker');
```
Example [_worker.js_](./examples/node/worker.js):
```js
var a = require('debug')('worker:a')
, b = require('debug')('worker:b');
function work() {
a('doing lots of uninteresting work');
setTimeout(work, Math.random() * 1000);
}
work();
function workb() {
b('doing some work');
setTimeout(workb, Math.random() * 2000);
}
workb();
```
The `DEBUG` environment variable is then used to enable these based on space or
comma-delimited names.
Here are some examples:
<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
#### Windows command prompt notes
##### CMD
On Windows the environment variable is set using the `set` command.
```cmd
set DEBUG=*,-not_this
```
Example:
```cmd
set DEBUG=* & node app.js
```
##### PowerShell (VS Code default)
PowerShell uses different syntax to set environment variables.
```cmd
$env:DEBUG = "*,-not_this"
```
Example:
```cmd
$env:DEBUG='app';node app.js
```
Then, run the program to be debugged as usual.
npm script example:
```js
"windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
```
## Namespace Colors
Every debug instance has a color generated for it based on its namespace name.
This helps when visually parsing the debug output to identify which debug instance
a debug line belongs to.
#### Node.js
In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
otherwise debug will only use a small handful of basic colors.
<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png">
#### Web Browser
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
option. These are WebKit web inspectors, Firefox ([since version
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
and the Firebug plugin for Firefox (any version).
<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png">
## Millisecond diff
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png">
## Conventions
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
## Wildcards
The `*` character may be used as a wildcard. Suppose for example your library has
debuggers named "connect:bodyParser", "connect:compress", "connect:session",
instead of listing all three with
`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
You can also exclude specific debuggers by prefixing them with a "-" character.
For example, `DEBUG=*,-connect:*` would include all debuggers except those
starting with "connect:".
## Environment Variables
When running through Node.js, you can set a few environment variables that will
change the behavior of the debug logging:
| Name | Purpose |
|-----------|-------------------------------------------------|
| `DEBUG` | Enables/disables specific debugging namespaces. |
| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
| `DEBUG_DEPTH` | Object inspection depth. |
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
__Note:__ The environment variables beginning with `DEBUG_` end up being
converted into an Options object that gets used with `%o`/`%O` formatters.
See the Node.js documentation for
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
for the complete list.
## Formatters
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
Below are the officially supported formatters:
| Formatter | Representation |
|-----------|----------------|
| `%O` | Pretty-print an Object on multiple lines. |
| `%o` | Pretty-print an Object all on a single line. |
| `%s` | String. |
| `%d` | Number (both integer and float). |
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
| `%%` | Single percent sign ('%'). This does not consume an argument. |
### Custom formatters
You can add custom formatters by extending the `debug.formatters` object.
For example, if you wanted to add support for rendering a Buffer as hex with
`%h`, you could do something like:
```js
const createDebug = require('debug')
createDebug.formatters.h = (v) => {
return v.toString('hex')
}
// …elsewhere
const debug = createDebug('foo')
debug('this is hex: %h', new Buffer('hello world'))
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
```
## Browser Support
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
if you don't want to build it yourself.
Debug's enable state is currently persisted by `localStorage`.
Consider the situation shown below where you have `worker:a` and `worker:b`,
and wish to debug both. You can enable this using `localStorage.debug`:
```js
localStorage.debug = 'worker:*'
```
And then refresh the page.
```js
a = debug('worker:a');
b = debug('worker:b');
setInterval(function(){
a('doing some work');
}, 1000);
setInterval(function(){
b('doing some work');
}, 1200);
```
In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_.
<img width="647" src="https://user-images.githubusercontent.com/7143133/152083257-29034707-c42c-4959-8add-3cee850e6fcf.png">
## Output streams
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
Example [_stdout.js_](./examples/node/stdout.js):
```js
var debug = require('debug');
var error = debug('app:error');
// by default stderr is used
error('goes to stderr!');
var log = debug('app:log');
// set this namespace to log via console.log
log.log = console.log.bind(console); // don't forget to bind to console!
log('goes to stdout');
error('still goes to stderr!');
// set all output to go via console.info
// overrides all per-namespace log settings
debug.log = console.info.bind(console);
error('now goes to stdout via console.info');
log('still goes to stdout, but via console.info now');
```
## Extend
You can simply extend debugger
```js
const log = require('debug')('auth');
//creates new debug instance with extended namespace
const logSign = log.extend('sign');
const logLogin = log.extend('login');
log('hello'); // auth hello
logSign('hello'); //auth:sign hello
logLogin('hello'); //auth:login hello
```
## Set dynamically
You can also enable debug dynamically by calling the `enable()` method :
```js
let debug = require('debug');
console.log(1, debug.enabled('test'));
debug.enable('test');
console.log(2, debug.enabled('test'));
debug.disable();
console.log(3, debug.enabled('test'));
```
print :
```
1 false
2 true
3 false
```
Usage :
`enable(namespaces)`
`namespaces` can include modes separated by a colon and wildcards.
Note that calling `enable()` completely overrides previously set DEBUG variable :
```
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
=> false
```
`disable()`
Will disable all namespaces. The functions returns the namespaces currently
enabled (and skipped). This can be useful if you want to disable debugging
temporarily without knowing what was enabled to begin with.
For example:
```js
let debug = require('debug');
debug.enable('foo:*,-foo:bar');
let namespaces = debug.disable();
debug.enable(namespaces);
```
Note: There is no guarantee that the string will be identical to the initial
enable string, but semantically they will be identical.
## Checking whether a debug target is enabled
After you've created a debug instance, you can determine whether or not it is
enabled by checking the `enabled` property:
```javascript
const debug = require('debug')('http');
if (debug.enabled) {
// do stuff...
}
```
You can also manually toggle this property to force the debug instance to be
enabled or disabled.
## Usage in child processes
Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process.
For example:
```javascript
worker = fork(WORKER_WRAP_PATH, [workerPath], {
stdio: [
/* stdin: */ 0,
/* stdout: */ 'pipe',
/* stderr: */ 'pipe',
'ipc',
],
env: Object.assign({}, process.env, {
DEBUG_COLORS: 1 // without this settings, colors won't be shown
}),
});
worker.stderr.pipe(process.stderr, { end: false });
```
## Authors
- TJ Holowaychuk
- Nathan Rajlich
- Andrew Rhyne
- Josh Junon
## Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
## Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
## License
(The MIT License)
Copyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
Copyright (c) 2018-2021 Josh Junon
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment