| 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 ImportMetaEnv {
|
|---|
| 165 | [key: string]: string | boolean | undefined;
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | interface ImportMeta {
|
|---|
| 169 | url: string;
|
|---|
| 170 | webpack: number;
|
|---|
| 171 | webpackHot: webpack.Hot;
|
|---|
| 172 | env: ImportMetaEnv;
|
|---|
| 173 | webpackContext: (
|
|---|
| 174 | request: string,
|
|---|
| 175 | options?: {
|
|---|
| 176 | recursive?: boolean;
|
|---|
| 177 | regExp?: RegExp;
|
|---|
| 178 | include?: RegExp;
|
|---|
| 179 | exclude?: RegExp;
|
|---|
| 180 | preload?: boolean | number;
|
|---|
| 181 | prefetch?: boolean | number;
|
|---|
| 182 | fetchPriority?: "low" | "high" | "auto";
|
|---|
| 183 | chunkName?: string;
|
|---|
| 184 | exports?: string | string[][];
|
|---|
| 185 | mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once";
|
|---|
| 186 | }
|
|---|
| 187 | ) => webpack.Context;
|
|---|
| 188 | }
|
|---|
| 189 |
|
|---|
| 190 | declare const __resourceQuery: string;
|
|---|
| 191 | declare var __webpack_public_path__: string;
|
|---|
| 192 | declare var __webpack_nonce__: string;
|
|---|
| 193 | declare const __webpack_chunkname__: string;
|
|---|
| 194 | declare var __webpack_base_uri__: string;
|
|---|
| 195 | declare var __webpack_runtime_id__: string;
|
|---|
| 196 | declare const __webpack_hash__: string;
|
|---|
| 197 | declare const __webpack_modules__: Record<string | number, NodeJS.Module>;
|
|---|
| 198 | declare const __webpack_require__: (id: string | number) => unknown;
|
|---|
| 199 | declare var __webpack_chunk_load__: (chunkId: string | number) => Promise<void>;
|
|---|
| 200 | declare var __webpack_get_script_filename__: (
|
|---|
| 201 | chunkId: string | number
|
|---|
| 202 | ) => string;
|
|---|
| 203 | declare var __webpack_is_included__: (request: string) => boolean;
|
|---|
| 204 | declare var __webpack_exports_info__: webpack.ExportsInfo;
|
|---|
| 205 | declare const __webpack_share_scopes__: Record<
|
|---|
| 206 | string,
|
|---|
| 207 | Record<
|
|---|
| 208 | string,
|
|---|
| 209 | { loaded?: 1; get: () => Promise<unknown>; from: string; eager: boolean }
|
|---|
| 210 | >
|
|---|
| 211 | >;
|
|---|
| 212 | declare var __webpack_init_sharing__: (scope: string) => Promise<void>;
|
|---|
| 213 | declare var __non_webpack_require__: (id: any) => unknown;
|
|---|
| 214 | declare const __system_context__: object;
|
|---|
| 215 |
|
|---|
| 216 | declare namespace NodeJS {
|
|---|
| 217 | interface Module {
|
|---|
| 218 | hot: webpack.Hot;
|
|---|
| 219 | }
|
|---|
| 220 |
|
|---|
| 221 | interface Require {
|
|---|
| 222 | ensure(
|
|---|
| 223 | dependencies: string[],
|
|---|
| 224 | callback: (require: (module: string) => void) => void,
|
|---|
| 225 | errorCallback?: (error: Error) => void,
|
|---|
| 226 | chunkName?: string
|
|---|
| 227 | ): void;
|
|---|
| 228 | context(
|
|---|
| 229 | request: string,
|
|---|
| 230 | includeSubdirectories?: boolean,
|
|---|
| 231 | filter?: RegExp,
|
|---|
| 232 | mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once"
|
|---|
| 233 | ): webpack.Context;
|
|---|
| 234 | include(dependency: string): void;
|
|---|
| 235 | resolveWeak(dependency: string): void;
|
|---|
| 236 | onError?: (error: Error) => void;
|
|---|
| 237 | }
|
|---|
| 238 | }
|
|---|