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

31
app_vue/node_modules/babel-loader/lib/Error.js generated vendored Normal file
View File

@ -0,0 +1,31 @@
"use strict";
const STRIP_FILENAME_RE = /^[^:]+: /;
const format = err => {
if (err instanceof SyntaxError) {
err.name = "SyntaxError";
err.message = err.message.replace(STRIP_FILENAME_RE, "");
err.hideStack = true;
} else if (err instanceof TypeError) {
err.name = null;
err.message = err.message.replace(STRIP_FILENAME_RE, "");
err.hideStack = true;
}
return err;
};
class LoaderError extends Error {
constructor(err) {
super();
const {
name,
message,
codeFrame,
hideStack
} = format(err);
this.name = "BabelLoaderError";
this.message = `${name ? `${name}: ` : ""}${message}\n\n${codeFrame}\n`;
this.hideStack = hideStack;
Error.captureStackTrace(this, this.constructor);
}
}
module.exports = LoaderError;

203
app_vue/node_modules/babel-loader/lib/cache.js generated vendored Normal file
View File

@ -0,0 +1,203 @@
"use strict";
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
/**
* Filesystem Cache
*
* Given a file and a transform function, cache the result into files
* or retrieve the previously cached files if the given file is already known.
*
* @see https://github.com/babel/babel-loader/issues/34
* @see https://github.com/babel/babel-loader/pull/41
*/
const fs = require("fs");
const os = require("os");
const path = require("path");
const zlib = require("zlib");
const crypto = require("crypto");
const findCacheDir = require("find-cache-dir");
const {
promisify
} = require("util");
const transform = require("./transform");
// Lazily instantiated when needed
let defaultCacheDirectory = null;
let hashType = "sha256";
// use md5 hashing if sha256 is not available
try {
crypto.createHash(hashType);
} catch (err) {
hashType = "md5";
}
const readFile = promisify(fs.readFile);
const writeFile = promisify(fs.writeFile);
const gunzip = promisify(zlib.gunzip);
const gzip = promisify(zlib.gzip);
const makeDir = require("make-dir");
/**
* Read the contents from the compressed file.
*
* @async
* @params {String} filename
* @params {Boolean} compress
*/
const read = /*#__PURE__*/function () {
var _ref = _asyncToGenerator(function* (filename, compress) {
const data = yield readFile(filename + (compress ? ".gz" : ""));
const content = compress ? yield gunzip(data) : data;
return JSON.parse(content.toString());
});
return function read(_x, _x2) {
return _ref.apply(this, arguments);
};
}();
/**
* Write contents into a compressed file.
*
* @async
* @params {String} filename
* @params {Boolean} compress
* @params {String} result
*/
const write = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator(function* (filename, compress, result) {
const content = JSON.stringify(result);
const data = compress ? yield gzip(content) : content;
return yield writeFile(filename + (compress ? ".gz" : ""), data);
});
return function write(_x3, _x4, _x5) {
return _ref2.apply(this, arguments);
};
}();
/**
* Build the filename for the cached file
*
* @params {String} source File source code
* @params {Object} options Options used
*
* @return {String}
*/
const filename = function (source, identifier, options) {
const hash = crypto.createHash(hashType);
const contents = JSON.stringify({
source,
options,
identifier
});
hash.update(contents);
return hash.digest("hex") + ".json";
};
/**
* Handle the cache
*
* @params {String} directory
* @params {Object} params
*/
const handleCache = /*#__PURE__*/function () {
var _ref3 = _asyncToGenerator(function* (directory, params) {
const {
source,
options = {},
cacheIdentifier,
cacheDirectory,
cacheCompression,
logger
} = params;
const file = path.join(directory, filename(source, cacheIdentifier, options));
try {
// No errors mean that the file was previously cached
// we just need to return it
logger.debug(`reading cache file '${file}'`);
return yield read(file, cacheCompression);
} catch (err) {
// conitnue if cache can't be read
logger.debug(`discarded cache as it can not be read`);
}
const fallback = typeof cacheDirectory !== "string" && directory !== os.tmpdir();
// Make sure the directory exists.
try {
logger.debug(`creating cache folder '${directory}'`);
yield makeDir(directory);
} catch (err) {
if (fallback) {
return handleCache(os.tmpdir(), params);
}
throw err;
}
// Otherwise just transform the file
// return it to the user asap and write it in cache
logger.debug(`applying Babel transform`);
const result = yield transform(source, options);
// Do not cache if there are external dependencies,
// since they might change and we cannot control it.
if (!result.externalDependencies.length) {
try {
logger.debug(`writing result to cache file '${file}'`);
yield write(file, cacheCompression, result);
} catch (err) {
if (fallback) {
// Fallback to tmpdir if node_modules folder not writable
return handleCache(os.tmpdir(), params);
}
throw err;
}
}
return result;
});
return function handleCache(_x6, _x7) {
return _ref3.apply(this, arguments);
};
}();
/**
* Retrieve file from cache, or create a new one for future reads
*
* @async
* @param {Object} params
* @param {String} params.cacheDirectory Directory to store cached files
* @param {String} params.cacheIdentifier Unique identifier to bust cache
* @param {Boolean} params.cacheCompression Whether compressing cached files
* @param {String} params.source Original contents of the file to be cached
* @param {Object} params.options Options to be given to the transform fn
*
* @example
*
* const result = await cache({
* cacheDirectory: '.tmp/cache',
* cacheIdentifier: 'babel-loader-cachefile',
* cacheCompression: false,
* source: *source code from file*,
* options: {
* experimental: true,
* runtime: true
* },
* });
*/
module.exports = /*#__PURE__*/function () {
var _ref4 = _asyncToGenerator(function* (params) {
let directory;
if (typeof params.cacheDirectory === "string") {
directory = params.cacheDirectory;
} else {
if (defaultCacheDirectory === null) {
defaultCacheDirectory = findCacheDir({
name: "babel-loader"
}) || os.tmpdir();
}
directory = defaultCacheDirectory;
}
return yield handleCache(directory, params);
});
return function (_x8) {
return _ref4.apply(this, arguments);
};
}();

