diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2022-11-28 12:47:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-28 12:47:25 +0100 |
commit | 9202611e3695c7091f257b261af809697df959ab (patch) | |
tree | ba4dcc28d4c9caf6cc8d9c2ba10c29c0ecd498ce | |
parent | 1dd4843b62085a2aeb3134573adf9a7c47c154e2 (diff) |
fix(runtime): feature-flag snapshot from snapshot (#16843)
-rw-r--r-- | cli/Cargo.toml | 2 | ||||
-rw-r--r-- | runtime/Cargo.toml | 2 | ||||
-rw-r--r-- | runtime/build.rs | 9 | ||||
-rw-r--r-- | runtime/web_worker.rs | 3 |
4 files changed, 13 insertions, 3 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 0e46fd498..0bbb75ddc 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -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 diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index d130e9edc..ccfebe8af 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -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" diff --git a/runtime/build.rs b/runtime/build.rs index 62a3da03b..5887941ca 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -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); } } diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index a8e0842f2..89f0bd6c2 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -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; |