1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-14 16:33:45 -05:00
denoland-deno/cli/startup_data.rs

42 lines
1.3 KiB
Rust
Raw Normal View History

2020-01-02 15:13:47 -05:00
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use crate::js::CLI_SNAPSHOT;
use crate::js::COMPILER_SNAPSHOT;
2020-04-22 14:24:49 -04:00
use deno_core::Snapshot;
use deno_core::StartupData;
#[cfg(feature = "no-snapshot-init")]
pub fn deno_isolate_init() -> StartupData<'static> {
debug!("Deno isolate init without snapshots.");
let source =
include_str!(concat!(env!("GN_OUT_DIR"), "/gen/cli/bundle/main.js"));
StartupData::Script(deno_core::Script {
filename: "gen/cli/bundle/main.js",
source,
})
}
#[cfg(not(feature = "no-snapshot-init"))]
pub fn deno_isolate_init() -> StartupData<'static> {
debug!("Deno isolate init with snapshots.");
let data = CLI_SNAPSHOT;
2020-04-22 14:24:49 -04:00
StartupData::Snapshot(Snapshot::Static(data))
}
#[cfg(feature = "no-snapshot-init")]
pub fn compiler_isolate_init() -> StartupData<'static> {
debug!("Compiler isolate init without snapshots.");
let source =
include_str!(concat!(env!("GN_OUT_DIR"), "/gen/cli/bundle/compiler.js"));
StartupData::Script(deno_core::Script {
filename: "gen/cli/bundle/compiler.js",
source,
})
}
#[cfg(not(feature = "no-snapshot-init"))]
pub fn compiler_isolate_init() -> StartupData<'static> {
debug!("Deno isolate init with snapshots.");
let data = COMPILER_SNAPSHOT;
2020-04-22 14:24:49 -04:00
StartupData::Snapshot(Snapshot::Static(data))
}