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