Clean it up
This commit is contained in:
parent
8cd8334ada
commit
f067cefd18
4 changed files with 10 additions and 9 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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")) {
|
||||
|
|
10
src/webpack/wreq.d.ts
vendored
10
src/webpack/wreq.d.ts
vendored
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue