diff --git a/core/extensions.rs b/core/extensions.rs index 0ee6790ecf..3d17db5922 100644 --- a/core/extensions.rs +++ b/core/extensions.rs @@ -77,7 +77,7 @@ pub struct Extension { initialized: bool, enabled: bool, name: &'static str, - deps: Option>, + deps: Option<&'static [&'static str]>, } // Note: this used to be a trait, but we "downgraded" it to a single concrete type @@ -90,11 +90,22 @@ impl Extension { } } + pub fn builder_with_deps( + name: &'static str, + deps: &'static [&'static str], + ) -> ExtensionBuilder { + ExtensionBuilder { + name, + deps, + ..Default::default() + } + } + /// Check if dependencies have been loaded, and errors if either: /// - The extension is depending on itself or an extension with the same name. /// - A dependency hasn't been loaded yet. pub fn check_dependencies(&self, previous_exts: &[&mut Extension]) { - if let Some(deps) = &self.deps { + if let Some(deps) = self.deps { 'dep_loop: for dep in deps { if dep == &self.name { panic!("Extension '{}' is either depending on itself or there is another extension with the same name", self.name); @@ -194,15 +205,10 @@ pub struct ExtensionBuilder { middleware: Option>, event_loop_middleware: Option>, name: &'static str, - deps: Vec<&'static str>, + deps: &'static [&'static str], } impl ExtensionBuilder { - pub fn dependencies(&mut self, dependencies: Vec<&'static str>) -> &mut Self { - self.deps.extend(dependencies); - self - } - pub fn js(&mut self, js_files: Vec) -> &mut Self { let js_files = // TODO(bartlomieju): if we're automatically remapping here, then we should diff --git a/ext/broadcast_channel/lib.rs b/ext/broadcast_channel/lib.rs index cb8d318908..3698cc8855 100644 --- a/ext/broadcast_channel/lib.rs +++ b/ext/broadcast_channel/lib.rs @@ -110,20 +110,22 @@ pub fn init( bc: BC, unstable: bool, ) -> Extension { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_webidl", "deno_web"]) - .esm(include_js_files!("01_broadcast_channel.js",)) - .ops(vec![ - op_broadcast_subscribe::decl::(), - op_broadcast_unsubscribe::decl::(), - op_broadcast_send::decl::(), - op_broadcast_recv::decl::(), - ]) - .state(move |state| { - state.put(bc.clone()); - state.put(Unstable(unstable)); - }) - .build() + Extension::builder_with_deps( + env!("CARGO_PKG_NAME"), + &["deno_webidl", "deno_web"], + ) + .esm(include_js_files!("01_broadcast_channel.js",)) + .ops(vec![ + op_broadcast_subscribe::decl::(), + op_broadcast_unsubscribe::decl::(), + op_broadcast_send::decl::(), + op_broadcast_recv::decl::(), + ]) + .state(move |state| { + state.put(bc.clone()); + state.put(Unstable(unstable)); + }) + .build() } pub fn get_declaration() -> PathBuf { diff --git a/ext/cache/lib.rs b/ext/cache/lib.rs index 463ade94f4..477bbcb3e1 100644 --- a/ext/cache/lib.rs +++ b/ext/cache/lib.rs @@ -25,23 +25,25 @@ pub struct CreateCache(pub Arc C>); pub fn init( maybe_create_cache: Option>, ) -> Extension { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_webidl", "deno_web", "deno_url", "deno_fetch"]) - .esm(include_js_files!("01_cache.js",)) - .ops(vec![ - op_cache_storage_open::decl::(), - op_cache_storage_has::decl::(), - op_cache_storage_delete::decl::(), - op_cache_put::decl::(), - op_cache_match::decl::(), - op_cache_delete::decl::(), - ]) - .state(move |state| { - if let Some(create_cache) = maybe_create_cache.clone() { - state.put(create_cache); - } - }) - .build() + Extension::builder_with_deps( + env!("CARGO_PKG_NAME"), + &["deno_webidl", "deno_web", "deno_url", "deno_fetch"], + ) + .esm(include_js_files!("01_cache.js",)) + .ops(vec![ + op_cache_storage_open::decl::(), + op_cache_storage_has::decl::(), + op_cache_storage_delete::decl::(), + op_cache_put::decl::(), + op_cache_match::decl::(), + op_cache_delete::decl::(), + ]) + .state(move |state| { + if let Some(create_cache) = maybe_create_cache.clone() { + state.put(create_cache); + } + }) + .build() } pub fn get_declaration() -> PathBuf { diff --git a/ext/crypto/lib.rs b/ext/crypto/lib.rs index 6f456c9ee5..f406e64ec1 100644 --- a/ext/crypto/lib.rs +++ b/ext/crypto/lib.rs @@ -73,46 +73,48 @@ use crate::key::HkdfOutput; use crate::shared::RawKeyData; pub fn init(maybe_seed: Option) -> Extension { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_webidl", "deno_web"]) - .esm(include_js_files!("00_crypto.js", "01_webidl.js",)) - .ops(vec![ - op_crypto_get_random_values::decl(), - op_crypto_generate_key::decl(), - op_crypto_sign_key::decl(), - op_crypto_verify_key::decl(), - op_crypto_derive_bits::decl(), - op_crypto_import_key::decl(), - op_crypto_export_key::decl(), - op_crypto_encrypt::decl(), - op_crypto_decrypt::decl(), - op_crypto_subtle_digest::decl(), - op_crypto_random_uuid::decl(), - op_crypto_wrap_key::decl(), - op_crypto_unwrap_key::decl(), - op_crypto_base64url_decode::decl(), - op_crypto_base64url_encode::decl(), - x25519::op_generate_x25519_keypair::decl(), - x25519::op_derive_bits_x25519::decl(), - x25519::op_import_spki_x25519::decl(), - x25519::op_import_pkcs8_x25519::decl(), - ed25519::op_generate_ed25519_keypair::decl(), - ed25519::op_import_spki_ed25519::decl(), - ed25519::op_import_pkcs8_ed25519::decl(), - ed25519::op_sign_ed25519::decl(), - ed25519::op_verify_ed25519::decl(), - ed25519::op_export_spki_ed25519::decl(), - ed25519::op_export_pkcs8_ed25519::decl(), - ed25519::op_jwk_x_ed25519::decl(), - x25519::op_export_spki_x25519::decl(), - x25519::op_export_pkcs8_x25519::decl(), - ]) - .state(move |state| { - if let Some(seed) = maybe_seed { - state.put(StdRng::seed_from_u64(seed)); - } - }) - .build() + Extension::builder_with_deps( + env!("CARGO_PKG_NAME"), + &["deno_webidl", "deno_web"], + ) + .esm(include_js_files!("00_crypto.js", "01_webidl.js",)) + .ops(vec![ + op_crypto_get_random_values::decl(), + op_crypto_generate_key::decl(), + op_crypto_sign_key::decl(), + op_crypto_verify_key::decl(), + op_crypto_derive_bits::decl(), + op_crypto_import_key::decl(), + op_crypto_export_key::decl(), + op_crypto_encrypt::decl(), + op_crypto_decrypt::decl(), + op_crypto_subtle_digest::decl(), + op_crypto_random_uuid::decl(), + op_crypto_wrap_key::decl(), + op_crypto_unwrap_key::decl(), + op_crypto_base64url_decode::decl(), + op_crypto_base64url_encode::decl(), + x25519::op_generate_x25519_keypair::decl(), + x25519::op_derive_bits_x25519::decl(), + x25519::op_import_spki_x25519::decl(), + x25519::op_import_pkcs8_x25519::decl(), + ed25519::op_generate_ed25519_keypair::decl(), + ed25519::op_import_spki_ed25519::decl(), + ed25519::op_import_pkcs8_ed25519::decl(), + ed25519::op_sign_ed25519::decl(), + ed25519::op_verify_ed25519::decl(), + ed25519::op_export_spki_ed25519::decl(), + ed25519::op_export_pkcs8_ed25519::decl(), + ed25519::op_jwk_x_ed25519::decl(), + x25519::op_export_spki_x25519::decl(), + x25519::op_export_pkcs8_x25519::decl(), + ]) + .state(move |state| { + if let Some(seed) = maybe_seed { + state.put(StdRng::seed_from_u64(seed)); + } + }) + .build() } #[op] diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs index f2a962539c..8576b3c530 100644 --- a/ext/fetch/lib.rs +++ b/ext/fetch/lib.rs @@ -95,37 +95,39 @@ pub fn init(options: Options) -> Extension where FP: FetchPermissions + 'static, { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_webidl", "deno_web", "deno_url", "deno_console"]) - .esm(include_js_files!( - "20_headers.js", - "21_formdata.js", - "22_body.js", - "22_http_client.js", - "23_request.js", - "23_response.js", - "26_fetch.js", - )) - .ops(vec![ - op_fetch::decl::(), - op_fetch_send::decl(), - op_fetch_custom_client::decl::(), - ]) - .state(move |state| { - state.put::(options.clone()); - state.put::({ - create_http_client( - options.user_agent.clone(), - options.root_cert_store.clone(), - vec![], - options.proxy.clone(), - options.unsafely_ignore_certificate_errors.clone(), - options.client_cert_chain_and_key.clone(), - ) - .unwrap() - }); - }) - .build() + Extension::builder_with_deps( + env!("CARGO_PKG_NAME"), + &["deno_webidl", "deno_web", "deno_url", "deno_console"], + ) + .esm(include_js_files!( + "20_headers.js", + "21_formdata.js", + "22_body.js", + "22_http_client.js", + "23_request.js", + "23_response.js", + "26_fetch.js", + )) + .ops(vec![ + op_fetch::decl::(), + op_fetch_send::decl(), + op_fetch_custom_client::decl::(), + ]) + .state(move |state| { + state.put::(options.clone()); + state.put::({ + create_http_client( + options.user_agent.clone(), + options.root_cert_store.clone(), + vec![], + options.proxy.clone(), + options.unsafely_ignore_certificate_errors.clone(), + options.client_cert_chain_and_key.clone(), + ) + .unwrap() + }); + }) + .build() } pub type CancelableResponseFuture = diff --git a/ext/ffi/lib.rs b/ext/ffi/lib.rs index e9ce2ec2ed..8a1227ed99 100644 --- a/ext/ffi/lib.rs +++ b/ext/ffi/lib.rs @@ -82,8 +82,7 @@ pub(crate) struct FfiState { } pub fn init(unstable: bool) -> Extension { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_web"]) + Extension::builder_with_deps(env!("CARGO_PKG_NAME"), &["deno_web"]) .esm(include_js_files!("00_ffi.js",)) .ops(vec![ op_ffi_load::decl::

