diff options
author | denobot <33910674+denobot@users.noreply.github.com> | 2023-11-17 00:57:25 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-17 17:57:25 +0900 |
commit | 21e6a7651967acbe8c35ec0e1e906cdcf3ce38b1 (patch) | |
tree | 8552e69715fca852d30059417ec6946c9a67f8ef /runtime/build.rs | |
parent | 9534e6e1131542653c4e266f712c4067af2c8ec0 (diff) |
chore: forward v1.38.2 release commit to main (#21236)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Diffstat (limited to 'runtime/build.rs')
-rw-r--r-- | runtime/build.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/runtime/build.rs b/runtime/build.rs index 606d341f3..f77f3ed07 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -13,13 +13,34 @@ mod startup_snapshot { use super::*; use deno_cache::SqliteBackedCache; use deno_core::error::AnyError; + use deno_core::op2; use deno_core::snapshot_util::*; use deno_core::Extension; + use deno_core::OpState; use deno_http::DefaultHttpPropertyExtractor; use shared::maybe_transpile_source; use shared::runtime; use std::path::Path; + // Keep in sync with `runtime/ops/bootstrap.rs` + #[derive(serde::Serialize, Default)] + #[serde(rename_all = "camelCase")] + pub struct SnapshotOptions { + pub deno_version: String, + pub ts_version: String, + pub v8_version: &'static str, + pub target: String, + } + + // TODO(@littledivy): Remove this once we get rid of deno_runtime snapshots. + #[op2] + #[serde] + pub fn op_snapshot_options(_: &mut OpState) -> SnapshotOptions { + SnapshotOptions::default() + } + + deno_core::extension!(snapshot, ops = [op_snapshot_options],); + #[derive(Clone)] struct Permissions; @@ -232,6 +253,7 @@ mod startup_snapshot { deno_fs::deno_fs::init_ops_and_esm::<Permissions>(fs.clone()), deno_node::deno_node::init_ops_and_esm::<Permissions>(None, fs), runtime::init_ops_and_esm(), + snapshot::init_ops_and_esm(), ]; for extension in &mut extensions { |