MCPcopy
hub / github.com/webpack/webpack / processDependency

Method processDependency

lib/Compilation.js:1891–2020  ·  view source on GitHub ↗
(dep, index)

Source from the content-addressed store, hash-verified

1889 * @returns {void}
1890 */
1891 const processDependency = (dep, index) => {
1892 this.moduleGraph.setParents(dep, currentBlock, module, index);
1893 if (
1894 hasLazyBarrel &&
1895 // TODO remove in webpack 6
1896 // It may be missing on custom dependency types not extending the base Dependency
1897 "isLazy" in dep &&
1898 dep.isLazy()
1899 ) {
1900 return;
1901 }
1902
1903 if (this._unsafeCache) {
1904 try {
1905 const unsafeCachedModule = unsafeCacheDependencies.get(dep);
1906 if (unsafeCachedModule === null) return;
1907 if (unsafeCachedModule !== undefined) {
1908 if (
1909 this._restoredUnsafeCacheModuleEntries.has(unsafeCachedModule)
1910 ) {
1911 this._handleExistingModuleFromUnsafeCache(
1912 module,
1913 dep,
1914 unsafeCachedModule
1915 );
1916 this._lazyBarrelController.unlazyForDependency(
1917 unsafeCachedModule,
1918 dep,
1919 sortedDependencies
1920 );
1921 return;
1922 }
1923 const identifier = unsafeCachedModule.identifier();
1924 const cachedModule =
1925 this._restoredUnsafeCacheEntries.get(identifier);
1926 if (cachedModule !== undefined) {
1927 // update unsafe cache to new module
1928 unsafeCacheDependencies.set(dep, cachedModule);
1929 this._handleExistingModuleFromUnsafeCache(
1930 module,
1931 dep,
1932 cachedModule
1933 );
1934 this._lazyBarrelController.unlazyForDependency(
1935 cachedModule,
1936 dep,
1937 sortedDependencies
1938 );
1939 return;
1940 }
1941 inProgressSorting++;
1942 this._modulesCache.get(identifier, null, (err, cachedModule) => {
1943 if (err) {
1944 if (inProgressSorting <= 0) return;
1945 inProgressSorting = -1;
1946 onDependenciesSorted(/** @type {WebpackError} */ (err));
1947 return;
1948 }

Callers

nothing calls this directly

Calls 12

setParentsMethod · 0.80
unlazyForDependencyMethod · 0.80
isLazyMethod · 0.45
getMethod · 0.45
hasMethod · 0.45
identifierMethod · 0.45
setMethod · 0.45
addMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected