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

This commit is contained in:
Nuckyz 2024-06-22 06:16:36 -03:00
commit d55770797a
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 6 additions and 8 deletions

View file

@ -56,8 +56,9 @@ const handler: ProxyHandler<any> = {
return keys;
},
getOwnPropertyDescriptor: (target, p) => {
if (typeof p === "string" && UNCONFIGURABLE_PROPERTIES.includes(p))
if (typeof p === "string" && UNCONFIGURABLE_PROPERTIES.includes(p)) {
return Reflect.getOwnPropertyDescriptor(target, p);
}
const descriptor = Reflect.getOwnPropertyDescriptor(target[SYM_LAZY_GET](), p);
if (descriptor) Object.defineProperty(target, p, descriptor);
@ -79,9 +80,7 @@ export function proxyLazy<T = AnyObject>(factory: () => T, attempts = 5, isChild
let isSameTick = true;
if (!isChild) setTimeout(() => isSameTick = false, 0);
// Define the function in an object to preserve the name after minification
const proxyDummy = ({ ProxyDummy() { } }).ProxyDummy;
Object.assign(proxyDummy, {
const proxyDummy = Object.assign(function () { }, {
[SYM_LAZY_GET]() {
if (!proxyDummy[SYM_LAZY_CACHED]) {
if (!get.$$vencordLazyFailed()) {

View file

@ -31,8 +31,9 @@ const handler: ProxyHandler<any> = {
return keys;
},
getOwnPropertyDescriptor: (target, p) => {
if (typeof p === "string" && UNCONFIGURABLE_PROPERTIES.includes(p))
if (typeof p === "string" && UNCONFIGURABLE_PROPERTIES.includes(p)) {
return Reflect.getOwnPropertyDescriptor(target, p);
}
const descriptor = Reflect.getOwnPropertyDescriptor(target[SYM_PROXY_INNER_GET](), p);
if (descriptor) Object.defineProperty(target, p, descriptor);
@ -56,9 +57,7 @@ export function proxyInner<T = AnyObject>(
let isSameTick = true;
if (!isChild) setTimeout(() => isSameTick = false, 0);
// Define the function in an object to preserve the name after minification
const proxyDummy = ({ ProxyDummy() { } }).ProxyDummy;
Object.assign(proxyDummy, {
const proxyDummy = Object.assign(function () { }, {
[SYM_PROXY_INNER_GET]: function () {
if (proxyDummy[SYM_PROXY_INNER_VALUE] == null) {
throw new Error(errMsg);