revenge-bundle-next/types/globals.d.ts

119 lines
2.8 KiB
TypeScript
Raw Normal View History

2025-05-05 21:17:42 +07:00
import type { Metro } from '@revenge-mod/modules/types'
import type {
ImageProps,
ScrollViewProps,
TextProps,
ViewProps,
} from 'react-native'
/// REACT NATIVE COMPONENTS
declare module 'react' {
namespace JSX {
interface IntrinsicElements {
// TODO(PalmDevs): more intrinsic elements?
RCTView: ViewProps
RCTImage: ImageProps
RCTScrollView: ScrollViewProps
RCTText: TextProps
}
}
}
2025-03-21 19:59:16 +07:00
/// HERMES
declare global {
2025-06-03 16:24:58 +07:00
function setTimeout(
cb: (...args: unknown[]) => unknown,
timeout?: number,
): number
2025-03-21 19:59:16 +07:00
/**
* Calls the garbage collector
*/
2025-05-08 18:52:57 +07:00
function gc(): void
2025-03-21 19:59:16 +07:00
interface HermesInternalObject {
getRuntimeProperties(): Record<string, string>
// biome-ignore lint/complexity/noBannedTypes: You can pass any function here
getFunctionLocation(fn: Function): {
fileName: string
lineNumber: number
columnNumber: number
segmentID: number
virtualOffset: number
isNative: boolean
}
}
}
/// HERMES PROMISES
declare global {
2025-05-08 18:52:57 +07:00
interface Promise<T> {
2025-03-21 19:59:16 +07:00
/// PROMISE POLYFILLS FROM: https://github.com/then/promise
/// AND: https://github.com/facebook/hermes/blob/main/lib/InternalBytecode/01-Promise.js
_h: 0 | 1 | 2
2025-08-09 01:22:42 +07:00
/**
* The resolved value of the promise, if it has been resolved.
*/
_j: any
2025-03-21 19:59:16 +07:00
}
2025-06-03 16:24:58 +07:00
type HermesPromiseRejectionHandler = (
promise: Promise<any>,
error: any,
) => void
2025-03-21 19:59:16 +07:00
interface PromiseConstructor {
_m: HermesPromiseRejectionHandler
}
}
/// REACT DEVTOOLS
declare global {
var __REACT_DEVTOOLS_GLOBAL_HOOK__: unknown | undefined
var __REACT_DEVTOOLS__:
2025-03-21 19:59:16 +07:00
| {
version: number
2025-03-21 19:59:16 +07:00
exports: {
connectToDevTools(opts: {
host?: string
port?: number
websocket?: WebSocket
}): void
}
}
| undefined
}
/// METRO
declare global {
var __METRO_GLOBAL_PREFIX__: ''
var __d: Metro.DefineFn
var __r: Metro.Require
var __c: Metro.ClearFn
var __registerSegment: Metro.RegisterSegmentFn
2025-03-21 19:59:16 +07:00
}
/// REACT NATIVE
declare global {
var nativeModuleProxy: Record<string, unknown>
2025-08-09 01:22:42 +07:00
var __turboModuleProxy: ((name: string) => unknown) | undefined
2025-05-08 18:52:57 +07:00
function nativeLoggingHook(str: string, level: number): void
function RN$registerCallableModule(
name: string,
moduleProvider: () => object,
): void
2025-05-08 18:52:57 +07:00
function alert(message: unknown): void
feat!: module finders refactor (#6) - Renamed `byX` filters to `withX`. It is more correct. For example: You don't lookup, wait for, or get modules **BY** props. You lookup, wait for, and get modules **WITH** props. - Renamed `*byImportedPath` to `*withImportedPath` For consistency with the above change. - Renamed `getModule` to `getModules`. The API allows getting multiple modules and not just a single one. Types are renamed as well. `getModuleByImportedPath` remains the same as it only gets one single module with a unique imported path. - `withX` filter **helpers** removed. They can now be replaced with the new capability-based `and` filter. - `preferExports` and `moduleStateAware` filters removed. They can now be replaced with the new capability-based `and` filter. - Composite finders renamed. `some` -> `or`, `every` -> `and` - Composite finders takes a capability-based approach. - Filter generators now need to attach runtime flag to let the system know whether the generated filter can be used to filter modules without proper exports or not. ## Misc. - Removed useless unsub call in Profile Badges - Use `queueMicrotask` with `asap` # Features ## Capability-based approach to composite filters ```js // Old byProps(...).withDependencies(...) // Old, same as: preferExports(byProps(...), byDependencies(...)) every(byDependencies(...), byProps(...)) // Old, ordering matters, this would fail unexpectedly! every(byProps(...), byDependencies(...)) // New withProps(...).and(withDependencies(...)) // New (as well), ordering doesn't matter, this has the same result as above withDependencies(...).and(withProps(...)) ```
2025-08-30 09:19:57 +07:00
function queueMicrotask(cb: () => void): void
2025-03-21 19:59:16 +07:00
var nativePerformanceNow: typeof performance.now
var performance: {
now(): number
}
}