MCPcopy
hub / github.com/webpack/webpack / doWrite

Method doWrite

lib/Compiler.js:899–927  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

897 * @returns {void}
898 */
899 const doWrite = (content) => {
900 /** @type {OutputFileSystem} */
901 (this.outputFileSystem).writeFile(targetPath, content, (err) => {
902 if (err) return callback(err);
903
904 // information marker that the asset has been emitted
905 compilation.emittedAssets.add(file);
906
907 // cache the information that the Source has been written to that location
908 const newGeneration =
909 targetFileGeneration === undefined
910 ? 1
911 : targetFileGeneration + 1;
912 /** @type {CacheEntry} */
913 (cacheEntry).writtenTo.set(targetPath, newGeneration);
914 this._assetEmittingWrittenFiles.set(targetPath, newGeneration);
915 this.hooks.assetEmitted.callAsync(
916 file,
917 {
918 content,
919 source,
920 outputPath,
921 compilation,
922 targetPath
923 },
924 callback
925 );
926 });
927 };
928
929 /**
930 * Updates with replacement source.

Callers

nothing calls this directly

Calls 4

callbackFunction · 0.50
writeFileMethod · 0.45
addMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected