2020-01-02 20:13:47 +00:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2019-06-23 11:49:49 +00:00
|
|
|
#[cfg(feature = "no-snapshot-init")]
|
2020-01-05 16:56:18 +00:00
|
|
|
use deno_core::Script;
|
2019-03-04 23:09:35 +00:00
|
|
|
|
2019-10-05 00:28:51 +00:00
|
|
|
use crate::js::CLI_SNAPSHOT;
|
|
|
|
use crate::js::COMPILER_SNAPSHOT;
|
2020-01-05 16:56:18 +00:00
|
|
|
use deno_core::StartupData;
|
2019-06-23 11:49:49 +00:00
|
|
|
|
|
|
|
#[cfg(feature = "no-snapshot-init")]
|
|
|
|
pub fn deno_isolate_init() -> StartupData<'static> {
|
|
|
|
debug!("Deno isolate init without snapshots.");
|
|
|
|
#[cfg(not(feature = "check-only"))]
|
|
|
|
let source =
|
|
|
|
include_str!(concat!(env!("GN_OUT_DIR"), "/gen/cli/bundle/main.js"));
|
|
|
|
#[cfg(feature = "check-only")]
|
|
|
|
let source = "";
|
|
|
|
|
|
|
|
StartupData::Script(Script {
|
|
|
|
filename: "gen/cli/bundle/main.js",
|
|
|
|
source,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(not(feature = "no-snapshot-init"))]
|
2019-04-08 14:12:43 +00:00
|
|
|
pub fn deno_isolate_init() -> StartupData<'static> {
|
2019-06-23 11:49:49 +00:00
|
|
|
debug!("Deno isolate init with snapshots.");
|
|
|
|
#[cfg(not(feature = "check-only"))]
|
2019-09-02 21:07:11 +00:00
|
|
|
let data = CLI_SNAPSHOT;
|
2019-06-23 11:49:49 +00:00
|
|
|
#[cfg(feature = "check-only")]
|
|
|
|
let data = b"";
|
|
|
|
|
|
|
|
StartupData::Snapshot(data)
|
2019-03-04 23:09:35 +00:00
|
|
|
}
|
|
|
|
|
2019-06-23 11:49:49 +00:00
|
|
|
#[cfg(feature = "no-snapshot-init")]
|
2019-04-08 14:12:43 +00:00
|
|
|
pub fn compiler_isolate_init() -> StartupData<'static> {
|
2019-06-23 11:49:49 +00:00
|
|
|
debug!("Compiler isolate init without snapshots.");
|
|
|
|
#[cfg(not(feature = "check-only"))]
|
|
|
|
let source =
|
|
|
|
include_str!(concat!(env!("GN_OUT_DIR"), "/gen/cli/bundle/compiler.js"));
|
|
|
|
#[cfg(feature = "check-only")]
|
|
|
|
let source = "";
|
|
|
|
|
|
|
|
StartupData::Script(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.");
|
|
|
|
#[cfg(not(feature = "check-only"))]
|
2019-09-02 21:07:11 +00:00
|
|
|
let data = COMPILER_SNAPSHOT;
|
2019-06-23 11:49:49 +00:00
|
|
|
#[cfg(feature = "check-only")]
|
|
|
|
let data = b"";
|
|
|
|
|
|
|
|
StartupData::Snapshot(data)
|
2019-03-04 23:09:35 +00:00
|
|
|
}
|