feat(lib/modules/common)!: export more commons

This commit is contained in:
PalmDevs 2025-04-27 21:14:41 +07:00
parent 54b45dfd93
commit 87ff29a36a
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA
7 changed files with 40 additions and 4 deletions

View file

@ -1,4 +1,4 @@
import { ReactNative } from '@revenge-mod/modules/common'
import { ReactNative } from '@revenge-mod/modules/common/react'
import { _assets } from './_internal'
import { AssetRegistry } from './patches'

View file

@ -7,7 +7,13 @@
"default": "./src/index.ts"
},
"./common": {
"default": "./src/common.ts"
"default": "./src/common/index.ts"
},
"./common/discord": {
"default": "./src/common/discord/index.ts"
},
"./common/react": {
"default": "./src/common/react.ts"
},
"./finders": {
"default": "./src/finders/index.ts"

View file

@ -0,0 +1,16 @@
import { waitForModules } from '../../finders'
import { byProps } from '../../finders/filters'
import type { DiscordModules } from '../../../types'
waitForModules(byProps<DiscordModules.Flux.Store>('_dispatchToken'), (_, store) => {
const name = store.getName()
_stores[name] = store
})
const _stores: Record<string, any> = {}
export const stores = new Proxy(_stores, {
ownKeys: () => Reflect.ownKeys(_stores),
get: (_, name) => Reflect.get(_stores, name),
})

View file

@ -0,0 +1,11 @@
import { lookupModule } from '../../finders'
import { byName, byProps } from '../../finders/filters'
import type { DiscordModules } from '../../../types/discord'
export * as flux from './flux'
// ../discord_common/js/shared/Logger.tsx
export const Logger = lookupModule(byName<DiscordModules.Logger>('Logger'))!
// ../discord_common/js/packages/tokens/native.tsx
export const tokens = lookupModule(byProps('RawColor'))!

View file

@ -0,0 +1,2 @@
export * as discord from './discord'
export * as react from './react'

View file

@ -1,7 +1,7 @@
import { yielded } from '@revenge-mod/utils/generators'
import { lookupModuleId, lookupModuleIds } from './finders'
import { byProps } from './finders/filters'
import { lookupModuleId, lookupModuleIds } from '../finders'
import { byProps } from '../finders/filters'
export const ReactModuleId = yielded(lookupModuleIds(byProps<typeof import('react')>('useState')), 1)!
export const ReactNativeModuleId = lookupModuleId(byProps<typeof import('react-native')>('AppRegistry'))!

View file

@ -31,6 +31,7 @@ export namespace DiscordModules {
_isInitialized: boolean
_version: number
_reactChangeCallbacks: StoreChangeCallbacks
_dispatchToken: string
}
export interface Dispatcher {