232
app_vue/node_modules/babel-loader/lib/index.js generated vendored Normal file
View File

@ -0,0 +1,232 @@
"use strict";
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
let babel;
try {
babel = require("@babel/core");
} catch (err) {
if (err.code === "MODULE_NOT_FOUND") {
err.message += "\n babel-loader@8 requires Babel 7.x (the package '@babel/core'). " + "If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'.";
}
throw err;
}
// Since we've got the reverse bridge package at @babel/core@6.x, give
// people useful feedback if they try to use it alongside babel-loader.
if (/^6\./.test(babel.version)) {
throw new Error("\n babel-loader@8 will not work with the '@babel/core@6' bridge package. " + "If you want to use Babel 6.x, install 'babel-loader@7'.");
}
const {
version
} = require("../package.json");
const cache = require("./cache");
const transform = require("./transform");
const injectCaller = require("./injectCaller");
const schema = require("./schema");
const {
isAbsolute
} = require("path");
const loaderUtils = require("loader-utils");
const validateOptions = require("schema-utils");
function subscribe(subscriber, metadata, context) {
if (context[subscriber]) {
context[subscriber](metadata);
}
}
module.exports = makeLoader();
module.exports.custom = makeLoader;
function makeLoader(callback) {
const overrides = callback ? callback(babel) : undefined;
return function (source, inputSourceMap) {
// Make the loader async
const callback = this.async();
loader.call(this, source, inputSourceMap, overrides).then(args => callback(null, ...args), err => callback(err));
};
}
function loader(_x, _x2, _x3) {
return _loader.apply(this, arguments);
}
function _loader() {
_loader = _asyncToGenerator(function* (source, inputSourceMap, overrides) {
const filename = this.resourcePath;
const logger = typeof this.getLogger === "function" ? this.getLogger("babel-loader") : {
debug: () => {}
};
let loaderOptions = loaderUtils.getOptions(this);
validateOptions(schema, loaderOptions, {
name: "Babel loader"
});
if (loaderOptions.customize != null) {
if (typeof loaderOptions.customize !== "string") {
throw new Error("Customized loaders must be implemented as standalone modules.");
}
if (!isAbsolute(loaderOptions.customize)) {
throw new Error("Customized loaders must be passed as absolute paths, since " + "babel-loader has no way to know what they would be relative to.");
}
if (overrides) {
throw new Error("babel-loader's 'customize' option is not available when already " + "using a customized babel-loader wrapper.");
}
logger.debug(`loading customize override: '${loaderOptions.customize}'`);
let override = require(loaderOptions.customize);
if (override.__esModule) override = override.default;
if (typeof override !== "function") {
throw new Error("Custom overrides must be functions.");
}
logger.debug("applying customize override to @babel/core");
overrides = override(babel);
}
let customOptions;
if (overrides && overrides.customOptions) {
logger.debug("applying overrides customOptions() to loader options");
const result = yield overrides.customOptions.call(this, loaderOptions, {
source,
map: inputSourceMap
});
customOptions = result.custom;
loaderOptions = result.loader;
}
// Deprecation handling
if ("forceEnv" in loaderOptions) {
console.warn("The option `forceEnv` has been removed in favor of `envName` in Babel 7.");
}
if (typeof loaderOptions.babelrc === "string") {
console.warn("The option `babelrc` should not be set to a string anymore in the babel-loader config. " + "Please update your configuration and set `babelrc` to true or false.\n" + "If you want to specify a specific babel config file to inherit config from " + "please use the `extends` option.\nFor more information about this options see " + "https://babeljs.io/docs/core-packages/#options");
}
logger.debug("normalizing loader options");
// Standardize on 'sourceMaps' as the key passed through to Webpack, so that
// users may safely use either one alongside our default use of
// 'this.sourceMap' below without getting error about conflicting aliases.
if (Object.prototype.hasOwnProperty.call(loaderOptions, "sourceMap") && !Object.prototype.hasOwnProperty.call(loaderOptions, "sourceMaps")) {
loaderOptions = Object.assign({}, loaderOptions, {
sourceMaps: loaderOptions.sourceMap
});
delete loaderOptions.sourceMap;
}
const programmaticOptions = Object.assign({}, loaderOptions, {
filename,
inputSourceMap: inputSourceMap || loaderOptions.inputSourceMap,
// Set the default sourcemap behavior based on Webpack's mapping flag,
// but allow users to override if they want.
sourceMaps: loaderOptions.sourceMaps === undefined ? this.sourceMap : loaderOptions.sourceMaps,
// Ensure that Webpack will get a full absolute path in the sourcemap
// so that it can properly map the module back to its internal cached
// modules.
sourceFileName: filename
});
// Remove loader related options
delete programmaticOptions.customize;
delete programmaticOptions.cacheDirectory;
delete programmaticOptions.cacheIdentifier;
delete programmaticOptions.cacheCompression;
delete programmaticOptions.metadataSubscribers;
if (!babel.loadPartialConfig) {
throw new Error(`babel-loader ^8.0.0-beta.3 requires @babel/core@7.0.0-beta.41, but ` + `you appear to be using "${babel.version}". Either update your ` + `@babel/core version, or pin you babel-loader version to 8.0.0-beta.2`);
}
// babel.loadPartialConfigAsync is available in v7.8.0+
const {
loadPartialConfigAsync = babel.loadPartialConfig
} = babel;
logger.debug("resolving Babel configs");
const config = yield loadPartialConfigAsync(injectCaller(programmaticOptions, this.target));
if (config) {
let options = config.options;
if (overrides && overrides.config) {
logger.debug("applying overrides config() to Babel config");
options = yield overrides.config.call(this, config, {
source,
map: inputSourceMap,
customOptions
});
}
if (options.sourceMaps === "inline") {
// Babel has this weird behavior where if you set "inline", we
// inline the sourcemap, and set 'result.map = null'. This results
// in bad behavior from Babel since the maps get put into the code,
// which Webpack does not expect, and because the map we return to
// Webpack is null, which is also bad. To avoid that, we override the
// behavior here so "inline" just behaves like 'true'.
options.sourceMaps = true;
}
const {
cacheDirectory = null,
cacheIdentifier = JSON.stringify({
options,
"@babel/core": transform.version,
"@babel/loader": version
}),
cacheCompression = true,
metadataSubscribers = []
} = loaderOptions;
let result;
if (cacheDirectory) {
logger.debug("cache is enabled");
result = yield cache({
source,
options,
transform,
cacheDirectory,
cacheIdentifier,
cacheCompression,
logger
});
} else {
logger.debug("cache is disabled, applying Babel transform");
result = yield transform(source, options);
}
// Availabe since Babel 7.12
// https://github.com/babel/babel/pull/11907
if (config.files) {
config.files.forEach(configFile => {
this.addDependency(configFile);
logger.debug(`added '${configFile}' to webpack dependencies`);
});
} else {
// .babelrc.json
if (typeof config.babelrc === "string") {
this.addDependency(config.babelrc);
logger.debug(`added '${config.babelrc}' to webpack dependencies`);
}
// babel.config.js
if (config.config) {
this.addDependency(config.config);
logger.debug(`added '${config.config}' to webpack dependencies`);
}
}
if (result) {
if (overrides && overrides.result) {
logger.debug("applying overrides result() to Babel transform results");
result = yield overrides.result.call(this, result, {
source,
map: inputSourceMap,
customOptions,
config,
options
});
}
const {
code,
map,
metadata,
externalDependencies
} = result;
externalDependencies == null ? void 0 : externalDependencies.forEach(dep => {
this.addDependency(dep);
logger.debug(`added '${dep}' to webpack dependencies`);
});
metadataSubscribers.forEach(subscriber => {
subscribe(subscriber, metadata, this);
logger.debug(`invoked metadata subscriber '${String(subscriber)}'`);
});
return [code, map];
}
}
// If the file was ignored, pass through the original content.
return [source, inputSourceMap];
});
return _loader.apply(this, arguments);
}

