diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-10-31 01:25:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-31 01:25:58 +0100 |
commit | 1713df13524ad20c6bd0413bcf4aa57adc3f9735 (patch) | |
tree | a558239a7f483cab10b83305b333d5ef9657bd3e /cli/args/mod.rs | |
parent | 48c5c3a3fb2f43716528db8915b36e55c411d94f (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/args/mod.rs')
-rw-r--r-- | cli/args/mod.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/args/mod.rs b/cli/args/mod.rs index ab8d6b503..96f4e9a74 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -1130,6 +1130,18 @@ impl CliOptions { &self.flags.ext } + pub fn has_hmr(&self) -> bool { + if let DenoSubcommand::Run(RunFlags { + watch: Some(WatchFlagsWithPaths { hmr, .. }), + .. + }) = &self.flags.subcommand + { + *hmr + } else { + false + } + } + /// If the --inspect or --inspect-brk flags are used. pub fn is_inspecting(&self) -> bool { self.flags.inspect.is_some() |