WXL
4 天以前 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7
node_modules/webpack/lib/ModuleFilenameHelpers.js
@@ -15,7 +15,8 @@
/** @typedef {import("./Module")} Module */
/** @typedef {import("./RequestShortener")} RequestShortener */
/** @typedef {string | RegExp | ((str: string) => boolean) | (string | RegExp | ((str: string) => boolean))[]} Matcher */
/** @typedef {(str: string) => boolean} MatcherFn */
/** @typedef {string | RegExp | MatcherFn | (string | RegExp | MatcherFn)[]} Matcher */
/** @typedef {{ test?: Matcher, include?: Matcher, exclude?: Matcher }} MatchObject */
const ModuleFilenameHelpers = module.exports;
@@ -89,6 +90,7 @@
   };
/**
 * Returns the lazy access object.
 * @template T
 * Returns a lazy object. The object is lazy in the sense that the properties are
 * only evaluated when they are accessed. This is only obtained by setting a function as the value for each key.
@@ -115,8 +117,9 @@
   return newObj;
};
const SQUARE_BRACKET_TAG_REGEXP = /\[\\*([\w-]+)\\*\]/gi;
const SQUARE_BRACKET_TAG_REGEXP = /\[\\*([\w-]+)\\*\]/g;
/**
 * Defines the module filename template context type used by this module.
 * @typedef {object} ModuleFilenameTemplateContext
 * @property {string} identifier the identifier of the module
 * @property {string} shortIdentifier the shortened identifier of the module
@@ -134,6 +137,7 @@
/** @typedef {string | ModuleFilenameTemplateFunction} ModuleFilenameTemplate */
/**
 * Returns the filename.
 * @param {Module | string} module the module
 * @param {{ namespace?: string, moduleFilenameTemplate?: ModuleFilenameTemplate }} options options
 * @param {{ requestShortener: RequestShortener, chunkGraph: ChunkGraph, hashFunction?: HashFunction }} contextInfo context info
@@ -157,6 +161,7 @@
   /** @type {ReturnStringCallback} */
   let absoluteResourcePath;
   /** @type {ReturnStringCallback} */
   let hash;
   /** @type {ReturnStringCallback} */
   let identifier;
@@ -281,7 +286,7 @@
 * @template T
 * @param {T[]} array the array with duplicates to be replaced
 * @param {(duplicateItem: T, duplicateItemIndex: number, numberOfTimesReplaced: number) => T} fn callback function to generate new values for the duplicate items
 * @param {(firstElement:T, nextElement:T) => -1 | 0 | 1=} comparator optional comparator function to sort the duplicate items
 * @param {(firstElement: T, nextElement: T) => -1 | 0 | 1=} comparator optional comparator function to sort the duplicate items
 * @returns {T[]} the array with duplicates replaced
 * @example
 * ```js