diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-10-23 11:50:15 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-23 11:50:15 +1100 |
commit | 7e2c7fb6c5454e30158d74e1a5786183ea391f07 (patch) | |
tree | 42402aa26a0422b9c46d1d441598dbe803b8ed15 /cli/main.rs | |
parent | 9fa59f0ca8164f5e02ba2a2fa90b6fdbce5c1afb (diff) |
refactor(cli): migrate run and cache to new infrastructure (#7996)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'cli/main.rs')
-rw-r--r-- | cli/main.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cli/main.rs b/cli/main.rs index 56e3c19f8..51355555e 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -51,7 +51,7 @@ mod test_runner; mod text_encoding; mod tokio_util; mod tsc; -pub mod tsc2; +mod tsc2; mod tsc_config; mod upgrade; mod version; @@ -174,14 +174,16 @@ async fn info_command( let specifier = ModuleSpecifier::resolve_url_or_path(&specifier)?; let handler = Rc::new(RefCell::new(specifier_handler::FetchHandler::new( &program_state, + // info accesses dynamically imported modules just for their information + // so we allow access to all of them. Permissions::allow_all(), )?)); let mut builder = module_graph2::GraphBuilder2::new( handler, program_state.maybe_import_map.clone(), ); - builder.insert(&specifier).await?; - let graph = builder.get_graph(&program_state.lockfile)?; + builder.add(&specifier, false).await?; + let graph = builder.get_graph(&program_state.lockfile); let info = graph.info()?; if json { @@ -312,14 +314,16 @@ async fn bundle_command( let output = if flags.no_check { let handler = Rc::new(RefCell::new(FetchHandler::new( &program_state, + // when bundling, dynamic imports are only access for their type safety, + // therefore we will allow the graph to access any module. Permissions::allow_all(), )?)); let mut builder = module_graph2::GraphBuilder2::new( handler, program_state.maybe_import_map.clone(), ); - builder.insert(&module_specifier).await?; - let graph = builder.get_graph(&program_state.lockfile)?; + builder.add(&module_specifier, false).await?; + let graph = builder.get_graph(&program_state.lockfile); let (s, stats, maybe_ignored_options) = graph.bundle(module_graph2::BundleOptions { |