1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 15:49:44 -05:00

fix(runtime): feature-flag snapshot from snapshot (#16843)

This commit is contained in:
Leo Kettmeir 2022-11-28 12:47:25 +01:00 committed by GitHub
parent 1dd4843b62
commit 9202611e36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 3 deletions

View file

@ -26,7 +26,7 @@ harness = false
path = "./bench/lsp_bench_standalone.rs"
[build-dependencies]
deno_runtime.workspace = true
deno_runtime = { workspace = true, features = ["snapshot_from_snapshot"] }
deno_core.workspace = true
regex.workspace = true
serde.workspace = true

View file

@ -12,6 +12,8 @@ description = "Provides the deno runtime library"
[features]
# "fake" feature that allows to generate docs on docs.rs
docsrs = []
# feature that modifies the snapshot to allow extending it
snapshot_from_snapshot = []
[lib]
name = "deno_runtime"

View file

@ -169,7 +169,14 @@ mod not_docs {
}
pub fn build_snapshot(runtime_snapshot_path: PathBuf) {
let js_files = get_js_files(env!("CARGO_MANIFEST_DIR"), "js");
#[allow(unused_mut)]
let mut js_files = get_js_files(env!("CARGO_MANIFEST_DIR"), "js");
#[cfg(not(feature = "snapshot_from_snapshot"))]
{
let manifest = env!("CARGO_MANIFEST_DIR");
let path = PathBuf::from(manifest);
js_files.push(path.join("js").join("99_main.js"));
}
create_runtime_snapshot(runtime_snapshot_path, js_files);
}
}

View file

@ -17,6 +17,7 @@ use deno_core::futures::channel::mpsc;
use deno_core::futures::future::poll_fn;
use deno_core::futures::stream::StreamExt;
use deno_core::futures::task::AtomicWaker;
use deno_core::located_script_name;
use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
use deno_core::serde_json::json;
@ -31,8 +32,8 @@ use deno_core::ModuleLoader;
use deno_core::ModuleSpecifier;
use deno_core::RuntimeOptions;
use deno_core::SharedArrayBufferStore;
use deno_core::Snapshot;
use deno_core::SourceMapGetter;
use deno_core::{located_script_name, Snapshot};
use deno_node::RequireNpmResolver;
use deno_tls::rustls::RootCertStore;
use deno_web::create_entangled_message_port;