MCPcopy
hub / github.com/webpack/webpack / getResourceName

Function getResourceName

lib/stats/DefaultStatsPrinterPlugin.js:67–78  ·  view source on GitHub ↗
(resource)

Source from the content-addressed store, hash-verified

65 * @returns {string} resource name for display
66 */
67const getResourceName = (resource) => {
68 if (!resource) return "";
69 const dataUrl = /^data:[^,]+,/.exec(resource);
70 if (!dataUrl) return resource;
71
72 const len = dataUrl[0].length + DATA_URI_CONTENT_LENGTH;
73 if (resource.length < len) return resource;
74 return `${resource.slice(
75 0,
76 Math.min(resource.length - /* '..'.length */ 2, len)
77 )}..`;
78};
79
80/**
81 * Returns prefix and module name.

Callers 2

getModuleNameFunction · 0.85

Calls 2

execMethod · 0.80
sliceMethod · 0.80

Tested by

no test coverage detected