diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-03-05 01:17:39 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-05 01:17:39 +0000 |
commit | d9fa2dd5505a773ac2c8eb6ca2a8bbd237aca35d (patch) | |
tree | ec5b0008f8095d3c03e6af31685ed99569163dd9 /runtime/snapshot.rs | |
parent | 0022c35a237773b50a771b0fef48cac734f7a9d6 (diff) |
chore: upgrade deno_core (#22699)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
Diffstat (limited to 'runtime/snapshot.rs')
-rw-r--r-- | runtime/snapshot.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/runtime/snapshot.rs b/runtime/snapshot.rs index e48af43ff..edfef39c2 100644 --- a/runtime/snapshot.rs +++ b/runtime/snapshot.rs @@ -13,6 +13,7 @@ use deno_http::DefaultHttpPropertyExtractor; use std::io::Write; use std::path::Path; use std::path::PathBuf; +use std::rc::Rc; use std::sync::Arc; #[derive(Clone)] @@ -204,7 +205,7 @@ pub fn create_runtime_snapshot( // NOTE(bartlomieju): ordering is important here, keep it in sync with // `runtime/worker.rs`, `runtime/web_worker.rs` and `runtime/snapshot.rs`! let fs = std::sync::Arc::new(deno_fs::RealFs); - let mut extensions: Vec<Extension> = vec![ + let extensions: Vec<Extension> = vec![ deno_webidl::deno_webidl::init_ops_and_esm(), deno_console::deno_console::init_ops_and_esm(), deno_url::deno_url::init_ops_and_esm(), @@ -257,20 +258,14 @@ pub fn create_runtime_snapshot( ops::web_worker::deno_web_worker::init_ops(), ]; - for extension in &mut extensions { - for source in extension.esm_files.to_mut() { - maybe_transpile_source(source).unwrap(); - } - for source in extension.js_files.to_mut() { - maybe_transpile_source(source).unwrap(); - } - } - let output = create_snapshot( CreateSnapshotOptions { cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"), startup_snapshot: None, extensions, + extension_transpiler: Some(Rc::new(|specifier, source| { + maybe_transpile_source(specifier, source) + })), with_runtime_cb: Some(Box::new(|rt| { let isolate = rt.v8_isolate(); let scope = &mut v8::HandleScope::new(isolate); |