From c2d12321f684c4c9398e322be49862327f68d767 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Wed, 13 Aug 2025 01:27:49 +0700 Subject: [PATCH] chore(lib/modules): simplify imports --- lib/assets/src/preinit.ts | 10 ++++---- lib/discord/src/actions.ts | 5 +--- lib/discord/src/common/flux.ts | 2 +- lib/discord/src/common/index.ts | 2 +- lib/discord/src/common/utils.ts | 2 +- lib/discord/src/design.ts | 2 +- lib/discord/src/flux/stores.ts | 10 ++++---- lib/discord/src/modules/main_tabs_v2.ts | 2 +- lib/discord/src/modules/settings/renderer.ts | 2 +- lib/discord/src/preinit.ts | 2 +- lib/discord/src/start.ts | 2 +- lib/externals/src/browserify.ts | 2 +- lib/externals/src/react-native-clipboard.ts | 2 +- lib/externals/src/react-navigation.ts | 2 +- lib/externals/src/shopify.ts | 2 +- lib/modules/package.json | 12 +++------ lib/modules/src/finders/index.ts | 3 +++ lib/plugins/src/apis/modules.ts | 26 ++++++-------------- lib/react/src/index.ts | 2 +- lib/utils/src/discord.ts | 2 +- scripts/types.ts | 4 +-- src/plugins/preinit/no-track/index.ts | 2 +- src/plugins/start/error-boundary/index.tsx | 2 +- src/plugins/start/settings/index.ts | 4 +-- src/plugins/start/staff-settings/index.ts | 2 +- src/plugins/start/user-badges/index.tsx | 2 +- 26 files changed, 45 insertions(+), 65 deletions(-) create mode 100644 lib/modules/src/finders/index.ts diff --git a/lib/assets/src/preinit.ts b/lib/assets/src/preinit.ts index 76eecdb..83ff56f 100644 --- a/lib/assets/src/preinit.ts +++ b/lib/assets/src/preinit.ts @@ -1,13 +1,13 @@ +import { + lookupModule, + lookupModules, + waitForModules, +} from '@revenge-mod/modules/finders' import { byDependencies, byName, byProps, } from '@revenge-mod/modules/finders/filters' -import { - lookupModule, - lookupModules, -} from '@revenge-mod/modules/finders/lookup' -import { waitForModules } from '@revenge-mod/modules/finders/wait' import { mInitializingId, mUninitialized, diff --git a/lib/discord/src/actions.ts b/lib/discord/src/actions.ts index c50a60a..c1ba282 100644 --- a/lib/discord/src/actions.ts +++ b/lib/discord/src/actions.ts @@ -1,3 +1,4 @@ +import { lookupModule, lookupModules } from '@revenge-mod/modules/finders' import { byDependencies, byProps, @@ -5,10 +6,6 @@ import { preferExports, withoutProps, } from '@revenge-mod/modules/finders/filters' -import { - lookupModule, - lookupModules, -} from '@revenge-mod/modules/finders/lookup' import { ReactJSXRuntimeModuleId, ReactModuleId, diff --git a/lib/discord/src/common/flux.ts b/lib/discord/src/common/flux.ts index 56a83c5..d99fd60 100644 --- a/lib/discord/src/common/flux.ts +++ b/lib/discord/src/common/flux.ts @@ -1,9 +1,9 @@ +import { lookupModule } from '@revenge-mod/modules/finders' import { byDependencies, byProps, preferExports, } from '@revenge-mod/modules/finders/filters' -import { lookupModule } from '@revenge-mod/modules/finders/lookup' import type { Metro } from '@revenge-mod/modules/types' import type { DiscordModules } from '../types' diff --git a/lib/discord/src/common/index.ts b/lib/discord/src/common/index.ts index ea29631..7d2faa3 100644 --- a/lib/discord/src/common/index.ts +++ b/lib/discord/src/common/index.ts @@ -1,10 +1,10 @@ +import { lookupModule } from '@revenge-mod/modules/finders' import { byDependencies, byName, byProps, preferExports, } from '@revenge-mod/modules/finders/filters' -import { lookupModule } from '@revenge-mod/modules/finders/lookup' import { proxify } from '@revenge-mod/utils/proxy' import type { Metro } from '@revenge-mod/modules/types' import type { DiscordModules } from '../types' diff --git a/lib/discord/src/common/utils.ts b/lib/discord/src/common/utils.ts index 7e2b0af..9f68a36 100644 --- a/lib/discord/src/common/utils.ts +++ b/lib/discord/src/common/utils.ts @@ -1,9 +1,9 @@ +import { lookupModule } from '@revenge-mod/modules/finders' import { byDependencies, byName, preferExports, } from '@revenge-mod/modules/finders/filters' -import { lookupModule } from '@revenge-mod/modules/finders/lookup' import { proxify } from '@revenge-mod/utils/proxy' import type { DiscordModules } from '../types' diff --git a/lib/discord/src/design.ts b/lib/discord/src/design.ts index a3a8aa3..afdacef 100644 --- a/lib/discord/src/design.ts +++ b/lib/discord/src/design.ts @@ -1,10 +1,10 @@ +import { lookupModule } from '@revenge-mod/modules/finders' import { byDependencies, byProps, bySingleProp, preferExports, } from '@revenge-mod/modules/finders/filters' -import { lookupModule } from '@revenge-mod/modules/finders/lookup' import { ReactJSXRuntimeModuleId, ReactModuleId, diff --git a/lib/discord/src/flux/stores.ts b/lib/discord/src/flux/stores.ts index d23e6c8..3d0c817 100644 --- a/lib/discord/src/flux/stores.ts +++ b/lib/discord/src/flux/stores.ts @@ -1,12 +1,12 @@ +import { + lookupModule, + lookupModules, + waitForModules, +} from '@revenge-mod/modules/finders' import { byName, createFilterGenerator, } from '@revenge-mod/modules/finders/filters' -import { - lookupModule, - lookupModules, -} from '@revenge-mod/modules/finders/lookup' -import { waitForModules } from '@revenge-mod/modules/finders/wait' import { getModuleDependencies } from '@revenge-mod/modules/metro/utils' import { asap, noop } from '@revenge-mod/utils/callback' import { cached, cacheFilterResultForId } from '#modules/src/caches' diff --git a/lib/discord/src/modules/main_tabs_v2.ts b/lib/discord/src/modules/main_tabs_v2.ts index 80eda74..2d8d940 100644 --- a/lib/discord/src/modules/main_tabs_v2.ts +++ b/lib/discord/src/modules/main_tabs_v2.ts @@ -1,9 +1,9 @@ +import { lookupModule } from '@revenge-mod/modules/finders' import { byDependencies, byProps, preferExports, } from '@revenge-mod/modules/finders/filters' -import { lookupModule } from '@revenge-mod/modules/finders/lookup' import { proxify } from '@revenge-mod/utils/proxy' import type { NavigationContainerRef } from '@react-navigation/core' diff --git a/lib/discord/src/modules/settings/renderer.ts b/lib/discord/src/modules/settings/renderer.ts index 7e77b68..9add092 100644 --- a/lib/discord/src/modules/settings/renderer.ts +++ b/lib/discord/src/modules/settings/renderer.ts @@ -1,9 +1,9 @@ +import { lookupModule } from '@revenge-mod/modules/finders' import { byDependencies, byProps, preferExports, } from '@revenge-mod/modules/finders/filters' -import { lookupModule } from '@revenge-mod/modules/finders/lookup' import { ReactJSXRuntimeModuleId, ReactModuleId, diff --git a/lib/discord/src/preinit.ts b/lib/discord/src/preinit.ts index 4257104..d4394a8 100644 --- a/lib/discord/src/preinit.ts +++ b/lib/discord/src/preinit.ts @@ -1,9 +1,9 @@ +import { lookupModule } from '@revenge-mod/modules/finders' import { byDependencies, byProps, preferExports, } from '@revenge-mod/modules/finders/filters' -import { lookupModule } from '@revenge-mod/modules/finders/lookup' import type { Metro } from '@revenge-mod/modules/types' import type { DiscordModules } from './types' diff --git a/lib/discord/src/start.ts b/lib/discord/src/start.ts index fe58dee..c7673d1 100644 --- a/lib/discord/src/start.ts +++ b/lib/discord/src/start.ts @@ -1,5 +1,5 @@ +import { waitForModules } from '@revenge-mod/modules/finders' import { byProps } from '@revenge-mod/modules/finders/filters' -import { waitForModules } from '@revenge-mod/modules/finders/wait' import { sConfig, sSubscriptions } from './modules/settings/_internal' import type { SettingsItem } from './modules/settings' diff --git a/lib/externals/src/browserify.ts b/lib/externals/src/browserify.ts index adbd48c..48178f8 100644 --- a/lib/externals/src/browserify.ts +++ b/lib/externals/src/browserify.ts @@ -1,9 +1,9 @@ +import { lookupModule } from '@revenge-mod/modules/finders' import { byDependencies, byProps, preferExports, } from '@revenge-mod/modules/finders/filters' -import { lookupModule } from '@revenge-mod/modules/finders/lookup' import { proxify } from '@revenge-mod/utils/proxy' const { loose, relative } = byDependencies diff --git a/lib/externals/src/react-native-clipboard.ts b/lib/externals/src/react-native-clipboard.ts index f007c94..607d7c1 100644 --- a/lib/externals/src/react-native-clipboard.ts +++ b/lib/externals/src/react-native-clipboard.ts @@ -1,9 +1,9 @@ +import { lookupModule } from '@revenge-mod/modules/finders' import { byDependencies, byProps, preferExports, } from '@revenge-mod/modules/finders/filters' -import { lookupModule } from '@revenge-mod/modules/finders/lookup' import { ReactModuleId, ReactNativeModuleId } from '@revenge-mod/react' import { destructure, proxify } from '@revenge-mod/utils/proxy' diff --git a/lib/externals/src/react-navigation.ts b/lib/externals/src/react-navigation.ts index c1d295e..0ea8645 100644 --- a/lib/externals/src/react-navigation.ts +++ b/lib/externals/src/react-navigation.ts @@ -1,10 +1,10 @@ +import { lookupModule } from '@revenge-mod/modules/finders' import { byDependencies, byName, byProps, preferExports, } from '@revenge-mod/modules/finders/filters' -import { lookupModule } from '@revenge-mod/modules/finders/lookup' import { ReactJSXRuntimeModuleId, ReactModuleId } from '@revenge-mod/react' import { proxify } from '@revenge-mod/utils/proxy' diff --git a/lib/externals/src/shopify.ts b/lib/externals/src/shopify.ts index f0e7bf9..f0f1342 100644 --- a/lib/externals/src/shopify.ts +++ b/lib/externals/src/shopify.ts @@ -1,9 +1,9 @@ +import { lookupModule } from '@revenge-mod/modules/finders' import { byDependencies, byProps, preferExports, } from '@revenge-mod/modules/finders/filters' -import { lookupModule } from '@revenge-mod/modules/finders/lookup' import { ReactJSXRuntimeModuleId, ReactModuleId, diff --git a/lib/modules/package.json b/lib/modules/package.json index 39a3f2d..b8ddf5f 100644 --- a/lib/modules/package.json +++ b/lib/modules/package.json @@ -6,14 +6,8 @@ "./finders/filters": { "default": "./src/finders/filters.ts" }, - "./finders/get": { - "default": "./src/finders/get.ts" - }, - "./finders/lookup": { - "default": "./src/finders/lookup.ts" - }, - "./finders/wait": { - "default": "./src/finders/wait.ts" + "./finders": { + "default": "./src/finders/index.ts" }, "./metro/subscriptions": { "default": "./src/metro/subscriptions/index.ts" @@ -31,4 +25,4 @@ "types": "./src/types.ts" } } -} +} \ No newline at end of file diff --git a/lib/modules/src/finders/index.ts b/lib/modules/src/finders/index.ts new file mode 100644 index 0000000..532e579 --- /dev/null +++ b/lib/modules/src/finders/index.ts @@ -0,0 +1,3 @@ +export * from './get' +export * from './lookup' +export * from './wait' diff --git a/lib/plugins/src/apis/modules.ts b/lib/plugins/src/apis/modules.ts index 17cb9b6..5a64ee2 100644 --- a/lib/plugins/src/apis/modules.ts +++ b/lib/plugins/src/apis/modules.ts @@ -1,7 +1,5 @@ +import * as PluginApiModulesFinders_ from '@revenge-mod/modules/finders' import * as PluginApiModulesFindersFilters from '@revenge-mod/modules/finders/filters' -import * as PluginApiModulesFindersGet from '@revenge-mod/modules/finders/get' -import * as PluginApiModulesFindersLookup from '@revenge-mod/modules/finders/lookup' -import * as PluginApiModulesFindersWait from '@revenge-mod/modules/finders/wait' import * as PluginApiModulesMetroSubscriptions from '@revenge-mod/modules/metro/subscriptions' import * as PluginApiModulesMetroUtils from '@revenge-mod/modules/metro/utils' import * as PluginApiModulesNative_ from '@revenge-mod/modules/native' @@ -20,24 +18,14 @@ export type PluginApiModulesMetro = typeof PluginApiModulesMetroUtils & typeof PluginApiModulesMetroSubscriptions -export type PluginApiModulesFinders = - // biome-ignore format: Don't - typeof PluginApiModulesFindersGet & - typeof PluginApiModulesFindersLookup & - typeof PluginApiModulesFindersWait & { - filters: typeof PluginApiModulesFindersFilters - } +export type PluginApiModulesFinders = typeof PluginApiModulesFinders_ & { + filters: typeof PluginApiModulesFindersFilters +} export const modules: PluginApiModules = { - finders: spreadDescriptors( - PluginApiModulesFindersGet, - spreadDescriptors( - PluginApiModulesFindersLookup, - spreadDescriptors(PluginApiModulesFindersWait, { - filters: PluginApiModulesFindersFilters, - }), - ), - ), + finders: spreadDescriptors(PluginApiModulesFinders_, { + filters: PluginApiModulesFindersFilters, + }), metro: spreadDescriptors( PluginApiModulesMetroUtils, spreadDescriptors(PluginApiModulesMetroSubscriptions, {}), diff --git a/lib/react/src/index.ts b/lib/react/src/index.ts index 0791f82..8ab438a 100644 --- a/lib/react/src/index.ts +++ b/lib/react/src/index.ts @@ -1,5 +1,5 @@ +import { waitForModules } from '@revenge-mod/modules/finders' import { byProps } from '@revenge-mod/modules/finders/filters' -import { waitForModules } from '@revenge-mod/modules/finders/wait' import type { Metro } from '@revenge-mod/modules/types' export let ReactModuleId: Metro.ModuleID diff --git a/lib/utils/src/discord.ts b/lib/utils/src/discord.ts index 9e276e9..8ab4240 100644 --- a/lib/utils/src/discord.ts +++ b/lib/utils/src/discord.ts @@ -1,10 +1,10 @@ import { getAssetByName } from '@revenge-mod/assets' import { TokensModuleId } from '@revenge-mod/discord/common' +import { lookupModule } from '@revenge-mod/modules/finders' import { byDependencies, createFilterGenerator, } from '@revenge-mod/modules/finders/filters' -import { lookupModule } from '@revenge-mod/modules/finders/lookup' import { ReactJSXRuntimeModuleId, ReactModuleId, diff --git a/scripts/types.ts b/scripts/types.ts index 07f2ad1..b7ca449 100644 --- a/scripts/types.ts +++ b/scripts/types.ts @@ -219,10 +219,8 @@ const Libraries = [ 'types', ]), library(modules, [ + 'finders', 'finders/filters', - ['finders/get', 'finders'], - ['finders/lookup', 'finders'], - ['finders/wait', 'finders'], ['metro/subscriptions', 'metro'], ['metro/utils', 'metro'], 'native', diff --git a/src/plugins/preinit/no-track/index.ts b/src/plugins/preinit/no-track/index.ts index b53478d..82a8508 100644 --- a/src/plugins/preinit/no-track/index.ts +++ b/src/plugins/preinit/no-track/index.ts @@ -1,5 +1,5 @@ +import { waitForModules } from '@revenge-mod/modules/finders' import { byProps } from '@revenge-mod/modules/finders/filters' -import { waitForModules } from '@revenge-mod/modules/finders/wait' import { getModuleDependencies } from '@revenge-mod/modules/metro/utils' import { instead } from '@revenge-mod/patcher' import { InternalPluginFlags, registerPlugin } from '@revenge-mod/plugins/_' diff --git a/src/plugins/start/error-boundary/index.tsx b/src/plugins/start/error-boundary/index.tsx index 96a2a9e..0faec21 100644 --- a/src/plugins/start/error-boundary/index.tsx +++ b/src/plugins/start/error-boundary/index.tsx @@ -1,5 +1,5 @@ +import { waitForModules } from '@revenge-mod/modules/finders' import { byName } from '@revenge-mod/modules/finders/filters' -import { waitForModules } from '@revenge-mod/modules/finders/wait' import { instead } from '@revenge-mod/patcher' import { InternalPluginFlags, registerPlugin } from '@revenge-mod/plugins/_' import { PluginFlags } from '@revenge-mod/plugins/constants' diff --git a/src/plugins/start/settings/index.ts b/src/plugins/start/settings/index.ts index a62a792..ae09e2b 100644 --- a/src/plugins/start/settings/index.ts +++ b/src/plugins/start/settings/index.ts @@ -1,10 +1,10 @@ import { sRefresher, sSections } from '@revenge-mod/discord/_/modules/settings' import { onSettingsModulesLoaded } from '@revenge-mod/discord/modules/settings' -import { byName } from '@revenge-mod/modules/finders/filters' import { waitForModuleByImportedPath, waitForModules, -} from '@revenge-mod/modules/finders/wait' +} from '@revenge-mod/modules/finders' +import { byName } from '@revenge-mod/modules/finders/filters' import { instead } from '@revenge-mod/patcher' import { InternalPluginFlags, registerPlugin } from '@revenge-mod/plugins/_' import { PluginFlags } from '@revenge-mod/plugins/constants' diff --git a/src/plugins/start/staff-settings/index.ts b/src/plugins/start/staff-settings/index.ts index 09516d1..45ede53 100644 --- a/src/plugins/start/staff-settings/index.ts +++ b/src/plugins/start/staff-settings/index.ts @@ -1,7 +1,7 @@ import { ToastActionCreators } from '@revenge-mod/discord/actions' import { getStore, Stores } from '@revenge-mod/discord/flux' +import { getModule } from '@revenge-mod/modules/finders' import { byProps } from '@revenge-mod/modules/finders/filters' -import { getModule } from '@revenge-mod/modules/finders/get' import { instead } from '@revenge-mod/patcher' import { InternalPluginFlags, registerPlugin } from '@revenge-mod/plugins/_' import { PluginFlags } from '@revenge-mod/plugins/constants' diff --git a/src/plugins/start/user-badges/index.tsx b/src/plugins/start/user-badges/index.tsx index 4cc69a3..c022a44 100644 --- a/src/plugins/start/user-badges/index.tsx +++ b/src/plugins/start/user-badges/index.tsx @@ -1,7 +1,7 @@ import { AlertActionCreators } from '@revenge-mod/discord/actions' import { Design } from '@revenge-mod/discord/design' +import { getModule } from '@revenge-mod/modules/finders' import { byProps } from '@revenge-mod/modules/finders/filters' -import { getModule } from '@revenge-mod/modules/finders/get' import { InternalPluginFlags, registerPlugin } from '@revenge-mod/plugins/_' import { PluginFlags } from '@revenge-mod/plugins/constants' import { afterJSX, beforeJSX } from '@revenge-mod/react/jsx-runtime'