MCPcopy
hub / github.com/webpack/webpack / _createIdentifier

Method _createIdentifier

lib/optimize/ConcatenatedModule.js:1351–1370  ·  view source on GitHub ↗

* @param {Module} rootModule the root module of the concatenation * @param {Set<Module>} modules all modules in the concatenation (including the root module) * @param {AssociatedObjectForCache=} associatedObjectForCache object for caching * @param {HashFunction=} hashFunction hash function to

(
		rootModule,
		modules,
		associatedObjectForCache,
		hashFunction = DEFAULTS.HASH_FUNCTION
	)

Source from the content-addressed store, hash-verified

1349 * @returns {string} the identifier
1350 */
1351 static _createIdentifier(
1352 rootModule,
1353 modules,
1354 associatedObjectForCache,
1355 hashFunction = DEFAULTS.HASH_FUNCTION
1356 ) {
1357 const cachedMakePathsRelative = makePathsRelative.bindContextCache(
1358 /** @type {string} */ (rootModule.context),
1359 associatedObjectForCache
1360 );
1361 /** @type {string[]} */
1362 const identifiers = [];
1363 for (const module of modules) {
1364 identifiers.push(cachedMakePathsRelative(module.identifier()));
1365 }
1366 identifiers.sort();
1367 const hash = createHash(hashFunction);
1368 hash.update(identifiers.join(" "));
1369 return `${rootModule.identifier()}|${hash.digest("hex")}`;
1370 }
1371
1372 /**
1373 * Adds the provided file dependencies to the module.

Callers 1

createMethod · 0.45

Calls 6

createHashFunction · 0.85
sortMethod · 0.80
pushMethod · 0.45
identifierMethod · 0.45
updateMethod · 0.45
digestMethod · 0.45

Tested by

no test coverage detected