diff --git a/Cargo.lock b/Cargo.lock index 749e388d78..3cdc3f0a23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1195,9 +1195,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.257.0" +version = "0.258.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a9283383b7fe9712396c09407cbfb41c90778168f67d2ad1112a00a9df2e8f4" +checksum = "f200cdc161745281e4ec56e3b0e563058d2cc50a824ac901823ed0720b481619" dependencies = [ "anyhow", "bit-set", @@ -1645,9 +1645,9 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.133.0" +version = "0.134.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecf506732df72384bed194ce601bc6b77a5508d2de5da197c97c0a112013d504" +checksum = "fe122714b90abf065a746f452f69beae37324436a1541118ca4078b9b9d2b260" dependencies = [ "proc-macro-rules", "proc-macro2", @@ -5407,9 +5407,9 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.166.0" +version = "0.167.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cdf59dc8e11fc49804a1b677b41859fc4b24efbcd1cb162ebc4f0f39e15d2e1" +checksum = "cc6b38f6831f968e3813a480ca5a236c9a0972d9dcf0bb241f193ba524e4cf4e" dependencies = [ "bytes", "derive_more", diff --git a/Cargo.toml b/Cargo.toml index 21340ef4e5..fbcd2d41f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ repository = "https://github.com/denoland/deno" [workspace.dependencies] deno_ast = { version = "0.32.0", features = ["transpiling"] } -deno_core = { version = "0.257.0" } +deno_core = { version = "0.258.0" } deno_bench_util = { version = "0.130.0", path = "./bench_util" } deno_lockfile = "0.18.0" diff --git a/bench_util/benches/utf8.rs b/bench_util/benches/utf8.rs index 783983dcb1..48af4dba7e 100644 --- a/bench_util/benches/utf8.rs +++ b/bench_util/benches/utf8.rs @@ -6,27 +6,23 @@ use deno_bench_util::bencher::benchmark_group; use deno_bench_util::bencher::Bencher; use deno_bench_util::BenchOptions; use deno_core::Extension; -use deno_core::ExtensionFileSource; -use deno_core::ExtensionFileSourceCode; fn setup() -> Vec { - vec![Extension { - name: "bench_setup", - js_files: std::borrow::Cow::Borrowed(&[ExtensionFileSource { - specifier: "ext:bench_setup/setup.js", - code: ExtensionFileSourceCode::IncludedInBinary( - r#" + deno_core::extension!( + bench_setup, + js = ["ext:bench_setup/setup.js" = { + source = r#" const hello = "hello world\n"; const hello1k = hello.repeat(1e3); const hello1m = hello.repeat(1e6); const helloEncoded = Deno.core.encode(hello); const hello1kEncoded = Deno.core.encode(hello1k); const hello1mEncoded = Deno.core.encode(hello1m); - "#, - ), - }]), - ..Default::default() - }] + "# + }] + ); + + vec![bench_setup::init_ops_and_esm()] } fn bench_utf8_encode_12_b(b: &mut Bencher) { diff --git a/ext/node/lib.rs b/ext/node/lib.rs index 9d92f7663c..98b927ba83 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -509,56 +509,56 @@ deno_core::extension!(deno_node, "path/separator.ts", "readline/promises.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.js" with_specifier "node:querystring", - "readline.ts" with_specifier "node:readline", - "repl.ts" with_specifier "node:repl", - "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", - "testing.ts" with_specifier "node:test", - "timers.ts" with_specifier "node:timers", - "timers/promises.ts" with_specifier "node:timers/promises", - "tls.ts" with_specifier "node:tls", - "tty.js" 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", + "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.js", + "node:readline" = "readline.ts", + "node:repl" = "repl.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:test" = "testing.ts", + "node:timers" = "timers.ts", + "node:timers/promises" = "timers/promises.ts", + "node:tls" = "tls.ts", + "node:tty" = "tty.js", + "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", ], options = { maybe_npm_resolver: Option, diff --git a/ext/url/benches/url_ops.rs b/ext/url/benches/url_ops.rs index 23b8c5c504..70afb96db2 100644 --- a/ext/url/benches/url_ops.rs +++ b/ext/url/benches/url_ops.rs @@ -6,28 +6,24 @@ use deno_bench_util::bencher::benchmark_group; use deno_bench_util::bencher::Bencher; use deno_core::Extension; -use deno_core::ExtensionFileSource; -use deno_core::ExtensionFileSourceCode; fn setup() -> Vec { + deno_core::extension!( + bench_setup, + esm_entry_point = "ext:bench_setup/setup", + esm = ["ext:bench_setup/setup" = { + source = r#" + import { URL } from "ext:deno_url/00_url.js"; + globalThis.URL = URL; + "# + }] + ); + 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(), - 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; - "#, - ), - }]), - esm_entry_point: Some("ext:bench_setup/setup"), - ..Default::default() - }, + bench_setup::init_ops_and_esm(), ] } diff --git a/ext/web/benches/encoding.rs b/ext/web/benches/encoding.rs index 1c14c64019..d0738c6452 100644 --- a/ext/web/benches/encoding.rs +++ b/ext/web/benches/encoding.rs @@ -5,8 +5,6 @@ use deno_bench_util::bench_or_profile; use deno_bench_util::bencher::benchmark_group; use deno_bench_util::bencher::Bencher; use deno_core::Extension; -use deno_core::ExtensionFileSource; -use deno_core::ExtensionFileSourceCode; #[derive(Clone)] struct Permissions; @@ -18,6 +16,21 @@ impl deno_web::TimersPermission for Permissions { } fn setup() -> Vec { + deno_core::extension!( + bench_setup, + esm_entry_point = "ext:bench_setup/setup", + esm = ["ext:bench_setup/setup" = { + source = r#" + 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| { + state.put(Permissions {}); + }, + ); + vec![ deno_webidl::deno_webidl::init_ops_and_esm(), deno_url::deno_url::init_ops_and_esm(), @@ -26,24 +39,7 @@ fn setup() -> Vec { Default::default(), None, ), - 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)); - "#, - ), - }]), - esm_entry_point: Some("ext:bench_setup/setup"), - op_state_fn: Some(Box::new(|state| { - state.put(Permissions {}); - })), - ..Default::default() - }, + bench_setup::init_ops_and_esm(), ] } diff --git a/ext/web/benches/timers_ops.rs b/ext/web/benches/timers_ops.rs index 00721bd1e6..eda6d332e6 100644 --- a/ext/web/benches/timers_ops.rs +++ b/ext/web/benches/timers_ops.rs @@ -5,8 +5,6 @@ use deno_bench_util::bench_or_profile; use deno_bench_util::bencher::benchmark_group; use deno_bench_util::bencher::Bencher; use deno_core::Extension; -use deno_core::ExtensionFileSource; -use deno_core::ExtensionFileSourceCode; #[derive(Clone)] struct Permissions; @@ -18,6 +16,21 @@ impl deno_web::TimersPermission for Permissions { } fn setup() -> Vec { + deno_core::extension!( + bench_setup, + esm_entry_point = "ext:bench_setup/setup", + esm = ["ext:bench_setup/setup" = { + source = r#" + import { setTimeout, handleTimerMacrotask } from "ext:deno_web/02_timers.js"; + globalThis.setTimeout = setTimeout; + Deno.core.setMacrotaskCallback(handleTimerMacrotask); + "# + }], + state = |state| { + state.put(Permissions {}); + }, + ); + vec![ deno_webidl::deno_webidl::init_ops_and_esm(), deno_url::deno_url::init_ops_and_esm(), @@ -26,24 +39,7 @@ fn setup() -> Vec { 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); - "#, - ), - }]), - esm_entry_point: Some("ext:bench_setup/setup"), - op_state_fn: Some(Box::new(|state| { - state.put(Permissions {}); - })), - ..Default::default() - }, + bench_setup::init_ops_and_esm(), ] } diff --git a/ext/webidl/benches/dict.rs b/ext/webidl/benches/dict.rs index 8b1055dfa9..cfb658fa84 100644 --- a/ext/webidl/benches/dict.rs +++ b/ext/webidl/benches/dict.rs @@ -6,23 +6,17 @@ use deno_bench_util::bencher::benchmark_group; use deno_bench_util::bencher::Bencher; use deno_core::Extension; -use deno_core::ExtensionFileSource; -use deno_core::ExtensionFileSourceCode; fn setup() -> Vec { + deno_core::extension!( + deno_webidl_bench, + esm_entry_point = "ext:deno_webidl_bench/setup.js", + esm = ["ext:deno_webidl_bench/setup.js" = "benches/dict.js"] + ); + vec![ deno_webidl::deno_webidl::init_ops_and_esm(), - 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: Some("ext:deno_webidl_bench/setup.js"), - ..Default::default() - }, + deno_webidl_bench::init_ops_and_esm(), ] } diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index 3e9e9c6b1f..3022635ec5 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -378,11 +378,9 @@ core.registerErrorClass("BrokenPipe", errors.BrokenPipe); core.registerErrorClass("AlreadyExists", errors.AlreadyExists); core.registerErrorClass("InvalidData", errors.InvalidData); core.registerErrorClass("TimedOut", errors.TimedOut); -core.registerErrorClass("Interrupted", errors.Interrupted); core.registerErrorClass("WouldBlock", errors.WouldBlock); core.registerErrorClass("WriteZero", errors.WriteZero); core.registerErrorClass("UnexpectedEof", errors.UnexpectedEof); -core.registerErrorClass("BadResource", errors.BadResource); core.registerErrorClass("Http", errors.Http); core.registerErrorClass("Busy", errors.Busy); core.registerErrorClass("NotSupported", errors.NotSupported); diff --git a/runtime/shared.rs b/runtime/shared.rs index 1f24fec0bb..35712dfb3b 100644 --- a/runtime/shared.rs +++ b/runtime/shared.rs @@ -56,12 +56,7 @@ extension!(runtime, customizer = |ext: &mut Extension| { #[cfg(not(feature = "exclude_runtime_main_js"))] { - ext.esm_files.to_mut().push(ExtensionFileSource { - specifier: "ext:runtime_main/js/99_main.js", - code: ExtensionFileSourceCode::IncludedInBinary( - include_str!("./js/99_main.js"), - ), - }); + ext.esm_files.to_mut().push(ExtensionFileSource::new("ext:runtime_main/js/99_main.js", include_str!("./js/99_main.js"))); ext.esm_entry_point = Some("ext:runtime_main/js/99_main.js"); } }