From 9aa20b3ba758765863a4c1055097fda399efcfc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 13 Mar 2023 22:44:16 -0400 Subject: refactor: --watch commands use deno_core::resolve_url_or_path (#18172) This commit changes various CLI subcommands that have support for the "--watch" flag to use initial current working directory when resolving "main module". This is part of migration towards explicitly passing current working directory to "deno_core::resolve_url_or_path" API. As a side effect this makes "deno --watch" more aligned to user expectations, where calling "Deno.chdir()" during program doesn't break watcher. Towards landing https://github.com/denoland/deno/pull/15454 --- cli/tools/run.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'cli/tools/run.rs') diff --git a/cli/tools/run.rs b/cli/tools/run.rs index 04ddcb4d9..84ec75e1a 100644 --- a/cli/tools/run.rs +++ b/cli/tools/run.rs @@ -9,7 +9,6 @@ use deno_core::anyhow::Context; use deno_core::error::AnyError; use deno_core::resolve_path; use deno_core::resolve_url_or_path; -use deno_core::resolve_url_or_path_deprecated; use deno_graph::npm::NpmPackageReqReference; use deno_runtime::permissions::Permissions; use deno_runtime::permissions::PermissionsContainer; @@ -104,10 +103,10 @@ pub async fn run_from_stdin(flags: Flags) -> Result { // code properly. async fn run_with_watch(flags: Flags, script: String) -> Result { let flags = Arc::new(flags); - let main_module = resolve_url_or_path_deprecated(&script)?; let (sender, receiver) = tokio::sync::mpsc::unbounded_channel(); let mut ps = ProcState::build_for_file_watcher((*flags).clone(), sender.clone()).await?; + let main_module = resolve_url_or_path(&script, ps.options.initial_cwd())?; let operation = |main_module: ModuleSpecifier| { ps.reset_for_file_watcher(); -- cgit v1.2.3