Remove obsolete mapMangledModule ~ modules are no longer mangled

This commit is contained in:
V 2023-11-23 03:11:17 +01:00
parent 6869705673
commit 63451bad25
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905
12 changed files with 46 additions and 90 deletions

View file

@ -17,16 +17,12 @@
*/
// eslint-disable-next-line path-alias/no-relative
import { filters, mapMangledModuleLazy, waitFor } from "../webpack";
import { findByPropsLazy, waitFor } from "../webpack";
import type * as t from "./types/menu";
export let Menu = {} as t.Menu;
waitFor(["MenuItem", "MenuSliderControl"], m => Menu = m);
export const ContextMenu: t.ContextMenuApi = mapMangledModuleLazy('type:"CONTEXT_MENU_OPEN"', {
open: filters.byCode("stopPropagation"),
openLazy: m => m.toString().length < 50,
close: filters.byCode("CONTEXT_MENU_CLOSE")
});
export const ContextMenuApi: t.ContextMenuApi = findByPropsLazy("closeContextMenu", "openContextMenu");

View file

@ -19,7 +19,7 @@
import type * as Stores from "discord-types/stores";
// eslint-disable-next-line path-alias/no-relative
import { filters, findByPropsLazy, mapMangledModuleLazy } from "../webpack";
import { findByPropsLazy } from "../webpack";
import { waitForStore } from "./internal";
import * as t from "./types/stores";
@ -62,10 +62,6 @@ export let EmojiStore: t.EmojiStore;
export let WindowStore: t.WindowStore;
export let DraftStore: t.DraftStore;
export const MaskedLinkStore = mapMangledModuleLazy('"MaskedLinkStore"', {
openUntrustedLink: filters.byCode(".apply(this,arguments)")
});
/**
* React hook that returns stateful data for one or more stores
* You might need a custom comparator (4th argument) if your store data is an object

View file

@ -75,14 +75,14 @@ export interface Menu {
}
export interface ContextMenuApi {
close(): void;
open(
closeContextMenu(): void;
openContextMenu(
event: UIEvent,
render?: Menu["Menu"],
options?: { enableSpellCheck?: boolean; },
renderLazy?: () => Promise<Menu["Menu"]>
): void;
openLazy(
openContextMenuLazy(
event: UIEvent,
renderLazy?: () => Promise<Menu["Menu"]>,
options?: { enableSpellCheck?: boolean; }

View file

@ -161,3 +161,24 @@ export interface i18n {
Messages: Record<i18nMessages, any>;
}
export interface Clipboard {
copy(text: string): void;
SUPPORTS_COPY: boolean;
}
export interface NavigationRouter {
back(): void;
forward(): void;
hasNavigated(): boolean;
getHistory(): {
action: string;
length: 50;
[key: string]: any;
};
transitionTo(path: string, ...args: unknown[]): void;
transitionToGuild(guildId: string, ...args: unknown[]): void;
replaceWith(...args: unknown[]): void;
getLastRouteChangeSource(): any;
getLastRouteChangeSourceLocationStack(): any;
}

View file

@ -20,7 +20,7 @@ import { proxyLazy } from "@utils/lazy";
import type { Channel, User } from "discord-types/general";
// eslint-disable-next-line path-alias/no-relative
import { _resolveReady, filters, find, findByPropsLazy, findLazy, mapMangledModuleLazy, waitFor } from "../webpack";
import { _resolveReady, find, findByPropsLazy, findLazy, waitFor } from "../webpack";
import type * as t from "./types/utils";
export let FluxDispatcher: t.FluxDispatcher;
@ -102,17 +102,9 @@ export const ApplicationAssetUtils = findByPropsLazy("fetchAssetIds", "getAssetI
fetchAssetIds: (applicationId: string, e: string[]) => Promise<string[]>;
};
export const Clipboard = mapMangledModuleLazy('document.queryCommandEnabled("copy")||document.queryCommandSupported("copy")', {
copy: filters.byCode(".copy("),
SUPPORTS_COPY: x => typeof x === "boolean",
});
export const Clipboard: t.Clipboard = findByPropsLazy("SUPPORTS_COPY", "copy");
export const NavigationRouter = mapMangledModuleLazy("transitionToGuild - ", {
transitionTo: filters.byCode("transitionTo -"),
transitionToGuild: filters.byCode("transitionToGuild -"),
goBack: filters.byCode("goBack()"),
goForward: filters.byCode("goForward()"),
});
export const NavigationRouter: t.NavigationRouter = findByPropsLazy("transitionTo", "replaceWith", "transitionToGuild");
waitFor(["dispatch", "subscribe"], m => {
FluxDispatcher = m;