mirror of
https://github.com/denoland/deno.git
synced 2025-03-09 13:49:37 -04:00
fix(runtime): snapshot options op missing during snapshot (#21235)
Porting https://github.com/denoland/deno/pull/21233 to release branch Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
This commit is contained in:
parent
2129f12f83
commit
2a55f50031
2 changed files with 23 additions and 0 deletions
|
@ -62,6 +62,7 @@ deno_websocket.workspace = true
|
|||
deno_webstorage.workspace = true
|
||||
deno_napi.workspace = true
|
||||
flate2 = { workspace = true, features = ["default"] }
|
||||
serde.workspace = true
|
||||
|
||||
[target.'cfg(windows)'.build-dependencies]
|
||||
winres.workspace = true
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue