first commit

This commit is contained in:
monjack
2025-06-20 18:01:48 +08:00
commit 6daa6d65c1
24611 changed files with 2512443 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","ignoreList":[]}

View File

@ -0,0 +1,57 @@
;
const pluginCorejs2 = require("babel-plugin-polyfill-corejs2").default;
const pluginCorejs3 = require("babel-plugin-polyfill-corejs3").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 createCorejs3Plugin(options) {
return (api, _, filename) => pluginCorejs3(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,
moduleName
}, runtimeVersion, absoluteImports) {
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,
proposals,
[pluginsCompat]: {
useBabelRuntime: true,
runtimeVersion,
ext: "",
moduleName
}
};
return createRegeneratorPlugin(polyfillOpts, regenerator, corejsVersion === 2 ? createCorejs2Plugin(polyfillOpts) : corejsVersion === 3 ? createCorejs3Plugin(polyfillOpts) : null);
};
//# sourceMappingURL=polyfills.cjs.map

File diff suppressed because one or more lines are too long