From 3d8a4d3b81e107bbb152ad69047f64d16ca800f3 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Wed, 26 Apr 2023 21:23:28 +0100 Subject: feat(cli): don't check permissions for statically analyzable dynamic imports (#18713) Closes #17697 Closes #17658 --- cli/tools/bench.rs | 7 ++----- cli/tools/test.rs | 9 ++------- 2 files changed, 4 insertions(+), 12 deletions(-) (limited to 'cli/tools') diff --git a/cli/tools/bench.rs b/cli/tools/bench.rs index 9930bcc77..962b1ac17 100644 --- a/cli/tools/bench.rs +++ b/cli/tools/bench.rs @@ -418,7 +418,6 @@ impl BenchReporter for ConsoleReporter { /// Type check a collection of module and document specifiers. async fn check_specifiers( ps: &ProcState, - permissions: Permissions, specifiers: Vec, ) -> Result<(), AnyError> { let lib = ps.options.ts_type_lib_window(); @@ -428,10 +427,8 @@ async fn check_specifiers( false, lib, PermissionsContainer::allow_all(), - PermissionsContainer::new(permissions), ) .await?; - Ok(()) } @@ -654,7 +651,7 @@ pub async fn run_benchmarks( return Err(generic_error("No bench modules found")); } - check_specifiers(&ps, permissions.clone(), specifiers.clone()).await?; + check_specifiers(&ps, specifiers.clone()).await?; if bench_options.no_run { return Ok(()); @@ -813,7 +810,7 @@ pub async fn run_benchmarks_with_watch( .filter(|specifier| modules_to_reload.contains(specifier)) .collect::>(); - check_specifiers(&ps, permissions.clone(), specifiers.clone()).await?; + check_specifiers(&ps, specifiers.clone()).await?; if bench_options.no_run { return Ok(()); diff --git a/cli/tools/test.rs b/cli/tools/test.rs index 17d1cebf3..268f3b4b9 100644 --- a/cli/tools/test.rs +++ b/cli/tools/test.rs @@ -1230,7 +1230,6 @@ async fn fetch_inline_files( /// Type check a collection of module and document specifiers. pub async fn check_specifiers( ps: &ProcState, - permissions: Permissions, specifiers: Vec<(ModuleSpecifier, TestMode)>, ) -> Result<(), AnyError> { let lib = ps.options.ts_type_lib_window(); @@ -1265,7 +1264,6 @@ pub async fn check_specifiers( false, lib, PermissionsContainer::new(Permissions::allow_all()), - PermissionsContainer::new(permissions.clone()), ) .await?; } @@ -1287,7 +1285,6 @@ pub async fn check_specifiers( false, lib, PermissionsContainer::allow_all(), - PermissionsContainer::new(permissions), ) .await?; @@ -1648,8 +1645,7 @@ pub async fn run_tests( return Err(generic_error("No test modules found")); } - check_specifiers(&ps, permissions.clone(), specifiers_with_mode.clone()) - .await?; + check_specifiers(&ps, specifiers_with_mode.clone()).await?; if test_options.no_run { return Ok(()); @@ -1821,8 +1817,7 @@ pub async fn run_tests_with_watch( .filter(|(specifier, _)| modules_to_reload.contains(specifier)) .collect::>(); - check_specifiers(&ps, permissions.clone(), specifiers_with_mode.clone()) - .await?; + check_specifiers(&ps, specifiers_with_mode.clone()).await?; if test_options.no_run { return Ok(()); -- cgit v1.2.3