feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -10,6 +10,7 @@ const { getUsedModuleIdsAndModules } = require("./IdHelpers");
/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Module")} Module */
/** @typedef {import("../util/fs").IntermediateFileSystem} IntermediateFileSystem */
const plugin = "SyncModuleIdsPlugin";
@@ -42,7 +43,9 @@ class SyncModuleIdsPlugin {
let dataChanged = false;
if (this._read) {
compiler.hooks.readRecords.tapAsync(plugin, callback => {
const fs = compiler.intermediateFileSystem;
const fs =
/** @type {IntermediateFileSystem} */
(compiler.intermediateFileSystem);
fs.readFile(this._path, (err, buffer) => {
if (err) {
if (err.code !== "ENOENT") {
@@ -69,7 +72,9 @@ class SyncModuleIdsPlugin {
for (const [key, value] of sorted) {
json[key] = value;
}
const fs = compiler.intermediateFileSystem;
const fs =
/** @type {IntermediateFileSystem} */
(compiler.intermediateFileSystem);
fs.writeFile(this._path, JSON.stringify(json), callback);
});
}