From c56f2e0fc04f12d3a69c1892d8866323995f3be4 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sat, 13 Apr 2024 01:15:38 +0530 Subject: [PATCH] chore: upgrade deno_core to 0.274.0 (#23344) Signed-off-by: Divy Srivastava --- Cargo.lock | 64 +++++++++++++++---- Cargo.toml | 2 +- cli/lsp/tsc.rs | 10 ++- cli/ops/jupyter.rs | 3 +- cli/tsc/mod.rs | 48 +++++++++++--- ext/io/lib.rs | 3 +- ext/net/ops.rs | 35 +++++++++- runtime/ops/os/mod.rs | 3 +- .../eval_context_throw_dom_exception.js.out | 2 +- 9 files changed, 137 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5290a1ce10..1debff5e7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -462,6 +462,18 @@ dependencies = [ "serde", ] +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block" version = "0.1.6" @@ -1282,9 +1294,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.272.0" +version = "0.274.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07093891f2af763023614cfe2d1ce5f9ce5a7920c4fcf2f00911bd0d93083523" +checksum = "473f7e7cfa6862e72da6adeb9ac2e252c900e18982522be45aa8241e5e6d9fd4" dependencies = [ "anyhow", "bincode", @@ -1297,7 +1309,6 @@ dependencies = [ "deno_unsync 0.3.2", "futures", "libc", - "log", "memoffset 0.9.1", "parking_lot 0.12.1", "pin-project", @@ -1305,7 +1316,7 @@ dependencies = [ "serde_json", "serde_v8", "smallvec", - "sourcemap 7.1.1", + "sourcemap 8.0.1", "static_assertions", "tokio", "url", @@ -1742,9 +1753,9 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.148.0" +version = "0.150.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc73fc07ad26e71715d5a726d1dd228587c0d121a591b1931a0fcf958a2ec3b" +checksum = "cc87a3ee5742db42580d2a067a16990159c49044a4e447297bcd60ffb29336d7" dependencies = [ "proc-macro-rules", "proc-macro2", @@ -2764,6 +2775,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futf" version = "0.1.5" @@ -5015,6 +5032,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "radix_fmt" version = "1.0.0" @@ -5662,9 +5685,9 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.181.0" +version = "0.183.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd25bb66a20a1a405fb3733aaaf8a8a77a14fd55c8f5fd9db2a2e95bbd7eeab9" +checksum = "40a4a61adb424734b07eac7e6521e19cc07fb06f217511494ee9cd07b6e7401c" dependencies = [ "bytes", "num-bigint", @@ -5858,14 +5881,16 @@ dependencies = [ [[package]] name = "sourcemap" -version = "7.1.1" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7768edd06c02535e0d50653968f46e1e0d3aa54742190d35dd9466f59de9c71" +checksum = "208d40b9e8cad9f93613778ea295ed8f3c2b1824217c6cfc7219d3f6f45b96d4" dependencies = [ "base64-simd 0.7.0", + "bitvec", "data-encoding", "debugid", "if_chain", + "rustc-hash", "rustc_version 0.2.3", "serde", "serde_json", @@ -6475,6 +6500,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tar" version = "0.4.40" @@ -7380,7 +7411,7 @@ dependencies = [ "codespan-reporting", "log", "naga", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "profiling", "raw-window-handle", "ron", @@ -7421,7 +7452,7 @@ dependencies = [ "naga", "objc", "once_cell", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "profiling", "range-alloc", "raw-window-handle", @@ -7718,6 +7749,15 @@ dependencies = [ "toml", ] +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "x25519-dalek" version = "2.0.1" diff --git a/Cargo.toml b/Cargo.toml index 2e39bc5984..60b8f117de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,7 @@ repository = "https://github.com/denoland/deno" [workspace.dependencies] deno_ast = { version = "0.36.1", features = ["transpiling"] } -deno_core = { version = "0.272.0" } +deno_core = { version = "0.274.0" } deno_bench_util = { version = "0.140.0", path = "./bench_util" } deno_lockfile = "0.19.0" diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs index 2aac251d35..c77da221cd 100644 --- a/cli/lsp/tsc.rs +++ b/cli/lsp/tsc.rs @@ -4036,6 +4036,14 @@ fn op_load<'s>( fn op_resolve( state: &mut OpState, #[serde] args: ResolveArgs, +) -> Result>, AnyError> { + op_resolve_inner(state, args) +} + +#[inline] +fn op_resolve_inner( + state: &mut OpState, + args: ResolveArgs, ) -> Result>, AnyError> { let state = state.borrow_mut::(); let mark = state.performance.mark_with_args("tsc.op.op_resolve", &args); @@ -5585,7 +5593,7 @@ mod tests { ) .await; let mut state = setup_op_state(snapshot); - let resolved = op_resolve::call( + let resolved = op_resolve_inner( &mut state, ResolveArgs { base: "file:///a.ts".to_string(), diff --git a/cli/ops/jupyter.rs b/cli/ops/jupyter.rs index 56bbf7171a..1d727c33fb 100644 --- a/cli/ops/jupyter.rs +++ b/cli/ops/jupyter.rs @@ -10,7 +10,6 @@ use crate::tools::jupyter::server::StdioMsg; use deno_core::error::AnyError; use deno_core::op2; use deno_core::serde_json; -use deno_core::Op; use deno_core::OpState; use tokio::sync::mpsc; use tokio::sync::Mutex; @@ -23,7 +22,7 @@ deno_core::extension!(deno_jupyter, sender: mpsc::UnboundedSender, }, middleware = |op| match op.name { - "op_print" => op_print::DECL, + "op_print" => op_print(), _ => op, }, state = |state, options| { diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index 383ed1291d..2d06e0a956 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -393,6 +393,11 @@ fn normalize_specifier( #[op2] #[string] fn op_create_hash(s: &mut OpState, #[string] text: &str) -> String { + op_create_hash_inner(s, text) +} + +#[inline] +fn op_create_hash_inner(s: &mut OpState, text: &str) -> String { let state = s.borrow_mut::(); get_hash(text, state.hash_data) } @@ -409,6 +414,11 @@ struct EmitArgs { #[op2] fn op_emit(state: &mut OpState, #[serde] args: EmitArgs) -> bool { + op_emit_inner(state, args) +} + +#[inline] +fn op_emit_inner(state: &mut OpState, args: EmitArgs) -> bool { let state = state.borrow_mut::(); match args.file_name.as_ref() { "internal:///.tsbuildinfo" => state.maybe_tsbuildinfo = Some(args.data), @@ -459,6 +469,13 @@ struct LoadResponse { fn op_load( state: &mut OpState, #[string] load_specifier: &str, +) -> Result, AnyError> { + op_load_inner(state, load_specifier) +} + +fn op_load_inner( + state: &mut OpState, + load_specifier: &str, ) -> Result, AnyError> { let state = state.borrow_mut::(); @@ -561,6 +578,14 @@ pub struct ResolveArgs { fn op_resolve( state: &mut OpState, #[serde] args: ResolveArgs, +) -> Result, AnyError> { + op_resolve_inner(state, args) +} + +#[inline] +fn op_resolve_inner( + state: &mut OpState, + args: ResolveArgs, ) -> Result, AnyError> { let state = state.borrow_mut::(); let mut resolved: Vec<(String, String)> = @@ -779,6 +804,11 @@ struct RespondArgs { // Can't we use something more efficient here? #[op2] fn op_respond(state: &mut OpState, #[serde] args: RespondArgs) { + op_respond_inner(state, args) +} + +#[inline] +fn op_respond_inner(state: &mut OpState, args: RespondArgs) { let state = state.borrow_mut::(); state.maybe_response = Some(args); } @@ -1022,7 +1052,7 @@ mod tests { #[tokio::test] async fn test_create_hash() { let mut state = setup(None, Some(123), None).await; - let actual = op_create_hash::call(&mut state, "some sort of content"); + let actual = op_create_hash_inner(&mut state, "some sort of content"); assert_eq!(actual, "11905938177474799758"); } @@ -1038,7 +1068,7 @@ mod tests { #[tokio::test] async fn test_emit_tsbuildinfo() { let mut state = setup(None, None, None).await; - let actual = op_emit::call( + let actual = op_emit_inner( &mut state, EmitArgs { data: "some file content".to_string(), @@ -1062,7 +1092,7 @@ mod tests { ) .await; let actual = - op_load::call(&mut state, "https://deno.land/x/mod.ts").unwrap(); + op_load_inner(&mut state, "https://deno.land/x/mod.ts").unwrap(); assert_eq!( serde_json::to_value(actual).unwrap(), json!({ @@ -1081,7 +1111,7 @@ mod tests { Some("some content".to_string()), ) .await; - let actual = op_load::call(&mut state, "asset:///lib.dom.d.ts") + let actual = op_load_inner(&mut state, "asset:///lib.dom.d.ts") .expect("should have invoked op") .expect("load should have succeeded"); let expected = get_lazily_loaded_asset("lib.dom.d.ts").unwrap(); @@ -1098,7 +1128,7 @@ mod tests { Some("some content".to_string()), ) .await; - let actual = op_load::call(&mut state, "internal:///.tsbuildinfo") + let actual = op_load_inner(&mut state, "internal:///.tsbuildinfo") .expect("should have invoked op") .expect("load should have succeeded"); assert_eq!( @@ -1114,7 +1144,7 @@ mod tests { #[tokio::test] async fn test_load_missing_specifier() { let mut state = setup(None, None, None).await; - let actual = op_load::call(&mut state, "https://deno.land/x/mod.ts") + let actual = op_load_inner(&mut state, "https://deno.land/x/mod.ts") .expect("should have invoked op"); assert_eq!(serde_json::to_value(actual).unwrap(), json!(null)); } @@ -1127,7 +1157,7 @@ mod tests { None, ) .await; - let actual = op_resolve::call( + let actual = op_resolve_inner( &mut state, ResolveArgs { base: "https://deno.land/x/a.ts".to_string(), @@ -1149,7 +1179,7 @@ mod tests { None, ) .await; - let actual = op_resolve::call( + let actual = op_resolve_inner( &mut state, ResolveArgs { base: "https://deno.land/x/a.ts".to_string(), @@ -1177,7 +1207,7 @@ mod tests { "stats": [["a", 12]] })) .unwrap(); - op_respond::call(&mut state, args); + op_respond_inner(&mut state, args); let state = state.borrow::(); assert_eq!( state.maybe_response, diff --git a/ext/io/lib.rs b/ext/io/lib.rs index 8d80eec256..04ed58ef27 100644 --- a/ext/io/lib.rs +++ b/ext/io/lib.rs @@ -11,7 +11,6 @@ use deno_core::BufMutView; use deno_core::BufView; use deno_core::CancelHandle; use deno_core::CancelTryFuture; -use deno_core::Op; use deno_core::OpState; use deno_core::RcRef; use deno_core::Resource; @@ -102,7 +101,7 @@ deno_core::extension!(deno_io, stdio: Option, }, middleware = |op| match op.name { - "op_print" => op_print::DECL, + "op_print" => op_print(), _ => op, }, state = |state, options| { diff --git a/ext/net/ops.rs b/ext/net/ops.rs index a25b6c310f..535e4b0cb9 100644 --- a/ext/net/ops.rs +++ b/ext/net/ops.rs @@ -295,6 +295,17 @@ pub async fn op_net_connect_tcp( state: Rc>, #[serde] addr: IpAddr, ) -> Result<(ResourceId, IpAddr, IpAddr), AnyError> +where + NP: NetPermissions + 'static, +{ + op_net_connect_tcp_inner::(state, addr).await +} + +#[inline] +pub async fn op_net_connect_tcp_inner( + state: Rc>, + addr: IpAddr, +) -> Result<(ResourceId, IpAddr, IpAddr), AnyError> where NP: NetPermissions + 'static, { @@ -626,6 +637,15 @@ pub fn op_set_nodelay( state: &mut OpState, #[smi] rid: ResourceId, nodelay: bool, +) -> Result<(), AnyError> { + op_set_nodelay_inner(state, rid, nodelay) +} + +#[inline] +pub fn op_set_nodelay_inner( + state: &mut OpState, + rid: ResourceId, + nodelay: bool, ) -> Result<(), AnyError> { let resource: Rc = state.resource_table.get::(rid)?; @@ -637,6 +657,15 @@ pub fn op_set_keepalive( state: &mut OpState, #[smi] rid: ResourceId, keepalive: bool, +) -> Result<(), AnyError> { + op_set_keepalive_inner(state, rid, keepalive) +} + +#[inline] +pub fn op_set_keepalive_inner( + state: &mut OpState, + rid: ResourceId, + keepalive: bool, ) -> Result<(), AnyError> { let resource: Rc = state.resource_table.get::(rid)?; @@ -969,7 +998,7 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn tcp_set_no_delay() { let set_nodelay = Box::new(|state: &mut OpState, rid| { - op_set_nodelay::call(state, rid, true).unwrap(); + op_set_nodelay_inner(state, rid, true).unwrap(); }); let test_fn = Box::new(|socket: SockRef| { assert!(socket.nodelay().unwrap()); @@ -981,7 +1010,7 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn tcp_set_keepalive() { let set_keepalive = Box::new(|state: &mut OpState, rid| { - op_set_keepalive::call(state, rid, true).unwrap(); + op_set_keepalive_inner(state, rid, true).unwrap(); }); let test_fn = Box::new(|socket: SockRef| { assert!(!socket.nodelay().unwrap()); @@ -1032,7 +1061,7 @@ mod tests { }; let mut connect_fut = - op_net_connect_tcp::::call(conn_state, ip_addr) + op_net_connect_tcp_inner::(conn_state, ip_addr) .boxed_local(); let mut rid = None; diff --git a/runtime/ops/os/mod.rs b/runtime/ops/os/mod.rs index de9792a454..7a71590baa 100644 --- a/runtime/ops/os/mod.rs +++ b/runtime/ops/os/mod.rs @@ -8,7 +8,6 @@ use deno_core::error::AnyError; use deno_core::op2; use deno_core::url::Url; use deno_core::v8; -use deno_core::Op; use deno_core::OpState; use deno_node::NODE_ENV_VAR_ALLOWLIST; use serde::Serialize; @@ -67,7 +66,7 @@ deno_core::extension!( ], middleware = |op| match op.name { "op_exit" | "op_set_exit_code" => - op.with_implementation_from(&deno_core::op_void_sync::DECL), + op.with_implementation_from(&deno_core::op_void_sync()), _ => op, }, ); diff --git a/tests/testdata/run/eval_context_throw_dom_exception.js.out b/tests/testdata/run/eval_context_throw_dom_exception.js.out index f7d368471d..39f5a81745 100644 --- a/tests/testdata/run/eval_context_throw_dom_exception.js.out +++ b/tests/testdata/run/eval_context_throw_dom_exception.js.out @@ -1,4 +1,4 @@ -[Object: null prototype] { +{ thrown: DOMException: foo at new DOMException (ext:deno_web/01_dom_exception.js:[WILDCARD]) at [WILDCARD]