| | |
| | | /** @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; |
| | |
| | | }; |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | 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 |
| | |
| | | /** @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 |
| | |
| | | |
| | | /** @type {ReturnStringCallback} */ |
| | | let absoluteResourcePath; |
| | | /** @type {ReturnStringCallback} */ |
| | | let hash; |
| | | /** @type {ReturnStringCallback} */ |
| | | let identifier; |
| | |
| | | * @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 |