This commit is contained in:
2025-09-19 14:25:20 +08:00
parent 269893a435
commit fbf3f77229
24949 changed files with 2839404 additions and 0 deletions

20
node_modules/mini-css-extract-plugin/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
Copyright JS Foundation and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1296
node_modules/mini-css-extract-plugin/README.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,252 @@
"use strict";
/* global document */
/*
eslint-disable
no-console,
func-names
*/
var normalizeUrl = require("./normalize-url");
var srcByModuleId = Object.create(null);
var noDocument = typeof document === "undefined";
var forEach = Array.prototype.forEach;
// eslint-disable-next-line jsdoc/no-restricted-syntax
/**
* @param {Function} fn any function
* @param {number} time time
* @returns {() => void} wrapped function
*/
function debounce(fn, time) {
var timeout = 0;
return function () {
// @ts-expect-error
var self = this;
// eslint-disable-next-line prefer-rest-params
var args = arguments;
// eslint-disable-next-line func-style
var functionCall = function functionCall() {
return fn.apply(self, args);
};
clearTimeout(timeout);
// @ts-expect-error
timeout = setTimeout(functionCall, time);
};
}
/**
* @returns {void}
*/
function noop() {}
/** @typedef {(filename?: string) => string[]} GetScriptSrc */
/**
* @param {string | number} moduleId a module id
* @returns {GetScriptSrc} current script url
*/
function getCurrentScriptUrl(moduleId) {
var src = srcByModuleId[moduleId];
if (!src) {
if (document.currentScript) {
src = (/** @type {HTMLScriptElement} */document.currentScript).src;
} else {
var scripts = document.getElementsByTagName("script");
var lastScriptTag = scripts[scripts.length - 1];
if (lastScriptTag) {
src = lastScriptTag.src;
}
}
srcByModuleId[moduleId] = src;
}
/** @type {GetScriptSrc} */
return function (fileMap) {
if (!src) {
return [];
}
var splitResult = src.split(/([^\\/]+)\.js$/);
var filename = splitResult && splitResult[1];
if (!filename) {
return [src.replace(".js", ".css")];
}
if (!fileMap) {
return [src.replace(".js", ".css")];
}
return fileMap.split(",").map(function (mapRule) {
var reg = new RegExp("".concat(filename, "\\.js$"), "g");
return normalizeUrl(src.replace(reg, "".concat(mapRule.replace(/{fileName}/g, filename), ".css")));
});
};
}
/**
* @param {string} url URL
* @returns {boolean} true when URL can be request, otherwise false
*/
function isUrlRequest(url) {
// An URL is not an request if
// It is not http or https
if (!/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url)) {
return false;
}
return true;
}
/** @typedef {HTMLLinkElement & { isLoaded: boolean, visited: boolean }} HotHTMLLinkElement */
/**
* @param {HotHTMLLinkElement} el html link element
* @param {string=} url a URL
*/
function updateCss(el, url) {
if (!url) {
if (!el.href) {
return;
}
// eslint-disable-next-line
url = el.href.split("?")[0];
}
if (!isUrlRequest(/** @type {string} */url)) {
return;
}
if (el.isLoaded === false) {
// We seem to be about to replace a css link that hasn't loaded yet.
// We're probably changing the same file more than once.
return;
}
// eslint-disable-next-line unicorn/prefer-includes
if (!url || !(url.indexOf(".css") > -1)) {
return;
}
el.visited = true;
var newEl = /** @type {HotHTMLLinkElement} */
el.cloneNode();
newEl.isLoaded = false;
newEl.addEventListener("load", function () {
if (newEl.isLoaded) {
return;
}
newEl.isLoaded = true;
if (el.parentNode) {
el.parentNode.removeChild(el);
}
});
newEl.addEventListener("error", function () {
if (newEl.isLoaded) {
return;
}
newEl.isLoaded = true;
if (el.parentNode) {
el.parentNode.removeChild(el);
}
});
newEl.href = "".concat(url, "?").concat(Date.now());
if (el.parentNode) {
if (el.nextSibling) {
el.parentNode.insertBefore(newEl, el.nextSibling);
} else {
el.parentNode.appendChild(newEl);
}
}
}
/**
* @param {string} href href
* @param {string[]} src src
* @returns {undefined | string} a reload url
*/
function getReloadUrl(href, src) {
var ret;
href = normalizeUrl(href);
src.some(
/**
* @param {string} url url
*/
// eslint-disable-next-line array-callback-return
function (url) {
// @ts-expect-error fix me in the next major release
// eslint-disable-next-line unicorn/prefer-includes
if (href.indexOf(src) > -1) {
ret = url;
}
});
return ret;
}
/**
* @param {string[]} src source
* @returns {boolean} true when loaded, otherwise false
*/
function reloadStyle(src) {
var elements = document.querySelectorAll("link");
var loaded = false;
forEach.call(elements, function (el) {
if (!el.href) {
return;
}
var url = getReloadUrl(el.href, src);
if (url && !isUrlRequest(url)) {
return;
}
if (el.visited === true) {
return;
}
if (url) {
updateCss(el, url);
loaded = true;
}
});
return loaded;
}
/**
* @returns {void}
*/
function reloadAll() {
var elements = document.querySelectorAll("link");
forEach.call(elements, function (el) {
if (el.visited === true) {
return;
}
updateCss(el);
});
}
/**
* @param {number | string} moduleId a module id
* @param {{ filename?: string, locals?: boolean }} options options
* @returns {() => void} wrapper function
*/
module.exports = function (moduleId, options) {
if (noDocument) {
console.log("no window.document found, will not HMR CSS");
return noop;
}
var getScriptSrc = getCurrentScriptUrl(moduleId);
/**
* @returns {void}
*/
function update() {
var src = getScriptSrc(options.filename);
var reloaded = reloadStyle(src);
if (options.locals) {
console.log("[HMR] Detected local css modules. Reload all css");
reloadAll();
return;
}
if (reloaded) {
console.log("[HMR] css reload %s", src.join(" "));
} else {
console.log("[HMR] Reload all css");
reloadAll();
}
}
return debounce(update, 50);
};

View File

@@ -0,0 +1,39 @@
"use strict";
/**
* @param {string[]} pathComponents path components
* @returns {string} normalized url
*/
function normalizeUrlInner(pathComponents) {
return pathComponents.reduce(function (accumulator, item) {
switch (item) {
case "..":
accumulator.pop();
break;
case ".":
break;
default:
accumulator.push(item);
}
return accumulator;
}, /** @type {string[]} */[]).join("/");
}
/**
* @param {string} urlString url string
* @returns {string} normalized url string
*/
module.exports = function normalizeUrl(urlString) {
urlString = urlString.trim();
if (/^data:/i.test(urlString)) {
return urlString;
}
var protocol =
// eslint-disable-next-line unicorn/prefer-includes
urlString.indexOf("//") !== -1 ? "".concat(urlString.split("//")[0], "//") : "";
var components = urlString.replace(new RegExp(protocol, "i"), "").split("/");
var host = components[0].toLowerCase().replace(/\.$/, "");
components[0] = "";
var path = normalizeUrlInner(components);
return protocol + host + path;
};

