Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

65
node_modules/webpack/lib/errors/AbstractMethodError.js generated vendored Normal file
View File

@@ -0,0 +1,65 @@
/*
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_.]*)/;
/**
* Creates the error message shown when an abstract API is called without
* being implemented by a subclass.
* @param {string=} method method name
* @returns {string} message
*/
function createMessage(method) {
return `Abstract method${method ? ` ${method}` : ""}. Must be overridden.`;
}
/**
* Captures a stack trace so the calling method name can be folded into the
* final abstract-method error message.
* @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 thrown when code reaches a method that is intended to be overridden by
* a subclass.
* @example
* ```js
* class FooClass {
* abstractMethod() {
* throw new AbstractMethodError(); // error message: Abstract method FooClass.abstractMethod. Must be overridden.
* }
* }
* ```
*/
class AbstractMethodError extends WebpackError {
/**
* Creates an error whose message points at the abstract method that was
* invoked.
*/
constructor() {
super(new Message().message);
/** @type {string} */
this.name = "AbstractMethodError";
}
}
module.exports = AbstractMethodError;

View File

@@ -0,0 +1,39 @@
/*
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 */
/**
* Error raised when webpack detects an attempt to lazy-load a chunk name that
* is already claimed by an entrypoint's initial chunk.
*/
class AsyncDependencyToInitialChunkError extends WebpackError {
/**
* Captures the chunk name, originating module, and source location for an
* invalid async dependency targeting an initial chunk.
* @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.`
);
/** @type {string} */
this.name = "AsyncDependencyToInitialChunkError";
/** @type {Module} */
this.module = module;
/** @type {DependencyLocation} */
this.loc = loc;
}
}
module.exports = AsyncDependencyToInitialChunkError;

30
node_modules/webpack/lib/errors/BuildCycleError.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
/*
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 BuildCycleError extends WebpackError {
/**
* Creates an instance of BuildCycleError.
* @param {Module} module the module starting the cycle
*/
constructor(module) {
super(
"There is a circular build dependency, which makes it impossible to create this module"
);
/** @type {string} */
this.name = "BuildCycleError";
/** @type {Module} */
this.module = module;
}
}
/** @type {typeof BuildCycleError} */
module.exports = BuildCycleError;

38
node_modules/webpack/lib/errors/ChunkRenderError.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 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();
/** @type {string} */
this.name = "ChunkRenderError";
/** @type {Chunk} */
this.chunk = chunk;
/** @type {string} */
this.file = file;
/** @type {Error} */
this.error = error;
/** @type {string} */
this.message = error.message;
/** @type {string} */
this.details = error.stack;
}
}
/** @type {typeof ChunkRenderError} */
module.exports = ChunkRenderError;

35
node_modules/webpack/lib/errors/CodeGenerationError.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
/*
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();
/** @type {string} */
this.name = "CodeGenerationError";
/** @type {Module} */
this.module = module;
/** @type {Error} */
this.error = error;
/** @type {string} */
this.message = error.message;
/** @type {string} */
this.details = error.stack;
}
}
/** @type {typeof CodeGenerationError} */
module.exports = CodeGenerationError;

View File

@@ -0,0 +1,39 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/**
* Warning used for comment-related compilation issues, such as malformed magic
* comments that webpack can parse but wants to report.
*/
class CommentCompilationWarning extends WebpackError {
/**
* Captures a warning message together with the dependency location that
* triggered it.
* @param {string} message warning message
* @param {DependencyLocation} loc affected lines of code
*/
constructor(message, loc) {
super(message);
/** @type {string} */
this.name = "CommentCompilationWarning";
/** @type {DependencyLocation} */
this.loc = loc;
}
}
makeSerializable(
CommentCompilationWarning,
"webpack/lib/errors/CommentCompilationWarning"
);
module.exports = CommentCompilationWarning;

View File

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

View File

@@ -0,0 +1,51 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Gengkun He @ahabhgk
*/
"use strict";
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
/** @typedef {import("../Module")} Module */
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
/** @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);
/** @type {string} */
this.name = "EnvironmentNotSupportAsyncWarning";
/** @type {Module} */
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/errors/EnvironmentNotSupportAsyncWarning"
);
module.exports = EnvironmentNotSupportAsyncWarning;

