From 8f207c0f3f3a43d77e0c88cfdc840b4b742b9708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 9 Mar 2023 10:56:19 -0400 Subject: refactor: Split extension registration for runtime and snapshotting (#18095) This commit splits "::init" functions into "init_ops" and "init_ops_and_esm". That way we don't have to construct list of ESM sources on each startup if we're running with a snapshot. In a follow up commit "deno_core" will be changed to not have a split between "extensions" and "extensions_with_js" - it will be embedders' responsibility to pass appropriately configured extensions. Prerequisite for https://github.com/denoland/deno/pull/18080 --- cli/build.rs | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'cli') diff --git a/cli/build.rs b/cli/build.rs index 956293b78..6687b1e44 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -322,36 +322,40 @@ mod ts { fn create_cli_snapshot(snapshot_path: PathBuf) { let extensions: Vec = vec![ - deno_webidl::init(), - deno_console::init(), - deno_url::init(), + deno_webidl::init_esm(), + deno_console::init_esm(), + deno_url::init_ops_and_esm(), deno_tls::init(), - deno_web::init::( + deno_web::init_ops_and_esm::( deno_web::BlobStore::default(), Default::default(), ), - deno_fetch::init::(Default::default()), - deno_cache::init::(None), - deno_websocket::init::("".to_owned(), None, None), - deno_webstorage::init(None), - deno_crypto::init(None), - deno_webgpu::init(false), - deno_broadcast_channel::init( + deno_fetch::init_ops_and_esm::(Default::default()), + deno_cache::init_ops_and_esm::(None), + deno_websocket::init_ops_and_esm::( + "".to_owned(), + None, + None, + ), + deno_webstorage::init_ops_and_esm(None), + deno_crypto::init_ops_and_esm(None), + deno_webgpu::init_ops_and_esm(false), + deno_broadcast_channel::init_ops_and_esm( deno_broadcast_channel::InMemoryBroadcastChannel::default(), false, // No --unstable. ), - deno_io::init(Default::default()), - deno_fs::init::(false), - deno_node::init::(None), // No --unstable. + deno_io::init_ops_and_esm(Default::default()), + deno_fs::init_ops_and_esm::(false), + deno_node::init_ops_and_esm::(None), // No --unstable. deno_node::init_polyfill_ops_and_esm(), - deno_ffi::init::(false), - deno_net::init::( + deno_ffi::init_ops_and_esm::(false), + deno_net::init_ops_and_esm::( None, false, // No --unstable. None, ), deno_napi::init::(), - deno_http::init(), - deno_flash::init::(false), // No --unstable + deno_http::init_ops_and_esm(), + deno_flash::init_ops_and_esm::(false), // No --unstable ]; let mut esm_files = include_js_files!( -- cgit v1.2.3