1047
node_modules/mini-css-extract-plugin/dist/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
{
"title": "Mini CSS Extract Plugin Loader options",
"type": "object",
"additionalProperties": false,
"properties": {
"publicPath": {
"anyOf": [
{
"type": "string"
},
{
"instanceof": "Function"
}
],
"description": "Specifies a custom public path for the external resources like images, files, etc inside CSS.",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#publicpath"
},
"emit": {
"type": "boolean",
"description": "If true, emits a file (writes a file to the filesystem). If false, the plugin will extract the CSS but will not emit the file",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#emit"
},
"esModule": {
"type": "boolean",
"description": "Generates JS modules that use the ES modules syntax.",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#esmodule"
},
"layer": {
"type": "string"
},
"defaultExport": {
"type": "boolean",
"description": "Duplicate the named export with CSS modules locals to the default export (only when `esModules: true` for css-loader).",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#defaultexports"
}
}
}

412
node_modules/mini-css-extract-plugin/dist/loader.js generated vendored Normal file
View File

@@ -0,0 +1,412 @@
"use strict";
const path = require("path");
const schema = require("./loader-options.json");
const {
ABSOLUTE_PUBLIC_PATH,
AUTO_PUBLIC_PATH,
BASE_URI,
SINGLE_DOT_PATH_SEGMENT,
evalModuleCode,
findModuleById,
stringifyLocal,
stringifyRequest
} = require("./utils");
const MiniCssExtractPlugin = require("./index");
/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
/** @typedef {import("webpack").Compiler} Compiler */
/** @typedef {import("webpack").Compilation} Compilation */
/** @typedef {import("webpack").Chunk} Chunk */
/** @typedef {import("webpack").Module} Module */
/** @typedef {import("webpack").sources.Source} Source */
/** @typedef {import("webpack").AssetInfo} AssetInfo */
/** @typedef {import("webpack").NormalModule} NormalModule */
/** @typedef {import("./index.js").LoaderOptions} LoaderOptions */
// eslint-disable-next-line jsdoc/no-restricted-syntax
/** @typedef {{[key: string]: string | Function }} Locals */
// eslint-disable-next-line jsdoc/no-restricted-syntax
/** @typedef {any} EXPECTED_ANY */
/**
* @typedef {object} Dependency
* @property {string} identifier identifier
* @property {string | null} context context
* @property {Buffer} content content
* @property {string=} media media
* @property {string=} supports supports
* @property {string=} layer layer
* @property {Buffer=} sourceMap source map
*/
/**
* @param {string} code code
* @param {{ loaderContext: import("webpack").LoaderContext<LoaderOptions>, options: LoaderOptions, locals: Locals | undefined }} context context
* @returns {string} code and HMR code
*/
function hotLoader(code, context) {
const localsJsonString = JSON.stringify(JSON.stringify(context.locals));
return `${code}
if(module.hot) {
(function() {
var localsJsonString = ${localsJsonString};
// ${Date.now()}
var cssReload = require(${stringifyRequest(context.loaderContext, path.join(__dirname, "hmr/hotModuleReplacement.js"))})(module.id, ${JSON.stringify(context.options)});
// only invalidate when locals change
if (
module.hot.data &&
module.hot.data.value &&
module.hot.data.value !== localsJsonString
) {
module.hot.invalidate();
} else {
module.hot.accept();
}
module.hot.dispose(function(data) {
data.value = localsJsonString;
cssReload();
});
})();
}
`;
}
/**
* @this {import("webpack").LoaderContext<LoaderOptions>}
* @param {string} request request
*/
function pitch(request) {
if (this._compiler && this._compiler.options && this._compiler.options.experiments && this._compiler.options.experiments.css && this._module && (this._module.type === "css" || this._module.type === "css/auto" || this._module.type === "css/global" || this._module.type === "css/module")) {
this.emitWarning(new Error('You can\'t use `experiments.css` (`experiments.futureDefaults` enable built-in CSS support by default) and `mini-css-extract-plugin` together, please set `experiments.css` to `false` or set `{ type: "javascript/auto" }` for rules with `mini-css-extract-plugin` in your webpack config (now `mini-css-extract-plugin` does nothing).'));
return;
}
const options = this.getOptions(/** @type {Schema} */schema);
const emit = typeof options.emit !== "undefined" ? options.emit : true;
const callback = this.async();
const optionsFromPlugin =
// @ts-expect-error
this[MiniCssExtractPlugin.pluginSymbol];
if (!optionsFromPlugin) {
callback(new Error("You forgot to add 'mini-css-extract-plugin' plugin (i.e. `{ plugins: [new MiniCssExtractPlugin()] }`), please read https://github.com/webpack-contrib/mini-css-extract-plugin#getting-started"));
return;
}
const {
webpack
} = /** @type {Compiler} */this._compiler;
/**
* @param {EXPECTED_ANY} originalExports original exports
* @param {Compilation=} compilation compilation
* @param {{ [name: string]: Source }=} assets assets
* @param {Map<string, AssetInfo>=} assetsInfo assets info
* @returns {void}
*/
const handleExports = (originalExports, compilation, assets, assetsInfo) => {
/** @type {Locals | undefined} */
let locals;
let namedExport;
const esModule = typeof options.esModule !== "undefined" ? options.esModule : true;
/**
* @param {Dependency[] | [null, object][]} dependencies dependencies
*/
const addDependencies = dependencies => {
// eslint-disable-next-line no-eq-null, eqeqeq
if (!Array.isArray(dependencies) && dependencies != null) {
throw new Error(`Exported value was not extracted as an array: ${JSON.stringify(dependencies)}`);
}
const identifierCountMap = new Map();
let lastDep;
for (const dependency of dependencies) {
if (!(/** @type {Dependency} */dependency.identifier) || !emit) {
continue;
}
const count = identifierCountMap.get(/** @type {Dependency} */dependency.identifier) || 0;
const CssDependency = MiniCssExtractPlugin.getCssDependency(webpack);
/** @type {NormalModule} */
this._module.addDependency(lastDep = new CssDependency(/** @type {Dependency} */
dependency, /** @type {Dependency} */
dependency.context, count));
identifierCountMap.set(/** @type {Dependency} */
dependency.identifier, count + 1);
}
if (lastDep && assets) {
lastDep.assets = assets;
lastDep.assetsInfo = assetsInfo;
}
};
try {
const exports = originalExports.__esModule ? originalExports.default : originalExports;
namedExport = originalExports.__esModule && (!originalExports.default || !("locals" in originalExports.default));
if (namedExport) {
for (const key of Object.keys(originalExports)) {
if (key !== "default") {
if (!locals) {
locals = {};
}
/** @type {Locals} */
locals[key] = originalExports[key];
}
}
} else {
locals = exports && exports.locals;
}
/** @type {Dependency[] | [null, Record<string, string>][]} */
let dependencies;
if (!Array.isArray(exports)) {
dependencies = [[null, exports]];
} else {
dependencies = exports.map(([id, content, media, sourceMap, supports, layer]) => {
let identifier = id;
let context;
if (compilation) {
const module = /** @type {Module} */
findModuleById(compilation, id);
identifier = module.identifier();
({
context
} = module);
} else {
// TODO check if this context is used somewhere
context = this.rootContext;
}
return {
identifier,
context,
content: Buffer.from(content),
media,
supports,
layer,
sourceMap: sourceMap ? Buffer.from(JSON.stringify(sourceMap)) : undefined
};
});
}
addDependencies(dependencies);
} catch (err) {
callback(/** @type {Error} */err);
return;
}
const result = function makeResult() {
const defaultExport = typeof options.defaultExport !== "undefined" ? options.defaultExport : false;
if (locals) {
if (namedExport) {
const identifiers = [...function* generateIdentifiers() {
let identifierId = 0;
for (const key of Object.keys(locals)) {
identifierId += 1;
yield [`_${identifierId.toString(16)}`, key];
}
}()];
const localsString = identifiers.map(([id, key]) => `\nvar ${id} = ${stringifyLocal(/** @type {Locals} */locals[key])};`).join("");
const exportsString = `export { ${identifiers.map(([id, key]) => `${id} as ${JSON.stringify(key)}`).join(", ")} }`;
return defaultExport ? `${localsString}\n${exportsString}\nexport default { ${identifiers.map(([id, key]) => `${JSON.stringify(key)}: ${id}`).join(", ")} }\n` : `${localsString}\n${exportsString}\n`;
}
return `\n${esModule ? "export default" : "module.exports = "} ${JSON.stringify(locals)};`;
} else if (esModule) {
return defaultExport ? "\nexport {};export default {};" : "\nexport {};";
}
return "";
}();
let resultSource = `// extracted by ${MiniCssExtractPlugin.pluginName}`;
// only attempt hotreloading if the css is actually used for something other than hash values
resultSource += this.hot && emit ? hotLoader(result, {
loaderContext: this,
options,
locals
}) : result;
callback(null, resultSource);
};
let {
publicPath
} = /** @type {Compilation} */
this._compilation.outputOptions;
if (typeof options.publicPath === "string") {
publicPath = options.publicPath;
} else if (typeof options.publicPath === "function") {
publicPath = options.publicPath(this.resourcePath, this.rootContext);
}
if (publicPath === "auto") {
publicPath = AUTO_PUBLIC_PATH;
}
if (typeof optionsFromPlugin.experimentalUseImportModule === "undefined" && typeof this.importModule === "function" || optionsFromPlugin.experimentalUseImportModule) {
if (!this.importModule) {
callback(new Error("You are using 'experimentalUseImportModule' but 'this.importModule' is not available in loader context. You need to have at least webpack 5.33.2."));
return;
}
let publicPathForExtract;
if (typeof publicPath === "string") {
const isAbsolutePublicPath = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(publicPath);
publicPathForExtract = isAbsolutePublicPath ? publicPath : `${ABSOLUTE_PUBLIC_PATH}${publicPath.replace(/\./g, SINGLE_DOT_PATH_SEGMENT)}`;
} else {
publicPathForExtract = publicPath;
}
this.importModule(`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`, {
layer: options.layer,
publicPath: (/** @type {string} */publicPathForExtract),
baseUri: `${BASE_URI}/`
},
/**
* @param {Error | null | undefined} error error
* @param {object} exports exports
*/
(error, exports) => {
if (error) {
callback(error);
return;
}
handleExports(exports);
});
return;
}
const loaders = this.loaders.slice(this.loaderIndex + 1);
this.addDependency(this.resourcePath);
const childFilename = "*";
const outputOptions = {
filename: childFilename,
publicPath
};
const childCompiler = /** @type {Compilation} */
this._compilation.createChildCompiler(`${MiniCssExtractPlugin.pluginName} ${request}`, outputOptions);
// The templates are compiled and executed by NodeJS - similar to server side rendering
// Unfortunately this causes issues as some loaders require an absolute URL to support ES Modules
// The following config enables relative URL support for the child compiler
childCompiler.options.module = {
...childCompiler.options.module
};
childCompiler.options.module.parser = {
...childCompiler.options.module.parser
};
childCompiler.options.module.parser.javascript = {
...childCompiler.options.module.parser.javascript,
url: "relative"
};
const {
NodeTemplatePlugin
} = webpack.node;
const {
NodeTargetPlugin
} = webpack.node;
new NodeTemplatePlugin().apply(childCompiler);
new NodeTargetPlugin().apply(childCompiler);
const {
EntryOptionPlugin
} = webpack;
const {
library: {
EnableLibraryPlugin
}
} = webpack;
new EnableLibraryPlugin("commonjs2").apply(childCompiler);
EntryOptionPlugin.applyEntryOption(childCompiler, this.context, {
child: {
library: {
type: "commonjs2"
},
import: [`!!${request}`]
}
});
const {
LimitChunkCountPlugin
} = webpack.optimize;
new LimitChunkCountPlugin({
maxChunks: 1
}).apply(childCompiler);
const {
NormalModule
} = webpack;
childCompiler.hooks.thisCompilation.tap(`${MiniCssExtractPlugin.pluginName} loader`,
/**
* @param {Compilation} compilation compilation
*/
compilation => {
const normalModuleHook = NormalModule.getCompilationHooks(compilation).loader;
normalModuleHook.tap(`${MiniCssExtractPlugin.pluginName} loader`, (loaderContext, module) => {
if (module.request === request) {
module.loaders = loaders.map(loader => ({
type: null,
loader: loader.path,
options: loader.options,
ident: loader.ident
}));
}
});
});
/** @type {string | Buffer} */
let source;
childCompiler.hooks.compilation.tap(MiniCssExtractPlugin.pluginName,
/**
* @param {Compilation} compilation compilation
*/
compilation => {
compilation.hooks.processAssets.tap(MiniCssExtractPlugin.pluginName, () => {
source = compilation.assets[childFilename] && compilation.assets[childFilename].source();
// Remove all chunk assets
for (const chunk of compilation.chunks) {
for (const file of chunk.files) {
compilation.deleteAsset(file);
}
}
});
});
childCompiler.runAsChild((error, entries, compilation_) => {
if (error) {
callback(error);
return;
}
const compilation = /** @type {Compilation} */compilation_;
if (compilation.errors.length > 0) {
callback(compilation.errors[0]);
return;
}
/** @type {{ [name: string]: Source }} */
const assets = Object.create(null);
/** @type {Map<string, AssetInfo>} */
const assetsInfo = new Map();
for (const asset of compilation.getAssets()) {
assets[asset.name] = asset.source;
assetsInfo.set(asset.name, asset.info);
}
for (const dep of compilation.fileDependencies) {
this.addDependency(dep);
}
for (const dep of compilation.contextDependencies) {
this.addContextDependency(dep);
}
if (!source) {
callback(new Error("Didn't get a result from child compiler"));
return;
}
let originalExports;
try {
originalExports = evalModuleCode(this, source, request);
} catch (err) {
callback(/** @type {Error} */err);
return;
}
handleExports(originalExports, compilation, assets, assetsInfo);
});
}
/**
* @this {import("webpack").LoaderContext<LoaderOptions>}
* @param {string} content content
* @returns {string | undefined} the original content
*/
function loader(content) {
if (this._compiler && this._compiler.options && this._compiler.options.experiments && this._compiler.options.experiments.css && this._module && (this._module.type === "css" || this._module.type === "css/auto" || this._module.type === "css/global" || this._module.type === "css/module")) {
return content;
}
}
module.exports = loader;
module.exports.hotLoader = hotLoader;
module.exports.pitch = pitch;

