|
| 1 | +declare namespace webpack { |
| 2 | + type HotEvent = |
| 3 | + | { |
| 4 | + type: "disposed"; |
| 5 | + /** The module in question. */ |
| 6 | + moduleId: number; |
| 7 | + } |
| 8 | + | { |
| 9 | + type: "self-declined" | "unaccepted"; |
| 10 | + /** The module in question. */ |
| 11 | + moduleId: number; |
| 12 | + /** the chain from where the update was propagated. */ |
| 13 | + chain: number[]; |
| 14 | + } |
| 15 | + | { |
| 16 | + type: "declined"; |
| 17 | + /** The module in question. */ |
| 18 | + moduleId: number; |
| 19 | + /** the chain from where the update was propagated. */ |
| 20 | + chain: number[]; |
| 21 | + /** the module id of the declining parent */ |
| 22 | + parentId: number; |
| 23 | + } |
| 24 | + | { |
| 25 | + type: "accepted"; |
| 26 | + /** The module in question. */ |
| 27 | + moduleId: number; |
| 28 | + /** the chain from where the update was propagated. */ |
| 29 | + chain: number[]; |
| 30 | + /** the modules that are outdated and will be disposed */ |
| 31 | + outdatedModules: number[]; |
| 32 | + /** the accepted dependencies that are outdated */ |
| 33 | + outdatedDependencies: { |
| 34 | + [id: number]: number[]; |
| 35 | + }; |
| 36 | + } |
| 37 | + | { |
| 38 | + type: "accept-error-handler-errored"; |
| 39 | + /** The module in question. */ |
| 40 | + moduleId: number; |
| 41 | + /** the module id owning the accept handler. */ |
| 42 | + dependencyId: number; |
| 43 | + /** the thrown error */ |
| 44 | + error: Error; |
| 45 | + /** the error thrown by the module before the error handler tried to handle it. */ |
| 46 | + originalError: Error; |
| 47 | + } |
| 48 | + | { |
| 49 | + type: "self-accept-error-handler-errored"; |
| 50 | + /** The module in question. */ |
| 51 | + moduleId: number; |
| 52 | + /** the thrown error */ |
| 53 | + error: Error; |
| 54 | + /** the error thrown by the module before the error handler tried to handle it. */ |
| 55 | + originalError: Error; |
| 56 | + } |
| 57 | + | { |
| 58 | + type: "accept-errored"; |
| 59 | + /** The module in question. */ |
| 60 | + moduleId: number; |
| 61 | + /** the module id owning the accept handler. */ |
| 62 | + dependencyId: number; |
| 63 | + /** the thrown error */ |
| 64 | + error: Error; |
| 65 | + } |
| 66 | + | { |
| 67 | + type: "self-accept-errored"; |
| 68 | + /** The module in question. */ |
| 69 | + moduleId: number; |
| 70 | + /** the thrown error */ |
| 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 | + } |
| 133 | + |
| 134 | + interface ExportsInfo { |
| 135 | + [k: string]: ExportInfo & ExportsInfo; |
| 136 | + } |
| 137 | + |
| 138 | + interface Context { |
| 139 | + resolve(dependency: string): string | number; |
| 140 | + keys(): Array<string>; |
| 141 | + id: string | number; |
| 142 | + (dependency: string): unknown; |
| 143 | + } |
| 144 | +} |
| 145 | + |
| 146 | +interface ImportMeta { |
| 147 | + url: string; |
| 148 | + webpack: number; |
| 149 | + webpackHot: webpack.Hot; |
| 150 | +} |
| 151 | + |
| 152 | +declare const __resourceQuery: string; |
| 153 | +declare var __webpack_public_path__: string; |
| 154 | +declare var __webpack_nonce__: string; |
| 155 | +declare const __webpack_chunkname__: string; |
| 156 | +declare var __webpack_base_uri__: string; |
| 157 | +declare var __webpack_runtime_id__: string; |
| 158 | +declare const __webpack_hash__: string; |
| 159 | +declare const __webpack_modules__: Record<string | number, NodeJS.Module>; |
| 160 | +declare const __webpack_require__: (id: string | number) => unknown; |
| 161 | +declare var __webpack_chunk_load__: (chunkId: string | number) => Promise<void>; |
| 162 | +declare var __webpack_get_script_filename__: ( |
| 163 | + chunkId: string | number |
| 164 | +) => string; |
| 165 | +declare var __webpack_is_included__: (request: string) => boolean; |
| 166 | +declare var __webpack_exports_info__: webpack.ExportsInfo; |
| 167 | +declare const __webpack_share_scopes__: Record< |
| 168 | + string, |
| 169 | + Record< |
| 170 | + string, |
| 171 | + { loaded?: 1; get: () => Promise<unknown>; from: string; eager: boolean } |
| 172 | + > |
| 173 | +>; |
| 174 | +declare var __webpack_init_sharing__: (scope: string) => Promise<void>; |
| 175 | +declare var __non_webpack_require__: (id: any) => unknown; |
| 176 | +declare const __system_context__: object; |
| 177 | + |
| 178 | +declare namespace NodeJS { |
| 179 | + interface Module { |
| 180 | + hot: webpack.Hot; |
| 181 | + } |
| 182 | + |
| 183 | + interface Require { |
| 184 | + ensure( |
| 185 | + dependencies: string[], |
| 186 | + callback: (require: (module: string) => void) => void, |
| 187 | + errorCallback?: (error: Error) => void, |
| 188 | + chunkName?: string |
| 189 | + ): void; |
| 190 | + context( |
| 191 | + request: string, |
| 192 | + includeSubdirectories?: boolean, |
| 193 | + filter?: RegExp, |
| 194 | + mode?: "sync" | "eager" | "weak" | "lazy" | "lazy-once" |
| 195 | + ): webpack.Context; |
| 196 | + include(dependency: string): void; |
| 197 | + resolveWeak(dependency: string): void; |
| 198 | + onError?: (error: Error) => void; |
| 199 | + } |
| 200 | +} |
0 commit comments