File tree Expand file tree Collapse file tree 3 files changed +35
-35
lines changed Expand file tree Collapse file tree 3 files changed +35
-35
lines changed Original file line number Diff line number Diff line change 4343 "author" : " Netlify Inc." ,
4444 "devDependencies" : {
4545 "@netlify/types" : " 2.0.1" ,
46- "@types/lodash.debounce" : " ^4.0.9" ,
4746 "@types/node" : " ^18.19.110" ,
4847 "@types/parse-gitignore" : " ^1.0.2" ,
4948 "@types/write-file-atomic" : " ^4.0.3" ,
5655 "ansis" : " ^4.1.0" ,
5756 "chokidar" : " ^4.0.1" ,
5857 "decache" : " ^4.6.2" ,
58+ "dettle" : " ^1.0.5" ,
5959 "dot-prop" : " 9.0.0" ,
6060 "empathic" : " ^2.0.0" ,
6161 "env-paths" : " ^3.0.0" ,
6262 "image-size" : " ^2.0.2" ,
6363 "js-image-generator" : " ^1.0.4" ,
64- "lodash.debounce" : " ^4.0.8" ,
6564 "parse-gitignore" : " ^2.0.0" ,
6665 "semver" : " ^7.7.2" ,
6766 "tmp-promise" : " ^3.0.3" ,
Original file line number Diff line number Diff line change 11import { once } from 'node:events'
22
3- import chokidar , { FSWatcher } from 'chokidar'
3+ import chokidar from 'chokidar'
44import decache from 'decache'
5- import debounce from 'lodash.debounce '
5+ import { debounce } from 'dettle '
66
77const DEBOUNCE_WAIT = 100
88
@@ -38,18 +38,30 @@ export const watchDebounced = async (
3838 let onAddQueue : string [ ] = [ ]
3939 let onUnlinkQueue : string [ ] = [ ]
4040
41- const debouncedOnChange = debounce ( ( ) => {
42- onChange ( onChangeQueue )
43- onChangeQueue = [ ]
44- } , DEBOUNCE_WAIT )
45- const debouncedOnAdd = debounce ( ( ) => {
46- onAdd ( onAddQueue )
47- onAddQueue = [ ]
48- } , DEBOUNCE_WAIT )
49- const debouncedOnUnlink = debounce ( ( ) => {
50- onUnlink ( onUnlinkQueue )
51- onUnlinkQueue = [ ]
52- } , DEBOUNCE_WAIT )
41+ const debouncedOnChange = debounce (
42+ ( ) => {
43+ onChange ( onChangeQueue )
44+ onChangeQueue = [ ]
45+ } ,
46+ DEBOUNCE_WAIT ,
47+ { leading : true } ,
48+ )
49+ const debouncedOnAdd = debounce (
50+ ( ) => {
51+ onAdd ( onAddQueue )
52+ onAddQueue = [ ]
53+ } ,
54+ DEBOUNCE_WAIT ,
55+ { leading : true } ,
56+ )
57+ const debouncedOnUnlink = debounce (
58+ ( ) => {
59+ onUnlink ( onUnlinkQueue )
60+ onUnlinkQueue = [ ]
61+ } ,
62+ DEBOUNCE_WAIT ,
63+ { leading : true } ,
64+ )
5365
5466 watcher
5567 . on ( 'change' , ( path ) => {
You can’t perform that action at this time.
0 commit comments