127
node_modules/webpack/lib/errors/HookWebpackError.js generated vendored Normal file
View File

@@ -0,0 +1,127 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Sean Larkin @thelarkinn
*/
"use strict";
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/**
* Defines the callback callback.
* @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 ? error.message : undefined, error ? { cause: error } : {});
this.hook = hook;
this.error = error;
/** @type {string} */
this.name = "HookWebpackError";
this.hideStack = true;
this.stack += `\n-- inner error --\n${error ? error.stack : ""}`;
this.details = `caused by plugins in ${hook}\n${error ? error.stack : ""}`;
}
/**
* Serializes this instance into the provided serializer context.
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.error);
write(this.hook);
super.serialize(context);
}
/**
* Restores this instance from the provided deserializer context.
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.error = read();
this.hook = read();
super.deserialize(context);
}
}
makeSerializable(HookWebpackError, "webpack/lib/errors/HookWebpackError");
module.exports = HookWebpackError;
/**
* Creates webpack error.
* @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;
/**
* Creates webpack error callback.
* @template T
* @param {(err: Error | 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;
/**
* Try run or webpack error.
* @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) => {
/** @type {T} */
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,41 @@
/*
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 {
/**
* Creates an instance of IgnoreErrorModuleFactory.
* @param {NormalModuleFactory} normalModuleFactory normalModuleFactory instance
*/
constructor(normalModuleFactory) {
super();
this.normalModuleFactory = normalModuleFactory;
}
/**
* Processes the provided data.
* @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;

View File

@@ -0,0 +1,45 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
/** @typedef {import("../Module")} Module */
class InvalidDependenciesModuleWarning extends WebpackError {
/**
* Creates an instance of InvalidDependenciesModuleWarning.
* @param {Module} module module tied to dependency
* @param {Iterable<string>} deps invalid dependencies
*/
constructor(module, deps) {
const orderedDeps = deps ? [...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 ..." : ""
}`);
/** @type {string} */
this.name = "InvalidDependenciesModuleWarning";
this.details = depsList.slice(3).join("\n");
this.module = module;
}
}
makeSerializable(
InvalidDependenciesModuleWarning,
"webpack/lib/errors/InvalidDependenciesModuleWarning"
);
module.exports = InvalidDependenciesModuleWarning;

114
node_modules/webpack/lib/errors/JSONParseError.js generated vendored Normal file
View File

@@ -0,0 +1,114 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
*/
"use strict";
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
const makeSerializable = require("../util/makeSerializable");
const CONTEXT = 20;
class JSONParseError extends SyntaxError {
/**
* @param {Error} err err
* @param {EXPECTED_ANY} raw raw
* @param {string} txt text
*/
constructor(err, raw, txt) {
let originalMessage = err.message;
/** @type {string} */
let message;
/** @type {number} */
let position;
if (typeof raw !== "string") {
message = `Cannot parse ${Array.isArray(raw) && raw.length === 0 ? "an empty array" : String(raw)}`;
position = 0;
} else if (!txt) {
message = `${originalMessage} while parsing empty string`;
position = 0;
} else {
// Node 20 puts single quotes around the token and a comma after it
const UNEXPECTED_TOKEN = /^Unexpected token '?(.)'?(,)? /i;
const badTokenMatch = originalMessage.match(UNEXPECTED_TOKEN);
const badIndexMatch = originalMessage.match(/ position\s+(\d+)/i);
if (badTokenMatch) {
const h = badTokenMatch[1].charCodeAt(0).toString(16).toUpperCase();
const hex = `0x${h.length % 2 ? "0" : ""}${h}`;
originalMessage = originalMessage.replace(
UNEXPECTED_TOKEN,
`Unexpected token ${JSON.stringify(badTokenMatch[1])} (${hex})$2 `
);
}
/** @type {number | undefined} */
let errIdx;
if (badIndexMatch) {
errIdx = Number(badIndexMatch[1]);
} else if (
// doesn't happen in Node 22+
/^Unexpected end of JSON.*/i.test(originalMessage)
) {
errIdx = txt.length - 1;
}
if (errIdx === undefined) {
message = `${originalMessage} while parsing '${txt.slice(0, CONTEXT * 2)}'`;
position = 0;
} else {
const start = errIdx <= CONTEXT ? 0 : errIdx - CONTEXT;
const end =
errIdx + CONTEXT >= txt.length ? txt.length : errIdx + CONTEXT;
const slice = `${start ? "..." : ""}${txt.slice(start, end)}${end === txt.length ? "" : "..."}`;
message = `${originalMessage} while parsing ${txt === slice ? "" : "near "}${JSON.stringify(slice)}`;
position = errIdx;
}
}
super(message);
/** @type {string} */
this.name = "JSONParseError";
/** @type {string | undefined} */
this.stack = undefined;
/** @type {Error} */
this.systemError = err;
/** @type {EXPECTED_ANY} */
this.raw = raw;
/** @type {string} */
this.txt = txt;
/** @type {number} */
this.position = position;
}
/**
* Serializes this instance into the provided serializer context.
* @param {ObjectSerializerContext} context context
*/
serialize({ write }) {
write(this.systemError);
write(this.raw);
write(this.txt);
}
/**
* Restores this instance from the provided deserializer context.
* @param {ObjectDeserializerContext} context context
* @returns {JSONParseError} DelegatedModule
*/
static deserialize(context) {
const { read } = context;
return new JSONParseError(read(), read(), read());
}
}
makeSerializable(JSONParseError, "webpack/lib/errors/JSONParseError");
module.exports = JSONParseError;

86
node_modules/webpack/lib/errors/ModuleBuildError.js generated vendored Normal file
View File

@@ -0,0 +1,86 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { cutOffLoaderExecution } = require("../ErrorHelpers");
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {Error & { hideStack?: boolean }} ErrorWithHideStack */
class ModuleBuildError extends WebpackError {
/**
* Creates an instance of ModuleBuildError.
* @param {string | ErrorWithHideStack} err error thrown
* @param {{ from?: string | null }} info additional info
*/
constructor(err, { from = null } = {}) {
let message = "Module build failed";
/** @type {undefined | string} */
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);
/** @type {string} */
this.name = "ModuleBuildError";
this.details = details;
this.error = err;
}
/**
* Serializes this instance into the provided serializer context.
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.error);
super.serialize(context);
}
/**
* Restores this instance from the provided deserializer context.
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.error = read();
super.deserialize(context);
}
}
makeSerializable(ModuleBuildError, "webpack/lib/errors/ModuleBuildError");
module.exports = ModuleBuildError;

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("../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);
/** @type {string} */
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,50 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../Module")} Module */
/** @typedef {import("./ModuleDependencyError").ErrorWithHideStack} ErrorWithHideStack */
class ModuleDependencyWarning extends WebpackError {
/**
* Creates an instance of ModuleDependencyWarning.
* @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 : "");
/** @type {string} */
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/errors/ModuleDependencyWarning"
);
module.exports = ModuleDependencyWarning;

71
node_modules/webpack/lib/errors/ModuleError.js generated vendored Normal file
View File

@@ -0,0 +1,71 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { cleanUp } = require("../ErrorHelpers");
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
/** @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);
/** @type {string} */
this.name = "ModuleError";
/** @type {Error} */
this.error = err;
/** @type {string | undefined} */
this.details =
err && typeof err === "object" && err.stack
? cleanUp(err.stack, this.message)
: undefined;
}
/**
* Serializes this instance into the provided serializer context.
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.error);
super.serialize(context);
}
/**
* Restores this instance from the provided deserializer context.
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.error = read();
super.deserialize(context);
}
}
makeSerializable(ModuleError, "webpack/lib/errors/ModuleError");
module.exports = ModuleError;

31
node_modules/webpack/lib/errors/ModuleHashingError.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("../Module")} Module */
class ModuleHashingError extends WebpackError {
/**
* Create a new ModuleHashingError
* @param {Module} module related module
* @param {Error} error Original error
*/
constructor(module, error) {
super();
/** @type {string} */
this.name = "ModuleHashingError";
this.error = error;
this.message = error.message;
this.details = error.stack;
this.module = module;
}
}
/** @type {typeof ModuleHashingError} */
module.exports = ModuleHashingError;

91
node_modules/webpack/lib/errors/ModuleNotFoundError.js generated vendored Normal file
View File

@@ -0,0 +1,91 @@
/*
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 {
/**
* Creates an instance of ModuleNotFoundError.
* @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);
/** @type {string} */
this.name = "ModuleNotFoundError";
this.details = err.details;
this.module = module;
this.error = err;
this.loc = loc;
}
}
module.exports = ModuleNotFoundError;

130
node_modules/webpack/lib/errors/ModuleParseError.js generated vendored Normal file
View File

@@ -0,0 +1,130 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @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 {
/**
* Creates an instance of ModuleParseError.
* @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}`;
/** @type {undefined | DependencyLocation} */
let loc;
if (
((Buffer.isBuffer(source) && source.subarray(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. " +
"See https://webpack.js.org/concepts/loaders";
} 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) ||
// eslint-disable-next-line no-control-regex
/[\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);
/** @type {string} */
this.name = "ModuleParseError";
/** @type {undefined | DependencyLocation} */
this.loc = loc;
/** @type {Error} */
this.error = err;
}
/**
* Serializes this instance into the provided serializer context.
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.error);
super.serialize(context);
}
/**
* Restores this instance from the provided deserializer context.
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.error = read();
super.deserialize(context);
}
}
makeSerializable(ModuleParseError, "webpack/lib/errors/ModuleParseError");
module.exports = ModuleParseError;

47
node_modules/webpack/lib/errors/ModuleRestoreError.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
/*
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 {
/**
* Creates an instance of ModuleRestoreError.
* @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);
/** @type {string} */
this.name = "ModuleRestoreError";
/** @type {string | undefined} */
this.details = details;
this.module = module;
this.error = err;
}
}
/** @type {typeof ModuleRestoreError} */
module.exports = ModuleRestoreError;

46
node_modules/webpack/lib/errors/ModuleStoreError.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
/*
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 {
/**
* Creates an instance of ModuleStoreError.
* @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);
/** @type {string} */
this.name = "ModuleStoreError";
this.details = /** @type {string | undefined} */ (details);
this.module = module;
this.error = err;
}
}
/** @type {typeof ModuleStoreError} */
module.exports = ModuleStoreError;

