From 004b74c8c65a492a15a7538f71d44a92a86675fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 11 Aug 2024 23:10:55 +0100 Subject: feat: Rename --unstable-hmr to --watch-hmr (#24975) This commit stabilizes HMR functionality and renames `--unstable-hmr` to `--watch-hmr`. The `--unstable-hmr` flag is still working, but hidden from the help output. It will be removed in Deno 2. Once https://github.com/denoland/deno/pull/24958 lands we should improve grouping of `--watch` and `--watch-hmr` flags. --- cli/args/flags.rs | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'cli/args') diff --git a/cli/args/flags.rs b/cli/args/flags.rs index acdcaf8a7..085ba95d8 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -3604,8 +3604,10 @@ fn seed_arg() -> Arg { fn hmr_arg(takes_files: bool) -> Arg { let arg = Arg::new("hmr") - .long("unstable-hmr") - .help("UNSTABLE: Watch for file changes and hot replace modules") + .long("watch-hmr") + // NOTE(bartlomieju): compatibility with Deno pre-1.46 + .alias("unstable-hmr") + .help("Watch for file changes and hot replace modules") .conflicts_with("watch"); if takes_files { @@ -5249,6 +5251,31 @@ mod tests { } ); + let r = flags_from_vec(svec![ + "deno", + "run", + "--watch-hmr", + "--no-clear-screen", + "script.ts" + ]); + let flags = r.unwrap(); + assert_eq!( + flags, + Flags { + subcommand: DenoSubcommand::Run(RunFlags { + script: "script.ts".to_string(), + watch: Some(WatchFlagsWithPaths { + hmr: true, + paths: vec![], + no_clear_screen: true, + exclude: vec![], + }), + }), + code_cache_enabled: true, + ..Flags::default() + } + ); + let r = flags_from_vec(svec![ "deno", "run", @@ -5277,7 +5304,7 @@ mod tests { let r = flags_from_vec(svec![ "deno", "run", - "--unstable-hmr=foo.txt", + "--watch-hmr=foo.txt", "--no-clear-screen", "script.ts" ]); -- cgit v1.2.3