diff options
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r-- | runtime/worker.rs | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs index 5dc5db71d..e6da93d78 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -418,16 +418,13 @@ impl MainWorker { ops::signal::deno_signal::init_ops_and_esm(), ops::tty::deno_tty::init_ops_and_esm(), ops::http::deno_http_runtime::init_ops_and_esm(), - ops::bootstrap::deno_bootstrap::init_ops_and_esm({ - #[cfg(feature = "__runtime_js_sources")] - { - Some(Default::default()) - } - #[cfg(not(feature = "__runtime_js_sources"))] - { + ops::bootstrap::deno_bootstrap::init_ops_and_esm( + if options.startup_snapshot.is_some() { None - } - }), + } else { + Some(Default::default()) + }, + ), deno_permissions_worker::init_ops_and_esm( permissions, enable_testing_features, @@ -435,14 +432,16 @@ impl MainWorker { runtime::init_ops_and_esm(), ]; + #[cfg(__runtime_js_sources)] + assert!(cfg!(not(feature = "only_snapshotted_js_sources")), "'__runtime_js_sources' is incompatible with 'only_snapshotted_js_sources'."); + for extension in &mut extensions { - #[cfg(not(feature = "__runtime_js_sources"))] - { + if options.startup_snapshot.is_some() { extension.js_files = std::borrow::Cow::Borrowed(&[]); extension.esm_files = std::borrow::Cow::Borrowed(&[]); extension.esm_entry_point = None; } - #[cfg(feature = "__runtime_js_sources")] + #[cfg(not(feature = "only_snapshotted_js_sources"))] { use crate::shared::maybe_transpile_source; for source in extension.esm_files.to_mut() { @@ -456,17 +455,8 @@ impl MainWorker { extensions.extend(std::mem::take(&mut options.extensions)); - #[cfg(all( - feature = "include_js_files_for_snapshotting", - not(feature = "__runtime_js_sources") - ))] - options - .startup_snapshot - .as_ref() - .expect("Sources are not embedded and a user snapshot was not provided."); - - #[cfg(not(feature = "dont_use_runtime_snapshot"))] - options.startup_snapshot.as_ref().expect("A user snapshot was not provided, if you want to create a runtime without a snapshot use 'dont_use_runtime_snapshot' Cargo feature."); + #[cfg(feature = "only_snapshotted_js_sources")] + options.startup_snapshot.as_ref().expect("A user snapshot was not provided, even though 'only_snapshotted_js_sources' is used."); let has_notified_of_inspector_disconnect = AtomicBool::new(false); let wait_for_inspector_disconnect_callback = Box::new(move || { |