View File

@@ -0,0 +1,79 @@
{
"title": "Mini CSS Extract Plugin options",
"type": "object",
"additionalProperties": false,
"properties": {
"filename": {
"anyOf": [
{
"type": "string",
"absolutePath": false,
"minLength": 1
},
{
"instanceof": "Function"
}
],
"description": "This option determines the name of each output CSS file.",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#filename"
},
"chunkFilename": {
"anyOf": [
{
"type": "string",
"absolutePath": false,
"minLength": 1
},
{
"instanceof": "Function"
}
],
"description": "This option determines the name of non-entry chunk files.",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#chunkfilename"
},
"experimentalUseImportModule": {
"type": "boolean",
"description": "Enable the experimental importModule approach instead of using child compilers. This uses less memory and is faster.",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#experimentaluseimportmodule"
},
"ignoreOrder": {
"type": "boolean",
"description": "Remove Order Warnings.",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#ignoreorder"
},
"insert": {
"description": "Inserts the `link` tag at the given position for non-initial (async) (https://webpack.js.org/concepts/under-the-hood/#chunks) CSS chunks.",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#insert",
"anyOf": [
{
"type": "string"
},
{
"instanceof": "Function"
}
]
},
"attributes": {
"description": "Adds custom attributes to the `link` tag for non-initial (async) (https://webpack.js.org/concepts/under-the-hood/#chunks) CSS chunks.",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#attributes",
"type": "object"
},
"linkType": {
"anyOf": [
{
"enum": ["text/css"]
},
{
"type": "boolean"
}
],
"description": "This option allows loading asynchronous chunks with a custom link type",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#linktype"
},
"runtime": {
"type": "boolean",
"description": "Enabled/Disables runtime generation. CSS will be still extracted and can be used for a custom loading methods.",
"link": "https://github.com/webpack-contrib/mini-css-extract-plugin#noRuntime"
}
}
}

