aboutsummaryrefslogtreecommitdiff
path: root/src/webpack/patchWebpack.ts
diff options
context:
space:
mode:
authorNuckyz <61953774+Nuckyz@users.noreply.github.com>2023-02-08 17:54:11 -0300
committerGitHub <noreply@github.com>2023-02-08 21:54:11 +0100
commit992a77e76cee25dd307a600f7c89d80b9b48f17f (patch)
tree5454ed44488fed736540338f4a89dcba36e051e1 /src/webpack/patchWebpack.ts
parent291f38115c40c209c88ce509d5163375b34d04a9 (diff)
downloadVencord-992a77e76cee25dd307a600f7c89d80b9b48f17f.tar.gz
Vencord-992a77e76cee25dd307a600f7c89d80b9b48f17f.tar.bz2
Vencord-992a77e76cee25dd307a600f7c89d80b9b48f17f.zip
ShowHiddenChannels: Stage and voice channels support (#469)
Co-authored-by: Ven <vendicated@riseup.net>
Diffstat (limited to 'src/webpack/patchWebpack.ts')
-rw-r--r--src/webpack/patchWebpack.ts6
1 files changed, 4 insertions, 2 deletions
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);
}