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

1 line
58 KiB
Plaintext
Raw Normal View History

{"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