1 | declare namespace webpack {
|
2 | type HotEvent =
|
3 | | {
|
4 | type: "disposed";
|
5 |
|
6 | moduleId: number;
|
7 | }
|
8 | | {
|
9 | type: "self-declined" | "unaccepted";
|
10 |
|
11 | moduleId: number;
|
12 |
|
13 | chain: number[];
|
14 | }
|
15 | | {
|
16 | type: "declined";
|
17 |
|
18 | moduleId: number;
|
19 |
|
20 | chain: number[];
|
21 |
|
22 | parentId: number;
|
23 | }
|
24 | | {
|
25 | type: "accepted";
|
26 |
|
27 | moduleId: number;
|
28 |
|
29 | chain: number[];
|
30 |
|
31 | outdatedModules: number[];
|
32 |
|
33 | outdatedDependencies: {
|
34 | [id: number]: number[];
|
35 | };
|
36 | }
|
37 | | {
|
38 | type: "accept-error-handler-errored";
|
39 |
|
40 | moduleId: number;
|
41 |
|
42 | dependencyId: number;
|
43 |
|
44 | error: Error;
|
45 |
|
46 | originalError: Error;
|
47 | }
|
48 | | {
|
49 | type: "self-accept-error-handler-errored";
|
50 |
|
51 | moduleId: number;
|
52 |
|
53 | error: Error;
|
54 |
|
55 | originalError: Error;
|
56 | }
|
57 | | {
|
58 | type: "accept-errored";
|
59 |
|
60 | moduleId: number;
|
61 |
|
62 | dependencyId: number;
|
63 |
|
64 | error: Error;
|
65 | }
|
66 | | {
|
67 | type: "self-accept-errored";
|
68 |
|
69 | moduleId: number;
|
70 |
|
71 | error: Error;
|
72 | };
|
73 |
|
74 | interface ApplyOptions {
|
75 | ignoreUnaccepted?: boolean;
|
76 | ignoreDeclined?: boolean;
|
77 | ignoreErrored?: boolean;
|
78 | onDeclined?(callback: (info: HotEvent) => void): void;
|
79 | onUnaccepted?(callback: (info: HotEvent) => void): void;
|
80 | onAccepted?(callback: (info: HotEvent) => void): void;
|
81 | onDisposed?(callback: (info: HotEvent) => void): void;
|
82 | onErrored?(callback: (info: HotEvent) => void): void;
|
83 | }
|
84 |
|
85 | const enum HotUpdateStatus {
|
86 | idle = "idle",
|
87 | check = "check",
|
88 | prepare = "prepare",
|
89 | ready = "ready",
|
90 | dispose = "dispose",
|
91 | apply = "apply",
|
92 | abort = "abort",
|
93 | fail = "fail"
|
94 | }
|
95 |
|
96 | interface Hot {
|
97 | accept: {
|
98 | (
|
99 | modules: string | string[],
|
100 | callback?: (outdatedDependencies: string[]) => void,
|
101 | errorHandler?: (
|
102 | err: Error,
|
103 | context: { moduleId: string | number; dependencyId: string | number }
|
104 | ) => void
|
105 | ): void;
|
106 | (
|
107 | errorHandler?: (
|
108 | err: Error,
|
109 | ids: { moduleId: string | number; module: NodeJS.Module }
|
110 | ) => void
|
111 | ): void;
|
112 | };
|
113 | status(): HotUpdateStatus;
|
114 | decline(module?: string | string[]): void;
|
115 | dispose(callback: (data: object) => void): void;
|
116 | addDisposeHandler(callback: (data: object) => void): void;
|
117 | removeDisposeHandler(callback: (data: object) => void): void;
|
118 | invalidate(): void;
|
119 | addStatusHandler(callback: (status: HotUpdateStatus) => void): void;
|
120 | removeStatusHandler(callback: (status: HotUpdateStatus) => void): void;
|
121 | data: object;
|
122 | check(
|
123 | autoApply?: boolean | ApplyOptions
|
124 | ): Promise<(string | number)[] | null>;
|
125 | apply(options?: ApplyOptions): Promise<(string | number)[] | null>;
|
126 | }
|
127 |
|
128 | interface ExportInfo {
|
129 | used: boolean;
|
130 | provideInfo: boolean | null | undefined;
|
131 | useInfo: boolean | null | undefined;
|
132 | canMangle: boolean;
|
133 | }
|
134 |
|
135 | interface ExportsInfo {
|
136 | [k: string]: ExportInfo & ExportsInfo;
|
137 | }
|
138 |
|
139 | interface Context {
|
140 | resolve(dependency: string): string | number;
|
141 | keys(): Array<string>;
|
142 | id: string | number;
|
143 | (dependency: string): unknown;
|
144 | }
|
145 | }
|
146 |
|
147 | interface ImportMeta {
|
148 | url: string;
|
149 | webpack: number;
|
150 | webpackHot: webpack.Hot;
|
151 | webpackContext: (
|
152 | request: string,
|
153 | options?: {
|
154 | recursive?: boolean;
|
155 | regExp?: RegExp;
|
156 | include?: RegExp;
|
157 | exclude?: RegExp;
|
158 | preload?: boolean | number;
|
159 | prefetch?: boolean | number;
|
160 | chunkName?: string;
|
161 | exports?: string | string[][];
|
162 | mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once";
|
163 | }
|
164 | ) => webpack.Context;
|
165 | }
|
166 |
|
167 | declare const __resourceQuery: string;
|
168 | declare var __webpack_public_path__: string;
|
169 | declare var __webpack_nonce__: string;
|
170 | declare const __webpack_chunkname__: string;
|
171 | declare var __webpack_base_uri__: string;
|
172 | declare var __webpack_runtime_id__: string;
|
173 | declare const __webpack_hash__: string;
|
174 | declare const __webpack_modules__: Record<string | number, NodeJS.Module>;
|
175 | declare const __webpack_require__: (id: string | number) => unknown;
|
176 | declare var __webpack_chunk_load__: (chunkId: string | number) => Promise<void>;
|
177 | declare var __webpack_get_script_filename__: (
|
178 | chunkId: string | number
|
179 | ) => string;
|
180 | declare var __webpack_is_included__: (request: string) => boolean;
|
181 | declare var __webpack_exports_info__: webpack.ExportsInfo;
|
182 | declare const __webpack_share_scopes__: Record<
|
183 | string,
|
184 | Record<
|
185 | string,
|
186 | { loaded?: 1; get: () => Promise<unknown>; from: string; eager: boolean }
|
187 | >
|
188 | >;
|
189 | declare var __webpack_init_sharing__: (scope: string) => Promise<void>;
|
190 | declare var __non_webpack_require__: (id: any) => unknown;
|
191 | declare const __system_context__: object;
|
192 |
|
193 | declare namespace NodeJS {
|
194 | interface Module {
|
195 | hot: webpack.Hot;
|
196 | }
|
197 |
|
198 | interface Require {
|
199 | ensure(
|
200 | dependencies: string[],
|
201 | callback: (require: (module: string) => void) => void,
|
202 | errorCallback?: (error: Error) => void,
|
203 | chunkName?: string
|
204 | ): void;
|
205 | context(
|
206 | request: string,
|
207 | includeSubdirectories?: boolean,
|
208 | filter?: RegExp,
|
209 | mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once"
|
210 | ): webpack.Context;
|
211 | include(dependency: string): void;
|
212 | resolveWeak(dependency: string): void;
|
213 | onError?: (error: Error) => void;
|
214 | }
|
215 | }
|