feat(plugins): ConsoleJanitor (#2659)

This commit is contained in:
Nuckyz 2024-07-03 00:06:12 -03:00
parent 99b41dba19
commit 256a85c95c
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
4 changed files with 161 additions and 3 deletions

View file

@ -59,11 +59,15 @@ export function addPatch(newPatch: Omit<Patch, "plugin">, pluginName: string) {
delete patch.group;
}
if (patch.predicate && !patch.predicate()) return;
canonicalizeFind(patch);
if (!Array.isArray(patch.replacement)) {
patch.replacement = [patch.replacement];
}
patch.replacement = patch.replacement.filter(({ predicate }) => !predicate || predicate());
if (IS_REPORTER) {
patch.replacement.forEach(r => {
delete r.predicate;