(), diff --git a/ext/flash/lib.rs b/ext/flash/lib.rs index b50b7bb5c7..605dc3e433 100644 --- a/ext/flash/lib.rs +++ b/ext/flash/lib.rs @@ -1527,46 +1527,48 @@ pub trait FlashPermissions { } pub fn init(unstable: bool) -> Extension { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec![ + Extension::builder_with_deps( + env!("CARGO_PKG_NAME"), + &[ "deno_web", "deno_net", "deno_fetch", "deno_websocket", "deno_http", - ]) - .esm(deno_core::include_js_files!("01_http.js",)) - .ops(vec![ - op_flash_serve::decl::

(), - op_node_unstable_flash_serve::decl::

(), - op_flash_respond::decl(), - op_flash_respond_async::decl(), - op_flash_respond_chunked::decl(), - op_flash_method::decl(), - op_flash_path::decl(), - op_flash_headers::decl(), - op_flash_addr::decl(), - op_flash_next::decl(), - op_flash_next_server::decl(), - op_flash_next_async::decl(), - op_flash_read_body::decl(), - op_flash_upgrade_websocket::decl(), - op_flash_drive_server::decl(), - op_flash_wait_for_listening::decl(), - op_flash_first_packet::decl(), - op_flash_has_body_stream::decl(), - op_flash_close_server::decl(), - op_flash_make_request::decl(), - op_flash_write_resource::decl(), - op_try_flash_respond_chunked::decl(), - ]) - .state(move |op_state| { - op_state.put(Unstable(unstable)); - op_state.put(FlashContext { - next_server_id: 0, - join_handles: HashMap::default(), - servers: HashMap::default(), - }); - }) - .build() + ], + ) + .esm(deno_core::include_js_files!("01_http.js",)) + .ops(vec![ + op_flash_serve::decl::

(), + op_node_unstable_flash_serve::decl::

(), + op_flash_respond::decl(), + op_flash_respond_async::decl(), + op_flash_respond_chunked::decl(), + op_flash_method::decl(), + op_flash_path::decl(), + op_flash_headers::decl(), + op_flash_addr::decl(), + op_flash_next::decl(), + op_flash_next_server::decl(), + op_flash_next_async::decl(), + op_flash_read_body::decl(), + op_flash_upgrade_websocket::decl(), + op_flash_drive_server::decl(), + op_flash_wait_for_listening::decl(), + op_flash_first_packet::decl(), + op_flash_has_body_stream::decl(), + op_flash_close_server::decl(), + op_flash_make_request::decl(), + op_flash_write_resource::decl(), + op_try_flash_respond_chunked::decl(), + ]) + .state(move |op_state| { + op_state.put(Unstable(unstable)); + op_state.put(FlashContext { + next_server_id: 0, + join_handles: HashMap::default(), + servers: HashMap::default(), + }); + }) + .build() } diff --git a/ext/http/lib.rs b/ext/http/lib.rs index eb73817735..14a93ede92 100644 --- a/ext/http/lib.rs +++ b/ext/http/lib.rs @@ -78,20 +78,22 @@ pub mod compressible; mod reader_stream; pub fn init() -> Extension { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_web", "deno_net", "deno_fetch", "deno_websocket"]) - .esm(include_js_files!("01_http.js",)) - .ops(vec![ - op_http_accept::decl(), - op_http_write_headers::decl(), - op_http_headers::decl(), - op_http_write::decl(), - op_http_write_resource::decl(), - op_http_shutdown::decl(), - op_http_websocket_accept_header::decl(), - op_http_upgrade_websocket::decl(), - ]) - .build() + Extension::builder_with_deps( + env!("CARGO_PKG_NAME"), + &["deno_web", "deno_net", "deno_fetch", "deno_websocket"], + ) + .esm(include_js_files!("01_http.js",)) + .ops(vec![ + op_http_accept::decl(), + op_http_write_headers::decl(), + op_http_headers::decl(), + op_http_write::decl(), + op_http_write_resource::decl(), + op_http_shutdown::decl(), + op_http_websocket_accept_header::decl(), + op_http_upgrade_websocket::decl(), + ]) + .build() } pub enum HttpSocketAddr { diff --git a/ext/io/lib.rs b/ext/io/lib.rs index 84d9d34a6b..8eebc93aef 100644 --- a/ext/io/lib.rs +++ b/ext/io/lib.rs @@ -82,9 +82,8 @@ pub fn init(stdio: Stdio) -> Extension { // todo(dsheret): don't do this? Taking out the writers was necessary to prevent invalid handle panics let stdio = Rc::new(RefCell::new(Some(stdio))); - Extension::builder("deno_io") + Extension::builder_with_deps("deno_io", &["deno_web"]) .ops(vec![op_read_sync::decl(), op_write_sync::decl()]) - .dependencies(vec!["deno_web"]) .esm(include_js_files!("12_io.js",)) .middleware(|op| match op.name { "op_print" => op_print::decl(), diff --git a/ext/net/lib.rs b/ext/net/lib.rs index 5dc7823bcd..780cbceb5a 100644 --- a/ext/net/lib.rs +++ b/ext/net/lib.rs @@ -84,8 +84,7 @@ pub fn init( ) -> Extension { let mut ops = ops::init::

(); ops.extend(ops_tls::init::

()); - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_web"]) + Extension::builder_with_deps(env!("CARGO_PKG_NAME"), &["deno_web"]) .esm(include_js_files!("01_net.js", "02_tls.js",)) .ops(ops) .state(move |state| { diff --git a/ext/node/lib.rs b/ext/node/lib.rs index 496d35fbc3..899a1d30c2 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -332,10 +332,9 @@ pub fn init_polyfill_ops_and_esm() -> Extension { "zlib.ts", ); - Extension::builder(env!("CARGO_PKG_NAME")) + Extension::builder_with_deps(env!("CARGO_PKG_NAME"), &["deno_io", "deno_fs"]) .esm(esm_files) .esm_entry_point("ext:deno_node/module_all.ts") - .dependencies(vec!["deno_io", "deno_fs"]) .ops(vec![ crypto::op_node_create_hash::decl(), crypto::op_node_hash_update::decl(), diff --git a/ext/url/lib.rs b/ext/url/lib.rs index 4f15cb9247..f1295a13fb 100644 --- a/ext/url/lib.rs +++ b/ext/url/lib.rs @@ -18,8 +18,7 @@ use crate::urlpattern::op_urlpattern_parse; use crate::urlpattern::op_urlpattern_process_match_input; pub fn init() -> Extension { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_webidl"]) + Extension::builder_with_deps(env!("CARGO_PKG_NAME"), &["deno_webidl"]) .esm(include_js_files!("00_url.js", "01_urlpattern.js",)) .ops(vec![ op_url_reparse::decl(), diff --git a/ext/web/lib.rs b/ext/web/lib.rs index 1af4cc29d7..6a21a7470d 100644 --- a/ext/web/lib.rs +++ b/ext/web/lib.rs @@ -62,67 +62,69 @@ pub fn init( blob_store: BlobStore, maybe_location: Option, ) -> Extension { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_webidl", "deno_console", "deno_url"]) - .esm(include_js_files!( - "00_infra.js", - "01_dom_exception.js", - "01_mimesniff.js", - "02_event.js", - "02_structured_clone.js", - "02_timers.js", - "03_abort_signal.js", - "04_global_interfaces.js", - "05_base64.js", - "06_streams.js", - "08_text_encoding.js", - "09_file.js", - "10_filereader.js", - "11_blob_url.js", - "12_location.js", - "13_message_port.js", - "14_compression.js", - "15_performance.js", - )) - .ops(vec![ - op_base64_decode::decl(), - op_base64_encode::decl(), - op_base64_atob::decl(), - op_base64_btoa::decl(), - op_encoding_normalize_label::decl(), - op_encoding_decode_single::decl(), - op_encoding_decode_utf8::decl(), - op_encoding_new_decoder::decl(), - op_encoding_decode::decl(), - op_encoding_encode_into::decl(), - op_encode_binary_string::decl(), - op_blob_create_part::decl(), - op_blob_slice_part::decl(), - op_blob_read_part::decl(), - op_blob_remove_part::decl(), - op_blob_create_object_url::decl(), - op_blob_revoke_object_url::decl(), - op_blob_from_object_url::decl(), - op_message_port_create_entangled::decl(), - op_message_port_post_message::decl(), - op_message_port_recv_message::decl(), - compression::op_compression_new::decl(), - compression::op_compression_write::decl(), - compression::op_compression_finish::decl(), - op_now::decl::

(), - op_timer_handle::decl(), - op_cancel_handle::decl(), - op_sleep::decl(), - op_transfer_arraybuffer::decl(), - ]) - .state(move |state| { - state.put(blob_store.clone()); - if let Some(location) = maybe_location.clone() { - state.put(Location(location)); - } - state.put(StartTime::now()); - }) - .build() + Extension::builder_with_deps( + env!("CARGO_PKG_NAME"), + &["deno_webidl", "deno_console", "deno_url"], + ) + .esm(include_js_files!( + "00_infra.js", + "01_dom_exception.js", + "01_mimesniff.js", + "02_event.js", + "02_structured_clone.js", + "02_timers.js", + "03_abort_signal.js", + "04_global_interfaces.js", + "05_base64.js", + "06_streams.js", + "08_text_encoding.js", + "09_file.js", + "10_filereader.js", + "11_blob_url.js", + "12_location.js", + "13_message_port.js", + "14_compression.js", + "15_performance.js", + )) + .ops(vec![ + op_base64_decode::decl(), + op_base64_encode::decl(), + op_base64_atob::decl(), + op_base64_btoa::decl(), + op_encoding_normalize_label::decl(), + op_encoding_decode_single::decl(), + op_encoding_decode_utf8::decl(), + op_encoding_new_decoder::decl(), + op_encoding_decode::decl(), + op_encoding_encode_into::decl(), + op_encode_binary_string::decl(), + op_blob_create_part::decl(), + op_blob_slice_part::decl(), + op_blob_read_part::decl(), + op_blob_remove_part::decl(), + op_blob_create_object_url::decl(), + op_blob_revoke_object_url::decl(), + op_blob_from_object_url::decl(), + op_message_port_create_entangled::decl(), + op_message_port_post_message::decl(), + op_message_port_recv_message::decl(), + compression::op_compression_new::decl(), + compression::op_compression_write::decl(), + compression::op_compression_finish::decl(), + op_now::decl::

(), + op_timer_handle::decl(), + op_cancel_handle::decl(), + op_sleep::decl(), + op_transfer_arraybuffer::decl(), + ]) + .state(move |state| { + state.put(blob_store.clone()); + if let Some(location) = maybe_location.clone() { + state.put(Location(location)); + } + state.put(StartTime::now()); + }) + .build() } #[op] diff --git a/ext/webgpu/lib.rs b/ext/webgpu/lib.rs index 8e13a80501..aa6207d349 100644 --- a/ext/webgpu/lib.rs +++ b/ext/webgpu/lib.rs @@ -117,18 +117,20 @@ impl Resource for WebGpuQuerySet { } pub fn init(unstable: bool) -> Extension { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_webidl", "deno_web"]) - .esm(include_js_files!("01_webgpu.js", "02_idl_types.js",)) - .ops(declare_webgpu_ops()) - .state(move |state| { - // TODO: check & possibly streamline this - // Unstable might be able to be OpMiddleware - // let unstable_checker = state.borrow::(); - // let unstable = unstable_checker.unstable; - state.put(Unstable(unstable)); - }) - .build() + Extension::builder_with_deps( + env!("CARGO_PKG_NAME"), + &["deno_webidl", "deno_web"], + ) + .esm(include_js_files!("01_webgpu.js", "02_idl_types.js",)) + .ops(declare_webgpu_ops()) + .state(move |state| { + // TODO: check & possibly streamline this + // Unstable might be able to be OpMiddleware + // let unstable_checker = state.borrow::(); + // let unstable = unstable_checker.unstable; + state.put(Unstable(unstable)); + }) + .build() } fn deserialize_features(features: &wgpu_types::Features) -> Vec<&'static str> { diff --git a/ext/websocket/lib.rs b/ext/websocket/lib.rs index 4537c45e58..bf6d519141 100644 --- a/ext/websocket/lib.rs +++ b/ext/websocket/lib.rs @@ -502,27 +502,29 @@ pub fn init( root_cert_store: Option, unsafely_ignore_certificate_errors: Option>, ) -> Extension { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_url", "deno_webidl"]) - .esm(include_js_files!( - "01_websocket.js", - "02_websocketstream.js", - )) - .ops(vec![ - op_ws_check_permission_and_cancel_handle::decl::

