From bad96b78879f296d5b9e7adacb03756b0f58427a Mon Sep 17 00:00:00 2001 From: Ven Date: Mon, 28 Nov 2022 13:37:55 +0100 Subject: Path aliases, better lazyWebpack (#268) --- browser/VencordNativeStub.ts | 2 +- docs/2_PLUGINS.md | 2 +- src/VencordNative.ts | 3 +- src/api/Commands/commandHelpers.ts | 8 +-- src/api/Commands/index.ts | 3 +- src/api/MessageEvents.ts | 5 +- src/api/Notices.ts | 2 +- src/api/ServerList.ts | 2 +- src/api/settings.ts | 12 ++-- src/components/CheckedTextInput.tsx | 2 +- src/components/DonateButton.tsx | 5 +- src/components/ErrorBoundary.tsx | 7 ++- src/components/ErrorCard.tsx | 2 +- src/components/Flex.tsx | 2 +- src/components/Link.tsx | 2 +- src/components/Monaco.ts | 10 ++-- src/components/PatchHelper.tsx | 9 +-- src/components/PluginSettings/PluginModal.tsx | 18 +++--- .../components/SettingBooleanComponent.tsx | 5 +- .../components/SettingCustomComponent.tsx | 3 +- .../components/SettingNumericComponent.tsx | 5 +- .../components/SettingSelectComponent.tsx | 5 +- .../components/SettingSliderComponent.tsx | 5 +- .../components/SettingTextComponent.tsx | 5 +- src/components/PluginSettings/components/index.ts | 3 +- src/components/PluginSettings/index.tsx | 21 +++---- .../VencordSettings/BackupRestoreTab.tsx | 5 +- src/components/VencordSettings/Updater.tsx | 7 ++- src/components/VencordSettings/VencordTab.tsx | 9 +-- src/components/VencordSettings/index.tsx | 8 +-- src/components/handleComponentFailed.ts | 2 +- src/debug/Tracer.ts | 2 +- src/ipcMain/index.ts | 6 +- src/ipcMain/updater/git.ts | 2 +- src/ipcMain/updater/http.ts | 4 +- src/modules.d.ts | 2 +- src/patcher.ts | 2 +- src/plugins/BetterNotes.ts | 8 +-- src/plugins/HideAttachments.tsx | 11 ++-- src/plugins/TimeBarAllActivities.ts | 4 +- src/plugins/anonymiseFileNames.ts | 6 +- src/plugins/apiBadges.tsx | 22 ++++---- src/plugins/apiCommands.ts | 4 +- src/plugins/apiMenuItemDeobfuscator.ts | 6 +- src/plugins/apiMessageAccessories.ts | 4 +- src/plugins/apiMessageEvents.ts | 4 +- src/plugins/apiNotices.ts | 6 +- src/plugins/apiServerList.ts | 4 +- src/plugins/arRPC.tsx | 15 +++-- src/plugins/banger.ts | 4 +- src/plugins/betterGifAltText.ts | 4 +- src/plugins/betterRoleDot.ts | 8 +-- src/plugins/betterUploadButton.ts | 4 +- src/plugins/blurNsfw.ts | 6 +- src/plugins/callTimer.tsx | 10 ++-- src/plugins/clearURLs/index.ts | 9 +-- src/plugins/consoleShortcuts.ts | 4 +- src/plugins/corruptMp4s.ts | 12 ++-- src/plugins/dictionary.ts | 8 +-- src/plugins/emoteCloner.tsx | 22 ++++---- src/plugins/experiments.tsx | 13 ++--- src/plugins/fakeNitro.ts | 22 ++++---- src/plugins/fart.ts | 10 ++-- src/plugins/forceOwnerCrown.ts | 6 +- src/plugins/friendInvites.ts | 8 +-- src/plugins/fxTwitter.ts | 6 +- src/plugins/iLoveSpam.ts | 4 +- src/plugins/ignoreActivities.ts | 11 ++-- src/plugins/index.ts | 9 +-- src/plugins/keepCurrentChannel.ts | 8 +-- src/plugins/lastfm.tsx | 64 +++++++++++----------- src/plugins/loadingQuotes.ts | 4 +- src/plugins/messageActions.ts | 21 ++++--- src/plugins/messageLogger/index.tsx | 19 +++---- src/plugins/messageTags.ts | 10 ++-- src/plugins/moreCommands.ts | 6 +- src/plugins/moreKaomoji.ts | 8 +-- src/plugins/moyai.ts | 13 ++--- src/plugins/muteNewGuild.ts | 4 +- src/plugins/noBlockedMessages.ts | 12 ++-- src/plugins/noCanaryMessageLinks.ts | 8 +-- src/plugins/noDevtoolsWarning.ts | 6 +- src/plugins/noF1.ts | 4 +- src/plugins/noRPC.ts | 4 +- src/plugins/noReplyMention.ts | 4 +- src/plugins/noSystemBadge.ts | 4 +- src/plugins/noTrack.ts | 4 +- src/plugins/noUnblockToJump.ts | 4 +- src/plugins/oneko.ts | 4 +- src/plugins/petpet.ts | 18 +++--- src/plugins/plainFolderIcon.ts | 4 +- src/plugins/platformIndicators.tsx | 16 +++--- .../components/PronounsAboutComponent.tsx | 4 +- .../pronoundb/components/PronounsChatComponent.tsx | 10 ++-- .../components/PronounsProfileWrapper.tsx | 7 ++- src/plugins/pronoundb/index.ts | 5 +- src/plugins/pronoundb/pronoundbUtils.ts | 7 ++- src/plugins/quickMention.tsx | 8 +-- src/plugins/quickReply.ts | 14 ++--- src/plugins/readAllNotificationsButton.tsx | 8 +-- src/plugins/reverseImageSearch.tsx | 6 +- src/plugins/reviewDB/Utils/ReviewDBAPI.ts | 3 +- src/plugins/reviewDB/Utils/Utils.tsx | 13 +++-- src/plugins/reviewDB/components/MessageButton.tsx | 4 +- .../reviewDB/components/ReviewComponent.tsx | 7 ++- src/plugins/reviewDB/components/ReviewsView.tsx | 7 ++- src/plugins/reviewDB/index.tsx | 10 ++-- src/plugins/settings.tsx | 8 +-- src/plugins/showHiddenChannels.tsx | 14 ++--- src/plugins/silentTyping.ts | 4 +- src/plugins/spotifyControls/PlayerComponent.tsx | 17 +++--- src/plugins/spotifyControls/SpotifyStore.ts | 15 +++-- src/plugins/spotifyControls/index.tsx | 5 +- src/plugins/spotifyCrack.ts | 7 +-- src/plugins/spotifyShareCommands.ts | 19 +++---- src/plugins/startupTimings/StartupTimingPage.tsx | 11 ++-- src/plugins/startupTimings/index.tsx | 6 +- src/plugins/unindent.ts | 6 +- src/plugins/unminifyErrors.ts | 4 +- src/plugins/uwuify.ts | 6 +- src/plugins/vcDoubleClick.ts | 8 +-- src/plugins/viewIcons.tsx | 15 +++-- src/plugins/volumeBooster.ts | 6 +- src/plugins/webContextMenus.ts | 4 +- src/plugins/webhookTags.ts | 4 +- src/plugins/whoReacted.tsx | 19 +++---- src/preload.ts | 4 +- src/utils/discord.ts | 3 +- src/utils/misc.tsx | 14 +---- src/utils/modal.tsx | 3 +- src/utils/proxyLazy.ts | 2 +- src/utils/quickCss.ts | 3 +- src/utils/settingsSync.ts | 3 +- src/utils/types.ts | 3 +- src/webpack/common.tsx | 32 ++++++----- src/webpack/patchWebpack.ts | 5 +- src/webpack/webpack.ts | 25 ++++++++- tsconfig.json | 11 +++- 138 files changed, 572 insertions(+), 547 deletions(-) diff --git a/browser/VencordNativeStub.ts b/browser/VencordNativeStub.ts index dca7da8..ef3923b 100644 --- a/browser/VencordNativeStub.ts +++ b/browser/VencordNativeStub.ts @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -import IpcEvents from "../src/utils/IpcEvents"; import * as DataStore from "../src/api/DataStore"; +import IpcEvents from "../src/utils/IpcEvents"; // Discord deletes this so need to store in variable const { localStorage } = window; diff --git a/docs/2_PLUGINS.md b/docs/2_PLUGINS.md index 6ac4b24..705ea89 100644 --- a/docs/2_PLUGINS.md +++ b/docs/2_PLUGINS.md @@ -15,7 +15,7 @@ You don't need to run `pnpm build` every time you make a change. Instead, use `p 3. In `index.ts`, copy-paste the following template code: ```ts -import definePlugin from "../../utils/types"; +import definePlugin from "@utils/types"; export default definePlugin({ name: "Epic Plugin", diff --git a/src/VencordNative.ts b/src/VencordNative.ts index c984870..3cd53e1 100644 --- a/src/VencordNative.ts +++ b/src/VencordNative.ts @@ -16,10 +16,9 @@ * along with this program. If not, see . */ +import IPC_EVENTS from "@utils/IpcEvents"; import { IpcRenderer, ipcRenderer } from "electron"; -import IPC_EVENTS from "./utils/IpcEvents"; - function assertEventAllowed(event: string) { if (!(event in IPC_EVENTS)) throw new Error(`Event ${event} not allowed.`); } diff --git a/src/api/Commands/commandHelpers.ts b/src/api/Commands/commandHelpers.ts index 8986248..d363d6e 100644 --- a/src/api/Commands/commandHelpers.ts +++ b/src/api/Commands/commandHelpers.ts @@ -16,15 +16,15 @@ * along with this program. If not, see . */ +import { mergeDefaults } from "@utils/misc"; +import { findByCodeLazy, findByPropsLazy, waitFor } from "@webpack"; import { Message } from "discord-types/general"; import type { PartialDeep } from "type-fest"; -import { lazyWebpack, mergeDefaults } from "../../utils/misc"; -import { filters, waitFor } from "../../webpack"; import { Argument } from "./types"; -const createBotMessage = lazyWebpack(filters.byCode('username:"Clyde"')); -const MessageSender = lazyWebpack(filters.byProps("receiveMessage")); +const createBotMessage = findByCodeLazy('username:"Clyde"'); +const MessageSender = findByPropsLazy("receiveMessage"); let SnowflakeUtils: any; waitFor("fromTimestamp", m => SnowflakeUtils = m); diff --git a/src/api/Commands/index.ts b/src/api/Commands/index.ts index f31043c..88139d4 100644 --- a/src/api/Commands/index.ts +++ b/src/api/Commands/index.ts @@ -16,7 +16,8 @@ * along with this program. If not, see . */ -import { makeCodeblock } from "../../utils/misc"; +import { makeCodeblock } from "@utils/misc"; + import { sendBotMessage } from "./commandHelpers"; import { ApplicationCommandInputType, ApplicationCommandOptionType, ApplicationCommandType, Argument, Command, CommandContext, Option } from "./types"; diff --git a/src/api/MessageEvents.ts b/src/api/MessageEvents.ts index 02638b2..1bf6b0b 100644 --- a/src/api/MessageEvents.ts +++ b/src/api/MessageEvents.ts @@ -16,11 +16,10 @@ * along with this program. If not, see . */ +import Logger from "@utils/Logger"; +import { MessageStore } from "@webpack/common"; import type { Channel, Message } from "discord-types/general"; -import Logger from "../utils/Logger"; -import { MessageStore } from "../webpack/common"; - const MessageEventsLogger = new Logger("MessageEvents", "#e5c890"); export interface Emoji { diff --git a/src/api/Notices.ts b/src/api/Notices.ts index 4364ca5..6d20087 100644 --- a/src/api/Notices.ts +++ b/src/api/Notices.ts @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { waitFor } from "../webpack"; +import { waitFor } from "@webpack"; let NoticesModule: any; waitFor(m => m.show && m.dismiss && !m.suppressAll, m => NoticesModule = m); diff --git a/src/api/ServerList.ts b/src/api/ServerList.ts index d3a9a11..c98b174 100644 --- a/src/api/ServerList.ts +++ b/src/api/ServerList.ts @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import Logger from "../utils/Logger"; +import Logger from "@utils/Logger"; const logger = new Logger("ServerListAPI"); diff --git a/src/api/settings.ts b/src/api/settings.ts index dd8692a..b7499d1 100644 --- a/src/api/settings.ts +++ b/src/api/settings.ts @@ -16,13 +16,13 @@ * along with this program. If not, see . */ -import plugins from "~plugins"; +import IpcEvents from "@utils/IpcEvents"; +import Logger from "@utils/Logger"; +import { mergeDefaults } from "@utils/misc"; +import { OptionType } from "@utils/types"; +import { React } from "@webpack/common"; -import IpcEvents from "../utils/IpcEvents"; -import Logger from "../utils/Logger"; -import { mergeDefaults } from "../utils/misc"; -import { OptionType } from "../utils/types"; -import { React } from "../webpack/common"; +import plugins from "~plugins"; const logger = new Logger("Settings"); export interface Settings { diff --git a/src/components/CheckedTextInput.tsx b/src/components/CheckedTextInput.tsx index e97519d..cf4aa11 100644 --- a/src/components/CheckedTextInput.tsx +++ b/src/components/CheckedTextInput.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { React, TextInput } from "../webpack/common"; +import { React, TextInput } from "@webpack/common"; // TODO: Refactor settings to use this as well interface TextInputProps { diff --git a/src/components/DonateButton.tsx b/src/components/DonateButton.tsx index 6aae8ad..49f079b 100644 --- a/src/components/DonateButton.tsx +++ b/src/components/DonateButton.tsx @@ -16,8 +16,9 @@ * along with this program. If not, see . */ -import IpcEvents from "../utils/IpcEvents"; -import { Button } from "../webpack/common"; +import IpcEvents from "@utils/IpcEvents"; +import { Button } from "@webpack/common"; + import { Heart } from "./Heart"; export default function DonateButton(props: any) { diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx index 86a5946..8ebc61b 100644 --- a/src/components/ErrorBoundary.tsx +++ b/src/components/ErrorBoundary.tsx @@ -16,9 +16,10 @@ * along with this program. If not, see . */ -import Logger from "../utils/Logger"; -import { LazyComponent } from "../utils/misc"; -import { Margins, React } from "../webpack/common"; +import Logger from "@utils/Logger"; +import { LazyComponent } from "@utils/misc"; +import { Margins, React } from "@webpack/common"; + import { ErrorCard } from "./ErrorCard"; interface Props { diff --git a/src/components/ErrorCard.tsx b/src/components/ErrorCard.tsx index f83be38..e749ea4 100644 --- a/src/components/ErrorCard.tsx +++ b/src/components/ErrorCard.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { Card } from "../webpack/common"; +import { Card } from "@webpack/common"; interface Props { style?: React.CSSProperties; diff --git a/src/components/Flex.tsx b/src/components/Flex.tsx index 1987fab..430d857 100644 --- a/src/components/Flex.tsx +++ b/src/components/Flex.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import type { React } from "../webpack/common"; +import type { React } from "@webpack/common"; export function Flex(props: React.PropsWithChildren<{ flexDirection?: React.CSSProperties["flexDirection"]; diff --git a/src/components/Link.tsx b/src/components/Link.tsx index 2400ea6..0f4eb07 100644 --- a/src/components/Link.tsx +++ b/src/components/Link.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { React } from "../webpack/common"; +import { React } from "@webpack/common"; interface Props extends React.DetailedHTMLProps, HTMLAnchorElement> { disabled?: boolean; diff --git a/src/components/Monaco.ts b/src/components/Monaco.ts index 6d16c76..aa98f99 100644 --- a/src/components/Monaco.ts +++ b/src/components/Monaco.ts @@ -16,12 +16,12 @@ * along with this program. If not, see . */ -import monacoHtml from "~fileContent/monacoWin.html"; +import { debounce } from "@utils/debounce"; +import IpcEvents from "@utils/IpcEvents"; +import { Queue } from "@utils/Queue"; +import { find } from "@webpack"; -import { debounce } from "../utils/debounce"; -import IpcEvents from "../utils/IpcEvents"; -import { Queue } from "../utils/Queue"; -import { find } from "../webpack/webpack"; +import monacoHtml from "~fileContent/monacoWin.html"; const queue = new Queue(); const setCss = debounce((css: string) => { diff --git a/src/components/PatchHelper.tsx b/src/components/PatchHelper.tsx index 0314de8..22c2b4d 100644 --- a/src/components/PatchHelper.tsx +++ b/src/components/PatchHelper.tsx @@ -16,10 +16,11 @@ * along with this program. If not, see . */ -import { debounce } from "../utils/debounce"; -import { makeCodeblock } from "../utils/misc"; -import { Button, Clipboard, Forms, Margins, Parser, React, Switch, Text, TextInput } from "../webpack/common"; -import { search } from "../webpack/webpack"; +import { debounce } from "@utils/debounce"; +import { makeCodeblock } from "@utils/misc"; +import { search } from "@webpack"; +import { Button, Clipboard, Forms, Margins, Parser, React, Switch, Text, TextInput } from "@webpack/common"; + import { CheckedTextInput } from "./CheckedTextInput"; import ErrorBoundary from "./ErrorBoundary"; diff --git a/src/components/PluginSettings/PluginModal.tsx b/src/components/PluginSettings/PluginModal.tsx index 7331fff..275d370 100644 --- a/src/components/PluginSettings/PluginModal.tsx +++ b/src/components/PluginSettings/PluginModal.tsx @@ -16,17 +16,17 @@ * along with this program. If not, see . */ +import { generateId } from "@api/Commands"; +import { useSettings } from "@api/settings"; +import { LazyComponent } from "@utils/misc"; +import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize } from "@utils/modal"; +import { proxyLazy } from "@utils/proxyLazy"; +import { OptionType, Plugin } from "@utils/types"; +import { findByCode, findByPropsLazy } from "@webpack"; +import { Button, FluxDispatcher, Forms, React, Text, Tooltip, UserStore, UserUtils } from "@webpack/common"; import { User } from "discord-types/general"; import { Constructor } from "type-fest"; -import { generateId } from "../../api/Commands"; -import { useSettings } from "../../api/settings"; -import { LazyComponent, lazyWebpack } from "../../utils/misc"; -import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize } from "../../utils/modal"; -import { proxyLazy } from "../../utils/proxyLazy"; -import { OptionType, Plugin } from "../../utils/types"; -import { filters, findByCode } from "../../webpack"; -import { Button, FluxDispatcher, Forms, React, Text, Tooltip, UserStore, UserUtils } from "../../webpack/common"; import ErrorBoundary from "../ErrorBoundary"; import { Flex } from "../Flex"; import { @@ -40,7 +40,7 @@ import { } from "./components"; const UserSummaryItem = LazyComponent(() => findByCode("defaultRenderUser", "showDefaultAvatarsForNullUsers")); -const AvatarStyles = lazyWebpack(filters.byProps("moreUsers", "emptyUser", "avatarContainer", "clickableAvatar")); +const AvatarStyles = findByPropsLazy("moreUsers", "emptyUser", "avatarContainer", "clickableAvatar"); const UserRecord: Constructor> = proxyLazy(() => UserStore.getCurrentUser().constructor) as any; interface PluginModalProps extends ModalProps { diff --git a/src/components/PluginSettings/components/SettingBooleanComponent.tsx b/src/components/PluginSettings/components/SettingBooleanComponent.tsx index 99c1eae..0aaafa0 100644 --- a/src/components/PluginSettings/components/SettingBooleanComponent.tsx +++ b/src/components/PluginSettings/components/SettingBooleanComponent.tsx @@ -16,8 +16,9 @@ * along with this program. If not, see . */ -import { PluginOptionBoolean } from "../../../utils/types"; -import { Forms, React, Select } from "../../../webpack/common"; +import { PluginOptionBoolean } from "@utils/types"; +import { Forms, React, Select } from "@webpack/common"; + import { ISettingElementProps } from "."; export function SettingBooleanComponent({ option, pluginSettings, id, onChange, onError }: ISettingElementProps) { diff --git a/src/components/PluginSettings/components/SettingCustomComponent.tsx b/src/components/PluginSettings/components/SettingCustomComponent.tsx index dd704bf..af7192f 100644 --- a/src/components/PluginSettings/components/SettingCustomComponent.tsx +++ b/src/components/PluginSettings/components/SettingCustomComponent.tsx @@ -16,7 +16,8 @@ * along with this program. If not, see . */ -import { PluginOptionComponent } from "../../../utils/types"; +import { PluginOptionComponent } from "@utils/types"; + import { ISettingElementProps } from "."; export function SettingCustomComponent({ option, onChange, onError }: ISettingElementProps) { diff --git a/src/components/PluginSettings/components/SettingNumericComponent.tsx b/src/components/PluginSettings/components/SettingNumericComponent.tsx index 01e72dc..3457783 100644 --- a/src/components/PluginSettings/components/SettingNumericComponent.tsx +++ b/src/components/PluginSettings/components/SettingNumericComponent.tsx @@ -16,8 +16,9 @@ * along with this program. If not, see . */ -import { OptionType, PluginOptionNumber } from "../../../utils/types"; -import { Forms, React, TextInput } from "../../../webpack/common"; +import { OptionType, PluginOptionNumber } from "@utils/types"; +import { Forms, React, TextInput } from "@webpack/common"; + import { ISettingElementProps } from "."; const MAX_SAFE_NUMBER = BigInt(Number.MAX_SAFE_INTEGER); diff --git a/src/components/PluginSettings/components/SettingSelectComponent.tsx b/src/components/PluginSettings/components/SettingSelectComponent.tsx index ce35675..8a5bee1 100644 --- a/src/components/PluginSettings/components/SettingSelectComponent.tsx +++ b/src/components/PluginSettings/components/SettingSelectComponent.tsx @@ -16,8 +16,9 @@ * along with this program. If not, see . */ -import { PluginOptionSelect } from "../../../utils/types"; -import { Forms, React, Select } from "../../../webpack/common"; +import { PluginOptionSelect } from "@utils/types"; +import { Forms, React, Select } from "@webpack/common"; + import { ISettingElementProps } from "."; export function SettingSelectComponent({ option, pluginSettings, onChange, onError, id }: ISettingElementProps) { diff --git a/src/components/PluginSettings/components/SettingSliderComponent.tsx b/src/components/PluginSettings/components/SettingSliderComponent.tsx index ff1c491..2d31696 100644 --- a/src/components/PluginSettings/components/SettingSliderComponent.tsx +++ b/src/components/PluginSettings/components/SettingSliderComponent.tsx @@ -16,8 +16,9 @@ * along with this program. If not, see . */ -import { PluginOptionSlider } from "../../../utils/types"; -import { Forms, React, Slider } from "../../../webpack/common"; +import { PluginOptionSlider } from "@utils/types"; +import { Forms, React, Slider } from "@webpack/common"; + import { ISettingElementProps } from "."; export function makeRange(start: number, end: number, step = 1) { diff --git a/src/components/PluginSettings/components/SettingTextComponent.tsx b/src/components/PluginSettings/components/SettingTextComponent.tsx index f76bd58..b92fcec 100644 --- a/src/components/PluginSettings/components/SettingTextComponent.tsx +++ b/src/components/PluginSettings/components/SettingTextComponent.tsx @@ -16,8 +16,9 @@ * along with this program. If not, see . */ -import { PluginOptionString } from "../../../utils/types"; -import { Forms, React, TextInput } from "../../../webpack/common"; +import { PluginOptionString } from "@utils/types"; +import { Forms, React, TextInput } from "@webpack/common"; + import { ISettingElementProps } from "."; export function SettingTextComponent({ option, pluginSettings, id, onChange, onError }: ISettingElementProps) { diff --git a/src/components/PluginSettings/components/index.ts b/src/components/PluginSettings/components/index.ts index 507b53a..9e75068 100644 --- a/src/components/PluginSettings/components/index.ts +++ b/src/components/PluginSettings/components/index.ts @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { PluginOptionBase } from "../../../utils/types"; +import { PluginOptionBase } from "@utils/types"; export interface ISettingElementProps { option: T; @@ -35,3 +35,4 @@ export * from "./SettingNumericComponent"; export * from "./SettingSelectComponent"; export * from "./SettingSliderComponent"; export * from "./SettingTextComponent"; + diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx index f16d55c..495a509 100644 --- a/src/components/PluginSettings/index.tsx +++ b/src/components/PluginSettings/index.tsx @@ -16,18 +16,19 @@ * along with this program. If not, see . */ +import { showNotice } from "@api/Notices"; +import { Settings, useSettings } from "@api/settings"; +import { ChangeList } from "@utils/ChangeList"; +import Logger from "@utils/Logger"; +import { classes, LazyComponent } from "@utils/misc"; +import { openModalLazy } from "@utils/modal"; +import { Plugin } from "@utils/types"; +import { findByCode, findByPropsLazy } from "@webpack"; +import { Alerts, Button, Forms, Margins, Parser, React, Select, Switch, Text, TextInput, Toasts, Tooltip } from "@webpack/common"; + import Plugins from "~plugins"; -import { showNotice } from "../../api/Notices"; -import { Settings, useSettings } from "../../api/settings"; import { startDependenciesRecursive, startPlugin, stopPlugin } from "../../plugins"; -import { ChangeList } from "../../utils/ChangeList"; -import Logger from "../../utils/Logger"; -import { classes, LazyComponent, lazyWebpack } from "../../utils/misc"; -import { openModalLazy } from "../../utils/modal"; -import { Plugin } from "../../utils/types"; -import { filters, findByCode } from "../../webpack"; -import { Alerts, Button, Forms, Margins, Parser, React, Select, Switch, Text, TextInput, Toasts, Tooltip } from "../../webpack/common"; import ErrorBoundary from "../ErrorBoundary"; import { ErrorCard } from "../ErrorCard"; import { Flex } from "../Flex"; @@ -37,7 +38,7 @@ import * as styles from "./styles"; const logger = new Logger("PluginSettings", "#a6d189"); -const InputStyles = lazyWebpack(filters.byProps("inputDefault", "inputWrapper")); +const InputStyles = findByPropsLazy("inputDefault", "inputWrapper"); const CogWheel = LazyComponent(() => findByCode("18.564C15.797 19.099 14.932 19.498 14 19.738V22H10V19.738C9.069")); const InfoIcon = LazyComponent(() => findByCode("4.4408921e-16 C4.4771525,-1.77635684e-15 4.4408921e-16")); diff --git a/src/components/VencordSettings/BackupRestoreTab.tsx b/src/components/VencordSettings/BackupRestoreTab.tsx index ce0bdaa..73a1309 100644 --- a/src/components/VencordSettings/BackupRestoreTab.tsx +++ b/src/components/VencordSettings/BackupRestoreTab.tsx @@ -16,8 +16,9 @@ * along with this program. If not, see . */ -import { downloadSettingsBackup, uploadSettingsBackup } from "../../utils/settingsSync"; -import { Button, Card, Forms, Margins, Text } from "../../webpack/common"; +import { downloadSettingsBackup, uploadSettingsBackup } from "@utils/settingsSync"; +import { Button, Card, Forms, Margins, Text } from "@webpack/common"; + import ErrorBoundary from "../ErrorBoundary"; import { Flex } from "../Flex"; diff --git a/src/components/VencordSettings/Updater.tsx b/src/components/VencordSettings/Updater.tsx index 8f2b75b..7abfad9 100644 --- a/src/components/VencordSettings/Updater.tsx +++ b/src/components/VencordSettings/Updater.tsx @@ -16,11 +16,12 @@ * along with this program. If not, see . */ +import { classes, useAwaiter } from "@utils/misc"; +import { changes, checkForUpdates, getRepo, isNewer, rebuild, update, updateError, UpdateLogger } from "@utils/updater"; +import { Alerts, Button, Card, Forms, Margins, Parser, React, Toasts } from "@webpack/common"; + import gitHash from "~git-hash"; -import { classes, useAwaiter } from "../../utils/misc"; -import { changes, checkForUpdates, getRepo, isNewer, rebuild, update, updateError, UpdateLogger } from "../../utils/updater"; -import { Alerts, Button, Card, Forms, Margins, Parser, React, Toasts } from "../../webpack/common"; import ErrorBoundary from "../ErrorBoundary"; import { ErrorCard } from "../ErrorCard"; import { Flex } from "../Flex"; diff --git a/src/components/VencordSettings/VencordTab.tsx b/src/components/VencordSettings/VencordTab.tsx index 0e5846f..3a3f45f 100644 --- a/src/components/VencordSettings/VencordTab.tsx +++ b/src/components/VencordSettings/VencordTab.tsx @@ -17,10 +17,11 @@ */ -import { useSettings } from "../../api/settings"; -import IpcEvents from "../../utils/IpcEvents"; -import { useAwaiter } from "../../utils/misc"; -import { Button, Card, Forms, React, Switch } from "../../webpack/common"; +import { useSettings } from "@api/settings"; +import IpcEvents from "@utils/IpcEvents"; +import { useAwaiter } from "@utils/misc"; +import { Button, Card, Forms, React, Switch } from "@webpack/common"; + import DonateButton from "../DonateButton"; import ErrorBoundary from "../ErrorBoundary"; diff --git a/src/components/VencordSettings/index.tsx b/src/components/VencordSettings/index.tsx index 028bd5e..4b6fb4e 100644 --- a/src/components/VencordSettings/index.tsx +++ b/src/components/VencordSettings/index.tsx @@ -16,11 +16,11 @@ * along with this program. If not, see . */ +import { findByCodeLazy } from "@webpack"; +import { Forms, Router, Text } from "@webpack/common"; + import cssText from "~fileContent/settingsStyles.css"; -import { lazyWebpack } from "../../utils/misc"; -import { filters } from "../../webpack"; -import { Forms, React, Router, Text } from "../../webpack/common"; import ErrorBoundary from "../ErrorBoundary"; import BackupRestoreTab from "./BackupRestoreTab"; import PluginsTab from "./PluginsTab"; @@ -33,7 +33,7 @@ document.head.appendChild(style); const st = (style: string) => `vcSettings${style}`; -const TabBar = lazyWebpack(filters.byCode('[role="tab"][aria-disabled="false"]')); +const TabBar = findByCodeLazy('[role="tab"][aria-disabled="false"]'); interface SettingsProps { tab: string; diff --git a/src/components/handleComponentFailed.ts b/src/components/handleComponentFailed.ts index 34f3ab9..020e8ef 100644 --- a/src/components/handleComponentFailed.ts +++ b/src/components/handleComponentFailed.ts @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { isOutdated, rebuild, update } from "../utils/updater"; +import { isOutdated, rebuild, update } from "@utils/updater"; export async function handleComponentFailed() { if (isOutdated) { diff --git a/src/debug/Tracer.ts b/src/debug/Tracer.ts index 4e17143..185915a 100644 --- a/src/debug/Tracer.ts +++ b/src/debug/Tracer.ts @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import Logger from "../utils/Logger"; +import Logger from "@utils/Logger"; if (IS_DEV) { var traces = {} as Record; diff --git a/src/ipcMain/index.ts b/src/ipcMain/index.ts index 535c005..ba85eeb 100644 --- a/src/ipcMain/index.ts +++ b/src/ipcMain/index.ts @@ -18,6 +18,9 @@ import "./updater"; +import { debounce } from "@utils/debounce"; +import IpcEvents from "@utils/IpcEvents"; +import { Queue } from "@utils/Queue"; import { BrowserWindow, desktopCapturer, ipcMain, shell } from "electron"; import { mkdirSync, readFileSync, watch } from "fs"; import { open, readFile, writeFile } from "fs/promises"; @@ -25,9 +28,6 @@ import { join } from "path"; import monacoHtml from "~fileContent/../components/monacoWin.html;base64"; -import { debounce } from "../utils/debounce"; -import IpcEvents from "../utils/IpcEvents"; -import { Queue } from "../utils/Queue"; import { ALLOWED_PROTOCOLS, QUICKCSS_PATH, SETTINGS_DIR, SETTINGS_FILE } from "./constants"; mkdirSync(SETTINGS_DIR, { recursive: true }); diff --git a/src/ipcMain/updater/git.ts b/src/ipcMain/updater/git.ts index 7e4176a..07c94cb 100644 --- a/src/ipcMain/updater/git.ts +++ b/src/ipcMain/updater/git.ts @@ -16,12 +16,12 @@ * along with this program. If not, see . */ +import IpcEvents from "@utils/IpcEvents"; import { execFile as cpExecFile } from "child_process"; import { ipcMain } from "electron"; import { join } from "path"; import { promisify } from "util"; -import IpcEvents from "../../utils/IpcEvents"; import { calculateHashes, serializeErrors } from "./common"; const VENCORD_SRC_DIR = join(__dirname, ".."); diff --git a/src/ipcMain/updater/http.ts b/src/ipcMain/updater/http.ts index 523340f..902d644 100644 --- a/src/ipcMain/updater/http.ts +++ b/src/ipcMain/updater/http.ts @@ -16,6 +16,8 @@ * along with this program. If not, see . */ +import { VENCORD_USER_AGENT } from "@utils/constants"; +import IpcEvents from "@utils/IpcEvents"; import { ipcMain } from "electron"; import { writeFile } from "fs/promises"; import { join } from "path"; @@ -23,8 +25,6 @@ import { join } from "path"; import gitHash from "~git-hash"; import gitRemote from "~git-remote"; -import { VENCORD_USER_AGENT } from "../../utils/constants"; -import IpcEvents from "../../utils/IpcEvents"; import { get } from "../simpleGet"; import { calculateHashes, serializeErrors } from "./common"; diff --git a/src/modules.d.ts b/src/modules.d.ts index 78cc9a5..6901260 100644 --- a/src/modules.d.ts +++ b/src/modules.d.ts @@ -20,7 +20,7 @@ /// declare module "~plugins" { - const plugins: Record; + const plugins: Record; export default plugins; } diff --git a/src/patcher.ts b/src/patcher.ts index 28910b7..12cefc0 100644 --- a/src/patcher.ts +++ b/src/patcher.ts @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +import { onceDefined } from "@utils/onceDefined"; import electron, { app, BrowserWindowConstructorOptions } from "electron"; import { readFileSync } from "fs"; import { dirname, join } from "path"; @@ -23,7 +24,6 @@ import { dirname, join } from "path"; import { initIpc } from "./ipcMain"; import { installExt } from "./ipcMain/extensions"; import { readSettings } from "./ipcMain/index"; -import { onceDefined } from "./utils/onceDefined"; console.log("[Vencord] Starting up..."); diff --git a/src/plugins/BetterNotes.ts b/src/plugins/BetterNotes.ts index 15282b6..4184259 100644 --- a/src/plugins/BetterNotes.ts +++ b/src/plugins/BetterNotes.ts @@ -16,10 +16,10 @@ * along with this program. If not, see . */ -import { Settings } from "../api/settings"; -import { Devs } from "../utils/constants"; -import { makeLazy } from "../utils/misc"; -import definePlugin, { OptionType } from "../utils/types"; +import { Settings } from "@api/settings"; +import { Devs } from "@utils/constants"; +import { makeLazy } from "@utils/misc"; +import definePlugin, { OptionType } from "@utils/types"; export default definePlugin({ name: "BetterNotesBox", diff --git a/src/plugins/HideAttachments.tsx b/src/plugins/HideAttachments.tsx index 0789214..2c1a0d4 100644 --- a/src/plugins/HideAttachments.tsx +++ b/src/plugins/HideAttachments.tsx @@ -16,14 +16,13 @@ * along with this program. If not, see . */ +import { get, set } from "@api/DataStore"; +import { Devs } from "@utils/constants"; +import Logger from "@utils/Logger"; +import definePlugin from "@utils/types"; +import { ChannelStore, FluxDispatcher } from "@webpack/common"; import { Message } from "discord-types/general"; -import { get, set } from "../api/DataStore"; -import { Devs } from "../utils/constants"; -import Logger from "../utils/Logger"; -import definePlugin from "../utils/types"; -import { ChannelStore, FluxDispatcher } from "../webpack/common"; - let style: HTMLStyleElement; const KEY = "HideAttachments_HiddenIds"; diff --git a/src/plugins/TimeBarAllActivities.ts b/src/plugins/TimeBarAllActivities.ts index d4fe639..223f182 100644 --- a/src/plugins/TimeBarAllActivities.ts +++ b/src/plugins/TimeBarAllActivities.ts @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; export default definePlugin({ name: "TimeBarAllActivities", diff --git a/src/plugins/anonymiseFileNames.ts b/src/plugins/anonymiseFileNames.ts index c7c3ed5..f953a14 100644 --- a/src/plugins/anonymiseFileNames.ts +++ b/src/plugins/anonymiseFileNames.ts @@ -16,9 +16,9 @@ * along with this program. If not, see . */ -import { Devs } from "../utils/constants"; -import definePlugin, { OptionType } from "../utils/types"; -import { Settings } from "../Vencord"; +import { Settings } from "@api/settings"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; enum Methods { Random, diff --git a/src/plugins/apiBadges.tsx b/src/plugins/apiBadges.tsx index 831bf86..77ea46e 100644 --- a/src/plugins/apiBadges.tsx +++ b/src/plugins/apiBadges.tsx @@ -16,17 +16,17 @@ * along with this program. If not, see . */ -import { BadgePosition, ProfileBadge } from "../api/Badges"; -import DonateButton from "../components/DonateButton"; -import ErrorBoundary from "../components/ErrorBoundary"; -import { Flex } from "../components/Flex"; -import { Heart } from "../components/Heart"; -import { Devs } from "../utils/constants"; -import IpcEvents from "../utils/IpcEvents"; -import Logger from "../utils/Logger"; -import { closeModal, Modals, openModal } from "../utils/modal"; -import definePlugin from "../utils/types"; -import { Forms, Margins } from "../webpack/common"; +import { BadgePosition, ProfileBadge } from "@api/Badges"; +import DonateButton from "@components/DonateButton"; +import ErrorBoundary from "@components/ErrorBoundary"; +import { Flex } from "@components/Flex"; +import { Heart } from "@components/Heart"; +import { Devs } from "@utils/constants"; +import IpcEvents from "@utils/IpcEvents"; +import Logger from "@utils/Logger"; +import { closeModal, Modals, openModal } from "@utils/modal"; +import definePlugin from "@utils/types"; +import { Forms, Margins } from "@webpack/common"; const CONTRIBUTOR_BADGE = "https://media.discordapp.net/stickers/1026517526106087454.webp"; diff --git a/src/plugins/apiCommands.ts b/src/plugins/apiCommands.ts index 4136deb..e92b904 100644 --- a/src/plugins/apiCommands.ts +++ b/src/plugins/apiCommands.ts @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; export default definePlugin({ name: "CommandsAPI", diff --git a/src/plugins/apiMenuItemDeobfuscator.ts b/src/plugins/apiMenuItemDeobfuscator.ts index 40d53f1..5703456 100644 --- a/src/plugins/apiMenuItemDeobfuscator.ts +++ b/src/plugins/apiMenuItemDeobfuscator.ts @@ -16,9 +16,9 @@ * along with this program. If not, see . */ -import { migratePluginSettings } from "../api/settings"; -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { migratePluginSettings } from "@api/settings"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; // duplicate values have multiple branches with different types. Just include all to be safe const nameMap = { diff --git a/src/plugins/apiMessageAccessories.ts b/src/plugins/apiMessageAccessories.ts index ee3ee90..0b30b58 100644 --- a/src/plugins/apiMessageAccessories.ts +++ b/src/plugins/apiMessageAccessories.ts @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; export default definePlugin({ name: "MessageAccessoriesAPI", diff --git a/src/plugins/apiMessageEvents.ts b/src/plugins/apiMessageEvents.ts index bf7c7f5..13fbc4c 100644 --- a/src/plugins/apiMessageEvents.ts +++ b/src/plugins/apiMessageEvents.ts @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; export default definePlugin({ name: "MessageEventsAPI", diff --git a/src/plugins/apiNotices.ts b/src/plugins/apiNotices.ts index f53c535..a93334b 100644 --- a/src/plugins/apiNotices.ts +++ b/src/plugins/apiNotices.ts @@ -16,9 +16,9 @@ * along with this program. If not, see . */ -import { migratePluginSettings } from "../api/settings"; -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { migratePluginSettings } from "@api/settings"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; migratePluginSettings("NoticesAPI", "NoticesApi"); diff --git a/src/plugins/apiServerList.ts b/src/plugins/apiServerList.ts index 134870e..77498ac 100644 --- a/src/plugins/apiServerList.ts +++ b/src/plugins/apiServerList.ts @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; export default definePlugin({ name: "ServerListAPI", diff --git a/src/plugins/arRPC.tsx b/src/plugins/arRPC.tsx index 081ea48..cba3504 100644 --- a/src/plugins/arRPC.tsx +++ b/src/plugins/arRPC.tsx @@ -16,13 +16,12 @@ * along with this program. If not, see . */ -import { popNotice, showNotice } from "../api/Notices"; -import { Link } from "../components/Link"; -import { Devs } from "../utils/constants"; -import { lazyWebpack } from "../utils/misc"; -import definePlugin from "../utils/types"; -import { filters, mapMangledModuleLazy } from "../webpack"; -import { FluxDispatcher, Forms, Toasts } from "../webpack/common"; +import { popNotice, showNotice } from "@api/Notices"; +import { Link } from "@components/Link"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; +import { filters, findByCodeLazy, mapMangledModuleLazy } from "@webpack"; +import { FluxDispatcher, Forms, Toasts } from "@webpack/common"; const assetManager = mapMangledModuleLazy( "getAssetImage: size must === [number, number] for Twitch", @@ -31,7 +30,7 @@ const assetManager = mapMangledModuleLazy( } ); -const rpcManager = lazyWebpack(filters.byCode(".APPLICATION_RPC(")); +const rpcManager = findByCodeLazy(".APPLICATION_RPC("); async function lookupAsset(applicationId: string, key: string): Promise { return (await assetManager.getAsset(applicationId, [key, undefined]))[0]; diff --git a/src/plugins/banger.ts b/src/plugins/banger.ts index 6263224..68163cb 100644 --- a/src/plugins/banger.ts +++ b/src/plugins/banger.ts @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -import { Devs } from "../utils/constants"; -import definePlugin, { OptionType } from "../utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; export default definePlugin({ name: "BANger", diff --git a/src/plugins/betterGifAltText.ts b/src/plugins/betterGifAltText.ts index 56d7b54..686ef0a 100644 --- a/src/plugins/betterGifAltText.ts +++ b/src/plugins/betterGifAltText.ts @@ -17,8 +17,8 @@ */ -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; export default definePlugin({ name: "BetterGifAltText", diff --git a/src/plugins/betterRoleDot.ts b/src/plugins/betterRoleDot.ts index 37a2ea7..3b2ac39 100644 --- a/src/plugins/betterRoleDot.ts +++ b/src/plugins/betterRoleDot.ts @@ -16,10 +16,10 @@ * along with this program. If not, see . */ -import { migratePluginSettings, Settings } from "../api/settings"; -import { Devs } from "../utils/constants"; -import definePlugin, { OptionType } from "../utils/types"; -import { Clipboard, Toasts } from "../webpack/common"; +import { migratePluginSettings, Settings } from "@api/settings"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; +import { Clipboard, Toasts } from "@webpack/common"; migratePluginSettings("BetterRoleDot", "ClickableRoleDot"); export default definePlugin({ diff --git a/src/plugins/betterUploadButton.ts b/src/plugins/betterUploadButton.ts index 94c1f49..64a3785 100644 --- a/src/plugins/betterUploadButton.ts +++ b/src/plugins/betterUploadButton.ts @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; export default definePlugin({ name: "BetterUploadButton", diff --git a/src/plugins/blurNsfw.ts b/src/plugins/blurNsfw.ts index 8f4178f..5521897 100644 --- a/src/plugins/blurNsfw.ts +++ b/src/plugins/blurNsfw.ts @@ -16,9 +16,9 @@ * along with this program. If not, see . */ -import { Settings } from "../api/settings"; -import { Devs } from "../utils/constants"; -import definePlugin, { OptionType } from "../utils/types"; +import { Settings } from "@api/settings"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; let style: HTMLStyleElement; diff --git a/src/plugins/callTimer.tsx b/src/plugins/callTimer.tsx index 40aa160..6a1d357 100644 --- a/src/plugins/callTimer.tsx +++ b/src/plugins/callTimer.tsx @@ -16,11 +16,11 @@ * along with this program. If not, see . */ -import { Settings } from "../api/settings"; -import ErrorBoundary from "../components/ErrorBoundary"; -import { Devs } from "../utils/constants"; -import definePlugin, { OptionType } from "../utils/types"; -import { React } from "../webpack/common"; +import { Settings } from "@api/settings"; +import ErrorBoundary from "@components/ErrorBoundary"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; +import { React } from "@webpack/common"; function formatDuration(ms: number) { // here be dragons (moment fucking sucks) diff --git a/src/plugins/clearURLs/index.ts b/src/plugins/clearURLs/index.ts index f5b8909..178a0e1 100644 --- a/src/plugins/clearURLs/index.ts +++ b/src/plugins/clearURLs/index.ts @@ -22,10 +22,11 @@ import { MessageObject, removePreEditListener, removePreSendListener -} from "../../api/MessageEvents"; -import { migratePluginSettings } from "../../api/settings"; -import { Devs } from "../../utils/constants"; -import definePlugin from "../../utils/types"; +} from "@api/MessageEvents"; +import { migratePluginSettings } from "@api/settings"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; + import { defaultRules } from "./defaultRules"; // From lodash diff --git a/src/plugins/consoleShortcuts.ts b/src/plugins/consoleShortcuts.ts index eeb5d8d..ae0de9f 100644 --- a/src/plugins/consoleShortcuts.ts +++ b/src/plugins/consoleShortcuts.ts @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; const WEB_ONLY = (f: string) => () => { throw new Error(`'${f}' is Discord Desktop only.`); diff --git a/src/plugins/corruptMp4s.ts b/src/plugins/corruptMp4s.ts index 05cdf5f..5ae25ee 100644 --- a/src/plugins/corruptMp4s.ts +++ b/src/plugins/corruptMp4s.ts @@ -16,12 +16,12 @@ * along with this program. If not, see . */ -import { ApplicationCommandOptionType, sendBotMessage } from "../api/Commands"; -import { findOption } from "../api/Commands/commandHelpers"; -import { ApplicationCommandInputType } from "../api/Commands/types"; -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; -import { findByCode, findByProps } from "../webpack"; +import { ApplicationCommandOptionType, sendBotMessage } from "@api/Commands"; +import { findOption } from "@api/Commands/commandHelpers"; +import { ApplicationCommandInputType } from "@api/Commands/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; +import { findByCode, findByProps } from "@webpack"; const DRAFT_TYPE = 0; diff --git a/src/plugins/dictionary.ts b/src/plugins/dictionary.ts index 547636d..14ee37b 100644 --- a/src/plugins/dictionary.ts +++ b/src/plugins/dictionary.ts @@ -16,10 +16,10 @@ * along with this program. If not, see . */ -import { ApplicationCommandOptionType, sendBotMessage } from "../api/Commands"; -import { ApplicationCommandInputType } from "../api/Commands/types"; -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { ApplicationCommandOptionType, sendBotMessage } from "@api/Commands"; +import { ApplicationCommandInputType } from "@api/Commands/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; export default definePlugin({ name: "UrbanDictionary", diff --git a/src/plugins/emoteCloner.tsx b/src/plugins/emoteCloner.tsx index 0b1190b..36b283e 100644 --- a/src/plugins/emoteCloner.tsx +++ b/src/plugins/emoteCloner.tsx @@ -16,20 +16,20 @@ * along with this program. If not, see . */ -import { migratePluginSettings, Settings } from "../api/settings"; -import { CheckedTextInput } from "../components/CheckedTextInput"; -import { Devs } from "../utils/constants"; -import Logger from "../utils/Logger"; -import { lazyWebpack, makeLazy } from "../utils/misc"; -import { ModalContent, ModalHeader, ModalRoot, openModal } from "../utils/modal"; -import definePlugin from "../utils/types"; -import { filters } from "../webpack"; -import { Forms, GuildStore, Margins, Menu, PermissionStore, React, Toasts, Tooltip, UserStore } from "../webpack/common"; +import { migratePluginSettings, Settings } from "@api/settings"; +import { CheckedTextInput } from "@components/CheckedTextInput"; +import { Devs } from "@utils/constants"; +import Logger from "@utils/Logger"; +import { makeLazy } from "@utils/misc"; +import { ModalContent, ModalHeader, ModalRoot, openModal } from "@utils/modal"; +import definePlugin from "@utils/types"; +import { findByCodeLazy, findByPropsLazy } from "@webpack"; +import { Forms, GuildStore, Margins, Menu, PermissionStore, React, Toasts, Tooltip, UserStore } from "@webpack/common"; const MANAGE_EMOJIS_AND_STICKERS = 1n << 30n; -const GuildEmojiStore = lazyWebpack(filters.byProps("getGuilds", "getGuildEmoji")); -const uploadEmoji = lazyWebpack(filters.byCode('"EMOJI_UPLOAD_START"', "GUILD_EMOJIS(")); +const GuildEmojiStore = findByPropsLazy("getGuilds", "getGuildEmoji"); +const uploadEmoji = findByCodeLazy('"EMOJI_UPLOAD_START"', "GUILD_EMOJIS("); function getGuildCandidates(isAnimated: boolean) { const meId = UserStore.getCurrentUser().id; diff --git a/src/plugins/experiments.tsx b/src/plugins/experiments.tsx index 4f83c5a..3019e64 100644 --- a/src/plugins/experiments.tsx +++ b/src/plugins/experiments.tsx @@ -16,14 +16,13 @@ * along with this program. If not, see . */ -import { Devs } from "../utils/constants"; -import { lazyWebpack } from "../utils/misc"; -import definePlugin, { OptionType } from "../utils/types"; -import { Settings } from "../Vencord"; -import { filters } from "../webpack"; -import { Forms, React } from "../webpack/common"; +import { Settings } from "@api/settings"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; +import { findByPropsLazy } from "@webpack"; +import { Forms, React } from "@webpack/common"; -const KbdStyles = lazyWebpack(filters.byProps("key", "removeBuildOverride")); +const KbdStyles = findByPropsLazy("key", "removeBuildOverride"); export default definePlugin({ name: "Experiments", diff --git a/src/plugins/fakeNitro.ts b/src/plugins/fakeNitro.ts index c682324..0a1985a 100644 --- a/src/plugins/fakeNitro.ts +++ b/src/plugins/fakeNitro.ts @@ -16,18 +16,16 @@ * along with this program. If not, see . */ -import { addPreEditListener, addPreSendListener, removePreEditListener, removePreSendListener } from "../api/MessageEvents"; -import { migratePluginSettings } from "../api/settings"; -import { Devs } from "../utils/constants"; -import { ApngDisposeOp, getGifEncoder, importApngJs } from "../utils/dependencies"; -import { lazyWebpack } from "../utils/misc"; -import definePlugin, { OptionType } from "../utils/types"; -import { Settings } from "../Vencord"; -import { filters } from "../webpack"; -import { ChannelStore, UserStore } from "../webpack/common"; +import { addPreEditListener, addPreSendListener, removePreEditListener, removePreSendListener } from "@api/MessageEvents"; +import { migratePluginSettings, Settings } from "@api/settings"; +import { Devs } from "@utils/constants"; +import { ApngDisposeOp, getGifEncoder, importApngJs } from "@utils/dependencies"; +import definePlugin, { OptionType } from "@utils/types"; +import { findByCodeLazy, findByPropsLazy } from "@webpack"; +import { ChannelStore, UserStore } from "@webpack/common"; const DRAFT_TYPE = 0; -const promptToUpload = lazyWebpack(filters.byCode("UPLOAD_FILE_LIMIT_ERROR")); +const promptToUpload = findByCodeLazy("UPLOAD_FILE_LIMIT_ERROR"); interface BaseSticker { available: boolean; @@ -225,8 +223,8 @@ export default definePlugin({ return; } - const EmojiStore = lazyWebpack(filters.byProps("getCustomEmojiById")); - const StickerStore = lazyWebpack(filters.byProps("getAllGuildStickers")) as { + const EmojiStore = findByPropsLazy("getCustomEmojiById"); + const StickerStore = findByPropsLazy("getAllGuildStickers") as { getPremiumPacks(): StickerPack[]; getAllGuildStickers(): Map; getStickerById(id: string): Sticker | undefined; diff --git a/src/plugins/fart.ts b/src/plugins/fart.ts index 88e95af..9404b39 100644 --- a/src/plugins/fart.ts +++ b/src/plugins/fart.ts @@ -16,11 +16,11 @@ * along with this program. If not, see . */ -import { ApplicationCommandOptionType } from "../api/Commands"; -import { makeRange } from "../components/PluginSettings/components"; -import { Devs } from "../utils/constants"; -import definePlugin, { OptionType } from "../utils/types"; -import { Settings } from "../Vencord"; +import { ApplicationCommandOptionType } from "@api/Commands"; +import { Settings } from "@api/settings"; +import { makeRange } from "@components/PluginSettings/components"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; export default definePlugin({ name: "Fart2", diff --git a/src/plugins/forceOwnerCrown.ts b/src/plugins/forceOwnerCrown.ts index a26e6e2..9345ea7 100644 --- a/src/plugins/forceOwnerCrown.ts +++ b/src/plugins/forceOwnerCrown.ts @@ -16,9 +16,9 @@ * along with this program. If not, see . */ -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; -import { waitFor } from "../webpack"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; +import { waitFor } from "@webpack"; let GuildStore; waitFor(["getGuild"], m => GuildStore = m); diff --git a/src/plugins/friendInvites.ts b/src/plugins/friendInvites.ts index 24ca50a..73dffd1 100644 --- a/src/plugins/friendInvites.ts +++ b/src/plugins/friendInvites.ts @@ -16,10 +16,10 @@ * along with this program. If not, see . */ -import { ApplicationCommandInputType, sendBotMessage } from "../api/Commands"; -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; -import { findByProps } from "../webpack"; +import { ApplicationCommandInputType, sendBotMessage } from "@api/Commands"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; +import { findByProps } from "@webpack"; export default definePlugin({ name: "FriendInvites", diff --git a/src/plugins/fxTwitter.ts b/src/plugins/fxTwitter.ts index 4bb00d9..efe1ebc 100644 --- a/src/plugins/fxTwitter.ts +++ b/src/plugins/fxTwitter.ts @@ -16,9 +16,9 @@ * along with this program. If not, see . */ -import { addPreSendListener, MessageObject, removePreSendListener } from "../api/MessageEvents"; -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { addPreSendListener, MessageObject, removePreSendListener } from "@api/MessageEvents"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; const re = /https?:\/\/twitter\.com(?=\/\w+?\/status\/)/g; diff --git a/src/plugins/iLoveSpam.ts b/src/plugins/iLoveSpam.ts index 7f390f3..79b2e3f 100644 --- a/src/plugins/iLoveSpam.ts +++ b/src/plugins/iLoveSpam.ts @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; export default definePlugin({ name: "iLoveSpam", diff --git a/src/plugins/ignoreActivities.ts b/src/plugins/ignoreActivities.ts index d33d5cc..a39b026 100644 --- a/src/plugins/ignoreActivities.ts +++ b/src/plugins/ignoreActivities.ts @@ -16,11 +16,10 @@ * along with this program. If not, see . */ -import { DataStore } from "../api"; -import { Devs } from "../utils/constants"; -import { lazyWebpack } from "../utils/misc"; -import definePlugin from "../utils/types"; -import { filters } from "../webpack"; +import * as DataStore from "@api/DataStore"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; +import { findByPropsLazy } from "@webpack"; interface MatchAndReplace { match: RegExp; @@ -28,7 +27,7 @@ interface MatchAndReplace { } /** Used to re-render the Registered Games tab to update how our button looks like */ -const RunningGameStoreModule = lazyWebpack(filters.byProps("IgnoreActivities_reRenderGames")); +const RunningGameStoreModule = findByPropsLazy("IgnoreActivities_reRenderGames"); let ignoredActivitiesCache: string[] = []; diff --git a/src/plugins/index.ts b/src/plugins/index.ts index 68a76cb..c0325d4 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -16,13 +16,14 @@ * along with this program. If not, see . */ +import { registerCommand, unregisterCommand } from "@api/Commands"; +import { Settings } from "@api/settings"; +import Logger from "@utils/Logger"; +import { Patch, Plugin } from "@utils/types"; + import Plugins from "~plugins"; -import { registerCommand, unregisterCommand } from "../api/Commands"; -import { Settings } from "../api/settings"; import { traceFunction } from "../debug/Tracer"; -import Logger from "../utils/Logger"; -import { Patch, Plugin } from "../utils/types"; const logger = new Logger("PluginManager", "#a6d189"); diff --git a/src/plugins/keepCurrentChannel.ts b/src/plugins/keepCurrentChannel.ts index 395fd76..0d7147c 100644 --- a/src/plugins/keepCurrentChannel.ts +++ b/src/plugins/keepCurrentChannel.ts @@ -16,10 +16,10 @@ * along with this program. If not, see . */ -import { DataStore } from "../api"; -import { Devs } from "../utils/constants"; -import definePlugin from "../utils/types"; -import { ChannelStore, FluxDispatcher, NavigationRouter, SelectedChannelStore, SelectedGuildStore } from "../webpack/common"; +import * as DataStore from "@api/DataStore"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; +import { ChannelStore, FluxDispatcher, NavigationRouter, SelectedChannelStore, SelectedGuildStore } from "@webpack/common"; export interface LogoutEvent { type: "LOGOUT"; diff --git a/src/plugins/lastfm.tsx b/src/plugins/lastfm.tsx index 280c0ee..bf3f63c 100644 --- a/src/plugins/lastfm.tsx +++ b/src/plugins/lastfm.tsx @@ -16,43 +16,43 @@ * along with this program. If not, see . */ -import { Link } from "../components/Link"; -import { Devs } from "../utils/constants"; -import { lazyWebpack } from "../utils/misc"; -import definePlugin, { OptionType } from "../utils/types"; -import { Settings, Webpack } from "../Vencord"; -import { FluxDispatcher, Forms } from "../webpack/common"; +import { Settings } from "@api/settings"; +import { Link } from "@components/Link"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; +import { filters, findByPropsLazy, mapMangledModuleLazy } from "@webpack"; +import { FluxDispatcher, Forms } from "@webpack/common"; interface ActivityAssets { - large_image?: string - large_text?: string - small_image?: string - small_text?: string + large_image?: string; + large_text?: string; + small_image?: string; + small_text?: string; } interface Activity { - state: string - details?: string + state: string; + details?: string; timestamps?: { - start?: Number - } - assets?: ActivityAssets - buttons?: Array - name: string - application_id: string + start?: Number; + }; + assets?: ActivityAssets; + buttons?: Array; + name: string; + application_id: string; metadata?: { - button_urls?: Array - } - type: Number - flags: Number + button_urls?: Array; + }; + type: Number; + flags: Number; } interface TrackData { - name: string - album: string - artist: string - url: string - imageUrl?: string + name: string; + album: string; + artist: string; + ur