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