MCPcopy
hub / github.com/webpack/webpack / walkDefinitionsForValues

Method walkDefinitionsForValues

lib/DefinePlugin.js:868–892  ·  view source on GitHub ↗
(definitions, prefix)

Source from the content-addressed store, hash-verified

866 * @returns {void}
867 */
868 const walkDefinitionsForValues = (definitions, prefix) => {
869 for (const key of Object.keys(definitions)) {
870 const code = definitions[key];
871 const version = /** @type {string} */ (toCacheVersion(code));
872 const name = VALUE_DEP_PREFIX + prefix + key;
873 mainHash.update(`|${prefix}${key}`);
874 const oldVersion = compilation.valueCacheVersions.get(name);
875 if (oldVersion === undefined) {
876 compilation.valueCacheVersions.set(name, version);
877 } else if (oldVersion !== version) {
878 const warning = new WebpackError(
879 `${PLUGIN_NAME}\nConflicting values for '${prefix + key}'`
880 );
881 warning.details = `'${oldVersion}' !== '${version}'`;
882 warning.hideStack = true;
883 compilation.warnings.push(warning);
884 }
885 if (isObjectDefinition(code)) {
886 walkDefinitionsForValues(
887 /** @type {Definitions} */ (code),
888 `${prefix + key}.`
889 );
890 }
891 }
892 };
893
894 /**
895 * Walk definitions for keys.

Callers

nothing calls this directly

Calls 7

toCacheVersionFunction · 0.85
isObjectDefinitionFunction · 0.85
keysMethod · 0.65
updateMethod · 0.45
getMethod · 0.45
setMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected