first commit

This commit is contained in:
jefferyzhao
2025-07-31 17:44:12 +08:00
commit b9bdc8598b
42390 changed files with 4467935 additions and 0 deletions

View File

@ -0,0 +1,5 @@
Object.defineProperty(exports, "createPolyfillPlugins", {
get: () => require("./polyfills.cjs")
});
//# sourceMappingURL=index.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["Object","defineProperty","exports","get","require"],"sources":["../../src/babel-7/index.cjs"],"sourcesContent":["Object.defineProperty(exports, \"createPolyfillPlugins\", {\n get: () => require(\"./polyfills.cjs\"),\n});\n"],"mappings":"AAAAA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,uBAAuB,EAAE;EACtDC,GAAG,EAAEA,CAAA,KAAMC,OAAO,CAAC,iBAAiB;AACtC,CAAC,CAAC"}

View File

@ -0,0 +1,50 @@
;
const pluginCorejs2 = require("babel-plugin-polyfill-corejs2").default;
const pluginRegenerator = require("babel-plugin-polyfill-regenerator").default;
const pluginsCompat = "#__secret_key__@babel/runtime__compatibility";
function createCorejs2Plugin(options) {
return (api, _, filename) => pluginCorejs2(api, options, filename);
}
function createRegeneratorPlugin(options, useRuntimeRegenerator, corejsPlugin) {
if (!useRuntimeRegenerator) return corejsPlugin != null ? corejsPlugin : undefined;
return (api, _, filename) => {
return Object.assign({}, pluginRegenerator(api, options, filename), {
inherits: corejsPlugin != null ? corejsPlugin : undefined
});
};
}
module.exports = function createBasePolyfillsPlugin({
corejs,
regenerator = true
}, runtimeVersion, absoluteImports, corejs3Plugin) {
let proposals = false;
let rawVersion;
if (typeof corejs === "object" && corejs !== null) {
rawVersion = corejs.version;
proposals = Boolean(corejs.proposals);
} else {
rawVersion = corejs;
}
const corejsVersion = rawVersion ? Number(rawVersion) : false;
if (![false, 2, 3].includes(corejsVersion)) {
throw new Error(`The \`core-js\` version must be false, 2 or 3, but got ${JSON.stringify(rawVersion)}.`);
}
if (proposals && (!corejsVersion || corejsVersion < 3)) {
throw new Error("The 'proposals' option is only supported when using 'corejs: 3'");
}
if (typeof regenerator !== "boolean") {
throw new Error("The 'regenerator' option must be undefined, or a boolean.");
}
const polyfillOpts = {
method: "usage-pure",
absoluteImports,
[pluginsCompat]: {
useBabelRuntime: true,
runtimeVersion,
ext: ""
}
};
return createRegeneratorPlugin(polyfillOpts, regenerator, corejsVersion === 2 ? createCorejs2Plugin(polyfillOpts) : corejsVersion === 3 ? corejs3Plugin : null);
};
//# sourceMappingURL=polyfills.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["pluginCorejs2","require","default","pluginRegenerator","pluginsCompat","createCorejs2Plugin","options","api","_","filename","createRegeneratorPlugin","useRuntimeRegenerator","corejsPlugin","undefined","Object","assign","inherits","module","exports","createBasePolyfillsPlugin","corejs","regenerator","runtimeVersion","absoluteImports","corejs3Plugin","proposals","rawVersion","version","Boolean","corejsVersion","Number","includes","Error","JSON","stringify","polyfillOpts","method","useBabelRuntime","ext"],"sources":["../../src/babel-7/polyfills.cjs"],"sourcesContent":["// TODO(Babel 8) Remove this file\nif (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Internal Babel error: This file should only be loaded in Babel 7\",\n );\n}\n\nconst pluginCorejs2 = require(\"babel-plugin-polyfill-corejs2\").default;\nconst pluginRegenerator = require(\"babel-plugin-polyfill-regenerator\").default;\n\nconst pluginsCompat = \"#__secret_key__@babel/runtime__compatibility\";\n\nfunction createCorejs2Plugin(options) {\n return (api, _, filename) => pluginCorejs2(api, options, filename);\n}\n\nfunction createRegeneratorPlugin(options, useRuntimeRegenerator, corejsPlugin) {\n if (!useRuntimeRegenerator) return corejsPlugin ?? undefined;\n return (api, _, filename) => {\n return {\n ...pluginRegenerator(api, options, filename),\n inherits: corejsPlugin ?? undefined,\n };\n };\n}\n\nmodule.exports = function createBasePolyfillsPlugin(\n { corejs, regenerator = true },\n runtimeVersion,\n absoluteImports,\n corejs3Plugin,\n) {\n let proposals = false;\n let rawVersion;\n\n if (typeof corejs === \"object\" && corejs !== null) {\n rawVersion = corejs.version;\n proposals = Boolean(corejs.proposals);\n } else {\n rawVersion = corejs;\n }\n\n const corejsVersion = rawVersion ? Number(rawVersion) : false;\n\n if (![false, 2, 3].includes(corejsVersion)) {\n throw new Error(\n `The \\`core-js\\` version must be false, 2 or 3, but got ${JSON.stringify(\n rawVersion,\n )}.`,\n );\n }\n\n if (proposals && (!corejsVersion || corejsVersion < 3)) {\n throw new Error(\n \"The 'proposals' option is only supported when using 'corejs: 3'\",\n );\n }\n\n if (typeof regenerator !== \"boolean\") {\n throw new Error(\n \"The 'regenerator' option must be undefined, or a boolean.\",\n );\n }\n\n const polyfillOpts = {\n method: \"usage-pure\",\n absoluteImports,\n [pluginsCompat]: { useBabelRuntime: true, runtimeVersion, ext: \"\" },\n };\n\n return createRegeneratorPlugin(\n polyfillOpts,\n regenerator,\n corejsVersion === 2\n ? createCorejs2Plugin(polyfillOpts)\n : corejsVersion === 3\n ? corejs3Plugin\n : null,\n );\n};\n"],"mappings":";AAOA,MAAMA,aAAa,GAAGC,OAAO,CAAC,+BAA+B,CAAC,CAACC,OAAO;AACtE,MAAMC,iBAAiB,GAAGF,OAAO,CAAC,mCAAmC,CAAC,CAACC,OAAO;AAE9E,MAAME,aAAa,GAAG,8CAA8C;AAEpE,SAASC,mBAAmBA,CAACC,OAAO,EAAE;EACpC,OAAO,CAACC,GAAG,EAAEC,CAAC,EAAEC,QAAQ,KAAKT,aAAa,CAACO,GAAG,EAAED,OAAO,EAAEG,QAAQ,CAAC;AACpE;AAEA,SAASC,uBAAuBA,CAACJ,OAAO,EAAEK,qBAAqB,EAAEC,YAAY,EAAE;EAC7E,IAAI,CAACD,qBAAqB,EAAE,OAAOC,YAAY,WAAZA,YAAY,GAAIC,SAAS;EAC5D,OAAO,CAACN,GAAG,EAAEC,CAAC,EAAEC,QAAQ,KAAK;IAC3B,OAAAK,MAAA,CAAAC,MAAA,KACKZ,iBAAiB,CAACI,GAAG,EAAED,OAAO,EAAEG,QAAQ,CAAC;MAC5CO,QAAQ,EAAEJ,YAAY,WA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BL,aAAa,GACb,IACR,CAAC;AACH,CAAC"}

View File

@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCorejs3Plugin = createCorejs3Plugin;
var _babelPluginPolyfillCorejs = require("babel-plugin-polyfill-corejs3");
const pluginCorejs3 = _babelPluginPolyfillCorejs.default || _babelPluginPolyfillCorejs;
const pluginsCompat = "#__secret_key__@babel/runtime__compatibility";
function createCorejs3Plugin(corejs, absoluteImports) {
let proposals = false;
let rawVersion;
if (typeof corejs === "object" && corejs !== null) {
rawVersion = corejs.version;
proposals = Boolean(corejs.proposals);
} else {
rawVersion = corejs;
}
if (!rawVersion) return null;
const version = rawVersion ? Number(rawVersion) : false;
if (version !== 3) {
throw new Error(`The \`core-js\` version must be 3, but got ${JSON.stringify(rawVersion)}.`);
}
return (api, _, filename) => pluginCorejs3(api, {
method: "usage-pure",
proposals,
absoluteImports,
[pluginsCompat]: {
useBabelRuntime: true,
ext: ""
}
}, filename);
}
//# sourceMappingURL=core-js.js.map

View File

@ -0,0 +1 @@
{"version":3,"names":["_babelPluginPolyfillCorejs","require","pluginCorejs3","_pluginCorejs3","default","pluginsCompat","createCorejs3Plugin","corejs","absoluteImports","proposals","rawVersion","version","Boolean","Number","Error","JSON","stringify","api","_","filename","method","useBabelRuntime","ext"],"sources":["../src/core-js.ts"],"sourcesContent":["// TODO: Consider removing babel-plugin-polyfill-corejs3 from here, and ask\n// users to explicitly enable it in their Babel configuration files.\n\nimport type { PluginAPI } from \"@babel/core\";\nimport _pluginCorejs3 from \"babel-plugin-polyfill-corejs3\";\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\nconst pluginCorejs3 = (_pluginCorejs3.default ||\n _pluginCorejs3) as typeof _pluginCorejs3.default;\n\nimport type { Options } from \"./index.ts\";\n\nconst pluginsCompat = \"#__secret_key__@babel/runtime__compatibility\";\n\nexport function createCorejs3Plugin(\n corejs: Options[\"corejs\"],\n absoluteImports: boolean,\n) {\n let proposals = false;\n let rawVersion;\n\n if (typeof corejs === \"object\" && corejs !== null) {\n rawVersion = corejs.version;\n proposals = Boolean(corejs.proposals);\n } else {\n rawVersion = corejs;\n }\n\n if (!rawVersion) return null;\n\n const version = rawVersion ? Number(rawVersion) : false;\n\n // TODO: Allow specifying minor versions\n if (version !== 3) {\n throw new Error(\n `The \\`core-js\\` version must be 3, but got ${JSON.stringify(\n rawVersion,\n )}.`,\n );\n }\n\n return (api: PluginAPI, _: {}, filename: string) =>\n pluginCorejs3(\n api,\n {\n method: \"usage-pure\",\n proposals,\n absoluteImports,\n [pluginsCompat]: { useBabelRuntime: true, ext: \"\" },\n },\n filename,\n );\n}\n"],"mappings":";;;;;;AAIA,IAAAA,0BAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GAAIC,0BAAc,CAACC,OAAO,IAC3CD,0BAAgD;AAIlD,MAAME,aAAa,GAAG,8CAA8C;AAE7D,SAASC,mBAAmBA,CACjCC,MAAyB,EACzBC,eAAwB,EACxB;EACA,IAAIC,SAAS,GAAG,KAAK;EACrB,IAAIC,UAAU;EAEd,IAAI,OAAOH,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,IAAI,EAAE;IACjDG,UAAU,GAAGH,MAAM,CAACI,OAAO;IAC3BF,SAAS,GAAGG,OAAO,CAACL,MAAM,CAACE,SAAS,CAAC;EACvC,CAAC,MAAM;IACLC,UAAU,GAAGH,MAAM;EACrB;EAEA,IAAI,CAACG,UAAU,EAAE,OAAO,IAAI;EAE5B,MAAMC,OAAO,GAAGD,UAAU,GAAGG,MAAM,CAACH,UAAU,CAAC,GAAG,KAAK;EAGvD,IAAIC,OAAO,KAAK,CAAC,EAAE;IACjB,MAAM,IAAIG,KAAK,CACZ,8CAA6CC,IAAI,CAACC,SAAS,CAC1DN,UACF,CAAE,GACJ,CAAC;EACH;EAEA,OAAO,CAACO,GAAc,EAAEC,CAAK,EAAEC,QAAgB,KAC7CjB,aAAa,CACXe,GAAG,EACH;IACEG,MAAM,EAAE,YAAY;IACpBX,SAAS;IACTD,eAAe;IACf,CAACH,aAAa,GAAG;MAAEgB,eAAe,EAAE,IAAI;MAAEC,GAAG,EAAE;IAAG;EACpD,CAAC,EACDH,QACF,CAAC;AACL"}

