MCPcopy
hub / github.com/webpack/webpack / readableIdentifier

Method readableIdentifier

lib/ContextModule.js:312–372  ·  lib/ContextModule.js::ContextModule.readableIdentifier

* Returns a human-readable identifier for this module. * @param {RequestShortener} requestShortener the request shortener * @returns {string} a user readable identifier of the module

(requestShortener)

Source from the content-addressed store, hash-verified

310 * @returns {string} a user readable identifier of the module
311 */
312 readableIdentifier(requestShortener) {
313 /** @type {string} */
314 let identifier;
315
316 if (this.context) {
317 identifier = `${requestShortener.shorten(this.context)}/`;
318 } else if (
319 typeof this.options.resource === class="st">"string" ||
320 this.options.resource === false
321 ) {
322 identifier = `${requestShortener.shorten(`${this.options.resource}`)}/`;
323 } else {
324 identifier = this.options.resource
325 .map((r) => `${requestShortener.shorten(r)}/`)
326 .join(class="st">" ");
327 }
328 if (this.options.resourceQuery) {
329 identifier += ` ${this.options.resourceQuery}`;
330 }
331 if (this.options.mode) {
332 identifier += ` ${this.options.mode}`;
333 }
334 if (!this.options.recursive) {
335 identifier += class="st">" nonrecursive";
336 }
337 if (this.options.addon) {
338 identifier += ` ${requestShortener.shorten(this.options.addon)}`;
339 }
340 if (this.options.regExp) {
341 identifier += ` ${this._prettyRegExp(this.options.regExp)}`;
342 }
343 if (this.options.include) {
344 identifier += ` include: ${this._prettyRegExp(this.options.include)}`;
345 }
346 if (this.options.exclude) {
347 identifier += ` exclude: ${this._prettyRegExp(this.options.exclude)}`;
348 }
349 if (this.options.referencedExports) {
350 identifier += ` referencedExports: ${this.options.referencedExports
351 .map((e) => e.join(class="st">"."))
352 .join(class="st">", ")}`;
353 }
354 if (this.options.chunkName) {
355 identifier += ` chunkName: ${this.options.chunkName}`;
356 }
357 if (this.options.groupOptions) {
358 const groupOptions = this.options.groupOptions;
359 for (const key of Object.keys(groupOptions)) {
360 identifier += ` ${key}: ${
361 groupOptions[/** @type {keyof RawChunkGroupOptions} */ (key)]
362 }`;
363 }
364 }
365 if (this.options.namespaceObject === class="st">"strict") {
366 identifier += class="st">" strict namespace object";
367 } else if (this.options.namespaceObject) {
368 identifier += class="st">" namespace object";
369 }

Callers

nothing calls this directly

Calls 3

_prettyRegExpMethod · 0.95
shortenMethod · 0.80
keysMethod · 0.65

Tested by

no test coverage detected