mirror of https://github.com/webpack/webpack.git
Merge pull request #16094 from nuintun/hot-event-optimizing
fix: Fixed apply event callback and optimizing callback event type
This commit is contained in:
commit
284e71b878
|
@ -1,17 +1,5 @@
|
||||||
declare namespace webpack {
|
declare namespace webpack {
|
||||||
type HotEvent =
|
type DeclinedEvent =
|
||||||
| {
|
|
||||||
type: "disposed";
|
|
||||||
/** The module in question. */
|
|
||||||
moduleId: number;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
type: "self-declined" | "unaccepted";
|
|
||||||
/** The module in question. */
|
|
||||||
moduleId: number;
|
|
||||||
/** the chain from where the update was propagated. */
|
|
||||||
chain: number[];
|
|
||||||
}
|
|
||||||
| {
|
| {
|
||||||
type: "declined";
|
type: "declined";
|
||||||
/** The module in question. */
|
/** The module in question. */
|
||||||
|
@ -22,18 +10,42 @@ declare namespace webpack {
|
||||||
parentId: number;
|
parentId: number;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: "accepted";
|
type: "self-declined";
|
||||||
/** The module in question. */
|
/** The module in question. */
|
||||||
moduleId: number;
|
moduleId: number;
|
||||||
/** the chain from where the update was propagated. */
|
/** the chain from where the update was propagated. */
|
||||||
chain: number[];
|
chain: number[];
|
||||||
/** the modules that are outdated and will be disposed */
|
};
|
||||||
outdatedModules: number[];
|
|
||||||
/** the accepted dependencies that are outdated */
|
type UnacceptedEvent = {
|
||||||
outdatedDependencies: {
|
type: "unaccepted";
|
||||||
[id: number]: number[];
|
/** The module in question. */
|
||||||
};
|
moduleId: number;
|
||||||
}
|
/** the chain from where the update was propagated. */
|
||||||
|
chain: number[];
|
||||||
|
};
|
||||||
|
|
||||||
|
type AcceptedEvent = {
|
||||||
|
type: "accepted";
|
||||||
|
/** The module in question. */
|
||||||
|
moduleId: number;
|
||||||
|
/** the chain from where the update was propagated. */
|
||||||
|
chain: number[];
|
||||||
|
/** the modules that are outdated and will be disposed */
|
||||||
|
outdatedModules: number[];
|
||||||
|
/** the accepted dependencies that are outdated */
|
||||||
|
outdatedDependencies: {
|
||||||
|
[id: number]: number[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
type DisposedEvent = {
|
||||||
|
type: "disposed";
|
||||||
|
/** The module in question. */
|
||||||
|
moduleId: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ErroredEvent =
|
||||||
| {
|
| {
|
||||||
type: "accept-error-handler-errored";
|
type: "accept-error-handler-errored";
|
||||||
/** The module in question. */
|
/** The module in question. */
|
||||||
|
@ -71,15 +83,22 @@ declare namespace webpack {
|
||||||
error: Error;
|
error: Error;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type HotEvent =
|
||||||
|
| DeclinedEvent
|
||||||
|
| UnacceptedEvent
|
||||||
|
| AcceptedEvent
|
||||||
|
| DisposedEvent
|
||||||
|
| ErroredEvent;
|
||||||
|
|
||||||
interface ApplyOptions {
|
interface ApplyOptions {
|
||||||
ignoreUnaccepted?: boolean;
|
ignoreUnaccepted?: boolean;
|
||||||
ignoreDeclined?: boolean;
|
ignoreDeclined?: boolean;
|
||||||
ignoreErrored?: boolean;
|
ignoreErrored?: boolean;
|
||||||
onDeclined?(callback: (info: HotEvent) => void): void;
|
onDeclined?: (event: DeclinedEvent) => void;
|
||||||
onUnaccepted?(callback: (info: HotEvent) => void): void;
|
onUnaccepted?: (event: UnacceptedEvent) => void;
|
||||||
onAccepted?(callback: (info: HotEvent) => void): void;
|
onAccepted?: (event: AcceptedEvent) => void;
|
||||||
onDisposed?(callback: (info: HotEvent) => void): void;
|
onDisposed?: (event: DisposedEvent) => void;
|
||||||
onErrored?(callback: (info: HotEvent) => void): void;
|
onErrored?: (event: ErroredEvent) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const enum HotUpdateStatus {
|
const enum HotUpdateStatus {
|
||||||
|
|
Loading…
Reference in New Issue