diff --git a/src/debug/runReporter.ts b/src/debug/runReporter.ts index 35c649142..e47e0d715 100644 --- a/src/debug/runReporter.ts +++ b/src/debug/runReporter.ts @@ -45,7 +45,7 @@ async function runReporter() { for (const [plugin, moduleId, match, totalTime] of Vencord.WebpackPatcher.patchTimings) { if (totalTime > 3) { - new Logger("WebpackInterceptor").warn(`Patch by ${plugin} took ${totalTime}ms (Module id is ${String(moduleId)}): ${match}`); + new Logger("WebpackInterceptor").warn(`Patch by ${plugin} took ${Math.round(totalTime * 100) / 100}ms (Module id is ${String(moduleId)}): ${match}`); } } @@ -109,5 +109,6 @@ async function runReporter() { } } -// Run after the Vencord object has been created, because we need to add extra properties to it +// Run after the Vencord object has been created. +// We need to add extra properties to it, and it is only created after all of Vencord code has ran setTimeout(runReporter, 0); diff --git a/src/plugins/devCompanion.dev/index.tsx b/src/plugins/devCompanion.dev/index.tsx index a495907b2..d6a56fe69 100644 --- a/src/plugins/devCompanion.dev/index.tsx +++ b/src/plugins/devCompanion.dev/index.tsx @@ -160,7 +160,7 @@ function initWs(isManual = false) { return reply("Expected exactly one 'find' matches, found " + keys.length); const mod = candidates[keys[0]]; - let src = String(mod.original ?? mod).replaceAll("\n", ""); + let src = String(mod).replaceAll("\n", ""); if (src.startsWith("function(")) { src = "0," + src; diff --git a/src/webpack/common/menu.ts b/src/webpack/common/menu.ts index c45b69964..9896b3a20 100644 --- a/src/webpack/common/menu.ts +++ b/src/webpack/common/menu.ts @@ -25,7 +25,7 @@ export const Menu = {} as t.Menu; // Relies on .name properties added by the MenuItemDemanglerAPI waitFor(m => m.name === "MenuCheckboxItem", (_, id) => { // we have to do this manual require by ID because m is in this case the MenuCheckBoxItem instead of the entire module - const module = wreq(id as any); + const module = wreq(id); for (const e of Object.values(module)) { if (typeof e === "function" && e.name.startsWith("Menu")) { diff --git a/src/webpack/wreq.d.ts b/src/webpack/wreq.d.ts index 63bd27942..53a8ecaf6 100644 --- a/src/webpack/wreq.d.ts +++ b/src/webpack/wreq.d.ts @@ -15,9 +15,9 @@ export type Module = { /** exports can be anything, however initially it is always an empty object */ export type ModuleFactory = (this: ModuleExports, module: Module, exports: ModuleExports, require: WebpackRequire) => void; -export type WebpackQueues = unique symbol; -export type WebpackExports = unique symbol; -export type WebpackError = unique symbol; +export type WebpackQueues = unique symbol | "__webpack_queues__"; +export type WebpackExports = unique symbol | "__webpack_exports__"; +export type WebpackError = unique symbol | "__webpack_error__"; export type AsyncModulePromise = Promise & { [WebpackQueues]: (fnQueue: ((queue: any[]) => any)) => any; @@ -74,7 +74,7 @@ export type WebpackRequire = ((moduleId: PropertyKey) => ModuleExports) & { // */ // es: (this: WebpackRequire, fromObject: AnyRecord, toObject: AnyRecord) => AnyRecord; /** - * Creates an async module. A module that exports something that is a Promise, or requires an export from an async module. + * Creates an async module. A module that which has top level await, or requires an export from an async module. * * The body function must be an async function. "module.exports" will become an {@link AsyncModulePromise}. * @@ -98,7 +98,7 @@ export type WebpackRequire = ((moduleId: PropertyKey) => ModuleExports) & { * asyncResult(error); * } * }, false); // false because our module does not have an await after dealing with the async requires - * } + * }z2 */ a: (this: WebpackRequire, module: Module, body: AsyncModuleBody, hasAwaitAfterDependencies?: boolean) => void; /** getDefaultExport function for compatibility with non-harmony modules */