MCPcopy
hub / github.com/webpack/webpack / handleBuildDone

Method handleBuildDone

lib/NormalModule.js:1848–1941  ·  lib/NormalModule.js::NormalModule.handleBuildDone
()

Source from the content-addressed store, hash-verified

1846 };
1847
1848 const handleBuildDone = () => {
1849 try {
1850 hooks.beforeSnapshot.call(this);
1851 } catch (err) {
1852 this.markModuleAsErrored(/** @type {Error} */ (err));
1853 return callback();
1854 }
1855
1856 const snapshotOptions = compilation.options.snapshot.module;
1857 const { cacheable } = /** @type {NormalModuleBuildInfo} */ (
1858 this.buildInfo
1859 );
1860 if (!cacheable || !snapshotOptions) {
1861 return callback();
1862 }
1863 class="cm">// add warning for all non-absolute paths in fileDependencies, etc
1864 class="cm">// This makes it easier to find problems with watching and/or caching
1865 /** @type {undefined | Set<string>} */
1866 let nonAbsoluteDependencies;
1867 /**
1868 * @param {FileSystemDependencies} deps deps
1869 */
1870 const checkDependencies = (deps) => {
1871 for (const dep of deps) {
1872 if (!ABSOLUTE_PATH_REGEXP.test(dep)) {
1873 if (nonAbsoluteDependencies === undefined) {
1874 nonAbsoluteDependencies = new Set();
1875 }
1876 nonAbsoluteDependencies.add(dep);
1877 deps.delete(dep);
1878 try {
1879 const depWithoutGlob = dep.replace(/[\\/]?\*.*$/, class="st">"");
1880 const absolute = join(
1881 compilation.fileSystemInfo.fs,
1882 /** @type {string} */
1883 (this.context),
1884 depWithoutGlob
1885 );
1886 if (absolute !== dep && ABSOLUTE_PATH_REGEXP.test(absolute)) {
1887 (depWithoutGlob !== dep
1888 ? /** @type {NonNullable<KnownNormalModuleBuildInfo[class="st">"contextDependencies"]>} */
1889 (
1890 /** @type {NormalModuleBuildInfo} */
1891 (this.buildInfo).contextDependencies
1892 )
1893 : deps
1894 ).add(absolute);
1895 }
1896 } catch (_err) {
1897 class="cm">// ignore
1898 }
1899 }
1900 }
1901 };
1902 const buildInfo = /** @type {NormalModuleBuildInfo} */ (this.buildInfo);
1903 const fileDependencies =
1904 /** @type {NonNullable<KnownNormalModuleBuildInfo[class="st">"fileDependencies"]>} */
1905 (buildInfo.fileDependencies);

Callers

nothing calls this directly

Calls 5

markModuleAsErroredMethod · 0.95
createSnapshotMethod · 0.80
callbackFunction · 0.50
callMethod · 0.45
addWarningMethod · 0.45

Tested by

no test coverage detected