diff options
Diffstat (limited to 'cli/js.rs')
-rw-r--r-- | cli/js.rs | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -3,12 +3,20 @@ use deno_core::Snapshot; use log::debug; +#[cfg(not(feature = "__runtime_js_sources"))] static CLI_SNAPSHOT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/CLI_SNAPSHOT.bin")); -pub fn deno_isolate_init() -> Snapshot { +pub fn deno_isolate_init() -> Option<Snapshot> { debug!("Deno isolate init with snapshots."); - Snapshot::Static(CLI_SNAPSHOT) + #[cfg(not(feature = "__runtime_js_sources"))] + { + Some(Snapshot::Static(CLI_SNAPSHOT)) + } + #[cfg(feature = "__runtime_js_sources")] + { + None + } } #[cfg(test)] @@ -18,7 +26,7 @@ mod tests { #[test] fn runtime_snapshot() { let mut js_runtime = deno_core::JsRuntime::new(deno_core::RuntimeOptions { - startup_snapshot: Some(deno_isolate_init()), + startup_snapshot: deno_isolate_init(), ..Default::default() }); js_runtime |