(), - op_ws_create::decl::

(), - op_ws_send::decl(), - op_ws_close::decl(), - op_ws_next_event::decl(), - ]) - .state(move |state| { - state.put::(WsUserAgent(user_agent.clone())); - state.put(UnsafelyIgnoreCertificateErrors( - unsafely_ignore_certificate_errors.clone(), - )); - state.put::(WsRootStore(root_cert_store.clone())); - }) - .build() + Extension::builder_with_deps( + env!("CARGO_PKG_NAME"), + &["deno_url", "deno_webidl"], + ) + .esm(include_js_files!( + "01_websocket.js", + "02_websocketstream.js", + )) + .ops(vec![ + op_ws_check_permission_and_cancel_handle::decl::

(), + op_ws_create::decl::

(), + op_ws_send::decl(), + op_ws_close::decl(), + op_ws_next_event::decl(), + ]) + .state(move |state| { + state.put::(WsUserAgent(user_agent.clone())); + state.put(UnsafelyIgnoreCertificateErrors( + unsafely_ignore_certificate_errors.clone(), + )); + state.put::(WsRootStore(root_cert_store.clone())); + }) + .build() } pub fn get_declaration() -> PathBuf { diff --git a/ext/webstorage/lib.rs b/ext/webstorage/lib.rs index 98f1246d20..e98b5da411 100644 --- a/ext/webstorage/lib.rs +++ b/ext/webstorage/lib.rs @@ -22,8 +22,7 @@ struct OriginStorageDir(PathBuf); const MAX_STORAGE_BYTES: u32 = 10 * 1024 * 1024; pub fn init(origin_storage_dir: Option) -> Extension { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_webidl"]) + Extension::builder_with_deps(env!("CARGO_PKG_NAME"), &["deno_webidl"]) .esm(include_js_files!("01_webstorage.js",)) .ops(vec![ op_webstorage_length::decl(), diff --git a/runtime/build.rs b/runtime/build.rs index 5bf694cec9..d9f428e9b7 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -204,8 +204,9 @@ mod startup_snapshot { snapshot_path: PathBuf, maybe_additional_extension: Option, ) { - let runtime_extension = Extension::builder("runtime") - .dependencies(vec![ + let runtime_extension = Extension::builder_with_deps( + "runtime", + &[ "deno_webidl", "deno_console", "deno_url", @@ -227,26 +228,27 @@ mod startup_snapshot { "deno_flash", "deno_io", "deno_fs", - ]) - .esm(include_js_files!( - dir "js", - "01_errors.js", - "01_version.ts", - "06_util.js", - "10_permissions.js", - "11_workers.js", - "13_buffer.js", - "30_os.js", - "40_fs_events.js", - "40_http.js", - "40_process.js", - "40_signals.js", - "40_tty.js", - "41_prompt.js", - "90_deno_ns.js", - "98_global_scope.js", - )) - .build(); + ], + ) + .esm(include_js_files!( + dir "js", + "01_errors.js", + "01_version.ts", + "06_util.js", + "10_permissions.js", + "11_workers.js", + "13_buffer.js", + "30_os.js", + "40_fs_events.js", + "40_http.js", + "40_process.js", + "40_signals.js", + "40_tty.js", + "41_prompt.js", + "90_deno_ns.js", + "98_global_scope.js", + )) + .build(); let mut extensions_with_js: Vec = vec![ deno_webidl::init(),