@@ -66,33 +66,16 @@ impl BindingWatcher {
6666 . map ( create_bundler_config_from_binding_options)
6767 . collect :: < Result < Vec < _ > , _ > > ( ) ?;
6868
69- // Forward the largest build_delay from configs to the watcher's debounce.
70- let build_delay =
71- configs. iter ( ) . filter_map ( |c| c. options . watch . as_ref ( ) . and_then ( |w| w. build_delay ) ) . max ( ) ;
72-
73- // Extract use_polling / poll_interval / compare_contents_for_polling from the first config that specifies them.
74- let use_polling = configs
75- . iter ( )
76- . find_map ( |c| c. options . watch . as_ref ( ) . filter ( |w| w. use_polling ) . map ( |w| w. use_polling ) )
77- . unwrap_or ( false ) ;
78- let poll_interval =
79- configs. iter ( ) . find_map ( |c| c. options . watch . as_ref ( ) . and_then ( |w| w. poll_interval ) ) ;
80- let compare_contents_for_polling = configs
81- . iter ( )
82- . find_map ( |c| {
83- c. options
84- . watch
85- . as_ref ( )
86- . filter ( |w| w. compare_contents_for_polling )
87- . map ( |w| w. compare_contents_for_polling )
88- } )
89- . unwrap_or ( false ) ;
90-
69+ // Extract watcher config from the first config's watch options.
70+ let watch = configs. first ( ) . and_then ( |c| c. options . watch . as_ref ( ) ) ;
9171 let watcher_config = WatcherConfig {
92- debounce : build_delay. map ( |ms| Duration :: from_millis ( u64:: from ( ms) ) ) ,
93- use_polling,
94- poll_interval,
95- compare_contents_for_polling,
72+ debounce : watch. and_then ( |w| w. build_delay ) . map ( |ms| Duration :: from_millis ( u64:: from ( ms) ) ) ,
73+ use_polling : watch. is_some_and ( |w| w. use_polling ) ,
74+ poll_interval : watch. and_then ( |w| w. poll_interval ) ,
75+ compare_contents_for_polling : watch. is_some_and ( |w| w. compare_contents_for_polling ) ,
76+ use_debounce : watch. is_some_and ( |w| w. use_debounce ) ,
77+ debounce_delay : watch. and_then ( |w| w. debounce_delay ) ,
78+ debounce_tick_rate : watch. and_then ( |w| w. debounce_tick_rate ) ,
9679 } ;
9780
9881 let handler = NapiWatcherEventHandler { listener : Arc :: new ( listener) } ;
0 commit comments