netlify-cli 16.9.0 → 16.9.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "16.9.0",
4
+ "version": "16.9.2",
5
5
  "author": "Netlify Inc.",
6
6
  "type": "module",
7
7
  "engines": {
@@ -44,14 +44,14 @@
44
44
  "dependencies": {
45
45
  "@bugsnag/js": "7.20.2",
46
46
  "@fastify/static": "6.10.2",
47
- "@netlify/build": "29.23.1",
47
+ "@netlify/build": "29.23.4",
48
48
  "@netlify/build-info": "7.10.1",
49
49
  "@netlify/config": "20.9.0",
50
- "@netlify/edge-bundler": "9.3.0",
50
+ "@netlify/edge-bundler": "9.4.1",
51
51
  "@netlify/local-functions-proxy": "1.1.1",
52
52
  "@netlify/sdk": "^1.1.5",
53
- "@netlify/serverless-functions-api": "1.9.1",
54
- "@netlify/zip-it-and-ship-it": "9.25.1",
53
+ "@netlify/serverless-functions-api": "1.10.0",
54
+ "@netlify/zip-it-and-ship-it": "9.25.4",
55
55
  "@octokit/rest": "19.0.13",
56
56
  "ansi-escapes": "6.2.0",
57
57
  "ansi-styles": "6.2.1",
@@ -269,12 +269,15 @@ export class EdgeFunctionsRegistry {
269
269
  }
270
270
 
271
271
  /**
272
- * @param {string} path
272
+ * @param {string[]} paths
273
273
  * @returns {Promise<void>}
274
274
  */
275
- async #handleFileChange(path) {
275
+ async #handleFileChange(paths) {
276
276
  const matchingFunctions = new Set(
277
- [this.#functionPaths.get(path), ...(this.#dependencyPaths.get(path) || [])].filter(Boolean),
277
+ [
278
+ ...paths.map((path) => this.#functionPaths.get(path)),
279
+ ...paths.flatMap((path) => this.#dependencyPaths.get(path)),
280
+ ].filter(Boolean),
278
281
  )
279
282
 
280
283
  // If the file is not associated with any function, there's no point in
@@ -285,7 +288,7 @@ export class EdgeFunctionsRegistry {
285
288
  return
286
289
  }
287
290
 
288
- const reason = this.#debug ? ` because ${chalk.underline(path)} has changed` : ''
291
+ const reason = this.#debug ? ` because ${chalk.underline(paths.join(','))} has changed` : ''
289
292
 
290
293
  log(`${NETLIFYDEVLOG} ${chalk.magenta('Reloading')} edge functions${reason}...`)
291
294
 
@@ -548,7 +551,7 @@ export class EdgeFunctionsRegistry {
548
551
  const watcher = await watchDebounced(directory, {
549
552
  ignored,
550
553
  onAdd: () => this.#checkForAddedOrDeletedFunctions(),
551
- onChange: (path) => this.#handleFileChange(path),
554
+ onChange: (paths) => this.#handleFileChange(paths),
552
555
  onUnlink: () => this.#checkForAddedOrDeletedFunctions(),
553
556
  })
554
557
 
@@ -234,9 +234,9 @@ const DEBOUNCE_WAIT = 100
234
234
  * @param {Object} opts
235
235
  * @param {number} [opts.depth]
236
236
  * @param {Array<string|RegExp>} [opts.ignored]
237
- * @param {() => any} [opts.onAdd]
238
- * @param {() => any} [opts.onChange]
239
- * @param {() => any} [opts.onUnlink]
237
+ * @param {(paths: string[]) => any} [opts.onAdd]
238
+ * @param {(paths: string[]) => any} [opts.onChange]
239
+ * @param {(paths: string[]) => any} [opts.onUnlink]
240
240
  */
241
241
  export const watchDebounced = async (
242
242
  target,
@@ -247,22 +247,38 @@ export const watchDebounced = async (
247
247
 
248
248
  await once(watcher, 'ready')
249
249
 
250
- const debouncedOnChange = debounce(onChange, DEBOUNCE_WAIT)
251
- const debouncedOnUnlink = debounce(onUnlink, DEBOUNCE_WAIT)
252
- const debouncedOnAdd = debounce(onAdd, DEBOUNCE_WAIT)
250
+ let onChangeQueue = []
251
+ let onAddQueue = []
252
+ let onUnlinkQueue = []
253
+
254
+ const debouncedOnChange = debounce(() => {
255
+ onChange(onChangeQueue)
256
+ onChangeQueue = []
257
+ }, DEBOUNCE_WAIT)
258
+ const debouncedOnAdd = debounce(() => {
259
+ onAdd(onAddQueue)
260
+ onAddQueue = []
261
+ }, DEBOUNCE_WAIT)
262
+ const debouncedOnUnlink = debounce(() => {
263
+ onUnlink(onUnlinkQueue)
264
+ onUnlinkQueue = []
265
+ }, DEBOUNCE_WAIT)
253
266
 
254
267
  watcher
255
268
  .on('change', (path) => {
256
269
  decache(path)
257
- debouncedOnChange(path)
270
+ onChangeQueue.push(path)
271
+ debouncedOnChange()
258
272
  })
259
273
  .on('unlink', (path) => {
260
274
  decache(path)
261
- debouncedOnUnlink(path)
275
+ onUnlinkQueue.push(path)
276
+ debouncedOnUnlink()
262
277
  })
263
278
  .on('add', (path) => {
264
279
  decache(path)
265
- debouncedOnAdd(path)
280
+ onAddQueue.push(path)
281
+ debouncedOnAdd()
266
282
  })
267
283
 
268
284
  return watcher