diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/fs/lib.rs | 1 | ||||
-rw-r--r-- | ext/kv/lib.rs | 1 | ||||
-rw-r--r-- | ext/node/lib.rs | 105 | ||||
-rw-r--r-- | ext/url/benches/url_ops.rs | 17 | ||||
-rw-r--r-- | ext/web/benches/encoding.rs | 22 | ||||
-rw-r--r-- | ext/web/benches/timers_ops.rs | 37 | ||||
-rw-r--r-- | ext/webidl/benches/dict.rs | 12 |
7 files changed, 101 insertions, 94 deletions
diff --git a/ext/fs/lib.rs b/ext/fs/lib.rs index 7ba6cd7ca..d27712927 100644 --- a/ext/fs/lib.rs +++ b/ext/fs/lib.rs @@ -19,7 +19,6 @@ use crate::ops::*; use deno_core::error::AnyError; use deno_core::OpState; use std::cell::RefCell; -use std::convert::From; use std::path::Path; use std::rc::Rc; diff --git a/ext/kv/lib.rs b/ext/kv/lib.rs index db7c5c22e..a781f4579 100644 --- a/ext/kv/lib.rs +++ b/ext/kv/lib.rs @@ -8,7 +8,6 @@ use std::borrow::Cow; use std::cell::RefCell; use std::num::NonZeroU32; use std::rc::Rc; -use std::vec; use codec::decode_key; use codec::encode_key; diff --git a/ext/node/lib.rs b/ext/node/lib.rs index 89ee87cd3..8f910ac63 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -446,58 +446,55 @@ deno_core::extension!(deno_node, "path/separator.ts", "readline/promises.ts", "repl.ts", - "wasi.ts" - ], - esm_with_specifiers = [ - dir "polyfills", - ("node:assert", "assert.ts"), - ("node:assert/strict", "assert/strict.ts"), - ("node:async_hooks", "async_hooks.ts"), - ("node:buffer", "buffer.ts"), - ("node:child_process", "child_process.ts"), - ("node:cluster", "cluster.ts"), - ("node:console", "console.ts"), - ("node:constants", "constants.ts"), - ("node:crypto", "crypto.ts"), - ("node:dgram", "dgram.ts"), - ("node:diagnostics_channel", "diagnostics_channel.ts"), - ("node:dns", "dns.ts"), - ("node:dns/promises", "dns/promises.ts"), - ("node:domain", "domain.ts"), - ("node:events", "events.ts"), - ("node:fs", "fs.ts"), - ("node:fs/promises", "fs/promises.ts"), - ("node:http", "http.ts"), - ("node:http2", "http2.ts"), - ("node:https", "https.ts"), - ("node:module", "01_require.js"), - ("node:net", "net.ts"), - ("node:os", "os.ts"), - ("node:path", "path.ts"), - ("node:path/posix", "path/posix.ts"), - ("node:path/win32", "path/win32.ts"), - ("node:perf_hooks", "perf_hooks.ts"), - ("node:process", "process.ts"), - ("node:punycode", "punycode.ts"), - ("node:querystring", "querystring.ts"), - ("node:readline", "readline.ts"), - ("node:stream", "stream.ts"), - ("node:stream/consumers", "stream/consumers.mjs"), - ("node:stream/promises", "stream/promises.mjs"), - ("node:stream/web", "stream/web.ts"), - ("node:string_decoder", "string_decoder.ts"), - ("node:sys", "sys.ts"), - ("node:timers", "timers.ts"), - ("node:timers/promises", "timers/promises.ts"), - ("node:tls", "tls.ts"), - ("node:tty", "tty.ts"), - ("node:url", "url.ts"), - ("node:util", "util.ts"), - ("node:util/types", "util/types.ts"), - ("node:v8", "v8.ts"), - ("node:vm", "vm.ts"), - ("node:worker_threads", "worker_threads.ts"), - ("node:zlib", "zlib.ts"), + "wasi.ts", + "assert.ts" with_specifier "node:assert", + "assert/strict.ts" with_specifier "node:assert/strict", + "async_hooks.ts" with_specifier "node:async_hooks", + "buffer.ts" with_specifier "node:buffer", + "child_process.ts" with_specifier "node:child_process", + "cluster.ts" with_specifier "node:cluster", + "console.ts" with_specifier "node:console", + "constants.ts" with_specifier "node:constants", + "crypto.ts" with_specifier "node:crypto", + "dgram.ts" with_specifier "node:dgram", + "diagnostics_channel.ts" with_specifier "node:diagnostics_channel", + "dns.ts" with_specifier "node:dns", + "dns/promises.ts" with_specifier "node:dns/promises", + "domain.ts" with_specifier "node:domain", + "events.ts" with_specifier "node:events", + "fs.ts" with_specifier "node:fs", + "fs/promises.ts" with_specifier "node:fs/promises", + "http.ts" with_specifier "node:http", + "http2.ts" with_specifier "node:http2", + "https.ts" with_specifier "node:https", + "01_require.js" with_specifier "node:module", + "net.ts" with_specifier "node:net", + "os.ts" with_specifier "node:os", + "path.ts" with_specifier "node:path", + "path/posix.ts" with_specifier "node:path/posix", + "path/win32.ts" with_specifier "node:path/win32", + "perf_hooks.ts" with_specifier "node:perf_hooks", + "process.ts" with_specifier "node:process", + "punycode.ts" with_specifier "node:punycode", + "querystring.ts" with_specifier "node:querystring", + "readline.ts" with_specifier "node:readline", + "stream.ts" with_specifier "node:stream", + "stream/consumers.mjs" with_specifier "node:stream/consumers", + "stream/promises.mjs" with_specifier "node:stream/promises", + "stream/web.ts" with_specifier "node:stream/web", + "string_decoder.ts" with_specifier "node:string_decoder", + "sys.ts" with_specifier "node:sys", + "timers.ts" with_specifier "node:timers", + "timers/promises.ts" with_specifier "node:timers/promises", + "tls.ts" with_specifier "node:tls", + "tty.ts" with_specifier "node:tty", + "url.ts" with_specifier "node:url", + "util.ts" with_specifier "node:util", + "util/types.ts" with_specifier "node:util/types", + "v8.ts" with_specifier "node:v8", + "vm.ts" with_specifier "node:vm", + "worker_threads.ts" with_specifier "node:worker_threads", + "zlib.ts" with_specifier "node:zlib", ], options = { maybe_npm_resolver: Option<NpmResolverRc>, @@ -516,7 +513,7 @@ deno_core::extension!(deno_node, }, global_template_middleware = global_template_middleware, global_object_middleware = global_object_middleware, - customizer = |ext: &mut deno_core::ExtensionBuilder| { + customizer = |ext: &mut deno_core::Extension| { let mut external_references = Vec::with_capacity(7); global::GETTER_MAP_FN.with(|getter| { @@ -554,7 +551,7 @@ deno_core::extension!(deno_node, named_getter: *descriptor, }); }); - ext.external_references(external_references); + ext.external_references.to_mut().extend(external_references); }, ); diff --git a/ext/url/benches/url_ops.rs b/ext/url/benches/url_ops.rs index 835dfea2e..b65a0e345 100644 --- a/ext/url/benches/url_ops.rs +++ b/ext/url/benches/url_ops.rs @@ -13,17 +13,20 @@ fn setup() -> Vec<Extension> { vec![ deno_webidl::deno_webidl::init_ops_and_esm(), deno_url::deno_url::init_ops_and_esm(), - Extension::builder("bench_setup") - .esm(vec![ExtensionFileSource { + Extension { + name: "bench_setup", + esm_files: std::borrow::Cow::Borrowed(&[ExtensionFileSource { specifier: "ext:bench_setup/setup", code: ExtensionFileSourceCode::IncludedInBinary( - r#"import { URL } from "ext:deno_url/00_url.js"; - globalThis.URL = URL; + r#" + import { URL } from "ext:deno_url/00_url.js"; + globalThis.URL = URL; "#, ), - }]) - .esm_entry_point("ext:bench_setup/setup") - .build(), + }]), + esm_entry_point: Some("ext:bench_setup/setup"), + ..Default::default() + }, ] } diff --git a/ext/web/benches/encoding.rs b/ext/web/benches/encoding.rs index 12fff5d75..fc4ab37fc 100644 --- a/ext/web/benches/encoding.rs +++ b/ext/web/benches/encoding.rs @@ -30,22 +30,24 @@ fn setup() -> Vec<Extension> { Default::default(), None, ), - Extension::builder("bench_setup") - .esm(vec![ExtensionFileSource { + Extension { + name: "bench_setup", + esm_files: std::borrow::Cow::Borrowed(&[ExtensionFileSource { specifier: "ext:bench_setup/setup", code: ExtensionFileSourceCode::IncludedInBinary( r#" - import { TextDecoder } from "ext:deno_web/08_text_encoding.js"; - globalThis.TextDecoder = TextDecoder; - globalThis.hello12k = Deno.core.encode("hello world\n".repeat(1e3)); + import { TextDecoder } from "ext:deno_web/08_text_encoding.js"; + globalThis.TextDecoder = TextDecoder; + globalThis.hello12k = Deno.core.encode("hello world\n".repeat(1e3)); "#, ), - }]) - .state(|state| { + }]), + esm_entry_point: Some("ext:bench_setup/setup"), + op_state_fn: Some(Box::new(|state| { state.put(Permissions {}); - }) - .esm_entry_point("ext:bench_setup/setup") - .build(), + })), + ..Default::default() + }, ] } diff --git a/ext/web/benches/timers_ops.rs b/ext/web/benches/timers_ops.rs index 9d74abd17..589fc8534 100644 --- a/ext/web/benches/timers_ops.rs +++ b/ext/web/benches/timers_ops.rs @@ -24,23 +24,28 @@ fn setup() -> Vec<Extension> { deno_webidl::deno_webidl::init_ops_and_esm(), deno_url::deno_url::init_ops_and_esm(), deno_console::deno_console::init_ops_and_esm(), - deno_web::deno_web::init_ops_and_esm::<Permissions>(Default::default(), None), - Extension::builder("bench_setup") - .esm(vec![ - ExtensionFileSource { + deno_web::deno_web::init_ops_and_esm::<Permissions>( + Default::default(), + None, + ), + Extension { + name: "bench_setup", + esm_files: std::borrow::Cow::Borrowed(&[ExtensionFileSource { specifier: "ext:bench_setup/setup", - code: ExtensionFileSourceCode::IncludedInBinary(r#" - import { setTimeout, handleTimerMacrotask } from "ext:deno_web/02_timers.js"; - globalThis.setTimeout = setTimeout; - Deno.core.setMacrotaskCallback(handleTimerMacrotask); - "#) - }, - ]) - .state(|state| { - state.put(Permissions{}); - }) - .esm_entry_point("ext:bench_setup/setup") - .build() + code: ExtensionFileSourceCode::IncludedInBinary( + r#" + import { setTimeout, handleTimerMacrotask } from "ext:deno_web/02_timers.js"; + globalThis.setTimeout = setTimeout; + Deno.core.setMacrotaskCallback(handleTimerMacrotask); + "#, + ), + }]), + esm_entry_point: Some("ext:bench_setup/setup"), + op_state_fn: Some(Box::new(|state| { + state.put(Permissions {}); + })), + ..Default::default() + }, ] } diff --git a/ext/webidl/benches/dict.rs b/ext/webidl/benches/dict.rs index b3d95c8a3..e7f4d0300 100644 --- a/ext/webidl/benches/dict.rs +++ b/ext/webidl/benches/dict.rs @@ -12,15 +12,17 @@ use deno_core::ExtensionFileSourceCode; fn setup() -> Vec<Extension> { vec![ deno_webidl::deno_webidl::init_ops_and_esm(), - Extension::builder("deno_webidl_bench") - .esm(vec![ExtensionFileSource { + Extension { + name: "deno_webidl_bench", + esm_files: std::borrow::Cow::Borrowed(&[ExtensionFileSource { specifier: "ext:deno_webidl_bench/setup.js", code: ExtensionFileSourceCode::IncludedInBinary(include_str!( "dict.js" )), - }]) - .esm_entry_point("ext:deno_webidl_bench/setup.js") - .build(), + }]), + esm_entry_point: Some("ext:deno_webidl_bench/setup.js"), + ..Default::default() + }, ] } |