diff options
author | Luca Casonato <hello@lcas.dev> | 2023-05-09 12:37:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-09 12:37:13 +0200 |
commit | f34fcd16ea4d504c8a87c0873c65598d70bb1d07 (patch) | |
tree | db7eb7b1dd7f082fc28eb16f8cb3760296bed8e5 /runtime | |
parent | 723d4b038203e35f5be6d11088a7288e6d709869 (diff) |
fix(core): let V8 drive extension ESM loads (#18997)
This now allows circular imports across extensions.
Instead of load + eval of all ESM files in declaration order, all files
are only loaded. Eval is done recursively by V8, only evaluating
files that are listed in `Extension::esm_entry_point` fields.
---------
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/build.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/runtime/build.rs b/runtime/build.rs index 4f49ba681..18aaf7a7f 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -267,6 +267,17 @@ mod startup_snapshot { include_str!("js/99_main.js"), ), }]); + ext.esm_entry_point("ext:runtime_main/js/99_main.js"); + } + ); + + #[cfg(feature = "snapshot_from_snapshot")] + deno_core::extension!( + runtime_main, + deps = [runtime], + customizer = |ext: &mut deno_core::ExtensionBuilder| { + eprintln!("I am here!!!"); + ext.esm_entry_point("ext:runtime/90_deno_ns.js"); } ); @@ -315,7 +326,6 @@ mod startup_snapshot { // FIXME(bartlomieju): these extensions are specified last, because they // depend on `runtime`, even though it should be other way around deno_node::deno_node::init_ops_and_esm::<Permissions>(None, fs), - #[cfg(not(feature = "snapshot_from_snapshot"))] runtime_main::init_ops_and_esm(), ]; |