411
node_modules/mini-css-extract-plugin/dist/utils.js generated vendored Normal file
View File

@@ -0,0 +1,411 @@
"use strict";
const NativeModule = require("module");
const path = require("path");
/** @typedef {import("webpack").Compilation} Compilation */
/** @typedef {import("webpack").Module} Module */
// eslint-disable-next-line jsdoc/no-restricted-syntax
/** @typedef {import("webpack").LoaderContext<any>} LoaderContext */
/**
* @returns {boolean} always returns true
*/
function trueFn() {
return true;
}
/**
* @param {Compilation} compilation compilation
* @param {string | number} id module id
* @returns {null | Module} the found module
*/
function findModuleById(compilation, id) {
const {
modules,
chunkGraph
} = compilation;
for (const module of modules) {
const moduleId = typeof chunkGraph !== "undefined" ? chunkGraph.getModuleId(module) : module.id;
if (moduleId === id) {
return module;
}
}
return null;
}
// eslint-disable-next-line jsdoc/no-restricted-syntax
/**
* @param {LoaderContext} loaderContext loader context
* @param {string | Buffer} code code
* @param {string} filename filename
* @returns {Record<string, any>} exports of a module
*/
function evalModuleCode(loaderContext, code, filename) {
// @ts-expect-error
const module = new NativeModule(filename, loaderContext);
// @ts-expect-error
module.paths = NativeModule._nodeModulePaths(loaderContext.context);
module.filename = filename;
// @ts-expect-error
module._compile(code, filename);
return module.exports;
}
/**
* @param {string} a a
* @param {string} b b
* @returns {0 | 1 | -1} result of comparing
*/
function compareIds(a, b) {
if (typeof a !== typeof b) {
return typeof a < typeof b ? -1 : 1;
}
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
}
/**
* @param {Module} a a
* @param {Module} b b
* @returns {0 | 1 | -1} result of comparing
*/
function compareModulesByIdentifier(a, b) {
return compareIds(a.identifier(), b.identifier());
}
const MODULE_TYPE = "css/mini-extract";
const AUTO_PUBLIC_PATH = "__mini_css_extract_plugin_public_path_auto__";
const ABSOLUTE_PUBLIC_PATH = "webpack:///mini-css-extract-plugin/";
const BASE_URI = "webpack://";
const SINGLE_DOT_PATH_SEGMENT = "__mini_css_extract_plugin_single_dot_path_segment__";
/**
* @param {string} str path
* @returns {boolean} true when path is absolute, otherwise false
*/
function isAbsolutePath(str) {
return path.posix.isAbsolute(str) || path.win32.isAbsolute(str);
}
const RELATIVE_PATH_REGEXP = /^\.\.?[/\\]/;
/**
* @param {string} str string
* @returns {boolean} true when path is relative, otherwise false
*/
function isRelativePath(str) {
return RELATIVE_PATH_REGEXP.test(str);
}
// TODO simplify for the next major release
/**
* @param {LoaderContext} loaderContext the loader context
* @param {string} request a request
* @returns {string} a stringified request
*/
function stringifyRequest(loaderContext, request) {
if (typeof loaderContext.utils !== "undefined" && typeof loaderContext.utils.contextify === "function") {
return JSON.stringify(loaderContext.utils.contextify(loaderContext.context || loaderContext.rootContext, request));
}
const splitted = request.split("!");
const {
context
} = loaderContext;
return JSON.stringify(splitted.map(part => {
// First, separate singlePath from query, because the query might contain paths again
const splittedPart = part.match(/^(.*?)(\?.*)/);
const query = splittedPart ? splittedPart[2] : "";
let singlePath = splittedPart ? splittedPart[1] : part;
if (isAbsolutePath(singlePath) && context) {
singlePath = path.relative(context, singlePath);
if (isAbsolutePath(singlePath)) {
// If singlePath still matches an absolute path, singlePath was on a different drive than context.
// In this case, we leave the path platform-specific without replacing any separators.
// @see https://github.com/webpack/loader-utils/pull/14
return singlePath + query;
}
if (isRelativePath(singlePath) === false) {
// Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
singlePath = `./${singlePath}`;
}
}
return singlePath.replace(/\\/g, "/") + query;
}).join("!"));
}
/**
* @param {string} filename filename
* @param {string} outputPath output path
* @param {boolean} enforceRelative true when need to enforce relative path, otherwise false
* @returns {string} undo path
*/
function getUndoPath(filename, outputPath, enforceRelative) {
let depth = -1;
let append = "";
outputPath = outputPath.replace(/[\\/]$/, "");
for (const part of filename.split(/[/\\]+/)) {
if (part === "..") {
if (depth > -1) {
depth--;
} else {
const i = outputPath.lastIndexOf("/");
const j = outputPath.lastIndexOf("\\");
const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j);
if (pos < 0) {
return `${outputPath}/`;
}
append = `${outputPath.slice(pos + 1)}/${append}`;
outputPath = outputPath.slice(0, pos);
}
} else if (part !== ".") {
depth++;
}
}
return depth > 0 ? `${"../".repeat(depth)}${append}` : enforceRelative ? `./${append}` : append;
}
// eslint-disable-next-line jsdoc/no-restricted-syntax
/**
* @param {string | Function} value local
* @returns {string} stringified local
*/
function stringifyLocal(value) {
return typeof value === "function" ? value.toString() : JSON.stringify(value);
}
/**
* @param {string} str string
* @returns {string} string
*/
const toSimpleString = str => {
// eslint-disable-next-line no-implicit-coercion
if (`${+str}` === str) {
return str;
}
return JSON.stringify(str);
};
/**
* @param {string} str string
* @returns {string} quoted meta
*/
const quoteMeta = str => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
/**
* @param {Array<string>} items items
* @returns {string} common prefix
*/
const getCommonPrefix = items => {
let [prefix] = items;
for (let i = 1; i < items.length; i++) {
const item = items[i];
for (let prefixIndex = 0; prefixIndex < prefix.length; prefixIndex++) {
if (item[prefixIndex] !== prefix[prefixIndex]) {
prefix = prefix.slice(0, prefixIndex);
break;
}
}
}
return prefix;
};
/**
* @param {Array<string>} items items
* @returns {string} common suffix
*/
const getCommonSuffix = items => {
let [suffix] = items;
for (let i = 1; i < items.length; i++) {
const item = items[i];
for (let itemIndex = item.length - 1, suffixIndex = suffix.length - 1; suffixIndex >= 0; itemIndex--, suffixIndex--) {
if (item[itemIndex] !== suffix[suffixIndex]) {
suffix = suffix.slice(suffixIndex + 1);
break;
}
}
}
return suffix;
};
/**
* @param {Set<string>} itemsSet items set
* @param {(str: string) => string | false} getKey get key function
* @param {(str: Array<string>) => boolean} condition condition
* @returns {Array<Array<string>>} list of common items
*/
const popCommonItems = (itemsSet, getKey, condition) => {
/** @type {Map<string, Array<string>>} */
const map = new Map();
for (const item of itemsSet) {
const key = getKey(item);
if (key) {
let list = map.get(key);
if (list === undefined) {
/** @type {Array<string>} */
list = [];
map.set(key, list);
}
list.push(item);
}
}
/** @type {Array<Array<string>>} */
const result = [];
for (const list of map.values()) {
if (condition(list)) {
for (const item of list) {
itemsSet.delete(item);
}
result.push(list);
}
}
return result;
};
/**
* @param {Array<string>} itemsArr array of items
* @returns {string} regexp
*/
const itemsToRegexp = itemsArr => {
if (itemsArr.length === 1) {
return quoteMeta(itemsArr[0]);
}
/** @type {Array<string>} */
const finishedItems = [];
// merge single char items: (a|b|c|d|ef) => ([abcd]|ef)
let countOfSingleCharItems = 0;
for (const item of itemsArr) {
if (item.length === 1) {
countOfSingleCharItems++;
}
}
// special case for only single char items
if (countOfSingleCharItems === itemsArr.length) {
return `[${quoteMeta(itemsArr.sort().join(""))}]`;
}
const items = new Set(itemsArr.sort());
if (countOfSingleCharItems > 2) {
let singleCharItems = "";
for (const item of items) {
if (item.length === 1) {
singleCharItems += item;
items.delete(item);
}
}
finishedItems.push(`[${quoteMeta(singleCharItems)}]`);
}
// special case for 2 items with common prefix/suffix
if (finishedItems.length === 0 && items.size === 2) {
const prefix = getCommonPrefix(itemsArr);
const suffix = getCommonSuffix(itemsArr.map(item => item.slice(prefix.length)));
if (prefix.length > 0 || suffix.length > 0) {
return `${quoteMeta(prefix)}${itemsToRegexp(itemsArr.map(i => i.slice(prefix.length, -suffix.length || undefined)))}${quoteMeta(suffix)}`;
}
}
// special case for 2 items with common suffix
if (finishedItems.length === 0 && items.size === 2) {
/** @type {Iterator<string>} */
const it = items[Symbol.iterator]();
const a = it.next().value;
const b = it.next().value;
if (a.length > 0 && b.length > 0 && a.slice(-1) === b.slice(-1)) {
return `${itemsToRegexp([a.slice(0, -1), b.slice(0, -1)])}${quoteMeta(a.slice(-1))}`;
}
}
// find common prefix: (a1|a2|a3|a4|b5) => (a(1|2|3|4)|b5)
const prefixed = popCommonItems(items, item => item.length >= 1 ? item[0] : false, list => {
if (list.length >= 3) return true;
if (list.length <= 1) return false;
return list[0][1] === list[1][1];
});
for (const prefixedItems of prefixed) {
const prefix = getCommonPrefix(prefixedItems);
finishedItems.push(`${quoteMeta(prefix)}${itemsToRegexp(prefixedItems.map(i => i.slice(prefix.length)))}`);
}
// find common suffix: (a1|b1|c1|d1|e2) => ((a|b|c|d)1|e2)
const suffixed = popCommonItems(items, item => item.length >= 1 ? item.slice(-1) : false, list => {
if (list.length >= 3) return true;
if (list.length <= 1) return false;
return list[0].slice(-2) === list[1].slice(-2);
});
for (const suffixedItems of suffixed) {
const suffix = getCommonSuffix(suffixedItems);
finishedItems.push(`${itemsToRegexp(suffixedItems.map(i => i.slice(0, -suffix.length)))}${quoteMeta(suffix)}`);
}
// TODO further optimize regexp, i. e.
// use ranges: (1|2|3|4|a) => [1-4a]
const conditional = [...finishedItems, ...Array.from(items, quoteMeta)];
if (conditional.length === 1) return conditional[0];
return `(${conditional.join("|")})`;
};
/**
* @param {string[]} positiveItems positive items
* @param {string[]} negativeItems negative items
* @returns {(val: string) => string} a template function to determine the value at runtime
*/
const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => {
if (positiveItems.length === 0) {
return () => "false";
}
if (negativeItems.length === 0) {
return () => "true";
}
if (positiveItems.length === 1) {
return value => `${toSimpleString(positiveItems[0])} == ${value}`;
}
if (negativeItems.length === 1) {
return value => `${toSimpleString(negativeItems[0])} != ${value}`;
}
const positiveRegexp = itemsToRegexp(positiveItems);
const negativeRegexp = itemsToRegexp(negativeItems);
if (positiveRegexp.length <= negativeRegexp.length) {
return value => `/^${positiveRegexp}$/.test(${value})`;
}
return value => `!/^${negativeRegexp}$/.test(${value})`;
};
// TODO simplify in the next major release and use it from webpack
/**
* @param {Record<string | number, boolean>} map value map
* @returns {boolean | ((value: string) => string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime
*/
const compileBooleanMatcher = map => {
const positiveItems = Object.keys(map).filter(i => map[i]);
const negativeItems = Object.keys(map).filter(i => !map[i]);
if (positiveItems.length === 0) {
return false;
}
if (negativeItems.length === 0) {
return true;
}
return compileBooleanMatcherFromLists(positiveItems, negativeItems);
};
module.exports = {
ABSOLUTE_PUBLIC_PATH,
AUTO_PUBLIC_PATH,
BASE_URI,
MODULE_TYPE,
SINGLE_DOT_PATH_SEGMENT,
compareModulesByIdentifier,
compileBooleanMatcher,
evalModuleCode,
findModuleById,
getUndoPath,
stringifyLocal,
stringifyRequest,
trueFn
};

110
node_modules/mini-css-extract-plugin/package.json generated vendored Normal file
View File

@@ -0,0 +1,110 @@
{
"name": "mini-css-extract-plugin",
"version": "2.9.4",
"description": "extracts CSS into separate files",
"keywords": [
"webpack",
"css",
"extract",
"hmr"
],
"homepage": "https://github.com/webpack-contrib/mini-css-extract-plugin",
"bugs": "https://github.com/webpack-contrib/mini-css-extract-plugin/issues",
"repository": "webpack-contrib/mini-css-extract-plugin",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
},
"license": "MIT",
"author": "Tobias Koppers @sokra",
"main": "dist/index.js",
"types": "types/index.d.ts",
"files": [
"dist",
"types"
],
"scripts": {
"start": "npm run build -- -w",
"prebuild": "npm run clean",
"build:types": "tsc --declaration --emitDeclarationOnly --outDir types && prettier \"types/**/*.ts\" --write",
"build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files",
"build": "npm-run-all -p \"build:**\"",
"clean": "del-cli dist",
"commitlint": "commitlint --from=master",
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different",
"lint:code": "eslint --cache .",
"lint:spelling": "cspell \"**/*.*\"",
"lint:types": "tsc --pretty --noEmit",
"lint:es-check": "es-check es5 dist/hmr/hotModuleReplacement.js",
"lint": "npm-run-all -l -p \"lint:**\"",
"fix:code": "npm run lint:code -- --fix",
"fix:prettier": "npm run lint:prettier -- --write",
"fix": "npm-run-all -l fix:code fix:prettier",
"prepare": "husky install && npm run build",
"release": "standard-version",
"security": "npm audit --production",
"test:only": "cross-env NODE_ENV=test jest",
"test:only:experimental": "EXPERIMENTAL_USE_IMPORT_MODULE=true cross-env NODE_ENV=test jest",
"test:watch": "npm run test:only -- --watch",
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
"test:manual": "npm run build && webpack serve ./test/manual/src/index.js --open --config ./test/manual/webpack.config.js",
"pretest": "npm run lint",
"test": "cross-env NODE_ENV=test npm run test:coverage"
},
"dependencies": {
"schema-utils": "^4.0.0",
"tapable": "^2.2.1"
},
"devDependencies": {
"@babel/cli": "^7.24.1",
"@babel/core": "^7.24.4",
"@babel/preset-env": "^7.24.4",
"@commitlint/cli": "^17.5.1",
"@commitlint/config-conventional": "^17.4.4",
"@eslint/js": "^9.32.0",
"@eslint/markdown": "^7.0.0",
"@stylistic/eslint-plugin": "^5.2.2",
"@types/node": "^18.15.11",
"bootstrap": "^4.6.2",
"cross-env": "^7.0.3",
"cspell": "^6.31.1",
"css-loader": "^6.10.0",
"del": "^6.0.0",
"del-cli": "^4.0.0",
"es-check": "^7.1.0",
"eslint": "^9.32.0",
"eslint-config-prettier": "^10.1.8",
"eslint-config-webpack": "^4.4.2",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jest": "^29.0.1",
"eslint-plugin-jsdoc": "^52.0.0",
"eslint-plugin-n": "^17.21.0",
"eslint-plugin-prettier": "^5.5.3",
"eslint-plugin-unicorn": "^60.0.0",
"file-loader": "^6.2.0",
"globals": "^16.3.0",
"husky": "^7.0.0",
"jest": "^28.1.3",
"jest-environment-jsdom": "^28.1.3",
"jsdom": "^19.0.0",
"lint-staged": "^13.2.1",
"memfs": "^3.4.13",
"npm-run-all": "^4.1.5",
"prettier": "^3.6.0",
"prettier-2": "npm:prettier@^2",
"sass": "^1.74.1",
"sass-loader": "^12.6.0",
"standard-version": "^9.3.0",
"typescript": "^5.8.0",
"typescript-eslint": "^8.38.0",
"webpack": "^5.91.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^5.2.1"
},
"peerDependencies": {
"webpack": "^5.0.0"
},
"engines": {
"node": ">= 12.13.0"
}
}

View File

@@ -0,0 +1,16 @@
declare namespace _exports {
export { GetScriptSrc, HotHTMLLinkElement };
}
declare function _exports(
moduleId: number | string,
options: {
filename?: string;
locals?: boolean;
},
): () => void;
export = _exports;
type GetScriptSrc = (filename?: string) => string[];
type HotHTMLLinkElement = HTMLLinkElement & {
isLoaded: boolean;
visited: boolean;
};

View File

@@ -0,0 +1,2 @@
declare function _exports(urlString: string): string;
export = _exports;

17
node_modules/mini-css-extract-plugin/types/hooks.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
export function getCompilationHooks(
compilation: Compilation,
): MiniCssExtractPluginCompilationHooks;
export type Compilation = import("webpack").Compilation;
export type VarNames = {
tag: string;
chunkId: string;
href: string;
resolve: string;
reject: string;
};
export type MiniCssExtractPluginCompilationHooks = {
beforeTagInsert: import("tapable").SyncWaterfallHook<
[string, VarNames],
string
>;
};

362
node_modules/mini-css-extract-plugin/types/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,362 @@
export = MiniCssExtractPlugin;
declare class MiniCssExtractPlugin {
/**
* @param {Compiler["webpack"]} webpack webpack
* @returns {CssModuleConstructor} CSS module constructor
*/
static getCssModule(webpack: Compiler["webpack"]): CssModuleConstructor;
/**
* @param {Compiler["webpack"]} webpack webpack
* @returns {CssDependencyConstructor} CSS dependency constructor
*/
static getCssDependency(
webpack: Compiler["webpack"],
): CssDependencyConstructor;
/**
* Returns all hooks for the given compilation
* @param {Compilation} compilation the compilation
* @returns {MiniCssExtractPluginCompilationHooks} hooks
*/
static getCompilationHooks(
compilation: Compilation,
): MiniCssExtractPluginCompilationHooks;
/**
* @param {PluginOptions=} options options
*/
constructor(options?: PluginOptions | undefined);
/**
* @private
* @type {WeakMap<Chunk, Set<CssModule>>}
*/
private _sortedModulesCache;
/**
* @private
* @type {NormalizedPluginOptions}
*/
private options;
/**
* @private
* @type {RuntimeOptions}
*/
private runtimeOptions;
/**
* @param {Compiler} compiler compiler
*/
apply(compiler: Compiler): void;
/**
* @private
* @param {Chunk} chunk chunk
* @param {ChunkGraph} chunkGraph chunk graph
* @returns {Iterable<Module>} modules
*/
private getChunkModules;
/**
* @private
* @param {Compilation} compilation compilation
* @param {Chunk} chunk chunk
* @param {CssModule[]} modules modules
* @param {Compilation["requestShortener"]} requestShortener request shortener
* @returns {Set<CssModule>} css modules
*/
private sortModules;
/**
* @private
* @param {Compiler} compiler compiler
* @param {Compilation} compilation compilation
* @param {Chunk} chunk chunk
* @param {CssModule[]} modules modules
* @param {Compiler["requestShortener"]} requestShortener request shortener
* @param {string} filenameTemplate filename template
* @param {Parameters<Exclude<Required<Configuration>['output']['filename'], string | undefined>>[0]} pathData path data
* @returns {Source} source
*/
private renderContentAsset;
}
declare namespace MiniCssExtractPlugin {
export {
pluginName,
pluginSymbol,
loader,
Schema,
Compiler,
Compilation,
ChunkGraph,
Chunk,
ChunkGroup,
Module,
Dependency,
Source,
Configuration,
WebpackError,
AssetInfo,
LoaderDependency,
Filename,
ChunkFilename,
LoaderOptions,
PluginOptions,
NormalizedPluginOptions,
RuntimeOptions,
CssModuleDependency,
CssModule,
CssModuleConstructor,
CssDependency,
CssDependencyOptions,
CssDependencyConstructor,
VarNames,
MiniCssExtractPluginCompilationHooks,
};
}
/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
/** @typedef {import("webpack").Compiler} Compiler */
/** @typedef {import("webpack").Compilation} Compilation */
/** @typedef {import("webpack").ChunkGraph} ChunkGraph */
/** @typedef {import("webpack").Chunk} Chunk */
/** @typedef {import("webpack").ChunkGroup} ChunkGroup */
/** @typedef {import("webpack").Module} Module */
/** @typedef {import("webpack").Dependency} Dependency */
/** @typedef {import("webpack").sources.Source} Source */
/** @typedef {import("webpack").Configuration} Configuration */
/** @typedef {import("webpack").WebpackError} WebpackError */
/** @typedef {import("webpack").AssetInfo} AssetInfo */
/** @typedef {import("./loader.js").Dependency} LoaderDependency */
/** @typedef {NonNullable<Required<Configuration>['output']['filename']>} Filename */
/** @typedef {NonNullable<Required<Configuration>['output']['chunkFilename']>} ChunkFilename */
/**
* @typedef {object} LoaderOptions
* @property {string | ((resourcePath: string, rootContext: string) => string)=} publicPath public path
* @property {boolean=} emit true when need to emit, otherwise false
* @property {boolean=} esModule need to generate ES module syntax
* @property {string=} layer a layer
* @property {boolean=} defaultExport true when need to use default export, otherwise false
*/
/**
* @typedef {object} PluginOptions
* @property {Filename=} filename filename
* @property {ChunkFilename=} chunkFilename chunk filename
* @property {boolean=} ignoreOrder true when need to ignore order, otherwise false
* @property {string | ((linkTag: HTMLLinkElement) => void)=} insert link insert place or a custom insert function
* @property {Record<string, string>=} attributes link attributes
* @property {string | false | 'text/css'=} linkType value of a link type attribute
* @property {boolean=} runtime true when need to generate runtime code, otherwise false
* @property {boolean=} experimentalUseImportModule true when need to use `experimentalUseImportModule` API, otherwise false
*/
/**
* @typedef {object} NormalizedPluginOptions
* @property {Filename} filename filename
* @property {ChunkFilename=} chunkFilename chunk filename
* @property {boolean} ignoreOrder true when need to ignore order, otherwise false
* @property {string | ((linkTag: HTMLLinkElement) => void)=} insert a link insert place or a custom insert function
* @property {Record<string, string>=} attributes link attributes
* @property {string | false | 'text/css'=} linkType value of a link type attribute
* @property {boolean} runtime true when need to generate runtime code, otherwise false
* @property {boolean=} experimentalUseImportModule true when need to use `experimentalUseImportModule` API, otherwise false
*/
/**
* @typedef {object} RuntimeOptions
* @property {string | ((linkTag: HTMLLinkElement) => void)=} insert a link insert place or a custom insert function
* @property {string | false | 'text/css'} linkType value of a link type attribute
* @property {Record<string, string>=} attributes link attributes
*/
declare const pluginName: "mini-css-extract-plugin";
declare const pluginSymbol: unique symbol;
declare var loader: string;
type Schema = import("schema-utils/declarations/validate").Schema;
type Compiler = import("webpack").Compiler;
type Compilation = import("webpack").Compilation;
type ChunkGraph = import("webpack").ChunkGraph;
type Chunk = import("webpack").Chunk;
type ChunkGroup = import("webpack").ChunkGroup;
type Module = import("webpack").Module;
type Dependency = import("webpack").Dependency;
type Source = import("webpack").sources.Source;
type Configuration = import("webpack").Configuration;
type WebpackError = import("webpack").WebpackError;
type AssetInfo = import("webpack").AssetInfo;
type LoaderDependency = import("./loader.js").Dependency;
type Filename = NonNullable<Required<Configuration>["output"]["filename"]>;
type ChunkFilename = NonNullable<
Required<Configuration>["output"]["chunkFilename"]
>;
type LoaderOptions = {
/**
* public path
*/
publicPath?:
| (string | ((resourcePath: string, rootContext: string) => string))
| undefined;
/**
* true when need to emit, otherwise false
*/
emit?: boolean | undefined;
/**
* need to generate ES module syntax
*/
esModule?: boolean | undefined;
/**
* a layer
*/
layer?: string | undefined;
/**
* true when need to use default export, otherwise false
*/
defaultExport?: boolean | undefined;
};
type PluginOptions = {
/**
* filename
*/
filename?: Filename | undefined;
/**
* chunk filename
*/
chunkFilename?: ChunkFilename | undefined;
/**
* true when need to ignore order, otherwise false
*/
ignoreOrder?: boolean | undefined;
/**
* link insert place or a custom insert function
*/
insert?: (string | ((linkTag: HTMLLinkElement) => void)) | undefined;
/**
* link attributes
*/
attributes?: Record<string, string> | undefined;
/**
* value of a link type attribute
*/
linkType?: (string | false | "text/css") | undefined;
/**
* true when need to generate runtime code, otherwise false
*/
runtime?: boolean | undefined;
/**
* true when need to use `experimentalUseImportModule` API, otherwise false
*/
experimentalUseImportModule?: boolean | undefined;
};
type NormalizedPluginOptions = {
/**
* filename
*/
filename: Filename;
/**
* chunk filename
*/
chunkFilename?: ChunkFilename | undefined;
/**
* true when need to ignore order, otherwise false
*/
ignoreOrder: boolean;
/**
* a link insert place or a custom insert function
*/
insert?: (string | ((linkTag: HTMLLinkElement) => void)) | undefined;
/**
* link attributes
*/
attributes?: Record<string, string> | undefined;
/**
* value of a link type attribute
*/
linkType?: (string | false | "text/css") | undefined;
/**
* true when need to generate runtime code, otherwise false
*/
runtime: boolean;
/**
* true when need to use `experimentalUseImportModule` API, otherwise false
*/
experimentalUseImportModule?: boolean | undefined;
};
type RuntimeOptions = {
/**
* a link insert place or a custom insert function
*/
insert?: (string | ((linkTag: HTMLLinkElement) => void)) | undefined;
/**
* value of a link type attribute
*/
linkType: string | false | "text/css";
/**
* link attributes
*/
attributes?: Record<string, string> | undefined;
};
type CssModuleDependency = {
context: string | null;
identifier: string;
identifierIndex: number;
content: Buffer;
sourceMap?: Buffer;
media?: string;
supports?: string;
layer?: any;
assetsInfo?: Map<string, AssetInfo>;
assets?: {
[key: string]: Source;
};
};
type CssModule = Module & {
content: Buffer;
media?: string;
sourceMap?: Buffer;
supports?: string;
layer?: string;
assets?: {
[key: string]: Source;
};
assetsInfo?: Map<string, AssetInfo>;
};
type CssModuleConstructor = {
new (dependency: CssModuleDependency): CssModule;
};
type CssDependency = Dependency & CssModuleDependency;
type CssDependencyOptions = Omit<LoaderDependency, "context">;
type CssDependencyConstructor = {
new (
loaderDependency: CssDependencyOptions,
context: string | null,
identifierIndex: number,
): CssDependency;
};
type VarNames = {
/**
* tag
*/
tag: string;
/**
* chunk id
*/
chunkId: string;
/**
* href
*/
href: string;
/**
* resolve
*/
resolve: string;
/**
* reject
*/
reject: string;
};
type MiniCssExtractPluginCompilationHooks = {
/**
* before tag insert hook
*/
beforeTagInsert: import("tapable").SyncWaterfallHook<
[string, VarNames],
string
>;
/**
* link preload hook
*/
linkPreload: SyncWaterfallHook<[string, Chunk]>;
/**
* link prefetch hook
*/
linkPrefetch: SyncWaterfallHook<[string, Chunk]>;
};
import { SyncWaterfallHook } from "tapable";

