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

324
app_vue/node_modules/webpack/lib/APIPlugin.js generated vendored Normal file
View File

@ -0,0 +1,324 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const InitFragment = require("./InitFragment");
const {
JAVASCRIPT_MODULE_TYPE_AUTO,
JAVASCRIPT_MODULE_TYPE_DYNAMIC,
JAVASCRIPT_MODULE_TYPE_ESM
} = require("./ModuleTypeConstants");
const RuntimeGlobals = require("./RuntimeGlobals");
const WebpackError = require("./WebpackError");
const ConstDependency = require("./dependencies/ConstDependency");
const BasicEvaluatedExpression = require("./javascript/BasicEvaluatedExpression");
const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
const {
toConstantDependency,
evaluateToString
} = require("./javascript/JavascriptParserHelpers");
const ChunkNameRuntimeModule = require("./runtime/ChunkNameRuntimeModule");
const GetFullHashRuntimeModule = require("./runtime/GetFullHashRuntimeModule");
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Module").BuildInfo} BuildInfo */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("./javascript/JavascriptParser").Range} Range */
/**
* @param {boolean | undefined} module true if ES module
* @param {string} importMetaName `import.meta` name
* @returns {Record<string, {expr: string, req: string[] | null, type?: string, assign: boolean}>} replacements
*/
function getReplacements(module, importMetaName) {
return {
__webpack_require__: {
expr: RuntimeGlobals.require,
req: [RuntimeGlobals.require],
type: "function",
assign: false
},
__webpack_public_path__: {
expr: RuntimeGlobals.publicPath,
req: [RuntimeGlobals.publicPath],
type: "string",
assign: true
},
__webpack_base_uri__: {
expr: RuntimeGlobals.baseURI,
req: [RuntimeGlobals.baseURI],
type: "string",
assign: true
},
__webpack_modules__: {
expr: RuntimeGlobals.moduleFactories,
req: [RuntimeGlobals.moduleFactories],
type: "object",
assign: false
},
__webpack_chunk_load__: {
expr: RuntimeGlobals.ensureChunk,
req: [RuntimeGlobals.ensureChunk],
type: "function",
assign: true
},
__non_webpack_require__: {
expr: module
? `__WEBPACK_EXTERNAL_createRequire(${importMetaName}.url)`
: "require",
req: null,
type: undefined, // type is not known, depends on environment
assign: true
},
__webpack_nonce__: {
expr: RuntimeGlobals.scriptNonce,
req: [RuntimeGlobals.scriptNonce],
type: "string",
assign: true
},
__webpack_hash__: {
expr: `${RuntimeGlobals.getFullHash}()`,
req: [RuntimeGlobals.getFullHash],
type: "string",
assign: false
},
__webpack_chunkname__: {
expr: RuntimeGlobals.chunkName,
req: [RuntimeGlobals.chunkName],
type: "string",
assign: false
},
__webpack_get_script_filename__: {
expr: RuntimeGlobals.getChunkScriptFilename,
req: [RuntimeGlobals.getChunkScriptFilename],
type: "function",
assign: true
},
__webpack_runtime_id__: {
expr: RuntimeGlobals.runtimeId,
req: [RuntimeGlobals.runtimeId],
assign: false
},
"require.onError": {
expr: RuntimeGlobals.uncaughtErrorHandler,
req: [RuntimeGlobals.uncaughtErrorHandler],
type: undefined, // type is not known, could be function or undefined
assign: true // is never a pattern
},
__system_context__: {
expr: RuntimeGlobals.systemContext,
req: [RuntimeGlobals.systemContext],
type: "object",
assign: false
},
__webpack_share_scopes__: {
expr: RuntimeGlobals.shareScopeMap,
req: [RuntimeGlobals.shareScopeMap],
type: "object",
assign: false
},
__webpack_init_sharing__: {
expr: RuntimeGlobals.initializeSharing,
req: [RuntimeGlobals.initializeSharing],
type: "function",
assign: true
}
};
}
const PLUGIN_NAME = "APIPlugin";
/**
* @typedef {object} APIPluginOptions
* @property {boolean=} module the output filename
*/
class APIPlugin {
/**
* @param {APIPluginOptions=} options options
*/
constructor(options = {}) {
this.options = options;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
const importMetaName = /** @type {string} */ (
compilation.outputOptions.importMetaName
);
const REPLACEMENTS = getReplacements(
this.options.module,
importMetaName
);
compilation.dependencyTemplates.set(
ConstDependency,
new ConstDependency.Template()
);
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.chunkName)
.tap(PLUGIN_NAME, chunk => {
compilation.addRuntimeModule(
chunk,
new ChunkNameRuntimeModule(/** @type {string} */ (chunk.name))
);
return true;
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.getFullHash)
.tap(PLUGIN_NAME, (chunk, set) => {
compilation.addRuntimeModule(chunk, new GetFullHashRuntimeModule());
return true;
});
const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation);
hooks.renderModuleContent.tap(
PLUGIN_NAME,
(source, module, renderContext) => {
if (/** @type {BuildInfo} */ (module.buildInfo).needCreateRequire) {
const needPrefix =
renderContext.runtimeTemplate.supportNodePrefixForCoreModules();
const chunkInitFragments = [
new InitFragment(
`import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "${
needPrefix ? "node:" : ""
}module";\n`,
InitFragment.STAGE_HARMONY_IMPORTS,
0,
"external module node-commonjs"
)
];
renderContext.chunkInitFragments.push(...chunkInitFragments);
}
return source;
}
);
/**
* @param {JavascriptParser} parser the parser
*/
const handler = parser => {
for (const key of Object.keys(REPLACEMENTS)) {
const info = REPLACEMENTS[key];
parser.hooks.expression.for(key).tap(PLUGIN_NAME, expression => {
const dep = toConstantDependency(parser, info.expr, info.req);
if (key === "__non_webpack_require__" && this.options.module) {
/** @type {BuildInfo} */
(parser.state.module.buildInfo).needCreateRequire = true;
}
return dep(expression);
});
if (info.assign === false) {
parser.hooks.assign.for(key).tap(PLUGIN_NAME, expr => {
const err = new WebpackError(`${key} must not be assigned`);
err.loc = /** @type {DependencyLocation} */ (expr.loc);
throw err;
});
}
if (info.type) {
parser.hooks.evaluateTypeof
.for(key)
.tap(PLUGIN_NAME, evaluateToString(info.type));
}
}
parser.hooks.expression
.for("__webpack_layer__")
.tap(PLUGIN_NAME, expr => {
const dep = new ConstDependency(
JSON.stringify(parser.state.module.layer),
/** @type {Range} */ (expr.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);
return true;
});
parser.hooks.evaluateIdentifier
.for("__webpack_layer__")
.tap(PLUGIN_NAME, expr =>
(parser.state.module.layer === null
? new BasicEvaluatedExpression().setNull()
: new BasicEvaluatedExpression().setString(
parser.state.module.layer
)
).setRange(/** @type {Range} */ (expr.range))
);
parser.hooks.evaluateTypeof
.for("__webpack_layer__")
.tap(PLUGIN_NAME, expr =>
new BasicEvaluatedExpression()
.setString(
parser.state.module.layer === null ? "object" : "string"
)
.setRange(/** @type {Range} */ (expr.range))
);
parser.hooks.expression
.for("__webpack_module__.id")
.tap(PLUGIN_NAME, expr => {
/** @type {BuildInfo} */
(parser.state.module.buildInfo).moduleConcatenationBailout =
"__webpack_module__.id";
const dep = new ConstDependency(
`${parser.state.module.moduleArgument}.id`,
/** @type {Range} */ (expr.range),
[RuntimeGlobals.moduleId]
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);
return true;
});
parser.hooks.expression
.for("__webpack_module__")
.tap(PLUGIN_NAME, expr => {
/** @type {BuildInfo} */
(parser.state.module.buildInfo).moduleConcatenationBailout =
"__webpack_module__";
const dep = new ConstDependency(
parser.state.module.moduleArgument,
/** @type {Range} */ (expr.range),
[RuntimeGlobals.module]
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);
return true;
});
parser.hooks.evaluateTypeof
.for("__webpack_module__")
.tap(PLUGIN_NAME, evaluateToString("object"));
};
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_AUTO)
.tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
.tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_ESM)
.tap(PLUGIN_NAME, handler);
}
);
}
}
module.exports = APIPlugin;

View File

@ -0,0 +1,54 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Ivan Kopeykin @vankop
*/
"use strict";
const WebpackError = require("./WebpackError");
const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
/**
* @param {string=} method method name
* @returns {string} message
*/
function createMessage(method) {
return `Abstract method${method ? ` ${method}` : ""}. Must be overridden.`;
}
/**
* @constructor
*/
function Message() {
/** @type {string | undefined} */
this.stack = undefined;
Error.captureStackTrace(this);
/** @type {RegExpMatchArray | null} */
const match =
/** @type {string} */
(/** @type {unknown} */ (this.stack))
.split("\n")[3]
.match(CURRENT_METHOD_REGEXP);
this.message = match && match[1] ? createMessage(match[1]) : createMessage();
}
/**
* Error for abstract method
* @example
* ```js
* class FooClass {
* abstractMethod() {
* throw new AbstractMethodError(); // error message: Abstract method FooClass.abstractMethod. Must be overridden.
* }
* }
* ```
*/
class AbstractMethodError extends WebpackError {
constructor() {
super(new Message().message);
this.name = "AbstractMethodError";
}
}
module.exports = AbstractMethodError;

View File

@ -0,0 +1,116 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const DependenciesBlock = require("./DependenciesBlock");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./ChunkGroup")} ChunkGroup */
/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */
/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {(ChunkGroupOptions & { entryOptions?: EntryOptions }) | string} GroupOptions */
class AsyncDependenciesBlock extends DependenciesBlock {
/**
* @param {GroupOptions | null} groupOptions options for the group
* @param {(DependencyLocation | null)=} loc the line of code
* @param {(string | null)=} request the request
*/
constructor(groupOptions, loc, request) {
super();
if (typeof groupOptions === "string") {
groupOptions = { name: groupOptions };
} else if (!groupOptions) {
groupOptions = { name: undefined };
}
this.groupOptions = groupOptions;
this.loc = loc;
this.request = request;
this._stringifiedGroupOptions = undefined;
}
/**
* @returns {string | null | undefined} The name of the chunk
*/
get chunkName() {
return this.groupOptions.name;
}
/**
* @param {string | undefined} value The new chunk name
* @returns {void}
*/
set chunkName(value) {
if (this.groupOptions.name !== value) {
this.groupOptions.name = value;
this._stringifiedGroupOptions = undefined;
}
}
/**
* @param {Hash} hash the hash used to track dependencies
* @param {UpdateHashContext} context context
* @returns {void}
*/
updateHash(hash, context) {
const { chunkGraph } = context;
if (this._stringifiedGroupOptions === undefined) {
this._stringifiedGroupOptions = JSON.stringify(this.groupOptions);
}
const chunkGroup = chunkGraph.getBlockChunkGroup(this);
hash.update(
`${this._stringifiedGroupOptions}${chunkGroup ? chunkGroup.id : ""}`
);
super.updateHash(hash, context);
}
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.groupOptions);
write(this.loc);
write(this.request);
super.serialize(context);
}
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.groupOptions = read();
this.loc = read();
this.request = read();
super.deserialize(context);
}
}
makeSerializable(AsyncDependenciesBlock, "webpack/lib/AsyncDependenciesBlock");
Object.defineProperty(AsyncDependenciesBlock.prototype, "module", {
get() {
throw new Error(
"module property was removed from AsyncDependenciesBlock (it's not needed)"
);
},
set() {
throw new Error(
"module property was removed from AsyncDependenciesBlock (it's not needed)"
);
}
});
module.exports = AsyncDependenciesBlock;

View File

@ -0,0 +1,31 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Sean Larkin @thelarkinn
*/
"use strict";
const WebpackError = require("./WebpackError");
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Module")} Module */
class AsyncDependencyToInitialChunkError extends WebpackError {
/**
* Creates an instance of AsyncDependencyToInitialChunkError.
* @param {string} chunkName Name of Chunk
* @param {Module} module module tied to dependency
* @param {DependencyLocation} loc location of dependency
*/
constructor(chunkName, module, loc) {
super(
`It's not allowed to load an initial chunk on demand. The chunk name "${chunkName}" is already used by an entrypoint.`
);
this.name = "AsyncDependencyToInitialChunkError";
this.module = module;
this.loc = loc;
}
}
module.exports = AsyncDependencyToInitialChunkError;

View File

@ -0,0 +1,65 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const asyncLib = require("neo-async");
const NormalModule = require("./NormalModule");
const PrefetchDependency = require("./dependencies/PrefetchDependency");
/** @typedef {import("./Compiler")} Compiler */
const PLUGIN_NAME = "AutomaticPrefetchPlugin";
class AutomaticPrefetchPlugin {
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
compilation.dependencyFactories.set(
PrefetchDependency,
normalModuleFactory
);
}
);
/** @type {{context: string | null, request: string}[] | null} */
let lastModules = null;
compiler.hooks.afterCompile.tap(PLUGIN_NAME, compilation => {
lastModules = [];
for (const m of compilation.modules) {
if (m instanceof NormalModule) {
lastModules.push({
context: m.context,
request: m.request
});
}
}
});
compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {
if (!lastModules) return callback();
asyncLib.each(
lastModules,
(m, callback) => {
compilation.addModuleChain(
m.context || compiler.context,
new PrefetchDependency(`!!${m.request}`),
callback
);
},
err => {
lastModules = null;
callback(err);
}
);
});
}
}
module.exports = AutomaticPrefetchPlugin;

135
app_vue/node_modules/webpack/lib/BannerPlugin.js generated vendored Normal file
View File

@ -0,0 +1,135 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { ConcatSource } = require("webpack-sources");
const Compilation = require("./Compilation");
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
const Template = require("./Template");
const createSchemaValidation = require("./util/create-schema-validation");
/** @typedef {import("../declarations/plugins/BannerPlugin").BannerFunction} BannerFunction */
/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginArgument} BannerPluginArgument */
/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginOptions} BannerPluginOptions */
/** @typedef {import("./Compilation").PathData} PathData */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
const validate = createSchemaValidation(
/** @type {((value: typeof import("../schemas/plugins/BannerPlugin.json")) => boolean)} */
(require("../schemas/plugins/BannerPlugin.check.js")),
() => require("../schemas/plugins/BannerPlugin.json"),
{
name: "Banner Plugin",
baseDataPath: "options"
}
);
/**
* @param {string} str string to wrap
* @returns {string} wrapped string
*/
const wrapComment = str => {
if (!str.includes("\n")) {
return Template.toComment(str);
}
return `/*!\n * ${str
.replace(/\*\//g, "* /")
.split("\n")
.join("\n * ")
.replace(/\s+\n/g, "\n")
.trimEnd()}\n */`;
};
const PLUGIN_NAME = "BannerPlugin";
class BannerPlugin {
/**
* @param {BannerPluginArgument} options options object
*/
constructor(options) {
if (typeof options === "string" || typeof options === "function") {
options = {
banner: options
};
}
validate(options);
this.options = options;
const bannerOption = options.banner;
if (typeof bannerOption === "function") {
const getBanner = bannerOption;
/** @type {BannerFunction} */
this.banner = this.options.raw
? getBanner
: /** @type {BannerFunction} */ data => wrapComment(getBanner(data));
} else {
const banner = this.options.raw
? bannerOption
: wrapComment(bannerOption);
/** @type {BannerFunction} */
this.banner = () => banner;
}
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
const options = this.options;
const banner = this.banner;
const matchObject = ModuleFilenameHelpers.matchObject.bind(
undefined,
options
);
const cache = new WeakMap();
const stage =
this.options.stage || Compilation.PROCESS_ASSETS_STAGE_ADDITIONS;
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
compilation.hooks.processAssets.tap({ name: PLUGIN_NAME, stage }, () => {
for (const chunk of compilation.chunks) {
if (options.entryOnly && !chunk.canBeInitial()) {
continue;
}
for (const file of chunk.files) {
if (!matchObject(file)) {
continue;
}
/** @type {PathData} */
const data = { chunk, filename: file };
const comment = compilation.getPath(
/** @type {TemplatePath} */
(banner),
data
);
compilation.updateAsset(file, old => {
const cached = cache.get(old);
if (!cached || cached.comment !== comment) {
const source = options.footer
? new ConcatSource(old, "\n", comment)
: new ConcatSource(comment, "\n", old);
cache.set(old, { source, comment });
return source;
}
return cached.source;
});
}
}
});
});
}
}
module.exports = BannerPlugin;

167
app_vue/node_modules/webpack/lib/Cache.js generated vendored Normal file
View File

@ -0,0 +1,167 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } = require("tapable");
const {
makeWebpackError,
makeWebpackErrorCallback
} = require("./HookWebpackError");
/** @typedef {import("./WebpackError")} WebpackError */
/**
* @typedef {object} Etag
* @property {() => string} toString
*/
/**
* @template T
* @callback CallbackCache
* @param {WebpackError | null} err
* @param {T=} result
* @returns {void}
*/
/** @typedef {EXPECTED_ANY} Data */
/**
* @callback GotHandler
* @param {TODO} result
* @param {(err?: Error) => void} callback
* @returns {void}
*/
/**
* @param {number} times times
* @param {(err?: Error) => void} callback callback
* @returns {(err?: Error) => void} callback
*/
const needCalls = (times, callback) => err => {
if (--times === 0) {
return callback(err);
}
if (err && times > 0) {
times = 0;
return callback(err);
}
};
class Cache {
constructor() {
this.hooks = {
/** @type {AsyncSeriesBailHook<[string, Etag | null, GotHandler[]], Data>} */
get: new AsyncSeriesBailHook(["identifier", "etag", "gotHandlers"]),
/** @type {AsyncParallelHook<[string, Etag | null, Data]>} */
store: new AsyncParallelHook(["identifier", "etag", "data"]),
/** @type {AsyncParallelHook<[Iterable<string>]>} */
storeBuildDependencies: new AsyncParallelHook(["dependencies"]),
/** @type {SyncHook<[]>} */
beginIdle: new SyncHook([]),
/** @type {AsyncParallelHook<[]>} */
endIdle: new AsyncParallelHook([]),
/** @type {AsyncParallelHook<[]>} */
shutdown: new AsyncParallelHook([])
};
}
/**
* @template T
* @param {string} identifier the cache identifier
* @param {Etag | null} etag the etag
* @param {CallbackCache<T>} callback signals when the value is retrieved
* @returns {void}
*/
get(identifier, etag, callback) {
/** @type {GotHandler[]} */
const gotHandlers = [];
this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, result) => {
if (err) {
callback(makeWebpackError(err, "Cache.hooks.get"));
return;
}
if (result === null) {
result = undefined;
}
if (gotHandlers.length > 1) {
const innerCallback = needCalls(gotHandlers.length, () =>
callback(null, result)
);
for (const gotHandler of gotHandlers) {
gotHandler(result, innerCallback);
}
} else if (gotHandlers.length === 1) {
gotHandlers[0](result, () => callback(null, result));
} else {
callback(null, result);
}
});
}
/**
* @template T
* @param {string} identifier the cache identifier
* @param {Etag | null} etag the etag
* @param {T} data the value to store
* @param {CallbackCache<void>} callback signals when the value is stored
* @returns {void}
*/
store(identifier, etag, data, callback) {
this.hooks.store.callAsync(
identifier,
etag,
data,
makeWebpackErrorCallback(callback, "Cache.hooks.store")
);
}
/**
* After this method has succeeded the cache can only be restored when build dependencies are
* @param {Iterable<string>} dependencies list of all build dependencies
* @param {CallbackCache<void>} callback signals when the dependencies are stored
* @returns {void}
*/
storeBuildDependencies(dependencies, callback) {
this.hooks.storeBuildDependencies.callAsync(
dependencies,
makeWebpackErrorCallback(callback, "Cache.hooks.storeBuildDependencies")
);
}
/**
* @returns {void}
*/
beginIdle() {
this.hooks.beginIdle.call();
}
/**
* @param {CallbackCache<void>} callback signals when the call finishes
* @returns {void}
*/
endIdle(callback) {
this.hooks.endIdle.callAsync(
makeWebpackErrorCallback(callback, "Cache.hooks.endIdle")
);
}
/**
* @param {CallbackCache<void>} callback signals when the call finishes
* @returns {void}
*/
shutdown(callback) {
this.hooks.shutdown.callAsync(
makeWebpackErrorCallback(callback, "Cache.hooks.shutdown")
);
}
}
Cache.STAGE_MEMORY = -10;
Cache.STAGE_DEFAULT = 0;
Cache.STAGE_DISK = 10;
Cache.STAGE_NETWORK = 20;
module.exports = Cache;

350
app_vue/node_modules/webpack/lib/CacheFacade.js generated vendored Normal file
View File

@ -0,0 +1,350 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { forEachBail } = require("enhanced-resolve");
const asyncLib = require("neo-async");
const getLazyHashedEtag = require("./cache/getLazyHashedEtag");
const mergeEtags = require("./cache/mergeEtags");
/** @typedef {import("./Cache")} Cache */
/** @typedef {import("./Cache").Etag} Etag */
/** @typedef {import("./WebpackError")} WebpackError */
/** @typedef {import("./cache/getLazyHashedEtag").HashableObject} HashableObject */
/** @typedef {typeof import("./util/Hash")} HashConstructor */
/**
* @template T
* @callback CallbackCache
* @param {(Error | null)=} err
* @param {(T | null)=} result
* @returns {void}
*/
/**
* @template T
* @callback CallbackNormalErrorCache
* @param {(Error | null)=} err
* @param {T=} result
* @returns {void}
*/
class MultiItemCache {
/**
* @param {ItemCacheFacade[]} items item caches
*/
constructor(items) {
this._items = items;
// @ts-expect-error expected - returns the single ItemCacheFacade when passed an array of length 1
// eslint-disable-next-line no-constructor-return
if (items.length === 1) return /** @type {ItemCacheFacade} */ (items[0]);
}
/**
* @template T
* @param {CallbackCache<T>} callback signals when the value is retrieved
* @returns {void}
*/
get(callback) {
forEachBail(this._items, (item, callback) => item.get(callback), callback);
}
/**
* @template T
* @returns {Promise<T>} promise with the data
*/
getPromise() {
/**
* @param {number} i index
* @returns {Promise<T>} promise with the data
*/
const next = i =>
this._items[i].getPromise().then(result => {
if (result !== undefined) return result;
if (++i < this._items.length) return next(i);
});
return next(0);
}
/**
* @template T
* @param {T} data the value to store
* @param {CallbackCache<void>} callback signals when the value is stored
* @returns {void}
*/
store(data, callback) {
asyncLib.each(
this._items,
(item, callback) => item.store(data, callback),
callback
);
}
/**
* @template T
* @param {T} data the value to store
* @returns {Promise<void>} promise signals when the value is stored
*/
storePromise(data) {
return Promise.all(this._items.map(item => item.storePromise(data))).then(
() => {}
);
}
}
class ItemCacheFacade {
/**
* @param {Cache} cache the root cache
* @param {string} name the child cache item name
* @param {Etag | null} etag the etag
*/
constructor(cache, name, etag) {
this._cache = cache;
this._name = name;
this._etag = etag;
}
/**
* @template T
* @param {CallbackCache<T>} callback signals when the value is retrieved
* @returns {void}
*/
get(callback) {
this._cache.get(this._name, this._etag, callback);
}
/**
* @template T
* @returns {Promise<T>} promise with the data
*/
getPromise() {
return new Promise((resolve, reject) => {
this._cache.get(this._name, this._etag, (err, data) => {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
}
/**
* @template T
* @param {T} data the value to store
* @param {CallbackCache<void>} callback signals when the value is stored
* @returns {void}
*/
store(data, callback) {
this._cache.store(this._name, this._etag, data, callback);
}
/**
* @template T
* @param {T} data the value to store
* @returns {Promise<void>} promise signals when the value is stored
*/
storePromise(data) {
return new Promise((resolve, reject) => {
this._cache.store(this._name, this._etag, data, err => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
}
/**
* @template T
* @param {(callback: CallbackNormalErrorCache<T>) => void} computer function to compute the value if not cached
* @param {CallbackNormalErrorCache<T>} callback signals when the value is retrieved
* @returns {void}
*/
provide(computer, callback) {
this.get((err, cacheEntry) => {
if (err) return callback(err);
if (cacheEntry !== undefined) return cacheEntry;
computer((err, result) => {
if (err) return callback(err);
this.store(result, err => {
if (err) return callback(err);
callback(null, result);
});
});
});
}
/**
* @template T
* @param {() => Promise<T> | T} computer function to compute the value if not cached
* @returns {Promise<T>} promise with the data
*/
async providePromise(computer) {
const cacheEntry = await this.getPromise();
if (cacheEntry !== undefined) return cacheEntry;
const result = await computer();
await this.storePromise(result);
return result;
}
}
class CacheFacade {
/**
* @param {Cache} cache the root cache
* @param {string} name the child cache name
* @param {(string | HashConstructor)=} hashFunction the hash function to use
*/
constructor(cache, name, hashFunction) {
this._cache = cache;
this._name = name;
this._hashFunction = hashFunction;
}
/**
* @param {string} name the child cache name#
* @returns {CacheFacade} child cache
*/
getChildCache(name) {
return new CacheFacade(
this._cache,
`${this._name}|${name}`,
this._hashFunction
);
}
/**
* @param {string} identifier the cache identifier
* @param {Etag | null} etag the etag
* @returns {ItemCacheFacade} item cache
*/
getItemCache(identifier, etag) {
return new ItemCacheFacade(
this._cache,
`${this._name}|${identifier}`,
etag
);
}
/**
* @param {HashableObject} obj an hashable object
* @returns {Etag} an etag that is lazy hashed
*/
getLazyHashedEtag(obj) {
return getLazyHashedEtag(obj, this._hashFunction);
}
/**
* @param {Etag} a an etag
* @param {Etag} b another etag
* @returns {Etag} an etag that represents both
*/
mergeEtags(a, b) {
return mergeEtags(a, b);
}
/**
* @template T
* @param {string} identifier the cache identifier
* @param {Etag | null} etag the etag
* @param {CallbackCache<T>} callback signals when the value is retrieved
* @returns {void}
*/
get(identifier, etag, callback) {
this._cache.get(`${this._name}|${identifier}`, etag, callback);
}
/**
* @template T
* @param {string} identifier the cache identifier
* @param {Etag | null} etag the etag
* @returns {Promise<T>} promise with the data
*/
getPromise(identifier, etag) {
return new Promise((resolve, reject) => {
this._cache.get(`${this._name}|${identifier}`, etag, (err, data) => {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
}
/**
* @template T
* @param {string} identifier the cache identifier
* @param {Etag | null} etag the etag
* @param {T} data the value to store
* @param {CallbackCache<void>} callback signals when the value is stored
* @returns {void}
*/
store(identifier, etag, data, callback) {
this._cache.store(`${this._name}|${identifier}`, etag, data, callback);
}
/**
* @template T
* @param {string} identifier the cache identifier
* @param {Etag | null} etag the etag
* @param {T} data the value to store
* @returns {Promise<void>} promise signals when the value is stored
*/
storePromise(identifier, etag, data) {
return new Promise((resolve, reject) => {
this._cache.store(`${this._name}|${identifier}`, etag, data, err => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
}
/**
* @template T
* @param {string} identifier the cache identifier
* @param {Etag | null} etag the etag
* @param {(callback: CallbackNormalErrorCache<T>) => void} computer function to compute the value if not cached
* @param {CallbackNormalErrorCache<T>} callback signals when the value is retrieved
* @returns {void}
*/
provide(identifier, etag, computer, callback) {
this.get(identifier, etag, (err, cacheEntry) => {
if (err) return callback(err);
if (cacheEntry !== undefined) return cacheEntry;
computer((err, result) => {
if (err) return callback(err);
this.store(identifier, etag, result, err => {
if (err) return callback(err);
callback(null, result);
});
});
});
}
/**
* @template T
* @param {string} identifier the cache identifier
* @param {Etag | null} etag the etag
* @param {() => Promise<T> | T} computer function to compute the value if not cached
* @returns {Promise<T>} promise with the data
*/
async providePromise(identifier, etag, computer) {
const cacheEntry = await this.getPromise(identifier, etag);
if (cacheEntry !== undefined) return cacheEntry;
const result = await computer();
await this.storePromise(identifier, etag, result);
return result;
}
}
module.exports = CacheFacade;
module.exports.ItemCacheFacade = ItemCacheFacade;
module.exports.MultiItemCache = MultiItemCache;

View File

@ -0,0 +1,71 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ModuleGraph")} ModuleGraph */
/**
* @param {Module[]} modules the modules to be sorted
* @returns {Module[]} sorted version of original modules
*/
const sortModules = modules =>
modules.sort((a, b) => {
const aIdent = a.identifier();
const bIdent = b.identifier();
/* istanbul ignore next */
if (aIdent < bIdent) return -1;
/* istanbul ignore next */
if (aIdent > bIdent) return 1;
/* istanbul ignore next */
return 0;
});
/**
* @param {Module[]} modules each module from throw
* @param {ModuleGraph} moduleGraph the module graph
* @returns {string} each message from provided modules
*/
const createModulesListMessage = (modules, moduleGraph) =>
modules
.map(m => {
let message = `* ${m.identifier()}`;
const validReasons = Array.from(
moduleGraph.getIncomingConnectionsByOriginModule(m).keys()
).filter(Boolean);
if (validReasons.length > 0) {
message += `\n Used by ${validReasons.length} module(s), i. e.`;
message += `\n ${
/** @type {Module[]} */ (validReasons)[0].identifier()
}`;
}
return message;
})
.join("\n");
class CaseSensitiveModulesWarning extends WebpackError {
/**
* Creates an instance of CaseSensitiveModulesWarning.
* @param {Iterable<Module>} modules modules that were detected
* @param {ModuleGraph} moduleGraph the module graph
*/
constructor(modules, moduleGraph) {
const sortedModules = sortModules(Array.from(modules));
const modulesList = createModulesListMessage(sortedModules, moduleGraph);
super(`There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
${modulesList}`);
this.name = "CaseSensitiveModulesWarning";
this.module = sortedModules[0];
}
}
module.exports = CaseSensitiveModulesWarning;

877
app_vue/node_modules/webpack/lib/Chunk.js generated vendored Normal file
View File

@ -0,0 +1,877 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const ChunkGraph = require("./ChunkGraph");
const Entrypoint = require("./Entrypoint");
const { intersect } = require("./util/SetHelpers");
const SortableSet = require("./util/SortableSet");
const StringXor = require("./util/StringXor");
const {
compareModulesByIdentifier,
compareChunkGroupsByIndex,
compareModulesById
} = require("./util/comparators");
const { createArrayToSetDeprecationSet } = require("./util/deprecation");
const { mergeRuntime } = require("./util/runtime");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./ChunkGraph").ChunkFilterPredicate} ChunkFilterPredicate */
/** @typedef {import("./ChunkGraph").ChunkSizeOptions} ChunkSizeOptions */
/** @typedef {import("./ChunkGraph").ModuleFilterPredicate} ModuleFilterPredicate */
/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
/** @typedef {import("./ChunkGroup")} ChunkGroup */
/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */
/** @typedef {import("./Compilation")} Compilation */
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ModuleGraph")} ModuleGraph */
/** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/** @typedef {string | null} ChunkName */
/** @typedef {number | string} ChunkId */
/** @typedef {SortableSet<string>} IdNameHints */
const ChunkFilesSet = createArrayToSetDeprecationSet("chunk.files");
/**
* @typedef {object} WithId an object who has an id property *
* @property {string | number} id the id of the object
*/
/**
* @deprecated
* @typedef {object} ChunkMaps
* @property {Record<string | number, string>} hash
* @property {Record<string | number, Record<string, string>>} contentHash
* @property {Record<string | number, string>} name
*/
/**
* @deprecated
* @typedef {object} ChunkModuleMaps
* @property {Record<string|number, (string|number)[]>} id
* @property {Record<string|number, string>} hash
*/
let debugId = 1000;
/**
* A Chunk is a unit of encapsulation for Modules.
* Chunks are "rendered" into bundles that get emitted when the build completes.
*/
class Chunk {
/**
* @param {ChunkName=} name of chunk being created, is optional (for subclasses)
* @param {boolean} backCompat enable backward-compatibility
*/
constructor(name, backCompat = true) {
/** @type {ChunkId | null} */
this.id = null;
/** @type {ChunkId[] | null} */
this.ids = null;
/** @type {number} */
this.debugId = debugId++;
/** @type {ChunkName | undefined} */
this.name = name;
/** @type {IdNameHints} */
this.idNameHints = new SortableSet();
/** @type {boolean} */
this.preventIntegration = false;
/** @type {TemplatePath | undefined} */
this.filenameTemplate = undefined;
/** @type {TemplatePath | undefined} */
this.cssFilenameTemplate = undefined;
/**
* @private
* @type {SortableSet<ChunkGroup>}
*/
this._groups = new SortableSet(undefined, compareChunkGroupsByIndex);
/** @type {RuntimeSpec} */
this.runtime = undefined;
/** @type {Set<string>} */
this.files = backCompat ? new ChunkFilesSet() : new Set();
/** @type {Set<string>} */
this.auxiliaryFiles = new Set();
/** @type {boolean} */
this.rendered = false;
/** @type {string=} */
this.hash = undefined;
/** @type {Record<string, string>} */
this.contentHash = Object.create(null);
/** @type {string=} */
this.renderedHash = undefined;
/** @type {string=} */
this.chunkReason = undefined;
/** @type {boolean} */
this.extraAsync = false;
}
// TODO remove in webpack 6
// BACKWARD-COMPAT START
get entryModule() {
const entryModules = Array.from(
ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.entryModule",
"DEP_WEBPACK_CHUNK_ENTRY_MODULE"
).getChunkEntryModulesIterable(this)
);
if (entryModules.length === 0) {
return undefined;
} else if (entryModules.length === 1) {
return entryModules[0];
}
throw new Error(
"Module.entryModule: Multiple entry modules are not supported by the deprecated API (Use the new ChunkGroup API)"
);
}
/**
* @returns {boolean} true, if the chunk contains an entry module
*/
hasEntryModule() {
return (
ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.hasEntryModule",
"DEP_WEBPACK_CHUNK_HAS_ENTRY_MODULE"
).getNumberOfEntryModules(this) > 0
);
}
/**
* @param {Module} module the module
* @returns {boolean} true, if the chunk could be added
*/
addModule(module) {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.addModule",
"DEP_WEBPACK_CHUNK_ADD_MODULE"
);
if (chunkGraph.isModuleInChunk(module, this)) return false;
chunkGraph.connectChunkAndModule(this, module);
return true;
}
/**
* @param {Module} module the module
* @returns {void}
*/
removeModule(module) {
ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.removeModule",
"DEP_WEBPACK_CHUNK_REMOVE_MODULE"
).disconnectChunkAndModule(this, module);
}
/**
* @returns {number} the number of module which are contained in this chunk
*/
getNumberOfModules() {
return ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.getNumberOfModules",
"DEP_WEBPACK_CHUNK_GET_NUMBER_OF_MODULES"
).getNumberOfChunkModules(this);
}
get modulesIterable() {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.modulesIterable",
"DEP_WEBPACK_CHUNK_MODULES_ITERABLE"
);
return chunkGraph.getOrderedChunkModulesIterable(
this,
compareModulesByIdentifier
);
}
/**
* @param {Chunk} otherChunk the chunk to compare with
* @returns {-1|0|1} the comparison result
*/
compareTo(otherChunk) {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.compareTo",
"DEP_WEBPACK_CHUNK_COMPARE_TO"
);
return chunkGraph.compareChunks(this, otherChunk);
}
/**
* @param {Module} module the module
* @returns {boolean} true, if the chunk contains the module
*/
containsModule(module) {
return ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.containsModule",
"DEP_WEBPACK_CHUNK_CONTAINS_MODULE"
).isModuleInChunk(module, this);
}
/**
* @returns {Module[]} the modules for this chunk
*/
getModules() {
return ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.getModules",
"DEP_WEBPACK_CHUNK_GET_MODULES"
).getChunkModules(this);
}
/**
* @returns {void}
*/
remove() {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.remove",
"DEP_WEBPACK_CHUNK_REMOVE"
);
chunkGraph.disconnectChunk(this);
this.disconnectFromGroups();
}
/**
* @param {Module} module the module
* @param {Chunk} otherChunk the target chunk
* @returns {void}
*/
moveModule(module, otherChunk) {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.moveModule",
"DEP_WEBPACK_CHUNK_MOVE_MODULE"
);
chunkGraph.disconnectChunkAndModule(this, module);
chunkGraph.connectChunkAndModule(otherChunk, module);
}
/**
* @param {Chunk} otherChunk the other chunk
* @returns {boolean} true, if the specified chunk has been integrated
*/
integrate(otherChunk) {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.integrate",
"DEP_WEBPACK_CHUNK_INTEGRATE"
);
if (chunkGraph.canChunksBeIntegrated(this, otherChunk)) {
chunkGraph.integrateChunks(this, otherChunk);
return true;
}
return false;
}
/**
* @param {Chunk} otherChunk the other chunk
* @returns {boolean} true, if chunks could be integrated
*/
canBeIntegrated(otherChunk) {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.canBeIntegrated",
"DEP_WEBPACK_CHUNK_CAN_BE_INTEGRATED"
);
return chunkGraph.canChunksBeIntegrated(this, otherChunk);
}
/**
* @returns {boolean} true, if this chunk contains no module
*/
isEmpty() {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.isEmpty",
"DEP_WEBPACK_CHUNK_IS_EMPTY"
);
return chunkGraph.getNumberOfChunkModules(this) === 0;
}
/**
* @returns {number} total size of all modules in this chunk
*/
modulesSize() {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.modulesSize",
"DEP_WEBPACK_CHUNK_MODULES_SIZE"
);
return chunkGraph.getChunkModulesSize(this);
}
/**
* @param {ChunkSizeOptions} options options object
* @returns {number} total size of this chunk
*/
size(options = {}) {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.size",
"DEP_WEBPACK_CHUNK_SIZE"
);
return chunkGraph.getChunkSize(this, options);
}
/**
* @param {Chunk} otherChunk the other chunk
* @param {ChunkSizeOptions} options options object
* @returns {number} total size of the chunk or false if the chunk can't be integrated
*/
integratedSize(otherChunk, options) {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.integratedSize",
"DEP_WEBPACK_CHUNK_INTEGRATED_SIZE"
);
return chunkGraph.getIntegratedChunksSize(this, otherChunk, options);
}
/**
* @param {ModuleFilterPredicate} filterFn function used to filter modules
* @returns {ChunkModuleMaps} module map information
*/
getChunkModuleMaps(filterFn) {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.getChunkModuleMaps",
"DEP_WEBPACK_CHUNK_GET_CHUNK_MODULE_MAPS"
);
/** @type {Record<string|number, (string|number)[]>} */
const chunkModuleIdMap = Object.create(null);
/** @type {Record<string|number, string>} */
const chunkModuleHashMap = Object.create(null);
for (const asyncChunk of this.getAllAsyncChunks()) {
/** @type {ChunkId[] | undefined} */
let array;
for (const module of chunkGraph.getOrderedChunkModulesIterable(
asyncChunk,
compareModulesById(chunkGraph)
)) {
if (filterFn(module)) {
if (array === undefined) {
array = [];
chunkModuleIdMap[/** @type {ChunkId} */ (asyncChunk.id)] = array;
}
const moduleId =
/** @type {ModuleId} */
(chunkGraph.getModuleId(module));
array.push(moduleId);
chunkModuleHashMap[moduleId] = chunkGraph.getRenderedModuleHash(
module,
undefined
);
}
}
}
return {
id: chunkModuleIdMap,
hash: chunkModuleHashMap
};
}
/**
* @param {ModuleFilterPredicate} filterFn predicate function used to filter modules
* @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks
* @returns {boolean} return true if module exists in graph
*/
hasModuleInGraph(filterFn, filterChunkFn) {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
"Chunk.hasModuleInGraph",
"DEP_WEBPACK_CHUNK_HAS_MODULE_IN_GRAPH"
);
return chunkGraph.hasModuleInGraph(this, filterFn, filterChunkFn);
}
/**
* @deprecated
* @param {boolean} realHash whether the full hash or the rendered hash is to be used
* @returns {ChunkMaps} the chunk map information
*/
getChunkMaps(realHash) {
/** @type {Record<string|number, string>} */
const chunkHashMap = Object.create(null);
/** @type {Record<string|number, Record<string, string>>} */
const chunkContentHashMap = Object.create(null);
/** @type {Record<string|number, string>} */
const chunkNameMap = Object.create(null);
for (const chunk of this.getAllAsyncChunks()) {
const id = /** @type {ChunkId} */ (chunk.id);
chunkHashMap[id] =
/** @type {string} */
(realHash ? chunk.hash : chunk.renderedHash);
for (const key of Object.keys(chunk.contentHash)) {
if (!chunkContentHashMap[key]) {
chunkContentHashMap[key] = Object.create(null);
}
chunkContentHashMap[key][id] = chunk.contentHash[key];
}
if (chunk.name) {
chunkNameMap[id] = chunk.name;
}
}
return {
hash: chunkHashMap,
contentHash: chunkContentHashMap,
name: chunkNameMap
};
}
// BACKWARD-COMPAT END
/**
* @returns {boolean} whether or not the Chunk will have a runtime
*/
hasRuntime() {
for (const chunkGroup of this._groups) {
if (
chunkGroup instanceof Entrypoint &&
chunkGroup.getRuntimeChunk() === this
) {
return true;
}
}
return false;
}
/**
* @returns {boolean} whether or not this chunk can be an initial chunk
*/
canBeInitial() {
for (const chunkGroup of this._groups) {
if (chunkGroup.isInitial()) return true;
}
return false;
}
/**
* @returns {boolean} whether this chunk can only be an initial chunk
*/
isOnlyInitial() {
if (this._groups.size <= 0) return false;
for (const chunkGroup of this._groups) {
if (!chunkGroup.isInitial()) return false;
}
return true;
}
/**
* @returns {EntryOptions | undefined} the entry options for this chunk
*/
getEntryOptions() {
for (const chunkGroup of this._groups) {
if (chunkGroup instanceof Entrypoint) {
return chunkGroup.options;
}
}
return undefined;
}
/**
* @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being added
* @returns {void}
*/
addGroup(chunkGroup) {
this._groups.add(chunkGroup);
}
/**
* @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being removed from
* @returns {void}
*/
removeGroup(chunkGroup) {
this._groups.delete(chunkGroup);
}
/**
* @param {ChunkGroup} chunkGroup the chunkGroup to check
* @returns {boolean} returns true if chunk has chunkGroup reference and exists in chunkGroup
*/
isInGroup(chunkGroup) {
return this._groups.has(chunkGroup);
}
/**
* @returns {number} the amount of groups that the said chunk is in
*/
getNumberOfGroups() {
return this._groups.size;
}
/**
* @returns {SortableSet<ChunkGroup>} the chunkGroups that the said chunk is referenced in
*/
get groupsIterable() {
this._groups.sort();
return this._groups;
}
/**
* @returns {void}
*/
disconnectFromGroups() {
for (const chunkGroup of this._groups) {
chunkGroup.removeChunk(this);
}
}
/**
* @param {Chunk} newChunk the new chunk that will be split out of
* @returns {void}
*/
split(newChunk) {
for (const chunkGroup of this._groups) {
chunkGroup.insertChunk(newChunk, this);
newChunk.addGroup(chunkGroup);
}
for (const idHint of this.idNameHints) {
newChunk.idNameHints.add(idHint);
}
newChunk.runtime = mergeRuntime(newChunk.runtime, this.runtime);
}
/**
* @param {Hash} hash hash (will be modified)
* @param {ChunkGraph} chunkGraph the chunk graph
* @returns {void}
*/
updateHash(hash, chunkGraph) {
hash.update(
`${this.id} ${this.ids ? this.ids.join() : ""} ${this.name || ""} `
);
const xor = new StringXor();
for (const m of chunkGraph.getChunkModulesIterable(this)) {
xor.add(chunkGraph.getModuleHash(m, this.runtime));
}
xor.updateHash(hash);
const entryModules =
chunkGraph.getChunkEntryModulesWithChunkGroupIterable(this);
for (const [m, chunkGroup] of entryModules) {
hash.update(
`entry${chunkGraph.getModuleId(m)}${
/** @type {ChunkGroup} */ (chunkGroup).id
}`
);
}
}
/**
* @returns {Set<Chunk>} a set of all the async chunks
*/
getAllAsyncChunks() {
const queue = new Set();
const chunks = new Set();
const initialChunks = intersect(
Array.from(this.groupsIterable, g => new Set(g.chunks))
);
const initialQueue = new Set(this.groupsIterable);
for (const chunkGroup of initialQueue) {
for (const child of chunkGroup.childrenIterable) {
if (child instanceof Entrypoint) {
initialQueue.add(child);
} else {
queue.add(child);
}
}
}
for (const chunkGroup of queue) {
for (const chunk of chunkGroup.chunks) {
if (!initialChunks.has(chunk)) {
chunks.add(chunk);
}
}
for (const child of chunkGroup.childrenIterable) {
queue.add(child);
}
}
return chunks;
}
/**
* @returns {Set<Chunk>} a set of all the initial chunks (including itself)
*/
getAllInitialChunks() {
const chunks = new Set();
const queue = new Set(this.groupsIterable);
for (const group of queue) {
if (group.isInitial()) {
for (const c of group.chunks) chunks.add(c);
for (const g of group.childrenIterable) queue.add(g);
}
}
return chunks;
}
/**
* @returns {Set<Chunk>} a set of all the referenced chunks (including itself)
*/
getAllReferencedChunks() {
const queue = new Set(this.groupsIterable);
const chunks = new Set();
for (const chunkGroup of queue) {
for (const chunk of chunkGroup.chunks) {
chunks.add(chunk);
}
for (const child of chunkGroup.childrenIterable) {
queue.add(child);
}
}
return chunks;
}
/**
* @returns {Set<Entrypoint>} a set of all the referenced entrypoints
*/
getAllReferencedAsyncEntrypoints() {
const queue = new Set(this.groupsIterable);
const entrypoints = new Set();
for (const chunkGroup of queue) {
for (const entrypoint of chunkGroup.asyncEntrypointsIterable) {
entrypoints.add(entrypoint);
}
for (const child of chunkGroup.childrenIterable) {
queue.add(child);
}
}
return entrypoints;
}
/**
* @returns {boolean} true, if the chunk references async chunks
*/
hasAsyncChunks() {
const queue = new Set();
const initialChunks = intersect(
Array.from(this.groupsIterable, g => new Set(g.chunks))
);
for (const chunkGroup of this.groupsIterable) {
for (const child of chunkGroup.childrenIterable) {
queue.add(child);
}
}
for (const chunkGroup of queue) {
for (const chunk of chunkGroup.chunks) {
if (!initialChunks.has(chunk)) {
return true;
}
}
for (const child of chunkGroup.childrenIterable) {
queue.add(child);
}
}
return false;
}
/**
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {ChunkFilterPredicate=} filterFn function used to filter chunks
* @returns {Record<string, ChunkId[]>} a record object of names to lists of child ids(?)
*/
getChildIdsByOrders(chunkGraph, filterFn) {
/** @type {Map<string, {order: number, group: ChunkGroup}[]>} */
const lists = new Map();
for (const group of this.groupsIterable) {
if (group.chunks[group.chunks.length - 1] === this) {
for (const childGroup of group.childrenIterable) {
for (const key of Object.keys(childGroup.options)) {
if (key.endsWith("Order")) {
const name = key.slice(0, key.length - "Order".length);
let list = lists.get(name);
if (list === undefined) {
list = [];
lists.set(name, list);
}
list.push({
order:
/** @type {number} */
(
childGroup.options[
/** @type {keyof ChunkGroupOptions} */
(key)
]
),
group: childGroup
});
}
}
}
}
}
/** @type {Record<string, (string | number)[]>} */
const result = Object.create(null);
for (const [name, list] of lists) {
list.sort((a, b) => {
const cmp = b.order - a.order;
if (cmp !== 0) return cmp;
return a.group.compareTo(chunkGraph, b.group);
});
/** @type {Set<ChunkId>} */
const chunkIdSet = new Set();
for (const item of list) {
for (const chunk of item.group.chunks) {
if (filterFn && !filterFn(chunk, chunkGraph)) continue;
chunkIdSet.add(/** @type {ChunkId} */ (chunk.id));
}
}
if (chunkIdSet.size > 0) {
result[name] = Array.from(chunkIdSet);
}
}
return result;
}
/**
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {string} type option name
* @returns {{ onChunks: Chunk[], chunks: Set<Chunk> }[] | undefined} referenced chunks for a specific type
*/
getChildrenOfTypeInOrder(chunkGraph, type) {
const list = [];
for (const group of this.groupsIterable) {
for (const childGroup of group.childrenIterable) {
const order =
childGroup.options[/** @type {keyof ChunkGroupOptions} */ (type)];
if (order === undefined) continue;
list.push({
order,
group,
childGroup
});
}
}
if (list.length === 0) return;
list.sort((a, b) => {
const cmp =
/** @type {number} */ (b.order) - /** @type {number} */ (a.order);
if (cmp !== 0) return cmp;
return a.group.compareTo(chunkGraph, b.group);
});
const result = [];
let lastEntry;
for (const { group, childGroup } of list) {
if (lastEntry && lastEntry.onChunks === group.chunks) {
for (const chunk of childGroup.chunks) {
lastEntry.chunks.add(chunk);
}
} else {
result.push(
(lastEntry = {
onChunks: group.chunks,
chunks: new Set(childGroup.chunks)
})
);
}
}
return result;
}
/**
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {boolean=} includeDirectChildren include direct children (by default only children of async children are included)
* @param {ChunkFilterPredicate=} filterFn function used to filter chunks
* @returns {Record<string|number, Record<string, (string | number)[]>>} a record object of names to lists of child ids(?) by chunk id
*/
getChildIdsByOrdersMap(chunkGraph, includeDirectChildren, filterFn) {
/** @type {Record<string|number, Record<string, (string | number)[]>>} */
const chunkMaps = Object.create(null);
/**
* @param {Chunk} chunk a chunk
* @returns {void}
*/
const addChildIdsByOrdersToMap = chunk => {
const data = chunk.getChildIdsByOrders(chunkGraph, filterFn);
for (const key of Object.keys(data)) {
let chunkMap = chunkMaps[key];
if (chunkMap === undefined) {
chunkMaps[key] = chunkMap = Object.create(null);
}
chunkMap[/** @type {ChunkId} */ (chunk.id)] = data[key];
}
};
if (includeDirectChildren) {
/** @type {Set<Chunk>} */
const chunks = new Set();
for (const chunkGroup of this.groupsIterable) {
for (const chunk of chunkGroup.chunks) {
chunks.add(chunk);
}
}
for (const chunk of chunks) {
addChildIdsByOrdersToMap(chunk);
}
}
for (const chunk of this.getAllAsyncChunks()) {
addChildIdsByOrdersToMap(chunk);
}
return chunkMaps;
}
/**
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {string} type option name
* @param {boolean=} includeDirectChildren include direct children (by default only children of async children are included)
* @param {ChunkFilterPredicate=} filterFn function used to filter chunks
* @returns {boolean} true when the child is of type order, otherwise false
*/
hasChildByOrder(chunkGraph, type, includeDirectChildren, filterFn) {
if (includeDirectChildren) {
/** @type {Set<Chunk>} */
const chunks = new Set();
for (const chunkGroup of this.groupsIterable) {
for (const chunk of chunkGroup.chunks) {
chunks.add(chunk);
}
}
for (const chunk of chunks) {
const data = chunk.getChildIdsByOrders(chunkGraph, filterFn);
if (data[type] !== undefined) return true;
}
}
for (const chunk of this.getAllAsyncChunks()) {
const data = chunk.getChildIdsByOrders(chunkGraph, filterFn);
if (data[type] !== undefined) return true;
}
return false;
}
}
module.exports = Chunk;

1872
app_vue/node_modules/webpack/lib/ChunkGraph.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

611
app_vue/node_modules/webpack/lib/ChunkGroup.js generated vendored Normal file
View File

@ -0,0 +1,611 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const util = require("util");
const SortableSet = require("./util/SortableSet");
const {
compareLocations,
compareChunks,
compareIterables
} = require("./util/comparators");
/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Entrypoint")} Entrypoint */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ModuleGraph")} ModuleGraph */
/** @typedef {{id: number}} HasId */
/** @typedef {{module: Module | null, loc: DependencyLocation, request: string}} OriginRecord */
/**
* @typedef {object} RawChunkGroupOptions
* @property {number=} preloadOrder
* @property {number=} prefetchOrder
* @property {("low" | "high" | "auto")=} fetchPriority
*/
/** @typedef {RawChunkGroupOptions & { name?: string | null }} ChunkGroupOptions */
let debugId = 5000;
/**
* @template T
* @param {SortableSet<T>} set set to convert to array.
* @returns {T[]} the array format of existing set
*/
const getArray = set => Array.from(set);
/**
* A convenience method used to sort chunks based on their id's
* @param {ChunkGroup} a first sorting comparator
* @param {ChunkGroup} b second sorting comparator
* @returns {1|0|-1} a sorting index to determine order
*/
const sortById = (a, b) => {
if (a.id < b.id) return -1;
if (b.id < a.id) return 1;
return 0;
};
/**
* @param {OriginRecord} a the first comparator in sort
* @param {OriginRecord} b the second comparator in sort
* @returns {1|-1|0} returns sorting order as index
*/
const sortOrigin = (a, b) => {
const aIdent = a.module ? a.module.identifier() : "";
const bIdent = b.module ? b.module.identifier() : "";
if (aIdent < bIdent) return -1;
if (aIdent > bIdent) return 1;
return compareLocations(a.loc, b.loc);
};
class ChunkGroup {
/**
* Creates an instance of ChunkGroup.
* @param {string | ChunkGroupOptions=} options chunk group options passed to chunkGroup
*/
constructor(options) {
if (typeof options === "string") {
options = { name: options };
} else if (!options) {
options = { name: undefined };
}
/** @type {number} */
this.groupDebugId = debugId++;
this.options = /** @type {ChunkGroupOptions} */ (options);
/** @type {SortableSet<ChunkGroup>} */
this._children = new SortableSet(undefined, sortById);
/** @type {SortableSet<ChunkGroup>} */
this._parents = new SortableSet(undefined, sortById);
/** @type {SortableSet<ChunkGroup>} */
this._asyncEntrypoints = new SortableSet(undefined, sortById);
this._blocks = new SortableSet();
/** @type {Chunk[]} */
this.chunks = [];
/** @type {OriginRecord[]} */
this.origins = [];
/** Indices in top-down order */
/**
* @private
* @type {Map<Module, number>}
*/
this._modulePreOrderIndices = new Map();
/** Indices in bottom-up order */
/**
* @private
* @type {Map<Module, number>}
*/
this._modulePostOrderIndices = new Map();
/** @type {number | undefined} */
this.index = undefined;
}
/**
* when a new chunk is added to a chunkGroup, addingOptions will occur.
* @param {ChunkGroupOptions} options the chunkGroup options passed to addOptions
* @returns {void}
*/
addOptions(options) {
for (const _key of Object.keys(options)) {
const key =
/** @type {keyof ChunkGroupOptions} */
(_key);
if (this.options[key] === undefined) {
/** @type {EXPECTED_ANY} */
(this.options)[key] = options[key];
} else if (this.options[key] !== options[key]) {
if (key.endsWith("Order")) {
const orderKey =
/** @type {Exclude<keyof ChunkGroupOptions, "name" | "fetchPriority">} */
(key);
this.options[orderKey] = Math.max(
/** @type {number} */
(this.options[orderKey]),
/** @type {number} */
(options[orderKey])
);
} else {
throw new Error(
`ChunkGroup.addOptions: No option merge strategy for ${key}`
);
}
}
}
}
/**
* returns the name of current ChunkGroup
* @returns {string | null | undefined} returns the ChunkGroup name
*/
get name() {
return this.options.name;
}
/**
* sets a new name for current ChunkGroup
* @param {string | undefined} value the new name for ChunkGroup
* @returns {void}
*/
set name(value) {
this.options.name = value;
}
/* istanbul ignore next */
/**
* get a uniqueId for ChunkGroup, made up of its member Chunk debugId's
* @returns {string} a unique concatenation of chunk debugId's
*/
get debugId() {
return Array.from(this.chunks, x => x.debugId).join("+");
}
/**
* get a unique id for ChunkGroup, made up of its member Chunk id's
* @returns {string} a unique concatenation of chunk ids
*/
get id() {
return Array.from(this.chunks, x => x.id).join("+");
}
/**
* Performs an unshift of a specific chunk
* @param {Chunk} chunk chunk being unshifted
* @returns {boolean} returns true if attempted chunk shift is accepted
*/
unshiftChunk(chunk) {
const oldIdx = this.chunks.indexOf(chunk);
if (oldIdx > 0) {
this.chunks.splice(oldIdx, 1);
this.chunks.unshift(chunk);
} else if (oldIdx < 0) {
this.chunks.unshift(chunk);
return true;
}
return false;
}
/**
* inserts a chunk before another existing chunk in group
* @param {Chunk} chunk Chunk being inserted
* @param {Chunk} before Placeholder/target chunk marking new chunk insertion point
* @returns {boolean} return true if insertion was successful
*/
insertChunk(chunk, before) {
const oldIdx = this.chunks.indexOf(chunk);
const idx = this.chunks.indexOf(before);
if (idx < 0) {
throw new Error("before chunk not found");
}
if (oldIdx >= 0 && oldIdx > idx) {
this.chunks.splice(oldIdx, 1);
this.chunks.splice(idx, 0, chunk);
} else if (oldIdx < 0) {
this.chunks.splice(idx, 0, chunk);
return true;
}
return false;
}
/**
* add a chunk into ChunkGroup. Is pushed on or prepended
* @param {Chunk} chunk chunk being pushed into ChunkGroupS
* @returns {boolean} returns true if chunk addition was successful.
*/
pushChunk(chunk) {
const oldIdx = this.chunks.indexOf(chunk);
if (oldIdx >= 0) {
return false;
}
this.chunks.push(chunk);
return true;
}
/**
* @param {Chunk} oldChunk chunk to be replaced
* @param {Chunk} newChunk New chunk that will be replaced with
* @returns {boolean | undefined} returns true if the replacement was successful
*/
replaceChunk(oldChunk, newChunk) {
const oldIdx = this.chunks.indexOf(oldChunk);
if (oldIdx < 0) return false;
const newIdx = this.chunks.indexOf(newChunk);
if (newIdx < 0) {
this.chunks[oldIdx] = newChunk;
return true;
}
if (newIdx < oldIdx) {
this.chunks.splice(oldIdx, 1);
return true;
} else if (newIdx !== oldIdx) {
this.chunks[oldIdx] = newChunk;
this.chunks.splice(newIdx, 1);
return true;
}
}
/**
* @param {Chunk} chunk chunk to remove
* @returns {boolean} returns true if chunk was removed
*/
removeChunk(chunk) {
const idx = this.chunks.indexOf(chunk);
if (idx >= 0) {
this.chunks.splice(idx, 1);
return true;
}
return false;
}
/**
* @returns {boolean} true, when this chunk group will be loaded on initial page load
*/
isInitial() {
return false;
}
/**
* @param {ChunkGroup} group chunk group to add
* @returns {boolean} returns true if chunk group was added
*/
addChild(group) {
const size = this._children.size;
this._children.add(group);
return size !== this._children.size;
}
/**
* @returns {ChunkGroup[]} returns the children of this group
*/
getChildren() {
return this._children.getFromCache(getArray);
}
getNumberOfChildren() {
return this._children.size;
}
get childrenIterable() {
return this._children;
}
/**
* @param {ChunkGroup} group the chunk group to remove
* @returns {boolean} returns true if the chunk group was removed
*/
removeChild(group) {
if (!this._children.has(group)) {
return false;
}
this._children.delete(group);
group.removeParent(this);
return true;
}
/**
* @param {ChunkGroup} parentChunk the parent group to be added into
* @returns {boolean} returns true if this chunk group was added to the parent group
*/
addParent(parentChunk) {
if (!this._parents.has(parentChunk)) {
this._parents.add(parentChunk);
return true;
}
return false;
}
/**
* @returns {ChunkGroup[]} returns the parents of this group
*/
getParents() {
return this._parents.getFromCache(getArray);
}
getNumberOfParents() {
return this._parents.size;
}
/**
* @param {ChunkGroup} parent the parent group
* @returns {boolean} returns true if the parent group contains this group
*/
hasParent(parent) {
return this._parents.has(parent);
}
get parentsIterable() {
return this._parents;
}
/**
* @param {ChunkGroup} chunkGroup the parent group
* @returns {boolean} returns true if this group has been removed from the parent
*/
removeParent(chunkGroup) {
if (this._parents.delete(chunkGroup)) {
chunkGroup.removeChild(this);
return true;
}
return false;
}
/**
* @param {Entrypoint} entrypoint entrypoint to add
* @returns {boolean} returns true if entrypoint was added
*/
addAsyncEntrypoint(entrypoint) {
const size = this._asyncEntrypoints.size;
this._asyncEntrypoints.add(entrypoint);
return size !== this._asyncEntrypoints.size;
}
get asyncEntrypointsIterable() {
return this._asyncEntrypoints;
}
/**
* @returns {Array<AsyncDependenciesBlock>} an array containing the blocks
*/
getBlocks() {
return this._blocks.getFromCache(getArray);
}
getNumberOfBlocks() {
return this._blocks.size;
}
/**
* @param {AsyncDependenciesBlock} block block
* @returns {boolean} true, if block exists
*/
hasBlock(block) {
return this._blocks.has(block);
}
/**
* @returns {Iterable<AsyncDependenciesBlock>} blocks
*/
get blocksIterable() {
return this._blocks;
}
/**
* @param {AsyncDependenciesBlock} block a block
* @returns {boolean} false, if block was already added
*/
addBlock(block) {
if (!this._blocks.has(block)) {
this._blocks.add(block);
return true;
}
return false;
}
/**
* @param {Module | null} module origin module
* @param {DependencyLocation} loc location of the reference in the origin module
* @param {string} request request name of the reference
* @returns {void}
*/
addOrigin(module, loc, request) {
this.origins.push({
module,
loc,
request
});
}
/**
* @returns {string[]} the files contained this chunk group
*/
getFiles() {
const files = new Set();
for (const chunk of this.chunks) {
for (const file of chunk.files) {
files.add(file);
}
}
return Array.from(files);
}
/**
* @returns {void}
*/
remove() {
// cleanup parents
for (const parentChunkGroup of this._parents) {
// remove this chunk from its parents
parentChunkGroup._children.delete(this);
// cleanup "sub chunks"
for (const chunkGroup of this._children) {
/**
* remove this chunk as "intermediary" and connect
* it "sub chunks" and parents directly
*/
// add parent to each "sub chunk"
chunkGroup.addParent(parentChunkGroup);
// add "sub chunk" to parent
parentChunkGroup.addChild(chunkGroup);
}
}
/**
* we need to iterate again over the children
* to remove this from the child's parents.
* This can not be done in the above loop
* as it is not guaranteed that `this._parents` contains anything.
*/
for (const chunkGroup of this._children) {
// remove this as parent of every "sub chunk"
chunkGroup._parents.delete(this);
}
// remove chunks
for (const chunk of this.chunks) {
chunk.removeGroup(this);
}
}
sortItems() {
this.origins.sort(sortOrigin);
}
/**
* Sorting predicate which allows current ChunkGroup to be compared against another.
* Sorting values are based off of number of chunks in ChunkGroup.
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {ChunkGroup} otherGroup the chunkGroup to compare this against
* @returns {-1|0|1} sort position for comparison
*/
compareTo(chunkGraph, otherGroup) {
if (this.chunks.length > otherGroup.chunks.length) return -1;
if (this.chunks.length < otherGroup.chunks.length) return 1;
return compareIterables(compareChunks(chunkGraph))(
this.chunks,
otherGroup.chunks
);
}
/**
* @param {ModuleGraph} moduleGraph the module graph
* @param {ChunkGraph} chunkGraph the chunk graph
* @returns {Record<string, ChunkGroup[]>} mapping from children type to ordered list of ChunkGroups
*/
getChildrenByOrders(moduleGraph, chunkGraph) {
/** @type {Map<string, {order: number, group: ChunkGroup}[]>} */
const lists = new Map();
for (const childGroup of this._children) {
for (const key of Object.keys(childGroup.options)) {
if (key.endsWith("Order")) {
const name = key.slice(0, key.length - "Order".length);
let list = lists.get(name);
if (list === undefined) {
lists.set(name, (list = []));
}
list.push({
order:
/** @type {number} */
(
childGroup.options[/** @type {keyof ChunkGroupOptions} */ (key)]
),
group: childGroup
});
}
}
}
/** @type {Record<string, ChunkGroup[]>} */
const result = Object.create(null);
for (const [name, list] of lists) {
list.sort((a, b) => {
const cmp = b.order - a.order;
if (cmp !== 0) return cmp;
return a.group.compareTo(chunkGraph, b.group);
});
result[name] = list.map(i => i.group);
}
return result;
}
/**
* Sets the top-down index of a module in this ChunkGroup
* @param {Module} module module for which the index should be set
* @param {number} index the index of the module
* @returns {void}
*/
setModulePreOrderIndex(module, index) {
this._modulePreOrderIndices.set(module, index);
}
/**
* Gets the top-down index of a module in this ChunkGroup
* @param {Module} module the module
* @returns {number | undefined} index
*/
getModulePreOrderIndex(module) {
return this._modulePreOrderIndices.get(module);
}
/**
* Sets the bottom-up index of a module in this ChunkGroup
* @param {Module} module module for which the index should be set
* @param {number} index the index of the module
* @returns {void}
*/
setModulePostOrderIndex(module, index) {
this._modulePostOrderIndices.set(module, index);
}
/**
* Gets the bottom-up index of a module in this ChunkGroup
* @param {Module} module the module
* @returns {number | undefined} index
*/
getModulePostOrderIndex(module) {
return this._modulePostOrderIndices.get(module);
}
/* istanbul ignore next */
checkConstraints() {
const chunk = this;
for (const child of chunk._children) {
if (!child._parents.has(chunk)) {
throw new Error(
`checkConstraints: child missing parent ${chunk.debugId} -> ${child.debugId}`
);
}
}
for (const parentChunk of chunk._parents) {
if (!parentChunk._children.has(chunk)) {
throw new Error(
`checkConstraints: parent missing child ${parentChunk.debugId} <- ${chunk.debugId}`
);
}
}
}
}
ChunkGroup.prototype.getModuleIndex = util.deprecate(
ChunkGroup.prototype.getModulePreOrderIndex,
"ChunkGroup.getModuleIndex was renamed to getModulePreOrderIndex",
"DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX"
);
ChunkGroup.prototype.getModuleIndex2 = util.deprecate(
ChunkGroup.prototype.getModulePostOrderIndex,
"ChunkGroup.getModuleIndex2 was renamed to getModulePostOrderIndex",
"DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX_2"
);
module.exports = ChunkGroup;

31
app_vue/node_modules/webpack/lib/ChunkRenderError.js generated vendored Normal file
View File

@ -0,0 +1,31 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
/** @typedef {import("./Chunk")} Chunk */
class ChunkRenderError extends WebpackError {
/**
* Create a new ChunkRenderError
* @param {Chunk} chunk A chunk
* @param {string} file Related file
* @param {Error} error Original error
*/
constructor(chunk, file, error) {
super();
this.name = "ChunkRenderError";
this.error = error;
this.message = error.message;
this.details = error.stack;
this.file = file;
this.chunk = chunk;
}
}
module.exports = ChunkRenderError;

181
app_vue/node_modules/webpack/lib/ChunkTemplate.js generated vendored Normal file
View File

@ -0,0 +1,181 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const util = require("util");
const memoize = require("./util/memoize");
/** @typedef {import("tapable").Tap} Tap */
/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */
/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./Compilation")} Compilation */
/** @typedef {import("./Compilation").ChunkHashContext} ChunkHashContext */
/** @typedef {import("./Compilation").Hash} Hash */
/** @typedef {import("./Compilation").RenderManifestEntry} RenderManifestEntry */
/** @typedef {import("./Compilation").RenderManifestOptions} RenderManifestOptions */
/** @typedef {import("./Compilation").Source} Source */
/** @typedef {import("./ModuleTemplate")} ModuleTemplate */
/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext */
/**
* @template T
* @typedef {import("tapable").IfSet<T>} IfSet
*/
const getJavascriptModulesPlugin = memoize(() =>
require("./javascript/JavascriptModulesPlugin")
);
// TODO webpack 6 remove this class
class ChunkTemplate {
/**
* @param {OutputOptions} outputOptions output options
* @param {Compilation} compilation the compilation
*/
constructor(outputOptions, compilation) {
this._outputOptions = outputOptions || {};
this.hooks = Object.freeze({
renderManifest: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(renderManifestEntries: RenderManifestEntry[], renderManifestOptions: RenderManifestOptions) => RenderManifestEntry[]} fn function
*/
(options, fn) => {
compilation.hooks.renderManifest.tap(
options,
(entries, options) => {
if (options.chunk.hasRuntime()) return entries;
return fn(entries, options);
}
);
},
"ChunkTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)",
"DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_MANIFEST"
)
},
modules: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(source: Source, moduleTemplate: ModuleTemplate, renderContext: RenderContext) => Source} fn function
*/
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.renderChunk.tap(options, (source, renderContext) =>
fn(
source,
compilation.moduleTemplates.javascript,
renderContext
)
);
},
"ChunkTemplate.hooks.modules is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderChunk instead)",
"DEP_WEBPACK_CHUNK_TEMPLATE_MODULES"
)
},
render: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(source: Source, moduleTemplate: ModuleTemplate, renderContext: RenderContext) => Source} fn function
*/
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.renderChunk.tap(options, (source, renderContext) =>
fn(
source,
compilation.moduleTemplates.javascript,
renderContext
)
);
},
"ChunkTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderChunk instead)",
"DEP_WEBPACK_CHUNK_TEMPLATE_RENDER"
)
},
renderWithEntry: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(source: Source, chunk: Chunk) => Source} fn function
*/
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.render.tap(options, (source, renderContext) => {
if (
renderContext.chunkGraph.getNumberOfEntryModules(
renderContext.chunk
) === 0 ||
renderContext.chunk.hasRuntime()
) {
return source;
}
return fn(source, renderContext.chunk);
});
},
"ChunkTemplate.hooks.renderWithEntry is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)",
"DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_WITH_ENTRY"
)
},
hash: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(hash: Hash) => void} fn function
*/
(options, fn) => {
compilation.hooks.fullHash.tap(options, fn);
},
"ChunkTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)",
"DEP_WEBPACK_CHUNK_TEMPLATE_HASH"
)
},
hashForChunk: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(hash: Hash, chunk: Chunk, chunkHashContext: ChunkHashContext) => void} fn function
*/
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.chunkHash.tap(options, (chunk, hash, context) => {
if (chunk.hasRuntime()) return;
fn(hash, chunk, context);
});
},
"ChunkTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)",
"DEP_WEBPACK_CHUNK_TEMPLATE_HASH_FOR_CHUNK"
)
}
});
}
}
Object.defineProperty(ChunkTemplate.prototype, "outputOptions", {
get: util.deprecate(
/**
* @this {ChunkTemplate}
* @returns {OutputOptions} output options
*/
function () {
return this._outputOptions;
},
"ChunkTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)",
"DEP_WEBPACK_CHUNK_TEMPLATE_OUTPUT_OPTIONS"
)
});
module.exports = ChunkTemplate;

445
app_vue/node_modules/webpack/lib/CleanPlugin.js generated vendored Normal file
View File

@ -0,0 +1,445 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Sergey Melyukov @smelukov
*/
"use strict";
const asyncLib = require("neo-async");
const { SyncBailHook } = require("tapable");
const Compilation = require("./Compilation");
const createSchemaValidation = require("./util/create-schema-validation");
const { join } = require("./util/fs");
const processAsyncTree = require("./util/processAsyncTree");
/** @typedef {import("../declarations/WebpackOptions").CleanOptions} CleanOptions */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./logging/Logger").Logger} Logger */
/** @typedef {import("./util/fs").IStats} IStats */
/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */
/** @typedef {import("./util/fs").StatsCallback} StatsCallback */
/** @typedef {Map<string, number>} Assets */
/**
* @typedef {object} CleanPluginCompilationHooks
* @property {SyncBailHook<[string], boolean | void>} keep when returning true the file/directory will be kept during cleaning, returning false will clean it and ignore the following plugins and config
*/
/**
* @callback KeepFn
* @param {string} path path
* @returns {boolean | void} true, if the path should be kept
*/
const validate = createSchemaValidation(
undefined,
() => {
const { definitions } = require("../schemas/WebpackOptions.json");
return {
definitions,
oneOf: [{ $ref: "#/definitions/CleanOptions" }]
};
},
{
name: "Clean Plugin",
baseDataPath: "options"
}
);
const _10sec = 10 * 1000;
/**
* merge assets map 2 into map 1
* @param {Assets} as1 assets
* @param {Assets} as2 assets
* @returns {void}
*/
const mergeAssets = (as1, as2) => {
for (const [key, value1] of as2) {
const value2 = as1.get(key);
if (!value2 || value1 > value2) as1.set(key, value1);
}
};
/** @typedef {Set<string>} Diff */
/**
* @param {OutputFileSystem} fs filesystem
* @param {string} outputPath output path
* @param {Map<string, number>} currentAssets filename of the current assets (must not start with .. or ., must only use / as path separator)
* @param {(err?: Error | null, set?: Diff) => void} callback returns the filenames of the assets that shouldn't be there
* @returns {void}
*/
const getDiffToFs = (fs, outputPath, currentAssets, callback) => {
const directories = new Set();
// get directories of assets
for (const [asset] of currentAssets) {
directories.add(asset.replace(/(^|\/)[^/]*$/, ""));
}
// and all parent directories
for (const directory of directories) {
directories.add(directory.replace(/(^|\/)[^/]*$/, ""));
}
const diff = new Set();
asyncLib.forEachLimit(
directories,
10,
(directory, callback) => {
/** @type {NonNullable<OutputFileSystem["readdir"]>} */
(fs.readdir)(join(fs, outputPath, directory), (err, entries) => {
if (err) {
if (err.code === "ENOENT") return callback();
if (err.code === "ENOTDIR") {
diff.add(directory);
return callback();
}
return callback(err);
}
for (const entry of /** @type {string[]} */ (entries)) {
const file = entry;
const filename = directory ? `${directory}/${file}` : file;
if (!directories.has(filename) && !currentAssets.has(filename)) {
diff.add(filename);
}
}
callback();
});
},
err => {
if (err) return callback(err);
callback(null, diff);
}
);
};
/**
* @param {Assets} currentAssets assets list
* @param {Assets} oldAssets old assets list
* @returns {Diff} diff
*/
const getDiffToOldAssets = (currentAssets, oldAssets) => {
const diff = new Set();
const now = Date.now();
for (const [asset, ts] of oldAssets) {
if (ts >= now) continue;
if (!currentAssets.has(asset)) diff.add(asset);
}
return diff;
};
/**
* @param {OutputFileSystem} fs filesystem
* @param {string} filename path to file
* @param {StatsCallback} callback callback for provided filename
* @returns {void}
*/
const doStat = (fs, filename, callback) => {
if ("lstat" in fs) {
/** @type {NonNullable<OutputFileSystem["lstat"]>} */
(fs.lstat)(filename, callback);
} else {
fs.stat(filename, callback);
}
};
/**
* @param {OutputFileSystem} fs filesystem
* @param {string} outputPath output path
* @param {boolean} dry only log instead of fs modification
* @param {Logger} logger logger
* @param {Diff} diff filenames of the assets that shouldn't be there
* @param {(path: string) => boolean | void} isKept check if the entry is ignored
* @param {(err?: Error, assets?: Assets) => void} callback callback
* @returns {void}
*/
const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
/**
* @param {string} msg message
*/
const log = msg => {
if (dry) {
logger.info(msg);
} else {
logger.log(msg);
}
};
/** @typedef {{ type: "check" | "unlink" | "rmdir", filename: string, parent: { remaining: number, job: Job } | undefined }} Job */
/** @type {Job[]} */
const jobs = Array.from(diff.keys(), filename => ({
type: "check",
filename,
parent: undefined
}));
/** @type {Assets} */
const keptAssets = new Map();
processAsyncTree(
jobs,
10,
({ type, filename, parent }, push, callback) => {
/**
* @param {Error & { code?: string }} err error
* @returns {void}
*/
const handleError = err => {
if (err.code === "ENOENT") {
log(`${filename} was removed during cleaning by something else`);
handleParent();
return callback();
}
return callback(err);
};
const handleParent = () => {
if (parent && --parent.remaining === 0) push(parent.job);
};
const path = join(fs, outputPath, filename);
switch (type) {
case "check":
if (isKept(filename)) {
keptAssets.set(filename, 0);
// do not decrement parent entry as we don't want to delete the parent
log(`${filename} will be kept`);
return process.nextTick(callback);
}
doStat(fs, path, (err, stats) => {
if (err) return handleError(err);
if (!(/** @type {IStats} */ (stats).isDirectory())) {
push({
type: "unlink",
filename,
parent
});
return callback();
}
/** @type {NonNullable<OutputFileSystem["readdir"]>} */
(fs.readdir)(path, (err, _entries) => {
if (err) return handleError(err);
/** @type {Job} */
const deleteJob = {
type: "rmdir",
filename,
parent
};
const entries = /** @type {string[]} */ (_entries);
if (entries.length === 0) {
push(deleteJob);
} else {
const parentToken = {
remaining: entries.length,
job: deleteJob
};
for (const entry of entries) {
const file = /** @type {string} */ (entry);
if (file.startsWith(".")) {
log(
`${filename} will be kept (dot-files will never be removed)`
);
continue;
}
push({
type: "check",
filename: `${filename}/${file}`,
parent: parentToken
});
}
}
return callback();
});
});
break;
case "rmdir":
log(`${filename} will be removed`);
if (dry) {
handleParent();
return process.nextTick(callback);
}
if (!fs.rmdir) {
logger.warn(
`${filename} can't be removed because output file system doesn't support removing directories (rmdir)`
);
return process.nextTick(callback);
}
fs.rmdir(path, err => {
if (err) return handleError(err);
handleParent();
callback();
});
break;
case "unlink":
log(`${filename} will be removed`);
if (dry) {
handleParent();
return process.nextTick(callback);
}
if (!fs.unlink) {
logger.warn(
`${filename} can't be removed because output file system doesn't support removing files (rmdir)`
);
return process.nextTick(callback);
}
fs.unlink(path, err => {
if (err) return handleError(err);
handleParent();
callback();
});
break;
}
},
err => {
if (err) return callback(err);
callback(undefined, keptAssets);
}
);
};
/** @type {WeakMap<Compilation, CleanPluginCompilationHooks>} */
const compilationHooksMap = new WeakMap();
const PLUGIN_NAME = "CleanPlugin";
class CleanPlugin {
/**
* @param {Compilation} compilation the compilation
* @returns {CleanPluginCompilationHooks} the attached hooks
*/
static getCompilationHooks(compilation) {
if (!(compilation instanceof Compilation)) {
throw new TypeError(
"The 'compilation' argument must be an instance of Compilation"
);
}
let hooks = compilationHooksMap.get(compilation);
if (hooks === undefined) {
hooks = {
keep: new SyncBailHook(["ignore"])
};
compilationHooksMap.set(compilation, hooks);
}
return hooks;
}
/** @param {CleanOptions} options options */
constructor(options = {}) {
validate(options);
this.options = { dry: false, ...options };
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
const { dry, keep } = this.options;
/** @type {KeepFn} */
const keepFn =
typeof keep === "function"
? keep
: typeof keep === "string"
? path => path.startsWith(keep)
: typeof keep === "object" && keep.test
? path => keep.test(path)
: () => false;
// We assume that no external modification happens while the compiler is active
// So we can store the old assets and only diff to them to avoid fs access on
// incremental builds
/** @type {undefined|Assets} */
let oldAssets;
compiler.hooks.emit.tapAsync(
{
name: PLUGIN_NAME,
stage: 100
},
(compilation, callback) => {
const hooks = CleanPlugin.getCompilationHooks(compilation);
const logger = compilation.getLogger(`webpack.${PLUGIN_NAME}`);
const fs = /** @type {OutputFileSystem} */ (compiler.outputFileSystem);
if (!fs.readdir) {
return callback(
new Error(
`${PLUGIN_NAME}: Output filesystem doesn't support listing directories (readdir)`
)
);
}
/** @type {Assets} */
const currentAssets = new Map();
const now = Date.now();
for (const asset of Object.keys(compilation.assets)) {
if (/^[A-Za-z]:\\|^\/|^\\\\/.test(asset)) continue;
let normalizedAsset;
let newNormalizedAsset = asset.replace(/\\/g, "/");
do {
normalizedAsset = newNormalizedAsset;
newNormalizedAsset = normalizedAsset.replace(
/(^|\/)(?!\.\.)[^/]+\/\.\.\//g,
"$1"
);
} while (newNormalizedAsset !== normalizedAsset);
if (normalizedAsset.startsWith("../")) continue;
const assetInfo = compilation.assetsInfo.get(asset);
if (assetInfo && assetInfo.hotModuleReplacement) {
currentAssets.set(normalizedAsset, now + _10sec);
} else {
currentAssets.set(normalizedAsset, 0);
}
}
const outputPath = compilation.getPath(compiler.outputPath, {});
/**
* @param {string} path path
* @returns {boolean | void} true, if needs to be kept
*/
const isKept = path => {
const result = hooks.keep.call(path);
if (result !== undefined) return result;
return keepFn(path);
};
/**
* @param {(Error | null)=} err err
* @param {Diff=} diff diff
*/
const diffCallback = (err, diff) => {
if (err) {
oldAssets = undefined;
callback(err);
return;
}
applyDiff(
fs,
outputPath,
dry,
logger,
/** @type {Diff} */ (diff),
isKept,
(err, keptAssets) => {
if (err) {
oldAssets = undefined;
} else {
if (oldAssets) mergeAssets(currentAssets, oldAssets);
oldAssets = currentAssets;
if (keptAssets) mergeAssets(oldAssets, keptAssets);
}
callback(err);
}
);
};
if (oldAssets) {
diffCallback(null, getDiffToOldAssets(currentAssets, oldAssets));
} else {
getDiffToFs(fs, outputPath, currentAssets, diffCallback);
}
}
);
}
}
module.exports = CleanPlugin;

View File

@ -0,0 +1,29 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
/** @typedef {import("./Module")} Module */
class CodeGenerationError extends WebpackError {
/**
* Create a new CodeGenerationError
* @param {Module} module related module
* @param {Error} error Original error
*/
constructor(module, error) {
super();
this.name = "CodeGenerationError";
this.error = error;
this.message = error.message;
this.details = error.stack;
this.module = module;
}
}
module.exports = CodeGenerationError;

View File

@ -0,0 +1,158 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { DEFAULTS } = require("./config/defaults");
const { getOrInsert } = require("./util/MapHelpers");
const { first } = require("./util/SetHelpers");
const createHash = require("./util/createHash");
const { runtimeToString, RuntimeSpecMap } = require("./util/runtime");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */
/** @typedef {import("./Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */
/** @typedef {typeof import("./util/Hash")} Hash */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
class CodeGenerationResults {
/**
* @param {string | Hash} hashFunction the hash function to use
*/
constructor(hashFunction = DEFAULTS.HASH_FUNCTION) {
/** @type {Map<Module, RuntimeSpecMap<CodeGenerationResult>>} */
this.map = new Map();
this._hashFunction = hashFunction;
}
/**
* @param {Module} module the module
* @param {RuntimeSpec} runtime runtime(s)
* @returns {CodeGenerationResult} the CodeGenerationResult
*/
get(module, runtime) {
const entry = this.map.get(module);
if (entry === undefined) {
throw new Error(
`No code generation entry for ${module.identifier()} (existing entries: ${Array.from(
this.map.keys(),
m => m.identifier()
).join(", ")})`
);
}
if (runtime === undefined) {
if (entry.size > 1) {
const results = new Set(entry.values());
if (results.size !== 1) {
throw new Error(
`No unique code generation entry for unspecified runtime for ${module.identifier()} (existing runtimes: ${Array.from(
entry.keys(),
r => runtimeToString(r)
).join(", ")}).
Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").`
);
}
return /** @type {CodeGenerationResult} */ (first(results));
}
return /** @type {CodeGenerationResult} */ (entry.values().next().value);
}
const result = entry.get(runtime);
if (result === undefined) {
throw new Error(
`No code generation entry for runtime ${runtimeToString(
runtime
)} for ${module.identifier()} (existing runtimes: ${Array.from(
entry.keys(),
r => runtimeToString(r)
).join(", ")})`
);
}
return result;
}
/**
* @param {Module} module the module
* @param {RuntimeSpec} runtime runtime(s)
* @returns {boolean} true, when we have data for this
*/
has(module, runtime) {
const entry = this.map.get(module);
if (entry === undefined) {
return false;
}
if (runtime !== undefined) {
return entry.has(runtime);
} else if (entry.size > 1) {
const results = new Set(entry.values());
return results.size === 1;
}
return entry.size === 1;
}
/**
* @param {Module} module the module
* @param {RuntimeSpec} runtime runtime(s)
* @param {string} sourceType the source type
* @returns {Source} a source
*/
getSource(module, runtime, sourceType) {
return /** @type {Source} */ (
this.get(module, runtime).sources.get(sourceType)
);
}
/**
* @param {Module} module the module
* @param {RuntimeSpec} runtime runtime(s)
* @returns {ReadOnlyRuntimeRequirements | null} runtime requirements
*/
getRuntimeRequirements(module, runtime) {
return this.get(module, runtime).runtimeRequirements;
}
/**
* @param {Module} module the module
* @param {RuntimeSpec} runtime runtime(s)
* @param {string} key data key
* @returns {TODO | undefined} data generated by code generation
*/
getData(module, runtime, key) {
const data = this.get(module, runtime).data;
return data === undefined ? undefined : data.get(key);
}
/**
* @param {Module} module the module
* @param {RuntimeSpec} runtime runtime(s)
* @returns {string} hash of the code generation
*/
getHash(module, runtime) {
const info = this.get(module, runtime);
if (info.hash !== undefined) return info.hash;
const hash = createHash(this._hashFunction);
for (const [type, source] of info.sources) {
hash.update(type);
source.updateHash(hash);
}
if (info.runtimeRequirements) {
for (const rr of info.runtimeRequirements) hash.update(rr);
}
return (info.hash = /** @type {string} */ (hash.digest("hex")));
}
/**
* @param {Module} module the module
* @param {RuntimeSpec} runtime runtime(s)
* @param {CodeGenerationResult} result result from module
* @returns {void}
*/
add(module, runtime, result) {
const map = getOrInsert(this.map, module, () => new RuntimeSpecMap());
map.set(runtime, result);
}
}
module.exports = CodeGenerationResults;

View File

@ -0,0 +1,32 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
class CommentCompilationWarning extends WebpackError {
/**
* @param {string} message warning message
* @param {DependencyLocation} loc affected lines of code
*/
constructor(message, loc) {
super(message);
this.name = "CommentCompilationWarning";
this.loc = loc;
}
}
makeSerializable(
CommentCompilationWarning,
"webpack/lib/CommentCompilationWarning"
);
module.exports = CommentCompilationWarning;

194
app_vue/node_modules/webpack/lib/CompatibilityPlugin.js generated vendored Normal file
View File

@ -0,0 +1,194 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const {
JAVASCRIPT_MODULE_TYPE_AUTO,
JAVASCRIPT_MODULE_TYPE_DYNAMIC,
JAVASCRIPT_MODULE_TYPE_ESM
} = require("./ModuleTypeConstants");
const RuntimeGlobals = require("./RuntimeGlobals");
const ConstDependency = require("./dependencies/ConstDependency");
/** @typedef {import("estree").CallExpression} CallExpression */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("./javascript/JavascriptParser").Range} Range */
/** @typedef {import("./javascript/JavascriptParser").TagData} TagData */
const nestedWebpackIdentifierTag = Symbol("nested webpack identifier");
const PLUGIN_NAME = "CompatibilityPlugin";
class CompatibilityPlugin {
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
compilation.dependencyTemplates.set(
ConstDependency,
new ConstDependency.Template()
);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_AUTO)
.tap(PLUGIN_NAME, (parser, parserOptions) => {
if (
parserOptions.browserify !== undefined &&
!parserOptions.browserify
)
return;
parser.hooks.call.for("require").tap(
PLUGIN_NAME,
/**
* @param {CallExpression} expr call expression
* @returns {boolean | void} true when need to handle
*/
expr => {
// support for browserify style require delegator: "require(o, !0)"
if (expr.arguments.length !== 2) return;
const second = parser.evaluateExpression(expr.arguments[1]);
if (!second.isBoolean()) return;
if (second.asBool() !== true) return;
const dep = new ConstDependency(
"require",
/** @type {Range} */ (expr.callee.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
if (parser.state.current.dependencies.length > 0) {
const last =
parser.state.current.dependencies[
parser.state.current.dependencies.length - 1
];
if (
last.critical &&
last.options &&
last.options.request === "." &&
last.userRequest === "." &&
last.options.recursive
)
parser.state.current.dependencies.pop();
}
parser.state.module.addPresentationalDependency(dep);
return true;
}
);
});
/**
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
const handler = parser => {
// Handle nested requires
parser.hooks.preStatement.tap(PLUGIN_NAME, statement => {
if (
statement.type === "FunctionDeclaration" &&
statement.id &&
statement.id.name === RuntimeGlobals.require
) {
const newName = `__nested_webpack_require_${
/** @type {Range} */ (statement.range)[0]
}__`;
parser.tagVariable(
statement.id.name,
nestedWebpackIdentifierTag,
{
name: newName,
declaration: {
updated: false,
loc: statement.id.loc,
range: statement.id.range
}
}
);
return true;
}
});
parser.hooks.pattern
.for(RuntimeGlobals.require)
.tap(PLUGIN_NAME, pattern => {
const newName = `__nested_webpack_require_${
/** @type {Range} */ (pattern.range)[0]
}__`;
parser.tagVariable(pattern.name, nestedWebpackIdentifierTag, {
name: newName,
declaration: {
updated: false,
loc: pattern.loc,
range: pattern.range
}
});
return true;
});
parser.hooks.pattern
.for(RuntimeGlobals.exports)
.tap(PLUGIN_NAME, pattern => {
parser.tagVariable(pattern.name, nestedWebpackIdentifierTag, {
name: "__nested_webpack_exports__",
declaration: {
updated: false,
loc: pattern.loc,
range: pattern.range
}
});
return true;
});
parser.hooks.expression
.for(nestedWebpackIdentifierTag)
.tap(PLUGIN_NAME, expr => {
const { name, declaration } =
/** @type {TagData} */
(parser.currentTagData);
if (!declaration.updated) {
const dep = new ConstDependency(name, declaration.range);
dep.loc = declaration.loc;
parser.state.module.addPresentationalDependency(dep);
declaration.updated = true;
}
const dep = new ConstDependency(
name,
/** @type {Range} */ (expr.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);
return true;
});
// Handle hashbang
parser.hooks.program.tap(PLUGIN_NAME, (program, comments) => {
if (comments.length === 0) return;
const c = comments[0];
if (c.type === "Line" && /** @type {Range} */ (c.range)[0] === 0) {
if (parser.state.source.slice(0, 2).toString() !== "#!") return;
// this is a hashbang comment
const dep = new ConstDependency("//", 0);
dep.loc = /** @type {DependencyLocation} */ (c.loc);
parser.state.module.addPresentationalDependency(dep);
}
});
};
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_AUTO)
.tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
.tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_ESM)
.tap(PLUGIN_NAME, handler);
}
);
}
}
module.exports = CompatibilityPlugin;

5724
app_vue/node_modules/webpack/lib/Compilation.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1381
app_vue/node_modules/webpack/lib/Compiler.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

143
app_vue/node_modules/webpack/lib/ConcatenationScope.js generated vendored Normal file
View File

@ -0,0 +1,143 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const {
DEFAULT_EXPORT,
NAMESPACE_OBJECT_EXPORT
} = require("./util/concatenate");
/** @typedef {import("./Module")} Module */
/** @typedef {import("./optimize/ConcatenatedModule").ConcatenatedModuleInfo} ConcatenatedModuleInfo */
/** @typedef {import("./optimize/ConcatenatedModule").ModuleInfo} ModuleInfo */
const MODULE_REFERENCE_REGEXP =
/^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(?:_asiSafe(\d))?__$/;
/**
* @typedef {object} ModuleReferenceOptions
* @property {string[]} ids the properties/exports of the module
* @property {boolean} call true, when this referenced export is called
* @property {boolean} directImport true, when this referenced export is directly imported (not via property access)
* @property {boolean | undefined} asiSafe if the position is ASI safe or unknown
*/
class ConcatenationScope {
/**
* @param {ModuleInfo[] | Map<Module, ModuleInfo>} modulesMap all module info by module
* @param {ConcatenatedModuleInfo} currentModule the current module info
*/
constructor(modulesMap, currentModule) {
this._currentModule = currentModule;
if (Array.isArray(modulesMap)) {
const map = new Map();
for (const info of modulesMap) {
map.set(info.module, info);
}
modulesMap = map;
}
this._modulesMap = modulesMap;
}
/**
* @param {Module} module the referenced module
* @returns {boolean} true, when it's in the scope
*/
isModuleInScope(module) {
return this._modulesMap.has(module);
}
/**
* @param {string} exportName name of the export
* @param {string} symbol identifier of the export in source code
*/
registerExport(exportName, symbol) {
if (!this._currentModule.exportMap) {
this._currentModule.exportMap = new Map();
}
if (!this._currentModule.exportMap.has(exportName)) {
this._currentModule.exportMap.set(exportName, symbol);
}
}
/**
* @param {string} exportName name of the export
* @param {string} expression expression to be used
*/
registerRawExport(exportName, expression) {
if (!this._currentModule.rawExportMap) {
this._currentModule.rawExportMap = new Map();
}
if (!this._currentModule.rawExportMap.has(exportName)) {
this._currentModule.rawExportMap.set(exportName, expression);
}
}
/**
* @param {string} symbol identifier of the export in source code
*/
registerNamespaceExport(symbol) {
this._currentModule.namespaceExportSymbol = symbol;
}
/**
* @param {Module} module the referenced module
* @param {Partial<ModuleReferenceOptions>} options options
* @returns {string} the reference as identifier
*/
createModuleReference(
module,
{ ids = undefined, call = false, directImport = false, asiSafe = false }
) {
const info = /** @type {ModuleInfo} */ (this._modulesMap.get(module));
const callFlag = call ? "_call" : "";
const directImportFlag = directImport ? "_directImport" : "";
const asiSafeFlag = asiSafe
? "_asiSafe1"
: asiSafe === false
? "_asiSafe0"
: "";
const exportData = ids
? Buffer.from(JSON.stringify(ids), "utf-8").toString("hex")
: "ns";
// a "._" is appended to allow "delete ...", which would cause a SyntaxError in strict mode
return `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${callFlag}${directImportFlag}${asiSafeFlag}__._`;
}
/**
* @param {string} name the identifier
* @returns {boolean} true, when it's an module reference
*/
static isModuleReference(name) {
return MODULE_REFERENCE_REGEXP.test(name);
}
/**
* @param {string} name the identifier
* @returns {ModuleReferenceOptions & { index: number } | null} parsed options and index
*/
static matchModuleReference(name) {
const match = MODULE_REFERENCE_REGEXP.exec(name);
if (!match) return null;
const index = Number(match[1]);
const asiSafe = match[5];
return {
index,
ids:
match[2] === "ns"
? []
: JSON.parse(Buffer.from(match[2], "hex").toString("utf-8")),
call: Boolean(match[3]),
directImport: Boolean(match[4]),
asiSafe: asiSafe ? asiSafe === "1" : undefined
};
}
}
ConcatenationScope.DEFAULT_EXPORT = DEFAULT_EXPORT;
ConcatenationScope.NAMESPACE_OBJECT_EXPORT = NAMESPACE_OBJECT_EXPORT;
module.exports = ConcatenationScope;

View File

@ -0,0 +1,18 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Maksim Nazarjev @acupofspirt
*/
"use strict";
const WebpackError = require("./WebpackError");
module.exports = class ConcurrentCompilationError extends WebpackError {
constructor() {
super();
this.name = "ConcurrentCompilationError";
this.message =
"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time.";
}
};

View File

@ -0,0 +1,120 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { ConcatSource, PrefixSource } = require("webpack-sources");
const InitFragment = require("./InitFragment");
const Template = require("./Template");
const { mergeRuntime } = require("./util/runtime");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./Generator").GenerateContext} GenerateContext */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/**
* @param {string} condition condition
* @param {string | Source} source source
* @returns {string | Source} wrapped source
*/
const wrapInCondition = (condition, source) => {
if (typeof source === "string") {
return Template.asString([
`if (${condition}) {`,
Template.indent(source),
"}",
""
]);
}
return new ConcatSource(
`if (${condition}) {\n`,
new PrefixSource("\t", source),
"}\n"
);
};
/**
* @extends {InitFragment<GenerateContext>}
*/
class ConditionalInitFragment extends InitFragment {
/**
* @param {string | Source | undefined} content the source code that will be included as initialization code
* @param {number} stage category of initialization code (contribute to order)
* @param {number} position position in the category (contribute to order)
* @param {string | undefined} key unique key to avoid emitting the same initialization code twice
* @param {RuntimeSpec | boolean} runtimeCondition in which runtime this fragment should be executed
* @param {string | Source=} endContent the source code that will be included at the end of the module
*/
constructor(
content,
stage,
position,
key,
runtimeCondition = true,
endContent = undefined
) {
super(content, stage, position, key, endContent);
this.runtimeCondition = runtimeCondition;
}
/**
* @param {GenerateContext} context context
* @returns {string | Source | undefined} the source code that will be included as initialization code
*/
getContent(context) {
if (this.runtimeCondition === false || !this.content) return "";
if (this.runtimeCondition === true) return this.content;
const expr = context.runtimeTemplate.runtimeConditionExpression({
chunkGraph: context.chunkGraph,
runtimeRequirements: context.runtimeRequirements,
runtime: context.runtime,
runtimeCondition: this.runtimeCondition
});
if (expr === "true") return this.content;
return wrapInCondition(expr, this.content);
}
/**
* @param {GenerateContext} context context
* @returns {string | Source=} the source code that will be included at the end of the module
*/
getEndContent(context) {
if (this.runtimeCondition === false || !this.endContent) return "";
if (this.runtimeCondition === true) return this.endContent;
const expr = context.runtimeTemplate.runtimeConditionExpression({
chunkGraph: context.chunkGraph,
runtimeRequirements: context.runtimeRequirements,
runtime: context.runtime,
runtimeCondition: this.runtimeCondition
});
if (expr === "true") return this.endContent;
return wrapInCondition(expr, this.endContent);
}
/**
* @param {ConditionalInitFragment} other fragment to merge with
* @returns {ConditionalInitFragment} merged fragment
*/
merge(other) {
if (this.runtimeCondition === true) return this;
if (other.runtimeCondition === true) return other;
if (this.runtimeCondition === false) return other;
if (other.runtimeCondition === false) return this;
const runtimeCondition = mergeRuntime(
this.runtimeCondition,
other.runtimeCondition
);
return new ConditionalInitFragment(
this.content,
this.stage,
this.position,
this.key,
runtimeCondition,
this.endContent
);
}
}
module.exports = ConditionalInitFragment;

557
app_vue/node_modules/webpack/lib/ConstPlugin.js generated vendored Normal file
View File

@ -0,0 +1,557 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const {
JAVASCRIPT_MODULE_TYPE_AUTO,
JAVASCRIPT_MODULE_TYPE_DYNAMIC,
JAVASCRIPT_MODULE_TYPE_ESM
} = require("./ModuleTypeConstants");
const CachedConstDependency = require("./dependencies/CachedConstDependency");
const ConstDependency = require("./dependencies/ConstDependency");
const { evaluateToString } = require("./javascript/JavascriptParserHelpers");
const { parseResource } = require("./util/identifier");
/** @typedef {import("estree").AssignmentProperty} AssignmentProperty */
/** @typedef {import("estree").Expression} Expression */
/** @typedef {import("estree").Identifier} Identifier */
/** @typedef {import("estree").Pattern} Pattern */
/** @typedef {import("estree").SourceLocation} SourceLocation */
/** @typedef {import("estree").Statement} Statement */
/** @typedef {import("estree").Super} Super */
/** @typedef {import("estree").VariableDeclaration} VariableDeclaration */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("./javascript/JavascriptParser").Range} Range */
/**
* @param {Set<string>} declarations set of declarations
* @param {Identifier | Pattern} pattern pattern to collect declarations from
*/
const collectDeclaration = (declarations, pattern) => {
const stack = [pattern];
while (stack.length > 0) {
const node = /** @type {Pattern} */ (stack.pop());
switch (node.type) {
case "Identifier":
declarations.add(node.name);
break;
case "ArrayPattern":
for (const element of node.elements) {
if (element) {
stack.push(element);
}
}
break;
case "AssignmentPattern":
stack.push(node.left);
break;
case "ObjectPattern":
for (const property of node.properties) {
stack.push(/** @type {AssignmentProperty} */ (property).value);
}
break;
case "RestElement":
stack.push(node.argument);
break;
}
}
};
/**
* @param {Statement} branch branch to get hoisted declarations from
* @param {boolean} includeFunctionDeclarations whether to include function declarations
* @returns {Array<string>} hoisted declarations
*/
const getHoistedDeclarations = (branch, includeFunctionDeclarations) => {
const declarations = new Set();
/** @type {Array<Statement | null | undefined>} */
const stack = [branch];
while (stack.length > 0) {
const node = stack.pop();
// Some node could be `null` or `undefined`.
if (!node) continue;
switch (node.type) {
// Walk through control statements to look for hoisted declarations.
// Some branches are skipped since they do not allow declarations.
case "BlockStatement":
for (const stmt of node.body) {
stack.push(stmt);
}
break;
case "IfStatement":
stack.push(node.consequent);
stack.push(node.alternate);
break;
case "ForStatement":
stack.push(/** @type {VariableDeclaration} */ (node.init));
stack.push(node.body);
break;
case "ForInStatement":
case "ForOfStatement":
stack.push(/** @type {VariableDeclaration} */ (node.left));
stack.push(node.body);
break;
case "DoWhileStatement":
case "WhileStatement":
case "LabeledStatement":
stack.push(node.body);
break;
case "SwitchStatement":
for (const cs of node.cases) {
for (const consequent of cs.consequent) {
stack.push(consequent);
}
}
break;
case "TryStatement":
stack.push(node.block);
if (node.handler) {
stack.push(node.handler.body);
}
stack.push(node.finalizer);
break;
case "FunctionDeclaration":
if (includeFunctionDeclarations) {
collectDeclaration(declarations, /** @type {Identifier} */ (node.id));
}
break;
case "VariableDeclaration":
if (node.kind === "var") {
for (const decl of node.declarations) {
collectDeclaration(declarations, decl.id);
}
}
break;
}
}
return Array.from(declarations);
};
const PLUGIN_NAME = "ConstPlugin";
class ConstPlugin {
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
const cachedParseResource = parseResource.bindCache(compiler.root);
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
compilation.dependencyTemplates.set(
ConstDependency,
new ConstDependency.Template()
);
compilation.dependencyTemplates.set(
CachedConstDependency,
new CachedConstDependency.Template()
);
/**
* @param {JavascriptParser} parser the parser
*/
const handler = parser => {
parser.hooks.terminate.tap(PLUGIN_NAME, statement => true);
parser.hooks.statementIf.tap(PLUGIN_NAME, statement => {
if (parser.scope.isAsmJs) return;
const param = parser.evaluateExpression(statement.test);
const bool = param.asBool();
if (typeof bool === "boolean") {
if (!param.couldHaveSideEffects()) {
const dep = new ConstDependency(
`${bool}`,
/** @type {Range} */ (param.range)
);
dep.loc = /** @type {SourceLocation} */ (statement.loc);
parser.state.module.addPresentationalDependency(dep);
} else {
parser.walkExpression(statement.test);
}
const branchToRemove = bool
? statement.alternate
: statement.consequent;
if (branchToRemove) {
this.eliminateUnusedStatement(parser, branchToRemove);
}
return bool;
}
});
parser.hooks.unusedStatement.tap(PLUGIN_NAME, statement => {
if (
parser.scope.isAsmJs ||
// Check top level scope here again
parser.scope.topLevelScope === true
)
return;
this.eliminateUnusedStatement(parser, statement);
return true;
});
parser.hooks.expressionConditionalOperator.tap(
PLUGIN_NAME,
expression => {
if (parser.scope.isAsmJs) return;
const param = parser.evaluateExpression(expression.test);
const bool = param.asBool();
if (typeof bool === "boolean") {
if (!param.couldHaveSideEffects()) {
const dep = new ConstDependency(
` ${bool}`,
/** @type {Range} */ (param.range)
);
dep.loc = /** @type {SourceLocation} */ (expression.loc);
parser.state.module.addPresentationalDependency(dep);
} else {
parser.walkExpression(expression.test);
}
// Expressions do not hoist.
// It is safe to remove the dead branch.
//
// Given the following code:
//
// false ? someExpression() : otherExpression();
//
// the generated code is:
//
// false ? 0 : otherExpression();
//
const branchToRemove = bool
? expression.alternate
: expression.consequent;
const dep = new ConstDependency(
"0",
/** @type {Range} */ (branchToRemove.range)
);
dep.loc = /** @type {SourceLocation} */ (branchToRemove.loc);
parser.state.module.addPresentationalDependency(dep);
return bool;
}
}
);
parser.hooks.expressionLogicalOperator.tap(
PLUGIN_NAME,
expression => {
if (parser.scope.isAsmJs) return;
if (
expression.operator === "&&" ||
expression.operator === "||"
) {
const param = parser.evaluateExpression(expression.left);
const bool = param.asBool();
if (typeof bool === "boolean") {
// Expressions do not hoist.
// It is safe to remove the dead branch.
//
// ------------------------------------------
//
// Given the following code:
//
// falsyExpression() && someExpression();
//
// the generated code is:
//
// falsyExpression() && false;
//
// ------------------------------------------
//
// Given the following code:
//
// truthyExpression() && someExpression();
//
// the generated code is:
//
// true && someExpression();
//
// ------------------------------------------
//
// Given the following code:
//
// truthyExpression() || someExpression();
//
// the generated code is:
//
// truthyExpression() || false;
//
// ------------------------------------------
//
// Given the following code:
//
// falsyExpression() || someExpression();
//
// the generated code is:
//
// false && someExpression();
//
const keepRight =
(expression.operator === "&&" && bool) ||
(expression.operator === "||" && !bool);
if (
!param.couldHaveSideEffects() &&
(param.isBoolean() || keepRight)
) {
// for case like
//
// return'development'===process.env.NODE_ENV&&'foo'
//
// we need a space before the bool to prevent result like
//
// returnfalse&&'foo'
//
const dep = new ConstDependency(
` ${bool}`,
/** @type {Range} */ (param.range)
);
dep.loc = /** @type {SourceLocation} */ (expression.loc);
parser.state.module.addPresentationalDependency(dep);
} else {
parser.walkExpression(expression.left);
}
if (!keepRight) {
const dep = new ConstDependency(
"0",
/** @type {Range} */ (expression.right.range)
);
dep.loc = /** @type {SourceLocation} */ (expression.loc);
parser.state.module.addPresentationalDependency(dep);
}
return keepRight;
}
} else if (expression.operator === "??") {
const param = parser.evaluateExpression(expression.left);
const keepRight = param.asNullish();
if (typeof keepRight === "boolean") {
// ------------------------------------------
//
// Given the following code:
//
// nonNullish ?? someExpression();
//
// the generated code is:
//
// nonNullish ?? 0;
//
// ------------------------------------------
//
// Given the following code:
//
// nullish ?? someExpression();
//
// the generated code is:
//
// null ?? someExpression();
//
if (!param.couldHaveSideEffects() && keepRight) {
// cspell:word returnnull
// for case like
//
// return('development'===process.env.NODE_ENV&&null)??'foo'
//
// we need a space before the bool to prevent result like
//
// returnnull??'foo'
//
const dep = new ConstDependency(
" null",
/** @type {Range} */ (param.range)
);
dep.loc = /** @type {SourceLocation} */ (expression.loc);
parser.state.module.addPresentationalDependency(dep);
} else {
const dep = new ConstDependency(
"0",
/** @type {Range} */ (expression.right.range)
);
dep.loc = /** @type {SourceLocation} */ (expression.loc);
parser.state.module.addPresentationalDependency(dep);
parser.walkExpression(expression.left);
}
return keepRight;
}
}
}
);
parser.hooks.optionalChaining.tap(PLUGIN_NAME, expr => {
/** @type {Expression[]} */
const optionalExpressionsStack = [];
/** @type {Expression | Super} */
let next = expr.expression;
while (
next.type === "MemberExpression" ||
next.type === "CallExpression"
) {
if (next.type === "MemberExpression") {
if (next.optional) {
// SuperNode can not be optional
optionalExpressionsStack.push(
/** @type {Expression} */ (next.object)
);
}
next = next.object;
} else {
if (next.optional) {
// SuperNode can not be optional
optionalExpressionsStack.push(
/** @type {Expression} */ (next.callee)
);
}
next = next.callee;
}
}
while (optionalExpressionsStack.length) {
const expression = optionalExpressionsStack.pop();
const evaluated = parser.evaluateExpression(
/** @type {Expression} */ (expression)
);
if (evaluated.asNullish()) {
// ------------------------------------------
//
// Given the following code:
//
// nullishMemberChain?.a.b();
//
// the generated code is:
//
// undefined;
//
// ------------------------------------------
//
const dep = new ConstDependency(
" undefined",
/** @type {Range} */ (expr.range)
);
dep.loc = /** @type {SourceLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);
return true;
}
}
});
parser.hooks.evaluateIdentifier
.for("__resourceQuery")
.tap(PLUGIN_NAME, expr => {
if (parser.scope.isAsmJs) return;
if (!parser.state.module) return;
return evaluateToString(
cachedParseResource(parser.state.module.resource).query
)(expr);
});
parser.hooks.expression
.for("__resourceQuery")
.tap(PLUGIN_NAME, expr => {
if (parser.scope.isAsmJs) return;
if (!parser.state.module) return;
const dep = new CachedConstDependency(
JSON.stringify(
cachedParseResource(parser.state.module.resource).query
),
/** @type {Range} */ (expr.range),
"__resourceQuery"
);
dep.loc = /** @type {SourceLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);
return true;
});
parser.hooks.evaluateIdentifier
.for("__resourceFragment")
.tap(PLUGIN_NAME, expr => {
if (parser.scope.isAsmJs) return;
if (!parser.state.module) return;
return evaluateToString(
cachedParseResource(parser.state.module.resource).fragment
)(expr);
});
parser.hooks.expression
.for("__resourceFragment")
.tap(PLUGIN_NAME, expr => {
if (parser.scope.isAsmJs) return;
if (!parser.state.module) return;
const dep = new CachedConstDependency(
JSON.stringify(
cachedParseResource(parser.state.module.resource).fragment
),
/** @type {Range} */ (expr.range),
"__resourceFragment"
);
dep.loc = /** @type {SourceLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);
return true;
});
};
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_AUTO)
.tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
.tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_ESM)
.tap(PLUGIN_NAME, handler);
}
);
}
/**
* Eliminate an unused statement.
* @param {JavascriptParser} parser the parser
* @param {Statement} statement the statement to remove
* @returns {void}
*/
eliminateUnusedStatement(parser, statement) {
// Before removing the unused branch, the hoisted declarations
// must be collected.
//
// Given the following code:
//
// if (true) f() else g()
// if (false) {
// function f() {}
// const g = function g() {}
// if (someTest) {
// let a = 1
// var x, {y, z} = obj
// }
// } else {
// …
// }
//
// the generated code is:
//
// if (true) f() else {}
// if (false) {
// var f, x, y, z; (in loose mode)
// var x, y, z; (in strict mode)
// } else {
// …
// }
//
// NOTE: When code runs in strict mode, `var` declarations
// are hoisted but `function` declarations don't.
//
const declarations = parser.scope.isStrict
? getHoistedDeclarations(statement, false)
: getHoistedDeclarations(statement, true);
const replacement =
declarations.length > 0 ? `{ var ${declarations.join(", ")}; }` : "{}";
const dep = new ConstDependency(
`// removed by dead control flow\n${replacement}`,
/** @type {Range} */ (statement.range)
);
dep.loc = /** @type {SourceLocation} */ (statement.loc);
parser.state.module.addPresentationalDependency(dep);
}
}
module.exports = ConstPlugin;

View File

@ -0,0 +1,34 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
*/
"use strict";
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./ContextModuleFactory")} ContextModuleFactory */
const PLUGIN_NAME = "ContextExclusionPlugin";
class ContextExclusionPlugin {
/**
* @param {RegExp} negativeMatcher Matcher regular expression
*/
constructor(negativeMatcher) {
this.negativeMatcher = negativeMatcher;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, cmf => {
cmf.hooks.contextModuleFiles.tap(PLUGIN_NAME, files =>
files.filter(filePath => !this.negativeMatcher.test(filePath))
);
});
}
}
module.exports = ContextExclusionPlugin;

1256
app_vue/node_modules/webpack/lib/ContextModule.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,480 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const asyncLib = require("neo-async");
const { AsyncSeriesWaterfallHook, SyncWaterfallHook } = require("tapable");
const ContextModule = require("./ContextModule");
const ModuleFactory = require("./ModuleFactory");
const ContextElementDependency = require("./dependencies/ContextElementDependency");
const LazySet = require("./util/LazySet");
const { cachedSetProperty } = require("./util/cleverMerge");
const { createFakeHook } = require("./util/deprecation");
const { join } = require("./util/fs");
/** @typedef {import("./ContextModule").ContextModuleOptions} ContextModuleOptions */
/** @typedef {import("./ContextModule").ResolveDependenciesCallback} ResolveDependenciesCallback */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */
/** @typedef {import("./ModuleFactory").ModuleFactoryCallback} ModuleFactoryCallback */
/** @typedef {import("./ResolverFactory")} ResolverFactory */
/** @typedef {import("./dependencies/ContextDependency")} ContextDependency */
/** @typedef {import("enhanced-resolve").ResolveRequest} ResolveRequest */
/**
* @template T
* @typedef {import("./util/deprecation").FakeHook<T>} FakeHook<T>
*/
/** @typedef {import("./util/fs").IStats} IStats */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
/** @typedef {{ context: string, request: string }} ContextAlternativeRequest */
const EMPTY_RESOLVE_OPTIONS = {};
module.exports = class ContextModuleFactory extends ModuleFactory {
/**
* @param {ResolverFactory} resolverFactory resolverFactory
*/
constructor(resolverFactory) {
super();
/** @type {AsyncSeriesWaterfallHook<[ContextAlternativeRequest[], ContextModuleOptions]>} */
const alternativeRequests = new AsyncSeriesWaterfallHook([
"modules",
"options"
]);
this.hooks = Object.freeze({
/** @type {AsyncSeriesWaterfallHook<[TODO]>} */
beforeResolve: new AsyncSeriesWaterfallHook(["data"]),
/** @type {AsyncSeriesWaterfallHook<[TODO]>} */
afterResolve: new AsyncSeriesWaterfallHook(["data"]),
/** @type {SyncWaterfallHook<[string[]]>} */
contextModuleFiles: new SyncWaterfallHook(["files"]),
/** @type {FakeHook<Pick<AsyncSeriesWaterfallHook<[ContextAlternativeRequest[]]>, "tap" | "tapAsync" | "tapPromise" | "name">>} */
alternatives: createFakeHook(
{
name: "alternatives",
/** @type {AsyncSeriesWaterfallHook<[ContextAlternativeRequest[]]>["intercept"]} */
intercept: interceptor => {
throw new Error(
"Intercepting fake hook ContextModuleFactory.hooks.alternatives is not possible, use ContextModuleFactory.hooks.alternativeRequests instead"
);
},
/** @type {AsyncSeriesWaterfallHook<[ContextAlternativeRequest[]]>["tap"]} */
tap: (options, fn) => {
alternativeRequests.tap(options, fn);
},
/** @type {AsyncSeriesWaterfallHook<[ContextAlternativeRequest[]]>["tapAsync"]} */
tapAsync: (options, fn) => {
alternativeRequests.tapAsync(options, (items, _options, callback) =>
fn(items, callback)
);
},
/** @type {AsyncSeriesWaterfallHook<[ContextAlternativeRequest[]]>["tapPromise"]} */
tapPromise: (options, fn) => {
alternativeRequests.tapPromise(options, fn);
}
},
"ContextModuleFactory.hooks.alternatives has deprecated in favor of ContextModuleFactory.hooks.alternativeRequests with an additional options argument.",
"DEP_WEBPACK_CONTEXT_MODULE_FACTORY_ALTERNATIVES"
),
alternativeRequests
});
this.resolverFactory = resolverFactory;
}
/**
* @param {ModuleFactoryCreateData} data data object
* @param {ModuleFactoryCallback} callback callback
* @returns {void}
*/
create(data, callback) {
const context = data.context;
const dependencies = data.dependencies;
const resolveOptions = data.resolveOptions;
const dependency = /** @type {ContextDependency} */ (dependencies[0]);
const fileDependencies = new LazySet();
const missingDependencies = new LazySet();
const contextDependencies = new LazySet();
this.hooks.beforeResolve.callAsync(
{
context,
dependencies,
layer: data.contextInfo.issuerLayer,
resolveOptions,
fileDependencies,
missingDependencies,
contextDependencies,
...dependency.options
},
(err, beforeResolveResult) => {
if (err) {
return callback(err, {
fileDependencies,
missingDependencies,
contextDependencies
});
}
// Ignored
if (!beforeResolveResult) {
return callback(null, {
fileDependencies,
missingDependencies,
contextDependencies
});
}
const context = beforeResolveResult.context;
const request = beforeResolveResult.request;
const resolveOptions = beforeResolveResult.resolveOptions;
let loaders;
let resource;
let loadersPrefix = "";
const idx = request.lastIndexOf("!");
if (idx >= 0) {
let loadersRequest = request.slice(0, idx + 1);
let i;
for (
i = 0;
i < loadersRequest.length && loadersRequest[i] === "!";
i++
) {
loadersPrefix += "!";
}
loadersRequest = loadersRequest
.slice(i)
.replace(/!+$/, "")
.replace(/!!+/g, "!");
loaders = loadersRequest === "" ? [] : loadersRequest.split("!");
resource = request.slice(idx + 1);
} else {
loaders = [];
resource = request;
}
const contextResolver = this.resolverFactory.get(
"context",
dependencies.length > 0
? cachedSetProperty(
resolveOptions || EMPTY_RESOLVE_OPTIONS,
"dependencyType",
dependencies[0].category
)
: resolveOptions
);
const loaderResolver = this.resolverFactory.get("loader");
asyncLib.parallel(
[
callback => {
const results = /** @type ResolveRequest[] */ ([]);
/**
* @param {ResolveRequest} obj obj
* @returns {void}
*/
const yield_ = obj => {
results.push(obj);
};
contextResolver.resolve(
{},
context,
resource,
{
fileDependencies,
missingDependencies,
contextDependencies,
yield: yield_
},
err => {
if (err) return callback(err);
callback(null, results);
}
);
},
callback => {
asyncLib.map(
loaders,
(loader, callback) => {
loaderResolver.resolve(
{},
context,
loader,
{
fileDependencies,
missingDependencies,
contextDependencies
},
(err, result) => {
if (err) return callback(err);
callback(null, /** @type {string} */ (result));
}
);
},
callback
);
}
],
(err, result) => {
if (err) {
return callback(err, {
fileDependencies,
missingDependencies,
contextDependencies
});
}
let [contextResult, loaderResult] =
/** @type {[ResolveRequest[], string[]]} */ (result);
if (contextResult.length > 1) {
const first = contextResult[0];
contextResult = contextResult.filter(r => r.path);
if (contextResult.length === 0) contextResult.push(first);
}
this.hooks.afterResolve.callAsync(
{
addon:
loadersPrefix +
loaderResult.join("!") +
(loaderResult.length > 0 ? "!" : ""),
resource:
contextResult.length > 1
? contextResult.map(r => r.path)
: contextResult[0].path,
resolveDependencies: this.resolveDependencies.bind(this),
resourceQuery: contextResult[0].query,
resourceFragment: contextResult[0].fragment,
...beforeResolveResult
},
(err, result) => {
if (err) {
return callback(err, {
fileDependencies,
missingDependencies,
contextDependencies
});
}
// Ignored
if (!result) {
return callback(null, {
fileDependencies,
missingDependencies,
contextDependencies
});
}
return callback(null, {
module: new ContextModule(result.resolveDependencies, result),
fileDependencies,
missingDependencies,
contextDependencies
});
}
);
}
);
}
);
}
/**
* @param {InputFileSystem} fs file system
* @param {ContextModuleOptions} options options
* @param {ResolveDependenciesCallback} callback callback function
* @returns {void}
*/
resolveDependencies(fs, options, callback) {
const cmf = this;
const {
resource,
resourceQuery,
resourceFragment,
recursive,
regExp,
include,
exclude,
referencedExports,
category,
typePrefix,
attributes
} = options;
if (!regExp || !resource) return callback(null, []);
/**
* @param {string} ctx context
* @param {string} directory directory
* @param {Set<string>} visited visited
* @param {ResolveDependenciesCallback} callback callback
*/
const addDirectoryChecked = (ctx, directory, visited, callback) => {
/** @type {NonNullable<InputFileSystem["realpath"]>} */
(fs.realpath)(directory, (err, _realPath) => {
if (err) return callback(err);
const realPath = /** @type {string} */ (_realPath);
if (visited.has(realPath)) return callback(null, []);
/** @type {Set<string> | undefined} */
let recursionStack;
addDirectory(
ctx,
directory,
(_, dir, callback) => {
if (recursionStack === undefined) {
recursionStack = new Set(visited);
recursionStack.add(realPath);
}
addDirectoryChecked(ctx, dir, recursionStack, callback);
},
callback
);
});
};
/**
* @param {string} ctx context
* @param {string} directory directory
* @param {(context: string, subResource: string, callback: () => void) => void} addSubDirectory addSubDirectoryFn
* @param {ResolveDependenciesCallback} callback callback
*/
const addDirectory = (ctx, directory, addSubDirectory, callback) => {
fs.readdir(directory, (err, files) => {
if (err) return callback(err);
const processedFiles = cmf.hooks.contextModuleFiles.call(
/** @type {string[]} */ (files).map(file => file.normalize("NFC"))
);
if (!processedFiles || processedFiles.length === 0)
return callback(null, []);
asyncLib.map(
processedFiles.filter(p => p.indexOf(".") !== 0),
(segment, callback) => {
const subResource = join(fs, directory, segment);
if (!exclude || !subResource.match(exclude)) {
fs.stat(subResource, (err, _stat) => {
if (err) {
if (err.code === "ENOENT") {
// ENOENT is ok here because the file may have been deleted between
// the readdir and stat calls.
return callback();
}
return callback(err);
}
const stat = /** @type {IStats} */ (_stat);
if (stat.isDirectory()) {
if (!recursive) return callback();
addSubDirectory(ctx, subResource, callback);
} else if (
stat.isFile() &&
(!include || subResource.match(include))
) {
/** @type {{ context: string, request: string }} */
const obj = {
context: ctx,
request: `.${subResource.slice(ctx.length).replace(/\\/g, "/")}`
};
this.hooks.alternativeRequests.callAsync(
[obj],
options,
(err, alternatives) => {
if (err) return callback(err);
callback(
null,
/** @type {ContextAlternativeRequest[]} */
(alternatives)
.filter(obj =>
regExp.test(/** @type {string} */ (obj.request))
)
.map(obj => {
const dep = new ContextElementDependency(
`${obj.request}${resourceQuery}${resourceFragment}`,
obj.request,
typePrefix,
/** @type {string} */
(category),
referencedExports,
obj.context,
attributes
);
dep.optional = true;
return dep;
})
);
}
);
} else {
callback();
}
});
} else {
callback();
}
},
(err, result) => {
if (err) return callback(err);
if (!result) return callback(null, []);
const flattenedResult = [];
for (const item of result) {
if (item) flattenedResult.push(...item);
}
callback(null, flattenedResult);
}
);
});
};
/**
* @param {string} ctx context
* @param {string} dir dir
* @param {ResolveDependenciesCallback} callback callback
* @returns {void}
*/
const addSubDirectory = (ctx, dir, callback) =>
addDirectory(ctx, dir, addSubDirectory, callback);
/**
* @param {string} resource resource
* @param {ResolveDependenciesCallback} callback callback
*/
const visitResource = (resource, callback) => {
if (typeof fs.realpath === "function") {
addDirectoryChecked(resource, resource, new Set(), callback);
} else {
addDirectory(resource, resource, addSubDirectory, callback);
}
};
if (typeof resource === "string") {
visitResource(resource, callback);
} else {
asyncLib.map(resource, visitResource, (err, _result) => {
if (err) return callback(err);
const result = /** @type {ContextElementDependency[][]} */ (_result);
// result dependencies should have unique userRequest
// ordered by resolve result
/** @type {Set<string>} */
const temp = new Set();
/** @type {ContextElementDependency[]} */
const res = [];
for (let i = 0; i < result.length; i++) {
const inner = result[i];
for (const el of inner) {
if (temp.has(el.userRequest)) continue;
res.push(el);
temp.add(el.userRequest);
}
}
callback(null, res);
});
}
}
};

View File

@ -0,0 +1,202 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const ContextElementDependency = require("./dependencies/ContextElementDependency");
const { join } = require("./util/fs");
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./ContextModule").ContextModuleOptions} ContextModuleOptions */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
/** @typedef {Record<string, string>} NewContentCreateContextMap */
const PLUGIN_NAME = "ContextReplacementPlugin";
class ContextReplacementPlugin {
/**
* @param {RegExp} resourceRegExp A regular expression that determines which files will be selected
* @param {(string | ((context: TODO) => void) | RegExp | boolean)=} newContentResource A new resource to replace the match
* @param {(boolean | NewContentCreateContextMap | RegExp)=} newContentRecursive If true, all subdirectories are searched for matches
* @param {RegExp=} newContentRegExp A regular expression that determines which files will be selected
*/
constructor(
resourceRegExp,
newContentResource,
newContentRecursive,
newContentRegExp
) {
this.resourceRegExp = resourceRegExp;
// new webpack.ContextReplacementPlugin(/selector/, (context) => { /* Logic */ });
if (typeof newContentResource === "function") {
this.newContentCallback = newContentResource;
}
// new ContextReplacementPlugin(/selector/, './folder', { './request': './request' });
else if (
typeof newContentResource === "string" &&
typeof newContentRecursive === "object"
) {
this.newContentResource = newContentResource;
/**
* @param {InputFileSystem} fs input file system
* @param {(err: null | Error, newContentRecursive: NewContentCreateContextMap) => void} callback callback
*/
this.newContentCreateContextMap = (fs, callback) => {
callback(
null,
/** @type {NewContentCreateContextMap} */ (newContentRecursive)
);
};
}
// new ContextReplacementPlugin(/selector/, './folder', (context) => { /* Logic */ });
else if (
typeof newContentResource === "string" &&
typeof newContentRecursive === "function"
) {
this.newContentResource = newContentResource;
this.newContentCreateContextMap = newContentRecursive;
} else {
// new webpack.ContextReplacementPlugin(/selector/, false, /reg-exp/);
if (typeof newContentResource !== "string") {
newContentRegExp = /** @type {RegExp} */ (newContentRecursive);
newContentRecursive = /** @type {boolean} */ (newContentResource);
newContentResource = undefined;
}
// new webpack.ContextReplacementPlugin(/selector/, /de|fr|hu/);
if (typeof newContentRecursive !== "boolean") {
newContentRegExp = /** @type {RegExp} */ (newContentRecursive);
newContentRecursive = undefined;
}
// new webpack.ContextReplacementPlugin(/selector/, './folder', false, /selector/);
this.newContentResource =
/** @type {string | undefined} */
(newContentResource);
this.newContentRecursive =
/** @type {boolean | undefined} */
(newContentRecursive);
this.newContentRegExp =
/** @type {RegExp | undefined} */
(newContentRegExp);
}
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
const resourceRegExp = this.resourceRegExp;
const newContentCallback = this.newContentCallback;
const newContentResource = this.newContentResource;
const newContentRecursive = this.newContentRecursive;
const newContentRegExp = this.newContentRegExp;
const newContentCreateContextMap = this.newContentCreateContextMap;
compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, cmf => {
cmf.hooks.beforeResolve.tap(PLUGIN_NAME, result => {
if (!result) return;
if (resourceRegExp.test(result.request)) {
if (newContentResource !== undefined) {
result.request = newContentResource;
}
if (newContentRecursive !== undefined) {
result.recursive = newContentRecursive;
}
if (newContentRegExp !== undefined) {
result.regExp = newContentRegExp;
}
if (typeof newContentCallback === "function") {
newContentCallback(result);
} else {
for (const d of result.dependencies) {
if (d.critical) d.critical = false;
}
}
}
return result;
});
cmf.hooks.afterResolve.tap(PLUGIN_NAME, result => {
if (!result) return;
if (resourceRegExp.test(result.resource)) {
if (newContentResource !== undefined) {
if (
newContentResource.startsWith("/") ||
(newContentResource.length > 1 && newContentResource[1] === ":")
) {
result.resource = newContentResource;
} else {
result.resource = join(
/** @type {InputFileSystem} */ (compiler.inputFileSystem),
result.resource,
newContentResource
);
}
}
if (newContentRecursive !== undefined) {
result.recursive = newContentRecursive;
}
if (newContentRegExp !== undefined) {
result.regExp = newContentRegExp;
}
if (typeof newContentCreateContextMap === "function") {
result.resolveDependencies =
createResolveDependenciesFromContextMap(
newContentCreateContextMap
);
}
if (typeof newContentCallback === "function") {
const origResource = result.resource;
newContentCallback(result);
if (
result.resource !== origResource &&
!result.resource.startsWith("/") &&
(result.resource.length <= 1 || result.resource[1] !== ":")
) {
// When the function changed it to an relative path
result.resource = join(
/** @type {InputFileSystem} */ (compiler.inputFileSystem),
origResource,
result.resource
);
}
} else {
for (const d of result.dependencies) {
if (d.critical) d.critical = false;
}
}
}
return result;
});
});
}
}
/**
* @param {(fs: InputFileSystem, callback: (err: null | Error, map: NewContentCreateContextMap) => void) => void} createContextMap create context map function
* @returns {(fs: InputFileSystem, options: ContextModuleOptions, callback: (err: null | Error, dependencies?: ContextElementDependency[]) => void) => void} resolve resolve dependencies from context map function
*/
const createResolveDependenciesFromContextMap =
createContextMap => (fs, options, callback) => {
createContextMap(fs, (err, map) => {
if (err) return callback(err);
const dependencies = Object.keys(map).map(
key =>
new ContextElementDependency(
map[key] + options.resourceQuery + options.resourceFragment,
key,
options.typePrefix,
/** @type {string} */
(options.category),
options.referencedExports
)
);
callback(null, dependencies);
});
};
module.exports = ContextReplacementPlugin;

174
app_vue/node_modules/webpack/lib/CssModule.js generated vendored Normal file
View File

@ -0,0 +1,174 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Alexander Akait @alexander-akait
*/
"use strict";
const NormalModule = require("./NormalModule");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./Module")} Module */
/** @typedef {import("./NormalModule").NormalModuleCreateData} NormalModuleCreateData */
/** @typedef {import("./RequestShortener")} RequestShortener */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {string | undefined} CssLayer */
/** @typedef {string | undefined} Supports */
/** @typedef {string | undefined} Media */
/** @typedef {[CssLayer, Supports, Media]} InheritanceItem */
/** @typedef {Array<InheritanceItem>} Inheritance */
/** @typedef {NormalModuleCreateData & { cssLayer: CssLayer, supports: Supports, media: Media, inheritance: Inheritance }} CSSModuleCreateData */
class CssModule extends NormalModule {
/**
* @param {CSSModuleCreateData} options options object
*/
constructor(options) {
super(options);
// Avoid override `layer` for `Module` class, because it is a feature to run module in specific layer
this.cssLayer = options.cssLayer;
this.supports = options.supports;
this.media = options.media;
this.inheritance = options.inheritance;
}
/**
* @returns {string} a unique identifier of the module
*/
identifier() {
let identifier = super.identifier();
if (this.cssLayer) {
identifier += `|${this.cssLayer}`;
}
if (this.supports) {
identifier += `|${this.supports}`;
}
if (this.media) {
identifier += `|${this.media}`;
}
if (this.inheritance) {
const inheritance = this.inheritance.map(
(item, index) =>
`inheritance_${index}|${item[0] || ""}|${item[1] || ""}|${
item[2] || ""
}`
);
identifier += `|${inheritance.join("|")}`;
}
// We generate extra code for HMR, so we need to invalidate the module
if (this.hot) {
identifier += `|${this.hot}`;
}
return identifier;
}
/**
* @param {RequestShortener} requestShortener the request shortener
* @returns {string} a user readable identifier of the module
*/
readableIdentifier(requestShortener) {
const readableIdentifier = super.readableIdentifier(requestShortener);
let identifier = `css ${readableIdentifier}`;
if (this.cssLayer) {
identifier += ` (layer: ${this.cssLayer})`;
}
if (this.supports) {
identifier += ` (supports: ${this.supports})`;
}
if (this.media) {
identifier += ` (media: ${this.media})`;
}
return identifier;
}
/**
* Assuming this module is in the cache. Update the (cached) module with
* the fresh module from the factory. Usually updates internal references
* and properties.
* @param {Module} module fresh module
* @returns {void}
*/
updateCacheModule(module) {
super.updateCacheModule(module);
const m = /** @type {CssModule} */ (module);
this.cssLayer = m.cssLayer;
this.supports = m.supports;
this.media = m.media;
this.inheritance = m.inheritance;
}
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.cssLayer);
write(this.supports);
write(this.media);
write(this.inheritance);
super.serialize(context);
}
/**
* @param {ObjectDeserializerContext} context context
* @returns {CssModule} the deserialized object
*/
static deserialize(context) {
const obj = new CssModule({
// will be deserialized by Module
layer: /** @type {EXPECTED_ANY} */ (null),
type: "",
// will be filled by updateCacheModule
resource: "",
context: "",
request: /** @type {EXPECTED_ANY} */ (null),
userRequest: /** @type {EXPECTED_ANY} */ (null),
rawRequest: /** @type {EXPECTED_ANY} */ (null),
loaders: /** @type {EXPECTED_ANY} */ (null),
matchResource: /** @type {EXPECTED_ANY} */ (null),
parser: /** @type {EXPECTED_ANY} */ (null),
parserOptions: /** @type {EXPECTED_ANY} */ (null),
generator: /** @type {EXPECTED_ANY} */ (null),
generatorOptions: /** @type {EXPECTED_ANY} */ (null),
resolveOptions: /** @type {EXPECTED_ANY} */ (null),
cssLayer: /** @type {EXPECTED_ANY} */ (null),
supports: /** @type {EXPECTED_ANY} */ (null),
media: /** @type {EXPECTED_ANY} */ (null),
inheritance: /** @type {EXPECTED_ANY} */ (null)
});
obj.deserialize(context);
return obj;
}
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.cssLayer = read();
this.supports = read();
this.media = read();
this.inheritance = read();
super.deserialize(context);
}
}
makeSerializable(CssModule, "webpack/lib/CssModule");
module.exports = CssModule;

720
app_vue/node_modules/webpack/lib/DefinePlugin.js generated vendored Normal file
View File

@ -0,0 +1,720 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const {
JAVASCRIPT_MODULE_TYPE_AUTO,
JAVASCRIPT_MODULE_TYPE_ESM,
JAVASCRIPT_MODULE_TYPE_DYNAMIC
} = require("./ModuleTypeConstants");
const RuntimeGlobals = require("./RuntimeGlobals");
const WebpackError = require("./WebpackError");
const ConstDependency = require("./dependencies/ConstDependency");
const BasicEvaluatedExpression = require("./javascript/BasicEvaluatedExpression");
const { VariableInfo } = require("./javascript/JavascriptParser");
const {
evaluateToString,
toConstantDependency
} = require("./javascript/JavascriptParserHelpers");
const createHash = require("./util/createHash");
/** @typedef {import("estree").Expression} Expression */
/** @typedef {import("../declarations/WebpackOptions").HashFunction} HashFunction */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Module").BuildInfo} BuildInfo */
/** @typedef {import("./Module").ValueCacheVersions} ValueCacheVersions */
/** @typedef {import("./NormalModule")} NormalModule */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("./javascript/JavascriptParser").DestructuringAssignmentProperty} DestructuringAssignmentProperty */
/** @typedef {import("./javascript/JavascriptParser").Range} Range */
/** @typedef {import("./logging/Logger").Logger} Logger */
/** @typedef {null | undefined | RegExp | EXPECTED_FUNCTION | string | number | boolean | bigint | undefined} CodeValuePrimitive */
/** @typedef {RecursiveArrayOrRecord<CodeValuePrimitive | RuntimeValue>} CodeValue */
/**
* @typedef {object} RuntimeValueOptions
* @property {string[]=} fileDependencies
* @property {string[]=} contextDependencies
* @property {string[]=} missingDependencies
* @property {string[]=} buildDependencies
* @property {string| (() => string)=} version
*/
/** @typedef {string | Set<string>} ValueCacheVersion */
/** @typedef {(value: { module: NormalModule, key: string, readonly version: ValueCacheVersion }) => CodeValuePrimitive} GeneratorFn */
class RuntimeValue {
/**
* @param {GeneratorFn} fn generator function
* @param {true | string[] | RuntimeValueOptions=} options options
*/
constructor(fn, options) {
this.fn = fn;
if (Array.isArray(options)) {
options = {
fileDependencies: options
};
}
this.options = options || {};
}
get fileDependencies() {
return this.options === true ? true : this.options.fileDependencies;
}
/**
* @param {JavascriptParser} parser the parser
* @param {ValueCacheVersions} valueCacheVersions valueCacheVersions
* @param {string} key the defined key
* @returns {CodeValuePrimitive} code
*/
exec(parser, valueCacheVersions, key) {
const buildInfo = /** @type {BuildInfo} */ (parser.state.module.buildInfo);
if (this.options === true) {
buildInfo.cacheable = false;
} else {
if (this.options.fileDependencies) {
for (const dep of this.options.fileDependencies) {
/** @type {NonNullable<BuildInfo["fileDependencies"]>} */
(buildInfo.fileDependencies).add(dep);
}
}
if (this.options.contextDependencies) {
for (const dep of this.options.contextDependencies) {
/** @type {NonNullable<BuildInfo["contextDependencies"]>} */
(buildInfo.contextDependencies).add(dep);
}
}
if (this.options.missingDependencies) {
for (const dep of this.options.missingDependencies) {
/** @type {NonNullable<BuildInfo["missingDependencies"]>} */
(buildInfo.missingDependencies).add(dep);
}
}
if (this.options.buildDependencies) {
for (const dep of this.options.buildDependencies) {
/** @type {NonNullable<BuildInfo["buildDependencies"]>} */
(buildInfo.buildDependencies).add(dep);
}
}
}
return this.fn({
module: parser.state.module,
key,
get version() {
return /** @type {ValueCacheVersion} */ (
valueCacheVersions.get(VALUE_DEP_PREFIX + key)
);
}
});
}
getCacheVersion() {
return this.options === true
? undefined
: (typeof this.options.version === "function"
? this.options.version()
: this.options.version) || "unset";
}
}
/**
* @param {Set<DestructuringAssignmentProperty> | undefined} properties properties
* @returns {Set<string> | undefined} used keys
*/
function getObjKeys(properties) {
if (!properties) return;
return new Set([...properties].map(p => p.id));
}
/** @typedef {Set<string> | null} ObjKeys */
/** @typedef {boolean | undefined | null} AsiSafe */
/**
* @param {EXPECTED_ANY[] | {[k: string]: EXPECTED_ANY}} obj obj
* @param {JavascriptParser} parser Parser
* @param {ValueCacheVersions} valueCacheVersions valueCacheVersions
* @param {string} key the defined key
* @param {RuntimeTemplate} runtimeTemplate the runtime template
* @param {Logger} logger the logger object
* @param {AsiSafe=} asiSafe asi safe (undefined: unknown, null: unneeded)
* @param {ObjKeys=} objKeys used keys
* @returns {string} code converted to string that evaluates
*/
const stringifyObj = (
obj,
parser,
valueCacheVersions,
key,
runtimeTemplate,
logger,
asiSafe,
objKeys
) => {
let code;
const arr = Array.isArray(obj);
if (arr) {
code = `[${obj
.map(code =>
toCode(
code,
parser,
valueCacheVersions,
key,
runtimeTemplate,
logger,
null
)
)
.join(",")}]`;
} else {
let keys = Object.keys(obj);
if (objKeys) {
keys = objKeys.size === 0 ? [] : keys.filter(k => objKeys.has(k));
}
code = `{${keys
.map(key => {
const code = obj[key];
return `${JSON.stringify(key)}:${toCode(
code,
parser,
valueCacheVersions,
key,
runtimeTemplate,
logger,
null
)}`;
})
.join(",")}}`;
}
switch (asiSafe) {
case null:
return code;
case true:
return arr ? code : `(${code})`;
case false:
return arr ? `;${code}` : `;(${code})`;
default:
return `/*#__PURE__*/Object(${code})`;
}
};
/**
* Convert code to a string that evaluates
* @param {CodeValue} code Code to evaluate
* @param {JavascriptParser} parser Parser
* @param {ValueCacheVersions} valueCacheVersions valueCacheVersions
* @param {string} key the defined key
* @param {RuntimeTemplate} runtimeTemplate the runtime template
* @param {Logger} logger the logger object
* @param {boolean | undefined | null=} asiSafe asi safe (undefined: unknown, null: unneeded)
* @param {ObjKeys=} objKeys used keys
* @returns {string} code converted to string that evaluates
*/
const toCode = (
code,
parser,
valueCacheVersions,
key,
runtimeTemplate,
logger,
asiSafe,
objKeys
) => {
const transformToCode = () => {
if (code === null) {
return "null";
}
if (code === undefined) {
return "undefined";
}
if (Object.is(code, -0)) {
return "-0";
}
if (code instanceof RuntimeValue) {
return toCode(
code.exec(parser, valueCacheVersions, key),
parser,
valueCacheVersions,
key,
runtimeTemplate,
logger,
asiSafe
);
}
if (code instanceof RegExp && code.toString) {
return code.toString();
}
if (typeof code === "function" && code.toString) {
return `(${code.toString()})`;
}
if (typeof code === "object") {
return stringifyObj(
code,
parser,
valueCacheVersions,
key,
runtimeTemplate,
logger,
asiSafe,
objKeys
);
}
if (typeof code === "bigint") {
return runtimeTemplate.supportsBigIntLiteral()
? `${code}n`
: `BigInt("${code}")`;
}
return `${code}`;
};
const strCode = transformToCode();
logger.debug(`Replaced "${key}" with "${strCode}"`);
return strCode;
};
/**
* @param {CodeValue} code code
* @returns {string | undefined} result
*/
const toCacheVersion = code => {
if (code === null) {
return "null";
}
if (code === undefined) {
return "undefined";
}
if (Object.is(code, -0)) {
return "-0";
}
if (code instanceof RuntimeValue) {
return code.getCacheVersion();
}
if (code instanceof RegExp && code.toString) {
return code.toString();
}
if (typeof code === "function" && code.toString) {
return `(${code.toString()})`;
}
if (typeof code === "object") {
const items = Object.keys(code).map(key => ({
key,
value: toCacheVersion(
/** @type {Record<string, EXPECTED_ANY>} */
(code)[key]
)
}));
if (items.some(({ value }) => value === undefined)) return;
return `{${items.map(({ key, value }) => `${key}: ${value}`).join(", ")}}`;
}
if (typeof code === "bigint") {
return `${code}n`;
}
return `${code}`;
};
const PLUGIN_NAME = "DefinePlugin";
const VALUE_DEP_PREFIX = `webpack/${PLUGIN_NAME} `;
const VALUE_DEP_MAIN = `webpack/${PLUGIN_NAME}_hash`;
const TYPEOF_OPERATOR_REGEXP = /^typeof\s+/;
const WEBPACK_REQUIRE_FUNCTION_REGEXP = new RegExp(
`${RuntimeGlobals.require}\\s*(!?\\.)`
);
const WEBPACK_REQUIRE_IDENTIFIER_REGEXP = new RegExp(RuntimeGlobals.require);
class DefinePlugin {
/**
* Create a new define plugin
* @param {Record<string, CodeValue>} definitions A map of global object definitions
*/
constructor(definitions) {
this.definitions = definitions;
}
/**
* @param {GeneratorFn} fn generator function
* @param {true | string[] | RuntimeValueOptions=} options options
* @returns {RuntimeValue} runtime value
*/
static runtimeValue(fn, options) {
return new RuntimeValue(fn, options);
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
const definitions = this.definitions;
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
const logger = compilation.getLogger("webpack.DefinePlugin");
compilation.dependencyTemplates.set(
ConstDependency,
new ConstDependency.Template()
);
const { runtimeTemplate } = compilation;
const mainHash = createHash(
/** @type {HashFunction} */
(compilation.outputOptions.hashFunction)
);
mainHash.update(
/** @type {string} */
(compilation.valueCacheVersions.get(VALUE_DEP_MAIN)) || ""
);
/**
* Handler
* @param {JavascriptParser} parser Parser
* @returns {void}
*/
const handler = parser => {
const mainValue =
/** @type {ValueCacheVersion} */
(compilation.valueCacheVersions.get(VALUE_DEP_MAIN));
parser.hooks.program.tap(PLUGIN_NAME, () => {
const buildInfo = /** @type {BuildInfo} */ (
parser.state.module.buildInfo
);
if (!buildInfo.valueDependencies)
buildInfo.valueDependencies = new Map();
buildInfo.valueDependencies.set(VALUE_DEP_MAIN, mainValue);
});
/**
* @param {string} key key
*/
const addValueDependency = key => {
const buildInfo =
/** @type {BuildInfo} */
(parser.state.module.buildInfo);
/** @type {NonNullable<BuildInfo["valueDependencies"]>} */
(buildInfo.valueDependencies).set(
VALUE_DEP_PREFIX + key,
/** @type {ValueCacheVersion} */
(compilation.valueCacheVersions.get(VALUE_DEP_PREFIX + key))
);
};
/**
* @template T
* @param {string} key key
* @param {(expression: Expression) => T} fn fn
* @returns {(expression: Expression) => T} result
*/
const withValueDependency =
(key, fn) =>
(...args) => {
addValueDependency(key);
return fn(...args);
};
/**
* Walk definitions
* @param {Record<string, CodeValue>} definitions Definitions map
* @param {string} prefix Prefix string
* @returns {void}
*/
const walkDefinitions = (definitions, prefix) => {
for (const key of Object.keys(definitions)) {
const code = definitions[key];
if (
code &&
typeof code === "object" &&
!(code instanceof RuntimeValue) &&
!(code instanceof RegExp)
) {
walkDefinitions(
/** @type {Record<string, CodeValue>} */ (code),
`${prefix + key}.`
);
applyObjectDefine(prefix + key, code);
continue;
}
applyDefineKey(prefix, key);
applyDefine(prefix + key, code);
}
};
/**
* Apply define key
* @param {string} prefix Prefix
* @param {string} key Key
* @returns {void}
*/
const applyDefineKey = (prefix, key) => {
const splittedKey = key.split(".");
const firstKey = splittedKey[0];
for (const [i, _] of splittedKey.slice(1).entries()) {
const fullKey = prefix + splittedKey.slice(0, i + 1).join(".");
parser.hooks.canRename.for(fullKey).tap(PLUGIN_NAME, () => {
addValueDependency(key);
if (
parser.scope.definitions.get(firstKey) instanceof VariableInfo
) {
return false;
}
return true;
});
}
};
/**
* Apply Code
* @param {string} key Key
* @param {CodeValue} code Code
* @returns {void}
*/
const applyDefine = (key, code) => {
const originalKey = key;
const isTypeof = TYPEOF_OPERATOR_REGEXP.test(key);
if (isTypeof) key = key.replace(TYPEOF_OPERATOR_REGEXP, "");
let recurse = false;
let recurseTypeof = false;
if (!isTypeof) {
parser.hooks.canRename.for(key).tap(PLUGIN_NAME, () => {
addValueDependency(originalKey);
return true;
});
parser.hooks.evaluateIdentifier
.for(key)
.tap(PLUGIN_NAME, expr => {
/**
* this is needed in case there is a recursion in the DefinePlugin
* to prevent an endless recursion
* e.g.: new DefinePlugin({
* "a": "b",
* "b": "a"
* });
*/
if (recurse) return;
addValueDependency(originalKey);
recurse = true;
const res = parser.evaluate(
toCode(
code,
parser,
compilation.valueCacheVersions,
key,
runtimeTemplate,
logger,
null
)
);
recurse = false;
res.setRange(/** @type {Range} */ (expr.range));
return res;
});
parser.hooks.expression.for(key).tap(PLUGIN_NAME, expr => {
addValueDependency(originalKey);
let strCode = toCode(
code,
parser,
compilation.valueCacheVersions,
originalKey,
runtimeTemplate,
logger,
!parser.isAsiPosition(/** @type {Range} */ (expr.range)[0]),
null
);
if (parser.scope.inShorthand) {
strCode = `${parser.scope.inShorthand}:${strCode}`;
}
if (WEBPACK_REQUIRE_FUNCTION_REGEXP.test(strCode)) {
return toConstantDependency(parser, strCode, [
RuntimeGlobals.require
])(expr);
} else if (WEBPACK_REQUIRE_IDENTIFIER_REGEXP.test(strCode)) {
return toConstantDependency(parser, strCode, [
RuntimeGlobals.requireScope
])(expr);
}
return toConstantDependency(parser, strCode)(expr);
});
}
parser.hooks.evaluateTypeof.for(key).tap(PLUGIN_NAME, expr => {
/**
* this is needed in case there is a recursion in the DefinePlugin
* to prevent an endless recursion
* e.g.: new DefinePlugin({
* "typeof a": "typeof b",
* "typeof b": "typeof a"
* });
*/
if (recurseTypeof) return;
recurseTypeof = true;
addValueDependency(originalKey);
const codeCode = toCode(
code,
parser,
compilation.valueCacheVersions,
originalKey,
runtimeTemplate,
logger,
null
);
const typeofCode = isTypeof ? codeCode : `typeof (${codeCode})`;
const res = parser.evaluate(typeofCode);
recurseTypeof = false;
res.setRange(/** @type {Range} */ (expr.range));
return res;
});
parser.hooks.typeof.for(key).tap(PLUGIN_NAME, expr => {
addValueDependency(originalKey);
const codeCode = toCode(
code,
parser,
compilation.valueCacheVersions,
originalKey,
runtimeTemplate,
logger,
null
);
const typeofCode = isTypeof ? codeCode : `typeof (${codeCode})`;
const res = parser.evaluate(typeofCode);
if (!res.isString()) return;
return toConstantDependency(
parser,
JSON.stringify(res.string)
).bind(parser)(expr);
});
};
/**
* Apply Object
* @param {string} key Key
* @param {object} obj Object
* @returns {void}
*/
const applyObjectDefine = (key, obj) => {
parser.hooks.canRename.for(key).tap(PLUGIN_NAME, () => {
addValueDependency(key);
return true;
});
parser.hooks.evaluateIdentifier.for(key).tap(PLUGIN_NAME, expr => {
addValueDependency(key);
return new BasicEvaluatedExpression()
.setTruthy()
.setSideEffects(false)
.setRange(/** @type {Range} */ (expr.range));
});
parser.hooks.evaluateTypeof
.for(key)
.tap(
PLUGIN_NAME,
withValueDependency(key, evaluateToString("object"))
);
parser.hooks.expression.for(key).tap(PLUGIN_NAME, expr => {
addValueDependency(key);
let strCode = stringifyObj(
obj,
parser,
compilation.valueCacheVersions,
key,
runtimeTemplate,
logger,
!parser.isAsiPosition(/** @type {Range} */ (expr.range)[0]),
getObjKeys(parser.destructuringAssignmentPropertiesFor(expr))
);
if (parser.scope.inShorthand) {
strCode = `${parser.scope.inShorthand}:${strCode}`;
}
if (WEBPACK_REQUIRE_FUNCTION_REGEXP.test(strCode)) {
return toConstantDependency(parser, strCode, [
RuntimeGlobals.require
])(expr);
} else if (WEBPACK_REQUIRE_IDENTIFIER_REGEXP.test(strCode)) {
return toConstantDependency(parser, strCode, [
RuntimeGlobals.requireScope
])(expr);
}
return toConstantDependency(parser, strCode)(expr);
});
parser.hooks.typeof
.for(key)
.tap(
PLUGIN_NAME,
withValueDependency(
key,
toConstantDependency(parser, JSON.stringify("object"))
)
);
};
walkDefinitions(definitions, "");
};
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_AUTO)
.tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
.tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_ESM)
.tap(PLUGIN_NAME, handler);
/**
* Walk definitions
* @param {Record<string, CodeValue>} definitions Definitions map
* @param {string} prefix Prefix string
* @returns {void}
*/
const walkDefinitionsForValues = (definitions, prefix) => {
for (const key of Object.keys(definitions)) {
const code = definitions[key];
const version = /** @type {string} */ (toCacheVersion(code));
const name = VALUE_DEP_PREFIX + prefix + key;
mainHash.update(`|${prefix}${key}`);
const oldVersion = compilation.valueCacheVersions.get(name);
if (oldVersion === undefined) {
compilation.valueCacheVersions.set(name, version);
} else if (oldVersion !== version) {
const warning = new WebpackError(
`${PLUGIN_NAME}\nConflicting values for '${prefix + key}'`
);
warning.details = `'${oldVersion}' !== '${version}'`;
warning.hideStack = true;
compilation.warnings.push(warning);
}
if (
code &&
typeof code === "object" &&
!(code instanceof RuntimeValue) &&
!(code instanceof RegExp)
) {
walkDefinitionsForValues(
/** @type {Record<string, CodeValue>} */ (code),
`${prefix + key}.`
);
}
}
};
walkDefinitionsForValues(definitions, "");
compilation.valueCacheVersions.set(
VALUE_DEP_MAIN,
/** @type {string} */ (mainHash.digest("hex").slice(0, 8))
);
}
);
}
}
module.exports = DefinePlugin;

274
app_vue/node_modules/webpack/lib/DelegatedModule.js generated vendored Normal file
View File

@ -0,0 +1,274 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { OriginalSource, RawSource } = require("webpack-sources");
const Module = require("./Module");
const { JS_TYPES } = require("./ModuleSourceTypesConstants");
const { JAVASCRIPT_MODULE_TYPE_DYNAMIC } = require("./ModuleTypeConstants");
const RuntimeGlobals = require("./RuntimeGlobals");
const DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
const StaticExportsDependency = require("./dependencies/StaticExportsDependency");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./Compilation")} Compilation */
/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
/** @typedef {import("./Generator").SourceTypes} SourceTypes */
/** @typedef {import("./LibManifestPlugin").ManifestModuleData} ManifestModuleData */
/** @typedef {import("./Module").BuildCallback} BuildCallback */
/** @typedef {import("./Module").BuildMeta} BuildMeta */
/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */
/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */
/** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */
/** @typedef {import("./Module").NeedBuildCallback} NeedBuildCallback */
/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */
/** @typedef {import("./Module").SourceContext} SourceContext */
/** @typedef {import("./RequestShortener")} RequestShortener */
/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./WebpackError")} WebpackError */
/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
/** @typedef {string} DelegatedModuleSourceRequest */
/** @typedef {NonNullable<DllReferencePluginOptions["type"]>} DelegatedModuleType */
/**
* @typedef {object} DelegatedModuleData
* @property {BuildMeta=} buildMeta build meta
* @property {true | string[]=} exports exports
* @property {number | string} id module id
*/
const RUNTIME_REQUIREMENTS = new Set([
RuntimeGlobals.module,
RuntimeGlobals.require
]);
class DelegatedModule extends Module {
/**
* @param {DelegatedModuleSourceRequest} sourceRequest source request
* @param {DelegatedModuleData} data data
* @param {DelegatedModuleType} type type
* @param {string} userRequest user request
* @param {string | Module} originalRequest original request
*/
constructor(sourceRequest, data, type, userRequest, originalRequest) {
super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);
// Info from Factory
this.sourceRequest = sourceRequest;
this.request = data.id;
this.delegationType = type;
this.userRequest = userRequest;
this.originalRequest = originalRequest;
this.delegateData = data;
// Build info
this.delegatedSourceDependency = undefined;
}
/**
* @returns {SourceTypes} types available (do not mutate)
*/
getSourceTypes() {
return JS_TYPES;
}
/**
* @param {LibIdentOptions} options options
* @returns {string | null} an identifier for library inclusion
*/
libIdent(options) {
return typeof this.originalRequest === "string"
? this.originalRequest
: this.originalRequest.libIdent(options);
}
/**
* @returns {string} a unique identifier of the module
*/
identifier() {
return `delegated ${JSON.stringify(this.request)} from ${
this.sourceRequest
}`;
}
/**
* @param {RequestShortener} requestShortener the request shortener
* @returns {string} a user readable identifier of the module
*/
readableIdentifier(requestShortener) {
return `delegated ${this.userRequest} from ${this.sourceRequest}`;
}
/**
* @param {NeedBuildContext} context context info
* @param {NeedBuildCallback} callback callback function, returns true, if the module needs a rebuild
* @returns {void}
*/
needBuild(context, callback) {
return callback(null, !this.buildMeta);
}
/**
* @param {WebpackOptions} options webpack options
* @param {Compilation} compilation the compilation
* @param {ResolverWithOptions} resolver the resolver
* @param {InputFileSystem} fs the file system
* @param {BuildCallback} callback callback function
* @returns {void}
*/
build(options, compilation, resolver, fs, callback) {
const delegateData = /** @type {ManifestModuleData} */ (this.delegateData);
this.buildMeta = { ...delegateData.buildMeta };
this.buildInfo = {};
this.dependencies.length = 0;
this.delegatedSourceDependency = new DelegatedSourceDependency(
this.sourceRequest
);
this.addDependency(this.delegatedSourceDependency);
this.addDependency(
new StaticExportsDependency(delegateData.exports || true, false)
);
callback();
}
/**
* @param {CodeGenerationContext} context context for code generation
* @returns {CodeGenerationResult} result
*/
codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) {
const dep = /** @type {DelegatedSourceDependency} */ (this.dependencies[0]);
const sourceModule = moduleGraph.getModule(dep);
let str;
if (!sourceModule) {
str = runtimeTemplate.throwMissingModuleErrorBlock({
request: this.sourceRequest
});
} else {
str = `module.exports = (${runtimeTemplate.moduleExports({
module: sourceModule,
chunkGraph,
request: dep.request,
runtimeRequirements: new Set()
})})`;
switch (this.delegationType) {
case "require":
str += `(${JSON.stringify(this.request)})`;
break;
case "object":
str += `[${JSON.stringify(this.request)}]`;
break;
}
str += ";";
}
const sources = new Map();
if (this.useSourceMap || this.useSimpleSourceMap) {
sources.set("javascript", new OriginalSource(str, this.identifier()));
} else {
sources.set("javascript", new RawSource(str));
}
return {
sources,
runtimeRequirements: RUNTIME_REQUIREMENTS
};
}
/**
* @param {string=} type the source type for which the size should be estimated
* @returns {number} the estimated size of the module (must be non-zero)
*/
size(type) {
return 42;
}
/**
* @param {Hash} hash the hash used to track dependencies
* @param {UpdateHashContext} context context
* @returns {void}
*/
updateHash(hash, context) {
hash.update(this.delegationType);
hash.update(JSON.stringify(this.request));
super.updateHash(hash, context);
}
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
// constructor
write(this.sourceRequest);
write(this.delegateData);
write(this.delegationType);
write(this.userRequest);
write(this.originalRequest);
super.serialize(context);
}
/**
* @param {ObjectDeserializerContext} context context\
* @returns {DelegatedModule} DelegatedModule
*/
static deserialize(context) {
const { read } = context;
const obj = new DelegatedModule(
read(), // sourceRequest
read(), // delegateData
read(), // delegationType
read(), // userRequest
read() // originalRequest
);
obj.deserialize(context);
return obj;
}
/**
* Assuming this module is in the cache. Update the (cached) module with
* the fresh module from the factory. Usually updates internal references
* and properties.
* @param {Module} module fresh module
* @returns {void}
*/
updateCacheModule(module) {
super.updateCacheModule(module);
const m = /** @type {DelegatedModule} */ (module);
this.delegationType = m.delegationType;
this.userRequest = m.userRequest;
this.originalRequest = m.originalRequest;
this.delegateData = m.delegateData;
}
/**
* Assuming this module is in the cache. Remove internal references to allow freeing some memory.
*/
cleanupForCache() {
super.cleanupForCache();
this.delegateData =
/** @type {EXPECTED_ANY} */
(undefined);
}
}
makeSerializable(DelegatedModule, "webpack/lib/DelegatedModule");
module.exports = DelegatedModule;

View File

@ -0,0 +1,114 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const DelegatedModule = require("./DelegatedModule");
/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */
/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptionsContent} DllReferencePluginOptionsContent */
/** @typedef {import("./DelegatedModule").DelegatedModuleSourceRequest} DelegatedModuleSourceRequest */
/** @typedef {import("./DelegatedModule").DelegatedModuleType} DelegatedModuleType */
/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */
/** @typedef {import("./util/identifier").AssociatedObjectForCache} AssociatedObjectForCache */
/**
* @typedef {object} Options
* @property {DelegatedModuleSourceRequest} source source
* @property {NonNullable<DllReferencePluginOptions["context"]>} context absolute context path to which lib ident is relative to
* @property {DllReferencePluginOptionsContent} content content
* @property {DllReferencePluginOptions["type"]} type type
* @property {DllReferencePluginOptions["extensions"]} extensions extensions
* @property {DllReferencePluginOptions["scope"]} scope scope
* @property {AssociatedObjectForCache=} associatedObjectForCache object for caching
*/
class DelegatedModuleFactoryPlugin {
/**
* @param {Options} options options
*/
constructor(options) {
this.options = options;
options.type = options.type || "require";
options.extensions = options.extensions || ["", ".js", ".json", ".wasm"];
}
/**
* @param {NormalModuleFactory} normalModuleFactory the normal module factory
* @returns {void}
*/
apply(normalModuleFactory) {
const scope = this.options.scope;
if (scope) {
normalModuleFactory.hooks.factorize.tapAsync(
"DelegatedModuleFactoryPlugin",
(data, callback) => {
const [dependency] = data.dependencies;
const { request } = dependency;
if (request && request.startsWith(`${scope}/`)) {
const innerRequest = `.${request.slice(scope.length)}`;
let resolved;
if (innerRequest in this.options.content) {
resolved = this.options.content[innerRequest];
return callback(
null,
new DelegatedModule(
this.options.source,
resolved,
/** @type {DelegatedModuleType} */
(this.options.type),
innerRequest,
request
)
);
}
const extensions =
/** @type {string[]} */
(this.options.extensions);
for (let i = 0; i < extensions.length; i++) {
const extension = extensions[i];
const requestPlusExt = innerRequest + extension;
if (requestPlusExt in this.options.content) {
resolved = this.options.content[requestPlusExt];
return callback(
null,
new DelegatedModule(
this.options.source,
resolved,
/** @type {DelegatedModuleType} */
(this.options.type),
requestPlusExt,
request + extension
)
);
}
}
}
return callback();
}
);
} else {
normalModuleFactory.hooks.module.tap(
"DelegatedModuleFactoryPlugin",
module => {
const request = module.libIdent(this.options);
if (request && request in this.options.content) {
const resolved = this.options.content[request];
return new DelegatedModule(
this.options.source,
resolved,
/** @type {DelegatedModuleType} */
(this.options.type),
request,
module
);
}
return module;
}
);
}
}
}
module.exports = DelegatedModuleFactoryPlugin;

49
app_vue/node_modules/webpack/lib/DelegatedPlugin.js generated vendored Normal file
View File

@ -0,0 +1,49 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
const DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./DelegatedModuleFactoryPlugin").Options} Options */
const PLUGIN_NAME = "DelegatedPlugin";
class DelegatedPlugin {
/**
* @param {Options} options options
*/
constructor(options) {
this.options = options;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
compilation.dependencyFactories.set(
DelegatedSourceDependency,
normalModuleFactory
);
}
);
compiler.hooks.compile.tap(PLUGIN_NAME, ({ normalModuleFactory }) => {
new DelegatedModuleFactoryPlugin({
associatedObjectForCache: compiler.root,
...this.options
}).apply(normalModuleFactory);
});
}
}
module.exports = DelegatedPlugin;

122
app_vue/node_modules/webpack/lib/DependenciesBlock.js generated vendored Normal file
View File

@ -0,0 +1,122 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./ChunkGroup")} ChunkGroup */
/** @typedef {import("./Dependency")} Dependency */
/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {(d: Dependency) => boolean} DependencyFilterFunction */
/**
* DependenciesBlock is the base class for all Module classes in webpack. It describes a
* "block" of dependencies which are pointers to other DependenciesBlock instances. For example
* when a Module has a CommonJs require statement, the DependencyBlock for the CommonJs module
* would be added as a dependency to the Module. DependenciesBlock is inherited by two types of classes:
* Module subclasses and AsyncDependenciesBlock subclasses. The only difference between the two is that
* AsyncDependenciesBlock subclasses are used for code-splitting (async boundary) and Module subclasses are not.
*/
class DependenciesBlock {
constructor() {
/** @type {Dependency[]} */
this.dependencies = [];
/** @type {AsyncDependenciesBlock[]} */
this.blocks = [];
/** @type {DependenciesBlock | undefined} */
this.parent = undefined;
}
getRootBlock() {
/** @type {DependenciesBlock} */
let current = this;
while (current.parent) current = current.parent;
return current;
}
/**
* Adds a DependencyBlock to DependencyBlock relationship.
* This is used for when a Module has a AsyncDependencyBlock tie (for code-splitting)
* @param {AsyncDependenciesBlock} block block being added
* @returns {void}
*/
addBlock(block) {
this.blocks.push(block);
block.parent = this;
}
/**
* @param {Dependency} dependency dependency being tied to block.
* This is an "edge" pointing to another "node" on module graph.
* @returns {void}
*/
addDependency(dependency) {
this.dependencies.push(dependency);
}
/**
* @param {Dependency} dependency dependency being removed
* @returns {void}
*/
removeDependency(dependency) {
const idx = this.dependencies.indexOf(dependency);
if (idx >= 0) {
this.dependencies.splice(idx, 1);
}
}
/**
* Removes all dependencies and blocks
* @returns {void}
*/
clearDependenciesAndBlocks() {
this.dependencies.length = 0;
this.blocks.length = 0;
}
/**
* @param {Hash} hash the hash used to track dependencies
* @param {UpdateHashContext} context context
* @returns {void}
*/
updateHash(hash, context) {
for (const dep of this.dependencies) {
dep.updateHash(hash, context);
}
for (const block of this.blocks) {
block.updateHash(hash, context);
}
}
/**
* @param {ObjectSerializerContext} context context
*/
serialize({ write }) {
write(this.dependencies);
write(this.blocks);
}
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize({ read }) {
this.dependencies = read();
this.blocks = read();
for (const block of this.blocks) {
block.parent = this;
}
}
}
makeSerializable(DependenciesBlock, "webpack/lib/DependenciesBlock");
module.exports = DependenciesBlock;

372
app_vue/node_modules/webpack/lib/Dependency.js generated vendored Normal file
View File

@ -0,0 +1,372 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const RawModule = require("./RawModule");
const memoize = require("./util/memoize");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ModuleGraph")} ModuleGraph */
/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */
/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./WebpackError")} WebpackError */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/**
* @typedef {object} UpdateHashContext
* @property {ChunkGraph} chunkGraph
* @property {RuntimeSpec} runtime
* @property {RuntimeTemplate=} runtimeTemplate
*/
/**
* @typedef {object} SourcePosition
* @property {number} line
* @property {number=} column
*/
/**
* @typedef {object} RealDependencyLocation
* @property {SourcePosition} start
* @property {SourcePosition=} end
* @property {number=} index
*/
/**
* @typedef {object} SyntheticDependencyLocation
* @property {string} name
* @property {number=} index
*/
/** @typedef {SyntheticDependencyLocation | RealDependencyLocation} DependencyLocation */
/**
* @typedef {object} ExportSpec
* @property {string} name the name of the export
* @property {boolean=} canMangle can the export be renamed (defaults to true)
* @property {boolean=} terminalBinding is the export a terminal binding that should be checked for export star conflicts
* @property {(string | ExportSpec)[]=} exports nested exports
* @property {ModuleGraphConnection=} from when reexported: from which module
* @property {string[] | null=} export when reexported: from which export
* @property {number=} priority when reexported: with which priority
* @property {boolean=} hidden export is not visible, because another export blends over it
*/
/**
* @typedef {object} ExportsSpec
* @property {(string | ExportSpec)[] | true | null} exports exported names, true for unknown exports or null for no exports
* @property {Set<string>=} excludeExports when exports = true, list of unaffected exports
* @property {(Set<string> | null)=} hideExports list of maybe prior exposed, but now hidden exports
* @property {ModuleGraphConnection=} from when reexported: from which module
* @property {number=} priority when reexported: with which priority
* @property {boolean=} canMangle can the export be renamed (defaults to true)
* @property {boolean=} terminalBinding are the exports terminal bindings that should be checked for export star conflicts
* @property {Module[]=} dependencies module on which the result depends on
*/
/**
* @typedef {object} ReferencedExport
* @property {string[]} name name of the referenced export
* @property {boolean=} canMangle when false, referenced export can not be mangled, defaults to true
*/
/** @typedef {(moduleGraphConnection: ModuleGraphConnection, runtime: RuntimeSpec) => ConnectionState} GetConditionFn */
const TRANSITIVE = Symbol("transitive");
const getIgnoredModule = memoize(
() => new RawModule("/* (ignored) */", "ignored", "(ignored)")
);
class Dependency {
constructor() {
/** @type {Module | undefined} */
this._parentModule = undefined;
/** @type {DependenciesBlock | undefined} */
this._parentDependenciesBlock = undefined;
/** @type {number} */
this._parentDependenciesBlockIndex = -1;
// TODO check if this can be moved into ModuleDependency
/** @type {boolean} */
this.weak = false;
// TODO check if this can be moved into ModuleDependency
/** @type {boolean} */
this.optional = false;
this._locSL = 0;
this._locSC = 0;
this._locEL = 0;
this._locEC = 0;
this._locI = undefined;
this._locN = undefined;
this._loc = undefined;
}
/**
* @returns {string} a display name for the type of dependency
*/
get type() {
return "unknown";
}
/**
* @returns {string} a dependency category, typical categories are "commonjs", "amd", "esm"
*/
get category() {
return "unknown";
}
/**
* @returns {DependencyLocation} location
*/
get loc() {
if (this._loc !== undefined) return this._loc;
/** @type {SyntheticDependencyLocation & RealDependencyLocation} */
const loc = {};
if (this._locSL > 0) {
loc.start = { line: this._locSL, column: this._locSC };
}
if (this._locEL > 0) {
loc.end = { line: this._locEL, column: this._locEC };
}
if (this._locN !== undefined) {
loc.name = this._locN;
}
if (this._locI !== undefined) {
loc.index = this._locI;
}
return (this._loc = loc);
}
set loc(loc) {
if ("start" in loc && typeof loc.start === "object") {
this._locSL = loc.start.line || 0;
this._locSC = loc.start.column || 0;
} else {
this._locSL = 0;
this._locSC = 0;
}
if ("end" in loc && typeof loc.end === "object") {
this._locEL = loc.end.line || 0;
this._locEC = loc.end.column || 0;
} else {
this._locEL = 0;
this._locEC = 0;
}
this._locI = "index" in loc ? loc.index : undefined;
this._locN = "name" in loc ? loc.name : undefined;
this._loc = loc;
}
/**
* @param {number} startLine start line
* @param {number} startColumn start column
* @param {number} endLine end line
* @param {number} endColumn end column
*/
setLoc(startLine, startColumn, endLine, endColumn) {
this._locSL = startLine;
this._locSC = startColumn;
this._locEL = endLine;
this._locEC = endColumn;
this._locI = undefined;
this._locN = undefined;
this._loc = undefined;
}
/**
* @returns {string | undefined} a request context
*/
getContext() {
return undefined;
}
/**
* @returns {string | null} an identifier to merge equal requests
*/
getResourceIdentifier() {
return null;
}
/**
* @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module
*/
couldAffectReferencingModule() {
return TRANSITIVE;
}
/**
* Returns the referenced module and export
* @deprecated
* @param {ModuleGraph} moduleGraph module graph
* @returns {never} throws error
*/
getReference(moduleGraph) {
throw new Error(
"Dependency.getReference was removed in favor of Dependency.getReferencedExports, ModuleGraph.getModule and ModuleGraph.getConnection().active"
);
}
/**
* Returns list of exports referenced by this dependency
* @param {ModuleGraph} moduleGraph module graph
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
* @returns {(string[] | ReferencedExport)[]} referenced exports
*/
getReferencedExports(moduleGraph, runtime) {
return Dependency.EXPORTS_OBJECT_REFERENCED;
}
/**
* @param {ModuleGraph} moduleGraph module graph
* @returns {null | false | GetConditionFn} function to determine if the connection is active
*/
getCondition(moduleGraph) {
return null;
}
/**
* Returns the exported names
* @param {ModuleGraph} moduleGraph module graph
* @returns {ExportsSpec | undefined} export names
*/
getExports(moduleGraph) {
return undefined;
}
/**
* Returns warnings
* @param {ModuleGraph} moduleGraph module graph
* @returns {WebpackError[] | null | undefined} warnings
*/
getWarnings(moduleGraph) {
return null;
}
/**
* Returns errors
* @param {ModuleGraph} moduleGraph module graph
* @returns {WebpackError[] | null | undefined} errors
*/
getErrors(moduleGraph) {
return null;
}
/**
* Update the hash
* @param {Hash} hash hash to be updated
* @param {UpdateHashContext} context context
* @returns {void}
*/
updateHash(hash, context) {}
/**
* implement this method to allow the occurrence order plugin to count correctly
* @returns {number} count how often the id is used in this dependency
*/
getNumberOfIdOccurrences() {
return 1;
}
/**
* @param {ModuleGraph} moduleGraph the module graph
* @returns {ConnectionState} how this dependency connects the module to referencing modules
*/
getModuleEvaluationSideEffectsState(moduleGraph) {
return true;
}
/**
* @param {string} context context directory
* @returns {Module} ignored module
*/
createIgnoredModule(context) {
return getIgnoredModule();
}
/**
* @param {ObjectSerializerContext} context context
*/
serialize({ write }) {
write(this.weak);
write(this.optional);
write(this._locSL);
write(this._locSC);
write(this._locEL);
write(this._locEC);
write(this._locI);
write(this._locN);
}
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize({ read }) {
this.weak = read();
this.optional = read();
this._locSL = read();
this._locSC = read();
this._locEL = read();
this._locEC = read();
this._locI = read();
this._locN = read();
}
}
/** @type {string[][]} */
Dependency.NO_EXPORTS_REFERENCED = [];
/** @type {string[][]} */
Dependency.EXPORTS_OBJECT_REFERENCED = [[]];
// TODO remove in webpack 6
Object.defineProperty(Dependency.prototype, "module", {
/**
* @deprecated
* @returns {EXPECTED_ANY} throws
*/
get() {
throw new Error(
"module property was removed from Dependency (use compilation.moduleGraph.getModule(dependency) instead)"
);
},
/**
* @deprecated
* @returns {never} throws
*/
set() {
throw new Error(
"module property was removed from Dependency (use compilation.moduleGraph.updateModule(dependency, module) instead)"
);
}
});
// TODO remove in webpack 6
Object.defineProperty(Dependency.prototype, "disconnect", {
/**
* @deprecated
* @returns {EXPECTED_ANY} throws
*/
get() {
throw new Error(
"disconnect was removed from Dependency (Dependency no longer carries graph specific information)"
);
}
});
Dependency.TRANSITIVE = TRANSITIVE;
module.exports = Dependency;

69
app_vue/node_modules/webpack/lib/DependencyTemplate.js generated vendored Normal file
View File

@ -0,0 +1,69 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
/** @typedef {import("./ConcatenationScope")} ConcatenationScope */
/** @typedef {import("./Dependency")} Dependency */
/** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
/** @typedef {import("./Generator").GenerateContext} GenerateContext */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./Module").RuntimeRequirements} RuntimeRequirements */
/** @typedef {import("./ModuleGraph")} ModuleGraph */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/**
* @template T
* @typedef {import("./InitFragment")<T>} InitFragment
*/
/**
* @typedef {object} DependencyTemplateContext
* @property {RuntimeTemplate} runtimeTemplate the runtime template
* @property {DependencyTemplates} dependencyTemplates the dependency templates
* @property {ModuleGraph} moduleGraph the module graph
* @property {ChunkGraph} chunkGraph the chunk graph
* @property {RuntimeRequirements} runtimeRequirements the requirements for runtime
* @property {Module} module current module
* @property {RuntimeSpec} runtime current runtimes, for which code is generated
* @property {InitFragment<GenerateContext>[]} initFragments mutable array of init fragments for the current module
* @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules
* @property {CodeGenerationResults} codeGenerationResults the code generation results
* @property {InitFragment<GenerateContext>[]} chunkInitFragments chunkInitFragments
*/
/**
* @typedef {object} CssDependencyTemplateContextExtras
* @property {CssData} cssData the css exports data
*/
/**
* @typedef {object} CssData
* @property {boolean} esModule whether export __esModule
* @property {Map<string, string>} exports the css exports
*/
/** @typedef {DependencyTemplateContext & CssDependencyTemplateContextExtras} CssDependencyTemplateContext */
class DependencyTemplate {
/* istanbul ignore next */
/**
* @abstract
* @param {Dependency} dependency the dependency for which the template should be applied
* @param {ReplaceSource} source the current replace source which can be modified
* @param {DependencyTemplateContext} templateContext the context object
* @returns {void}
*/
apply(dependency, source, templateContext) {
const AbstractMethodError = require("./AbstractMethodError");
throw new AbstractMethodError();
}
}
module.exports = DependencyTemplate;

View File

@ -0,0 +1,68 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { DEFAULTS } = require("./config/defaults");
const createHash = require("./util/createHash");
/** @typedef {import("./Dependency")} Dependency */
/** @typedef {import("./DependencyTemplate")} DependencyTemplate */
/** @typedef {typeof import("./util/Hash")} Hash */
/** @typedef {new (...args: EXPECTED_ANY[]) => Dependency} DependencyConstructor */
class DependencyTemplates {
/**
* @param {string | Hash} hashFunction the hash function to use
*/
constructor(hashFunction = DEFAULTS.HASH_FUNCTION) {
/** @type {Map<DependencyConstructor, DependencyTemplate>} */
this._map = new Map();
/** @type {string} */
this._hash = "31d6cfe0d16ae931b73c59d7e0c089c0";
this._hashFunction = hashFunction;
}
/**
* @param {DependencyConstructor} dependency Constructor of Dependency
* @returns {DependencyTemplate | undefined} template for this dependency
*/
get(dependency) {
return this._map.get(dependency);
}
/**
* @param {DependencyConstructor} dependency Constructor of Dependency
* @param {DependencyTemplate} dependencyTemplate template for this dependency
* @returns {void}
*/
set(dependency, dependencyTemplate) {
this._map.set(dependency, dependencyTemplate);
}
/**
* @param {string} part additional hash contributor
* @returns {void}
*/
updateHash(part) {
const hash = createHash(this._hashFunction);
hash.update(`${this._hash}${part}`);
this._hash = /** @type {string} */ (hash.digest("hex"));
}
getHash() {
return this._hash;
}
clone() {
const newInstance = new DependencyTemplates(this._hashFunction);
newInstance._map = new Map(this._map);
newInstance._hash = this._hash;
return newInstance;
}
}
module.exports = DependencyTemplates;

74
app_vue/node_modules/webpack/lib/DllEntryPlugin.js generated vendored Normal file
View File

@ -0,0 +1,74 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const DllModuleFactory = require("./DllModuleFactory");
const DllEntryDependency = require("./dependencies/DllEntryDependency");
const EntryDependency = require("./dependencies/EntryDependency");
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {string[]} Entries */
/** @typedef {{ name: string, filename: TODO }} Options */
const PLUGIN_NAME = "DllEntryPlugin";
class DllEntryPlugin {
/**
* @param {string} context context
* @param {Entries} entries entry names
* @param {Options} options options
*/
constructor(context, entries, options) {
this.context = context;
this.entries = entries;
this.options = options;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
const dllModuleFactory = new DllModuleFactory();
compilation.dependencyFactories.set(
DllEntryDependency,
dllModuleFactory
);
compilation.dependencyFactories.set(
EntryDependency,
normalModuleFactory
);
}
);
compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {
compilation.addEntry(
this.context,
new DllEntryDependency(
this.entries.map((e, idx) => {
const dep = new EntryDependency(e);
dep.loc = {
name: this.options.name,
index: idx
};
return dep;
}),
this.options.name
),
this.options,
error => {
if (error) return callback(error);
callback();
}
);
});
}
}
module.exports = DllEntryPlugin;

176
app_vue/node_modules/webpack/lib/DllModule.js generated vendored Normal file
View File

@ -0,0 +1,176 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { RawSource } = require("webpack-sources");
const Module = require("./Module");
const { JS_TYPES } = require("./ModuleSourceTypesConstants");
const { JAVASCRIPT_MODULE_TYPE_DYNAMIC } = require("./ModuleTypeConstants");
const RuntimeGlobals = require("./RuntimeGlobals");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./Compilation")} Compilation */
/** @typedef {import("./Dependency")} Dependency */
/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
/** @typedef {import("./Generator").SourceTypes} SourceTypes */
/** @typedef {import("./Module").BuildCallback} BuildCallback */
/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */
/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */
/** @typedef {import("./Module").NeedBuildCallback} NeedBuildCallback */
/** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */
/** @typedef {import("./Module").SourceContext} SourceContext */
/** @typedef {import("./RequestShortener")} RequestShortener */
/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./WebpackError")} WebpackError */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
const RUNTIME_REQUIREMENTS = new Set([
RuntimeGlobals.require,
RuntimeGlobals.module
]);
class DllModule extends Module {
/**
* @param {string} context context path
* @param {Dependency[]} dependencies dependencies
* @param {string} name name
*/
constructor(context, dependencies, name) {
super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, context);
// Info from Factory
/** @type {Dependency[]} */
this.dependencies = dependencies;
this.name = name;
}
/**
* @returns {SourceTypes} types available (do not mutate)
*/
getSourceTypes() {
return JS_TYPES;
}
/**
* @returns {string} a unique identifier of the module
*/
identifier() {
return `dll ${this.name}`;
}
/**
* @param {RequestShortener} requestShortener the request shortener
* @returns {string} a user readable identifier of the module
*/
readableIdentifier(requestShortener) {
return `dll ${this.name}`;
}
/**
* @param {WebpackOptions} options webpack options
* @param {Compilation} compilation the compilation
* @param {ResolverWithOptions} resolver the resolver
* @param {InputFileSystem} fs the file system
* @param {BuildCallback} callback callback function
* @returns {void}
*/
build(options, compilation, resolver, fs, callback) {
this.buildMeta = {};
this.buildInfo = {};
return callback();
}
/**
* @param {CodeGenerationContext} context context for code generation
* @returns {CodeGenerationResult} result
*/
codeGeneration(context) {
const sources = new Map();
sources.set(
"javascript",
new RawSource(`module.exports = ${RuntimeGlobals.require};`)
);
return {
sources,
runtimeRequirements: RUNTIME_REQUIREMENTS
};
}
/**
* @param {NeedBuildContext} context context info
* @param {NeedBuildCallback} callback callback function, returns true, if the module needs a rebuild
* @returns {void}
*/
needBuild(context, callback) {
return callback(null, !this.buildMeta);
}
/**
* @param {string=} type the source type for which the size should be estimated
* @returns {number} the estimated size of the module (must be non-zero)
*/
size(type) {
return 12;
}
/**
* @param {Hash} hash the hash used to track dependencies
* @param {UpdateHashContext} context context
* @returns {void}
*/
updateHash(hash, context) {
hash.update(`dll module${this.name || ""}`);
super.updateHash(hash, context);
}
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
context.write(this.name);
super.serialize(context);
}
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
this.name = context.read();
super.deserialize(context);
}
/**
* Assuming this module is in the cache. Update the (cached) module with
* the fresh module from the factory. Usually updates internal references
* and properties.
* @param {Module} module fresh module
* @returns {void}
*/
updateCacheModule(module) {
super.updateCacheModule(module);
this.dependencies = module.dependencies;
}
/**
* Assuming this module is in the cache. Remove internal references to allow freeing some memory.
*/
cleanupForCache() {
super.cleanupForCache();
this.dependencies = /** @type {EXPECTED_ANY} */ (undefined);
}
}
makeSerializable(DllModule, "webpack/lib/DllModule");
module.exports = DllModule;

38
app_vue/node_modules/webpack/lib/DllModuleFactory.js generated vendored Normal file
View File

@ -0,0 +1,38 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const DllModule = require("./DllModule");
const ModuleFactory = require("./ModuleFactory");
/** @typedef {import("./ModuleFactory").ModuleFactoryCallback} ModuleFactoryCallback */
/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */
/** @typedef {import("./dependencies/DllEntryDependency")} DllEntryDependency */
class DllModuleFactory extends ModuleFactory {
constructor() {
super();
this.hooks = Object.freeze({});
}
/**
* @param {ModuleFactoryCreateData} data data object
* @param {ModuleFactoryCallback} callback callback
* @returns {void}
*/
create(data, callback) {
const dependency = /** @type {DllEntryDependency} */ (data.dependencies[0]);
callback(null, {
module: new DllModule(
data.context,
dependency.dependencies,
dependency.name
)
});
}
}
module.exports = DllModuleFactory;

72
app_vue/node_modules/webpack/lib/DllPlugin.js generated vendored Normal file
View File

@ -0,0 +1,72 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const DllEntryPlugin = require("./DllEntryPlugin");
const FlagAllModulesAsUsedPlugin = require("./FlagAllModulesAsUsedPlugin");
const LibManifestPlugin = require("./LibManifestPlugin");
const createSchemaValidation = require("./util/create-schema-validation");
/** @typedef {import("../declarations/plugins/DllPlugin").DllPluginOptions} DllPluginOptions */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./DllEntryPlugin").Entries} Entries */
/** @typedef {import("./DllEntryPlugin").Options} Options */
const validate = createSchemaValidation(
require("../schemas/plugins/DllPlugin.check.js"),
() => require("../schemas/plugins/DllPlugin.json"),
{
name: "Dll Plugin",
baseDataPath: "options"
}
);
const PLUGIN_NAME = "DllPlugin";
class DllPlugin {
/**
* @param {DllPluginOptions} options options object
*/
constructor(options) {
validate(options);
this.options = {
...options,
entryOnly: options.entryOnly !== false
};
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.entryOption.tap(PLUGIN_NAME, (context, entry) => {
if (typeof entry !== "function") {
for (const name of Object.keys(entry)) {
/** @type {Options} */
const options = { name, filename: entry.filename };
new DllEntryPlugin(
context,
/** @type {Entries} */ (entry[name].import),
options
).apply(compiler);
}
} else {
throw new Error(
`${PLUGIN_NAME} doesn't support dynamic entry (function) yet`
);
}
return true;
});
new LibManifestPlugin(this.options).apply(compiler);
if (!this.options.entryOnly) {
new FlagAllModulesAsUsedPlugin(PLUGIN_NAME).apply(compiler);
}
}
}
module.exports = DllPlugin;

190
app_vue/node_modules/webpack/lib/DllReferencePlugin.js generated vendored Normal file
View File

@ -0,0 +1,190 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const parseJson = require("json-parse-even-better-errors");
const DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
const ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
const WebpackError = require("./WebpackError");
const DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
const createSchemaValidation = require("./util/create-schema-validation");
const makePathsRelative = require("./util/identifier").makePathsRelative;
/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */
/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptions} DllReferencePluginOptions */
/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptionsContent} DllReferencePluginOptionsContent */
/** @typedef {import("../declarations/plugins/DllReferencePlugin").DllReferencePluginOptionsManifest} DllReferencePluginOptionsManifest */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Compiler").CompilationParams} CompilationParams */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
const validate = createSchemaValidation(
require("../schemas/plugins/DllReferencePlugin.check.js"),
() => require("../schemas/plugins/DllReferencePlugin.json"),
{
name: "Dll Reference Plugin",
baseDataPath: "options"
}
);
/** @typedef {{ path: string, data: DllReferencePluginOptionsManifest | undefined, error: Error | undefined }} CompilationDataItem */
const PLUGIN_NAME = "DllReferencePlugin";
class DllReferencePlugin {
/**
* @param {DllReferencePluginOptions} options options object
*/
constructor(options) {
validate(options);
this.options = options;
/** @type {WeakMap<CompilationParams, CompilationDataItem>} */
this._compilationData = new WeakMap();
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
compilation.dependencyFactories.set(
DelegatedSourceDependency,
normalModuleFactory
);
}
);
compiler.hooks.beforeCompile.tapAsync(PLUGIN_NAME, (params, callback) => {
if ("manifest" in this.options) {
const manifest = this.options.manifest;
if (typeof manifest === "string") {
/** @type {InputFileSystem} */
(compiler.inputFileSystem).readFile(manifest, (err, result) => {
if (err) return callback(err);
/** @type {CompilationDataItem} */
const data = {
path: manifest,
data: undefined,
error: undefined
};
// Catch errors parsing the manifest so that blank
// or malformed manifest files don't kill the process.
try {
data.data = parseJson(
/** @type {Buffer} */ (result).toString("utf-8")
);
} catch (parseErr) {
// Store the error in the params so that it can
// be added as a compilation error later on.
const manifestPath = makePathsRelative(
/** @type {string} */ (compiler.options.context),
manifest,
compiler.root
);
data.error = new DllManifestError(
manifestPath,
/** @type {Error} */ (parseErr).message
);
}
this._compilationData.set(params, data);
return callback();
});
return;
}
}
return callback();
});
compiler.hooks.compile.tap(PLUGIN_NAME, params => {
let name = this.options.name;
let sourceType = this.options.sourceType;
let resolvedContent =
"content" in this.options ? this.options.content : undefined;
if ("manifest" in this.options) {
const manifestParameter = this.options.manifest;
let manifest;
if (typeof manifestParameter === "string") {
const data =
/** @type {CompilationDataItem} */
(this._compilationData.get(params));
// If there was an error parsing the manifest
// file, exit now because the error will be added
// as a compilation error in the "compilation" hook.
if (data.error) {
return;
}
manifest = data.data;
} else {
manifest = manifestParameter;
}
if (manifest) {
if (!name) name = manifest.name;
if (!sourceType) sourceType = manifest.type;
if (!resolvedContent) resolvedContent = manifest.content;
}
}
/** @type {Externals} */
const externals = {};
const source = `dll-reference ${name}`;
externals[source] = /** @type {string} */ (name);
const normalModuleFactory = params.normalModuleFactory;
new ExternalModuleFactoryPlugin(sourceType || "var", externals).apply(
normalModuleFactory
);
new DelegatedModuleFactoryPlugin({
source,
type: this.options.type,
scope: this.options.scope,
context:
/** @type {string} */
(this.options.context || compiler.options.context),
content:
/** @type {DllReferencePluginOptionsContent} */
(resolvedContent),
extensions: this.options.extensions,
associatedObjectForCache: compiler.root
}).apply(normalModuleFactory);
});
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation, params) => {
if ("manifest" in this.options) {
const manifest = this.options.manifest;
if (typeof manifest === "string") {
const data = /** @type {CompilationDataItem} */ (
this._compilationData.get(params)
);
// If there was an error parsing the manifest file, add the
// error as a compilation error to make the compilation fail.
if (data.error) {
compilation.errors.push(
/** @type {DllManifestError} */ (data.error)
);
}
compilation.fileDependencies.add(manifest);
}
}
});
}
}
class DllManifestError extends WebpackError {
/**
* @param {string} filename filename of the manifest
* @param {string} message error message
*/
constructor(filename, message) {
super();
this.name = "DllManifestError";
this.message = `Dll manifest ${filename}\n${message}`;
}
}
module.exports = DllReferencePlugin;

88
app_vue/node_modules/webpack/lib/DynamicEntryPlugin.js generated vendored Normal file
View File

@ -0,0 +1,88 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Naoyuki Kanezawa @nkzawa
*/
"use strict";
const EntryOptionPlugin = require("./EntryOptionPlugin");
const EntryPlugin = require("./EntryPlugin");
const EntryDependency = require("./dependencies/EntryDependency");
/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescriptionNormalized */
/** @typedef {import("../declarations/WebpackOptions").EntryDynamicNormalized} EntryDynamic */
/** @typedef {import("../declarations/WebpackOptions").EntryItem} EntryItem */
/** @typedef {import("../declarations/WebpackOptions").EntryStaticNormalized} EntryStatic */
/** @typedef {import("./Compiler")} Compiler */
const PLUGIN_NAME = "DynamicEntryPlugin";
class DynamicEntryPlugin {
/**
* @param {string} context the context path
* @param {EntryDynamic} entry the entry value
*/
constructor(context, entry) {
this.context = context;
this.entry = entry;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
compilation.dependencyFactories.set(
EntryDependency,
normalModuleFactory
);
}
);
compiler.hooks.make.tapPromise(PLUGIN_NAME, compilation =>
Promise.resolve(this.entry())
.then(entry => {
const promises = [];
for (const name of Object.keys(entry)) {
const desc = entry[name];
const options = EntryOptionPlugin.entryDescriptionToOptions(
compiler,
name,
desc
);
for (const entry of /** @type {NonNullable<EntryDescriptionNormalized["import"]>} */ (
desc.import
)) {
promises.push(
new Promise(
/**
* @param {(value?: undefined) => void} resolve resolve
* @param {(reason?: Error) => void} reject reject
*/
(resolve, reject) => {
compilation.addEntry(
this.context,
EntryPlugin.createDependency(entry, options),
options,
err => {
if (err) return reject(err);
resolve();
}
);
}
)
);
}
}
return Promise.all(promises);
})
.then(x => {})
);
}
}
module.exports = DynamicEntryPlugin;

98
app_vue/node_modules/webpack/lib/EntryOptionPlugin.js generated vendored Normal file
View File

@ -0,0 +1,98 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */
/** @typedef {import("../declarations/WebpackOptions").EntryNormalized} Entry */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */
const PLUGIN_NAME = "EntryOptionPlugin";
class EntryOptionPlugin {
/**
* @param {Compiler} compiler the compiler instance one is tapping into
* @returns {void}
*/
apply(compiler) {
compiler.hooks.entryOption.tap(PLUGIN_NAME, (context, entry) => {
EntryOptionPlugin.applyEntryOption(compiler, context, entry);
return true;
});
}
/**
* @param {Compiler} compiler the compiler
* @param {string} context context directory
* @param {Entry} entry request
* @returns {void}
*/
static applyEntryOption(compiler, context, entry) {
if (typeof entry === "function") {
const DynamicEntryPlugin = require("./DynamicEntryPlugin");
new DynamicEntryPlugin(context, entry).apply(compiler);
} else {
const EntryPlugin = require("./EntryPlugin");
for (const name of Object.keys(entry)) {
const desc = entry[name];
const options = EntryOptionPlugin.entryDescriptionToOptions(
compiler,
name,
desc
);
const descImport =
/** @type {Exclude<EntryDescription["import"], undefined>} */
(desc.import);
for (const entry of descImport) {
new EntryPlugin(context, entry, options).apply(compiler);
}
}
}
}
/**
* @param {Compiler} compiler the compiler
* @param {string} name entry name
* @param {EntryDescription} desc entry description
* @returns {EntryOptions} options for the entry
*/
static entryDescriptionToOptions(compiler, name, desc) {
/** @type {EntryOptions} */
const options = {
name,
filename: desc.filename,
runtime: desc.runtime,
layer: desc.layer,
dependOn: desc.dependOn,
baseUri: desc.baseUri,
publicPath: desc.publicPath,
chunkLoading: desc.chunkLoading,
asyncChunks: desc.asyncChunks,
wasmLoading: desc.wasmLoading,
library: desc.library
};
if (desc.layer !== undefined && !compiler.options.experiments.layers) {
throw new Error(
"'entryOptions.layer' is only allowed when 'experiments.layers' is enabled"
);
}
if (desc.chunkLoading) {
const EnableChunkLoadingPlugin = require("./javascript/EnableChunkLoadingPlugin");
EnableChunkLoadingPlugin.checkEnabled(compiler, desc.chunkLoading);
}
if (desc.wasmLoading) {
const EnableWasmLoadingPlugin = require("./wasm/EnableWasmLoadingPlugin");
EnableWasmLoadingPlugin.checkEnabled(compiler, desc.wasmLoading);
}
if (desc.library) {
const EnableLibraryPlugin = require("./library/EnableLibraryPlugin");
EnableLibraryPlugin.checkEnabled(compiler, desc.library.type);
}
return options;
}
}
module.exports = EntryOptionPlugin;

72
app_vue/node_modules/webpack/lib/EntryPlugin.js generated vendored Normal file
View File

@ -0,0 +1,72 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const EntryDependency = require("./dependencies/EntryDependency");
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */
const PLUGIN_NAME = "EntryPlugin";
class EntryPlugin {
/**
* An entry plugin which will handle creation of the EntryDependency
* @param {string} context context path
* @param {string} entry entry path
* @param {EntryOptions | string=} options entry options (passing a string is deprecated)
*/
constructor(context, entry, options) {
this.context = context;
this.entry = entry;
this.options = options || "";
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
compilation.dependencyFactories.set(
EntryDependency,
normalModuleFactory
);
}
);
const { entry, options, context } = this;
const dep = EntryPlugin.createDependency(entry, options);
compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {
compilation.addEntry(context, dep, options, err => {
callback(err);
});
});
}
/**
* @param {string} entry entry request
* @param {EntryOptions | string} options entry options (passing string is deprecated)
* @returns {EntryDependency} the dependency
*/
static createDependency(entry, options) {
const dep = new EntryDependency(entry);
// TODO webpack 6 remove string option
dep.loc = {
name:
typeof options === "object"
? /** @type {string} */ (options.name)
: options
};
return dep;
}
}
module.exports = EntryPlugin;

101
app_vue/node_modules/webpack/lib/Entrypoint.js generated vendored Normal file
View File

@ -0,0 +1,101 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const ChunkGroup = require("./ChunkGroup");
/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */
/** @typedef {import("./Chunk")} Chunk */
/** @typedef {{ name?: string } & Omit<EntryDescription, "import">} EntryOptions */
/**
* Entrypoint serves as an encapsulation primitive for chunks that are
* a part of a single ChunkGroup. They represent all bundles that need to be loaded for a
* single instance of a page. Multi-page application architectures will typically yield multiple Entrypoint objects
* inside of the compilation, whereas a Single Page App may only contain one with many lazy-loaded chunks.
*/
class Entrypoint extends ChunkGroup {
/**
* Creates an instance of Entrypoint.
* @param {EntryOptions | string} entryOptions the options for the entrypoint (or name)
* @param {boolean=} initial false, when the entrypoint is not initial loaded
*/
constructor(entryOptions, initial = true) {
if (typeof entryOptions === "string") {
entryOptions = { name: entryOptions };
}
super({
name: entryOptions.name
});
this.options = entryOptions;
/** @type {Chunk=} */
this._runtimeChunk = undefined;
/** @type {Chunk=} */
this._entrypointChunk = undefined;
/** @type {boolean} */
this._initial = initial;
}
/**
* @returns {boolean} true, when this chunk group will be loaded on initial page load
*/
isInitial() {
return this._initial;
}
/**
* Sets the runtimeChunk for an entrypoint.
* @param {Chunk} chunk the chunk being set as the runtime chunk.
* @returns {void}
*/
setRuntimeChunk(chunk) {
this._runtimeChunk = chunk;
}
/**
* Fetches the chunk reference containing the webpack bootstrap code
* @returns {Chunk | null} returns the runtime chunk or null if there is none
*/
getRuntimeChunk() {
if (this._runtimeChunk) return this._runtimeChunk;
for (const parent of this.parentsIterable) {
if (parent instanceof Entrypoint) return parent.getRuntimeChunk();
}
return null;
}
/**
* Sets the chunk with the entrypoint modules for an entrypoint.
* @param {Chunk} chunk the chunk being set as the entrypoint chunk.
* @returns {void}
*/
setEntrypointChunk(chunk) {
this._entrypointChunk = chunk;
}
/**
* Returns the chunk which contains the entrypoint modules
* (or at least the execution of them)
* @returns {Chunk} chunk
*/
getEntrypointChunk() {
return /** @type {Chunk} */ (this._entrypointChunk);
}
/**
* @param {Chunk} oldChunk chunk to be replaced
* @param {Chunk} newChunk New chunk that will be replaced with
* @returns {boolean | undefined} returns true if the replacement was successful
*/
replaceChunk(oldChunk, newChunk) {
if (this._runtimeChunk === oldChunk) this._runtimeChunk = newChunk;
if (this._entrypointChunk === oldChunk) this._entrypointChunk = newChunk;
return super.replaceChunk(oldChunk, newChunk);
}
}
module.exports = Entrypoint;

View File

@ -0,0 +1,52 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Gengkun He @ahabhgk
*/
"use strict";
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./Module")} Module */
/** @typedef {import("./Compilation")} Compilation */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {"asyncWebAssembly" | "topLevelAwait" | "external promise" | "external script" | "external import" | "external module"} Feature */
class EnvironmentNotSupportAsyncWarning extends WebpackError {
/**
* Creates an instance of EnvironmentNotSupportAsyncWarning.
* @param {Module} module module
* @param {Feature} feature feature
*/
constructor(module, feature) {
const message = `The generated code contains 'async/await' because this module is using "${feature}".
However, your target environment does not appear to support 'async/await'.
As a result, the code may not run as expected or may cause runtime errors.`;
super(message);
this.name = "EnvironmentNotSupportAsyncWarning";
this.module = module;
}
/**
* Creates an instance of EnvironmentNotSupportAsyncWarning.
* @param {Module} module module
* @param {RuntimeTemplate} runtimeTemplate compilation
* @param {Feature} feature feature
*/
static check(module, runtimeTemplate, feature) {
if (!runtimeTemplate.supportsAsyncFunction()) {
module.addWarning(new EnvironmentNotSupportAsyncWarning(module, feature));
}
}
}
makeSerializable(
EnvironmentNotSupportAsyncWarning,
"webpack/lib/EnvironmentNotSupportAsyncWarning"
);
module.exports = EnvironmentNotSupportAsyncWarning;

71
app_vue/node_modules/webpack/lib/EnvironmentPlugin.js generated vendored Normal file
View File

@ -0,0 +1,71 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Authors Simen Brekken @simenbrekken, Einar Löve @einarlove
*/
"use strict";
const DefinePlugin = require("./DefinePlugin");
const WebpackError = require("./WebpackError");
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./DefinePlugin").CodeValue} CodeValue */
const PLUGIN_NAME = "EnvironmentPlugin";
class EnvironmentPlugin {
/**
* @param {(string | string[] | Record<string, EXPECTED_ANY>)[]} keys keys
*/
constructor(...keys) {
if (keys.length === 1 && Array.isArray(keys[0])) {
/** @type {string[]} */
this.keys = keys[0];
this.defaultValues = {};
} else if (keys.length === 1 && keys[0] && typeof keys[0] === "object") {
this.keys = Object.keys(keys[0]);
this.defaultValues =
/** @type {Record<string, EXPECTED_ANY>} */
(keys[0]);
} else {
this.keys = /** @type {string[]} */ (keys);
this.defaultValues = {};
}
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
/** @type {Record<string, CodeValue>} */
const definitions = {};
for (const key of this.keys) {
const value =
process.env[key] !== undefined
? process.env[key]
: this.defaultValues[key];
if (value === undefined) {
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
const error = new WebpackError(
`${PLUGIN_NAME} - ${key} environment variable is undefined.\n\n` +
"You can pass an object with default values to suppress this warning.\n" +
"See https://webpack.js.org/plugins/environment-plugin for example."
);
error.name = "EnvVariableNotDefinedError";
compilation.errors.push(error);
});
}
definitions[`process.env.${key}`] =
value === undefined ? "undefined" : JSON.stringify(value);
}
new DefinePlugin(definitions).apply(compiler);
}
}
module.exports = EnvironmentPlugin;

100
app_vue/node_modules/webpack/lib/ErrorHelpers.js generated vendored Normal file
View File

@ -0,0 +1,100 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const loaderFlag = "LOADER_EXECUTION";
const webpackOptionsFlag = "WEBPACK_OPTIONS";
/**
* @param {string} stack stack trace
* @param {string} flag flag to cut off
* @returns {string} stack trace without the specified flag included
*/
const cutOffByFlag = (stack, flag) => {
const errorStack = stack.split("\n");
for (let i = 0; i < errorStack.length; i++) {
if (errorStack[i].includes(flag)) {
errorStack.length = i;
}
}
return errorStack.join("\n");
};
/**
* @param {string} stack stack trace
* @returns {string} stack trace without the loader execution flag included
*/
const cutOffLoaderExecution = stack => cutOffByFlag(stack, loaderFlag);
/**
* @param {string} stack stack trace
* @returns {string} stack trace without the webpack options flag included
*/
const cutOffWebpackOptions = stack => cutOffByFlag(stack, webpackOptionsFlag);
/**
* @param {string} stack stack trace
* @param {string} message error message
* @returns {string} stack trace without the message included
*/
const cutOffMultilineMessage = (stack, message) => {
const stackSplitByLines = stack.split("\n");
const messageSplitByLines = message.split("\n");
/** @type {string[]} */
const result = [];
for (const [idx, line] of stackSplitByLines.entries()) {
if (!line.includes(messageSplitByLines[idx])) result.push(line);
}
return result.join("\n");
};
/**
* @param {string} stack stack trace
* @param {string} message error message
* @returns {string} stack trace without the message included
*/
const cutOffMessage = (stack, message) => {
const nextLine = stack.indexOf("\n");
if (nextLine === -1) {
return stack === message ? "" : stack;
}
const firstLine = stack.slice(0, nextLine);
return firstLine === message ? stack.slice(nextLine + 1) : stack;
};
/**
* @param {string} stack stack trace
* @param {string} message error message
* @returns {string} stack trace without the loader execution flag and message included
*/
const cleanUp = (stack, message) => {
stack = cutOffLoaderExecution(stack);
stack = cutOffMessage(stack, message);
return stack;
};
/**
* @param {string} stack stack trace
* @param {string} message error message
* @returns {string} stack trace without the webpack options flag and message included
*/
const cleanUpWebpackOptions = (stack, message) => {
stack = cutOffWebpackOptions(stack);
stack = cutOffMultilineMessage(stack, message);
return stack;
};
module.exports.cutOffByFlag = cutOffByFlag;
module.exports.cutOffLoaderExecution = cutOffLoaderExecution;
module.exports.cutOffWebpackOptions = cutOffWebpackOptions;
module.exports.cutOffMultilineMessage = cutOffMultilineMessage;
module.exports.cutOffMessage = cutOffMessage;
module.exports.cleanUp = cleanUp;
module.exports.cleanUpWebpackOptions = cleanUpWebpackOptions;

View File

@ -0,0 +1,131 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { ConcatSource, RawSource } = require("webpack-sources");
const ExternalModule = require("./ExternalModule");
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
const RuntimeGlobals = require("./RuntimeGlobals");
const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */
/** @typedef {import("./Compiler")} Compiler */
/** @type {WeakMap<Source, Source>} */
const cache = new WeakMap();
const devtoolWarning = new RawSource(`/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
`);
/**
* @typedef {object} EvalDevToolModulePluginOptions
* @property {OutputOptions["devtoolNamespace"]=} namespace namespace
* @property {string=} sourceUrlComment source url comment
* @property {OutputOptions["devtoolModuleFilenameTemplate"]=} moduleFilenameTemplate module filename template
*/
const PLUGIN_NAME = "EvalDevToolModulePlugin";
class EvalDevToolModulePlugin {
/**
* @param {EvalDevToolModulePluginOptions=} options options
*/
constructor(options = {}) {
this.namespace = options.namespace || "";
this.sourceUrlComment = options.sourceUrlComment || "\n//# sourceURL=[url]";
this.moduleFilenameTemplate =
options.moduleFilenameTemplate ||
"webpack://[namespace]/[resourcePath]?[loaders]";
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation);
hooks.renderModuleContent.tap(
PLUGIN_NAME,
(source, module, { chunk, runtimeTemplate, chunkGraph }) => {
const cacheEntry = cache.get(source);
if (cacheEntry !== undefined) return cacheEntry;
if (module instanceof ExternalModule) {
cache.set(source, source);
return source;
}
const content = source.source();
const namespace = compilation.getPath(this.namespace, {
chunk
});
const str = ModuleFilenameHelpers.createFilename(
module,
{
moduleFilenameTemplate: this.moduleFilenameTemplate,
namespace
},
{
requestShortener: runtimeTemplate.requestShortener,
chunkGraph,
hashFunction: compilation.outputOptions.hashFunction
}
);
const footer = `\n${this.sourceUrlComment.replace(
/\[url\]/g,
encodeURI(str)
.replace(/%2F/g, "/")
.replace(/%20/g, "_")
.replace(/%5E/g, "^")
.replace(/%5C/g, "\\")
.replace(/^\//, "")
)}`;
const result = new RawSource(
`eval(${
compilation.outputOptions.trustedTypes
? `${RuntimeGlobals.createScript}(${JSON.stringify(
content + footer
)})`
: JSON.stringify(content + footer)
});`
);
cache.set(source, result);
return result;
}
);
hooks.inlineInRuntimeBailout.tap(
PLUGIN_NAME,
() => "the eval devtool is used."
);
hooks.render.tap(
PLUGIN_NAME,
source => new ConcatSource(devtoolWarning, source)
);
hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash) => {
hash.update(PLUGIN_NAME);
hash.update("2");
});
if (compilation.outputOptions.trustedTypes) {
compilation.hooks.additionalModuleRuntimeRequirements.tap(
PLUGIN_NAME,
(module, set, context) => {
set.add(RuntimeGlobals.createScript);
}
);
}
});
}
}
module.exports = EvalDevToolModulePlugin;

View File

@ -0,0 +1,226 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { ConcatSource, RawSource } = require("webpack-sources");
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
const NormalModule = require("./NormalModule");
const RuntimeGlobals = require("./RuntimeGlobals");
const SourceMapDevToolModuleOptionsPlugin = require("./SourceMapDevToolModuleOptionsPlugin");
const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
const ConcatenatedModule = require("./optimize/ConcatenatedModule");
const generateDebugId = require("./util/generateDebugId");
const { makePathsAbsolute } = require("./util/identifier");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../declarations/WebpackOptions").DevTool} DevToolOptions */
/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */
/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./NormalModule").SourceMap} SourceMap */
/** @type {WeakMap<Source, Source>} */
const cache = new WeakMap();
const devtoolWarning = new RawSource(`/*
* ATTENTION: An "eval-source-map" devtool has been used.
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
`);
const PLUGIN_NAME = "EvalSourceMapDevToolPlugin";
class EvalSourceMapDevToolPlugin {
/**
* @param {SourceMapDevToolPluginOptions | string} inputOptions Options object
*/
constructor(inputOptions) {
/** @type {SourceMapDevToolPluginOptions} */
let options;
if (typeof inputOptions === "string") {
options = {
append: inputOptions
};
} else {
options = inputOptions;
}
this.sourceMapComment =
options.append && typeof options.append !== "function"
? options.append
: "//# sourceURL=[module]\n//# sourceMappingURL=[url]";
this.moduleFilenameTemplate =
options.moduleFilenameTemplate ||
"webpack://[namespace]/[resource-path]?[hash]";
this.namespace = options.namespace || "";
this.options = options;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
const options = this.options;
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation);
new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation);
const matchModule = ModuleFilenameHelpers.matchObject.bind(
ModuleFilenameHelpers,
options
);
hooks.renderModuleContent.tap(
PLUGIN_NAME,
(source, m, { chunk, runtimeTemplate, chunkGraph }) => {
const cachedSource = cache.get(source);
if (cachedSource !== undefined) {
return cachedSource;
}
/**
* @param {Source} r result
* @returns {Source} result
*/
const result = r => {
cache.set(source, r);
return r;
};
if (m instanceof NormalModule) {
const module = /** @type {NormalModule} */ (m);
if (!matchModule(module.resource)) {
return result(source);
}
} else if (m instanceof ConcatenatedModule) {
const concatModule = /** @type {ConcatenatedModule} */ (m);
if (concatModule.rootModule instanceof NormalModule) {
const module = /** @type {NormalModule} */ (
concatModule.rootModule
);
if (!matchModule(module.resource)) {
return result(source);
}
} else {
return result(source);
}
} else {
return result(source);
}
const namespace = compilation.getPath(this.namespace, {
chunk
});
/** @type {SourceMap} */
let sourceMap;
let content;
if (source.sourceAndMap) {
const sourceAndMap = source.sourceAndMap(options);
sourceMap = /** @type {SourceMap} */ (sourceAndMap.map);
content = sourceAndMap.source;
} else {
sourceMap = /** @type {SourceMap} */ (source.map(options));
content = source.source();
}
if (!sourceMap) {
return result(source);
}
// Clone (flat) the sourcemap to ensure that the mutations below do not persist.
sourceMap = { ...sourceMap };
const context = /** @type {string} */ (compiler.options.context);
const root = compiler.root;
const modules = sourceMap.sources.map(source => {
if (!source.startsWith("webpack://")) return source;
source = makePathsAbsolute(context, source.slice(10), root);
const module = compilation.findModule(source);
return module || source;
});
let moduleFilenames = modules.map(module =>
ModuleFilenameHelpers.createFilename(
module,
{
moduleFilenameTemplate: this.moduleFilenameTemplate,
namespace
},
{
requestShortener: runtimeTemplate.requestShortener,
chunkGraph,
hashFunction: compilation.outputOptions.hashFunction
}
)
);
moduleFilenames = ModuleFilenameHelpers.replaceDuplicates(
moduleFilenames,
(filename, i, n) => {
for (let j = 0; j < n; j++) filename += "*";
return filename;
}
);
sourceMap.sources = moduleFilenames;
if (options.noSources) {
sourceMap.sourcesContent = undefined;
}
sourceMap.sourceRoot = options.sourceRoot || "";
const moduleId =
/** @type {ModuleId} */
(chunkGraph.getModuleId(m));
sourceMap.file =
typeof moduleId === "number" ? `${moduleId}.js` : moduleId;
if (options.debugIds) {
sourceMap.debugId = generateDebugId(content, sourceMap.file);
}
const footer = `${this.sourceMapComment.replace(
/\[url\]/g,
`data:application/json;charset=utf-8;base64,${Buffer.from(
JSON.stringify(sourceMap),
"utf8"
).toString("base64")}`
)}\n//# sourceURL=webpack-internal:///${moduleId}\n`; // workaround for chrome bug
return result(
new RawSource(
`eval(${
compilation.outputOptions.trustedTypes
? `${RuntimeGlobals.createScript}(${JSON.stringify(
content + footer
)})`
: JSON.stringify(content + footer)
});`
)
);
}
);
hooks.inlineInRuntimeBailout.tap(
"EvalDevToolModulePlugin",
() => "the eval-source-map devtool is used."
);
hooks.render.tap(
PLUGIN_NAME,
source => new ConcatSource(devtoolWarning, source)
);
hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash) => {
hash.update(PLUGIN_NAME);
hash.update("2");
});
if (compilation.outputOptions.trustedTypes) {
compilation.hooks.additionalModuleRuntimeRequirements.tap(
PLUGIN_NAME,
(module, set, context) => {
set.add(RuntimeGlobals.createScript);
}
);
}
});
}
}
module.exports = EvalSourceMapDevToolPlugin;

1675
app_vue/node_modules/webpack/lib/ExportsInfo.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,87 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const {
JAVASCRIPT_MODULE_TYPE_AUTO,
JAVASCRIPT_MODULE_TYPE_DYNAMIC,
JAVASCRIPT_MODULE_TYPE_ESM
} = require("./ModuleTypeConstants");
const ConstDependency = require("./dependencies/ConstDependency");
const ExportsInfoDependency = require("./dependencies/ExportsInfoDependency");
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("./javascript/JavascriptParser").Range} Range */
const PLUGIN_NAME = "ExportsInfoApiPlugin";
class ExportsInfoApiPlugin {
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
compilation.dependencyTemplates.set(
ExportsInfoDependency,
new ExportsInfoDependency.Template()
);
/**
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
const handler = parser => {
parser.hooks.expressionMemberChain
.for("__webpack_exports_info__")
.tap(PLUGIN_NAME, (expr, members) => {
const dep =
members.length >= 2
? new ExportsInfoDependency(
/** @type {Range} */ (expr.range),
members.slice(0, -1),
members[members.length - 1]
)
: new ExportsInfoDependency(
/** @type {Range} */ (expr.range),
null,
members[0]
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addDependency(dep);
return true;
});
parser.hooks.expression
.for("__webpack_exports_info__")
.tap(PLUGIN_NAME, expr => {
const dep = new ConstDependency(
"true",
/** @type {Range} */ (expr.range)
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);
return true;
});
};
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_AUTO)
.tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
.tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_ESM)
.tap(PLUGIN_NAME, handler);
}
);
}
}
module.exports = ExportsInfoApiPlugin;

1009
app_vue/node_modules/webpack/lib/ExternalModule.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,338 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const util = require("util");
const ExternalModule = require("./ExternalModule");
const ContextElementDependency = require("./dependencies/ContextElementDependency");
const CssImportDependency = require("./dependencies/CssImportDependency");
const CssUrlDependency = require("./dependencies/CssUrlDependency");
const HarmonyImportDependency = require("./dependencies/HarmonyImportDependency");
const ImportDependency = require("./dependencies/ImportDependency");
const { resolveByProperty, cachedSetProperty } = require("./util/cleverMerge");
/** @typedef {import("../declarations/WebpackOptions").ExternalItemFunctionData} ExternalItemFunctionData */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemObjectKnown} ExternalItemObjectKnown */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemObjectUnknown} ExternalItemObjectUnknown */
/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */
/** @typedef {import("./Compilation").DepConstructor} DepConstructor */
/** @typedef {import("./ExternalModule").DependencyMeta} DependencyMeta */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ModuleFactory").IssuerLayer} IssuerLayer */
/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */
const UNSPECIFIED_EXTERNAL_TYPE_REGEXP = /^[a-z0-9-]+ /;
const EMPTY_RESOLVE_OPTIONS = {};
// TODO webpack 6 remove this
const callDeprecatedExternals = util.deprecate(
/**
* @param {EXPECTED_FUNCTION} externalsFunction externals function
* @param {string} context context
* @param {string} request request
* @param {(err: Error | null | undefined, value: ExternalValue | undefined, ty: ExternalType | undefined) => void} cb cb
*/
(externalsFunction, context, request, cb) => {
// eslint-disable-next-line no-useless-call
externalsFunction.call(null, context, request, cb);
},
"The externals-function should be defined like ({context, request}, cb) => { ... }",
"DEP_WEBPACK_EXTERNALS_FUNCTION_PARAMETERS"
);
/** @typedef {ExternalItemObjectKnown & ExternalItemObjectUnknown} ExternalItemObject */
/**
* @template {ExternalItemObject} T
* @typedef {WeakMap<T, Map<IssuerLayer, Omit<T, "byLayer">>>} ExternalWeakCache
*/
/** @type {ExternalWeakCache<ExternalItemObject>} */
const cache = new WeakMap();
/**
* @param {ExternalItemObject} obj obj
* @param {IssuerLayer} layer layer
* @returns {Omit<ExternalItemObject, "byLayer">} result
*/
const resolveLayer = (obj, layer) => {
let map = cache.get(obj);
if (map === undefined) {
map = new Map();
cache.set(obj, map);
} else {
const cacheEntry = map.get(layer);
if (cacheEntry !== undefined) return cacheEntry;
}
const result = resolveByProperty(obj, "byLayer", layer);
map.set(layer, result);
return result;
};
/** @typedef {string | string[] | boolean | Record<string, string | string[]>} ExternalValue */
/** @typedef {string | undefined} ExternalType */
class ExternalModuleFactoryPlugin {
/**
* @param {string | undefined} type default external type
* @param {Externals} externals externals config
*/
constructor(type, externals) {
this.type = type;
this.externals = externals;
}
/**
* @param {NormalModuleFactory} normalModuleFactory the normal module factory
* @returns {void}
*/
apply(normalModuleFactory) {
const globalType = this.type;
normalModuleFactory.hooks.factorize.tapAsync(
"ExternalModuleFactoryPlugin",
(data, callback) => {
const context = data.context;
const contextInfo = data.contextInfo;
const dependency = data.dependencies[0];
const dependencyType = data.dependencyType;
/** @typedef {(err?: Error | null, externalModule?: ExternalModule) => void} HandleExternalCallback */
/**
* @param {ExternalValue} value the external config
* @param {ExternalType | undefined} type type of external
* @param {HandleExternalCallback} callback callback
* @returns {void}
*/
const handleExternal = (value, type, callback) => {
if (value === false) {
// Not externals, fallback to original factory
return callback();
}
/** @type {string | string[] | Record<string, string|string[]>} */
let externalConfig = value === true ? dependency.request : value;
// When no explicit type is specified, extract it from the externalConfig
if (type === undefined) {
if (
typeof externalConfig === "string" &&
UNSPECIFIED_EXTERNAL_TYPE_REGEXP.test(externalConfig)
) {
const idx = externalConfig.indexOf(" ");
type = externalConfig.slice(0, idx);
externalConfig = externalConfig.slice(idx + 1);
} else if (
Array.isArray(externalConfig) &&
externalConfig.length > 0 &&
UNSPECIFIED_EXTERNAL_TYPE_REGEXP.test(externalConfig[0])
) {
const firstItem = externalConfig[0];
const idx = firstItem.indexOf(" ");
type = firstItem.slice(0, idx);
externalConfig = [
firstItem.slice(idx + 1),
...externalConfig.slice(1)
];
}
}
const resolvedType = /** @type {string} */ (type || globalType);
// TODO make it pluggable/add hooks to `ExternalModule` to allow output modules own externals?
/** @type {DependencyMeta | undefined} */
let dependencyMeta;
if (
dependency instanceof HarmonyImportDependency ||
dependency instanceof ImportDependency ||
dependency instanceof ContextElementDependency
) {
const externalType =
dependency instanceof HarmonyImportDependency
? "module"
: dependency instanceof ImportDependency
? "import"
: undefined;
dependencyMeta = {
attributes: dependency.assertions,
externalType
};
} else if (dependency instanceof CssImportDependency) {
dependencyMeta = {
layer: dependency.layer,
supports: dependency.supports,
media: dependency.media
};
}
if (
resolvedType === "asset" &&
dependency instanceof CssUrlDependency
) {
dependencyMeta = { sourceType: "css-url" };
}
callback(
null,
new ExternalModule(
externalConfig,
resolvedType,
dependency.request,
dependencyMeta
)
);
};
/**
* @param {Externals} externals externals config
* @param {HandleExternalCallback} callback callback
* @returns {void}
*/
const handleExternals = (externals, callback) => {
if (typeof externals === "string") {
if (externals === dependency.request) {
return handleExternal(dependency.request, undefined, callback);
}
} else if (Array.isArray(externals)) {
let i = 0;
const next = () => {
/** @type {boolean | undefined} */
let asyncFlag;
/**
* @param {(Error | null)=} err err
* @param {ExternalModule=} module module
* @returns {void}
*/
const handleExternalsAndCallback = (err, module) => {
if (err) return callback(err);
if (!module) {
if (asyncFlag) {
asyncFlag = false;
return;
}
return next();
}
callback(null, module);
};
do {
asyncFlag = true;
if (i >= externals.length) return callback();
handleExternals(externals[i++], handleExternalsAndCallback);
} while (!asyncFlag);
asyncFlag = false;
};
next();
return;
} else if (externals instanceof RegExp) {
if (externals.test(dependency.request)) {
return handleExternal(dependency.request, undefined, callback);
}
} else if (typeof externals === "function") {
/**
* @param {Error | null | undefined} err err
* @param {ExternalValue=} value value
* @param {ExternalType=} type type
* @returns {void}
*/
const cb = (err, value, type) => {
if (err) return callback(err);
if (value !== undefined) {
handleExternal(value, type, callback);
} else {
callback();
}
};
if (externals.length === 3) {
// TODO webpack 6 remove this
callDeprecatedExternals(
externals,
context,
dependency.request,
cb
);
} else {
const promise = externals(
{
context,
request: dependency.request,
dependencyType,
contextInfo,
getResolve: options => (context, request, callback) => {
const resolveContext = {
fileDependencies: data.fileDependencies,
missingDependencies: data.missingDependencies,
contextDependencies: data.contextDependencies
};
let resolver = normalModuleFactory.getResolver(
"normal",
dependencyType
? cachedSetProperty(
data.resolveOptions || EMPTY_RESOLVE_OPTIONS,
"dependencyType",
dependencyType
)
: data.resolveOptions
);
if (options) resolver = resolver.withOptions(options);
if (callback) {
resolver.resolve(
{},
context,
request,
resolveContext,
callback
);
} else {
return new Promise((resolve, reject) => {
resolver.resolve(
{},
context,
request,
resolveContext,
(err, result) => {
if (err) reject(err);
else resolve(result);
}
);
});
}
}
},
cb
);
if (promise && promise.then) promise.then(r => cb(null, r), cb);
}
return;
} else if (typeof externals === "object") {
const resolvedExternals = resolveLayer(
externals,
/** @type {IssuerLayer} */
(contextInfo.issuerLayer)
);
if (
Object.prototype.hasOwnProperty.call(
resolvedExternals,
dependency.request
)
) {
return handleExternal(
resolvedExternals[dependency.request],
undefined,
callback
);
}
}
callback();
};
handleExternals(this.externals, callback);
}
);
}
}
module.exports = ExternalModuleFactoryPlugin;

39
app_vue/node_modules/webpack/lib/ExternalsPlugin.js generated vendored Normal file
View File

@ -0,0 +1,39 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin");
/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */
/** @typedef {import("./Compiler")} Compiler */
const PLUGIN_NAME = "ExternalsPlugin";
class ExternalsPlugin {
/**
* @param {string | undefined} type default external type
* @param {Externals} externals externals config
*/
constructor(type, externals) {
this.type = type;
this.externals = externals;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compile.tap(PLUGIN_NAME, ({ normalModuleFactory }) => {
new ExternalModuleFactoryPlugin(this.type, this.externals).apply(
normalModuleFactory
);
});
}
}
module.exports = ExternalsPlugin;

View File

@ -0,0 +1,19 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Arka Pratim Chaudhuri @arkapratimc
*/
"use strict";
const WebpackError = require("./WebpackError");
class FalseIIFEUmdWarning extends WebpackError {
constructor() {
super();
this.name = "FalseIIFEUmdWarning";
this.message =
"Configuration:\nSetting 'output.iife' to 'false' is incompatible with 'output.library.type' set to 'umd'. This configuration may cause unexpected behavior, as UMD libraries are expected to use an IIFE (Immediately Invoked Function Expression) to support various module formats. Consider setting 'output.iife' to 'true' or choosing a different 'library.type' to ensure compatibility.\nLearn more: https://webpack.js.org/configuration/output/";
}
}
module.exports = FalseIIFEUmdWarning;

4074
app_vue/node_modules/webpack/lib/FileSystemInfo.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { getEntryRuntime, mergeRuntimeOwned } = require("./util/runtime");
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Module").FactoryMeta} FactoryMeta */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
const PLUGIN_NAME = "FlagAllModulesAsUsedPlugin";
class FlagAllModulesAsUsedPlugin {
/**
* @param {string} explanation explanation
*/
constructor(explanation) {
this.explanation = explanation;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
const moduleGraph = compilation.moduleGraph;
compilation.hooks.optimizeDependencies.tap(PLUGIN_NAME, modules => {
/** @type {RuntimeSpec} */
let runtime;
for (const [name, { options }] of compilation.entries) {
runtime = mergeRuntimeOwned(
runtime,
getEntryRuntime(compilation, name, options)
);
}
for (const module of modules) {
const exportsInfo = moduleGraph.getExportsInfo(module);
exportsInfo.setUsedInUnknownWay(runtime);
moduleGraph.addExtraReason(module, this.explanation);
if (module.factoryMeta === undefined) {
module.factoryMeta = {};
}
/** @type {FactoryMeta} */
(module.factoryMeta).sideEffectFree = false;
}
});
});
}
}
module.exports = FlagAllModulesAsUsedPlugin;

View File

@ -0,0 +1,423 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const asyncLib = require("neo-async");
const Queue = require("./util/Queue");
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
/** @typedef {import("./Dependency")} Dependency */
/** @typedef {import("./Dependency").ExportSpec} ExportSpec */
/** @typedef {import("./Dependency").ExportsSpec} ExportsSpec */
/** @typedef {import("./ExportsInfo")} ExportsInfo */
/** @typedef {import("./ExportsInfo").RestoreProvidedData} RestoreProvidedData */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./Module").BuildInfo} BuildInfo */
const PLUGIN_NAME = "FlagDependencyExportsPlugin";
const PLUGIN_LOGGER_NAME = `webpack.${PLUGIN_NAME}`;
class FlagDependencyExportsPlugin {
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
const moduleGraph = compilation.moduleGraph;
const cache = compilation.getCache(PLUGIN_NAME);
compilation.hooks.finishModules.tapAsync(
PLUGIN_NAME,
(modules, callback) => {
const logger = compilation.getLogger(PLUGIN_LOGGER_NAME);
let statRestoredFromMemCache = 0;
let statRestoredFromCache = 0;
let statNoExports = 0;
let statFlaggedUncached = 0;
let statNotCached = 0;
let statQueueItemsProcessed = 0;
const { moduleMemCaches } = compilation;
/** @type {Queue<Module>} */
const queue = new Queue();
// Step 1: Try to restore cached provided export info from cache
logger.time("restore cached provided exports");
asyncLib.each(
modules,
(module, callback) => {
const exportsInfo = moduleGraph.getExportsInfo(module);
// If the module doesn't have an exportsType, it's a module
// without declared exports.
if (
(!module.buildMeta || !module.buildMeta.exportsType) &&
exportsInfo.otherExportsInfo.provided !== null
) {
// It's a module without declared exports
statNoExports++;
exportsInfo.setHasProvideInfo();
exportsInfo.setUnknownExportsProvided();
return callback();
}
// If the module has no hash, it's uncacheable
if (
typeof (/** @type {BuildInfo} */ (module.buildInfo).hash) !==
"string"
) {
statFlaggedUncached++;
// Enqueue uncacheable module for determining the exports
queue.enqueue(module);
exportsInfo.setHasProvideInfo();
return callback();
}
const memCache = moduleMemCaches && moduleMemCaches.get(module);
const memCacheValue = memCache && memCache.get(this);
if (memCacheValue !== undefined) {
statRestoredFromMemCache++;
exportsInfo.restoreProvided(memCacheValue);
return callback();
}
cache.get(
module.identifier(),
/** @type {BuildInfo} */
(module.buildInfo).hash,
(err, result) => {
if (err) return callback(err);
if (result !== undefined) {
statRestoredFromCache++;
exportsInfo.restoreProvided(result);
} else {
statNotCached++;
// Without cached info enqueue module for determining the exports
queue.enqueue(module);
exportsInfo.setHasProvideInfo();
}
callback();
}
);
},
err => {
logger.timeEnd("restore cached provided exports");
if (err) return callback(err);
/** @type {Set<Module>} */
const modulesToStore = new Set();
/** @type {Map<Module, Set<Module>>} */
const dependencies = new Map();
/** @type {Module} */
let module;
/** @type {ExportsInfo} */
let exportsInfo;
/** @type {Map<Dependency, ExportsSpec>} */
const exportsSpecsFromDependencies = new Map();
let cacheable = true;
let changed = false;
/**
* @param {DependenciesBlock} depBlock the dependencies block
* @returns {void}
*/
const processDependenciesBlock = depBlock => {
for (const dep of depBlock.dependencies) {
processDependency(dep);
}
for (const block of depBlock.blocks) {
processDependenciesBlock(block);
}
};
/**
* @param {Dependency} dep the dependency
* @returns {void}
*/
const processDependency = dep => {
const exportDesc = dep.getExports(moduleGraph);
if (!exportDesc) return;
exportsSpecsFromDependencies.set(dep, exportDesc);
};
/**
* @param {Dependency} dep dependency
* @param {ExportsSpec} exportDesc info
* @returns {void}
*/
const processExportsSpec = (dep, exportDesc) => {
const exports = exportDesc.exports;
const globalCanMangle = exportDesc.canMangle;
const globalFrom = exportDesc.from;
const globalPriority = exportDesc.priority;
const globalTerminalBinding =
exportDesc.terminalBinding || false;
const exportDeps = exportDesc.dependencies;
if (exportDesc.hideExports) {
for (const name of exportDesc.hideExports) {
const exportInfo = exportsInfo.getExportInfo(name);
exportInfo.unsetTarget(dep);
}
}
if (exports === true) {
// unknown exports
if (
exportsInfo.setUnknownExportsProvided(
globalCanMangle,
exportDesc.excludeExports,
globalFrom && dep,
globalFrom,
globalPriority
)
) {
changed = true;
}
} else if (Array.isArray(exports)) {
/**
* merge in new exports
* @param {ExportsInfo} exportsInfo own exports info
* @param {(ExportSpec | string)[]} exports list of exports
*/
const mergeExports = (exportsInfo, exports) => {
for (const exportNameOrSpec of exports) {
let name;
let canMangle = globalCanMangle;
let terminalBinding = globalTerminalBinding;
let exports;
let from = globalFrom;
let fromExport;
let priority = globalPriority;
let hidden = false;
if (typeof exportNameOrSpec === "string") {
name = exportNameOrSpec;
} else {
name = exportNameOrSpec.name;
if (exportNameOrSpec.canMangle !== undefined)
canMangle = exportNameOrSpec.canMangle;
if (exportNameOrSpec.export !== undefined)
fromExport = exportNameOrSpec.export;
if (exportNameOrSpec.exports !== undefined)
exports = exportNameOrSpec.exports;
if (exportNameOrSpec.from !== undefined)
from = exportNameOrSpec.from;
if (exportNameOrSpec.priority !== undefined)
priority = exportNameOrSpec.priority;
if (exportNameOrSpec.terminalBinding !== undefined)
terminalBinding = exportNameOrSpec.terminalBinding;
if (exportNameOrSpec.hidden !== undefined)
hidden = exportNameOrSpec.hidden;
}
const exportInfo = exportsInfo.getExportInfo(name);
if (
exportInfo.provided === false ||
exportInfo.provided === null
) {
exportInfo.provided = true;
changed = true;
}
if (
exportInfo.canMangleProvide !== false &&
canMangle === false
) {
exportInfo.canMangleProvide = false;
changed = true;
}
if (terminalBinding && !exportInfo.terminalBinding) {
exportInfo.terminalBinding = true;
changed = true;
}
if (exports) {
const nestedExportsInfo =
exportInfo.createNestedExportsInfo();
mergeExports(
/** @type {ExportsInfo} */ (nestedExportsInfo),
exports
);
}
if (
from &&
(hidden
? exportInfo.unsetTarget(dep)
: exportInfo.setTarget(
dep,
from,
fromExport === undefined ? [name] : fromExport,
priority
))
) {
changed = true;
}
// Recalculate target exportsInfo
const target = exportInfo.getTarget(moduleGraph);
let targetExportsInfo;
if (target) {
const targetModuleExportsInfo =
moduleGraph.getExportsInfo(target.module);
targetExportsInfo =
targetModuleExportsInfo.getNestedExportsInfo(
target.export
);
// add dependency for this module
const set = dependencies.get(target.module);
if (set === undefined) {
dependencies.set(target.module, new Set([module]));
} else {
set.add(module);
}
}
if (exportInfo.exportsInfoOwned) {
if (
/** @type {ExportsInfo} */
(exportInfo.exportsInfo).setRedirectNamedTo(
targetExportsInfo
)
) {
changed = true;
}
} else if (exportInfo.exportsInfo !== targetExportsInfo) {
exportInfo.exportsInfo = targetExportsInfo;
changed = true;
}
}
};
mergeExports(exportsInfo, exports);
}
// store dependencies
if (exportDeps) {
cacheable = false;
for (const exportDependency of exportDeps) {
// add dependency for this module
const set = dependencies.get(exportDependency);
if (set === undefined) {
dependencies.set(exportDependency, new Set([module]));
} else {
set.add(module);
}
}
}
};
const notifyDependencies = () => {
const deps = dependencies.get(module);
if (deps !== undefined) {
for (const dep of deps) {
queue.enqueue(dep);
}
}
};
logger.time("figure out provided exports");
while (queue.length > 0) {
module = /** @type {Module} */ (queue.dequeue());
statQueueItemsProcessed++;
exportsInfo = moduleGraph.getExportsInfo(module);
cacheable = true;
changed = false;
exportsSpecsFromDependencies.clear();
moduleGraph.freeze();
processDependenciesBlock(module);
moduleGraph.unfreeze();
for (const [dep, exportsSpec] of exportsSpecsFromDependencies) {
processExportsSpec(dep, exportsSpec);
}
if (cacheable) {
modulesToStore.add(module);
}
if (changed) {
notifyDependencies();
}
}
logger.timeEnd("figure out provided exports");
logger.log(
`${Math.round(
(100 * (statFlaggedUncached + statNotCached)) /
(statRestoredFromMemCache +
statRestoredFromCache +
statNotCached +
statFlaggedUncached +
statNoExports)
)}% of exports of modules have been determined (${statNoExports} no declared exports, ${statNotCached} not cached, ${statFlaggedUncached} flagged uncacheable, ${statRestoredFromCache} from cache, ${statRestoredFromMemCache} from mem cache, ${
statQueueItemsProcessed - statNotCached - statFlaggedUncached
} additional calculations due to dependencies)`
);
logger.time("store provided exports into cache");
asyncLib.each(
modulesToStore,
(module, callback) => {
if (
typeof (
/** @type {BuildInfo} */
(module.buildInfo).hash
) !== "string"
) {
// not cacheable
return callback();
}
const cachedData = moduleGraph
.getExportsInfo(module)
.getRestoreProvidedData();
const memCache =
moduleMemCaches && moduleMemCaches.get(module);
if (memCache) {
memCache.set(this, cachedData);
}
cache.store(
module.identifier(),
/** @type {BuildInfo} */
(module.buildInfo).hash,
cachedData,
callback
);
},
err => {
logger.timeEnd("store provided exports into cache");
callback(err);
}
);
}
);
}
);
/** @type {WeakMap<Module, RestoreProvidedData>} */
const providedExportsCache = new WeakMap();
compilation.hooks.rebuildModule.tap(PLUGIN_NAME, module => {
providedExportsCache.set(
module,
moduleGraph.getExportsInfo(module).getRestoreProvidedData()
);
});
compilation.hooks.finishRebuildingModule.tap(PLUGIN_NAME, module => {
moduleGraph.getExportsInfo(module).restoreProvided(
/** @type {RestoreProvidedData} */
(providedExportsCache.get(module))
);
});
});
}
}
module.exports = FlagDependencyExportsPlugin;

View File

@ -0,0 +1,347 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const Dependency = require("./Dependency");
const { UsageState } = require("./ExportsInfo");
const ModuleGraphConnection = require("./ModuleGraphConnection");
const { STAGE_DEFAULT } = require("./OptimizationStages");
const ArrayQueue = require("./util/ArrayQueue");
const TupleQueue = require("./util/TupleQueue");
const { getEntryRuntime, mergeRuntimeOwned } = require("./util/runtime");
/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./ChunkGroup")} ChunkGroup */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
/** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */
/** @typedef {import("./ExportsInfo")} ExportsInfo */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
const { NO_EXPORTS_REFERENCED, EXPORTS_OBJECT_REFERENCED } = Dependency;
const PLUGIN_NAME = "FlagDependencyUsagePlugin";
const PLUGIN_LOGGER_NAME = `webpack.${PLUGIN_NAME}`;
class FlagDependencyUsagePlugin {
/**
* @param {boolean} global do a global analysis instead of per runtime
*/
constructor(global) {
this.global = global;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
const moduleGraph = compilation.moduleGraph;
compilation.hooks.optimizeDependencies.tap(
{ name: PLUGIN_NAME, stage: STAGE_DEFAULT },
modules => {
if (compilation.moduleMemCaches) {
throw new Error(
"optimization.usedExports can't be used with cacheUnaffected as export usage is a global effect"
);
}
const logger = compilation.getLogger(PLUGIN_LOGGER_NAME);
/** @type {Map<ExportsInfo, Module>} */
const exportInfoToModuleMap = new Map();
/** @type {TupleQueue<Module, RuntimeSpec>} */
const queue = new TupleQueue();
/**
* @param {Module} module module to process
* @param {(string[] | ReferencedExport)[]} usedExports list of used exports
* @param {RuntimeSpec} runtime part of which runtime
* @param {boolean} forceSideEffects always apply side effects
* @returns {void}
*/
const processReferencedModule = (
module,
usedExports,
runtime,
forceSideEffects
) => {
const exportsInfo = moduleGraph.getExportsInfo(module);
if (usedExports.length > 0) {
if (!module.buildMeta || !module.buildMeta.exportsType) {
if (exportsInfo.setUsedWithoutInfo(runtime)) {
queue.enqueue(module, runtime);
}
return;
}
for (const usedExportInfo of usedExports) {
let usedExport;
let canMangle = true;
if (Array.isArray(usedExportInfo)) {
usedExport = usedExportInfo;
} else {
usedExport = usedExportInfo.name;
canMangle = usedExportInfo.canMangle !== false;
}
if (usedExport.length === 0) {
if (exportsInfo.setUsedInUnknownWay(runtime)) {
queue.enqueue(module, runtime);
}
} else {
let currentExportsInfo = exportsInfo;
for (let i = 0; i < usedExport.length; i++) {
const exportInfo = currentExportsInfo.getExportInfo(
usedExport[i]
);
if (canMangle === false) {
exportInfo.canMangleUse = false;
}
const lastOne = i === usedExport.length - 1;
if (!lastOne) {
const nestedInfo = exportInfo.getNestedExportsInfo();
if (nestedInfo) {
if (
exportInfo.setUsedConditionally(
used => used === UsageState.Unused,
UsageState.OnlyPropertiesUsed,
runtime
)
) {
const currentModule =
currentExportsInfo === exportsInfo
? module
: exportInfoToModuleMap.get(currentExportsInfo);
if (currentModule) {
queue.enqueue(currentModule, runtime);
}
}
currentExportsInfo = nestedInfo;
continue;
}
}
if (
exportInfo.setUsedConditionally(
v => v !== UsageState.Used,
UsageState.Used,
runtime
)
) {
const currentModule =
currentExportsInfo === exportsInfo
? module
: exportInfoToModuleMap.get(currentExportsInfo);
if (currentModule) {
queue.enqueue(currentModule, runtime);
}
}
break;
}
}
}
} else {
// for a module without side effects we stop tracking usage here when no export is used
// This module won't be evaluated in this case
// TODO webpack 6 remove this check
if (
!forceSideEffects &&
module.factoryMeta !== undefined &&
module.factoryMeta.sideEffectFree
) {
return;
}
if (exportsInfo.setUsedForSideEffectsOnly(runtime)) {
queue.enqueue(module, runtime);
}
}
};
/**
* @param {DependenciesBlock} module the module
* @param {RuntimeSpec} runtime part of which runtime
* @param {boolean} forceSideEffects always apply side effects
* @returns {void}
*/
const processModule = (module, runtime, forceSideEffects) => {
/** @type {Map<Module, (string[] | ReferencedExport)[] | Map<string, string[] | ReferencedExport>>} */
const map = new Map();
/** @type {ArrayQueue<DependenciesBlock>} */
const queue = new ArrayQueue();
queue.enqueue(module);
for (;;) {
const block = queue.dequeue();
if (block === undefined) break;
for (const b of block.blocks) {
if (
!this.global &&
b.groupOptions &&
b.groupOptions.entryOptions
) {
processModule(
b,
b.groupOptions.entryOptions.runtime || undefined,
true
);
} else {
queue.enqueue(b);
}
}
for (const dep of block.dependencies) {
const connection = moduleGraph.getConnection(dep);
if (!connection || !connection.module) {
continue;
}
const activeState = connection.getActiveState(runtime);
if (activeState === false) continue;
const { module } = connection;
if (activeState === ModuleGraphConnection.TRANSITIVE_ONLY) {
processModule(module, runtime, false);
continue;
}
const oldReferencedExports = map.get(module);
if (oldReferencedExports === EXPORTS_OBJECT_REFERENCED) {
continue;
}
const referencedExports =
compilation.getDependencyReferencedExports(dep, runtime);
if (
oldReferencedExports === undefined ||
oldReferencedExports === NO_EXPORTS_REFERENCED ||
referencedExports === EXPORTS_OBJECT_REFERENCED
) {
map.set(module, referencedExports);
} else if (
oldReferencedExports !== undefined &&
referencedExports === NO_EXPORTS_REFERENCED
) {
continue;
} else {
let exportsMap;
if (Array.isArray(oldReferencedExports)) {
exportsMap = new Map();
for (const item of oldReferencedExports) {
if (Array.isArray(item)) {
exportsMap.set(item.join("\n"), item);
} else {
exportsMap.set(item.name.join("\n"), item);
}
}
map.set(module, exportsMap);
} else {
exportsMap = oldReferencedExports;
}
for (const item of referencedExports) {
if (Array.isArray(item)) {
const key = item.join("\n");
const oldItem = exportsMap.get(key);
if (oldItem === undefined) {
exportsMap.set(key, item);
}
// if oldItem is already an array we have to do nothing
// if oldItem is an ReferencedExport object, we don't have to do anything
// as canMangle defaults to true for arrays
} else {
const key = item.name.join("\n");
const oldItem = exportsMap.get(key);
if (oldItem === undefined || Array.isArray(oldItem)) {
exportsMap.set(key, item);
} else {
exportsMap.set(key, {
name: item.name,
canMangle: item.canMangle && oldItem.canMangle
});
}
}
}
}
}
}
for (const [module, referencedExports] of map) {
if (Array.isArray(referencedExports)) {
processReferencedModule(
module,
referencedExports,
runtime,
forceSideEffects
);
} else {
processReferencedModule(
module,
Array.from(referencedExports.values()),
runtime,
forceSideEffects
);
}
}
};
logger.time("initialize exports usage");
for (const module of modules) {
const exportsInfo = moduleGraph.getExportsInfo(module);
exportInfoToModuleMap.set(exportsInfo, module);
exportsInfo.setHasUseInfo();
}
logger.timeEnd("initialize exports usage");
logger.time("trace exports usage in graph");
/**
* @param {Dependency} dep dependency
* @param {RuntimeSpec} runtime runtime
*/
const processEntryDependency = (dep, runtime) => {
const module = moduleGraph.getModule(dep);
if (module) {
processReferencedModule(
module,
NO_EXPORTS_REFERENCED,
runtime,
true
);
}
};
/** @type {RuntimeSpec} */
let globalRuntime;
for (const [
entryName,
{ dependencies: deps, includeDependencies: includeDeps, options }
] of compilation.entries) {
const runtime = this.global
? undefined
: getEntryRuntime(compilation, entryName, options);
for (const dep of deps) {
processEntryDependency(dep, runtime);
}
for (const dep of includeDeps) {
processEntryDependency(dep, runtime);
}
globalRuntime = mergeRuntimeOwned(globalRuntime, runtime);
}
for (const dep of compilation.globalEntry.dependencies) {
processEntryDependency(dep, globalRuntime);
}
for (const dep of compilation.globalEntry.includeDependencies) {
processEntryDependency(dep, globalRuntime);
}
while (queue.length) {
const [module, runtime] = /** @type {[Module, RuntimeSpec]} */ (
queue.dequeue()
);
processModule(module, runtime, false);
}
logger.timeEnd("trace exports usage in graph");
}
);
});
}
}
module.exports = FlagDependencyUsagePlugin;

View File

@ -0,0 +1,56 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { getEntryRuntime } = require("./util/runtime");
/** @typedef {import("./Compiler")} Compiler */
const PLUGIN_NAME = "FlagEntryExportAsUsedPlugin";
class FlagEntryExportAsUsedPlugin {
/**
* @param {boolean} nsObjectUsed true, if the ns object is used
* @param {string} explanation explanation for the reason
*/
constructor(nsObjectUsed, explanation) {
this.nsObjectUsed = nsObjectUsed;
this.explanation = explanation;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
const moduleGraph = compilation.moduleGraph;
compilation.hooks.seal.tap(PLUGIN_NAME, () => {
for (const [
entryName,
{ dependencies: deps, options }
] of compilation.entries) {
const runtime = getEntryRuntime(compilation, entryName, options);
for (const dep of deps) {
const module = moduleGraph.getModule(dep);
if (module) {
const exportsInfo = moduleGraph.getExportsInfo(module);
if (this.nsObjectUsed) {
exportsInfo.setUsedInUnknownWay(runtime);
} else {
exportsInfo.setAllKnownExportsUsed(runtime);
}
moduleGraph.addExtraReason(module, this.explanation);
}
}
}
});
});
}
}
module.exports = FlagEntryExportAsUsedPlugin;

183
app_vue/node_modules/webpack/lib/Generator.js generated vendored Normal file
View File

@ -0,0 +1,183 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
/** @typedef {import("./Compilation")} Compilation */
/** @typedef {import("./ConcatenationScope")} ConcatenationScope */
/** @typedef {import("./DependencyTemplate")} DependencyTemplate */
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
/** @typedef {import("./Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */
/** @typedef {import("./Module").RuntimeRequirements} RuntimeRequirements */
/** @typedef {import("./Module").SourceTypes} SourceTypes */
/** @typedef {import("./ModuleGraph")} ModuleGraph */
/** @typedef {import("./NormalModule")} NormalModule */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/**
* @typedef {object} GenerateContext
* @property {DependencyTemplates} dependencyTemplates mapping from dependencies to templates
* @property {RuntimeTemplate} runtimeTemplate the runtime template
* @property {ModuleGraph} moduleGraph the module graph
* @property {ChunkGraph} chunkGraph the chunk graph
* @property {RuntimeRequirements} runtimeRequirements the requirements for runtime
* @property {RuntimeSpec} runtime the runtime
* @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules
* @property {CodeGenerationResults=} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that)
* @property {string} type which kind of code should be generated
* @property {() => Map<string, TODO>=} getData get access to the code generation data
*/
/**
* @callback GenerateErrorFn
* @param {Error} error the error
* @param {NormalModule} module module for which the code should be generated
* @param {GenerateContext} generateContext context for generate
* @returns {Source | null} generated code
*/
/**
* @typedef {object} UpdateHashContext
* @property {NormalModule} module the module
* @property {ChunkGraph} chunkGraph
* @property {RuntimeSpec} runtime
* @property {RuntimeTemplate=} runtimeTemplate
*/
class Generator {
/**
* @param {Record<string, Generator>} map map of types
* @returns {ByTypeGenerator} generator by type
*/
static byType(map) {
return new ByTypeGenerator(map);
}
/* istanbul ignore next */
/**
* @abstract
* @param {NormalModule} module fresh module
* @returns {SourceTypes} available types (do not mutate)
*/
getTypes(module) {
const AbstractMethodError = require("./AbstractMethodError");
throw new AbstractMethodError();
}
/* istanbul ignore next */
/**
* @abstract
* @param {NormalModule} module the module
* @param {string=} type source type
* @returns {number} estimate size of the module
*/
getSize(module, type) {
const AbstractMethodError = require("./AbstractMethodError");
throw new AbstractMethodError();
}
/* istanbul ignore next */
/**
* @abstract
* @param {NormalModule} module module for which the code should be generated
* @param {GenerateContext} generateContext context for generate
* @returns {Source | null} generated code
*/
generate(
module,
{ dependencyTemplates, runtimeTemplate, moduleGraph, type }
) {
const AbstractMethodError = require("./AbstractMethodError");
throw new AbstractMethodError();
}
/**
* @param {NormalModule} module module for which the bailout reason should be determined
* @param {ConcatenationBailoutReasonContext} context context
* @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated
*/
getConcatenationBailoutReason(module, context) {
return `Module Concatenation is not implemented for ${this.constructor.name}`;
}
/**
* @param {Hash} hash hash that will be modified
* @param {UpdateHashContext} updateHashContext context for updating hash
*/
updateHash(hash, { module, runtime }) {
// no nothing
}
}
/**
* @this {ByTypeGenerator}
* @type {GenerateErrorFn}
*/
function generateError(error, module, generateContext) {
const type = generateContext.type;
const generator =
/** @type {Generator & { generateError?: GenerateErrorFn }} */
(this.map[type]);
if (!generator) {
throw new Error(`Generator.byType: no generator specified for ${type}`);
}
if (typeof generator.generateError === "undefined") {
return null;
}
return generator.generateError(error, module, generateContext);
}
class ByTypeGenerator extends Generator {
/**
* @param {Record<string, Generator>} map map of types
*/
constructor(map) {
super();
this.map = map;
this._types = new Set(Object.keys(map));
/** @type {GenerateErrorFn | undefined} */
this.generateError = generateError.bind(this);
}
/**
* @param {NormalModule} module fresh module
* @returns {SourceTypes} available types (do not mutate)
*/
getTypes(module) {
return this._types;
}
/**
* @param {NormalModule} module the module
* @param {string=} type source type
* @returns {number} estimate size of the module
*/
getSize(module, type = "javascript") {
const t = type;
const generator = this.map[t];
return generator ? generator.getSize(module, t) : 0;
}
/**
* @param {NormalModule} module module for which the code should be generated
* @param {GenerateContext} generateContext context for generate
* @returns {Source | null} generated code
*/
generate(module, generateContext) {
const type = generateContext.type;
const generator = this.map[type];
if (!generator) {
throw new Error(`Generator.byType: no generator specified for ${type}`);
}
return generator.generate(module, generateContext);
}
}
module.exports = Generator;

38
app_vue/node_modules/webpack/lib/GraphHelpers.js generated vendored Normal file
View File

@ -0,0 +1,38 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./ChunkGroup")} ChunkGroup */
/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
/** @typedef {import("./Module")} Module */
/**
* @param {ChunkGroup} chunkGroup the ChunkGroup to connect
* @param {Chunk} chunk chunk to tie to ChunkGroup
* @returns {void}
*/
const connectChunkGroupAndChunk = (chunkGroup, chunk) => {
if (chunkGroup.pushChunk(chunk)) {
chunk.addGroup(chunkGroup);
}
};
/**
* @param {ChunkGroup} parent parent ChunkGroup to connect
* @param {ChunkGroup} child child ChunkGroup to connect
* @returns {void}
*/
const connectChunkGroupParentAndChild = (parent, child) => {
if (parent.addChild(child)) {
child.addParent(parent);
}
};
module.exports.connectChunkGroupAndChunk = connectChunkGroupAndChunk;
module.exports.connectChunkGroupParentAndChild =
connectChunkGroupParentAndChild;

View File

@ -0,0 +1,16 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
*/
"use strict";
const WebpackError = require("./WebpackError");
module.exports = class HarmonyLinkingError extends WebpackError {
/** @param {string} message Error message */
constructor(message) {
super(message);
this.name = "HarmonyLinkingError";
this.hideStack = true;
}
};

91
app_vue/node_modules/webpack/lib/HookWebpackError.js generated vendored Normal file
View File

@ -0,0 +1,91 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Sean Larkin @thelarkinn
*/
"use strict";
const WebpackError = require("./WebpackError");
/** @typedef {import("./Module")} Module */
/**
* @template T
* @callback Callback
* @param {Error | null} err
* @param {T=} stats
* @returns {void}
*/
class HookWebpackError extends WebpackError {
/**
* Creates an instance of HookWebpackError.
* @param {Error} error inner error
* @param {string} hook name of hook
*/
constructor(error, hook) {
super(error.message);
this.name = "HookWebpackError";
this.hook = hook;
this.error = error;
this.hideStack = true;
this.details = `caused by plugins in ${hook}\n${error.stack}`;
this.stack += `\n-- inner error --\n${error.stack}`;
}
}
module.exports = HookWebpackError;
/**
* @param {Error} error an error
* @param {string} hook name of the hook
* @returns {WebpackError} a webpack error
*/
const makeWebpackError = (error, hook) => {
if (error instanceof WebpackError) return error;
return new HookWebpackError(error, hook);
};
module.exports.makeWebpackError = makeWebpackError;
/**
* @template T
* @param {(err: WebpackError | null, result?: T) => void} callback webpack error callback
* @param {string} hook name of hook
* @returns {Callback<T>} generic callback
*/
const makeWebpackErrorCallback = (callback, hook) => (err, result) => {
if (err) {
if (err instanceof WebpackError) {
callback(err);
return;
}
callback(new HookWebpackError(err, hook));
return;
}
callback(null, result);
};
module.exports.makeWebpackErrorCallback = makeWebpackErrorCallback;
/**
* @template T
* @param {() => T} fn function which will be wrapping in try catch
* @param {string} hook name of hook
* @returns {T} the result
*/
const tryRunOrWebpackError = (fn, hook) => {
let r;
try {
r = fn();
} catch (err) {
if (err instanceof WebpackError) {
throw err;
}
throw new HookWebpackError(/** @type {Error} */ (err), hook);
}
return r;
};
module.exports.tryRunOrWebpackError = tryRunOrWebpackError;

View File

@ -0,0 +1,869 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { SyncBailHook } = require("tapable");
const { RawSource } = require("webpack-sources");
const ChunkGraph = require("./ChunkGraph");
const Compilation = require("./Compilation");
const HotUpdateChunk = require("./HotUpdateChunk");
const NormalModule = require("./NormalModule");
const RuntimeGlobals = require("./RuntimeGlobals");
const WebpackError = require("./WebpackError");
const ConstDependency = require("./dependencies/ConstDependency");
const ImportMetaHotAcceptDependency = require("./dependencies/ImportMetaHotAcceptDependency");
const ImportMetaHotDeclineDependency = require("./dependencies/ImportMetaHotDeclineDependency");
const ModuleHotAcceptDependency = require("./dependencies/ModuleHotAcceptDependency");
const ModuleHotDeclineDependency = require("./dependencies/ModuleHotDeclineDependency");
const HotModuleReplacementRuntimeModule = require("./hmr/HotModuleReplacementRuntimeModule");
const JavascriptParser = require("./javascript/JavascriptParser");
const {
evaluateToIdentifier
} = require("./javascript/JavascriptParserHelpers");
const { find, isSubset } = require("./util/SetHelpers");
const TupleSet = require("./util/TupleSet");
const { compareModulesById } = require("./util/comparators");
const {
getRuntimeKey,
keyToRuntime,
forEachRuntime,
mergeRuntimeOwned,
subtractRuntime,
intersectRuntime
} = require("./util/runtime");
const {
JAVASCRIPT_MODULE_TYPE_AUTO,
JAVASCRIPT_MODULE_TYPE_DYNAMIC,
JAVASCRIPT_MODULE_TYPE_ESM,
WEBPACK_MODULE_TYPE_RUNTIME
} = require("./ModuleTypeConstants");
/** @typedef {import("estree").CallExpression} CallExpression */
/** @typedef {import("estree").Expression} Expression */
/** @typedef {import("estree").SpreadElement} SpreadElement */
/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputNormalized */
/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./Chunk").ChunkId} ChunkId */
/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
/** @typedef {import("./Compilation").Records} Records */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./Module").BuildInfo} BuildInfo */
/** @typedef {import("./RuntimeModule")} RuntimeModule */
/** @typedef {import("./javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
/** @typedef {import("./javascript/JavascriptParserHelpers").Range} Range */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/**
* @typedef {object} HMRJavascriptParserHooks
* @property {SyncBailHook<[Expression | SpreadElement, string[]], void>} hotAcceptCallback
* @property {SyncBailHook<[CallExpression, string[]], void>} hotAcceptWithoutCallback
*/
/** @typedef {{ updatedChunkIds: Set<ChunkId>, removedChunkIds: Set<ChunkId>, removedModules: Set<Module>, filename: string, assetInfo: AssetInfo }} HotUpdateMainContentByRuntimeItem */
/** @typedef {Map<string, HotUpdateMainContentByRuntimeItem>} HotUpdateMainContentByRuntime */
/** @type {WeakMap<JavascriptParser, HMRJavascriptParserHooks>} */
const parserHooksMap = new WeakMap();
const PLUGIN_NAME = "HotModuleReplacementPlugin";
class HotModuleReplacementPlugin {
/**
* @param {JavascriptParser} parser the parser
* @returns {HMRJavascriptParserHooks} the attached hooks
*/
static getParserHooks(parser) {
if (!(parser instanceof JavascriptParser)) {
throw new TypeError(
"The 'parser' argument must be an instance of JavascriptParser"
);
}
let hooks = parserHooksMap.get(parser);
if (hooks === undefined) {
hooks = {
hotAcceptCallback: new SyncBailHook(["expression", "requests"]),
hotAcceptWithoutCallback: new SyncBailHook(["expression", "requests"])
};
parserHooksMap.set(parser, hooks);
}
return hooks;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
const { _backCompat: backCompat } = compiler;
if (compiler.options.output.strictModuleErrorHandling === undefined)
compiler.options.output.strictModuleErrorHandling = true;
const runtimeRequirements = [RuntimeGlobals.module];
/**
* @param {JavascriptParser} parser the parser
* @param {typeof ModuleHotAcceptDependency} ParamDependency dependency
* @returns {(expr: CallExpression) => boolean | undefined} callback
*/
const createAcceptHandler = (parser, ParamDependency) => {
const { hotAcceptCallback, hotAcceptWithoutCallback } =
HotModuleReplacementPlugin.getParserHooks(parser);
return expr => {
const module = parser.state.module;
const dep = new ConstDependency(
`${module.moduleArgument}.hot.accept`,
/** @type {Range} */ (expr.callee.range),
runtimeRequirements
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
module.addPresentationalDependency(dep);
/** @type {BuildInfo} */
(module.buildInfo).moduleConcatenationBailout =
"Hot Module Replacement";
if (expr.arguments.length >= 1) {
const arg = parser.evaluateExpression(expr.arguments[0]);
/** @type {BasicEvaluatedExpression[]} */
let params = [];
if (arg.isString()) {
params = [arg];
} else if (arg.isArray()) {
params =
/** @type {BasicEvaluatedExpression[]} */
(arg.items).filter(param => param.isString());
}
/** @type {string[]} */
const requests = [];
if (params.length > 0) {
for (const [idx, param] of params.entries()) {
const request = /** @type {string} */ (param.string);
const dep = new ParamDependency(
request,
/** @type {Range} */ (param.range)
);
dep.optional = true;
dep.loc = Object.create(
/** @type {DependencyLocation} */ (expr.loc)
);
dep.loc.index = idx;
module.addDependency(dep);
requests.push(request);
}
if (expr.arguments.length > 1) {
hotAcceptCallback.call(expr.arguments[1], requests);
for (let i = 1; i < expr.arguments.length; i++) {
parser.walkExpression(expr.arguments[i]);
}
return true;
}
hotAcceptWithoutCallback.call(expr, requests);
return true;
}
}
parser.walkExpressions(expr.arguments);
return true;
};
};
/**
* @param {JavascriptParser} parser the parser
* @param {typeof ModuleHotDeclineDependency} ParamDependency dependency
* @returns {(expr: CallExpression) => boolean | undefined} callback
*/
const createDeclineHandler = (parser, ParamDependency) => expr => {
const module = parser.state.module;
const dep = new ConstDependency(
`${module.moduleArgument}.hot.decline`,
/** @type {Range} */ (expr.callee.range),
runtimeRequirements
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
module.addPresentationalDependency(dep);
/** @type {BuildInfo} */
(module.buildInfo).moduleConcatenationBailout = "Hot Module Replacement";
if (expr.arguments.length === 1) {
const arg = parser.evaluateExpression(expr.arguments[0]);
/** @type {BasicEvaluatedExpression[]} */
let params = [];
if (arg.isString()) {
params = [arg];
} else if (arg.isArray()) {
params =
/** @type {BasicEvaluatedExpression[]} */
(arg.items).filter(param => param.isString());
}
for (const [idx, param] of params.entries()) {
const dep = new ParamDependency(
/** @type {string} */ (param.string),
/** @type {Range} */ (param.range)
);
dep.optional = true;
dep.loc = Object.create(/** @type {DependencyLocation} */ (expr.loc));
dep.loc.index = idx;
module.addDependency(dep);
}
}
return true;
};
/**
* @param {JavascriptParser} parser the parser
* @returns {(expr: Expression) => boolean | undefined} callback
*/
const createHMRExpressionHandler = parser => expr => {
const module = parser.state.module;
const dep = new ConstDependency(
`${module.moduleArgument}.hot`,
/** @type {Range} */ (expr.range),
runtimeRequirements
);
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
module.addPresentationalDependency(dep);
/** @type {BuildInfo} */
(module.buildInfo).moduleConcatenationBailout = "Hot Module Replacement";
return true;
};
/**
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
const applyModuleHot = parser => {
parser.hooks.evaluateIdentifier.for("module.hot").tap(
{
name: PLUGIN_NAME,
before: "NodeStuffPlugin"
},
expr =>
evaluateToIdentifier(
"module.hot",
"module",
() => ["hot"],
true
)(expr)
);
parser.hooks.call
.for("module.hot.accept")
.tap(
PLUGIN_NAME,
createAcceptHandler(parser, ModuleHotAcceptDependency)
);
parser.hooks.call
.for("module.hot.decline")
.tap(
PLUGIN_NAME,
createDeclineHandler(parser, ModuleHotDeclineDependency)
);
parser.hooks.expression
.for("module.hot")
.tap(PLUGIN_NAME, createHMRExpressionHandler(parser));
};
/**
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
const applyImportMetaHot = parser => {
parser.hooks.evaluateIdentifier
.for("import.meta.webpackHot")
.tap(PLUGIN_NAME, expr =>
evaluateToIdentifier(
"import.meta.webpackHot",
"import.meta",
() => ["webpackHot"],
true
)(expr)
);
parser.hooks.call
.for("import.meta.webpackHot.accept")
.tap(
PLUGIN_NAME,
createAcceptHandler(parser, ImportMetaHotAcceptDependency)
);
parser.hooks.call
.for("import.meta.webpackHot.decline")
.tap(
PLUGIN_NAME,
createDeclineHandler(parser, ImportMetaHotDeclineDependency)
);
parser.hooks.expression
.for("import.meta.webpackHot")
.tap(PLUGIN_NAME, createHMRExpressionHandler(parser));
};
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
// This applies the HMR plugin only to the targeted compiler
// It should not affect child compilations
if (compilation.compiler !== compiler) return;
// #region module.hot.* API
compilation.dependencyFactories.set(
ModuleHotAcceptDependency,
normalModuleFactory
);
compilation.dependencyTemplates.set(
ModuleHotAcceptDependency,
new ModuleHotAcceptDependency.Template()
);
compilation.dependencyFactories.set(
ModuleHotDeclineDependency,
normalModuleFactory
);
compilation.dependencyTemplates.set(
ModuleHotDeclineDependency,
new ModuleHotDeclineDependency.Template()
);
// #endregion
// #region import.meta.webpackHot.* API
compilation.dependencyFactories.set(
ImportMetaHotAcceptDependency,
normalModuleFactory
);
compilation.dependencyTemplates.set(
ImportMetaHotAcceptDependency,
new ImportMetaHotAcceptDependency.Template()
);
compilation.dependencyFactories.set(
ImportMetaHotDeclineDependency,
normalModuleFactory
);
compilation.dependencyTemplates.set(
ImportMetaHotDeclineDependency,
new ImportMetaHotDeclineDependency.Template()
);
// #endregion
let hotIndex = 0;
/** @type {Record<string, string>} */
const fullHashChunkModuleHashes = {};
/** @type {Record<string, string>} */
const chunkModuleHashes = {};
compilation.hooks.record.tap(PLUGIN_NAME, (compilation, records) => {
if (records.hash === compilation.hash) return;
const chunkGraph = compilation.chunkGraph;
records.hash = compilation.hash;
records.hotIndex = hotIndex;
records.fullHashChunkModuleHashes = fullHashChunkModuleHashes;
records.chunkModuleHashes = chunkModuleHashes;
records.chunkHashes = {};
records.chunkRuntime = {};
for (const chunk of compilation.chunks) {
const chunkId = /** @type {ChunkId} */ (chunk.id);
records.chunkHashes[chunkId] = chunk.hash;
records.chunkRuntime[chunkId] = getRuntimeKey(chunk.runtime);
}
records.chunkModuleIds = {};
for (const chunk of compilation.chunks) {
records.chunkModuleIds[/** @type {ChunkId} */ (chunk.id)] =
Array.from(
chunkGraph.getOrderedChunkModulesIterable(
chunk,
compareModulesById(chunkGraph)
),
m => chunkGraph.getModuleId(m)
);
}
});
/** @type {TupleSet<Module, Chunk>} */
const updatedModules = new TupleSet();
/** @type {TupleSet<Module, Chunk>} */
const fullHashModules = new TupleSet();
/** @type {TupleSet<Module, RuntimeSpec>} */
const nonCodeGeneratedModules = new TupleSet();
compilation.hooks.fullHash.tap(PLUGIN_NAME, hash => {
const chunkGraph = compilation.chunkGraph;
const records = /** @type {Records} */ (compilation.records);
for (const chunk of compilation.chunks) {
/**
* @param {Module} module module
* @returns {string} module hash
*/
const getModuleHash = module => {
if (
compilation.codeGenerationResults.has(module, chunk.runtime)
) {
return compilation.codeGenerationResults.getHash(
module,
chunk.runtime
);
}
nonCodeGeneratedModules.add(module, chunk.runtime);
return chunkGraph.getModuleHash(module, chunk.runtime);
};
const fullHashModulesInThisChunk =
chunkGraph.getChunkFullHashModulesSet(chunk);
if (fullHashModulesInThisChunk !== undefined) {
for (const module of fullHashModulesInThisChunk) {
fullHashModules.add(module, chunk);
}
}
const modules = chunkGraph.getChunkModulesIterable(chunk);
if (modules !== undefined) {
if (records.chunkModuleHashes) {
if (fullHashModulesInThisChunk !== undefined) {
for (const module of modules) {
const key = `${chunk.id}|${module.identifier()}`;
const hash = getModuleHash(module);
if (
fullHashModulesInThisChunk.has(
/** @type {RuntimeModule} */ (module)
)
) {
if (records.fullHashChunkModuleHashes[key] !== hash) {
updatedModules.add(module, chunk);
}
fullHashChunkModuleHashes[key] = hash;
} else {
if (records.chunkModuleHashes[key] !== hash) {
updatedModules.add(module, chunk);
}
chunkModuleHashes[key] = hash;
}
}
} else {
for (const module of modules) {
const key = `${chunk.id}|${module.identifier()}`;
const hash = getModuleHash(module);
if (records.chunkModuleHashes[key] !== hash) {
updatedModules.add(module, chunk);
}
chunkModuleHashes[key] = hash;
}
}
} else if (fullHashModulesInThisChunk !== undefined) {
for (const module of modules) {
const key = `${chunk.id}|${module.identifier()}`;
const hash = getModuleHash(module);
if (
fullHashModulesInThisChunk.has(
/** @type {RuntimeModule} */ (module)
)
) {
fullHashChunkModuleHashes[key] = hash;
} else {
chunkModuleHashes[key] = hash;
}
}
} else {
for (const module of modules) {
const key = `${chunk.id}|${module.identifier()}`;
const hash = getModuleHash(module);
chunkModuleHashes[key] = hash;
}
}
}
}
hotIndex = records.hotIndex || 0;
if (updatedModules.size > 0) hotIndex++;
hash.update(`${hotIndex}`);
});
compilation.hooks.processAssets.tap(
{
name: PLUGIN_NAME,
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
},
() => {
const chunkGraph = compilation.chunkGraph;
const records = /** @type {Records} */ (compilation.records);
if (records.hash === compilation.hash) return;
if (
!records.chunkModuleHashes ||
!records.chunkHashes ||
!records.chunkModuleIds
) {
return;
}
for (const [module, chunk] of fullHashModules) {
const key = `${chunk.id}|${module.identifier()}`;
const hash = nonCodeGeneratedModules.has(module, chunk.runtime)
? chunkGraph.getModuleHash(module, chunk.runtime)
: compilation.codeGenerationResults.getHash(
module,
chunk.runtime
);
if (records.chunkModuleHashes[key] !== hash) {
updatedModules.add(module, chunk);
}
chunkModuleHashes[key] = hash;
}
/** @type {HotUpdateMainContentByRuntime} */
const hotUpdateMainContentByRuntime = new Map();
let allOldRuntime;
for (const key of Object.keys(records.chunkRuntime)) {
const runtime = keyToRuntime(records.chunkRuntime[key]);
allOldRuntime = mergeRuntimeOwned(allOldRuntime, runtime);
}
forEachRuntime(allOldRuntime, runtime => {
const { path: filename, info: assetInfo } =
compilation.getPathWithInfo(
/** @type {NonNullable<OutputNormalized["hotUpdateMainFilename"]>} */
(compilation.outputOptions.hotUpdateMainFilename),
{
hash: records.hash,
runtime
}
);
hotUpdateMainContentByRuntime.set(
/** @type {string} */ (runtime),
{
updatedChunkIds: new Set(),
removedChunkIds: new Set(),
removedModules: new Set(),
filename,
assetInfo
}
);
});
if (hotUpdateMainContentByRuntime.size === 0) return;
// Create a list of all active modules to verify which modules are removed completely
/** @type {Map<number|string, Module>} */
const allModules = new Map();
for (const module of compilation.modules) {
const id =
/** @type {ModuleId} */
(chunkGraph.getModuleId(module));
allModules.set(id, module);
}
// List of completely removed modules
/** @type {Set<string | number>} */
const completelyRemovedModules = new Set();
for (const key of Object.keys(records.chunkHashes)) {
const oldRuntime = keyToRuntime(records.chunkRuntime[key]);
/** @type {Module[]} */
const remainingModules = [];
// Check which modules are removed
for (const id of records.chunkModuleIds[key]) {
const module = allModules.get(id);
if (module === undefined) {
completelyRemovedModules.add(id);
} else {
remainingModules.push(module);
}
}
/** @type {ChunkId | null} */
let chunkId;
let newModules;
let newRuntimeModules;
let newFullHashModules;
let newDependentHashModules;
let newRuntime;
let removedFromRuntime;
const currentChunk = find(
compilation.chunks,
chunk => `${chunk.id}` === key
);
if (currentChunk) {
chunkId = currentChunk.id;
newRuntime = intersectRuntime(
currentChunk.runtime,
allOldRuntime
);
if (newRuntime === undefined) continue;
newModules = chunkGraph
.getChunkModules(currentChunk)
.filter(module => updatedModules.has(module, currentChunk));
newRuntimeModules = Array.from(
chunkGraph.getChunkRuntimeModulesIterable(currentChunk)
).filter(module => updatedModules.has(module, currentChunk));
const fullHashModules =
chunkGraph.getChunkFullHashModulesIterable(currentChunk);
newFullHashModules =
fullHashModules &&
Array.from(fullHashModules).filter(module =>
updatedModules.has(module, currentChunk)
);
const dependentHashModules =
chunkGraph.getChunkDependentHashModulesIterable(currentChunk);
newDependentHashModules =
dependentHashModules &&
Array.from(dependentHashModules).filter(module =>
updatedModules.has(module, currentChunk)
);
removedFromRuntime = subtractRuntime(oldRuntime, newRuntime);
} else {
// chunk has completely removed
chunkId = `${Number(key)}` === key ? Number(key) : key;
removedFromRuntime = oldRuntime;
newRuntime = oldRuntime;
}
if (removedFromRuntime) {
// chunk was removed from some runtimes
forEachRuntime(removedFromRuntime, runtime => {
const item =
/** @type {HotUpdateMainContentByRuntimeItem} */
(
hotUpdateMainContentByRuntime.get(
/** @type {string} */ (runtime)
)
);
item.removedChunkIds.add(/** @type {ChunkId} */ (chunkId));
});
// dispose modules from the chunk in these runtimes
// where they are no longer in this runtime
for (const module of remainingModules) {
const moduleKey = `${key}|${module.identifier()}`;
const oldHash = records.chunkModuleHashes[moduleKey];
const runtimes = chunkGraph.getModuleRuntimes(module);
if (oldRuntime === newRuntime && runtimes.has(newRuntime)) {
// Module is still in the same runtime combination
const hash = nonCodeGeneratedModules.has(module, newRuntime)
? chunkGraph.getModuleHash(module, newRuntime)
: compilation.codeGenerationResults.getHash(
module,
newRuntime
);
if (hash !== oldHash) {
if (module.type === WEBPACK_MODULE_TYPE_RUNTIME) {
newRuntimeModules = newRuntimeModules || [];
newRuntimeModules.push(
/** @type {RuntimeModule} */ (module)
);
} else {
newModules = newModules || [];
newModules.push(module);
}
}
} else {
// module is no longer in this runtime combination
// We (incorrectly) assume that it's not in an overlapping runtime combination
// and dispose it from the main runtimes the chunk was removed from
forEachRuntime(removedFromRuntime, runtime => {
// If the module is still used in this runtime, do not dispose it
// This could create a bad runtime state where the module is still loaded,
// but no chunk which contains it. This means we don't receive further HMR updates
// to this module and that's bad.
// TODO force load one of the chunks which contains the module
for (const moduleRuntime of runtimes) {
if (typeof moduleRuntime === "string") {
if (moduleRuntime === runtime) return;
} else if (
moduleRuntime !== undefined &&
moduleRuntime.has(/** @type {string} */ (runtime))
)
return;
}
const item =
/** @type {HotUpdateMainContentByRuntimeItem} */ (
hotUpdateMainContentByRuntime.get(
/** @type {string} */ (runtime)
)
);
item.removedModules.add(module);
});
}
}
}
if (
(newModules && newModules.length > 0) ||
(newRuntimeModules && newRuntimeModules.length > 0)
) {
const hotUpdateChunk = new HotUpdateChunk();
if (backCompat)
ChunkGraph.setChunkGraphForChunk(hotUpdateChunk, chunkGraph);
hotUpdateChunk.id = chunkId;
hotUpdateChunk.runtime = currentChunk
? currentChunk.runtime
: newRuntime;
if (currentChunk) {
for (const group of currentChunk.groupsIterable)
hotUpdateChunk.addGroup(group);
}
chunkGraph.attachModules(hotUpdateChunk, newModules || []);
chunkGraph.attachRuntimeModules(
hotUpdateChunk,
newRuntimeModules || []
);
if (newFullHashModules) {
chunkGraph.attachFullHashModules(
hotUpdateChunk,
newFullHashModules
);
}
if (newDependentHashModules) {
chunkGraph.attachDependentHashModules(
hotUpdateChunk,
newDependentHashModules
);
}
const renderManifest = compilation.getRenderManifest({
chunk: hotUpdateChunk,
hash: records.hash,
fullHash: records.hash,
outputOptions: compilation.outputOptions,
moduleTemplates: compilation.moduleTemplates,
dependencyTemplates: compilation.dependencyTemplates,
codeGenerationResults: compilation.codeGenerationResults,
runtimeTemplate: compilation.runtimeTemplate,
moduleGraph: compilation.moduleGraph,
chunkGraph
});
for (const entry of renderManifest) {
/** @type {string} */
let filename;
/** @type {AssetInfo} */
let assetInfo;
if ("filename" in entry) {
filename = entry.filename;
assetInfo = entry.info;
} else {
({ path: filename, info: assetInfo } =
compilation.getPathWithInfo(
entry.filenameTemplate,
entry.pathOptions
));
}
const source = entry.render();
compilation.additionalChunkAssets.push(filename);
compilation.emitAsset(filename, source, {
hotModuleReplacement: true,
...assetInfo
});
if (currentChunk) {
currentChunk.files.add(filename);
compilation.hooks.chunkAsset.call(currentChunk, filename);
}
}
forEachRuntime(newRuntime, runtime => {
const item =
/** @type {HotUpdateMainContentByRuntimeItem} */ (
hotUpdateMainContentByRuntime.get(
/** @type {string} */ (runtime)
)
);
item.updatedChunkIds.add(/** @type {ChunkId} */ (chunkId));
});
}
}
const completelyRemovedModulesArray = Array.from(
completelyRemovedModules
);
const hotUpdateMainContentByFilename = new Map();
for (const {
removedChunkIds,
removedModules,
updatedChunkIds,
filename,
assetInfo
} of hotUpdateMainContentByRuntime.values()) {
const old = hotUpdateMainContentByFilename.get(filename);
if (
old &&
(!isSubset(old.removedChunkIds, removedChunkIds) ||
!isSubset(old.removedModules, removedModules) ||
!isSubset(old.updatedChunkIds, updatedChunkIds))
) {
compilation.warnings.push(
new WebpackError(`HotModuleReplacementPlugin
The configured output.hotUpdateMainFilename doesn't lead to unique filenames per runtime and HMR update differs between runtimes.
This might lead to incorrect runtime behavior of the applied update.
To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename option, or use the default config.`)
);
for (const chunkId of removedChunkIds)
old.removedChunkIds.add(chunkId);
for (const chunkId of removedModules)
old.removedModules.add(chunkId);
for (const chunkId of updatedChunkIds)
old.updatedChunkIds.add(chunkId);
continue;
}
hotUpdateMainContentByFilename.set(filename, {
removedChunkIds,
removedModules,
updatedChunkIds,
assetInfo
});
}
for (const [
filename,
{ removedChunkIds, removedModules, updatedChunkIds, assetInfo }
] of hotUpdateMainContentByFilename) {
const hotUpdateMainJson = {
c: Array.from(updatedChunkIds),
r: Array.from(removedChunkIds),
m:
removedModules.size === 0
? completelyRemovedModulesArray
: completelyRemovedModulesArray.concat(
Array.from(
removedModules,
m =>
/** @type {ModuleId} */ (chunkGraph.getModuleId(m))
)
)
};
const source = new RawSource(JSON.stringify(hotUpdateMainJson));
compilation.emitAsset(filename, source, {
hotModuleReplacement: true,
...assetInfo
});
}
}
);
compilation.hooks.additionalTreeRuntimeRequirements.tap(
PLUGIN_NAME,
(chunk, runtimeRequirements) => {
runtimeRequirements.add(RuntimeGlobals.hmrDownloadManifest);
runtimeRequirements.add(RuntimeGlobals.hmrDownloadUpdateHandlers);
runtimeRequirements.add(RuntimeGlobals.interceptModuleExecution);
runtimeRequirements.add(RuntimeGlobals.moduleCache);
compilation.addRuntimeModule(
chunk,
new HotModuleReplacementRuntimeModule()
);
}
);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_AUTO)
.tap(PLUGIN_NAME, parser => {
applyModuleHot(parser);
applyImportMetaHot(parser);
});
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
.tap(PLUGIN_NAME, parser => {
applyModuleHot(parser);
});
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_ESM)
.tap(PLUGIN_NAME, parser => {
applyImportMetaHot(parser);
});
normalModuleFactory.hooks.module.tap(PLUGIN_NAME, module => {
module.hot = true;
return module;
});
NormalModule.getCompilationHooks(compilation).loader.tap(
PLUGIN_NAME,
context => {
context.hot = true;
}
);
}
);
}
}
module.exports = HotModuleReplacementPlugin;

19
app_vue/node_modules/webpack/lib/HotUpdateChunk.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const Chunk = require("./Chunk");
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./util/Hash")} Hash */
class HotUpdateChunk extends Chunk {
constructor() {
super();
}
}
module.exports = HotUpdateChunk;

View File

@ -0,0 +1,39 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Ivan Kopeykin @vankop
*/
"use strict";
const ModuleFactory = require("./ModuleFactory");
/** @typedef {import("./ModuleFactory").ModuleFactoryCallback} ModuleFactoryCallback */
/** @typedef {import("./ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */
/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */
/**
* Ignores error when module is unresolved
*/
class IgnoreErrorModuleFactory extends ModuleFactory {
/**
* @param {NormalModuleFactory} normalModuleFactory normalModuleFactory instance
*/
constructor(normalModuleFactory) {
super();
this.normalModuleFactory = normalModuleFactory;
}
/**
* @param {ModuleFactoryCreateData} data data object
* @param {ModuleFactoryCallback} callback callback
* @returns {void}
*/
create(data, callback) {
this.normalModuleFactory.create(data, (err, result) =>
callback(null, result)
);
}
}
module.exports = IgnoreErrorModuleFactory;

99
app_vue/node_modules/webpack/lib/IgnorePlugin.js generated vendored Normal file
View File

@ -0,0 +1,99 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const RawModule = require("./RawModule");
const EntryDependency = require("./dependencies/EntryDependency");
const createSchemaValidation = require("./util/create-schema-validation");
/** @typedef {import("../declarations/plugins/IgnorePlugin").IgnorePluginOptions} IgnorePluginOptions */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */
const validate = createSchemaValidation(
require("../schemas/plugins/IgnorePlugin.check.js"),
() => require("../schemas/plugins/IgnorePlugin.json"),
{
name: "Ignore Plugin",
baseDataPath: "options"
}
);
const PLUGIN_NAME = "IgnorePlugin";
class IgnorePlugin {
/**
* @param {IgnorePluginOptions} options IgnorePlugin options
*/
constructor(options) {
validate(options);
this.options = options;
this.checkIgnore = this.checkIgnore.bind(this);
}
/**
* Note that if "contextRegExp" is given, both the "resourceRegExp" and "contextRegExp" have to match.
* @param {ResolveData} resolveData resolve data
* @returns {false|undefined} returns false when the request should be ignored, otherwise undefined
*/
checkIgnore(resolveData) {
if (
"checkResource" in this.options &&
this.options.checkResource &&
this.options.checkResource(resolveData.request, resolveData.context)
) {
return false;
}
if (
"resourceRegExp" in this.options &&
this.options.resourceRegExp &&
this.options.resourceRegExp.test(resolveData.request)
) {
if ("contextRegExp" in this.options && this.options.contextRegExp) {
// if "contextRegExp" is given,
// both the "resourceRegExp" and "contextRegExp" have to match.
if (this.options.contextRegExp.test(resolveData.context)) {
return false;
}
} else {
return false;
}
}
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, nmf => {
nmf.hooks.beforeResolve.tap(PLUGIN_NAME, resolveData => {
const result = this.checkIgnore(resolveData);
if (
result === false &&
resolveData.dependencies.length > 0 &&
resolveData.dependencies[0] instanceof EntryDependency
) {
resolveData.ignoredModule = new RawModule(
"",
"ignored-entry-module",
"(ignored-entry-module)"
);
}
return result;
});
});
compiler.hooks.contextModuleFactory.tap(PLUGIN_NAME, cmf => {
cmf.hooks.beforeResolve.tap(PLUGIN_NAME, this.checkIgnore);
});
}
}
module.exports = IgnorePlugin;

View File

@ -0,0 +1,38 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("../declarations/WebpackOptions").IgnoreWarningsNormalized} IgnoreWarningsNormalized */
/** @typedef {import("./Compiler")} Compiler */
const PLUGIN_NAME = "IgnoreWarningsPlugin";
class IgnoreWarningsPlugin {
/**
* @param {IgnoreWarningsNormalized} ignoreWarnings conditions to ignore warnings
*/
constructor(ignoreWarnings) {
this._ignoreWarnings = ignoreWarnings;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
compilation.hooks.processWarnings.tap(PLUGIN_NAME, warnings =>
warnings.filter(
warning =>
!this._ignoreWarnings.some(ignore => ignore(warning, compilation))
)
);
});
}
}
module.exports = IgnoreWarningsPlugin;

185
app_vue/node_modules/webpack/lib/InitFragment.js generated vendored Normal file
View File

@ -0,0 +1,185 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Florent Cailhol @ooflorent
*/
"use strict";
const { ConcatSource } = require("webpack-sources");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./Generator").GenerateContext} GenerateContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/**
* @template T
* @param {InitFragment<T>} fragment the init fragment
* @param {number} index index
* @returns {[InitFragment<T>, number]} tuple with both
*/
const extractFragmentIndex = (fragment, index) => [fragment, index];
/**
* @template T
* @param {[InitFragment<T>, number]} a first pair
* @param {[InitFragment<T>, number]} b second pair
* @returns {number} sort value
*/
const sortFragmentWithIndex = ([a, i], [b, j]) => {
const stageCmp = a.stage - b.stage;
if (stageCmp !== 0) return stageCmp;
const positionCmp = a.position - b.position;
if (positionCmp !== 0) return positionCmp;
return i - j;
};
/**
* @template GenerateContext
*/
class InitFragment {
/**
* @param {string | Source | undefined} content the source code that will be included as initialization code
* @param {number} stage category of initialization code (contribute to order)
* @param {number} position position in the category (contribute to order)
* @param {string=} key unique key to avoid emitting the same initialization code twice
* @param {string | Source=} endContent the source code that will be included at the end of the module
*/
constructor(content, stage, position, key, endContent) {
this.content = content;
this.stage = stage;
this.position = position;
this.key = key;
this.endContent = endContent;
}
/**
* @param {GenerateContext} context context
* @returns {string | Source | undefined} the source code that will be included as initialization code
*/
getContent(context) {
return this.content;
}
/**
* @param {GenerateContext} context context
* @returns {string | Source=} the source code that will be included at the end of the module
*/
getEndContent(context) {
return this.endContent;
}
/**
* @template Context
* @template T
* @param {Source} source sources
* @param {InitFragment<T>[]} initFragments init fragments
* @param {Context} context context
* @returns {Source} source
*/
static addToSource(source, initFragments, context) {
if (initFragments.length > 0) {
// Sort fragments by position. If 2 fragments have the same position,
// use their index.
const sortedFragments = initFragments
.map(extractFragmentIndex)
.sort(sortFragmentWithIndex);
// Deduplicate fragments. If a fragment has no key, it is always included.
const keyedFragments = new Map();
for (const [fragment] of sortedFragments) {
if (
typeof (
/** @type {InitFragment<T> & { mergeAll?: (fragments: InitFragment<Context>[]) => InitFragment<Context>[] }} */
(fragment).mergeAll
) === "function"
) {
if (!fragment.key) {
throw new Error(
`InitFragment with mergeAll function must have a valid key: ${fragment.constructor.name}`
);
}
const oldValue = keyedFragments.get(fragment.key);
if (oldValue === undefined) {
keyedFragments.set(fragment.key, fragment);
} else if (Array.isArray(oldValue)) {
oldValue.push(fragment);
} else {
keyedFragments.set(fragment.key, [oldValue, fragment]);
}
continue;
} else if (typeof fragment.merge === "function") {
const oldValue = keyedFragments.get(fragment.key);
if (oldValue !== undefined) {
keyedFragments.set(fragment.key, fragment.merge(oldValue));
continue;
}
}
keyedFragments.set(fragment.key || Symbol("fragment key"), fragment);
}
const concatSource = new ConcatSource();
const endContents = [];
for (let fragment of keyedFragments.values()) {
if (Array.isArray(fragment)) {
fragment = fragment[0].mergeAll(fragment);
}
concatSource.add(fragment.getContent(context));
const endContent = fragment.getEndContent(context);
if (endContent) {
endContents.push(endContent);
}
}
concatSource.add(source);
for (const content of endContents.reverse()) {
concatSource.add(content);
}
return concatSource;
}
return source;
}
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.content);
write(this.stage);
write(this.position);
write(this.key);
write(this.endContent);
}
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.content = read();
this.stage = read();
this.position = read();
this.key = read();
this.endContent = read();
}
}
makeSerializable(InitFragment, "webpack/lib/InitFragment");
InitFragment.prototype.merge =
/** @type {TODO} */
(undefined);
InitFragment.STAGE_CONSTANTS = 10;
InitFragment.STAGE_ASYNC_BOUNDARY = 20;
InitFragment.STAGE_HARMONY_EXPORTS = 30;
InitFragment.STAGE_HARMONY_IMPORTS = 40;
InitFragment.STAGE_PROVIDES = 50;
InitFragment.STAGE_ASYNC_DEPENDENCIES = 60;
InitFragment.STAGE_ASYNC_HARMONY_IMPORTS = 70;
module.exports = InitFragment;

View File

@ -0,0 +1,44 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Module")} Module */
class InvalidDependenciesModuleWarning extends WebpackError {
/**
* @param {Module} module module tied to dependency
* @param {Iterable<string>} deps invalid dependencies
*/
constructor(module, deps) {
const orderedDeps = deps ? Array.from(deps).sort() : [];
const depsList = orderedDeps.map(dep => ` * ${JSON.stringify(dep)}`);
super(`Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths.
Invalid dependencies may lead to broken watching and caching.
As best effort we try to convert all invalid values to absolute paths and converting globs into context dependencies, but this is deprecated behavior.
Loaders: Pass absolute paths to this.addDependency (existing files), this.addMissingDependency (not existing files), and this.addContextDependency (directories).
Plugins: Pass absolute paths to fileDependencies (existing files), missingDependencies (not existing files), and contextDependencies (directories).
Globs: They are not supported. Pass absolute path to the directory as context dependencies.
The following invalid values have been reported:
${depsList.slice(0, 3).join("\n")}${
depsList.length > 3 ? "\n * and more ..." : ""
}`);
this.name = "InvalidDependenciesModuleWarning";
this.details = depsList.slice(3).join("\n");
this.module = module;
}
}
makeSerializable(
InvalidDependenciesModuleWarning,
"webpack/lib/InvalidDependenciesModuleWarning"
);
module.exports = InvalidDependenciesModuleWarning;

View File

@ -0,0 +1,80 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Sergey Melyukov @smelukov
*/
"use strict";
const {
JAVASCRIPT_MODULE_TYPE_AUTO,
JAVASCRIPT_MODULE_TYPE_DYNAMIC,
JAVASCRIPT_MODULE_TYPE_ESM
} = require("./ModuleTypeConstants");
const InnerGraph = require("./optimize/InnerGraph");
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Module").BuildInfo} BuildInfo */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
const PLUGIN_NAME = "JavascriptMetaInfoPlugin";
class JavascriptMetaInfoPlugin {
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
/**
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
const handler = parser => {
parser.hooks.call.for("eval").tap(PLUGIN_NAME, () => {
const buildInfo =
/** @type {BuildInfo} */
(parser.state.module.buildInfo);
buildInfo.moduleConcatenationBailout = "eval()";
buildInfo.usingEval = true;
const currentSymbol = InnerGraph.getTopLevelSymbol(parser.state);
if (currentSymbol) {
InnerGraph.addUsage(parser.state, null, currentSymbol);
} else {
InnerGraph.bailout(parser.state);
}
});
parser.hooks.finish.tap(PLUGIN_NAME, () => {
const buildInfo =
/** @type {BuildInfo} */
(parser.state.module.buildInfo);
let topLevelDeclarations = buildInfo.topLevelDeclarations;
if (topLevelDeclarations === undefined) {
topLevelDeclarations = buildInfo.topLevelDeclarations = new Set();
}
for (const name of parser.scope.definitions.asSet()) {
const freeInfo = parser.getFreeInfoFromVariable(name);
if (freeInfo === undefined) {
topLevelDeclarations.add(name);
}
}
});
};
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_AUTO)
.tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
.tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
.for(JAVASCRIPT_MODULE_TYPE_ESM)
.tap(PLUGIN_NAME, handler);
}
);
}
}
module.exports = JavascriptMetaInfoPlugin;

143
app_vue/node_modules/webpack/lib/LibManifestPlugin.js generated vendored Normal file
View File

@ -0,0 +1,143 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const asyncLib = require("neo-async");
const EntryDependency = require("./dependencies/EntryDependency");
const { someInIterable } = require("./util/IterableHelpers");
const { compareModulesById } = require("./util/comparators");
const { dirname, mkdirp } = require("./util/fs");
/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Compiler").IntermediateFileSystem} IntermediateFileSystem */
/** @typedef {import("./Module").BuildMeta} BuildMeta */
/**
* @typedef {object} ManifestModuleData
* @property {string | number} id
* @property {BuildMeta=} buildMeta
* @property {boolean | string[]=} exports
*/
/**
* @typedef {object} LibManifestPluginOptions
* @property {string=} context Context of requests in the manifest file (defaults to the webpack context).
* @property {boolean=} entryOnly If true, only entry points will be exposed (default: true).
* @property {boolean=} format If true, manifest json file (output) will be formatted.
* @property {string=} name Name of the exposed dll function (external name, use value of 'output.library').
* @property {string} path Absolute path to the manifest json file (output).
* @property {string=} type Type of the dll bundle (external type, use value of 'output.libraryTarget').
*/
const PLUGIN_NAME = "LibManifestPlugin";
class LibManifestPlugin {
/**
* @param {LibManifestPluginOptions} options the options
*/
constructor(options) {
this.options = options;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.emit.tapAsync(
{ name: PLUGIN_NAME, stage: 110 },
(compilation, callback) => {
const moduleGraph = compilation.moduleGraph;
// store used paths to detect issue and output an error. #18200
const usedPaths = new Set();
asyncLib.each(
Array.from(compilation.chunks),
(chunk, callback) => {
if (!chunk.canBeInitial()) {
callback();
return;
}
const chunkGraph = compilation.chunkGraph;
const targetPath = compilation.getPath(this.options.path, {
chunk
});
if (usedPaths.has(targetPath)) {
callback(new Error("each chunk must have a unique path"));
return;
}
usedPaths.add(targetPath);
const name =
this.options.name &&
compilation.getPath(this.options.name, {
chunk,
contentHashType: "javascript"
});
const content = Object.create(null);
for (const module of chunkGraph.getOrderedChunkModulesIterable(
chunk,
compareModulesById(chunkGraph)
)) {
if (
this.options.entryOnly &&
!someInIterable(
moduleGraph.getIncomingConnections(module),
c => c.dependency instanceof EntryDependency
)
) {
continue;
}
const ident = module.libIdent({
context:
this.options.context ||
/** @type {string} */ (compiler.options.context),
associatedObjectForCache: compiler.root
});
if (ident) {
const exportsInfo = moduleGraph.getExportsInfo(module);
const providedExports = exportsInfo.getProvidedExports();
/** @type {ManifestModuleData} */
const data = {
id: /** @type {ModuleId} */ (chunkGraph.getModuleId(module)),
buildMeta: /** @type {BuildMeta} */ (module.buildMeta),
exports: Array.isArray(providedExports)
? providedExports
: undefined
};
content[ident] = data;
}
}
const manifest = {
name,
type: this.options.type,
content
};
// Apply formatting to content if format flag is true;
const manifestContent = this.options.format
? JSON.stringify(manifest, null, 2)
: JSON.stringify(manifest);
const buffer = Buffer.from(manifestContent, "utf8");
const intermediateFileSystem =
/** @type {IntermediateFileSystem} */ (
compiler.intermediateFileSystem
);
mkdirp(
intermediateFileSystem,
dirname(intermediateFileSystem, targetPath),
err => {
if (err) return callback(err);
intermediateFileSystem.writeFile(targetPath, buffer, callback);
}
);
},
callback
);
}
);
}
}
module.exports = LibManifestPlugin;

View File

@ -0,0 +1,48 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const EnableLibraryPlugin = require("./library/EnableLibraryPlugin");
/** @typedef {import("../declarations/WebpackOptions").AuxiliaryComment} AuxiliaryComment */
/** @typedef {import("../declarations/WebpackOptions").LibraryExport} LibraryExport */
/** @typedef {import("../declarations/WebpackOptions").LibraryName} LibraryName */
/** @typedef {import("../declarations/WebpackOptions").LibraryType} LibraryType */
/** @typedef {import("../declarations/WebpackOptions").UmdNamedDefine} UmdNamedDefine */
/** @typedef {import("./Compiler")} Compiler */
// TODO webpack 6 remove
class LibraryTemplatePlugin {
/**
* @param {LibraryName} name name of library
* @param {LibraryType} target type of library
* @param {UmdNamedDefine} umdNamedDefine setting this to true will name the UMD module
* @param {AuxiliaryComment} auxiliaryComment comment in the UMD wrapper
* @param {LibraryExport} exportProperty which export should be exposed as library
*/
constructor(name, target, umdNamedDefine, auxiliaryComment, exportProperty) {
this.library = {
type: target || "var",
name,
umdNamedDefine,
auxiliaryComment,
export: exportProperty
};
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
const { output } = compiler.options;
output.library = this.library;
new EnableLibraryPlugin(this.library.type).apply(compiler);
}
}
module.exports = LibraryTemplatePlugin;

View File

@ -0,0 +1,88 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
const NormalModule = require("./NormalModule");
const createSchemaValidation = require("./util/create-schema-validation");
/** @typedef {import("../declarations/plugins/LoaderOptionsPlugin").LoaderOptionsPluginOptions} LoaderOptionsPluginOptions */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./ModuleFilenameHelpers").Matcher} Matcher */
/** @typedef {import("./ModuleFilenameHelpers").MatchObject} MatchObject */
/**
* @template T
* @typedef {import("../declarations/LoaderContext").LoaderContext<T>} LoaderContext
*/
const validate = createSchemaValidation(
require("../schemas/plugins/LoaderOptionsPlugin.check.js"),
() => require("../schemas/plugins/LoaderOptionsPlugin.json"),
{
name: "Loader Options Plugin",
baseDataPath: "options"
}
);
const PLUGIN_NAME = "LoaderOptionsPlugin";
class LoaderOptionsPlugin {
/**
* @param {LoaderOptionsPluginOptions & MatchObject} options options object
*/
constructor(options = {}) {
validate(options);
// If no options are set then generate empty options object
if (typeof options !== "object") options = {};
if (!options.test) {
/** @type {TODO} */
const defaultTrueMockRegExp = {
test: () => true
};
/** @type {RegExp} */
options.test = defaultTrueMockRegExp;
}
this.options = options;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
const options = this.options;
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
NormalModule.getCompilationHooks(compilation).loader.tap(
PLUGIN_NAME,
(context, module) => {
const resource = module.resource;
if (!resource) return;
const i = resource.indexOf("?");
if (
ModuleFilenameHelpers.matchObject(
options,
i < 0 ? resource : resource.slice(0, i)
)
) {
for (const key of Object.keys(options)) {
if (key === "include" || key === "exclude" || key === "test") {
continue;
}
/** @type {TODO} */
(context)[key] = options[key];
}
}
}
);
});
}
}
module.exports = LoaderOptionsPlugin;

39
app_vue/node_modules/webpack/lib/LoaderTargetPlugin.js generated vendored Normal file
View File

@ -0,0 +1,39 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const NormalModule = require("./NormalModule");
/** @typedef {import("./Compiler")} Compiler */
const PLUGIN_NAME = "LoaderTargetPlugin";
class LoaderTargetPlugin {
/**
* @param {string} target the target
*/
constructor(target) {
this.target = target;
}
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
NormalModule.getCompilationHooks(compilation).loader.tap(
PLUGIN_NAME,
loaderContext => {
loaderContext.target = this.target;
}
);
});
}
}
module.exports = LoaderTargetPlugin;

382
app_vue/node_modules/webpack/lib/MainTemplate.js generated vendored Normal file
View File

@ -0,0 +1,382 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { SyncWaterfallHook } = require("tapable");
const util = require("util");
const RuntimeGlobals = require("./RuntimeGlobals");
const memoize = require("./util/memoize");
/** @typedef {import("tapable").Tap} Tap */
/** @typedef {import("webpack-sources").ConcatSource} ConcatSource */
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */
/** @typedef {import("./ModuleTemplate")} ModuleTemplate */
/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./Compilation")} Compilation */
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
/** @typedef {import("./Compilation").InterpolatedPathAndAssetInfo} InterpolatedPathAndAssetInfo */
/** @typedef {import("./Module")} Module} */
/** @typedef {import("./util/Hash")} Hash} */
/** @typedef {import("./DependencyTemplates")} DependencyTemplates} */
/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext} */
/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderBootstrapContext} RenderBootstrapContext} */
/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkHashContext} ChunkHashContext} */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate} */
/** @typedef {import("./ModuleGraph")} ModuleGraph} */
/** @typedef {import("./ChunkGraph")} ChunkGraph} */
/** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions} */
/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry} */
/** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath} */
/** @typedef {import("./TemplatedPathPlugin").PathData} PathData} */
/**
* @template T
* @typedef {import("tapable").IfSet<T>} IfSet
*/
const getJavascriptModulesPlugin = memoize(() =>
require("./javascript/JavascriptModulesPlugin")
);
const getJsonpTemplatePlugin = memoize(() =>
require("./web/JsonpTemplatePlugin")
);
const getLoadScriptRuntimeModule = memoize(() =>
require("./runtime/LoadScriptRuntimeModule")
);
// TODO webpack 6 remove this class
class MainTemplate {
/**
* @param {OutputOptions} outputOptions output options for the MainTemplate
* @param {Compilation} compilation the compilation
*/
constructor(outputOptions, compilation) {
/** @type {OutputOptions} */
this._outputOptions = outputOptions || {};
this.hooks = Object.freeze({
renderManifest: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(renderManifestEntries: RenderManifestEntry[], renderManifestOptions: RenderManifestOptions) => RenderManifestEntry[]} fn fn
*/
(options, fn) => {
compilation.hooks.renderManifest.tap(
options,
(entries, options) => {
if (!options.chunk.hasRuntime()) return entries;
return fn(entries, options);
}
);
},
"MainTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_RENDER_MANIFEST"
)
},
modules: {
tap: () => {
throw new Error(
"MainTemplate.hooks.modules has been removed (there is no replacement, please create an issue to request that)"
);
}
},
moduleObj: {
tap: () => {
throw new Error(
"MainTemplate.hooks.moduleObj has been removed (there is no replacement, please create an issue to request that)"
);
}
},
require: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(value: string, renderBootstrapContext: RenderBootstrapContext) => string} fn fn
*/
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.renderRequire.tap(options, fn);
},
"MainTemplate.hooks.require is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderRequire instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE"
)
},
beforeStartup: {
tap: () => {
throw new Error(
"MainTemplate.hooks.beforeStartup has been removed (use RuntimeGlobals.startupOnlyBefore instead)"
);
}
},
startup: {
tap: () => {
throw new Error(
"MainTemplate.hooks.startup has been removed (use RuntimeGlobals.startup instead)"
);
}
},
afterStartup: {
tap: () => {
throw new Error(
"MainTemplate.hooks.afterStartup has been removed (use RuntimeGlobals.startupOnlyAfter instead)"
);
}
},
render: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(source: Source, chunk: Chunk, hash: string | undefined, moduleTemplate: ModuleTemplate, dependencyTemplates: DependencyTemplates) => Source} fn fn
*/
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.render.tap(options, (source, renderContext) => {
if (
renderContext.chunkGraph.getNumberOfEntryModules(
renderContext.chunk
) === 0 ||
!renderContext.chunk.hasRuntime()
) {
return source;
}
return fn(
source,
renderContext.chunk,
compilation.hash,
compilation.moduleTemplates.javascript,
compilation.dependencyTemplates
);
});
},
"MainTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_RENDER"
)
},
renderWithEntry: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(source: Source, chunk: Chunk, hash: string | undefined) => Source} fn fn
*/
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.render.tap(options, (source, renderContext) => {
if (
renderContext.chunkGraph.getNumberOfEntryModules(
renderContext.chunk
) === 0 ||
!renderContext.chunk.hasRuntime()
) {
return source;
}
return fn(source, renderContext.chunk, compilation.hash);
});
},
"MainTemplate.hooks.renderWithEntry is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_RENDER_WITH_ENTRY"
)
},
assetPath: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(value: string, path: PathData, assetInfo: AssetInfo | undefined) => string} fn fn
*/
(options, fn) => {
compilation.hooks.assetPath.tap(options, fn);
},
"MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH"
),
call: util.deprecate(
/**
* @param {TemplatePath} filename used to get asset path with hash
* @param {PathData} options context data
* @returns {string} interpolated path
*/
(filename, options) => compilation.getAssetPath(filename, options),
"MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH"
)
},
hash: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(hash: Hash) => void} fn fn
*/
(options, fn) => {
compilation.hooks.fullHash.tap(options, fn);
},
"MainTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_HASH"
)
},
hashForChunk: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(hash: Hash, chunk: Chunk) => void} fn fn
*/
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.chunkHash.tap(options, (chunk, hash) => {
if (!chunk.hasRuntime()) return;
return fn(hash, chunk);
});
},
"MainTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK"
)
},
globalHashPaths: {
tap: util.deprecate(
() => {},
"MainTemplate.hooks.globalHashPaths has been removed (it's no longer needed)",
"DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK"
)
},
globalHash: {
tap: util.deprecate(
() => {},
"MainTemplate.hooks.globalHash has been removed (it's no longer needed)",
"DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK"
)
},
hotBootstrap: {
tap: () => {
throw new Error(
"MainTemplate.hooks.hotBootstrap has been removed (use your own RuntimeModule instead)"
);
}
},
// for compatibility:
/** @type {SyncWaterfallHook<[string, Chunk, string, ModuleTemplate, DependencyTemplates]>} */
bootstrap: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleTemplate",
"dependencyTemplates"
]),
/** @type {SyncWaterfallHook<[string, Chunk, string]>} */
localVars: new SyncWaterfallHook(["source", "chunk", "hash"]),
/** @type {SyncWaterfallHook<[string, Chunk, string]>} */
requireExtensions: new SyncWaterfallHook(["source", "chunk", "hash"]),
/** @type {SyncWaterfallHook<[string, Chunk, string, string]>} */
requireEnsure: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"chunkIdExpression"
]),
get jsonpScript() {
const hooks =
getLoadScriptRuntimeModule().getCompilationHooks(compilation);
return hooks.createScript;
},
get linkPrefetch() {
const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation);
return hooks.linkPrefetch;
},
get linkPreload() {
const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation);
return hooks.linkPreload;
}
});
this.renderCurrentHashCode = util.deprecate(
/**
* @deprecated
* @param {string} hash the hash
* @param {number=} length length of the hash
* @returns {string} generated code
*/
(hash, length) => {
if (length) {
return `${RuntimeGlobals.getFullHash} ? ${
RuntimeGlobals.getFullHash
}().slice(0, ${length}) : ${hash.slice(0, length)}`;
}
return `${RuntimeGlobals.getFullHash} ? ${RuntimeGlobals.getFullHash}() : ${hash}`;
},
"MainTemplate.renderCurrentHashCode is deprecated (use RuntimeGlobals.getFullHash runtime function instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_RENDER_CURRENT_HASH_CODE"
);
this.getPublicPath = util.deprecate(
/**
* @param {PathData} options context data
* @returns {string} interpolated path
*/ options =>
compilation.getAssetPath(
/** @type {string} */
(compilation.outputOptions.publicPath),
options
),
"MainTemplate.getPublicPath is deprecated (use Compilation.getAssetPath(compilation.outputOptions.publicPath, options) instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_GET_PUBLIC_PATH"
);
this.getAssetPath = util.deprecate(
/**
* @param {TemplatePath} path used to get asset path with hash
* @param {PathData} options context data
* @returns {string} interpolated path
*/
(path, options) => compilation.getAssetPath(path, options),
"MainTemplate.getAssetPath is deprecated (use Compilation.getAssetPath instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH"
);
this.getAssetPathWithInfo = util.deprecate(
/**
* @param {TemplatePath} path used to get asset path with hash
* @param {PathData} options context data
* @returns {InterpolatedPathAndAssetInfo} interpolated path and asset info
*/
(path, options) => compilation.getAssetPathWithInfo(path, options),
"MainTemplate.getAssetPathWithInfo is deprecated (use Compilation.getAssetPath instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH_WITH_INFO"
);
}
}
Object.defineProperty(MainTemplate.prototype, "requireFn", {
get: util.deprecate(
() => RuntimeGlobals.require,
`MainTemplate.requireFn is deprecated (use "${RuntimeGlobals.require}")`,
"DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE_FN"
)
});
Object.defineProperty(MainTemplate.prototype, "outputOptions", {
get: util.deprecate(
/**
* @this {MainTemplate}
* @returns {OutputOptions} output options
*/
function () {
return this._outputOptions;
},
"MainTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_OUTPUT_OPTIONS"
)
});
module.exports = MainTemplate;

1236
app_vue/node_modules/webpack/lib/Module.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

81
app_vue/node_modules/webpack/lib/ModuleBuildError.js generated vendored Normal file
View File

@ -0,0 +1,81 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { cutOffLoaderExecution } = require("./ErrorHelpers");
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {Error & { hideStack?: boolean }} ErrorWithHideStack */
class ModuleBuildError extends WebpackError {
/**
* @param {string | ErrorWithHideStack} err error thrown
* @param {{from?: string|null}} info additional info
*/
constructor(err, { from = null } = {}) {
let message = "Module build failed";
let details;
message += from ? ` (from ${from}):\n` : ": ";
if (err !== null && typeof err === "object") {
if (typeof err.stack === "string" && err.stack) {
const stack = cutOffLoaderExecution(err.stack);
if (!err.hideStack) {
message += stack;
} else {
details = stack;
message +=
typeof err.message === "string" && err.message ? err.message : err;
}
} else if (typeof err.message === "string" && err.message) {
message += err.message;
} else {
message += String(err);
}
} else {
message += String(err);
}
super(message);
this.name = "ModuleBuildError";
this.details = details;
this.error = err;
}
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.error);
super.serialize(context);
}
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.error = read();
super.deserialize(context);
}
}
makeSerializable(ModuleBuildError, "webpack/lib/ModuleBuildError");
module.exports = ModuleBuildError;

View File

@ -0,0 +1,43 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ModuleBuildError").ErrorWithHideStack} ErrorWithHideStack */
class ModuleDependencyError extends WebpackError {
/**
* Creates an instance of ModuleDependencyError.
* @param {Module} module module tied to dependency
* @param {ErrorWithHideStack} err error thrown
* @param {DependencyLocation} loc location of dependency
*/
constructor(module, err, loc) {
super(err.message);
this.name = "ModuleDependencyError";
this.details =
err && !err.hideStack
? /** @type {string} */ (err.stack).split("\n").slice(1).join("\n")
: undefined;
this.module = module;
this.loc = loc;
/** error is not (de)serialized, so it might be undefined after deserialization */
this.error = err;
if (err && err.hideStack && err.stack) {
this.stack = /** @type {string} */ `${err.stack
.split("\n")
.slice(1)
.join("\n")}\n\n${this.stack}`;
}
}
}
module.exports = ModuleDependencyError;

View File

@ -0,0 +1,48 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ModuleDependencyError").ErrorWithHideStack} ErrorWithHideStack */
class ModuleDependencyWarning extends WebpackError {
/**
* @param {Module} module module tied to dependency
* @param {ErrorWithHideStack} err error thrown
* @param {DependencyLocation} loc location of dependency
*/
constructor(module, err, loc) {
super(err ? err.message : "");
this.name = "ModuleDependencyWarning";
this.details =
err && !err.hideStack
? /** @type {string} */ (err.stack).split("\n").slice(1).join("\n")
: undefined;
this.module = module;
this.loc = loc;
/** error is not (de)serialized, so it might be undefined after deserialization */
this.error = err;
if (err && err.hideStack && err.stack) {
this.stack = /** @type {string} */ `${err.stack
.split("\n")
.slice(1)
.join("\n")}\n\n${this.stack}`;
}
}
}
makeSerializable(
ModuleDependencyWarning,
"webpack/lib/ModuleDependencyWarning"
);
module.exports = ModuleDependencyWarning;

66
app_vue/node_modules/webpack/lib/ModuleError.js generated vendored Normal file
View File

@ -0,0 +1,66 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { cleanUp } = require("./ErrorHelpers");
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
class ModuleError extends WebpackError {
/**
* @param {Error} err error thrown
* @param {{from?: string|null}} info additional info
*/
constructor(err, { from = null } = {}) {
let message = "Module Error";
message += from ? ` (from ${from}):\n` : ": ";
if (err && typeof err === "object" && err.message) {
message += err.message;
} else if (err) {
message += err;
}
super(message);
this.name = "ModuleError";
this.error = err;
this.details =
err && typeof err === "object" && err.stack
? cleanUp(err.stack, this.message)
: undefined;
}
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.error);
super.serialize(context);
}
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.error = read();
super.deserialize(context);
}
}
makeSerializable(ModuleError, "webpack/lib/ModuleError");
module.exports = ModuleError;

56
app_vue/node_modules/webpack/lib/ModuleFactory.js generated vendored Normal file
View File

@ -0,0 +1,56 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */
/** @typedef {import("./Dependency")} Dependency */
/** @typedef {import("./Module")} Module */
/**
* @typedef {object} ModuleFactoryResult
* @property {Module=} module the created module or unset if no module was created
* @property {Set<string>=} fileDependencies
* @property {Set<string>=} contextDependencies
* @property {Set<string>=} missingDependencies
* @property {boolean=} cacheable allow to use the unsafe cache
*/
/** @typedef {string | null} IssuerLayer */
/**
* @typedef {object} ModuleFactoryCreateDataContextInfo
* @property {string} issuer
* @property {IssuerLayer=} issuerLayer
* @property {string=} compiler
*/
/**
* @typedef {object} ModuleFactoryCreateData
* @property {ModuleFactoryCreateDataContextInfo} contextInfo
* @property {ResolveOptions=} resolveOptions
* @property {string} context
* @property {Dependency[]} dependencies
*/
/**
* @typedef {(err?: Error | null, result?: ModuleFactoryResult) => void} ModuleFactoryCallback
*/
class ModuleFactory {
/* istanbul ignore next */
/**
* @abstract
* @param {ModuleFactoryCreateData} data data object
* @param {ModuleFactoryCallback} callback callback
* @returns {void}
*/
create(data, callback) {
const AbstractMethodError = require("./AbstractMethodError");
throw new AbstractMethodError();
}
}
module.exports = ModuleFactory;

View File

@ -0,0 +1,369 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const NormalModule = require("./NormalModule");
const { DEFAULTS } = require("./config/defaults");
const createHash = require("./util/createHash");
const memoize = require("./util/memoize");
/** @typedef {import("../declarations/WebpackOptions").DevtoolModuleFilenameTemplate} DevtoolModuleFilenameTemplate */
/** @typedef {import("../declarations/WebpackOptions").HashFunction} HashFunction */
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./RequestShortener")} RequestShortener */
/** @typedef {string | RegExp | (string | RegExp)[]} Matcher */
/** @typedef {{ test?: Matcher, include?: Matcher, exclude?: Matcher }} MatchObject */
const ModuleFilenameHelpers = module.exports;
// TODO webpack 6: consider removing these
ModuleFilenameHelpers.ALL_LOADERS_RESOURCE = "[all-loaders][resource]";
ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE =
/\[all-?loaders\]\[resource\]/gi;
ModuleFilenameHelpers.LOADERS_RESOURCE = "[loaders][resource]";
ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE = /\[loaders\]\[resource\]/gi;
ModuleFilenameHelpers.RESOURCE = "[resource]";
ModuleFilenameHelpers.REGEXP_RESOURCE = /\[resource\]/gi;
ModuleFilenameHelpers.ABSOLUTE_RESOURCE_PATH = "[absolute-resource-path]";
// cSpell:words olute
ModuleFilenameHelpers.REGEXP_ABSOLUTE_RESOURCE_PATH =
/\[abs(olute)?-?resource-?path\]/gi;
ModuleFilenameHelpers.RESOURCE_PATH = "[resource-path]";
ModuleFilenameHelpers.REGEXP_RESOURCE_PATH = /\[resource-?path\]/gi;
ModuleFilenameHelpers.ALL_LOADERS = "[all-loaders]";
ModuleFilenameHelpers.REGEXP_ALL_LOADERS = /\[all-?loaders\]/gi;
ModuleFilenameHelpers.LOADERS = "[loaders]";
ModuleFilenameHelpers.REGEXP_LOADERS = /\[loaders\]/gi;
ModuleFilenameHelpers.QUERY = "[query]";
ModuleFilenameHelpers.REGEXP_QUERY = /\[query\]/gi;
ModuleFilenameHelpers.ID = "[id]";
ModuleFilenameHelpers.REGEXP_ID = /\[id\]/gi;
ModuleFilenameHelpers.HASH = "[hash]";
ModuleFilenameHelpers.REGEXP_HASH = /\[hash\]/gi;
ModuleFilenameHelpers.NAMESPACE = "[namespace]";
ModuleFilenameHelpers.REGEXP_NAMESPACE = /\[namespace\]/gi;
/** @typedef {() => string} ReturnStringCallback */
/**
* Returns a function that returns the part of the string after the token
* @param {ReturnStringCallback} strFn the function to get the string
* @param {string} token the token to search for
* @returns {ReturnStringCallback} a function that returns the part of the string after the token
*/
const getAfter = (strFn, token) => () => {
const str = strFn();
const idx = str.indexOf(token);
return idx < 0 ? "" : str.slice(idx);
};
/**
* Returns a function that returns the part of the string before the token
* @param {ReturnStringCallback} strFn the function to get the string
* @param {string} token the token to search for
* @returns {ReturnStringCallback} a function that returns the part of the string before the token
*/
const getBefore = (strFn, token) => () => {
const str = strFn();
const idx = str.lastIndexOf(token);
return idx < 0 ? "" : str.slice(0, idx);
};
/**
* Returns a function that returns a hash of the string
* @param {ReturnStringCallback} strFn the function to get the string
* @param {HashFunction=} hashFunction the hash function to use
* @returns {ReturnStringCallback} a function that returns the hash of the string
*/
const getHash =
(strFn, hashFunction = DEFAULTS.HASH_FUNCTION) =>
() => {
const hash = createHash(hashFunction);
hash.update(strFn());
const digest = /** @type {string} */ (hash.digest("hex"));
return digest.slice(0, 4);
};
/**
* @template T
* Returns a lazy object. The object is lazy in the sense that the properties are
* only evaluated when they are accessed. This is only obtained by setting a function as the value for each key.
* @param {Record<string, () => T>} obj the object to convert to a lazy access object
* @returns {T} the lazy access object
*/
const lazyObject = obj => {
const newObj = /** @type {T} */ ({});
for (const key of Object.keys(obj)) {
const fn = obj[key];
Object.defineProperty(newObj, key, {
get: () => fn(),
set: v => {
Object.defineProperty(newObj, key, {
value: v,
enumerable: true,
writable: true
});
},
enumerable: true,
configurable: true
});
}
return newObj;
};
const SQUARE_BRACKET_TAG_REGEXP = /\[\\*([\w-]+)\\*\]/gi;
/** @typedef {((context: TODO) => string)} ModuleFilenameTemplateFunction */
/** @typedef {string | ModuleFilenameTemplateFunction} ModuleFilenameTemplate */
/**
* @param {Module | string} module the module
* @param {{ namespace?: string, moduleFilenameTemplate?: ModuleFilenameTemplate }} options options
* @param {{ requestShortener: RequestShortener, chunkGraph: ChunkGraph, hashFunction?: HashFunction }} contextInfo context info
* @returns {string} the filename
*/
ModuleFilenameHelpers.createFilename = (
// eslint-disable-next-line default-param-last
module = "",
options,
{ requestShortener, chunkGraph, hashFunction = DEFAULTS.HASH_FUNCTION }
) => {
const opts = {
namespace: "",
moduleFilenameTemplate: "",
...(typeof options === "object"
? options
: {
moduleFilenameTemplate: options
})
};
/** @type {ReturnStringCallback} */
let absoluteResourcePath;
let hash;
/** @type {ReturnStringCallback} */
let identifier;
/** @type {ReturnStringCallback} */
let moduleId;
/** @type {ReturnStringCallback} */
let shortIdentifier;
if (typeof module === "string") {
shortIdentifier =
/** @type {ReturnStringCallback} */
(memoize(() => requestShortener.shorten(module)));
identifier = shortIdentifier;
moduleId = () => "";
absoluteResourcePath = () =>
/** @type {string} */ (module.split("!").pop());
hash = getHash(identifier, hashFunction);
} else {
shortIdentifier = memoize(() =>
module.readableIdentifier(requestShortener)
);
identifier =
/** @type {ReturnStringCallback} */
(memoize(() => requestShortener.shorten(module.identifier())));
moduleId =
/** @type {ReturnStringCallback} */
(() => chunkGraph.getModuleId(module));
absoluteResourcePath = () =>
module instanceof NormalModule
? module.resource
: /** @type {string} */ (module.identifier().split("!").pop());
hash = getHash(identifier, hashFunction);
}
const resource =
/** @type {ReturnStringCallback} */
(memoize(() => shortIdentifier().split("!").pop()));
const loaders = getBefore(shortIdentifier, "!");
const allLoaders = getBefore(identifier, "!");
const query = getAfter(resource, "?");
const resourcePath = () => {
const q = query().length;
return q === 0 ? resource() : resource().slice(0, -q);
};
if (typeof opts.moduleFilenameTemplate === "function") {
return opts.moduleFilenameTemplate(
lazyObject({
identifier,
shortIdentifier,
resource,
resourcePath: memoize(resourcePath),
absoluteResourcePath: memoize(absoluteResourcePath),
loaders: memoize(loaders),
allLoaders: memoize(allLoaders),
query: memoize(query),
moduleId: memoize(moduleId),
hash: memoize(hash),
namespace: () => opts.namespace
})
);
}
// TODO webpack 6: consider removing alternatives without dashes
/** @type {Map<string, () => string>} */
const replacements = new Map([
["identifier", identifier],
["short-identifier", shortIdentifier],
["resource", resource],
["resource-path", resourcePath],
// cSpell:words resourcepath
["resourcepath", resourcePath],
["absolute-resource-path", absoluteResourcePath],
["abs-resource-path", absoluteResourcePath],
// cSpell:words absoluteresource
["absoluteresource-path", absoluteResourcePath],
// cSpell:words absresource
["absresource-path", absoluteResourcePath],
// cSpell:words resourcepath
["absolute-resourcepath", absoluteResourcePath],
// cSpell:words resourcepath
["abs-resourcepath", absoluteResourcePath],
// cSpell:words absoluteresourcepath
["absoluteresourcepath", absoluteResourcePath],
// cSpell:words absresourcepath
["absresourcepath", absoluteResourcePath],
["all-loaders", allLoaders],
// cSpell:words allloaders
["allloaders", allLoaders],
["loaders", loaders],
["query", query],
["id", moduleId],
["hash", hash],
["namespace", () => opts.namespace]
]);
// TODO webpack 6: consider removing weird double placeholders
return /** @type {string} */ (opts.moduleFilenameTemplate)
.replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE, "[identifier]")
.replace(
ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE,
"[short-identifier]"
)
.replace(SQUARE_BRACKET_TAG_REGEXP, (match, content) => {
if (content.length + 2 === match.length) {
const replacement = replacements.get(content.toLowerCase());
if (replacement !== undefined) {
return replacement();
}
} else if (match.startsWith("[\\") && match.endsWith("\\]")) {
return `[${match.slice(2, -2)}]`;
}
return match;
});
};
/**
* Replaces duplicate items in an array with new values generated by a callback function.
* The callback function is called with the duplicate item, the index of the duplicate item, and the number of times the item has been replaced.
* The callback function should return the new value for the duplicate item.
* @template T
* @param {T[]} array the array with duplicates to be replaced
* @param {(duplicateItem: T, duplicateItemIndex: number, numberOfTimesReplaced: number) => T} fn callback function to generate new values for the duplicate items
* @param {(firstElement:T, nextElement:T) => -1 | 0 | 1=} comparator optional comparator function to sort the duplicate items
* @returns {T[]} the array with duplicates replaced
* @example
* ```js
* const array = ["a", "b", "c", "a", "b", "a"];
* const result = ModuleFilenameHelpers.replaceDuplicates(array, (item, index, count) => `${item}-${count}`);
* // result: ["a-1", "b-1", "c", "a-2", "b-2", "a-3"]
* ```
*/
ModuleFilenameHelpers.replaceDuplicates = (array, fn, comparator) => {
const countMap = Object.create(null);
const posMap = Object.create(null);
for (const [idx, item] of array.entries()) {
countMap[item] = countMap[item] || [];
countMap[item].push(idx);
posMap[item] = 0;
}
if (comparator) {
for (const item of Object.keys(countMap)) {
countMap[item].sort(comparator);
}
}
return array.map((item, i) => {
if (countMap[item].length > 1) {
if (comparator && countMap[item][0] === i) return item;
return fn(item, i, posMap[item]++);
}
return item;
});
};
/**
* Tests if a string matches a RegExp or an array of RegExp.
* @param {string} str string to test
* @param {Matcher} test value which will be used to match against the string
* @returns {boolean} true, when the RegExp matches
* @example
* ```js
* ModuleFilenameHelpers.matchPart("foo.js", "foo"); // true
* ModuleFilenameHelpers.matchPart("foo.js", "foo.js"); // true
* ModuleFilenameHelpers.matchPart("foo.js", "foo."); // false
* ModuleFilenameHelpers.matchPart("foo.js", "foo*"); // false
* ModuleFilenameHelpers.matchPart("foo.js", "foo.*"); // true
* ModuleFilenameHelpers.matchPart("foo.js", /^foo/); // true
* ModuleFilenameHelpers.matchPart("foo.js", [/^foo/, "bar"]); // true
* ModuleFilenameHelpers.matchPart("foo.js", [/^foo/, "bar"]); // true
* ModuleFilenameHelpers.matchPart("foo.js", [/^foo/, /^bar/]); // true
* ModuleFilenameHelpers.matchPart("foo.js", [/^baz/, /^bar/]); // false
* ```
*/
const matchPart = (str, test) => {
if (!test) return true;
if (Array.isArray(test)) {
return test.some(test => matchPart(str, test));
}
if (typeof test === "string") {
return str.startsWith(test);
}
return test.test(str);
};
ModuleFilenameHelpers.matchPart = matchPart;
/**
* Tests if a string matches a match object. The match object can have the following properties:
* - `test`: a RegExp or an array of RegExp
* - `include`: a RegExp or an array of RegExp
* - `exclude`: a RegExp or an array of RegExp
*
* The `test` property is tested first, then `include` and then `exclude`.
* @param {MatchObject} obj a match object to test against the string
* @param {string} str string to test against the matching object
* @returns {boolean} true, when the object matches
* @example
* ```js
* ModuleFilenameHelpers.matchObject({ test: "foo.js" }, "foo.js"); // true
* ModuleFilenameHelpers.matchObject({ test: /^foo/ }, "foo.js"); // true
* ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "foo.js"); // true
* ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "baz.js"); // false
* ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "foo.js"); // true
* ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "bar.js"); // false
* ModuleFilenameHelpers.matchObject({ include: /^foo/ }, "foo.js"); // true
* ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "foo.js"); // true
* ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "baz.js"); // false
* ModuleFilenameHelpers.matchObject({ exclude: "foo.js" }, "foo.js"); // false
* ModuleFilenameHelpers.matchObject({ exclude: [/^foo/, "bar"] }, "foo.js"); // false
* ```
*/
ModuleFilenameHelpers.matchObject = (obj, str) => {
if (obj.test && !ModuleFilenameHelpers.matchPart(str, obj.test)) {
return false;
}
if (obj.include && !ModuleFilenameHelpers.matchPart(str, obj.include)) {
return false;
}
if (obj.exclude && ModuleFilenameHelpers.matchPart(str, obj.exclude)) {
return false;
}
return true;
};

907
app_vue/node_modules/webpack/lib/ModuleGraph.js generated vendored Normal file
View File

@ -0,0 +1,907 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const util = require("util");
const ExportsInfo = require("./ExportsInfo");
const ModuleGraphConnection = require("./ModuleGraphConnection");
const SortableSet = require("./util/SortableSet");
const WeakTupleMap = require("./util/WeakTupleMap");
/** @typedef {import("./Compilation").ModuleMemCaches} ModuleMemCaches */
/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
/** @typedef {import("./Dependency")} Dependency */
/** @typedef {import("./ExportsInfo").ExportInfo} ExportInfo */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ModuleProfile")} ModuleProfile */
/** @typedef {import("./RequestShortener")} RequestShortener */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/**
* @callback OptimizationBailoutFunction
* @param {RequestShortener} requestShortener
* @returns {string}
*/
const EMPTY_SET = new Set();
/**
* @param {SortableSet<ModuleGraphConnection>} set input
* @returns {readonly Map<Module | undefined, readonly ModuleGraphConnection[]>} mapped by origin module
*/
const getConnectionsByOriginModule = set => {
const map = new Map();
/** @type {Module | 0} */
let lastModule = 0;
/** @type {ModuleGraphConnection[] | undefined} */
let lastList;
for (const connection of set) {
const { originModule } = connection;
if (lastModule === originModule) {
/** @type {ModuleGraphConnection[]} */
(lastList).push(connection);
} else {
lastModule = /** @type {Module} */ (originModule);
const list = map.get(originModule);
if (list !== undefined) {
lastList = list;
list.push(connection);
} else {
const list = [connection];
lastList = list;
map.set(originModule, list);
}
}
}
return map;
};
/**
* @param {SortableSet<ModuleGraphConnection>} set input
* @returns {readonly Map<Module | undefined, readonly ModuleGraphConnection[]>} mapped by module
*/
const getConnectionsByModule = set => {
const map = new Map();
/** @type {Module | 0} */
let lastModule = 0;
/** @type {ModuleGraphConnection[] | undefined} */
let lastList;
for (const connection of set) {
const { module } = connection;
if (lastModule === module) {
/** @type {ModuleGraphConnection[]} */
(lastList).push(connection);
} else {
lastModule = module;
const list = map.get(module);
if (list !== undefined) {
lastList = list;
list.push(connection);
} else {
const list = [connection];
lastList = list;
map.set(module, list);
}
}
}
return map;
};
/** @typedef {SortableSet<ModuleGraphConnection>} IncomingConnections */
/** @typedef {SortableSet<ModuleGraphConnection>} OutgoingConnections */
class ModuleGraphModule {
constructor() {
/** @type {IncomingConnections} */
this.incomingConnections = new SortableSet();
/** @type {OutgoingConnections | undefined} */
this.outgoingConnections = undefined;
/** @type {Module | null | undefined} */
this.issuer = undefined;
/** @type {(string | OptimizationBailoutFunction)[]} */
this.optimizationBailout = [];
/** @type {ExportsInfo} */
this.exports = new ExportsInfo();
/** @type {number | null} */
this.preOrderIndex = null;
/** @type {number | null} */
this.postOrderIndex = null;
/** @type {number | null} */
this.depth = null;
/** @type {ModuleProfile | undefined} */
this.profile = undefined;
/** @type {boolean} */
this.async = false;
/** @type {ModuleGraphConnection[] | undefined} */
this._unassignedConnections = undefined;
}
}
/** @typedef {(moduleGraphConnection: ModuleGraphConnection) => boolean} FilterConnection */
/** @typedef {EXPECTED_OBJECT} MetaKey */
/** @typedef {TODO} Meta */
class ModuleGraph {
constructor() {
/**
* @type {WeakMap<Dependency, ModuleGraphConnection | null>}
* @private
*/
this._dependencyMap = new WeakMap();
/**
* @type {Map<Module, ModuleGraphModule>}
* @private
*/
this._moduleMap = new Map();
/**
* @type {WeakMap<MetaKey, Meta>}
* @private
*/
this._metaMap = new WeakMap();
/**
* @type {WeakTupleMap<EXPECTED_ANY[], EXPECTED_ANY> | undefined}
* @private
*/
this._cache = undefined;
/**
* @type {ModuleMemCaches | undefined}
* @private
*/
this._moduleMemCaches = undefined;
/**
* @type {string | undefined}
* @private
*/
this._cacheStage = undefined;
}
/**
* @param {Module} module the module
* @returns {ModuleGraphModule} the internal module
*/
_getModuleGraphModule(module) {
let mgm = this._moduleMap.get(module);
if (mgm === undefined) {
mgm = new ModuleGraphModule();
this._moduleMap.set(module, mgm);
}
return mgm;
}
/**
* @param {Dependency} dependency the dependency
* @param {DependenciesBlock} block parent block
* @param {Module} module parent module
* @param {number=} indexInBlock position in block
* @returns {void}
*/
setParents(dependency, block, module, indexInBlock = -1) {
dependency._parentDependenciesBlockIndex = indexInBlock;
dependency._parentDependenciesBlock = block;
dependency._parentModule = module;
}
/**
* @param {Dependency} dependency the dependency
* @returns {Module | undefined} parent module
*/
getParentModule(dependency) {
return dependency._parentModule;
}
/**
* @param {Dependency} dependency the dependency
* @returns {DependenciesBlock | undefined} parent block
*/
getParentBlock(dependency) {
return dependency._parentDependenciesBlock;
}
/**
* @param {Dependency} dependency the dependency
* @returns {number} index
*/
getParentBlockIndex(dependency) {
return dependency._parentDependenciesBlockIndex;
}
/**
* @param {Module | null} originModule the referencing module
* @param {Dependency} dependency the referencing dependency
* @param {Module} module the referenced module
* @returns {void}
*/
setResolvedModule(originModule, dependency, module) {
const connection = new ModuleGraphConnection(
originModule,
dependency,
module,
undefined,
dependency.weak,
dependency.getCondition(this)
);
const connections = this._getModuleGraphModule(module).incomingConnections;
connections.add(connection);
if (originModule) {
const mgm = this._getModuleGraphModule(originModule);
if (mgm._unassignedConnections === undefined) {
mgm._unassignedConnections = [];
}
mgm._unassignedConnections.push(connection);
if (mgm.outgoingConnections === undefined) {
mgm.outgoingConnections = new SortableSet();
}
mgm.outgoingConnections.add(connection);
} else {
this._dependencyMap.set(dependency, connection);
}
}
/**
* @param {Dependency} dependency the referencing dependency
* @param {Module} module the referenced module
* @returns {void}
*/
updateModule(dependency, module) {
const connection =
/** @type {ModuleGraphConnection} */
(this.getConnection(dependency));
if (connection.module === module) return;
const newConnection = connection.clone();
newConnection.module = module;
this._dependencyMap.set(dependency, newConnection);
connection.setActive(false);
const originMgm = this._getModuleGraphModule(
/** @type {Module} */ (connection.originModule)
);
/** @type {OutgoingConnections} */
(originMgm.outgoingConnections).add(newConnection);
const targetMgm = this._getModuleGraphModule(module);
targetMgm.incomingConnections.add(newConnection);
}
/**
* @param {Dependency} dependency the referencing dependency
* @returns {void}
*/
removeConnection(dependency) {
const connection =
/** @type {ModuleGraphConnection} */
(this.getConnection(dependency));
const targetMgm = this._getModuleGraphModule(connection.module);
targetMgm.incomingConnections.delete(connection);
const originMgm = this._getModuleGraphModule(
/** @type {Module} */ (connection.originModule)
);
/** @type {OutgoingConnections} */
(originMgm.outgoingConnections).delete(connection);
this._dependencyMap.set(dependency, null);
}
/**
* @param {Dependency} dependency the referencing dependency
* @param {string} explanation an explanation
* @returns {void}
*/
addExplanation(dependency, explanation) {
const connection =
/** @type {ModuleGraphConnection} */
(this.getConnection(dependency));
connection.addExplanation(explanation);
}
/**
* @param {Module} sourceModule the source module
* @param {Module} targetModule the target module
* @returns {void}
*/
cloneModuleAttributes(sourceModule, targetModule) {
const oldMgm = this._getModuleGraphModule(sourceModule);
const newMgm = this._getModuleGraphModule(targetModule);
newMgm.postOrderIndex = oldMgm.postOrderIndex;
newMgm.preOrderIndex = oldMgm.preOrderIndex;
newMgm.depth = oldMgm.depth;
newMgm.exports = oldMgm.exports;
newMgm.async = oldMgm.async;
}
/**
* @param {Module} module the module
* @returns {void}
*/
removeModuleAttributes(module) {
const mgm = this._getModuleGraphModule(module);
mgm.postOrderIndex = null;
mgm.preOrderIndex = null;
mgm.depth = null;
mgm.async = false;
}
/**
* @returns {void}
*/
removeAllModuleAttributes() {
for (const mgm of this._moduleMap.values()) {
mgm.postOrderIndex = null;
mgm.preOrderIndex = null;
mgm.depth = null;
mgm.async = false;
}
}
/**
* @param {Module} oldModule the old referencing module
* @param {Module} newModule the new referencing module
* @param {FilterConnection} filterConnection filter predicate for replacement
* @returns {void}
*/
moveModuleConnections(oldModule, newModule, filterConnection) {
if (oldModule === newModule) return;
const oldMgm = this._getModuleGraphModule(oldModule);
const newMgm = this._getModuleGraphModule(newModule);
// Outgoing connections
const oldConnections = oldMgm.outgoingConnections;
if (oldConnections !== undefined) {
if (newMgm.outgoingConnections === undefined) {
newMgm.outgoingConnections = new SortableSet();
}
const newConnections = newMgm.outgoingConnections;
for (const connection of oldConnections) {
if (filterConnection(connection)) {
connection.originModule = newModule;
newConnections.add(connection);
oldConnections.delete(connection);
}
}
}
// Incoming connections
const oldConnections2 = oldMgm.incomingConnections;
const newConnections2 = newMgm.incomingConnections;
for (const connection of oldConnections2) {
if (filterConnection(connection)) {
connection.module = newModule;
newConnections2.add(connection);
oldConnections2.delete(connection);
}
}
}
/**
* @param {Module} oldModule the old referencing module
* @param {Module} newModule the new referencing module
* @param {FilterConnection} filterConnection filter predicate for replacement
* @returns {void}
*/
copyOutgoingModuleConnections(oldModule, newModule, filterConnection) {
if (oldModule === newModule) return;
const oldMgm = this._getModuleGraphModule(oldModule);
const newMgm = this._getModuleGraphModule(newModule);
// Outgoing connections
const oldConnections = oldMgm.outgoingConnections;
if (oldConnections !== undefined) {
if (newMgm.outgoingConnections === undefined) {
newMgm.outgoingConnections = new SortableSet();
}
const newConnections = newMgm.outgoingConnections;
for (const connection of oldConnections) {
if (filterConnection(connection)) {
const newConnection = connection.clone();
newConnection.originModule = newModule;
newConnections.add(newConnection);
if (newConnection.module !== undefined) {
const otherMgm = this._getModuleGraphModule(newConnection.module);
otherMgm.incomingConnections.add(newConnection);
}
}
}
}
}
/**
* @param {Module} module the referenced module
* @param {string} explanation an explanation why it's referenced
* @returns {void}
*/
addExtraReason(module, explanation) {
const connections = this._getModuleGraphModule(module).incomingConnections;
connections.add(new ModuleGraphConnection(null, null, module, explanation));
}
/**
* @param {Dependency} dependency the dependency to look for a referenced module
* @returns {Module | null} the referenced module
*/
getResolvedModule(dependency) {
const connection = this.getConnection(dependency);
return connection !== undefined ? connection.resolvedModule : null;
}
/**
* @param {Dependency} dependency the dependency to look for a referenced module
* @returns {ModuleGraphConnection | undefined} the connection
*/
getConnection(dependency) {
const connection = this._dependencyMap.get(dependency);
if (connection === undefined) {
const module = this.getParentModule(dependency);
if (module !== undefined) {
const mgm = this._getModuleGraphModule(module);
if (
mgm._unassignedConnections &&
mgm._unassignedConnections.length !== 0
) {
let foundConnection;
for (const connection of mgm._unassignedConnections) {
this._dependencyMap.set(
/** @type {Dependency} */ (connection.dependency),
connection
);
if (connection.dependency === dependency)
foundConnection = connection;
}
mgm._unassignedConnections.length = 0;
if (foundConnection !== undefined) {
return foundConnection;
}
}
}
this._dependencyMap.set(dependency, null);
return;
}
return connection === null ? undefined : connection;
}
/**
* @param {Dependency} dependency the dependency to look for a referenced module
* @returns {Module | null} the referenced module
*/
getModule(dependency) {
const connection = this.getConnection(dependency);
return connection !== undefined ? connection.module : null;
}
/**
* @param {Dependency} dependency the dependency to look for a referencing module
* @returns {Module | null} the referencing module
*/
getOrigin(dependency) {
const connection = this.getConnection(dependency);
return connection !== undefined ? connection.originModule : null;
}
/**
* @param {Dependency} dependency the dependency to look for a referencing module
* @returns {Module | null} the original referencing module
*/
getResolvedOrigin(dependency) {
const connection = this.getConnection(dependency);
return connection !== undefined ? connection.resolvedOriginModule : null;
}
/**
* @param {Module} module the module
* @returns {Iterable<ModuleGraphConnection>} reasons why a module is included
*/
getIncomingConnections(module) {
const connections = this._getModuleGraphModule(module).incomingConnections;
return connections;
}
/**
* @param {Module} module the module
* @returns {Iterable<ModuleGraphConnection>} list of outgoing connections
*/
getOutgoingConnections(module) {
const connections = this._getModuleGraphModule(module).outgoingConnections;
return connections === undefined ? EMPTY_SET : connections;
}
/**
* @param {Module} module the module
* @returns {readonly Map<Module | undefined | null, readonly ModuleGraphConnection[]>} reasons why a module is included, in a map by source module
*/
getIncomingConnectionsByOriginModule(module) {
const connections = this._getModuleGraphModule(module).incomingConnections;
return connections.getFromUnorderedCache(getConnectionsByOriginModule);
}
/**
* @param {Module} module the module
* @returns {readonly Map<Module | undefined, readonly ModuleGraphConnection[]> | undefined} connections to modules, in a map by module
*/
getOutgoingConnectionsByModule(module) {
const connections = this._getModuleGraphModule(module).outgoingConnections;
return connections === undefined
? undefined
: connections.getFromUnorderedCache(getConnectionsByModule);
}
/**
* @param {Module} module the module
* @returns {ModuleProfile | undefined} the module profile
*/
getProfile(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.profile;
}
/**
* @param {Module} module the module
* @param {ModuleProfile | undefined} profile the module profile
* @returns {void}
*/
setProfile(module, profile) {
const mgm = this._getModuleGraphModule(module);
mgm.profile = profile;
}
/**
* @param {Module} module the module
* @returns {Module | null | undefined} the issuer module
*/
getIssuer(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.issuer;
}
/**
* @param {Module} module the module
* @param {Module | null} issuer the issuer module
* @returns {void}
*/
setIssuer(module, issuer) {
const mgm = this._getModuleGraphModule(module);
mgm.issuer = issuer;
}
/**
* @param {Module} module the module
* @param {Module | null} issuer the issuer module
* @returns {void}
*/
setIssuerIfUnset(module, issuer) {
const mgm = this._getModuleGraphModule(module);
if (mgm.issuer === undefined) mgm.issuer = issuer;
}
/**
* @param {Module} module the module
* @returns {(string | OptimizationBailoutFunction)[]} optimization bailouts
*/
getOptimizationBailout(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.optimizationBailout;
}
/**
* @param {Module} module the module
* @returns {true | string[] | null} the provided exports
*/
getProvidedExports(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.exports.getProvidedExports();
}
/**
* @param {Module} module the module
* @param {string | string[]} exportName a name of an export
* @returns {boolean | null} true, if the export is provided by the module.
* null, if it's unknown.
* false, if it's not provided.
*/
isExportProvided(module, exportName) {
const mgm = this._getModuleGraphModule(module);
const result = mgm.exports.isExportProvided(exportName);
return result === undefined ? null : result;
}
/**
* @param {Module} module the module
* @returns {ExportsInfo} info about the exports
*/
getExportsInfo(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.exports;
}
/**
* @param {Module} module the module
* @param {string} exportName the export
* @returns {ExportInfo} info about the export
*/
getExportInfo(module, exportName) {
const mgm = this._getModuleGraphModule(module);
return mgm.exports.getExportInfo(exportName);
}
/**
* @param {Module} module the module
* @param {string} exportName the export
* @returns {ExportInfo} info about the export (do not modify)
*/
getReadOnlyExportInfo(module, exportName) {
const mgm = this._getModuleGraphModule(module);
return mgm.exports.getReadOnlyExportInfo(exportName);
}
/**
* @param {Module} module the module
* @param {RuntimeSpec} runtime the runtime
* @returns {false | true | SortableSet<string> | null} the used exports
* false: module is not used at all.
* true: the module namespace/object export is used.
* SortableSet<string>: these export names are used.
* empty SortableSet<string>: module is used but no export.
* null: unknown, worst case should be assumed.
*/
getUsedExports(module, runtime) {
const mgm = this._getModuleGraphModule(module);
return mgm.exports.getUsedExports(runtime);
}
/**
* @param {Module} module the module
* @returns {number | null} the index of the module
*/
getPreOrderIndex(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.preOrderIndex;
}
/**
* @param {Module} module the module
* @returns {number | null} the index of the module
*/
getPostOrderIndex(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.postOrderIndex;
}
/**
* @param {Module} module the module
* @param {number} index the index of the module
* @returns {void}
*/
setPreOrderIndex(module, index) {
const mgm = this._getModuleGraphModule(module);
mgm.preOrderIndex = index;
}
/**
* @param {Module} module the module
* @param {number} index the index of the module
* @returns {boolean} true, if the index was set
*/
setPreOrderIndexIfUnset(module, index) {
const mgm = this._getModuleGraphModule(module);
if (mgm.preOrderIndex === null) {
mgm.preOrderIndex = index;
return true;
}
return false;
}
/**
* @param {Module} module the module
* @param {number} index the index of the module
* @returns {void}
*/
setPostOrderIndex(module, index) {
const mgm = this._getModuleGraphModule(module);
mgm.postOrderIndex = index;
}
/**
* @param {Module} module the module
* @param {number} index the index of the module
* @returns {boolean} true, if the index was set
*/
setPostOrderIndexIfUnset(module, index) {
const mgm = this._getModuleGraphModule(module);
if (mgm.postOrderIndex === null) {
mgm.postOrderIndex = index;
return true;
}
return false;
}
/**
* @param {Module} module the module
* @returns {number | null} the depth of the module
*/
getDepth(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.depth;
}
/**
* @param {Module} module the module
* @param {number} depth the depth of the module
* @returns {void}
*/
setDepth(module, depth) {
const mgm = this._getModuleGraphModule(module);
mgm.depth = depth;
}
/**
* @param {Module} module the module
* @param {number} depth the depth of the module
* @returns {boolean} true, if the depth was set
*/
setDepthIfLower(module, depth) {
const mgm = this._getModuleGraphModule(module);
if (mgm.depth === null || mgm.depth > depth) {
mgm.depth = depth;
return true;
}
return false;
}
/**
* @param {Module} module the module
* @returns {boolean} true, if the module is async
*/
isAsync(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.async;
}
/**
* @param {Module} module the module
* @returns {void}
*/
setAsync(module) {
const mgm = this._getModuleGraphModule(module);
mgm.async = true;
}
/**
* @param {MetaKey} thing any thing
* @returns {Meta} metadata
*/
getMeta(thing) {
let meta = this._metaMap.get(thing);
if (meta === undefined) {
meta = Object.create(null);
this._metaMap.set(thing, meta);
}
return meta;
}
/**
* @param {MetaKey} thing any thing
* @returns {Meta | undefined} metadata
*/
getMetaIfExisting(thing) {
return this._metaMap.get(thing);
}
/**
* @param {string=} cacheStage a persistent stage name for caching
*/
freeze(cacheStage) {
this._cache = new WeakTupleMap();
this._cacheStage = cacheStage;
}
unfreeze() {
this._cache = undefined;
this._cacheStage = undefined;
}
/**
* @template T
* @template R
* @param {(moduleGraph: ModuleGraph, ...args: T[]) => R} fn computer
* @param {...T} args arguments
* @returns {R} computed value or cached
*/
cached(fn, ...args) {
if (this._cache === undefined) return fn(this, ...args);
return this._cache.provide(fn, ...args, () => fn(this, ...args));
}
/**
* @param {ModuleMemCaches} moduleMemCaches mem caches for modules for better caching
*/
setModuleMemCaches(moduleMemCaches) {
this._moduleMemCaches = moduleMemCaches;
}
/**
* @template {Dependency} D
* @template {EXPECTED_ANY[]} ARGS
* @template R
* @param {D} dependency dependency
* @param {[...ARGS, (moduleGraph: ModuleGraph, dependency: D, ...args: ARGS) => R]} args arguments, last argument is a function called with moduleGraph, dependency, ...args
* @returns {R} computed value or cached
*/
dependencyCacheProvide(dependency, ...args) {
const fn =
/** @type {(moduleGraph: ModuleGraph, dependency: D, ...args: EXPECTED_ANY[]) => R} */
(args.pop());
if (this._moduleMemCaches && this._cacheStage) {
const memCache = this._moduleMemCaches.get(
/** @type {Module} */
(this.getParentModule(dependency))
);
if (memCache !== undefined) {
return memCache.provide(dependency, this._cacheStage, ...args, () =>
fn(this, dependency, ...args)
);
}
}
if (this._cache === undefined) return fn(this, dependency, ...args);
return this._cache.provide(dependency, ...args, () =>
fn(this, dependency, ...args)
);
}
// TODO remove in webpack 6
/**
* @param {Module} module the module
* @param {string} deprecateMessage message for the deprecation message
* @param {string} deprecationCode code for the deprecation
* @returns {ModuleGraph} the module graph
*/
static getModuleGraphForModule(module, deprecateMessage, deprecationCode) {
const fn = deprecateMap.get(deprecateMessage);
if (fn) return fn(module);
const newFn = util.deprecate(
/**
* @param {Module} module the module
* @returns {ModuleGraph} the module graph
*/
module => {
const moduleGraph = moduleGraphForModuleMap.get(module);
if (!moduleGraph)
throw new Error(
`${
deprecateMessage
}There was no ModuleGraph assigned to the Module for backward-compat (Use the new API)`
);
return moduleGraph;
},
`${deprecateMessage}: Use new ModuleGraph API`,
deprecationCode
);
deprecateMap.set(deprecateMessage, newFn);
return newFn(module);
}
// TODO remove in webpack 6
/**
* @param {Module} module the module
* @param {ModuleGraph} moduleGraph the module graph
* @returns {void}
*/
static setModuleGraphForModule(module, moduleGraph) {
moduleGraphForModuleMap.set(module, moduleGraph);
}
// TODO remove in webpack 6
/**
* @param {Module} module the module
* @returns {void}
*/
static clearModuleGraphForModule(module) {
moduleGraphForModuleMap.delete(module);
}
}
// TODO remove in webpack 6
/** @type {WeakMap<Module, ModuleGraph>} */
const moduleGraphForModuleMap = new WeakMap();
// TODO remove in webpack 6
/** @type {Map<string, (module: Module) => ModuleGraph>} */
const deprecateMap = new Map();
module.exports = ModuleGraph;
module.exports.ModuleGraphConnection = ModuleGraphConnection;

View File

@ -0,0 +1,199 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("./Dependency")} Dependency */
/** @typedef {import("./Dependency").GetConditionFn} GetConditionFn */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/**
* Module itself is not connected, but transitive modules are connected transitively.
*/
const TRANSITIVE_ONLY = Symbol("transitive only");
/**
* While determining the active state, this flag is used to signal a circular connection.
*/
const CIRCULAR_CONNECTION = Symbol("circular connection");
/** @typedef {boolean | typeof TRANSITIVE_ONLY | typeof CIRCULAR_CONNECTION} ConnectionState */
/**
* @param {ConnectionState} a first
* @param {ConnectionState} b second
* @returns {ConnectionState} merged
*/
const addConnectionStates = (a, b) => {
if (a === true || b === true) return true;
if (a === false) return b;
if (b === false) return a;
if (a === TRANSITIVE_ONLY) return b;
if (b === TRANSITIVE_ONLY) return a;
return a;
};
/**
* @param {ConnectionState} a first
* @param {ConnectionState} b second
* @returns {ConnectionState} intersected
*/
const intersectConnectionStates = (a, b) => {
if (a === false || b === false) return false;
if (a === true) return b;
if (b === true) return a;
if (a === CIRCULAR_CONNECTION) return b;
if (b === CIRCULAR_CONNECTION) return a;
return a;
};
class ModuleGraphConnection {
/**
* @param {Module|null} originModule the referencing module
* @param {Dependency|null} dependency the referencing dependency
* @param {Module} module the referenced module
* @param {string=} explanation some extra detail
* @param {boolean=} weak the reference is weak
* @param {false | null | GetConditionFn | undefined} condition condition for the connection
*/
constructor(
originModule,
dependency,
module,
explanation,
weak = false,
condition = undefined
) {
this.originModule = originModule;
this.resolvedOriginModule = originModule;
this.dependency = dependency;
this.resolvedModule = module;
this.module = module;
this.weak = weak;
this.conditional = Boolean(condition);
this._active = condition !== false;
this.condition = condition || undefined;
/** @type {Set<string> | undefined} */
this.explanations = undefined;
if (explanation) {
this.explanations = new Set();
this.explanations.add(explanation);
}
}
clone() {
const clone = new ModuleGraphConnection(
this.resolvedOriginModule,
this.dependency,
this.resolvedModule,
undefined,
this.weak,
this.condition
);
clone.originModule = this.originModule;
clone.module = this.module;
clone.conditional = this.conditional;
clone._active = this._active;
if (this.explanations) clone.explanations = new Set(this.explanations);
return clone;
}
/**
* @param {GetConditionFn} condition condition for the connection
* @returns {void}
*/
addCondition(condition) {
if (this.conditional) {
const old =
/** @type {GetConditionFn} */
(this.condition);
/** @type {GetConditionFn} */
(this.condition) = (c, r) =>
intersectConnectionStates(old(c, r), condition(c, r));
} else if (this._active) {
this.conditional = true;
this.condition = condition;
}
}
/**
* @param {string} explanation the explanation to add
* @returns {void}
*/
addExplanation(explanation) {
if (this.explanations === undefined) {
this.explanations = new Set();
}
this.explanations.add(explanation);
}
get explanation() {
if (this.explanations === undefined) return "";
return Array.from(this.explanations).join(" ");
}
/**
* @param {RuntimeSpec} runtime the runtime
* @returns {boolean} true, if the connection is active
*/
isActive(runtime) {
if (!this.conditional) return this._active;
return (
/** @type {GetConditionFn} */ (this.condition)(this, runtime) !== false
);
}
/**
* @param {RuntimeSpec} runtime the runtime
* @returns {boolean} true, if the connection is active
*/
isTargetActive(runtime) {
if (!this.conditional) return this._active;
return (
/** @type {GetConditionFn} */ (this.condition)(this, runtime) === true
);
}
/**
* @param {RuntimeSpec} runtime the runtime
* @returns {ConnectionState} true: fully active, false: inactive, TRANSITIVE: direct module inactive, but transitive connection maybe active
*/
getActiveState(runtime) {
if (!this.conditional) return this._active;
return /** @type {GetConditionFn} */ (this.condition)(this, runtime);
}
/**
* @param {boolean} value active or not
* @returns {void}
*/
setActive(value) {
this.conditional = false;
this._active = value;
}
// TODO webpack 5 remove
get active() {
throw new Error("Use getActiveState instead");
}
set active(value) {
throw new Error("Use setActive instead");
}
}
/** @typedef {typeof TRANSITIVE_ONLY} TRANSITIVE_ONLY */
/** @typedef {typeof CIRCULAR_CONNECTION} CIRCULAR_CONNECTION */
module.exports = ModuleGraphConnection;
module.exports.addConnectionStates = addConnectionStates;
module.exports.TRANSITIVE_ONLY = /** @type {typeof TRANSITIVE_ONLY} */ (
TRANSITIVE_ONLY
);
module.exports.CIRCULAR_CONNECTION = /** @type {typeof CIRCULAR_CONNECTION} */ (
CIRCULAR_CONNECTION
);

29
app_vue/node_modules/webpack/lib/ModuleHashingError.js generated vendored Normal file
View File

@ -0,0 +1,29 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
/** @typedef {import("./Module")} Module */
class ModuleHashingError extends WebpackError {
/**
* Create a new ModuleHashingError
* @param {Module} module related module
* @param {Error} error Original error
*/
constructor(module, error) {
super();
this.name = "ModuleHashingError";
this.error = error;
this.message = error.message;
this.details = error.stack;
this.module = module;
}
}
module.exports = ModuleHashingError;

View File

@ -0,0 +1,313 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { ConcatSource, RawSource, CachedSource } = require("webpack-sources");
const { UsageState } = require("./ExportsInfo");
const Template = require("./Template");
const CssModulesPlugin = require("./css/CssModulesPlugin");
const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./ExportsInfo")} ExportsInfo */
/** @typedef {import("./ExportsInfo").ExportInfo} ExportInfo */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./Module").BuildMeta} BuildMeta */
/** @typedef {import("./ModuleGraph")} ModuleGraph */
/** @typedef {import("./ModuleTemplate")} ModuleTemplate */
/** @typedef {import("./RequestShortener")} RequestShortener */
/**
* @template T
* @param {Iterable<T>} iterable iterable
* @returns {string} joined with comma
*/
const joinIterableWithComma = iterable => {
// This is more performant than Array.from().join(", ")
// as it doesn't create an array
let str = "";
let first = true;
for (const item of iterable) {
if (first) {
first = false;
} else {
str += ", ";
}
str += item;
}
return str;
};
/**
* @param {ConcatSource} source output
* @param {string} indent spacing
* @param {ExportsInfo} exportsInfo data
* @param {ModuleGraph} moduleGraph moduleGraph
* @param {RequestShortener} requestShortener requestShortener
* @param {Set<ExportInfo>} alreadyPrinted deduplication set
* @returns {void}
*/
const printExportsInfoToSource = (
source,
indent,
exportsInfo,
moduleGraph,
requestShortener,
alreadyPrinted = new Set()
) => {
const otherExportsInfo = exportsInfo.otherExportsInfo;
let alreadyPrintedExports = 0;
// determine exports to print
const printedExports = [];
for (const exportInfo of exportsInfo.orderedExports) {
if (!alreadyPrinted.has(exportInfo)) {
alreadyPrinted.add(exportInfo);
printedExports.push(exportInfo);
} else {
alreadyPrintedExports++;
}
}
let showOtherExports = false;
if (!alreadyPrinted.has(otherExportsInfo)) {
alreadyPrinted.add(otherExportsInfo);
showOtherExports = true;
} else {
alreadyPrintedExports++;
}
// print the exports
for (const exportInfo of printedExports) {
const target = exportInfo.getTarget(moduleGraph);
source.add(
`${Template.toComment(
`${indent}export ${JSON.stringify(exportInfo.name).slice(
1,
-1
)} [${exportInfo.getProvidedInfo()}] [${exportInfo.getUsedInfo()}] [${exportInfo.getRenameInfo()}]${
target
? ` -> ${target.module.readableIdentifier(requestShortener)}${
target.export
? ` .${target.export
.map(e => JSON.stringify(e).slice(1, -1))
.join(".")}`
: ""
}`
: ""
}`
)}\n`
);
if (exportInfo.exportsInfo) {
printExportsInfoToSource(
source,
`${indent} `,
exportInfo.exportsInfo,
moduleGraph,
requestShortener,
alreadyPrinted
);
}
}
if (alreadyPrintedExports) {
source.add(
`${Template.toComment(
`${indent}... (${alreadyPrintedExports} already listed exports)`
)}\n`
);
}
if (showOtherExports) {
const target = otherExportsInfo.getTarget(moduleGraph);
if (
target ||
otherExportsInfo.provided !== false ||
otherExportsInfo.getUsed(undefined) !== UsageState.Unused
) {
const title =
printedExports.length > 0 || alreadyPrintedExports > 0
? "other exports"
: "exports";
source.add(
`${Template.toComment(
`${indent}${title} [${otherExportsInfo.getProvidedInfo()}] [${otherExportsInfo.getUsedInfo()}]${
target
? ` -> ${target.module.readableIdentifier(requestShortener)}`
: ""
}`
)}\n`
);
}
}
};
/** @type {WeakMap<RequestShortener, WeakMap<Module, { header: RawSource | undefined, full: WeakMap<Source, CachedSource> }>>} */
const caches = new WeakMap();
const PLUGIN_NAME = "ModuleInfoHeaderPlugin";
class ModuleInfoHeaderPlugin {
/**
* @param {boolean=} verbose add more information like exports, runtime requirements and bailouts
*/
constructor(verbose = true) {
this._verbose = verbose;
}
/**
* @param {Compiler} compiler the compiler
* @returns {void}
*/
apply(compiler) {
const { _verbose: verbose } = this;
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
const javascriptHooks =
JavascriptModulesPlugin.getCompilationHooks(compilation);
javascriptHooks.renderModulePackage.tap(
PLUGIN_NAME,
(
moduleSource,
module,
{ chunk, chunkGraph, moduleGraph, runtimeTemplate }
) => {
const { requestShortener } = runtimeTemplate;
let cacheEntry;
let cache = caches.get(requestShortener);
if (cache === undefined) {
caches.set(requestShortener, (cache = new WeakMap()));
cache.set(
module,
(cacheEntry = { header: undefined, full: new WeakMap() })
);
} else {
cacheEntry = cache.get(module);
if (cacheEntry === undefined) {
cache.set(
module,
(cacheEntry = { header: undefined, full: new WeakMap() })
);
} else if (!verbose) {
const cachedSource = cacheEntry.full.get(moduleSource);
if (cachedSource !== undefined) return cachedSource;
}
}
const source = new ConcatSource();
let header = cacheEntry.header;
if (header === undefined) {
header = this.generateHeader(module, requestShortener);
cacheEntry.header = header;
}
source.add(header);
if (verbose) {
const exportsType = /** @type {BuildMeta} */ (module.buildMeta)
.exportsType;
source.add(
`${Template.toComment(
exportsType
? `${exportsType} exports`
: "unknown exports (runtime-defined)"
)}\n`
);
if (exportsType) {
const exportsInfo = moduleGraph.getExportsInfo(module);
printExportsInfoToSource(
source,
"",
exportsInfo,
moduleGraph,
requestShortener
);
}
source.add(
`${Template.toComment(
`runtime requirements: ${joinIterableWithComma(
chunkGraph.getModuleRuntimeRequirements(module, chunk.runtime)
)}`
)}\n`
);
const optimizationBailout =
moduleGraph.getOptimizationBailout(module);
if (optimizationBailout) {
for (const text of optimizationBailout) {
const code =
typeof text === "function" ? text(requestShortener) : text;
source.add(`${Template.toComment(`${code}`)}\n`);
}
}
source.add(moduleSource);
return source;
}
source.add(moduleSource);
const cachedSource = new CachedSource(source);
cacheEntry.full.set(moduleSource, cachedSource);
return cachedSource;
}
);
javascriptHooks.chunkHash.tap(PLUGIN_NAME, (_chunk, hash) => {
hash.update(PLUGIN_NAME);
hash.update("1");
});
const cssHooks = CssModulesPlugin.getCompilationHooks(compilation);
cssHooks.renderModulePackage.tap(
PLUGIN_NAME,
(moduleSource, module, { runtimeTemplate }) => {
const { requestShortener } = runtimeTemplate;
let cacheEntry;
let cache = caches.get(requestShortener);
if (cache === undefined) {
caches.set(requestShortener, (cache = new WeakMap()));
cache.set(
module,
(cacheEntry = { header: undefined, full: new WeakMap() })
);
} else {
cacheEntry = cache.get(module);
if (cacheEntry === undefined) {
cache.set(
module,
(cacheEntry = { header: undefined, full: new WeakMap() })
);
} else if (!verbose) {
const cachedSource = cacheEntry.full.get(moduleSource);
if (cachedSource !== undefined) return cachedSource;
}
}
const source = new ConcatSource();
let header = cacheEntry.header;
if (header === undefined) {
header = this.generateHeader(module, requestShortener);
cacheEntry.header = header;
}
source.add(header);
source.add(moduleSource);
const cachedSource = new CachedSource(source);
cacheEntry.full.set(moduleSource, cachedSource);
return cachedSource;
}
);
cssHooks.chunkHash.tap(PLUGIN_NAME, (_chunk, hash) => {
hash.update(PLUGIN_NAME);
hash.update("1");
});
});
}
/**
* @param {Module} module the module
* @param {RequestShortener} requestShortener request shortener
* @returns {RawSource} the header
*/
generateHeader(module, requestShortener) {
const req = module.readableIdentifier(requestShortener);
const reqStr = req.replace(/\*\//g, "*_/");
const reqStrStar = "*".repeat(reqStr.length);
const headerStr = `/*!****${reqStrStar}****!*\\\n !*** ${reqStr} ***!\n \\****${reqStrStar}****/\n`;
return new RawSource(headerStr);
}
}
module.exports = ModuleInfoHeaderPlugin;

View File

@ -0,0 +1,89 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Module")} Module */
const previouslyPolyfilledBuiltinModules = {
assert: "assert/",
buffer: "buffer/",
console: "console-browserify",
constants: "constants-browserify",
crypto: "crypto-browserify",
domain: "domain-browser",
events: "events/",
http: "stream-http",
https: "https-browserify",
os: "os-browserify/browser",
path: "path-browserify",
punycode: "punycode/",
process: "process/browser",
querystring: "querystring-es3",
stream: "stream-browserify",
_stream_duplex: "readable-stream/duplex",
_stream_passthrough: "readable-stream/passthrough",
_stream_readable: "readable-stream/readable",
_stream_transform: "readable-stream/transform",
_stream_writable: "readable-stream/writable",
string_decoder: "string_decoder/",
sys: "util/",
timers: "timers-browserify",
tty: "tty-browserify",
url: "url/",
util: "util/",
vm: "vm-browserify",
zlib: "browserify-zlib"
};
class ModuleNotFoundError extends WebpackError {
/**
* @param {Module | null} module module tied to dependency
* @param {Error & { details?: string }} err error thrown
* @param {DependencyLocation} loc location of dependency
*/
constructor(module, err, loc) {
let message = `Module not found: ${err.toString()}`;
// TODO remove in webpack 6
const match = err.message.match(/Can't resolve '([^']+)'/);
if (match) {
const request = match[1];
const alias =
previouslyPolyfilledBuiltinModules[
/** @type {keyof previouslyPolyfilledBuiltinModules} */ (request)
];
if (alias) {
const pathIndex = alias.indexOf("/");
const dependency = pathIndex > 0 ? alias.slice(0, pathIndex) : alias;
message +=
"\n\n" +
"BREAKING CHANGE: " +
"webpack < 5 used to include polyfills for node.js core modules by default.\n" +
"This is no longer the case. Verify if you need this module and configure a polyfill for it.\n\n";
message +=
"If you want to include a polyfill, you need to:\n" +
`\t- add a fallback 'resolve.fallback: { "${request}": require.resolve("${alias}") }'\n` +
`\t- install '${dependency}'\n`;
message +=
"If you don't want to include a polyfill, you can use an empty module like this:\n" +
`\tresolve.fallback: { "${request}": false }`;
}
}
super(message);
this.name = "ModuleNotFoundError";
this.details = err.details;
this.module = module;
this.error = err;
this.loc = loc;
}
}
module.exports = ModuleNotFoundError;

118
app_vue/node_modules/webpack/lib/ModuleParseError.js generated vendored Normal file
View File

@ -0,0 +1,118 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./Dependency").SourcePosition} SourcePosition */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
const WASM_HEADER = Buffer.from([0x00, 0x61, 0x73, 0x6d]);
class ModuleParseError extends WebpackError {
/**
* @param {string | Buffer} source source code
* @param {Error & { loc?: SourcePosition }} err the parse error
* @param {string[]} loaders the loaders used
* @param {string} type module type
*/
constructor(source, err, loaders, type) {
let message = `Module parse failed: ${err && err.message}`;
let loc;
if (
((Buffer.isBuffer(source) && source.slice(0, 4).equals(WASM_HEADER)) ||
(typeof source === "string" && /^\0asm/.test(source))) &&
!type.startsWith("webassembly")
) {
message +=
"\nThe module seem to be a WebAssembly module, but module is not flagged as WebAssembly module for webpack.";
message +=
"\nBREAKING CHANGE: Since webpack 5 WebAssembly is not enabled by default and flagged as experimental feature.";
message +=
"\nYou need to enable one of the WebAssembly experiments via 'experiments.asyncWebAssembly: true' (based on async modules) or 'experiments.syncWebAssembly: true' (like webpack 4, deprecated).";
message +=
"\nFor files that transpile to WebAssembly, make sure to set the module type in the 'module.rules' section of the config (e. g. 'type: \"webassembly/async\"').";
} else if (!loaders) {
message +=
"\nYou may need an appropriate loader to handle this file type.";
} else if (loaders.length >= 1) {
message += `\nFile was processed with these loaders:${loaders
.map(loader => `\n * ${loader}`)
.join("")}`;
message +=
"\nYou may need an additional loader to handle the result of these loaders.";
} else {
message +=
"\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders";
}
if (
err &&
err.loc &&
typeof err.loc === "object" &&
typeof err.loc.line === "number"
) {
const lineNumber = err.loc.line;
if (
Buffer.isBuffer(source) ||
/[\0\u0001\u0002\u0003\u0004\u0005\u0006\u0007]/.test(source)
) {
// binary file
message += "\n(Source code omitted for this binary file)";
} else {
const sourceLines = source.split(/\r?\n/);
const start = Math.max(0, lineNumber - 3);
const linesBefore = sourceLines.slice(start, lineNumber - 1);
const theLine = sourceLines[lineNumber - 1];
const linesAfter = sourceLines.slice(lineNumber, lineNumber + 2);
message += `${linesBefore
.map(l => `\n| ${l}`)
.join("")}\n> ${theLine}${linesAfter.map(l => `\n| ${l}`).join("")}`;
}
loc = { start: err.loc };
} else if (err && err.stack) {
message += `\n${err.stack}`;
}
super(message);
this.name = "ModuleParseError";
this.loc = loc;
this.error = err;
}
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.error);
super.serialize(context);
}
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.error = read();
super.deserialize(context);
}
}
makeSerializable(ModuleParseError, "webpack/lib/ModuleParseError");
module.exports = ModuleParseError;

108
app_vue/node_modules/webpack/lib/ModuleProfile.js generated vendored Normal file
View File

@ -0,0 +1,108 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
class ModuleProfile {
constructor() {
this.startTime = Date.now();
this.factoryStartTime = 0;
this.factoryEndTime = 0;
this.factory = 0;
this.factoryParallelismFactor = 0;
this.restoringStartTime = 0;
this.restoringEndTime = 0;
this.restoring = 0;
this.restoringParallelismFactor = 0;
this.integrationStartTime = 0;
this.integrationEndTime = 0;
this.integration = 0;
this.integrationParallelismFactor = 0;
this.buildingStartTime = 0;
this.buildingEndTime = 0;
this.building = 0;
this.buildingParallelismFactor = 0;
this.storingStartTime = 0;
this.storingEndTime = 0;
this.storing = 0;
this.storingParallelismFactor = 0;
/** @type {{ start: number, end: number }[] | undefined } */
this.additionalFactoryTimes = undefined;
this.additionalFactories = 0;
this.additionalFactoriesParallelismFactor = 0;
/** @deprecated */
this.additionalIntegration = 0;
}
markFactoryStart() {
this.factoryStartTime = Date.now();
}
markFactoryEnd() {
this.factoryEndTime = Date.now();
this.factory = this.factoryEndTime - this.factoryStartTime;
}
markRestoringStart() {
this.restoringStartTime = Date.now();
}
markRestoringEnd() {
this.restoringEndTime = Date.now();
this.restoring = this.restoringEndTime - this.restoringStartTime;
}
markIntegrationStart() {
this.integrationStartTime = Date.now();
}
markIntegrationEnd() {
this.integrationEndTime = Date.now();
this.integration = this.integrationEndTime - this.integrationStartTime;
}
markBuildingStart() {
this.buildingStartTime = Date.now();
}
markBuildingEnd() {
this.buildingEndTime = Date.now();
this.building = this.buildingEndTime - this.buildingStartTime;
}
markStoringStart() {
this.storingStartTime = Date.now();
}
markStoringEnd() {
this.storingEndTime = Date.now();
this.storing = this.storingEndTime - this.storingStartTime;
}
// This depends on timing so we ignore it for coverage
/* istanbul ignore next */
/**
* Merge this profile into another one
* @param {ModuleProfile} realProfile the profile to merge into
* @returns {void}
*/
mergeInto(realProfile) {
realProfile.additionalFactories = this.factory;
(realProfile.additionalFactoryTimes =
realProfile.additionalFactoryTimes || []).push({
start: this.factoryStartTime,
end: this.factoryEndTime
});
}
}
module.exports = ModuleProfile;

44
app_vue/node_modules/webpack/lib/ModuleRestoreError.js generated vendored Normal file
View File

@ -0,0 +1,44 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
/** @typedef {import("./Module")} Module */
class ModuleRestoreError extends WebpackError {
/**
* @param {Module} module module tied to dependency
* @param {string | Error} err error thrown
*/
constructor(module, err) {
let message = "Module restore failed: ";
/** @type {string | undefined} */
const details = undefined;
if (err !== null && typeof err === "object") {
if (typeof err.stack === "string" && err.stack) {
const stack = err.stack;
message += stack;
} else if (typeof err.message === "string" && err.message) {
message += err.message;
} else {
message += err;
}
} else {
message += String(err);
}
super(message);
this.name = "ModuleRestoreError";
/** @type {string | undefined} */
this.details = details;
this.module = module;
this.error = err;
}
}
module.exports = ModuleRestoreError;

View File

@ -0,0 +1,123 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Alexander Akait @alexander-akait
*/
"use strict";
/**
* @type {ReadonlySet<never>}
*/
const NO_TYPES = new Set();
/**
* @type {ReadonlySet<"asset">}
*/
const ASSET_TYPES = new Set(["asset"]);
/**
* @type {ReadonlySet<"asset" | "javascript" | "asset">}
*/
const ASSET_AND_JS_TYPES = new Set(["asset", "javascript"]);
/**
* @type {ReadonlySet<"css-url" | "asset">}
*/
const ASSET_AND_CSS_URL_TYPES = new Set(["asset", "css-url"]);
/**
* @type {ReadonlySet<"javascript" | "css-url" | "asset">}
*/
const ASSET_AND_JS_AND_CSS_URL_TYPES = new Set([
"asset",
"javascript",
"css-url"
]);
/**
* @type {"javascript"}
*/
const JS_TYPE = "javascript";
/**
* @type {ReadonlySet<"javascript">}
*/
const JS_TYPES = new Set(["javascript"]);
/**
* @type {ReadonlySet<"javascript" | "css-export">}
*/
const JS_AND_CSS_EXPORT_TYPES = new Set(["javascript", "css-export"]);
/**
* @type {ReadonlySet<"javascript" | "css-url">}
*/
const JS_AND_CSS_URL_TYPES = new Set(["javascript", "css-url"]);
/**
* @type {ReadonlySet<"javascript" | "css">}
*/
const JS_AND_CSS_TYPES = new Set(["javascript", "css"]);
/**
* @type {"css"}
*/
const CSS_TYPE = "css";
/**
* @type {ReadonlySet<"css">}
*/
const CSS_TYPES = new Set(["css"]);
/**
* @type {ReadonlySet<"css-url">}
*/
const CSS_URL_TYPES = new Set(["css-url"]);
/**
* @type {ReadonlySet<"css-import">}
*/
const CSS_IMPORT_TYPES = new Set(["css-import"]);
/**
* @type {ReadonlySet<"webassembly">}
*/
const WEBASSEMBLY_TYPES = new Set(["webassembly"]);
/**
* @type {ReadonlySet<"runtime">}
*/
const RUNTIME_TYPES = new Set(["runtime"]);
/**
* @type {ReadonlySet<"remote" | "share-init">}
*/
const REMOTE_AND_SHARE_INIT_TYPES = new Set(["remote", "share-init"]);
/**
* @type {ReadonlySet<"consume-shared">}
*/
const CONSUME_SHARED_TYPES = new Set(["consume-shared"]);
/**
* @type {ReadonlySet<"share-init">}
*/
const SHARED_INIT_TYPES = new Set(["share-init"]);
module.exports.NO_TYPES = NO_TYPES;
module.exports.JS_TYPE = JS_TYPE;
module.exports.JS_TYPES = JS_TYPES;
module.exports.JS_AND_CSS_TYPES = JS_AND_CSS_TYPES;
module.exports.JS_AND_CSS_URL_TYPES = JS_AND_CSS_URL_TYPES;
module.exports.JS_AND_CSS_EXPORT_TYPES = JS_AND_CSS_EXPORT_TYPES;
module.exports.ASSET_TYPES = ASSET_TYPES;
module.exports.ASSET_AND_JS_TYPES = ASSET_AND_JS_TYPES;
module.exports.ASSET_AND_CSS_URL_TYPES = ASSET_AND_CSS_URL_TYPES;
module.exports.ASSET_AND_JS_AND_CSS_URL_TYPES = ASSET_AND_JS_AND_CSS_URL_TYPES;
module.exports.CSS_TYPE = CSS_TYPE;
module.exports.CSS_TYPES = CSS_TYPES;
module.exports.CSS_URL_TYPES = CSS_URL_TYPES;
module.exports.CSS_IMPORT_TYPES = CSS_IMPORT_TYPES;
module.exports.WEBASSEMBLY_TYPES = WEBASSEMBLY_TYPES;
module.exports.RUNTIME_TYPES = RUNTIME_TYPES;
module.exports.REMOTE_AND_SHARE_INIT_TYPES = REMOTE_AND_SHARE_INIT_TYPES;
module.exports.CONSUME_SHARED_TYPES = CONSUME_SHARED_TYPES;
module.exports.SHARED_INIT_TYPES = SHARED_INIT_TYPES;

43
app_vue/node_modules/webpack/lib/ModuleStoreError.js generated vendored Normal file
View File

@ -0,0 +1,43 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const WebpackError = require("./WebpackError");
/** @typedef {import("./Module")} Module */
class ModuleStoreError extends WebpackError {
/**
* @param {Module} module module tied to dependency
* @param {string | Error} err error thrown
*/
constructor(module, err) {
let message = "Module storing failed: ";
/** @type {string | undefined} */
const details = undefined;
if (err !== null && typeof err === "object") {
if (typeof err.stack === "string" && err.stack) {
const stack = err.stack;
message += stack;
} else if (typeof err.message === "string" && err.message) {
message += err.message;
} else {
message += err;
}
} else {
message += String(err);
}
super(message);
this.name = "ModuleStoreError";
this.details = /** @type {string | undefined} */ (details);
this.module = module;
this.error = err;
}
}
module.exports = ModuleStoreError;

174
app_vue/node_modules/webpack/lib/ModuleTemplate.js generated vendored Normal file
View File

@ -0,0 +1,174 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const util = require("util");
const memoize = require("./util/memoize");
/** @typedef {import("tapable").Tap} Tap */
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./ChunkGraph")} ChunkGraph */
/** @typedef {import("./Compilation")} Compilation */
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ModuleGraph")} ModuleGraph */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */
/** @typedef {import("./util/Hash")} Hash */
/**
* @template T
* @typedef {import("tapable").IfSet<T>} IfSet
*/
const getJavascriptModulesPlugin = memoize(() =>
require("./javascript/JavascriptModulesPlugin")
);
// TODO webpack 6: remove this class
class ModuleTemplate {
/**
* @param {RuntimeTemplate} runtimeTemplate the runtime template
* @param {Compilation} compilation the compilation
*/
constructor(runtimeTemplate, compilation) {
this._runtimeTemplate = runtimeTemplate;
this.type = "javascript";
this.hooks = Object.freeze({
content: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(source: Source, module: Module, chunkRenderContext: ChunkRenderContext, dependencyTemplates: DependencyTemplates) => Source} fn fn
*/
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.renderModuleContent.tap(
options,
(source, module, renderContext) =>
fn(
source,
module,
renderContext,
renderContext.dependencyTemplates
)
);
},
"ModuleTemplate.hooks.content is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContent instead)",
"DEP_MODULE_TEMPLATE_CONTENT"
)
},
module: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(source: Source, module: Module, chunkRenderContext: ChunkRenderContext, dependencyTemplates: DependencyTemplates) => Source} fn fn
*/
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.renderModuleContent.tap(
options,
(source, module, renderContext) =>
fn(
source,
module,
renderContext,
renderContext.dependencyTemplates
)
);
},
"ModuleTemplate.hooks.module is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContent instead)",
"DEP_MODULE_TEMPLATE_MODULE"
)
},
render: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(source: Source, module: Module, chunkRenderContext: ChunkRenderContext, dependencyTemplates: DependencyTemplates) => Source} fn fn
*/
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.renderModuleContainer.tap(
options,
(source, module, renderContext) =>
fn(
source,
module,
renderContext,
renderContext.dependencyTemplates
)
);
},
"ModuleTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModuleContainer instead)",
"DEP_MODULE_TEMPLATE_RENDER"
)
},
package: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(source: Source, module: Module, chunkRenderContext: ChunkRenderContext, dependencyTemplates: DependencyTemplates) => Source} fn fn
*/
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.renderModulePackage.tap(
options,
(source, module, renderContext) =>
fn(
source,
module,
renderContext,
renderContext.dependencyTemplates
)
);
},
"ModuleTemplate.hooks.package is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderModulePackage instead)",
"DEP_MODULE_TEMPLATE_PACKAGE"
)
},
hash: {
tap: util.deprecate(
/**
* @template AdditionalOptions
* @param {string | Tap & IfSet<AdditionalOptions>} options options
* @param {(hash: Hash) => void} fn fn
*/
(options, fn) => {
compilation.hooks.fullHash.tap(options, fn);
},
"ModuleTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)",
"DEP_MODULE_TEMPLATE_HASH"
)
}
});
}
}
Object.defineProperty(ModuleTemplate.prototype, "runtimeTemplate", {
get: util.deprecate(
/**
* @this {ModuleTemplate}
* @returns {RuntimeTemplate} output options
*/
function () {
return this._runtimeTemplate;
},
"ModuleTemplate.runtimeTemplate is deprecated (use Compilation.runtimeTemplate instead)",
"DEP_WEBPACK_CHUNK_TEMPLATE_OUTPUT_OPTIONS"
)
});
module.exports = ModuleTemplate;

183
app_vue/node_modules/webpack/lib/ModuleTypeConstants.js generated vendored Normal file
View File

@ -0,0 +1,183 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Sean Larkin @TheLarkInn
*/
"use strict";
/**
* @type {Readonly<"javascript/auto">}
*/
const JAVASCRIPT_MODULE_TYPE_AUTO = "javascript/auto";
/**
* @type {Readonly<"javascript/dynamic">}
*/
const JAVASCRIPT_MODULE_TYPE_DYNAMIC = "javascript/dynamic";
/**
* @type {Readonly<"javascript/esm">}
* This is the module type used for _strict_ ES Module syntax. This means that all legacy formats
* that webpack supports (CommonJS, AMD, SystemJS) are not supported.
*/
const JAVASCRIPT_MODULE_TYPE_ESM = "javascript/esm";
/**
* @type {Readonly<"json">}
* This is the module type used for JSON files. JSON files are always parsed as ES Module.
*/
const JSON_MODULE_TYPE = "json";
/**
* @type {Readonly<"webassembly/async">}
* This is the module type used for WebAssembly modules. In webpack 5 they are always treated as async modules.
*/
const WEBASSEMBLY_MODULE_TYPE_ASYNC = "webassembly/async";
/**
* @type {Readonly<"webassembly/sync">}
* This is the module type used for WebAssembly modules. In webpack 4 they are always treated as sync modules.
* There is a legacy option to support this usage in webpack 5 and up.
*/
const WEBASSEMBLY_MODULE_TYPE_SYNC = "webassembly/sync";
/**
* @type {Readonly<"css">}
* This is the module type used for CSS files.
*/
const CSS_MODULE_TYPE = "css";
/**
* @type {Readonly<"css/global">}
* This is the module type used for CSS modules files where you need to use `:local` in selector list to hash classes.
*/
const CSS_MODULE_TYPE_GLOBAL = "css/global";
/**
* @type {Readonly<"css/module">}
* This is the module type used for CSS modules files, by default all classes are hashed.
*/
const CSS_MODULE_TYPE_MODULE = "css/module";
/**
* @type {Readonly<"css/auto">}
* This is the module type used for CSS files, the module will be parsed as CSS modules if it's filename contains `.module.` or `.modules.`.
*/
const CSS_MODULE_TYPE_AUTO = "css/auto";
/**
* @type {Readonly<"asset">}
* This is the module type used for automatically choosing between `asset/inline`, `asset/resource` based on asset size limit (8096).
*/
const ASSET_MODULE_TYPE = "asset";
/**
* @type {Readonly<"asset/inline">}
* This is the module type used for assets that are inlined as a data URI. This is the equivalent of `url-loader`.
*/
const ASSET_MODULE_TYPE_INLINE = "asset/inline";
/**
* @type {Readonly<"asset/resource">}
* This is the module type used for assets that are copied to the output directory. This is the equivalent of `file-loader`.
*/
const ASSET_MODULE_TYPE_RESOURCE = "asset/resource";
/**
* @type {Readonly<"asset/source">}
* This is the module type used for assets that are imported as source code. This is the equivalent of `raw-loader`.
*/
const ASSET_MODULE_TYPE_SOURCE = "asset/source";
/**
* @type {Readonly<"asset/raw-data-url">}
* TODO: Document what this asset type is for. See css-loader tests for its usage.
*/
const ASSET_MODULE_TYPE_RAW_DATA_URL = "asset/raw-data-url";
/**
* @type {Readonly<"runtime">}
* This is the module type used for the webpack runtime abstractions.
*/
const WEBPACK_MODULE_TYPE_RUNTIME = "runtime";
/**
* @type {Readonly<"fallback-module">}
* This is the module type used for the ModuleFederation feature's FallbackModule class.
* TODO: Document this better.
*/
const WEBPACK_MODULE_TYPE_FALLBACK = "fallback-module";
/**
* @type {Readonly<"remote-module">}
* This is the module type used for the ModuleFederation feature's RemoteModule class.
* TODO: Document this better.
*/
const WEBPACK_MODULE_TYPE_REMOTE = "remote-module";
/**
* @type {Readonly<"provide-module">}
* This is the module type used for the ModuleFederation feature's ProvideModule class.
* TODO: Document this better.
*/
const WEBPACK_MODULE_TYPE_PROVIDE = "provide-module";
/**
* @type {Readonly<"consume-shared-module">}
* This is the module type used for the ModuleFederation feature's ConsumeSharedModule class.
*/
const WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE = "consume-shared-module";
/**
* @type {Readonly<"lazy-compilation-proxy">}
* Module type used for `experiments.lazyCompilation` feature. See `LazyCompilationPlugin` for more information.
*/
const WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = "lazy-compilation-proxy";
/** @typedef {"javascript/auto" | "javascript/dynamic" | "javascript/esm"} JavaScriptModuleTypes */
/** @typedef {"json"} JSONModuleType */
/** @typedef {"webassembly/async" | "webassembly/sync"} WebAssemblyModuleTypes */
/** @typedef {"css" | "css/global" | "css/module"} CSSModuleTypes */
/** @typedef {"asset" | "asset/inline" | "asset/resource" | "asset/source" | "asset/raw-data-url"} AssetModuleTypes */
/** @typedef {"runtime" | "fallback-module" | "remote-module" | "provide-module" | "consume-shared-module" | "lazy-compilation-proxy"} WebpackModuleTypes */
/** @typedef {string} UnknownModuleTypes */
/** @typedef {JavaScriptModuleTypes | JSONModuleType | WebAssemblyModuleTypes | CSSModuleTypes | AssetModuleTypes | WebpackModuleTypes | UnknownModuleTypes} ModuleTypes */
module.exports.ASSET_MODULE_TYPE = ASSET_MODULE_TYPE;
module.exports.ASSET_MODULE_TYPE_RAW_DATA_URL = ASSET_MODULE_TYPE_RAW_DATA_URL;
module.exports.ASSET_MODULE_TYPE_SOURCE = ASSET_MODULE_TYPE_SOURCE;
module.exports.ASSET_MODULE_TYPE_RESOURCE = ASSET_MODULE_TYPE_RESOURCE;
module.exports.ASSET_MODULE_TYPE_INLINE = ASSET_MODULE_TYPE_INLINE;
module.exports.JAVASCRIPT_MODULE_TYPE_AUTO = JAVASCRIPT_MODULE_TYPE_AUTO;
module.exports.JAVASCRIPT_MODULE_TYPE_DYNAMIC = JAVASCRIPT_MODULE_TYPE_DYNAMIC;
module.exports.JAVASCRIPT_MODULE_TYPE_ESM = JAVASCRIPT_MODULE_TYPE_ESM;
module.exports.JAVASCRIPT_MODULES = [
JAVASCRIPT_MODULE_TYPE_AUTO,
JAVASCRIPT_MODULE_TYPE_DYNAMIC,
JAVASCRIPT_MODULE_TYPE_ESM
];
module.exports.JSON_MODULE_TYPE = JSON_MODULE_TYPE;
module.exports.WEBASSEMBLY_MODULE_TYPE_ASYNC = WEBASSEMBLY_MODULE_TYPE_ASYNC;
module.exports.WEBASSEMBLY_MODULE_TYPE_SYNC = WEBASSEMBLY_MODULE_TYPE_SYNC;
module.exports.WEBASSEMBLY_MODULES = [
WEBASSEMBLY_MODULE_TYPE_SYNC,
WEBASSEMBLY_MODULE_TYPE_SYNC
];
module.exports.CSS_MODULE_TYPE = CSS_MODULE_TYPE;
module.exports.CSS_MODULE_TYPE_GLOBAL = CSS_MODULE_TYPE_GLOBAL;
module.exports.CSS_MODULE_TYPE_MODULE = CSS_MODULE_TYPE_MODULE;
module.exports.CSS_MODULE_TYPE_AUTO = CSS_MODULE_TYPE_AUTO;
module.exports.CSS_MODULES = [
CSS_MODULE_TYPE,
CSS_MODULE_TYPE_GLOBAL,
CSS_MODULE_TYPE_MODULE,
CSS_MODULE_TYPE_AUTO
];
module.exports.WEBPACK_MODULE_TYPE_RUNTIME = WEBPACK_MODULE_TYPE_RUNTIME;
module.exports.WEBPACK_MODULE_TYPE_FALLBACK = WEBPACK_MODULE_TYPE_FALLBACK;
module.exports.WEBPACK_MODULE_TYPE_REMOTE = WEBPACK_MODULE_TYPE_REMOTE;
module.exports.WEBPACK_MODULE_TYPE_PROVIDE = WEBPACK_MODULE_TYPE_PROVIDE;
module.exports.WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE =
WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE;
module.exports.WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY =
WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY;

66
app_vue/node_modules/webpack/lib/ModuleWarning.js generated vendored Normal file
View File

@ -0,0 +1,66 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { cleanUp } = require("./ErrorHelpers");
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
class ModuleWarning extends WebpackError {
/**
* @param {Error} warning error thrown
* @param {{from?: string|null}} info additional info
*/
constructor(warning, { from = null } = {}) {
let message = "Module Warning";
message += from ? ` (from ${from}):\n` : ": ";
if (warning && typeof warning === "object" && warning.message) {
message += warning.message;
} else if (warning) {
message += String(warning);
}
super(message);
this.name = "ModuleWarning";
this.warning = warning;
this.details =
warning && typeof warning === "object" && warning.stack
? cleanUp(warning.stack, this.message)
: undefined;
}
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.warning);
super.serialize(context);
}
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.warning = read();
super.deserialize(context);
}
}
makeSerializable(ModuleWarning, "webpack/lib/ModuleWarning");
module.exports = ModuleWarning;

Some files were not shown because too many files have changed in this diff Show More