MCPcopy
hub / github.com/webpack/webpack / computePublicPathPlaceholderPlan

Function computePublicPathPlaceholderPlan

lib/css/CssModulesPlugin.js:141–158  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

139 * @returns {PublicPathPlaceholderPlan} placeholder offsets
140 */
141const computePublicPathPlaceholderPlan = (content) => {
142 /** @type {number[]} */
143 const autos = [];
144 const autoLen = PUBLIC_PATH_AUTO.length;
145 for (
146 let idx = content.indexOf(PUBLIC_PATH_AUTO);
147 idx !== -1;
148 idx = content.indexOf(PUBLIC_PATH_AUTO, idx + autoLen)
149 ) {
150 autos.push(idx);
151 }
152 /** @type {{ start: number, end: number, length: number }[]} */
153 const hashes = [];
154 walkFullHashPlaceholders(content, (start, end, length) => {
155 hashes.push({ start, end, length });
156 });
157 return { autos, hashes };
158};
159
160/**
161 * Returns ], definitions: import("../../schemas/WebpackOptions.json")["definitions"] }} schema.

Callers 1

renderModuleMethod · 0.85

Calls 2

walkFullHashPlaceholdersFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected