MCPcopy
hub / github.com/webpack/webpack / matchModuleReference

Method matchModuleReference

lib/ConcatenationScope.js:188–205  ·  view source on GitHub ↗

* Parses an encoded module reference back into its module index and * reference flags. * @param {string} name the identifier * @returns {ModuleReferenceOptions & { index: number } | null} parsed options and index

(name)

Source from the content-addressed store, hash-verified

186 * @returns {ModuleReferenceOptions & { index: number } | null} parsed options and index
187 */
188 static matchModuleReference(name) {
189 const match = MODULE_REFERENCE_REGEXP.exec(name);
190 if (!match) return null;
191 const index = Number(match[1]);
192 const asiSafe = match[7];
193 return {
194 index,
195 ids:
196 match[2] === "ns"
197 ? []
198 : JSON.parse(Buffer.from(match[2], "hex").toString("utf8")),
199 call: Boolean(match[3]),
200 directImport: Boolean(match[4]),
201 deferredImport: Boolean(match[5]),
202 mangleableNamespace: Boolean(match[6]),
203 asiSafe: asiSafe ? asiSafe === "1" : undefined
204 };
205 }
206}
207
208ConcatenationScope.DEFAULT_EXPORT = DEFAULT_EXPORT;

Callers 1

codeGenerationMethod · 0.80

Calls 3

execMethod · 0.80
parseMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected