summaryrefslogtreecommitdiff
path: root/cli/build.rs
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2023-11-15 04:25:55 -0800
committerGitHub <noreply@github.com>2023-11-15 13:25:55 +0100
commit7f3902b41f68edddbc50b01ea52c697827d8516f (patch)
tree4fae66aafc0d4c81e9fa39d7e2e2117f1afcf551 /cli/build.rs
parentc67de43ff3221ae5554398095261d684b6d41dda (diff)
perf: static bootstrap options in snapshot (#21213)
Closes https://github.com/denoland/deno/issues/21133
Diffstat (limited to 'cli/build.rs')
-rw-r--r--cli/build.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/cli/build.rs b/cli/build.rs
index 6260c1c61..1480bb5c7 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -352,9 +352,18 @@ fn create_cli_snapshot(snapshot_path: PathBuf) -> CreateSnapshotOutput {
use deno_runtime::deno_cron::local::LocalCronHandler;
use deno_runtime::deno_http::DefaultHttpPropertyExtractor;
use deno_runtime::deno_kv::sqlite::SqliteDbHandler;
+ use deno_runtime::ops::bootstrap::SnapshotOptions;
use deno_runtime::permissions::PermissionsContainer;
use std::sync::Arc;
+ fn deno_version() -> String {
+ if env::var("DENO_CANARY").is_ok() {
+ format!("{}+{}", env!("CARGO_PKG_VERSION"), git_commit_hash())
+ } else {
+ env!("CARGO_PKG_VERSION").to_string()
+ }
+ }
+
// NOTE(bartlomieju): ordering is important here, keep it in sync with
// `runtime/worker.rs`, `runtime/web_worker.rs` and `runtime/build.rs`!
let fs = Arc::new(deno_fs::RealFs);
@@ -405,7 +414,14 @@ fn create_cli_snapshot(snapshot_path: PathBuf) -> CreateSnapshotOutput {
deno_runtime::ops::signal::deno_signal::init_ops(),
deno_runtime::ops::tty::deno_tty::init_ops(),
deno_runtime::ops::http::deno_http_runtime::init_ops(),
- deno_runtime::ops::bootstrap::deno_bootstrap::init_ops(),
+ deno_runtime::ops::bootstrap::deno_bootstrap::init_ops(Some(
+ SnapshotOptions {
+ deno_version: deno_version(),
+ ts_version: ts::version(),
+ v8_version: deno_core::v8_version(),
+ target: std::env::var("TARGET").unwrap(),
+ },
+ )),
cli::init_ops_and_esm(), // NOTE: This needs to be init_ops_and_esm!
];