diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2023-06-25 08:35:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-25 09:35:31 +0200 |
commit | 28a4f3d0f5383695b1d49ccdc8b0f799a715b2c2 (patch) | |
tree | cd75b05db0bbfdadf3e565ca120d1f5d9ca39942 /core/modules | |
parent | a181ceb0e3791c842db6e8e6f528cf9ce320642a (diff) |
Reland "refactor(core): cleanup feature flags for js source inclusion" (#19519)
Relands #19463. This time the `ExtensionFileSourceCode` enum is
preserved, so this effectively just splits feature
`include_js_for_snapshotting` into `exclude_js_sources` and
`runtime_js_sources`, adds a `force_include_js_sources` option on
`extension!()`, and unifies `ext::Init_ops_and_esm()` and
`ext::init_ops()` into `ext::init()`.
Diffstat (limited to 'core/modules')
-rw-r--r-- | core/modules/loaders.rs | 24 | ||||
-rw-r--r-- | core/modules/tests.rs | 2 |
2 files changed, 1 insertions, 25 deletions
diff --git a/core/modules/loaders.rs b/core/modules/loaders.rs index d4dbf1ec2..fc0ab2deb 100644 --- a/core/modules/loaders.rs +++ b/core/modules/loaders.rs @@ -119,7 +119,6 @@ impl ExtModuleLoader { extensions .iter() .flat_map(|e| e.get_esm_sources()) - .flatten() .map(|s| (s.specifier.to_string(), s.clone())), ); ExtModuleLoader { @@ -179,29 +178,6 @@ impl ModuleLoader for ExtModuleLoader { } } -impl Drop for ExtModuleLoader { - fn drop(&mut self) { - let sources = self.sources.get_mut(); - let used_specifiers = self.used_specifiers.get_mut(); - let unused_modules: Vec<_> = sources - .iter() - .filter(|(k, _)| !used_specifiers.contains(k.as_str())) - .collect(); - - if !unused_modules.is_empty() { - let mut msg = - "Following modules were passed to ExtModuleLoader but never used:\n" - .to_string(); - for m in unused_modules { - msg.push_str(" - "); - msg.push_str(m.0); - msg.push('\n'); - } - panic!("{}", msg); - } - } -} - /// Basic file system module loader. /// /// Note that this loader will **block** event loop diff --git a/core/modules/tests.rs b/core/modules/tests.rs index 0eb7ce514..103019412 100644 --- a/core/modules/tests.rs +++ b/core/modules/tests.rs @@ -342,7 +342,7 @@ fn test_mods() { deno_core::extension!(test_ext, ops = [op_test]); let mut runtime = JsRuntime::new(RuntimeOptions { - extensions: vec![test_ext::init_ops()], + extensions: vec![test_ext::init_ext()], module_loader: Some(loader), ..Default::default() }); |