Make toStringTag non enumerable

This commit is contained in:
Nuckyz 2024-05-24 07:59:56 -03:00
parent 8dde496757
commit 2f16cdf77b
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 11 additions and 6 deletions

View file

@ -17,9 +17,7 @@ type PatchedModuleFactory = ModuleFactory & {
$$vencordOriginal?: ModuleFactory; $$vencordOriginal?: ModuleFactory;
}; };
type PatchedModuleFactories = Record<PropertyKey, PatchedModuleFactory> & { type PatchedModuleFactories = Record<PropertyKey, PatchedModuleFactory>;
[Symbol.toStringTag]?: string;
};
const logger = new Logger("WebpackInterceptor", "#8caaee"); const logger = new Logger("WebpackInterceptor", "#8caaee");
@ -140,7 +138,11 @@ Object.defineProperty(Function.prototype, "m", {
allModuleFactories.add(moduleFactories); allModuleFactories.add(moduleFactories);
moduleFactories[Symbol.toStringTag] = "ModuleFactories"; Object.defineProperty(moduleFactories, Symbol.toStringTag, {
value: "ModuleFactories",
configurable: true,
writable: true
});
moduleFactories = new Proxy(moduleFactories, moduleFactoriesHandler); moduleFactories = new Proxy(moduleFactories, moduleFactoriesHandler);
} }

View file

@ -78,8 +78,11 @@ export function _initWebpack(webpackRequire: WebpackRequire) {
wreq = webpackRequire; wreq = webpackRequire;
cache = webpackRequire.c; cache = webpackRequire.c;
// @ts-ignore Object.defineProperty(webpackRequire.c, Symbol.toStringTag, {
webpackRequire.c[Symbol.toStringTag] = "ModuleCache"; value: "ModuleCache",
configurable: true,
writable: true
});
} }
let devToolsOpen = false; let devToolsOpen = false;