MCPcopy
hub / github.com/webpack/webpack / getModuleGraphForModule

Method getModuleGraphForModule

lib/ModuleGraph.js:1034–1059  ·  view source on GitHub ↗

* Gets module graph for module. * @deprecated * @param {Module} module the module * @param {string} deprecateMessage message for the deprecation message * @param {string} deprecationCode code for the deprecation * @returns {ModuleGraph} the module graph

(module, deprecateMessage, deprecationCode)

Source from the content-addressed store, hash-verified

1032 * @returns {ModuleGraph} the module graph
1033 */
1034 static getModuleGraphForModule(module, deprecateMessage, deprecationCode) {
1035 const fn = deprecateMap.get(deprecateMessage);
1036 if (fn) return fn(module);
1037 const newFn = util.deprecate(
1038 /**
1039 * Handles the callback logic for this hook.
1040 * @param {Module} module the module
1041 * @returns {ModuleGraph} the module graph
1042 */
1043 (module) => {
1044 const moduleGraph = moduleGraphForModuleMap.get(module);
1045 if (!moduleGraph) {
1046 throw new Error(
1047 `${
1048 deprecateMessage
1049 }There was no ModuleGraph assigned to the Module for backward-compat (Use the new API)`
1050 );
1051 }
1052 return moduleGraph;
1053 },
1054 `${deprecateMessage}: Use new ModuleGraph API`,
1055 deprecationCode
1056 );
1057 deprecateMap.set(deprecateMessage, newFn);
1058 return newFn(module);
1059 }
1060
1061 // TODO remove in webpack 6
1062 /**

Callers 9

profileMethod · 0.80
indexMethod · 0.80
index2Method · 0.80
depthMethod · 0.80
issuerMethod · 0.80
usedExportsMethod · 0.80
optimizationBailoutMethod · 0.80
optionalMethod · 0.80
isProvidedMethod · 0.80

Calls 4

newFnFunction · 0.85
fnFunction · 0.50
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected