@voxgig/model 11.1.1 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/watch.ts CHANGED
@@ -17,6 +17,7 @@ import type {
17
17
  import { makeBuild } from './build'
18
18
  import { FSWatcher } from 'chokidar'
19
19
 
20
+ import { existsSync } from 'node:fs'
20
21
  import { stat } from 'fs/promises'
21
22
 
22
23
 
@@ -108,7 +109,6 @@ class Watch {
108
109
 
109
110
  // Check if there have been no recent changes, if so, run build.
110
111
  this.intervalId = setInterval(() => {
111
- // const start = this.startTime
112
112
  const now = Date.now()
113
113
  const idleDuration = now - this.lastChange.when
114
114
 
@@ -117,9 +117,6 @@ class Watch {
117
117
  // this.lastChange.path !== this.lastTrigger.path
118
118
 
119
119
  if (trigger) {
120
- // Only add to build queue if we've been idle.
121
- // This allows external compilation outputting multiple files to complete fully.
122
- // IMPORTANT: always trigger a new build if there were changes *inside* a build period
123
120
  if (this.idle < idleDuration) {
124
121
  this.lastTrigger.path = this.lastChange.path
125
122
  this.lastTrigger.when = this.lastChange.when
@@ -216,9 +213,10 @@ class Watch {
216
213
  files.push(...Object.keys(build.deps[target]))
217
214
  }
218
215
 
219
- // TODO: remove deleted files
220
216
  for (const file of files) {
221
- if ('string' === typeof file && '' !== file && build.opts.base !== file) {
217
+ // A dry run's in-memory config is not on disk to be watched.
218
+ if ('string' === typeof file && '' !== file && build.opts.base !== file &&
219
+ existsSync(file)) {
222
220
  await this.add(file)
223
221
  }
224
222
  }