MCPcopy
hub / github.com/webpack/webpack / comment

Method comment

lib/RuntimeTemplate.js:519–538  ·  view source on GitHub ↗

* Returns comment. * @param {object} options Information content of the comment * @param {string=} options.request request string used originally * @param {(string | null)=} options.chunkName name of the chunk referenced * @param {string=} options.chunkReason reason information of the chunk

({ request, chunkName, chunkReason, message, exportName })

Source from the content-addressed store, hash-verified

517 * @returns {string} comment
518 */
519 comment({ request, chunkName, chunkReason, message, exportName }) {
520 /** @type {string} */
521 let content;
522 if (this.outputOptions.pathinfo) {
523 content = [message, request, chunkName, chunkReason]
524 .filter(Boolean)
525 .map((item) => this.requestShortener.shorten(item))
526 .join(" | ");
527 } else {
528 content = [message, chunkName, chunkReason]
529 .filter(Boolean)
530 .map((item) => this.requestShortener.shorten(item))
531 .join(" | ");
532 }
533 if (!content) return "";
534 if (this.outputOptions.pathinfo) {
535 return `${Template.toComment(content)} `;
536 }
537 return `${Template.toNormalComment(content)} `;
538 }
539
540 /**
541 * Throw missing module error block.

Callers 3

moduleIdMethod · 0.95
blockPromiseMethod · 0.95

Calls 3

shortenMethod · 0.80
toCommentMethod · 0.80
toNormalCommentMethod · 0.80

Tested by

no test coverage detected