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