|
@@ -28,7 +28,7 @@ async function findWatchRoot(filename: string): Promise<{ filename: string; root
|
|
|
* Watch one patch path, including missing parents, and serialize refresh callbacks.
|
|
* Watch one patch path, including missing parents, and serialize refresh callbacks.
|
|
|
* @param ctx Context that owns watcher disposal and receives refresh failures.
|
|
* @param ctx Context that owns watcher disposal and receives refresh failures.
|
|
|
* @param filename Absolute patch-file path.
|
|
* @param filename Absolute patch-file path.
|
|
|
- * @param options Deployment watcher options inherited from the HMR configuration.
|
|
|
|
|
|
|
+ * @param options Deployment watcher options; configuration watches enable write stabilization by default.
|
|
|
* @param refresh Callback for additions, changes, and removals.
|
|
* @param refresh Callback for additions, changes, and removals.
|
|
|
* @param inTransaction Whether disposal is running inside the refresh being removed.
|
|
* @param inTransaction Whether disposal is running inside the refresh being removed.
|
|
|
* @returns A disposer that closes the watcher and drains its current refresh.
|
|
* @returns A disposer that closes the watcher and drains its current refresh.
|
|
@@ -44,7 +44,8 @@ export async function watchConfig(
|
|
|
if (paths.has(target.filename)) throw new Error(`config path already registered: ${filename}`)
|
|
if (paths.has(target.filename)) throw new Error(`config path already registered: ${filename}`)
|
|
|
const { cwd: _cwd, ignored: _ignored, ...watchOptions } = options
|
|
const { cwd: _cwd, ignored: _ignored, ...watchOptions } = options
|
|
|
const watcher = watch(target.root, {
|
|
const watcher = watch(target.root, {
|
|
|
- ...watchOptions, depth: target.depth, ignoreInitial: false,
|
|
|
|
|
|
|
+ // Stabilized events bypass Chokidar's lossy 50 ms change-event throttle.
|
|
|
|
|
+ awaitWriteFinish: true, ...watchOptions, depth: target.depth, ignoreInitial: false,
|
|
|
})
|
|
})
|
|
|
paths.add(target.filename)
|
|
paths.add(target.filename)
|
|
|
const state = { dirty: false }
|
|
const state = { dirty: false }
|