diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx index 33a472c1a..e6b2cf1fb 100644 --- a/src/components/PluginSettings/index.tsx +++ b/src/components/PluginSettings/index.tsx @@ -27,6 +27,7 @@ import PluginModal from "@components/PluginSettings/PluginModal"; import { AddonCard } from "@components/VencordSettings/AddonCard"; import { SettingsTab } from "@components/VencordSettings/shared"; import { ChangeList } from "@utils/ChangeList"; +import { proxyLazy } from "@utils/lazy"; import { Logger } from "@utils/Logger"; import { Margins } from "@utils/margins"; import { classes, isObjectEmpty } from "@utils/misc"; @@ -38,8 +39,8 @@ import { Alerts, Button, Card, Forms, lodash, Parser, React, Select, Text, TextI import Plugins from "~plugins"; -import { startDependenciesRecursive, startPlugin, stopPlugin } from "../../plugins"; - +// Avoid circular dependency +const { startDependenciesRecursive, startPlugin, stopPlugin } = proxyLazy(() => require("../../plugins")); const cl = classNameFactory("vc-plugins-"); const logger = new Logger("PluginSettings", "#a6d189"); diff --git a/src/plugins/_api/badges/index.tsx b/src/plugins/_api/badges/index.tsx index 5493d4b6a..bbccf0a11 100644 --- a/src/plugins/_api/badges/index.tsx +++ b/src/plugins/_api/badges/index.tsx @@ -23,6 +23,7 @@ import DonateButton from "@components/DonateButton"; import ErrorBoundary from "@components/ErrorBoundary"; import { Flex } from "@components/Flex"; import { Heart } from "@components/Heart"; +import { openContributorModal } from "@components/PluginSettings/ContributorModal"; import { Devs } from "@utils/constants"; import { Margins } from "@utils/margins"; import { isPluginDev } from "@utils/misc"; @@ -37,12 +38,7 @@ const ContributorBadge: ProfileBadge = { image: CONTRIBUTOR_BADGE, position: BadgePosition.START, shouldShow: ({ user }) => isPluginDev(user.id), - onClick(_, { user }) { - // circular import shenanigans - const { openContributorModal } = require("@components/PluginSettings/ContributorModal") as typeof import("@components/PluginSettings/ContributorModal"); - // setImmediate is needed to run on later tick to workaround limitation in proxyLazy - setImmediate(() => openContributorModal(user)); - } + onClick: (_, { user }) => openContributorModal(user) }; let DonorBadges = {} as Record>>; diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index 1aea0d6ee..772ee9b64 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -17,6 +17,13 @@ */ import { Settings } from "@api/Settings"; +import BackupAndRestoreTab from "@components/VencordSettings/BackupAndRestoreTab"; +import CloudTab from "@components/VencordSettings/CloudTab"; +import PatchHelperTab from "@components/VencordSettings/PatchHelperTab"; +import PluginsTab from "@components/VencordSettings/PluginsTab"; +import ThemesTab from "@components/VencordSettings/ThemesTab"; +import UpdaterTab from "@components/VencordSettings/UpdaterTab"; +import VencordTab from "@components/VencordSettings/VencordTab"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { React } from "@webpack/common"; @@ -36,7 +43,7 @@ export default definePlugin({ match: /\[\(0,.{1,3}\.jsxs?\)\((.{1,10}),(\{[^{}}]+\{.{0,20}.versionHash,.+?\})\)," "/, replace: (m, component, props) => { props = props.replace(/children:\[.+\]/, ""); - return `${m},Vencord.Plugins.plugins.Settings.makeInfoElements(${component}, ${props})`; + return `${m},$self.makeInfoElements(${component}, ${props})`; } } ] @@ -77,43 +84,43 @@ export default definePlugin({ { section: "VencordSettings", label: "Vencord", - element: require("@components/VencordSettings/VencordTab").default, + element: VencordTab, className: "vc-settings" }, { section: "VencordPlugins", label: "Plugins", - element: require("@components/VencordSettings/PluginsTab").default, + element: PluginsTab, className: "vc-plugins" }, { section: "VencordThemes", label: "Themes", - element: require("@components/VencordSettings/ThemesTab").default, + element: ThemesTab, className: "vc-themes" }, !IS_UPDATER_DISABLED && { section: "VencordUpdater", label: "Updater", - element: require("@components/VencordSettings/UpdaterTab").default, + element: UpdaterTab, className: "vc-updater" }, { section: "VencordCloud", label: "Cloud", - element: require("@components/VencordSettings/CloudTab").default, + element: CloudTab, className: "vc-cloud" }, { section: "VencordSettingsSync", label: "Backup & Restore", - element: require("@components/VencordSettings/BackupAndRestoreTab").default, + element: BackupAndRestoreTab, className: "vc-backup-restore" }, IS_DEV && { section: "VencordPatchHelper", label: "Patch Helper", - element: require("@components/VencordSettings/PatchHelperTab").default, + element: PatchHelperTab, className: "vc-patch-helper" }, ...this.customSections.map(func => func(SectionTypes)),