From c3cba7f22c49ca3a3f58df44d8ea4c85d8510bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 9 Mar 2023 08:10:54 -0400 Subject: refactor(core): Extension::builder_with_deps (#18093) Prerequisite for https://github.com/denoland/deno/pull/18080 --- ext/fetch/lib.rs | 64 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 31 deletions(-) (limited to 'ext/fetch') diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs index f2a962539..8576b3c53 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 = -- cgit v1.2.3