-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compile): Enable multiple roots for a standalone module graph
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`.
- Loading branch information
1 parent
1930c09
commit 1a4d647
Showing
7 changed files
with
85 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./import1.ts |
18 changes: 18 additions & 0 deletions
18
cli/tests/testdata/compile/dynamic_imports/main_unanalyzable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { join } from "https://deno.land/[email protected]/path/mod.ts"; | ||
|
||
console.log("Starting the main module"); | ||
|
||
// We load the dynamic import path from the file system, to make sure any | ||
// improvements in static analysis can't defeat the purpose of this test, which | ||
// is to make sure the `--site-module` flag works to add non-analyzed imports | ||
// to the module graph. | ||
const IMPORT_PATH_FILE_PATH = join( | ||
Deno.cwd(), | ||
"tests/testdata/compile/dynamic_imports/import_path", | ||
); | ||
|
||
setTimeout(async () => { | ||
console.log("Dynamic importing"); | ||
const importPath = (await Deno.readTextFile(IMPORT_PATH_FILE_PATH)).trim(); | ||
import(importPath).then(() => console.log("Dynamic import done.")); | ||
}, 500); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters