bigint-crypto-utils/node_modules/@rollup/plugin-commonjs/dist/index.js.map

1 line
58 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":"index.js","sources":["../src/helpers.js","../src/is-cjs.js","../src/resolve-id.js","../src/ast-utils.js","../src/utils.js","../src/transform.js","../src/index.js"],"sourcesContent":["export const PROXY_SUFFIX = '?commonjs-proxy';\nexport const getProxyId = (id) => `\\0${id}${PROXY_SUFFIX}`;\nexport const getIdFromProxyId = (proxyId) => proxyId.slice(1, -PROXY_SUFFIX.length);\n\nexport const EXTERNAL_SUFFIX = '?commonjs-external';\nexport const getExternalProxyId = (id) => `\\0${id}${EXTERNAL_SUFFIX}`;\nexport const getIdFromExternalProxyId = (proxyId) => proxyId.slice(1, -EXTERNAL_SUFFIX.length);\n\nexport const HELPERS_ID = '\\0commonjsHelpers.js';\n\n// `x['default']` is used instead of `x.default` for backward compatibility with ES3 browsers.\n// Minifiers like uglify will usually transpile it back if compatibility with ES3 is not enabled.\nexport const HELPERS = `\nexport var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nexport function commonjsRequire () {\n\tthrow new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');\n}\n\nexport function unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nexport function createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nexport function getCjsExportFromNamespace (n) {\n\treturn n && n['default'] || n;\n}`;\n","/* eslint-disable no-undefined */\nconst isCjsPromises = new Map();\n\nexport function getIsCjsPromise(id) {\n let isCjsPromise = isCjsPromises.get(id);\n if (isCjsPromise) return isCjsPromise.promise;\n\n const promise = new Promise((resolve) => {\n isCjsPromise = {\n resolve,\n promise: undefined\n };\n isCjsPromises.set(id, isCjsPromise);\n });\n isCjsPromise.promise = promise;\n\n return promise;\n}\n\nexport function setIsCjsPromise(id, resolution) {\n const isCjsPromise = isCjsPromises.get(id);\n if (isCjsPromise) {\n if (isCjsPromise.resolve) {\n isCjsPromise.resolve(resolution);\n isCjsPromise.resolve = undefined;\n }\n } else {\n isCjsPromises.set(id, { promise: Promise.resolve(resolution), resolve: undefined });\n }\n}\n","/* eslint-disable no-param-reassign, no-undefined */\nimport { statSync } from 'fs';\nimport { dirname, resolve, sep } from 'path';\n\nimport {\n getExternalProxyId,\n getIdFromProxyId,\n getProxyId,\n HELPERS_ID,\n PROXY_SUFFIX\n} from './helpers';\n\nfunction getCandidatesForExtension(resolved, extension) {\n return [resolved + extension, `${resolved}${sep}index${extension}`];\n}\n\nfunction getCandidates(resolved, extensions) {\n return extensions.reduce(\n (paths, extension) => paths.concat(getCandidatesForExtension(resolved, extension)),\n [resolved]\n );\n}\n\nexport default function getResolveId(extensions) {\n function resolveExtensions(importee, importer) {\n // not our problem\n if (importee[0] !== '.' || !importer) return undefined;\n\n const resolved = resolve(dirname(importer), importee);\n const candidates = getCandidates(resolved, extensions);\n\n for (let i = 0; i < candidates.length; i += 1) {\n try {\n const stats = statSync(candidates[i]);\n if (stats.isFile()) return { id: candidates[i] };\n } catch (err) {\n /* noop */\n }\n }\n\n return undefined;\n }\n\n function resolveId(importee, importer) {\n const isProxyModule = importee.endsWith(PROXY_SUFFIX);\n if (isProxyModule) {\n importee = getIdFromProxyId(importee);\n } else if (importee.startsWith('\\0')) {\n if (importee === HELPERS_ID) {\n return importee;\n }\n return null;\n }\n\n if (importer && importer.endsWith(PROXY_SUFFIX)) {\n importer = getIdFromProxyId(importer);\n }\n\n return this.resolve(importee, importer, { skipSelf: true }).then((resolved) => {\n if (!resolved) {\n resolved = resolveExtensions(importee, importer);\n }\n if (isProxyModule) {\n if (!resolved) {\n return { id: getExternalProxyId(importee), external: false };\n }\n resolved.id = (resolved.external ? getExternalProxyId : getProxyId)(resolved.id);\n resolved.external = false;\n return resolved;\n }\n return resolved;\n });\n }\n\n return resolveId;\n}\n","/* eslint-disable no-undefined */\nexport { default as isReference } from 'is-reference';\n\nconst operators = {\n '==': (x) => equals(x.left, x.right, false),\n\n '!=': (x) => not(operators['=='](x)),\n\n '===': (x) => equals(x.left, x.right, true),\n\n '!==': (x) => not(operators['==='](x)),\n\n '!': (x) => isFalsy(x.argument),\n\n '&&': (x) => isTruthy(x.left) && isTruthy(x.right),\n\n '||': (x) => isTruthy(x.left) || isTruthy(x.right)\n};\n\nconst extractors = {\n Identifier(names, node) {\n names.push(node.name);\n },\n\n ObjectPattern(names, node) {\n node.properties.forEach((prop) => {\n getExtractor(prop.value.type)(names, prop.value);\n });\n },\n\n ArrayPattern(names, node) {\n node.elements.forEach((element) => {\n if (!element) return;\n getExtractor(element.type)(names, element);\n });\n },\n\n RestElement(names, node) {\n getExtractor(node.argument.type)(names, node.argument);\n },\n\n AssignmentPattern(names, node) {\n getExtractor(node.left.type)(names, node.left);\n }\n};\n\nexport function flatten(node) {\n const parts = [];\n\n while (node.type === 'MemberExpression') {\n if (node.computed) return null;\n\n parts.unshift(node.property.name);\n // eslint-disable-next-line no-param-reassign\n node = node.object;\n }\n\n if (node.type !== 'Identifier') return null;\n\n const { name } = node;\n parts.unshift(name);\n\n return { name, keypath: parts.join('.') };\n}\n\nexport function extractNames(node) {\n const names = [];\n extractors[node.type](names, node);\n return names;\n}\n\nfunction getExtractor(type) {\n const extractor = extractors[type];\n if (!extractor) throw new SyntaxError(`${type} pattern not supported.`);\n return extractor;\n}\n\nexport function isTruthy(node) {\n if (node.type === 'Literal') return !!node.value;\n if (node.type === 'ParenthesizedExpression') return isTruthy(node.expression);\n if (node.operator in operators) return operators[node.operator](node);\n return undefined;\n}\n\nexport function isFalsy(node) {\n return not(isTruthy(node));\n}\n\nfunction not(value) {\n return value === undefined ? value : !value;\n}\n\nfunction equals(a, b, strict) {\n if (a.type !== b.type) return undefined;\n // eslint-disable-next-line eqeqeq\n if (a.type === 'Literal') return strict ? a.value === b.value : a.value == b.value;\n return undefined;\n}\n","/* eslint-disable import/prefer-default-export */\nimport { basename, dirname, extname, sep } from 'path';\n\nimport { makeLegalIdentifier } from '@rollup/pluginutils';\n\nexport function getName(id) {\n const name = makeLegalIdentifier(basename(id, extname(id)));\n if (name !== 'index') {\n return name;\n }\n const segments = dirname(id).split(sep);\n return makeLegalIdentifier(segments[segments.length - 1]);\n}\n","/* eslint-disable no-param-reassign, no-shadow, no-underscore-dangle */\nimport { walk } from 'estree-walker';\nimport MagicString from 'magic-string';\nimport { attachScopes, extractAssignedNames, makeLegalIdentifier } from '@rollup/pluginutils';\n\nimport { flatten, isFalsy, isReference, isTruthy } from './ast-utils';\nimport { getProxyId, HELPERS_ID } from './helpers';\nimport { getName } from './utils';\n\nconst reserved = 'process location abstract arguments boolean break byte case catch char class const continue debugger default delete do double else enum eval export extends false final finally float for from function goto if implements import in instanceof int interface let long native new null package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with yield'.split(\n ' '\n);\nconst blacklist = { __esModule: true };\nreserved.forEach((word) => (blacklist[word] = true));\n\nconst exportsPattern = /^(?:module\\.)?exports(?:\\.([a-zA-Z_$][a-zA-Z_$0-9]*))?$/;\n\nconst firstpassGlobal = /\\b(?:require|module|exports|global)\\b/;\nconst firstpassNoGlobal = /\\b(?:require|module|exports)\\b/;\nconst importExportDeclaration = /^(?:Import|Export(?:Named|Default))Declaration/;\nconst functionType = /^(?:FunctionDeclaration|FunctionExpression|ArrowFunctionExpression)$/;\n\nfunction deconflict(scope, globals, identifier) {\n let i = 1;\n let deconflicted = identifier;\n\n while (scope.contains(deconflicted) || globals.has(deconflicted) || deconflicted in blacklist) {\n deconflicted = `${identifier}_${i}`;\n i += 1;\n }\n scope.declarations[deconflicted] = true;\n\n return deconflicted;\n}\n\nfunction tryParse(parse, code, id) {\n try {\n return parse(code, { allowReturnOutsideFunction: true });\n } catch (err) {\n err.message += ` in ${id}`;\n throw err;\n }\n}\n\nexport function hasCjsKeywords(code, ignoreGlobal) {\n const firstpass = ignoreGlobal ? firstpassNoGlobal : firstpassGlobal;\n return firstpass.test(code);\n}\n\nexport function checkEsModule(parse, code, id) {\n const ast = tryParse(parse, code, id);\n\n let isEsModule = false;\n for (const node of ast.body) {\n if (node.type === 'ExportDefaultDeclaration')\n return { isEsModule: true, hasDefaultExport: true, ast };\n if (node.type === 'ExportNamedDeclaration') {\n isEsModule = true;\n for (const specifier of node.specifiers) {\n if (specifier.exported.name === 'default') {\n return { isEsModule: true, hasDefaultExport: true, ast };\n }\n }\n } else if (importExportDeclaration.test(node.type)) isEsModule = true;\n }\n\n return { isEsModule, hasDefaultExport: false, ast };\n}\n\nexport function transformCommonjs(\n parse,\n code,\n id,\n isEntry,\n ignoreGlobal,\n ignoreRequire,\n customNamedExports,\n sourceMap,\n allowDynamicRequire,\n astCache\n) {\n const ast = astCache || tryParse(parse, code, id);\n\n const magicString = new MagicString(code);\n\n const required = {};\n // Because objects have no guaranteed ordering, yet we need it,\n // we need to keep track of the order in a array\n const sources = [];\n\n let uid = 0;\n\n let scope = attachScopes(ast, 'scope');\n const uses = { module: false, exports: false, global: false, require: false };\n\n let lexicalDepth = 0;\n let programDepth = 0;\n\n const globals = new Set();\n\n // TODO technically wrong since globals isn't populated yet, but ¯\\_(ツ)_/¯\n const HELPERS_NAME = deconflict(scope, globals, 'commonjsHelpers');\n\n const namedExports = {};\n\n // TODO handle transpiled modules\n let shouldWrap = /__esModule/.test(code);\n\n function isRequireStatement(node) {\n if (!node) return false;\n if (node.type !== 'CallExpression') return false;\n if (node.callee.name !== 'require' || scope.contains('require')) return false;\n // Weird case of require() without arguments\n if (node.arguments.length === 0) return false;\n return true;\n }\n\n function hasDynamicArguments(node) {\n return (\n node.arguments.length > 1 ||\n (node.arguments[0].type !== 'Literal' &&\n (node.arguments[0].type !== 'TemplateLiteral' || node.arguments[0].expressions.length > 0))\n );\n }\n\n function isStaticRequireStatement(node) {\n if (!isRequireStatement(node)) return false;\n if (hasDynamicArguments(node)) return false;\n if (ignoreRequire(node.arguments[0].value)) return false;\n return true;\n }\n\n function getRequireStringArg(node) {\n return node.arguments[0].type === 'Literal'\n ? node.arguments[0].value\n : node.arguments[0].quasis[0].value.cooked;\n }\n\n function getRequired(node, name) {\n const sourceId = getRequireStringArg(node);\n const existing = required[sourceId];\n // eslint-disable-next-line no-undefined\n if (existing === undefined) {\n if (!name) {\n do {\n name = `require$$${uid}`;\n uid += 1;\n } while (scope.contains(name));\n }\n\n sources.push(sourceId);\n required[sourceId] = { source: sourceId, name, importsDefault: false };\n }\n\n return required[sourceId];\n }\n\n // do a first pass, see which names are assigned to. This is necessary to prevent\n // illegally replacing `var foo = require('foo')` with `import foo from 'foo'`,\n // where `foo` is later reassigned. (This happens in the wild. CommonJS, sigh)\n const assignedTo = new Set();\n walk(ast, {\n enter(node) {\n if (node.type !== 'AssignmentExpression') return;\n if (node.left.type === 'MemberExpression') return;\n\n extractAssignedNames(node.left).forEach((name) => {\n assignedTo.add(name);\n });\n }\n });\n\n walk(ast, {\n enter(node, parent) {\n if (sourceMap) {\n magicString.addSourcemapLocation(node.start);\n magicString.addSourcemapLocation(node.end);\n }\n\n // skip dead branches\n if (parent && (parent.type === 'IfStatement' || parent.type === 'ConditionalExpression')) {\n if (node === parent.consequent && isFalsy(parent.test)) {\n this.skip();\n return;\n }\n if (node === parent.alternate && isTruthy(parent.test)) {\n this.skip();\n return;\n }\n }\n\n if (node._skip) {\n this.skip();\n return;\n }\n\n programDepth += 1;\n\n if (node.scope) ({ scope } = node);\n if (functionType.test(node.type)) lexicalDepth += 1;\n\n // if toplevel return, we need to wrap it\n if (node.type === 'ReturnStatement' && lexicalDepth === 0) {\n shouldWrap = true;\n }\n\n // rewrite `this` as `commonjsHelpers.commonjsGlobal`\n if (node.type === 'ThisExpression' && lexicalDepth === 0) {\n uses.global = true;\n if (!ignoreGlobal)\n magicString.overwrite(node.start, node.end, `${HELPERS_NAME}.commonjsGlobal`, {\n storeName: true\n });\n return;\n }\n\n // rewrite `typeof module`, `typeof module.exports` and `typeof exports` (https://github.com/rollup/rollup-plugin-commonjs/issues/151)\n if (node.type === 'UnaryExpression' && node.operator === 'typeof') {\n const flattened = flatten(node.argument);\n if (!flattened) return;\n\n if (scope.contains(flattened.name)) return;\n\n if (\n flattened.keypath === 'module.exports' ||\n flattened.keypath === 'module' ||\n flattened.keypath === 'exports'\n ) {\n magicString.overwrite(node.start, node.end, `'object'`, { storeName: false });\n }\n }\n\n // rewrite `require` (if not already handled) `global` and `define`, and handle free references to\n // `module` and `exports` as these mean we need to wrap the module in commonjsHelpers.createCommonjsModule\n if (node.type === 'Identifier') {\n if (isReference(node, parent) && !scope.contains(node.name)) {\n if (node.name in uses) {\n if (node.name === 'require') {\n if (allowDynamicRequire) return;\n magicString.overwrite(node.start, node.end, `${HELPERS_NAME}.commonjsRequire`, {\n storeName: true\n });\n }\n\n uses[node.name] = true;\n if (node.name === 'global' && !ignoreGlobal) {\n magicString.overwrite(node.start, node.end, `${HELPERS_NAME}.commonjsGlobal`, {\n storeName: true\n });\n }\n\n // if module or exports are used outside the context of an assignment\n // expression, we need to wrap the module\n if (node.name === 'module' || node.name === 'exports') {\n shouldWrap = true;\n }\n }\n\n if (node.name === 'define') {\n magicString.overwrite(node.start, node.end, 'undefined', { storeName: true });\n }\n\n globals.add(node.name);\n }\n\n return;\n }\n\n // Is this an assignment to exports or module.exports?\n if (node.type === 'AssignmentExpression') {\n if (node.left.type !== 'MemberExpression') return;\n\n const flattened = flatten(node.left);\n if (!flattened) return;\n\n if (scope.contains(flattened.name)) return;\n\n const match = exportsPattern.exec(flattened.keypath);\n if (!match || flattened.keypath === 'exports') return;\n\n uses[flattened.name] = true;\n\n // we're dealing with `module.exports = ...` or `[module.]exports.foo = ...` \n // if this isn't top-level, we'll need to wrap the module\n if (programDepth > 3) shouldWrap = true;\n\n node.left._skip = true;\n\n if (flattened.keypath === 'module.exports' && node.right.type === 'ObjectExpression') {\n node.right.properties.forEach((prop) => {\n if (prop.computed || !('key' in prop) || prop.key.type !== 'Identifier') return;\n const { name } = prop.key;\n if (name === makeLegalIdentifier(name)) namedExports[name] = true;\n });\n return;\n }\n\n if (match[1]) namedExports[match[1]] = true;\n return;\n }\n\n // if this is `var x = require('x')`, we can do `import x from 'x'`\n if (\n node.type === 'VariableDeclarator' &&\n node.id.type === 'Identifier' &&\n isStaticRequireStatement(node.init)\n ) {\n // for now, only do this for top-level requires. maybe fix this in future\n if (scope.parent) return;\n\n // edge case — CJS allows you to assign to imports. ES doesn't\n if (assignedTo.has(node.id.name)) return;\n\n const required = getRequired(node.init, node.id.name);\n required.importsDefault = true;\n\n if (required.name === node.id.name) {\n node._shouldRemove = true;\n }\n }\n\n if (!isStaticRequireStatement(node)) return;\n\n const required = getRequired(node);\n\n if (parent.type === 'ExpressionStatement') {\n // is a bare import, e.g. `require('foo');`\n magicString.remove(parent.start, parent.end);\n } else {\n required.importsDefault = true;\n magicString.overwrite(node.start, node.end, required.name);\n }\n\n node.callee._skip = true;\n },\n\n leave(node) {\n programDepth -= 1;\n if (node.scope) scope = scope.parent;\n if (functionType.test(node.type)) lexicalDepth -= 1;\n\n if (node.type === 'VariableDeclaration') {\n let keepDeclaration = false;\n let c = node.declarations[0].start;\n\n for (let i = 0; i < node.declarations.length; i += 1) {\n const declarator = node.declarations[i];\n\n if (declarator._shouldRemove) {\n magicString.remove(c, declarator.end);\n } else {\n if (!keepDeclaration) {\n magicString.remove(c, declarator.start);\n keepDeclaration = true;\n }\n\n c = declarator.end;\n }\n }\n\n if (!keepDeclaration) {\n magicString.remove(node.start, node.end);\n }\n }\n }\n });\n\n if (\n !sources.length &&\n !uses.module &&\n !uses.exports &&\n !uses.require &&\n (ignoreGlobal || !uses.global)\n ) {\n if (Object.keys(namedExports).length) {\n throw new Error(\n `Custom named exports were specified for ${id} but it does not appear to be a CommonJS module`\n );\n }\n // not a CommonJS module\n return null;\n }\n\n const includeHelpers = shouldWrap || uses.global || uses.require;\n const importBlock = `${(includeHelpers\n ? [`import * as ${HELPERS_NAME} from '${HELPERS_ID}';`]\n : []\n )\n .concat(\n sources.map(\n (source) =>\n // import the actual module before the proxy, so that we know\n // what kind of proxy to build\n `import '${source}';`\n ),\n sources.map((source) => {\n const { name, importsDefault } = required[source];\n return `import ${importsDefault ? `${name} from ` : ``}'${getProxyId(source)}';`;\n })\n )\n .join('\\n')}\\n\\n`;\n\n const namedExportDeclarations = [];\n let wrapperStart = '';\n let wrapperEnd = '';\n\n const moduleName = deconflict(scope, globals, getName(id));\n if (!isEntry) {\n const exportModuleExports = {\n str: `export { ${moduleName} as __moduleExports };`,\n name: '__moduleExports'\n };\n\n namedExportDeclarations.push(exportModuleExports);\n }\n\n const name = getName(id);\n\n function addExport(x) {\n const deconflicted = deconflict(scope, globals, name);\n\n const declaration =\n deconflicted === name\n ? `export var ${x} = ${moduleName}.${x};`\n : `var ${deconflicted} = ${moduleName}.${x};\\nexport { ${deconflicted} as ${x} };`;\n\n namedExportDeclarations.push({\n str: declaration,\n name: x\n });\n }\n\n if (customNamedExports) customNamedExports.forEach(addExport);\n\n const defaultExportPropertyAssignments = [];\n let hasDefaultExport = false;\n\n if (shouldWrap) {\n const args = `module${uses.exports ? ', exports' : ''}`;\n\n wrapperStart = `var ${moduleName} = ${HELPERS_NAME}.createCommonjsModule(function (${args}) {\\n`;\n wrapperEnd = `\\n});`;\n } else {\n const names = [];\n\n ast.body.forEach((node) => {\n if (node.type === 'ExpressionStatement' && node.expression.type === 'AssignmentExpression') {\n const { left } = node.expression;\n const flattened = flatten(left);\n\n if (!flattened) return;\n\n const match = exportsPattern.exec(flattened.keypath);\n if (!match) return;\n\n if (flattened.keypath === 'module.exports') {\n hasDefaultExport = true;\n magicString.overwrite(left.start, left.end, `var ${moduleName}`);\n } else {\n const [, name] = match;\n const deconflicted = deconflict(scope, globals, name);\n\n names.push({ name, deconflicted });\n\n magicString.overwrite(node.start, left.end, `var ${deconflicted}`);\n\n const declaration =\n name === deconflicted\n ? `export { ${name} };`\n : `export { ${deconflicted} as ${name} };`;\n\n if (name !== 'default') {\n namedExportDeclarations.push({\n str: declaration,\n name\n });\n delete namedExports[name];\n }\n\n defaultExportPropertyAssignments.push(`${moduleName}.${name} = ${deconflicted};`);\n }\n }\n });\n\n if (!hasDefaultExport && (names.length || !isEntry)) {\n wrapperEnd = `\\n\\nvar ${moduleName} = {\\n${names\n .map(({ name, deconflicted }) => `\\t${name}: ${deconflicted}`)\n .join(',\\n')}\\n};`;\n }\n }\n Object.keys(namedExports)\n .filter((key) => !blacklist[key])\n .forEach(addExport);\n\n const defaultExport = /__esModule/.test(code)\n ? `export default ${HELPERS_NAME}.unwrapExports(${moduleName});`\n : `export default ${moduleName};`;\n\n const named = namedExportDeclarations\n .filter((x) => x.name !== 'default' || !hasDefaultExport)\n .map((x) => x.str);\n\n const exportBlock = `\\n\\n${[defaultExport]\n .concat(named)\n .concat(hasDefaultExport ? defaultExportPropertyAssignments : [])\n .join('\\n')}`;\n\n magicString\n .trim()\n .prepend(importBlock + wrapperStart)\n .trim()\n .append(wrapperEnd);\n\n if (hasDefaultExport || named.length > 0 || shouldWrap || !isEntry) {\n magicString.append(exportBlock);\n }\n\n code = magicString.toString();\n const map = sourceMap ? magicString.generateMap() : null;\n\n return { code, map };\n}\n","import { realpathSync, existsSync } from 'fs';\nimport { extname, resolve, normalize } from 'path';\n\nimport { sync as nodeResolveSync, isCore } from 'resolve';\nimport { createFilter } from '@rollup/pluginutils';\n\nimport { peerDependencies } from '../package.json';\n\nimport {\n EXTERNAL_SUFFIX,\n getIdFromExternalProxyId,\n getIdFromProxyId,\n HELPERS,\n HELPERS_ID,\n PROXY_SUFFIX\n} from './helpers';\nimport { getIsCjsPromise, setIsCjsPromise } from './is-cjs';\nimport getResolveId from './resolve-id';\nimport { checkEsModule, hasCjsKeywords, transformCommonjs } from './transform';\nimport { getName } from './utils';\n\nexport default function commonjs(options = {}) {\n const extensions = options.extensions || ['.js'];\n const filter = createFilter(options.include, options.exclude);\n const { ignoreGlobal } = options;\n\n const customNamedExports = {};\n if (options.namedExports) {\n Object.keys(options.namedExports).forEach((id) => {\n let resolveId = id;\n let resolvedId;\n\n if (isCore(id)) {\n // resolve will not find npm modules with the same name as\n // core modules without a trailing slash. Since core modules\n // must be external, we can assume any core modules defined\n // here are npm modules by that name.\n resolveId += '/';\n }\n\n try {\n resolvedId = nodeResolveSync(resolveId, { basedir: process.cwd() });\n } catch (err) {\n resolvedId = resolve(id);\n }\n\n // Note: customNamedExport's keys must be normalized file paths.\n // resolve and nodeResolveSync both return normalized file paths\n // so no additional normalization is necessary.\n customNamedExports[resolvedId] = options.namedExports[id];\n\n if (existsSync(resolvedId)) {\n const realpath = realpathSync(resolvedId);\n if (realpath !== resolvedId) {\n customNamedExports[realpath] = options.namedExports[id];\n }\n }\n });\n }\n\n const esModulesWithoutDefaultExport = new Set();\n const esModulesWithDefaultExport = new Set();\n // TODO maybe this should be configurable?\n const allowDynamicRequire = !!options.ignore;\n\n const ignoreRequire =\n typeof options.ignore === 'function'\n ? options.ignore\n : Array.isArray(options.ignore)\n ? (id) => options.ignore.includes(id)\n : () => false;\n\n const resolveId = getResolveId(extensions);\n\n const sourceMap = options.sourceMap !== false;\n\n function transformAndCheckExports(code, id) {\n const { isEsModule, hasDefaultExport, ast } = checkEsModule(this.parse, code, id);\n if (isEsModule) {\n (hasDefaultExport ? esModulesWithDefaultExport : esModulesWithoutDefaultExport).add(id);\n return null;\n }\n\n // it is not an ES module but it does not have CJS-specific elements.\n if (!hasCjsKeywords(code, ignoreGlobal)) {\n esModulesWithoutDefaultExport.add(id);\n return null;\n }\n\n const normalizedId = normalize(id);\n\n const transformed = transformCommonjs(\n this.parse,\n code,\n id,\n this.getModuleInfo(id).isEntry,\n ignoreGlobal,\n ignoreRequire,\n customNamedExports[normalizedId],\n sourceMap,\n allowDynamicRequire,\n ast\n );\n if (!transformed) {\n esModulesWithoutDefaultExport.add(id);\n return null;\n }\n\n return transformed;\n }\n\n return {\n name: 'commonjs',\n\n buildStart() {\n const [major, minor] = this.meta.rollupVersion.split('.').map(Number);\n const minVersion = peerDependencies.rollup.slice(2);\n const [minMajor, minMinor] = minVersion.split('.').map(Number);\n if (major < minMajor || (major === minMajor && minor < minMinor)) {\n this.error(\n `Insufficient Rollup version: \"@rollup/plugin-commonjs\" requires at least rollup@${minVersion} but found rollup@${this.meta.rollupVersion}.`\n );\n }\n },\n\n resolveId,\n\n load(id) {\n if (id === HELPERS_ID) return HELPERS;\n\n // generate proxy modules\n if (id.endsWith(EXTERNAL_SUFFIX)) {\n const actualId = getIdFromExternalProxyId(id);\n const name = getName(actualId);\n\n return `import ${name} from ${JSON.stringify(actualId)}; export default ${name};`;\n }\n\n if (id.endsWith(PROXY_SUFFIX)) {\n const actualId = getIdFromProxyId(id);\n const name = getName(actualId);\n\n return getIsCjsPromise(actualId).then((isCjs) => {\n if (isCjs)\n return `import { __moduleExports } from ${JSON.stringify(\n actualId\n )}; export default __moduleExports;`;\n else if (esModulesWithoutDefaultExport.has(actualId))\n return `import * as ${name} from ${JSON.stringify(actualId)}; export default ${name};`;\n else if (esModulesWithDefaultExport.has(actualId)) {\n return `export {default} from ${JSON.stringify(actualId)};`;\n }\n return `import * as ${name} from ${JSON.stringify(\n actualId\n )}; import {getCjsExportFromNamespace} from \"${HELPERS_ID}\"; export default getCjsExportFromNamespace(${name})`;\n });\n }\n\n return null;\n },\n\n transform(code, id) {\n if (!filter(id) || extensions.indexOf(extname(id)) === -1) {\n setIsCjsPromise(id, null);\n return null;\n }\n\n let transformed;\n try {\n transformed = transformAndCheckExports.call(this, code, id);\n } catch (err) {\n transformed = null;\n this.error(err, err.loc);\n }\n\n setIsCjsPromise(id, Boolean(transformed));\n return transformed;\n }\n };\n}\n"],"names":["PROXY_SUFFIX","getProxyId","id","getIdFromProxyId","proxyId","slice","length","EXTERNAL_SUFFIX","getExternalProxyId","getIdFromExternalProxyId","HELPERS_ID","HELPERS","isCjsPromises","Map","getIsCjsPromise","isCjsPromise","get","promise","Promise","resolve","undefined","set","setIsCjsPromise","resolution","getCandidatesForExtension","resolved","extension","sep","getCandidates","extensions","reduce","paths","concat","getResolveId","resolveExtensions","importee","importer","dirname","candidates","i","stats","statSync","isFile","err","resolveId","isProxyModule","endsWith","startsWith","skipSelf","then","external","operators","x","equals","left","right","not","isFalsy","argument","isTruthy","flatten","node","parts","type","computed","unshift","property","name","object","keypath","join","value","expression","operator","a","b","strict","getName","makeLegalIdentifier","basename","extname","segments","split","reserved","blacklist","__esModule","forEach","word","exportsPattern","firstpassGlobal","firstpassNoGlobal","importExportDeclaration","functionType","deconflict","scope","globals","identifier","deconflicted","contains","has","declarations","tryParse","parse","code","allowReturnOutsideFunction","message","hasCjsKeywords","ignoreGlobal","firstpass","test","checkEsModule","ast","isEsModule","body","hasDefaultExport","specifiers","specifier","exported","transformCommonjs","isEntry","ignoreRequire","customNamedExports","sourceMap","allowDynamicRequire","astCache","magicString","MagicString","required","sources","uid","attachScopes","uses","module","exports","global","require","lexicalDepth","programDepth","Set","HELPERS_NAME","namedExports","shouldWrap","isRequireStatement","callee","arguments","hasDynamicArguments","expressions","isStaticRequireStatement","getRequireStringArg","quasis","cooked","getRequired","sourceId","existing","push","source","importsDefault","assignedTo","walk","enter","extractAssignedNames","add","parent","addSourcemapLocation","start","end","consequent","skip","alternate","_skip","overwrite","storeName","flattened","isReference","match","exec","properties","prop","key","init","_shouldRemove","remove","leave","keepDeclaration","c","declarator","Object","keys","Error","includeHelpers","importBlock","map","namedExportDeclarations","wrapperStart","wrapperEnd","moduleName","exportModuleExports","str","addExport","declaration","defaultExportPropertyAssignments","args","names","filter","defaultExport","named","exportBlock","trim","prepend","append","toString","generateMap","commonjs","options","createFilter","include","exclude","resolvedId","isCore","nodeResolveSync","basedir","process","cwd","existsSync","realpath","realpathSync","esModulesWithoutDefaultExport","esModulesWithDefaultExport","ignore","Array","isArray","includes","transformAndCheckExports","normalizedId","normalize","transformed","getModuleInfo","buildStart","meta","rollupVersion","Number","major","minor","minVersion","peerDependencies","rollup","minMajor","minMinor","error","load","actualId","JSON","stringify","isCjs","transform","indexOf","call","loc","Boolean"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAMA,YAAY,GAAG,iBAArB;AACP,AAAO,MAAMC,UAAU,GAAIC,EAAD,IAAS,KAAIA,EAAG,GAAEF,YAAa,EAAlD;AACP,AAAO,MAAMG,gBAAgB,GAAIC,OAAD,IAAaA,OAAO,CAACC,KAAR,CAAc,CAAd,EAAiB,CAACL,YAAY,CAACM,MAA/B,CAAtC;AAEP,AAAO,MAAMC,eAAe,GAAG,oBAAxB;AACP,AAAO,MAAMC,kBAAkB,GAAIN,EAAD,IAAS,KAAIA,EAAG,GAAEK,eAAgB,EAA7D;AACP,AAAO,MAAME,wBAAwB,GAAIL,OAAD,IAAaA,OAAO,CAACC,KAAR,CAAc,CAAd,EAAiB,CAACE,eAAe,CAACD,MAAlC,CAA9C;AAEP,AAAO,MAAMI,UAAU,GAAG,sBAAnB;AAGP;;AACA,AAAO,MAAMC,OAAO,GAAI;;;;;;;;;;;;;;;;;EAAjB;;ACZP;AACA,MAAMC,aAAa,GAAG,IAAIC,GAAJ,EAAtB;AAEA,AAAO,SAASC,eAAT,CAAyBZ,EAAzB,EAA6B;AAClC,MAAIa,YAAY,GAAGH,aAAa,CAACI,GAAd,CAAkBd,EAAlB,CAAnB;AACA,MAAIa,YAAJ,EAAkB,OAAOA,YAAY,CAACE,OAApB;AAElB,QAAMA,OAAO,GAAG,IAAIC,OAAJ,CAAaC,OAAD,IAAa;AACvCJ,IAAAA,YAAY,GAAG;AACbI,MAAAA,OADa;AAEbF,MAAAA,OAAO,EAAEG;AAFI,KAAf;AAIAR,IAAAA,aAAa,CAACS,GAAd,CAAkBnB,EAAlB,EAAsBa,YAAtB;AACD,GANe,CAAhB;AAOAA,EAAA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