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