I forgot this
This commit is contained in:
parent
5e762ddd04
commit
d8c6559967
|
@ -24,7 +24,7 @@ const modulesProxyHandler: ProxyHandler<WebpackRequire["m"]> = {
|
||||||
[propName, (...args: any[]) => Reflect[propName](...args)]
|
[propName, (...args: any[]) => Reflect[propName](...args)]
|
||||||
)),
|
)),
|
||||||
get: (target, p) => {
|
get: (target, p) => {
|
||||||
const propValue = Reflect.get(target, p);
|
const propValue = Reflect.get(target, p, target);
|
||||||
|
|
||||||
// If the property is not a number, we are not dealing with a module factory
|
// If the property is not a number, we are not dealing with a module factory
|
||||||
// $$vencordOriginal means the factory is already patched, $$vencordRequired means it has already been required
|
// $$vencordOriginal means the factory is already patched, $$vencordRequired means it has already been required
|
||||||
|
@ -36,7 +36,7 @@ const modulesProxyHandler: ProxyHandler<WebpackRequire["m"]> = {
|
||||||
|
|
||||||
// This patches factories if eagerPatches are disabled
|
// This patches factories if eagerPatches are disabled
|
||||||
const patchedFactory = patchFactory(p, propValue);
|
const patchedFactory = patchFactory(p, propValue);
|
||||||
Reflect.set(target, p, patchedFactory);
|
Reflect.set(target, p, patchedFactory, target);
|
||||||
|
|
||||||
return patchedFactory;
|
return patchedFactory;
|
||||||
},
|
},
|
||||||
|
@ -44,10 +44,10 @@ const modulesProxyHandler: ProxyHandler<WebpackRequire["m"]> = {
|
||||||
// $$vencordRequired means we are resetting the factory to its original after being required
|
// $$vencordRequired means we are resetting the factory to its original after being required
|
||||||
// If the property is not a number, we are not dealing with a module factory
|
// If the property is not a number, we are not dealing with a module factory
|
||||||
if (!Settings.eagerPatches || newValue?.$$vencordRequired === true || Number.isNaN(Number(p))) {
|
if (!Settings.eagerPatches || newValue?.$$vencordRequired === true || Number.isNaN(Number(p))) {
|
||||||
return Reflect.set(target, p, newValue);
|
return Reflect.set(target, p, newValue, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
const existingFactory = Reflect.get(target, p);
|
const existingFactory = Reflect.get(target, p, target);
|
||||||
|
|
||||||
// Check if this factory is already patched
|
// Check if this factory is already patched
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -59,7 +59,7 @@ const modulesProxyHandler: ProxyHandler<WebpackRequire["m"]> = {
|
||||||
|
|
||||||
// Modules are only patched once, so we need to set the patched factory on all the modules
|
// Modules are only patched once, so we need to set the patched factory on all the modules
|
||||||
for (const proxiedModules of allProxiedModules) {
|
for (const proxiedModules of allProxiedModules) {
|
||||||
Reflect.set(proxiedModules, p, patchedFactory);
|
Reflect.set(proxiedModules, p, patchedFactory, proxiedModules);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -328,7 +328,7 @@ function patchFactory(id: PropertyKey, factory: ModuleFactory) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
originalFactory.$$vencordRequired = true;
|
originalFactory.$$vencordRequired = true;
|
||||||
for (const proxiedModules of allProxiedModules) {
|
for (const proxiedModules of allProxiedModules) {
|
||||||
Reflect.set(proxiedModules, id, originalFactory);
|
Reflect.set(proxiedModules, id, originalFactory, proxiedModules);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wreq == null && IS_DEV) {
|
if (wreq == null && IS_DEV) {
|
||||||
|
|
Loading…
Reference in a new issue