MCPcopy
hub / github.com/webpack/webpack / libIdent

Method libIdent

lib/ContextModule.js:379–435  ·  view source on GitHub ↗

* Gets the library identifier. * @param {LibIdentOptions} options options * @returns {LibIdent | null} an identifier for library inclusion

(options)

Source from the content-addressed store, hash-verified

377 * @returns {LibIdent | null} an identifier for library inclusion
378 */
379 libIdent(options) {
380 /** @type {string} */
381 let identifier;
382
383 if (this.context) {
384 identifier = contextify(
385 options.context,
386 this.context,
387 options.associatedObjectForCache
388 );
389 } else if (typeof this.options.resource === "string") {
390 identifier = contextify(
391 options.context,
392 this.options.resource,
393 options.associatedObjectForCache
394 );
395 } else if (this.options.resource === false) {
396 identifier = "false";
397 } else {
398 identifier = this.options.resource
399 .map((res) =>
400 contextify(options.context, res, options.associatedObjectForCache)
401 )
402 .join(" ");
403 }
404
405 if (this.layer) identifier = `(${this.layer})/${identifier}`;
406 if (this.options.mode) {
407 identifier += ` ${this.options.mode}`;
408 }
409 if (this.options.recursive) {
410 identifier += " recursive";
411 }
412 if (this.options.addon) {
413 identifier += ` ${contextify(
414 options.context,
415 this.options.addon,
416 options.associatedObjectForCache
417 )}`;
418 }
419 if (this.options.regExp) {
420 identifier += ` ${this._prettyRegExp(this.options.regExp)}`;
421 }
422 if (this.options.include) {
423 identifier += ` include: ${this._prettyRegExp(this.options.include)}`;
424 }
425 if (this.options.exclude) {
426 identifier += ` exclude: ${this._prettyRegExp(this.options.exclude)}`;
427 }
428 if (this.options.referencedExports) {
429 identifier += ` referencedExports: ${this.options.referencedExports
430 .map((e) => e.join("."))
431 .join(", ")}`;
432 }
433
434 return identifier;
435 }
436

Callers

nothing calls this directly

Calls 1

_prettyRegExpMethod · 0.95

Tested by

no test coverage detected