diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 13297d624..7706f6e54 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -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" diff --git a/src/debug/reporterData.ts b/src/debug/reporterData.ts new file mode 100644 index 000000000..09cd318d3 --- /dev/null +++ b/src/debug/reporterData.ts @@ -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; +} +export const reporterData: ReporterData = { + failedPatches: { + foundNoModule: [], + hadNoEffect: [], + undoingPatchGroup: [], + erroredPatch: [] + }, + failedWebpack: { + find: [], + findByProps: [], + findByCode: [], + findStore: [], + findComponent: [], + findComponentByCode: [], + findExportedComponent: [], + waitFor: [], + waitForComponent: [], + waitForStore: [], + proxyLazyWebpack: [], + LazyComponentWebpack: [], + extractAndLoadChunks: [], + mapMangledModule: [] + } +}; diff --git a/src/debug/runReporter.ts b/src/debug/runReporter.ts index 8a3a3c3d3..2c6563b6d 100644 --- a/src/debug/runReporter.ts +++ b/src/debug/runReporter.ts @@ -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; -} -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..."); diff --git a/src/plugins/devCompanion.dev/index.tsx b/src/plugins/devCompanion.dev/index.tsx index 715a32408..ab2be99e0 100644 --- a/src/plugins/devCompanion.dev/index.tsx +++ b/src/plugins/devCompanion.dev/index.tsx @@ -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", diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index 8793683fa..45c6970de 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -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