aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorVen <vendicated@riseup.net>2022-11-28 13:37:55 +0100
committerGitHub <noreply@github.com>2022-11-28 13:37:55 +0100
commitbad96b78879f296d5b9e7adacb03756b0f58427a (patch)
tree4ddbc57a29e9b201bee1317f18110e8e1ad320e5 /src/components
parent7a4402f1425ea9fdc6d2b3c985a4ce831f405937 (diff)
downloadVencord-bad96b78879f296d5b9e7adacb03756b0f58427a.tar.gz
Vencord-bad96b78879f296d5b9e7adacb03756b0f58427a.tar.bz2
Vencord-bad96b78879f296d5b9e7adacb03756b0f58427a.zip
Path aliases, better lazyWebpack (#268)
Diffstat (limited to 'src/components')
-rw-r--r--src/components/CheckedTextInput.tsx2
-rw-r--r--src/components/DonateButton.tsx5
-rw-r--r--src/components/ErrorBoundary.tsx7
-rw-r--r--src/components/ErrorCard.tsx2
-rw-r--r--src/components/Flex.tsx2
-rw-r--r--src/components/Link.tsx2
-rw-r--r--src/components/Monaco.ts10
-rw-r--r--src/components/PatchHelper.tsx9
-rw-r--r--src/components/PluginSettings/PluginModal.tsx18
-rw-r--r--src/components/PluginSettings/components/SettingBooleanComponent.tsx5
-rw-r--r--src/components/PluginSettings/components/SettingCustomComponent.tsx3
-rw-r--r--src/components/PluginSettings/components/SettingNumericComponent.tsx5
-rw-r--r--src/components/PluginSettings/components/SettingSelectComponent.tsx5
-rw-r--r--src/components/PluginSettings/components/SettingSliderComponent.tsx5
-rw-r--r--src/components/PluginSettings/components/SettingTextComponent.tsx5
-rw-r--r--src/components/PluginSettings/components/index.ts3
-rw-r--r--src/components/PluginSettings/index.tsx21
-rw-r--r--src/components/VencordSettings/BackupRestoreTab.tsx5
-rw-r--r--src/components/VencordSettings/Updater.tsx7
-rw-r--r--src/components/VencordSettings/VencordTab.tsx9
-rw-r--r--src/components/VencordSettings/index.tsx8
-rw-r--r--src/components/handleComponentFailed.ts2
22 files changed, 77 insertions, 63 deletions
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 <https://www.gnu.org/licenses/>.
*/
-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 <https://www.gnu.org/licenses/>.
*/
-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 <https://www.gnu.org/licenses/>.
*/
-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 <https://www.gnu.org/licenses/>.
*/
-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 <https://www.gnu.org/licenses/>.
*/
-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 <https://www.gnu.org/licenses/>.
*/
-import { React } from "../webpack/common";
+import { React } from "@webpack/common";
interface Props extends React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, 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 <https://www.gnu.org/licenses/>.
*/
-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 <https://www.gnu.org/licenses/>.
*/
-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 <https://www.gnu.org/licenses/>.
*/
+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<Partial<User>> = 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 <https://www.gnu.org/licenses/>.
*/
-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<PluginOptionBoolean>) {
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 <https://www.gnu.org/licenses/>.
*/
-import { PluginOptionComponent } from "../../../utils/types";
+import { PluginOptionComponent } from "@utils/types";
+
import { ISettingElementProps } from ".";
export function SettingCustomComponent({ option, onChange, onError }: ISettingElementProps<PluginOptionComponent>) {
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 <https://www.gnu.org/licenses/>.
*/
-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 <https://www.gnu.org/licenses/>.
*/
-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<PluginOptionSelect>) {
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 <https://www.gnu.org/licenses/>.
*/
-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 <https://www.gnu.org/licenses/>.
*/
-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<PluginOptionString>) {
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 <https://www.gnu.org/licenses/>.
*/
-import { PluginOptionBase } from "../../../utils/types";
+import { PluginOptionBase } from "@utils/types";
export interface ISettingElementProps<T extends PluginOptionBase> {
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 <https://www.gnu.org/licenses/>.
*/
+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 <https://www.gnu.org/licenses/>.
*/
-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 <https://www.gnu.org/licenses/>.
*/
+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 <https://www.gnu.org/licenses/>.
*/
+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 <https://www.gnu.org/licenses/>.
*/
-import { isOutdated, rebuild, update } from "../utils/updater";
+import { isOutdated, rebuild, update } from "@utils/updater";
export async function handleComponentFailed() {
if (isOutdated) {