| 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. |