Merge remote-tracking branch 'upstream/dev' into dev
Some checks are pending
Test / Test (push) Waiting to run
Release / Build Equicord (push) Waiting to run

This commit is contained in:
thororen1234 2025-05-13 16:34:42 -04:00
commit 62b8997443
No known key found for this signature in database
3 changed files with 26 additions and 7 deletions

View file

@ -23,12 +23,19 @@ export const Menu = {} as t.Menu;
// Relies on .name properties added by the MenuItemDemanglerAPI
waitFor(m => m.name === "MenuCheckboxItem", (_, id) => {
// we have to do this manual require by ID because m is in this case the MenuCheckBoxItem instead of the entire module
const module = wreq(id);
// We have to do this manual require by ID because m in this case is the MenuCheckBoxItem instead of the entire module
const exports = wreq(id);
for (const e of Object.values(module)) {
if (typeof e === "function" && e.name.startsWith("Menu")) {
Menu[e.name] = e;
for (const exportKey in exports) {
// Some exports might have not been initialized yet due to circular imports, so try catch it.
try {
var exportValue = exports[exportKey];
} catch {
continue;
}
if (typeof exportValue === "function" && exportValue.name.startsWith("Menu")) {
Menu[exportValue.name] = exportValue;
}
}
});

View file

@ -442,7 +442,12 @@ function runFactoryWithWrap(patchedFactory: PatchedModuleFactory, thisArg: unkno
}
for (const exportKey in exports) {
const exportValue = exports[exportKey];
// Some exports might have not been initialized yet due to circular imports, so try catch it.
try {
var exportValue = exports[exportKey];
} catch {
continue;
}
if (exportValue != null && filter(exportValue)) {
waitForSubscriptions.delete(filter);

View file

@ -156,7 +156,14 @@ export function _blacklistBadModules(requireCache: NonNullable<AnyWebpackRequire
let hasOnlyBadProperties = true;
for (const exportKey in exports) {
if (shouldIgnoreValue(exports[exportKey])) {
// Some exports might have not been initialized yet due to circular imports, so try catch it.
try {
var exportValue = exports[exportKey];
} catch {
continue;
}
if (shouldIgnoreValue(exportValue)) {
makePropertyNonEnumerable(exports, exportKey);
} else {
hasOnlyBadProperties = false;