Reporter Bad Webpack Finds logs cleanups

This commit is contained in:
Nuckyz 2024-05-08 06:16:00 -03:00
parent fa948e8639
commit f70cc5205c
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 15 additions and 3 deletions

View file

@ -529,9 +529,21 @@ async function runtime(token: string) {
parsedArgs === args &&
["waitFor", "find", "findComponent", "webpackDependantLazy", "webpackDependantLazyComponent"].includes(searchType)
) {
logMessage += `(${parsedArgs[0].toString().slice(0, 147)}...)`;
let filter = parsedArgs[0].toString();
if (filter.length > 150) {
filter = filter.slice(0, 147) + "...";
}
logMessage += `(${filter})`;
} else if (searchType === "extractAndLoadChunks") {
logMessage += `([${parsedArgs[0].map((arg: any) => `"${arg}"`).join(", ")}], ${parsedArgs[1].toString()})`;
let regexStr: string;
if (parsedArgs[1] === Vencord.Webpack.DefaultExtractAndLoadChunksRegex) {
regexStr = "DefaultExtractAndLoadChunksRegex";
} else {
regexStr = parsedArgs[1].toString();
}
logMessage += `([${parsedArgs[0].map((arg: any) => `"${arg}"`).join(", ")}], ${regexStr})`;
} else {
logMessage += `(${filterName.length ? `${filterName}(` : ""}${parsedArgs.map(arg => `"${arg}"`).join(", ")})${filterName.length ? ")" : ""}`;
}

View file

@ -614,7 +614,7 @@ export const findAll = deprecatedRedirect("findAll", "cacheFindAll", cacheFindAl
*/
export const findBulk = deprecatedRedirect("findBulk", "cacheFindBulk", cacheFindBulk);
const DefaultExtractAndLoadChunksRegex = /(?:Promise\.all\((\[\i\.\i\(".+?"\).+?\])\)|Promise\.resolve\(\)).then\(\i\.bind\(\i,"(.+?)"\)\)/;
export const DefaultExtractAndLoadChunksRegex = /(?:Promise\.all\((\[\i\.\i\(".+?"\).+?\])\)|Promise\.resolve\(\)).then\(\i\.bind\(\i,"(.+?)"\)\)/;
/**
* Extract and load chunks using their entry point.