From 654a271eae67887b8e2c3a797b8bb250e0058659 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:46:48 -0300 Subject: [PATCH] eeee --- src/debug/loadLazyChunks.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/debug/loadLazyChunks.ts b/src/debug/loadLazyChunks.ts index 6e3f06b80..5cd8f9874 100644 --- a/src/debug/loadLazyChunks.ts +++ b/src/debug/loadLazyChunks.ts @@ -16,9 +16,9 @@ export async function loadLazyChunks() { try { LazyChunkLoaderLogger.log("Loading all chunks..."); - const validChunks = new Set(); - const invalidChunks = new Set(); - const deferredRequires = new Set(); + const validChunks = new Set(); + const invalidChunks = new Set(); + const deferredRequires = new Set(); let chunksSearchingResolve: (value: void | PromiseLike) => void; const chunksSearchingDone = new Promise(r => chunksSearchingResolve = r); @@ -30,14 +30,14 @@ export async function loadLazyChunks() { async function searchAndLoadLazyChunks(factoryCode: string) { const lazyChunks = factoryCode.matchAll(LazyChunkRegex); - const validChunkGroups = new Set<[chunkIds: string[], entryPoint: string]>(); + const validChunkGroups = new Set<[chunkIds: number[], entryPoint: number]>(); // Workaround for a chunk that depends on the ChannelMessage component but may be be force loaded before // the chunk containing the component const shouldForceDefer = factoryCode.includes(".Messages.GUILD_FEED_UNFEATURE_BUTTON_TEXT"); await Promise.all(Array.from(lazyChunks).map(async ([, rawChunkIds, entryPoint]) => { - const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => m[1]) : []; + const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => Number(m[1])) : []; if (chunkIds.length === 0) { return; @@ -62,7 +62,7 @@ export async function loadLazyChunks() { } if (!invalidChunkGroup) { - validChunkGroups.add([chunkIds, entryPoint]); + validChunkGroups.add([chunkIds, Number(entryPoint)]); } })); @@ -133,14 +133,14 @@ export async function loadLazyChunks() { } // All chunks Discord has mapped to asset files, even if they are not used anymore - const allChunks = [] as string[]; + const allChunks = [] as number[]; // Matches "id" or id: - for (const currentMatch of String(wreq.u).matchAll(/(?:"(\d+?)")|(?:(\d+?):)/g)) { + for (const currentMatch of String(wreq.u).matchAll(/(?:"([\de]+?)")|(?:([\de]+?):)/g)) { const id = currentMatch[1] ?? currentMatch[2]; if (id == null) continue; - allChunks.push(id); + allChunks.push(Number(id)); } if (allChunks.length === 0) throw new Error("Failed to get all chunks");