71
node_modules/webpack/lib/errors/ModuleWarning.js generated vendored Normal file
View File

@@ -0,0 +1,71 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { cleanUp } = require("../ErrorHelpers");
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
class ModuleWarning extends WebpackError {
/**
* Creates an instance of ModuleWarning.
* @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);
/** @type {string} */
this.name = "ModuleWarning";
this.warning = warning;
this.details =
warning && typeof warning === "object" && warning.stack
? cleanUp(warning.stack, this.message)
: undefined;
}
/**
* Serializes this instance into the provided serializer context.
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.warning);
super.serialize(context);
}
/**
* Restores this instance from the provided deserializer context.
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.warning = read();
super.deserialize(context);
}
}
makeSerializable(ModuleWarning, "webpack/lib/errors/ModuleWarning");
/** @type {typeof ModuleWarning} */
module.exports = ModuleWarning;

36
node_modules/webpack/lib/errors/NodeStuffInWebError.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
class NodeStuffInWebError extends WebpackError {
/**
* Creates an instance of NodeStuffInWebError.
* @param {DependencyLocation} loc loc
* @param {string} expression expression
* @param {string} description description
*/
constructor(loc, expression, description) {
super(
`${JSON.stringify(
expression
)} has been used, it will be undefined in next major version.
${description}`
);
/** @type {string} */
this.name = "NodeStuffInWebError";
this.loc = loc;
}
}
makeSerializable(NodeStuffInWebError, "webpack/lib/NodeStuffInWebError");
module.exports = NodeStuffInWebError;

