summaryrefslogtreecommitdiff
path: root/cli/js.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js.rs')
-rw-r--r--cli/js.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/cli/js.rs b/cli/js.rs
index 6a312a206..f87bf6d73 100644
--- a/cli/js.rs
+++ b/cli/js.rs
@@ -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