this repo has no description

core/patch: Fix some patches being skipped over

Changed files
+5 -6
packages
core
src
+5 -6
packages/core/src/patch.ts
···
? moduleCache[id]
: func.toString().replace(/\n/g, "");
-
for (const patch of patches) {
+
for (let i = 0; i < patches.length; i++) {
+
const patch = patches[i];
if (patch.prerequisite != null && !patch.prerequisite()) {
continue;
}
···
entry[id].__moonlight = true;
moduleString = replaced;
} catch (e) {
-
logger.warn("Error constructing function for patch", e);
+
logger.warn("Error constructing function for patch", patch, e);
+
patched[id].pop();
}
} else if (replace.type === PatchReplaceType.Module) {
// Directly replace the module with a new one
···
}
if (shouldRemove) {
-
patches.splice(
-
patches.findIndex((p) => p.ext === patch.ext && p.id === patch.id),
-
1
-
);
+
patches.splice(i--, 1);
}
}
}