diff --git a/src/plugins/consoleShortcuts/index.ts b/src/plugins/consoleShortcuts/index.ts index 4be2e2ee8..5703f7f53 100644 --- a/src/plugins/consoleShortcuts/index.ts +++ b/src/plugins/consoleShortcuts/index.ts @@ -85,6 +85,7 @@ function makeShortcuts() { wpex: extract, wpexs: (code: string) => extract(findModuleId(code)!), loadLazyChunks: IS_DEV ? loadLazyChunks : () => { throw new Error("loadLazyChunks is dev only."); }, + filters, find, findAll: findAll, findByProps, diff --git a/src/webpack/webpack.ts b/src/webpack/webpack.ts index 989c239fd..bbe8ab513 100644 --- a/src/webpack/webpack.ts +++ b/src/webpack/webpack.ts @@ -453,14 +453,14 @@ export function findExportedComponentLazy(...props: stri * closeModal: filters.byCode("key==") * }) */ -export const mapMangledModule = traceFunction("mapMangledModule", function mapMangledModule(code: string, mappers: Record): Record { - const exports = {} as Record; +export const mapMangledModule = traceFunction("mapMangledModule", function mapMangledModule(code: string, mappers: Record): Record { + const exports = {} as Record; const id = findModuleId(code); if (id === null) return exports; - const mod = wreq(id as any); + const mod = wreq(id); outer: for (const key in mod) { const member = mod[key]; diff --git a/src/webpack/wreq.d.ts b/src/webpack/wreq.d.ts index 648ce839c..3416bbfbb 100644 --- a/src/webpack/wreq.d.ts +++ b/src/webpack/wreq.d.ts @@ -58,21 +58,21 @@ export type WebpackRequire = ((moduleId: PropertyKey) => ModuleExports) & { m: Record; /** The module cache, where all modules which have been WebpackRequire'd are stored */ c: Record; - /** - * Export star. Sets properties of "fromObject" to "toObject" as getters that return the value from "fromObject", like this: - * @example - * const fromObject = { a: 1 }; - * Object.keys(fromObject).forEach(key => { - * if (key !== "default" && !Object.hasOwn(toObject, key)) { - * Object.defineProperty(toObject, key, { - * get: () => fromObject[key], - * enumerable: true - * }); - * } - * }); - * @returns fromObject - */ - es: (this: WebpackRequire, fromObject: Record, toObject: Record) => Record; + // /** + // * Export star. Sets properties of "fromObject" to "toObject" as getters that return the value from "fromObject", like this: + // * @example + // * const fromObject = { a: 1 }; + // * Object.keys(fromObject).forEach(key => { + // * if (key !== "default" && !Object.hasOwn(toObject, key)) { + // * Object.defineProperty(toObject, key, { + // * get: () => fromObject[key], + // * enumerable: true + // * }); + // * } + // * }); + // * @returns fromObject + // */ + // es: (this: WebpackRequire, fromObject: Record, toObject: Record) => Record; /** * Creates an async module. A module that exports something that is a Promise, or requires an export from an async module. * @@ -179,6 +179,8 @@ export type WebpackRequire = ((moduleId: PropertyKey) => ModuleExports) & { v: (this: WebpackRequire, exports: ModuleExports, wasmModuleId: any, wasmModuleHash: string, importsObj?: WebAssembly.Imports) => Promise; /** Bundle public path, where chunk files are stored. Used by other methods which load chunks to obtain the full asset url */ p: string; + /** The runtime id of the current runtime */ + j: string; /** Document baseURI or WebWorker location.href */ b: string; };