114
node_modules/mini-css-extract-plugin/types/loader.d.ts generated vendored Normal file
View File

@@ -0,0 +1,114 @@
export = loader;
/**
* @this {import("webpack").LoaderContext<LoaderOptions>}
* @param {string} content content
* @returns {string | undefined} the original content
*/
declare function loader(
this: import("webpack").LoaderContext<MiniCssExtractPlugin.LoaderOptions>,
content: string,
): string | undefined;
declare namespace loader {
export {
hotLoader,
pitch,
Schema,
Compiler,
Compilation,
Chunk,
Module,
Source,
AssetInfo,
NormalModule,
LoaderOptions,
Locals,
EXPECTED_ANY,
Dependency,
};
}
import MiniCssExtractPlugin = require("./index");
/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
/** @typedef {import("webpack").Compiler} Compiler */
/** @typedef {import("webpack").Compilation} Compilation */
/** @typedef {import("webpack").Chunk} Chunk */
/** @typedef {import("webpack").Module} Module */
/** @typedef {import("webpack").sources.Source} Source */
/** @typedef {import("webpack").AssetInfo} AssetInfo */
/** @typedef {import("webpack").NormalModule} NormalModule */
/** @typedef {import("./index.js").LoaderOptions} LoaderOptions */
/** @typedef {{[key: string]: string | Function }} Locals */
/** @typedef {any} EXPECTED_ANY */
/**
* @typedef {object} Dependency
* @property {string} identifier identifier
* @property {string | null} context context
* @property {Buffer} content content
* @property {string=} media media
* @property {string=} supports supports
* @property {string=} layer layer
* @property {Buffer=} sourceMap source map
*/
/**
* @param {string} code code
* @param {{ loaderContext: import("webpack").LoaderContext<LoaderOptions>, options: LoaderOptions, locals: Locals | undefined }} context context
* @returns {string} code and HMR code
*/
declare function hotLoader(
code: string,
context: {
loaderContext: import("webpack").LoaderContext<LoaderOptions>;
options: LoaderOptions;
locals: Locals | undefined;
},
): string;
/**
* @this {import("webpack").LoaderContext<LoaderOptions>}
* @param {string} request request
*/
declare function pitch(
this: import("webpack").LoaderContext<MiniCssExtractPlugin.LoaderOptions>,
request: string,
): void;
type Schema = import("schema-utils/declarations/validate").Schema;
type Compiler = import("webpack").Compiler;
type Compilation = import("webpack").Compilation;
type Chunk = import("webpack").Chunk;
type Module = import("webpack").Module;
type Source = import("webpack").sources.Source;
type AssetInfo = import("webpack").AssetInfo;
type NormalModule = import("webpack").NormalModule;
type LoaderOptions = import("./index.js").LoaderOptions;
type Locals = {
[key: string]: string | Function;
};
type EXPECTED_ANY = any;
type Dependency = {
/**
* identifier
*/
identifier: string;
/**
* context
*/
context: string | null;
/**
* content
*/
content: Buffer;
/**
* media
*/
media?: string | undefined;
/**
* supports
*/
supports?: string | undefined;
/**
* layer
*/
layer?: string | undefined;
/**
* source map
*/
sourceMap?: Buffer | undefined;
};

