docs: rename HotUpdateContext to HotUpdateOptions (#18718)

This commit is contained in:
翠 / green 2024-11-20 22:21:37 +09:00 committed by GitHub
parent 0c658de41f
commit 824c347fa2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -28,10 +28,10 @@ interface HmrContext {
This hook is called once for all environments, and the passed modules have mixed information from the Client and SSR environments only. Once frameworks move to custom environments, a new hook that is called for each of them is needed. This hook is called once for all environments, and the passed modules have mixed information from the Client and SSR environments only. Once frameworks move to custom environments, a new hook that is called for each of them is needed.
The new `hotUpdate` hook works in the same way as `handleHotUpdate` but it is called for each environment and receives a new `HotUpdateContext` instance: The new `hotUpdate` hook works in the same way as `handleHotUpdate` but it is called for each environment and receives a new `HotUpdateOptions` instance:
```ts ```ts
interface HotUpdateContext { interface HotUpdateOptions {
type: 'create' | 'update' | 'delete' type: 'create' | 'update' | 'delete'
file: string file: string
timestamp: number timestamp: number

View File

@ -58,7 +58,7 @@ Plugins should set default values using the `config` hook. To configure each env
The `hotUpdate` hook allows plugins to perform custom HMR update handling for a given environment. When a file changes, the HMR algorithm is run for each environment in series according to the order in `server.environments`, so the `hotUpdate` hook will be called multiple times. The hook receives a context object with the following signature: The `hotUpdate` hook allows plugins to perform custom HMR update handling for a given environment. When a file changes, the HMR algorithm is run for each environment in series according to the order in `server.environments`, so the `hotUpdate` hook will be called multiple times. The hook receives a context object with the following signature:
```ts ```ts
interface HotUpdateContext { interface HotUpdateOptions {
type: 'create' | 'update' | 'delete' type: 'create' | 'update' | 'delete'
file: string file: string
timestamp: number timestamp: number

View File

@ -446,7 +446,7 @@ export async function handleHMRUpdate(
const options = { const options = {
...contextMeta, ...contextMeta,
modules: [...mods], modules: [...mods],
// later on hotUpdate will be called for each runtime with a new HotUpdateContext // later on hotUpdate will be called for each runtime with a new HotUpdateOptions
environment, environment,
} }
hotMap.set(environment, { options }) hotMap.set(environment, { options })