From 992a77e76cee25dd307a600f7c89d80b9b48f17f Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Wed, 8 Feb 2023 17:54:11 -0300 Subject: ShowHiddenChannels: Stage and voice channels support (#469) Co-authored-by: Ven --- src/webpack/patchWebpack.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/webpack/patchWebpack.ts') diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index 7b318b2..19ca951 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -21,6 +21,7 @@ import Logger from "@utils/Logger"; import { canonicalizeReplacement } from "@utils/patches"; import { PatchReplacement } from "@utils/types"; +import { traceFunction } from "../debug/Tracer"; import { _initWebpack } from "."; let webpackChunk: any[]; @@ -132,6 +133,7 @@ function patchPush() { for (let i = 0; i < patches.length; i++) { const patch = patches[i]; + const executePatch = traceFunction(`patch by ${patch.plugin}`, (match: string | RegExp, replace: string) => code.replace(match, replace)); if (patch.predicate && !patch.predicate()) continue; if (code.includes(patch.find)) { @@ -146,7 +148,7 @@ function patchPush() { canonicalizeReplacement(replacement, patch.plugin); try { - const newCode = code.replace(replacement.match, replacement.replace as string); + const newCode = executePatch(replacement.match, replacement.replace as string); if (newCode === code && !patch.noWarn) { logger.warn(`Patch by ${patch.plugin} had no effect (Module id is ${id}): ${replacement.match}`); if (IS_DEV) { @@ -187,7 +189,7 @@ function patchPush() { } logger.errorCustomFmt(...Logger.makeTitle("white", "Before"), context); - logger.errorCustomFmt(...Logger.makeTitle("white", "After"), context); + logger.errorCustomFmt(...Logger.makeTitle("white", "After"), patchedContext); const [titleFmt, ...titleElements] = Logger.makeTitle("white", "Diff"); logger.errorCustomFmt(titleFmt + fmt, ...titleElements, ...elements); } -- cgit