73
node_modules/mini-css-extract-plugin/types/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,73 @@
export type Compilation = import("webpack").Compilation;
export type Module = import("webpack").Module;
export type LoaderContext = import("webpack").LoaderContext<any>;
export const ABSOLUTE_PUBLIC_PATH: "webpack:///mini-css-extract-plugin/";
export const AUTO_PUBLIC_PATH: "__mini_css_extract_plugin_public_path_auto__";
export const BASE_URI: "webpack://";
export const MODULE_TYPE: "css/mini-extract";
export const SINGLE_DOT_PATH_SEGMENT: "__mini_css_extract_plugin_single_dot_path_segment__";
/**
* @param {Module} a a
* @param {Module} b b
* @returns {0 | 1 | -1} result of comparing
*/
export function compareModulesByIdentifier(a: Module, b: Module): 0 | 1 | -1;
/**
* @param {Record<string | number, boolean>} map value map
* @returns {boolean | ((value: string) => string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime
*/
export function compileBooleanMatcher(
map: Record<string | number, boolean>,
): boolean | ((value: string) => string);
/**
* @param {LoaderContext} loaderContext loader context
* @param {string | Buffer} code code
* @param {string} filename filename
* @returns {Record<string, any>} exports of a module
*/
export function evalModuleCode(
loaderContext: LoaderContext,
code: string | Buffer,
filename: string,
): Record<string, any>;
/**
* @param {Compilation} compilation compilation
* @param {string | number} id module id
* @returns {null | Module} the found module
*/
export function findModuleById(
compilation: Compilation,
id: string | number,
): null | Module;
/**
* @param {string} filename filename
* @param {string} outputPath output path
* @param {boolean} enforceRelative true when need to enforce relative path, otherwise false
* @returns {string} undo path
*/
export function getUndoPath(
filename: string,
outputPath: string,
enforceRelative: boolean,
): string;
/**
* @param {string | Function} value local
* @returns {string} stringified local
*/
export function stringifyLocal(value: string | Function): string;
/**
* @param {LoaderContext} loaderContext the loader context
* @param {string} request a request
* @returns {string} a stringified request
*/
export function stringifyRequest(
loaderContext: LoaderContext,
request: string,
): string;
/** @typedef {import("webpack").Compilation} Compilation */
/** @typedef {import("webpack").Module} Module */
/** @typedef {import("webpack").LoaderContext<any>} LoaderContext */
/**
* @returns {boolean} always returns true
*/
export function trueFn(): boolean;