Skip to content

Commit

Permalink
Clean it up
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckyz committed Jan 31, 2025
1 parent 8cd8334 commit f067cef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/debug/runReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
}

Expand Down Expand Up @@ -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);
2 changes: 1 addition & 1 deletion src/plugins/devCompanion.dev/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/webpack/common/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down
10 changes: 5 additions & 5 deletions src/webpack/wreq.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ModuleExports> & {
[WebpackQueues]: (fnQueue: ((queue: any[]) => any)) => any;
Expand Down Expand Up @@ -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}.
*
Expand All @@ -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 */
Expand Down

0 comments on commit f067cef

Please sign in to comment.