43
app_vue/node_modules/babel-loader/lib/injectCaller.js generated vendored Normal file
View File

@ -0,0 +1,43 @@
"use strict";
const babel = require("@babel/core");
module.exports = function injectCaller(opts, target) {
if (!supportsCallerOption()) return opts;
return Object.assign({}, opts, {
caller: Object.assign({
name: "babel-loader",
// Provide plugins with insight into webpack target.
// https://github.com/babel/babel-loader/issues/787
target,
// Webpack >= 2 supports ESM and dynamic import.
supportsStaticESM: true,
supportsDynamicImport: true,
// Webpack 5 supports TLA behind a flag. We enable it by default
// for Babel, and then webpack will throw an error if the experimental
// flag isn't enabled.
supportsTopLevelAwait: true
}, opts.caller)
});
};
// TODO: We can remove this eventually, I'm just adding it so that people have
// a little time to migrate to the newer RCs of @babel/core without getting
// hard-to-diagnose errors about unknown 'caller' options.
let supportsCallerOptionFlag = undefined;
function supportsCallerOption() {
if (supportsCallerOptionFlag === undefined) {
try {
// Rather than try to match the Babel version, we just see if it throws
// when passed a 'caller' flag, and use that to decide if it is supported.
babel.loadPartialConfig({
caller: undefined,
babelrc: false,
configFile: false
});
supportsCallerOptionFlag = true;
} catch (err) {
supportsCallerOptionFlag = false;
}
}
return supportsCallerOptionFlag;
}