View File

@@ -0,0 +1,28 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
class NonErrorEmittedError extends WebpackError {
/**
* @param {EXPECTED_ANY} error value which is not an instance of Error
*/
constructor(error) {
super();
this.name = "NonErrorEmittedError";
this.message = `(Emitted value instead of an instance of Error) ${error}`;
}
}
makeSerializable(
NonErrorEmittedError,
"webpack/lib/errors/NonErrorEmittedError"
);
module.exports = NonErrorEmittedError;

View File

@@ -0,0 +1,40 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Ivan Kopeykin @vankop
*/
"use strict";
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
/**
* Error raised when webpack encounters a resource URI scheme that no installed
* plugin knows how to read.
*/
class UnhandledSchemeError extends WebpackError {
/**
* Creates an error explaining that the current resource scheme is not
* supported by the active plugin set.
* @param {string} scheme scheme
* @param {string} resource resource
*/
constructor(scheme, resource) {
super(
`Reading from "${resource}" is not handled by plugins (Unhandled scheme).` +
'\nWebpack supports "data:" and "file:" URIs by default.' +
`\nYou may need an additional plugin to handle "${scheme}:" URIs.`
);
this.file = resource;
/** @type {string} */
this.name = "UnhandledSchemeError";
}
}
makeSerializable(
UnhandledSchemeError,
"webpack/lib/errors/UnhandledSchemeError",
"UnhandledSchemeError"
);
module.exports = UnhandledSchemeError;

View File

@@ -0,0 +1,36 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const makeSerializable = require("../util/makeSerializable");
const WebpackError = require("./WebpackError");
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
class UnsupportedFeatureWarning extends WebpackError {
/**
* Creates an instance of UnsupportedFeatureWarning.
* @param {string} message description of warning
* @param {DependencyLocation} loc location start and end positions of the module
*/
constructor(message, loc) {
super(message);
/** @type {string} */
this.name = "UnsupportedFeatureWarning";
/** @type {DependencyLocation} */
this.loc = loc;
/** @type {boolean} */
this.hideStack = true;
}
}
makeSerializable(
UnsupportedFeatureWarning,
"webpack/lib/errors/UnsupportedFeatureWarning"
);
module.exports = UnsupportedFeatureWarning;

84
node_modules/webpack/lib/errors/WebpackError.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Jarid Margolin @jaridmargolin
*/
"use strict";
const inspect = require("util").inspect.custom;
const makeSerializable = require("../util/makeSerializable");
/** @typedef {import("../Chunk")} Chunk */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../Module")} Module */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
class WebpackError extends Error {
/**
* Creates an instance of WebpackError.
* @param {string=} message error message
* @param {{ cause?: unknown }} options error options
*/
constructor(message, options = {}) {
super(message, options);
/** @type {string=} */
this.details = undefined;
/** @type {(Module | null)=} */
this.module = undefined;
/** @type {DependencyLocation=} */
this.loc = undefined;
/** @type {boolean=} */
this.hideStack = undefined;
/** @type {Chunk=} */
this.chunk = undefined;
/** @type {string=} */
this.file = undefined;
}
/**
* Returns inspect message.
* @returns {string} inspect message
*/
[inspect]() {
return (
this.stack +
(this.details ? `\n${this.details}` : "") +
(this.cause ? `\n${this.cause}` : "")
);
}
/**
* Serializes this instance into the provided serializer context.
* @param {ObjectSerializerContext} context context
*/
serialize({ write }) {
write(this.name);
write(this.message);
write(this.stack);
write(this.cause);
write(this.details);
write(this.loc);
write(this.hideStack);
}
/**
* Restores this instance from the provided deserializer context.
* @param {ObjectDeserializerContext} context context
*/
deserialize({ read }) {
this.name = read();
this.message = read();
this.stack = read();
this.cause = read();
this.details = read();
this.loc = read();
this.hideStack = read();
}
}
makeSerializable(WebpackError, "webpack/lib/errors/WebpackError");
/** @type {typeof WebpackError} */
module.exports = WebpackError;