mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 13:23:28 -05:00
fix imports causing a crash and add missing if statment
This commit is contained in:
parent
982b52d6e9
commit
4f92052d49
5 changed files with 73 additions and 51 deletions
13
.vscode/tasks.json
vendored
13
.vscode/tasks.json
vendored
|
@ -14,12 +14,19 @@
|
|||
},
|
||||
{
|
||||
// for use with the vencord companion extension
|
||||
"label": "BuildCompanionReporter",
|
||||
"label": "Build Companion Reporter",
|
||||
"type": "shell",
|
||||
"command": "pnpm build --dev --reporter --companion-test"
|
||||
"command": "pnpm build --dev --reporter --companion-test",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "silent",
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "BuildDev",
|
||||
"label": "Build Dev",
|
||||
"type": "shell",
|
||||
"command": "pnpm build --dev",
|
||||
"group": "build"
|
||||
|
|
48
src/debug/reporterData.ts
Normal file
48
src/debug/reporterData.ts
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
/**
|
||||
* this file is needed to avoid an import of plugins in ./runReporter.ts
|
||||
*/
|
||||
import { Patch } from "@utils/types";
|
||||
import { TypeWebpackSearchHistory } from "@webpack";
|
||||
|
||||
interface EvaledPatch extends Patch {
|
||||
id: number | string;
|
||||
}
|
||||
interface ReporterData {
|
||||
failedPatches: {
|
||||
foundNoModule: Patch[];
|
||||
hadNoEffect: EvaledPatch[];
|
||||
undoingPatchGroup: EvaledPatch[];
|
||||
erroredPatch: EvaledPatch[];
|
||||
};
|
||||
failedWebpack: Record<TypeWebpackSearchHistory, string[][]>;
|
||||
}
|
||||
export const reporterData: ReporterData = {
|
||||
failedPatches: {
|
||||
foundNoModule: [],
|
||||
hadNoEffect: [],
|
||||
undoingPatchGroup: [],
|
||||
erroredPatch: []
|
||||
},
|
||||
failedWebpack: {
|
||||
find: [],
|
||||
findByProps: [],
|
||||
findByCode: [],
|
||||
findStore: [],
|
||||
findComponent: [],
|
||||
findComponentByCode: [],
|
||||
findExportedComponent: [],
|
||||
waitFor: [],
|
||||
waitForComponent: [],
|
||||
waitForStore: [],
|
||||
proxyLazyWebpack: [],
|
||||
LazyComponentWebpack: [],
|
||||
extractAndLoadChunks: [],
|
||||
mapMangledModule: []
|
||||
}
|
||||
};
|
|
@ -5,49 +5,13 @@
|
|||
*/
|
||||
|
||||
import { Logger } from "@utils/Logger";
|
||||
import { Patch } from "@utils/types";
|
||||
import * as Webpack from "@webpack";
|
||||
import { patches } from "plugins";
|
||||
|
||||
import { loadLazyChunks } from "./loadLazyChunks";
|
||||
import { reporterData } from "./reporterData";
|
||||
|
||||
const ReporterLogger = new Logger("Reporter");
|
||||
interface EvaledPatch extends Patch {
|
||||
id: number | string;
|
||||
}
|
||||
interface ReporterData {
|
||||
failedPatches: {
|
||||
foundNoModule: Patch[];
|
||||
hadNoEffect: EvaledPatch[];
|
||||
undoingPatchGroup: EvaledPatch[];
|
||||
erroredPatch: EvaledPatch[];
|
||||
};
|
||||
failedWebpack: Record<Webpack.TypeWebpackSearchHistory, string[][]>;
|
||||
}
|
||||
export const reporterData: ReporterData = {
|
||||
failedPatches: {
|
||||
foundNoModule: [],
|
||||
hadNoEffect: [],
|
||||
undoingPatchGroup: [],
|
||||
erroredPatch: []
|
||||
},
|
||||
failedWebpack: {
|
||||
find: [],
|
||||
findByProps: [],
|
||||
findByCode: [],
|
||||
findStore: [],
|
||||
findComponent: [],
|
||||
findComponentByCode: [],
|
||||
findExportedComponent: [],
|
||||
waitFor: [],
|
||||
waitForComponent: [],
|
||||
waitForStore: [],
|
||||
proxyLazyWebpack: [],
|
||||
LazyComponentWebpack: [],
|
||||
extractAndLoadChunks: [],
|
||||
mapMangledModule: []
|
||||
}
|
||||
};
|
||||
async function runReporter() {
|
||||
try {
|
||||
ReporterLogger.log("Starting test...");
|
||||
|
|
|
@ -23,7 +23,7 @@ import { Logger } from "@utils/Logger";
|
|||
import { canonicalizeMatch, canonicalizeReplace } from "@utils/patches";
|
||||
import definePlugin, { OptionType, ReporterTestable } from "@utils/types";
|
||||
import { filters, findAll, search, wreq } from "@webpack";
|
||||
import { reporterData } from "debug/runReporter";
|
||||
import { reporterData } from "debug/reporterData";
|
||||
|
||||
import { extractModule, extractOrThrow, FindData, findModuleId, FindType, mkRegexFind, parseNode, PatchData, SendData } from "./util";
|
||||
|
||||
|
@ -69,11 +69,13 @@ function initWs(isManual = false) {
|
|||
ok: true,
|
||||
});
|
||||
// if we are running the reporter with companion integration, send the list to vscode as soon as we can
|
||||
replyData({
|
||||
type: "report",
|
||||
data: reporterData,
|
||||
ok: true
|
||||
});
|
||||
if (IS_COMPANION_TEST) {
|
||||
replyData({
|
||||
type: "report",
|
||||
data: reporterData,
|
||||
ok: true
|
||||
});
|
||||
}
|
||||
|
||||
(settings.store.notifyOnAutoConnect || isManual) && showNotification({
|
||||
title: "Dev Companion Connected",
|
||||
|
|
|
@ -20,7 +20,7 @@ import { WEBPACK_CHUNK } from "@utils/constants";
|
|||
import { Logger } from "@utils/Logger";
|
||||
import { canonicalizeReplacement } from "@utils/patches";
|
||||
import { PatchReplacement } from "@utils/types";
|
||||
import { reporterData } from "debug/runReporter";
|
||||
import { reporterData } from "debug/reporterData";
|
||||
import { WebpackInstance } from "discord-types/other";
|
||||
|
||||
import { traceFunction } from "../debug/Tracer";
|
||||
|
@ -357,10 +357,11 @@ function patchFactories(factories: Record<string, (module: any, exports: any, re
|
|||
|
||||
if (patch.group) {
|
||||
logger.warn(`Undoing patch group ${patch.find} by ${patch.plugin} because replacement ${replacement.match} errored`);
|
||||
reporterData.failedPatches.undoingPatchGroup.push({
|
||||
...patch,
|
||||
id
|
||||
});
|
||||
if (IS_COMPANION_TEST)
|
||||
reporterData.failedPatches.undoingPatchGroup.push({
|
||||
...patch,
|
||||
id
|
||||
});
|
||||
mod = previousMod;
|
||||
code = previousCode;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue