this repo has no description
at v1.2.3 2.5 kB view raw
1import type { Logger } from "./logger"; 2import type { Config, ConfigExtension } from "./config"; 3import type { DetectedExtension, IdentifiedPatch, IdentifiedWebpackModule, ProcessedExtensions } from "./extension"; 4import type EventEmitter from "events"; 5import type LunAST from "@moonlight-mod/lunast"; 6import type Moonmap from "@moonlight-mod/moonmap"; 7import type { EventPayloads, EventType, MoonlightEventEmitter } from "./core/event"; 8import { MoonlightFS } from "./fs"; 9 10export type MoonlightHost = { 11 asarPath: string; 12 config: Config; 13 events: EventEmitter; 14 extensions: DetectedExtension[]; 15 processedExtensions: ProcessedExtensions; 16 17 version: string; 18 branch: MoonlightBranch; 19 20 getConfig: (ext: string) => ConfigExtension["config"]; 21 getConfigOption: <T>(ext: string, name: string) => T | undefined; 22 getLogger: (id: string) => Logger; 23}; 24 25export type MoonlightNode = { 26 config: Config; 27 extensions: DetectedExtension[]; 28 processedExtensions: ProcessedExtensions; 29 nativesCache: Record<string, any>; 30 isBrowser: boolean; 31 32 version: string; 33 branch: MoonlightBranch; 34 35 getConfig: (ext: string) => ConfigExtension["config"]; 36 getConfigOption: <T>(ext: string, name: string) => T | undefined; 37 getNatives: (ext: string) => any | undefined; 38 getLogger: (id: string) => Logger; 39 40 getMoonlightDir: () => string; 41 getExtensionDir: (ext: string) => string; 42 writeConfig: (config: Config) => Promise<void>; 43}; 44 45export type MoonlightNodeSandboxed = { 46 fs: MoonlightFS; 47 addCors: (url: string) => void; 48 addBlocked: (url: string) => void; 49}; 50 51export type MoonlightWeb = { 52 unpatched: Set<IdentifiedPatch>; 53 pendingModules: Set<IdentifiedWebpackModule>; 54 enabledExtensions: Set<string>; 55 apiLevel: number; 56 events: MoonlightEventEmitter<EventType, EventPayloads>; 57 patchingInternals: { 58 onModuleLoad: (moduleId: string | string[], callback: (moduleId: string) => void) => void; 59 registerPatch: (patch: IdentifiedPatch) => void; 60 registerWebpackModule: (module: IdentifiedWebpackModule) => void; 61 }; 62 63 version: string; 64 branch: MoonlightBranch; 65 66 getConfig: (ext: string) => ConfigExtension["config"]; 67 getConfigOption: <T>(ext: string, name: string) => T | undefined; 68 getNatives: (ext: string) => any | undefined; 69 getLogger: (id: string) => Logger; 70 lunast: LunAST; 71 moonmap: Moonmap; 72}; 73 74export enum MoonlightEnv { 75 Injector = "injector", 76 NodePreload = "node-preload", 77 WebPreload = "web-preload" 78} 79 80export enum MoonlightBranch { 81 STABLE = "stable", 82 NIGHTLY = "nightly", 83 DEV = "dev" 84}