Merge remote-tracking branch 'upstream/dev'

This commit is contained in:
thororen1234 2024-06-19 12:19:51 -04:00
commit 7adcfaa735
38 changed files with 228 additions and 273 deletions

View file

@ -7,6 +7,6 @@
import { findLazy } from "@webpack";
export const UserSettingsActionCreators = {
FrecencyUserSettingsActionCreators: findLazy(m => m.typeName?.endsWith(".FrecencyUserSettings")),
PreloadedUserSettingsActionCreators: findLazy(m => m.typeName?.endsWith(".PreloadedUserSettings")),
FrecencyUserSettingsActionCreators: findLazy(m => m.ProtoClass?.typeName?.endsWith(".FrecencyUserSettings")),
PreloadedUserSettingsActionCreators: findLazy(m => m.ProtoClass?.typeName?.endsWith(".PreloadedUserSettings")),
};

View file

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { canonicalizeMatch } from "@utils/patches";
import type { Channel } from "discord-types/general";
import { _resolveReady, filters, findByCodeLazy, findByPropsLazy, findLazy, mapMangledModuleLazy, waitFor } from "../webpack";
@ -156,3 +157,10 @@ export const UserProfileActions = findByPropsLazy("openUserProfileModal", "close
export const InviteActions = findByPropsLazy("resolveInvite");
export const IconUtils: t.IconUtils = findByPropsLazy("getGuildBannerURL", "getUserAvatarURL");
const openExpressionPickerMatcher = canonicalizeMatch(/setState\({activeView:\i/);
// TODO: type
export const ExpressionPickerStore = mapMangledModuleLazy("expression-picker-last-active-view", {
closeExpressionPicker: filters.byCode("setState({activeView:null"),
openExpressionPicker: m => typeof m === "function" && openExpressionPickerMatcher.test(m.toString()),
});

View file

@ -106,7 +106,7 @@ export const find = traceFunction("find", function find(filter: FilterFn, { isIn
for (const key in cache) {
const mod = cache[key];
if (!mod?.exports) continue;
if (!mod.loaded || !mod?.exports) continue;
if (filter(mod.exports)) {
return isWaitFor ? [mod.exports, key] : mod.exports;
@ -142,7 +142,7 @@ export function findAll(filter: FilterFn) {
const ret = [] as any[];
for (const key in cache) {
const mod = cache[key];
if (!mod?.exports) continue;
if (!mod.loaded || !mod?.exports) continue;
if (filter(mod.exports))
ret.push(mod.exports);
@ -190,7 +190,7 @@ export const findBulk = traceFunction("findBulk", function findBulk(...filterFns
outer:
for (const key in cache) {
const mod = cache[key];
if (!mod?.exports) continue;
if (!mod.loaded || !mod?.exports) continue;
for (let j = 0; j < length; j++) {
const filter = filters[j];
@ -486,7 +486,7 @@ export function mapMangledModuleLazy<S extends string>(code: string, mappers: Re
return proxyLazy(() => mapMangledModule(code, mappers));
}
export const DefaultExtractAndLoadChunksRegex = /(?:(?:Promise\.all\(\[)?(\i\.e\("[^)]+?"\)[^\]]*?)(?:\]\))?|Promise\.resolve\(\))\.then\(\i\.bind\(\i,"([^)]+?)"\)\)/;
export const DefaultExtractAndLoadChunksRegex = /(?:(?:Promise\.all\(\[)?(\i\.e\("?[^)]+?"?\)[^\]]*?)(?:\]\))?|Promise\.resolve\(\))\.then\(\i\.bind\(\i,"?([^)]+?)"?\)\)/;
export const ChunkIdsRegex = /\("([^"]+?)"\)/g;
/**