mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 13:00:36 -05:00
chore: update deno_core and port all remaining ops to op2
(#20954)
Signed-off-by: Matt Mastracci <matthew@mastracci.com> Co-authored-by: Matt Mastracci <matthew@mastracci.com>
This commit is contained in:
parent
6c60859407
commit
093b3eee58
10 changed files with 40 additions and 43 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -1204,9 +1204,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_core"
|
||||
version = "0.222.0"
|
||||
version = "0.223.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b13c81b9ea8462680e7b77088a44fc36390bab3dbfa5a205a285e11b64e0919c"
|
||||
checksum = "68c55228461e414205ff6eeabe4058dfe37d41663883d70e1809a84c1814288c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
|
@ -1594,9 +1594,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_ops"
|
||||
version = "0.98.0"
|
||||
version = "0.99.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf89da1a3e50ff7c89956495b53d9bcad29e1f1b3f3d2bc54cad7155f55419c4"
|
||||
checksum = "a755d96f9ccd44e4779d859ac1fc823be2b9c975821ac8b05b3e318bc5301aa8"
|
||||
dependencies = [
|
||||
"deno-proc-macro-rules",
|
||||
"lazy-regex",
|
||||
|
@ -4814,9 +4814,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_v8"
|
||||
version = "0.131.0"
|
||||
version = "0.132.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38cafa16d0a4288d75925351bb54d06d2e830118ad3fad393947bb11f91b18f3"
|
||||
checksum = "9378f2bc5e649f1cbc703ac75d90abe386f924d729215d95950f08c55dad4a8d"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"derive_more",
|
||||
|
|
|
@ -39,7 +39,7 @@ repository = "https://github.com/denoland/deno"
|
|||
|
||||
[workspace.dependencies]
|
||||
deno_ast = { version = "0.31.0", features = ["transpiling"] }
|
||||
deno_core = { version = "0.222.0" }
|
||||
deno_core = { version = "0.223.0" }
|
||||
|
||||
deno_runtime = { version = "0.129.0", path = "./runtime" }
|
||||
napi_sym = { version = "0.51.0", path = "./cli/napi/sym" }
|
||||
|
|
|
@ -661,8 +661,7 @@ pub fn op_http_set_response_body_text(
|
|||
}
|
||||
}
|
||||
|
||||
// Skipping `fast` because we prefer an owned buffer here.
|
||||
#[op2]
|
||||
#[op2(fast)]
|
||||
pub fn op_http_set_response_body_bytes(
|
||||
#[smi] slab_id: SlabId,
|
||||
#[buffer] buffer: JsBuffer,
|
||||
|
|
|
@ -9,7 +9,6 @@ use std::task::Poll;
|
|||
use bytes::Bytes;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::futures::future::poll_fn;
|
||||
use deno_core::op;
|
||||
use deno_core::op2;
|
||||
use deno_core::serde::Serialize;
|
||||
use deno_core::AsyncRefCell;
|
||||
|
@ -157,10 +156,11 @@ pub async fn op_http2_listen(
|
|||
)
|
||||
}
|
||||
|
||||
#[op]
|
||||
#[op2(async)]
|
||||
#[serde]
|
||||
pub async fn op_http2_accept(
|
||||
state: Rc<RefCell<OpState>>,
|
||||
rid: ResourceId,
|
||||
#[smi] rid: ResourceId,
|
||||
) -> Result<
|
||||
Option<(Vec<(ByteString, ByteString)>, ResourceId, ResourceId)>,
|
||||
AnyError,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
use deno_core::op;
|
||||
use deno_core::op2;
|
||||
use deno_core::v8;
|
||||
|
||||
|
@ -8,8 +7,11 @@ pub fn op_v8_cached_data_version_tag() -> u32 {
|
|||
v8::script_compiler::cached_data_version_tag()
|
||||
}
|
||||
|
||||
#[op(v8)]
|
||||
fn op_v8_get_heap_statistics(scope: &mut v8::HandleScope, buffer: &mut [f64]) {
|
||||
#[op2]
|
||||
pub fn op_v8_get_heap_statistics(
|
||||
scope: &mut v8::HandleScope,
|
||||
#[buffer] buffer: &mut [f64],
|
||||
) {
|
||||
let mut stats = v8::HeapStatistics::default();
|
||||
scope.get_heap_statistics(&mut stats);
|
||||
|
||||
|
|
|
@ -10,9 +10,7 @@ mod timers;
|
|||
use deno_core::error::range_error;
|
||||
use deno_core::error::type_error;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::op;
|
||||
use deno_core::op2;
|
||||
use deno_core::serde_v8;
|
||||
use deno_core::url::Url;
|
||||
use deno_core::v8;
|
||||
use deno_core::ByteString;
|
||||
|
@ -366,14 +364,14 @@ impl Resource for TextDecoderResource {
|
|||
}
|
||||
}
|
||||
|
||||
#[op(v8)]
|
||||
fn op_encoding_encode_into_fallback(
|
||||
#[op2(fast(op_encoding_encode_into_fast))]
|
||||
fn op_encoding_encode_into(
|
||||
scope: &mut v8::HandleScope,
|
||||
input: serde_v8::Value,
|
||||
buffer: &mut [u8],
|
||||
out_buf: &mut [u32],
|
||||
input: v8::Local<v8::Value>,
|
||||
#[buffer] buffer: &mut [u8],
|
||||
#[buffer] out_buf: &mut [u32],
|
||||
) -> Result<(), AnyError> {
|
||||
let s = v8::Local::<v8::String>::try_from(input.v8_value)?;
|
||||
let s = v8::Local::<v8::String>::try_from(input)?;
|
||||
|
||||
let mut nchars = 0;
|
||||
out_buf[1] = s.write_utf8(
|
||||
|
@ -387,11 +385,11 @@ fn op_encoding_encode_into_fallback(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[op(fast, slow = op_encoding_encode_into_fallback)]
|
||||
fn op_encoding_encode_into(
|
||||
input: Cow<'_, str>,
|
||||
buffer: &mut [u8],
|
||||
out_buf: &mut [u32],
|
||||
#[op2(fast)]
|
||||
fn op_encoding_encode_into_fast(
|
||||
#[string] input: Cow<'_, str>,
|
||||
#[buffer] buffer: &mut [u8],
|
||||
#[buffer] out_buf: &mut [u32],
|
||||
) {
|
||||
// Since `input` is already UTF-8, we can simply find the last UTF-8 code
|
||||
// point boundary from input that fits in `buffer`, and copy the bytes up to
|
||||
|
|
|
@ -491,7 +491,7 @@ pub fn op_readable_stream_resource_write_buf(
|
|||
|
||||
/// Write to the channel synchronously, returning 0 if the channel was closed, 1 if we wrote
|
||||
/// successfully, 2 if the channel was full and we need to block.
|
||||
#[op2]
|
||||
#[op2(fast)]
|
||||
pub fn op_readable_stream_resource_write_sync(
|
||||
sender: *const c_void,
|
||||
#[buffer] buffer: JsBuffer,
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
use crate::hr_timer_lock::hr_timer_lock;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::op;
|
||||
use deno_core::op2;
|
||||
use deno_core::CancelFuture;
|
||||
use deno_core::CancelHandle;
|
||||
|
@ -80,11 +79,11 @@ pub fn op_timer_handle(state: &mut OpState) -> ResourceId {
|
|||
/// [`TimerHandle`] resource given by `rid` has been canceled.
|
||||
///
|
||||
/// If the timer is canceled, this returns `false`. Otherwise, it returns `true`.
|
||||
#[op(deferred)]
|
||||
#[op2(async(deferred), fast)]
|
||||
pub async fn op_sleep(
|
||||
state: Rc<RefCell<OpState>>,
|
||||
millis: u64,
|
||||
rid: ResourceId,
|
||||
#[number] millis: u64,
|
||||
#[smi] rid: ResourceId,
|
||||
) -> Result<bool, AnyError> {
|
||||
let handle = state.borrow().resource_table.get::<TimerHandle>(rid)?;
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ use bytes::Bytes;
|
|||
use deno_core::error::invalid_hostname;
|
||||
use deno_core::error::type_error;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::op;
|
||||
use deno_core::op2;
|
||||
use deno_core::url;
|
||||
use deno_core::AsyncMutFuture;
|
||||
|
@ -472,11 +471,11 @@ pub fn op_ws_send_text(
|
|||
}
|
||||
|
||||
/// Async version of send. Does not update buffered amount as we rely on the socket itself for backpressure.
|
||||
#[op(fast)]
|
||||
#[op2(async)]
|
||||
pub async fn op_ws_send_binary_async(
|
||||
state: Rc<RefCell<OpState>>,
|
||||
rid: ResourceId,
|
||||
data: JsBuffer,
|
||||
#[smi] rid: ResourceId,
|
||||
#[buffer] data: JsBuffer,
|
||||
) -> Result<(), AnyError> {
|
||||
let resource = state
|
||||
.borrow_mut()
|
||||
|
@ -490,11 +489,11 @@ pub async fn op_ws_send_binary_async(
|
|||
}
|
||||
|
||||
/// Async version of send. Does not update buffered amount as we rely on the socket itself for backpressure.
|
||||
#[op(fast)]
|
||||
#[op2(async)]
|
||||
pub async fn op_ws_send_text_async(
|
||||
state: Rc<RefCell<OpState>>,
|
||||
rid: ResourceId,
|
||||
data: String,
|
||||
#[smi] rid: ResourceId,
|
||||
#[string] data: String,
|
||||
) -> Result<(), AnyError> {
|
||||
let resource = state
|
||||
.borrow_mut()
|
||||
|
@ -609,10 +608,10 @@ pub fn op_ws_get_error(state: &mut OpState, #[smi] rid: ResourceId) -> String {
|
|||
resource.error.take().unwrap_or_default()
|
||||
}
|
||||
|
||||
#[op(fast)]
|
||||
#[op2(async)]
|
||||
pub async fn op_ws_next_event(
|
||||
state: Rc<RefCell<OpState>>,
|
||||
rid: ResourceId,
|
||||
#[smi] rid: ResourceId,
|
||||
) -> u16 {
|
||||
let Ok(resource) = state
|
||||
.borrow_mut()
|
||||
|
|
|
@ -37,7 +37,7 @@ fn op_worker_post_message(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[op2(async(lazy))]
|
||||
#[op2(async(lazy), fast)]
|
||||
#[serde]
|
||||
async fn op_worker_recv_message(
|
||||
state: Rc<RefCell<OpState>>,
|
||||
|
|
Loading…
Add table
Reference in a new issue