Merge branch 'modules-proxy-patches' into immediate-finds-modules-proxy

This commit is contained in:
Nuckyz 2024-05-28 04:00:41 -03:00
commit b36d3b4385
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -327,8 +327,9 @@ function patchFactory(id: PropertyKey, factory: ModuleFactory) {
if (!patch.all) patches.splice(i--, 1);
}
// The patched factory wrapper
const patchedFactory: PatchedModuleFactory = function (...args: Parameters<ModuleFactory>) {
// The patched factory wrapper, define it in an object to preserve the name after minification
const patchedFactory: PatchedModuleFactory = {
PatchedFactory(...args: Parameters<ModuleFactory>) {
// Restore the original factory in all the module factories objects,
// because we want to make sure the original factory is restored properly, no matter what is the Webpack instance
for (const moduleFactories of allModuleFactories) {
@ -418,7 +419,8 @@ function patchFactory(id: PropertyKey, factory: ModuleFactory) {
}
return factoryReturn;
};
}
}.PatchedFactory;
patchedFactory.toString = originalFactory.toString.bind(originalFactory);
patchedFactory.$$vencordOriginal = originalFactory;