WebpackPatcher: Improve getBuildNumber; Allow reporter to check for buildNumber

Allows replacements to define noWarn too
This commit is contained in:
Nuckyz 2025-02-21 01:14:11 -03:00
parent dd714ff3c2
commit 3e524f9d92
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 40 additions and 34 deletions

View file

@ -41,7 +41,12 @@ export interface PatchReplacement {
match: string | RegExp;
/** The replacement string or function which returns the string for the patch replacement */
replace: string | ReplaceFn;
/** A function which returns whether this patch replacement should be applied */
/** Do not warn if this replacement did no changes */
noWarn?: boolean;
/**
* A function which returns whether this patch replacement should be applied.
* This is ran before patches are registered, so if this returns false, the patch will never be registered.
*/
predicate?(): boolean;
/** The minimum build number for this patch to be applied */
fromBuild?: number;
@ -61,7 +66,10 @@ export interface Patch {
noWarn?: boolean;
/** Only apply this set of replacements if all of them succeed. Use this if your replacements depend on each other */
group?: boolean;
/** A function which returns whether this patch should be applied */
/**
* A function which returns whether this patch replacement should be applied.
* This is ran before patches are registered, so if this returns false, the patch will never be registered.
*/
predicate?(): boolean;
/** The minimum build number for this patch to be applied */
fromBuild?: number;