feat(compile): Enable multiple roots for a standalone module graph (#17663)

This change will enable dynamic imports and web workers to use modules
not reachable from the main module, by passing a list of extra side
module roots as options to `deno compile`. 

This can be done by specifying "--include" flag that accepts a file path or a
URL. This flag can be specified multiple times, to include several modules.
The modules specified with "--include" flag, will be added to the produced
"eszip".
This commit is contained in:
Andreu Botella 2023-03-19 00:43:07 +01:00 committed by GitHub
parent a80d1b6e66
commit b64ec79268
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 93 additions and 8 deletions

View file

@ -150,7 +150,7 @@ pub fn graph_lock_or_exit(graph: &ModuleGraph, lockfile: &mut Lockfile) {
}
pub async fn create_graph_and_maybe_check(
root: ModuleSpecifier,
roots: Vec<ModuleSpecifier>,
ps: &ProcState,
) -> Result<Arc<deno_graph::ModuleGraph>, AnyError> {
let mut cache = cache::FetchCacher::new(
@ -176,7 +176,7 @@ pub async fn create_graph_and_maybe_check(
build_graph_with_npm_resolution(
&mut graph,
&ps.npm_resolver,
vec![root],
roots,
&mut cache,
deno_graph::BuildOptions {
is_dynamic: false,