28
app_vue/node_modules/babel-loader/lib/schema.json generated vendored Normal file
View File

@ -0,0 +1,28 @@
{
"type": "object",
"properties": {
"cacheDirectory": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "string"
}
],
"default": false
},
"cacheIdentifier": {
"type": "string"
},
"cacheCompression": {
"type": "boolean",
"default": true
},
"customize": {
"type": "string",
"default": null
}
},
"additionalProperties": true
}

51
app_vue/node_modules/babel-loader/lib/transform.js generated vendored Normal file
View File

@ -0,0 +1,51 @@
"use strict";
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
const babel = require("@babel/core");
const {
promisify
} = require("util");
const LoaderError = require("./Error");
const transform = promisify(babel.transform);
module.exports = /*#__PURE__*/function () {
var _ref = _asyncToGenerator(function* (source, options) {
let result;
try {
result = yield transform(source, options);
} catch (err) {
throw err.message && err.codeFrame ? new LoaderError(err) : err;
}
if (!result) return null;
// We don't return the full result here because some entries are not
// really serializable. For a full list of properties see here:
// https://github.com/babel/babel/blob/main/packages/babel-core/src/transformation/index.js
// For discussion on this topic see here:
// https://github.com/babel/babel-loader/pull/629
const {
ast,
code,
map,
metadata,
sourceType,
externalDependencies
} = result;
if (map && (!map.sourcesContent || !map.sourcesContent.length)) {
map.sourcesContent = [source];
}
return {
ast,
code,
map,
metadata,
sourceType,
// Convert it from a Set to an Array to make it JSON-serializable.
externalDependencies: Array.from(externalDependencies || [])
};
});
return function (_x, _x2) {
return _ref.apply(this, arguments);
};
}();
module.exports.version = babel.version;