From efe4da33e770101d44855314c231d53aafefdf1f Mon Sep 17 00:00:00 2001 From: Rosie Val Date: Thu, 6 Aug 2026 11:37:10 -0400 Subject: [PATCH] Remove rawFindAll function from rawFind.ts --- plugins/server-drawer/src/lib/rawFind.ts | 31 ------------------------ 1 file changed, 31 deletions(-) diff --git a/plugins/server-drawer/src/lib/rawFind.ts b/plugins/server-drawer/src/lib/rawFind.ts index a3abd1e..178a371 100644 --- a/plugins/server-drawer/src/lib/rawFind.ts +++ b/plugins/server-drawer/src/lib/rawFind.ts @@ -17,37 +17,6 @@ // code to naturally reach the module we want. declare const window: any; -/** - * Every match, not just the first. Needed because "the first module that looks like the JSX - * runtime" is not necessarily the only one - a Metro bundle can carry several - * copies/re-exports of * react/jsx-runtime (plus a separate jsx-dev-runtime), and Discord's own - * chunks are not guaranteed to all import the same one. Patching only the first match silently - * leaves every element created through any other copy un-interceptable, which looks exactly like - * "the patch works sometimes." - */ -export function rawFindAll(predicate: (exports: any) => boolean): T[] { - const modules = window?.modules; - if (!modules) return []; - - const out: T[] = []; - for (const id in modules) { - const def = modules[id]; - if (!def?.isInitialized) continue; - - const exports = def.publicModule?.exports; - if (!exports) continue; - - try { - if (predicate(exports)) out.push(exports); - else if (exports.default != null && predicate(exports.default)) out.push(exports.default); - } catch { - // A predicate throwing on one module's shape shouldn't stop the scan. - } - } - - return out; -} - export function rawFind(predicate: (exports: any) => boolean): T | undefined { const modules = window?.modules; if (!modules) return undefined;