summaryrefslogtreecommitdiff
path: root/cli/tools/fmt.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-10-31 01:25:58 +0100
committerGitHub <noreply@github.com>2023-10-31 01:25:58 +0100
commit1713df13524ad20c6bd0413bcf4aa57adc3f9735 (patch)
treea558239a7f483cab10b83305b333d5ef9657bd3e /cli/tools/fmt.rs
parent48c5c3a3fb2f43716528db8915b36e55c411d94f (diff)
feat: deno run --unstable-hmr (#20876)
This commit adds `--unstable-hmr` flag, that enabled Hot Module Replacement. This flag works like `--watch` and accepts the same arguments. If HMR is not possible the process will be restarted instead. Currently HMR is only supported in `deno run` subcommand. Upon HMR a `CustomEvent("hmr")` will be dispatched that contains information which file was changed in its `details` property. --------- Co-authored-by: Valentin Anger <syrupthinker@gryphno.de> Co-authored-by: David Sherret <dsherret@gmail.com>
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r--cli/tools/fmt.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs
index 92facc7ec..5c47b5497 100644
--- a/cli/tools/fmt.rs
+++ b/cli/tools/fmt.rs
@@ -64,10 +64,7 @@ pub async fn format(flags: Flags, fmt_flags: FmtFlags) -> Result<(), AnyError> {
if let Some(watch_flags) = &fmt_flags.watch {
file_watcher::watch_func(
flags,
- file_watcher::PrintConfig {
- job_name: "Fmt".to_string(),
- clear_screen: !watch_flags.no_clear_screen,
- },
+ file_watcher::PrintConfig::new("Fmt", !watch_flags.no_clear_screen),
move |flags, watcher_communicator, changed_paths| {
let fmt_flags = fmt_flags.clone();
Ok(async move {
@@ -82,7 +79,7 @@ pub async fn format(flags: Flags, fmt_flags: FmtFlags) -> Result<(), AnyError> {
Ok(files)
}
})?;
- _ = watcher_communicator.watch_paths(files.clone());
+ let _ = watcher_communicator.watch_paths(files.clone());
let refmt_files = if let Some(paths) = changed_paths {
if fmt_options.check {
// check all files on any changed (https://github.com/denoland/deno/issues/12446)