View File

@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
exports.resolveFSPath = resolveFSPath;
function _default(moduleName, dirname, absoluteRuntime) {
if (absoluteRuntime === false) return moduleName;
resolveFSPath();
}
function resolveFSPath() {
throw new Error("The 'absoluteRuntime' option is not supported when using @babel/standalone.");
}
//# sourceMappingURL=browser.js.map

View File

@ -0,0 +1 @@
{"version":3,"names":["_default","moduleName","dirname","absoluteRuntime","resolveFSPath","Error"],"sources":["../../src/get-runtime-path/browser.ts"],"sourcesContent":["export default function (\n moduleName: string,\n dirname: string,\n absoluteRuntime: string | boolean,\n) {\n if (absoluteRuntime === false) return moduleName;\n\n resolveFSPath();\n}\n\nexport function resolveFSPath() {\n throw new Error(\n \"The 'absoluteRuntime' option is not supported when using @babel/standalone.\",\n );\n}\n"],"mappings":";;;;;;;AAAe,SAAAA,SACbC,UAAkB,EAClBC,OAAe,EACfC,eAAiC,EACjC;EACA,IAAIA,eAAe,KAAK,KAAK,EAAE,OAAOF,UAAU;EAEhDG,aAAa,CAAC,CAAC;AACjB;AAEO,SAASA,aAAaA,CAAA,EAAG;EAC9B,MAAM,IAAIC,KAAK,CACb,6EACF,CAAC;AACH"}

