diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2021-05-17 09:44:38 +0200 |
---|---|---|
committer | Luca Casonato <lucacasonato@yahoo.com> | 2021-05-17 09:45:54 +0200 |
commit | 5151afa123a9635d2f4de9555f8843460b284a11 (patch) | |
tree | 7c4686c3f5562dc27d8b863897225236aeb97b14 /cli/ops/runtime_compiler.rs | |
parent | 910935c07125e4710830be0df32a16c3ef278ba6 (diff) |
fix: static import permissions in dynamic imports
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/ops/runtime_compiler.rs')
-rw-r--r-- | cli/ops/runtime_compiler.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/cli/ops/runtime_compiler.rs b/cli/ops/runtime_compiler.rs index 2dfd995b5..c2d5582e7 100644 --- a/cli/ops/runtime_compiler.rs +++ b/cli/ops/runtime_compiler.rs @@ -66,15 +66,14 @@ async fn op_emit( // when we are actually resolving modules without provided sources, we should // treat the root module as a dynamic import so that runtime permissions are // applied. - let mut is_dynamic = false; let handler: Arc<Mutex<dyn SpecifierHandler>> = if let Some(sources) = args.sources { Arc::new(Mutex::new(MemoryHandler::new(sources))) } else { - is_dynamic = true; Arc::new(Mutex::new(FetchHandler::new( &program_state, runtime_permissions.clone(), + runtime_permissions.clone(), )?)) }; let maybe_import_map = if let Some(import_map_str) = args.import_map_path { @@ -103,15 +102,12 @@ async fn op_emit( }; let mut builder = GraphBuilder::new(handler, maybe_import_map, None); let root_specifier = resolve_url_or_path(&root_specifier)?; - builder - .add(&root_specifier, is_dynamic) - .await - .map_err(|_| { - type_error(format!( - "Unable to handle the given specifier: {}", - &root_specifier - )) - })?; + builder.add(&root_specifier, false).await.map_err(|_| { + type_error(format!( + "Unable to handle the given specifier: {}", + &root_specifier + )) + })?; let bundle_type = match args.bundle { Some(RuntimeBundleType::Module) => BundleType::Module, Some(RuntimeBundleType::Classic) => BundleType::Classic, |