MCPcopy
hub / github.com/webpack/webpack / getModuleName

Function getModuleName

lib/stats/DefaultStatsPrinterPlugin.js:85–103  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

83 * @returns {[string, string]} prefix and module name
84 */
85const getModuleName = (name) => {
86 const [, prefix, resource] =
87 /** @type {[string, string, string]} */
88 (/** @type {unknown} */ (/^(.*!)?([^!]*)$/.exec(name)));
89
90 if (resource.length > MAX_MODULE_IDENTIFIER_LENGTH) {
91 const truncatedResource = `${resource.slice(
92 0,
93 Math.min(
94 resource.length - /* '...(truncated)'.length */ 14,
95 MAX_MODULE_IDENTIFIER_LENGTH
96 )
97 )}...(truncated)`;
98
99 return [prefix, getResourceName(truncatedResource)];
100 }
101
102 return [prefix, getResourceName(resource)];
103};
104
105/**
106 * Returns joined string.

Callers 1

Calls 3

getResourceNameFunction · 0.85
execMethod · 0.80
sliceMethod · 0.80

Tested by

no test coverage detected