View File

@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
exports.resolveFSPath = resolveFSPath;
var _path = require("path");
var _module = require("module");
function _default(moduleName, dirname, absoluteRuntime) {
if (absoluteRuntime === false) return moduleName;
return resolveAbsoluteRuntime(moduleName, _path.resolve(dirname, absoluteRuntime === true ? "." : absoluteRuntime));
}
function resolveAbsoluteRuntime(moduleName, dirname) {
try {
return _path.dirname((((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, {
paths: [b]
}, M = require("module")) => {
let f = M._findPath(r, M._nodeModulePaths(b).concat(b));
if (f) return f;
f = new Error(`Cannot resolve module '${r}'`);
f.code = "MODULE_NOT_FOUND";
throw f;
})(`${moduleName}/package.json`, {
paths: [dirname]
})).replace(/\\/g, "/");
} catch (err) {
if (err.code !== "MODULE_NOT_FOUND") throw err;
throw Object.assign(new Error(`Failed to resolve "${moduleName}" relative to "${dirname}"`), {
code: "BABEL_RUNTIME_NOT_FOUND",
runtime: moduleName,
dirname
});
}
}
function resolveFSPath(path) {
return require.resolve(path).replace(/\\/g, "/");
}
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"names":["_path","require","_module","_default","moduleName","dirname","absoluteRuntime","resolveAbsoluteRuntime","path","resolve","v","w","split","process","versions","node","r","paths","b","M","f","_findPath","_nodeModulePaths","concat","Error","code","replace","err","Object","assign","runtime","resolveFSPath"],"sources":["../../src/get-runtime-path/index.ts"],"sourcesContent":["import path from \"path\";\n\nimport { createRequire } from \"module\";\nconst require = createRequire(import.meta.url);\n\nexport default function (\n moduleName: string,\n dirname: string,\n absoluteRuntime: string | boolean,\n) {\n if (absoluteRuntime === false) return moduleName;\n\n return resolveAbsoluteRuntime(\n moduleName,\n path.resolve(dirname, absoluteRuntime === true ? \".\" : absoluteRuntime),\n );\n}\n\nfunction resolveAbsoluteRuntime(moduleName: string, dirname: string) {\n try {\n return path\n .dirname(\n require.resolve(`${moduleName}/package.json`, { paths: [dirname] }),\n )\n .replace(/\\\\/g, \"/\");\n } catch (err) {\n if (err.code !== \"MODULE_NOT_FOUND\") throw err;\n\n throw Object.assign(\n new Error(`Failed to resolve \"${moduleName}\" relative to \"${dirname}\"`),\n {\n code: \"BABEL_RUNTIME_NOT_FOUND\",\n runtime: moduleName,\n dirname,\n },\n );\n }\n}\n\nexport function resolveFSPath(path: string) {\n return require.resolve(path).replace(/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AI,KAAK,kBAAkB,EAAE,MAAME,GAAG;IAE9C,MAAMC,MAAM,CAACC,MAAM,CACjB,IAAIL,KAAK,CAAE,sBAAqBpB,UAAW,kBAAiBC,OAAQ,GAAE,CAAC,EACvE;MACEoB,IAAI,EAAE,yBAAyB;MAC/BK,OAAO,EAAE1B,UAAU;MACnBC;IACF,CACF,CAAC;EACH;AACF;AAEO,SAAS0B,aAAaA,CAACvB,IAAY,EAAE;EAC1C,OAAOP,OAAO,CAACQ,OAAO,CAACD,IAAI,CAAC,CAACkB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;AAClD"}

View File

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.hasMinVersion = hasMinVersion;
var _semver = require("semver");
function hasMinVersion(minVersion, runtimeVersion) {
if (!runtimeVersion) return true;
if (_semver.valid(runtimeVersion)) runtimeVersion = `^${runtimeVersion}`;
return !_semver.intersects(`<${minVersion}`, runtimeVersion) && !_semver.intersects(`>=8.0.0`, runtimeVersion);
}
//# sourceMappingURL=helpers.js.map

View File

@ -0,0 +1 @@
{"version":3,"names":["_semver","require","hasMinVersion","minVersion","runtimeVersion","semver","valid","intersects"],"sources":["../src/helpers.ts"],"sourcesContent":["import semver from \"semver\";\n\nexport function hasMinVersion(\n minVersion: string,\n runtimeVersion: string | void,\n) {\n // If the range is unavailable, we're running the script during Babel's\n // build process, and we want to assume that all versions are satisfied so\n // that the built output will include all definitions.\n if (!runtimeVersion) return true;\n\n // semver.intersects() has some surprising behavior with comparing ranges\n // with pre-release versions. We add '^' to ensure that we are always\n // comparing ranges with ranges, which sidesteps this logic.\n // For example:\n //\n // semver.intersects(`<7.0.1`, \"7.0.0-beta.0\") // false - surprising\n // semver.intersects(`<7.0.1`, \"^7.0.0-beta.0\") // true - expected\n //\n // This is because the first falls back to\n //\n // semver.satisfies(\"7.0.0-beta.0\", `<7.0.1`) // false - surprising\n //\n // and this fails because a prerelease version can only satisfy a range\n // if it is a prerelease within the same major/minor/patch range.\n //\n // Note: If this is found to have issues, please also revisit the logic in\n // babel-core's availableHelper() API.\n if (semver.valid(runtimeVersion)) runtimeVersion = `^${runtimeVersion}`;\n\n return (\n !semver.intersects(`<${minVersion}`, runtimeVersion) &&\n !semver.intersects(`>=8.0.0`, runtimeVersion)\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEO,SAASC,aAAaA,CAC3BC,UAAkB,EAClBC,cAA6B,EAC7B;EAIA,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAmBhC,IAAIC,OAAM,CAACC,KAAK,CAACF,cAAc,CAAC,EAAEA,cAAc,GAAI,IAAGA,cAAe,EAAC;EAEvE,OACE,CAACC,OAAM,CAACE,UAAU,CAAE,IAAGJ,UAAW,EAAC,EAAEC,cAAc,CAAC,IACpD,CAACC,OAAM,CAACE,UAAU,CAAE,SAAQ,EAAEH,cAAc,CAAC;AAEjD"}

View File

@ -0,0 +1,108 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _helperModuleImports = require("@babel/helper-module-imports");
var _core = require("@babel/core");
var _helpers = require("./helpers.js");
var _index = require("./get-runtime-path/index.js");
var _coreJs = require("./core-js.js");
var _index2 = require("./babel-7/index.cjs");
var _default = exports.default = (0, _helperPluginUtils.declare)((api, options, dirname) => {
var _options$corejs;
api.assertVersion(7);
const {
helpers: useRuntimeHelpers = true,
version: runtimeVersion = "7.0.0-beta.0",
absoluteRuntime = false,
moduleName = null
} = options;
if (typeof useRuntimeHelpers !== "boolean") {
throw new Error("The 'helpers' option must be undefined, or a boolean.");
}
if (typeof absoluteRuntime !== "boolean" && typeof absoluteRuntime !== "string") {
throw new Error("The 'absoluteRuntime' option must be undefined, a boolean, or a string.");
}
if (typeof runtimeVersion !== "string") {
throw new Error(`The 'version' option must be a version string.`);
}
if (moduleName !== null && typeof moduleName !== "string") {
throw new Error("The 'moduleName' option must be null or a string.");
}
{
const DUAL_MODE_RUNTIME = "7.13.0";
var supportsCJSDefault = (0, _helpers.hasMinVersion)(DUAL_MODE_RUNTIME, runtimeVersion);
}
if (hasOwnProperty.call(options, "useBuiltIns")) {
if (options["useBuiltIns"]) {
throw new Error("The 'useBuiltIns' option has been removed. The @babel/runtime " + "module now uses builtins by default.");
} else {
throw new Error("The 'useBuiltIns' option has been removed. Use the 'corejs'" + "option to polyfill with `core-js` via @babel/runtime.");
}
}
if (hasOwnProperty.call(options, "polyfill")) {
if (options["polyfill"] === false) {
throw new Error("The 'polyfill' option has been removed. The @babel/runtime " + "module now skips polyfilling by default.");
} else {
throw new Error("The 'polyfill' option has been removed. Use the 'corejs'" + "option to polyfill with `core-js` via @babel/runtime.");
}
}
;
{
const {
useESModules = false
} = options;
if (typeof useESModules !== "boolean" && useESModules !== "auto") {
throw new Error("The 'useESModules' option must be undefined, or a boolean, or 'auto'.");
}
var esModules = useESModules === "auto" ? api.caller(caller => !!(caller != null && caller.supportsStaticESM)) : useESModules;
}
const HEADER_HELPERS = ["interopRequireWildcard", "interopRequireDefault"];
return {
name: "transform-runtime",
inherits: _index2.createPolyfillPlugins(options, runtimeVersion, absoluteRuntime, options.corejs === 3 || ((_options$corejs = options.corejs) == null ? void 0 : _options$corejs.version) === 3 ? (0, _coreJs.createCorejs3Plugin)(options.corejs, absoluteRuntime) : null),
pre(file) {
if (!useRuntimeHelpers) return;
let modulePath;
file.set("helperGenerator", name => {
var _modulePath, _ref;
(_modulePath = modulePath) != null ? _modulePath : modulePath = (0, _index.default)((_ref = moduleName != null ? moduleName : file.get("runtimeHelpersModuleName")) != null ? _ref : "@babel/runtime", dirname, absoluteRuntime);
{
if (!(file.availableHelper != null && file.availableHelper(name, runtimeVersion))) {
if (name === "regeneratorRuntime") {
return _core.types.arrowFunctionExpression([], _core.types.identifier("regeneratorRuntime"));
}
return;
}
}
const isInteropHelper = HEADER_HELPERS.indexOf(name) !== -1;
const blockHoist = isInteropHelper && !(0, _helperModuleImports.isModule)(file.path) ? 4 : undefined;
let helperPath = `${modulePath}/helpers/${esModules && file.path.node.sourceType === "module" ? "esm/" + name : name}`;
if (absoluteRuntime) helperPath = (0, _index.resolveFSPath)(helperPath);
return addDefaultImport(helperPath, name, blockHoist, true);
});
const cache = new Map();
function addDefaultImport(source, nameHint, blockHoist, isHelper = false) {
const cacheKey = (0, _helperModuleImports.isModule)(file.path);
const key = `${source}:${nameHint}:${cacheKey || ""}`;
let cached = cache.get(key);
if (cached) {
cached = _core.types.cloneNode(cached);
} else {
cached = (0, _helperModuleImports.addDefault)(file.path, source, {
importedInterop: isHelper && supportsCJSDefault ? "compiled" : "uncompiled",
nameHint,
blockHoist
});
cache.set(key, cached);
}
return cached;
}
}
};
});
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long