1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

chore: upgrade deno_core to 0.259.0 (#22311)

This update brings number of ops available to user code down to 45.
This commit is contained in:
Bartek Iwańczuk 2024-02-07 02:16:08 +01:00 committed by GitHub
parent e54684864d
commit 043fee48fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 19 additions and 65 deletions

12
Cargo.lock generated
View file

@ -1196,9 +1196,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_core" name = "deno_core"
version = "0.258.0" version = "0.259.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f200cdc161745281e4ec56e3b0e563058d2cc50a824ac901823ed0720b481619" checksum = "f62dc88f7f56fa48906e37fbea089128da7405e09b0f99bcd488f4f13f20c491"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bit-set", "bit-set",
@ -1646,9 +1646,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_ops" name = "deno_ops"
version = "0.134.0" version = "0.135.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe122714b90abf065a746f452f69beae37324436a1541118ca4078b9b9d2b260" checksum = "5f53a36c6138b760bda9c032ab9251a8f83286da4ef7724de313d1621931263e"
dependencies = [ dependencies = [
"proc-macro-rules", "proc-macro-rules",
"proc-macro2", "proc-macro2",
@ -5408,9 +5408,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_v8" name = "serde_v8"
version = "0.167.0" version = "0.168.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc6b38f6831f968e3813a480ca5a236c9a0972d9dcf0bb241f193ba524e4cf4e" checksum = "a64d740e74bee1f5bc3f4fe49aab63b08ee6dcc606e9321dec71628ba80e4293"
dependencies = [ dependencies = [
"bytes", "bytes",
"derive_more", "derive_more",

View file

@ -42,7 +42,7 @@ repository = "https://github.com/denoland/deno"
[workspace.dependencies] [workspace.dependencies]
deno_ast = { version = "0.32.0", features = ["transpiling"] } deno_ast = { version = "0.32.0", features = ["transpiling"] }
deno_core = { version = "0.258.0" } deno_core = { version = "0.259.0" }
deno_bench_util = { version = "0.130.0", path = "./bench_util" } deno_bench_util = { version = "0.130.0", path = "./bench_util" }
deno_lockfile = "0.18.0" deno_lockfile = "0.18.0"

View file

@ -172,7 +172,7 @@ function assertOps(fn) {
opIdHostRecvCtrl, opIdHostRecvCtrl,
); );
} }
const preTraces = new Map(core.opCallTraces); const preTraces = core.getAllOpCallTraces();
let postTraces; let postTraces;
let report = null; let report = null;
@ -195,7 +195,7 @@ function assertOps(fn) {
opIdHostRecvCtrl, opIdHostRecvCtrl,
); );
} }
postTraces = new Map(core.opCallTraces); postTraces = core.getAllOpCallTraces();
if (res === 3) { if (res === 3) {
report = op_test_op_sanitizer_report(desc.id); report = op_test_op_sanitizer_report(desc.id);
} }

View file

@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
const EXPECTED_OP_COUNT = 49; const EXPECTED_OP_COUNT = 45;
Deno.test(function checkExposedOps() { Deno.test(function checkExposedOps() {
// @ts-ignore TS doesn't allow to index with symbol // @ts-ignore TS doesn't allow to index with symbol

View file

@ -270,7 +270,7 @@ Deno.test(function textEncoderShouldCoerceToString() {
Deno.test(function binaryEncode() { Deno.test(function binaryEncode() {
// @ts-ignore: Deno[Deno.internal].core allowed // @ts-ignore: Deno[Deno.internal].core allowed
const ops = Deno[Deno.internal].core.ops; const core = Deno[Deno.internal].core;
function asBinaryString(bytes: Uint8Array): string { function asBinaryString(bytes: Uint8Array): string {
return Array.from(bytes).map( return Array.from(bytes).map(
(v: number) => String.fromCodePoint(v), (v: number) => String.fromCodePoint(v),
@ -281,30 +281,6 @@ Deno.test(function binaryEncode() {
const chars: string[] = Array.from(binaryString); const chars: string[] = Array.from(binaryString);
return chars.map((v: string): number | undefined => v.codePointAt(0)); return chars.map((v: string): number | undefined => v.codePointAt(0));
} }
// invalid utf-8 code points
const invalid = new Uint8Array([0xC0]);
assertEquals(
ops.op_encode_binary_string(invalid),
asBinaryString(invalid),
);
const invalid2 = new Uint8Array([0xC1]);
assertEquals(
ops.op_encode_binary_string(invalid2),
asBinaryString(invalid2),
);
for (let i = 0, j = 255; i <= 255; i++, j--) {
const bytes = new Uint8Array([i, j]);
const binaryString = ops.op_encode_binary_string(bytes);
assertEquals(
binaryString,
asBinaryString(bytes),
);
assertEquals(Array.from(bytes), decodeBinary(binaryString));
}
const inputs = [ const inputs = [
"σ😀", "σ😀",
"Кириллица is Cyrillic", "Кириллица is Cyrillic",
@ -315,7 +291,7 @@ Deno.test(function binaryEncode() {
]; ];
for (const input of inputs) { for (const input of inputs) {
const bytes = new TextEncoder().encode(input); const bytes = new TextEncoder().encode(input);
const binaryString = ops.op_encode_binary_string(bytes); const binaryString = core.encodeBinaryString(bytes);
assertEquals( assertEquals(
binaryString, binaryString,
asBinaryString(bytes), asBinaryString(bytes),

View file

@ -496,7 +496,7 @@ async fn test_specifier_inner(
if options.trace_ops { if options.trace_ops {
worker.execute_script_static( worker.execute_script_static(
located_script_name!(), located_script_name!(),
"Deno[Deno.internal].core.enableOpCallTracing();", "Deno[Deno.internal].core.setOpCallTracingEnabled(true);",
)?; )?;
} }

View file

@ -4,9 +4,9 @@ import { core, internals, primordials } from "ext:core/mod.js";
const { const {
isDate, isDate,
internalRidSymbol, internalRidSymbol,
createCancelHandle,
} = core; } = core;
import { import {
op_cancel_handle,
op_fs_chdir, op_fs_chdir,
op_fs_chmod_async, op_fs_chmod_async,
op_fs_chmod_sync, op_fs_chmod_sync,
@ -823,7 +823,7 @@ async function readFile(path, options) {
let abortHandler; let abortHandler;
if (options?.signal) { if (options?.signal) {
options.signal.throwIfAborted(); options.signal.throwIfAborted();
cancelRid = op_cancel_handle(); cancelRid = createCancelHandle();
abortHandler = () => core.tryClose(cancelRid); abortHandler = () => core.tryClose(cancelRid);
options.signal[abortSignal.add](abortHandler); options.signal[abortSignal.add](abortHandler);
} }
@ -853,7 +853,7 @@ async function readTextFile(path, options) {
let abortHandler; let abortHandler;
if (options?.signal) { if (options?.signal) {
options.signal.throwIfAborted(); options.signal.throwIfAborted();
cancelRid = op_cancel_handle(); cancelRid = createCancelHandle();
abortHandler = () => core.tryClose(cancelRid); abortHandler = () => core.tryClose(cancelRid);
options.signal[abortSignal.add](abortHandler); options.signal[abortSignal.add](abortHandler);
} }
@ -899,7 +899,7 @@ async function writeFile(
let abortHandler; let abortHandler;
if (options.signal) { if (options.signal) {
options.signal.throwIfAborted(); options.signal.throwIfAborted();
cancelRid = op_cancel_handle(); cancelRid = createCancelHandle();
abortHandler = () => core.tryClose(cancelRid); abortHandler = () => core.tryClose(cancelRid);
options.signal[abortSignal.add](abortHandler); options.signal[abortSignal.add](abortHandler);
} }

View file

@ -5,9 +5,9 @@ const {
BadResourcePrototype, BadResourcePrototype,
InterruptedPrototype, InterruptedPrototype,
internalRidSymbol, internalRidSymbol,
createCancelHandle,
} = core; } = core;
import { import {
op_cancel_handle,
op_dns_resolve, op_dns_resolve,
op_net_accept_tcp, op_net_accept_tcp,
op_net_accept_unix, op_net_accept_unix,
@ -67,7 +67,7 @@ async function resolveDns(query, recordType, options) {
let abortHandler; let abortHandler;
if (options?.signal) { if (options?.signal) {
options.signal.throwIfAborted(); options.signal.throwIfAborted();
cancelRid = op_cancel_handle(); cancelRid = createCancelHandle();
abortHandler = () => core.tryClose(cancelRid); abortHandler = () => core.tryClose(cancelRid);
options.signal[abortSignal.add](abortHandler); options.signal[abortSignal.add](abortHandler);
} }

View file

@ -14,7 +14,6 @@ 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::ByteString; use deno_core::ByteString;
use deno_core::CancelHandle;
use deno_core::OpState; use deno_core::OpState;
use deno_core::Resource; use deno_core::Resource;
use deno_core::ResourceId; use deno_core::ResourceId;
@ -71,7 +70,6 @@ deno_core::extension!(deno_web,
op_encoding_new_decoder, op_encoding_new_decoder,
op_encoding_decode, op_encoding_decode,
op_encoding_encode_into, op_encoding_encode_into,
op_encode_binary_string,
op_blob_create_part, op_blob_create_part,
op_blob_slice_part, op_blob_slice_part,
op_blob_read_part, op_blob_read_part,
@ -87,7 +85,6 @@ deno_core::extension!(deno_web,
compression::op_compression_finish, compression::op_compression_finish,
op_now<P>, op_now<P>,
op_timer_handle, op_timer_handle,
op_cancel_handle,
op_sleep, op_sleep,
op_transfer_arraybuffer, op_transfer_arraybuffer,
stream_resource::op_readable_stream_resource_allocate, stream_resource::op_readable_stream_resource_allocate,
@ -439,19 +436,6 @@ fn op_transfer_arraybuffer<'a>(
Ok(v8::ArrayBuffer::with_backing_store(scope, &bs)) Ok(v8::ArrayBuffer::with_backing_store(scope, &bs))
} }
#[op2]
#[serde]
fn op_encode_binary_string(#[buffer] s: &[u8]) -> ByteString {
ByteString::from(s)
}
/// Creates a [`CancelHandle`] resource that can be used to cancel invocations of certain ops.
#[op2(fast)]
#[smi]
pub fn op_cancel_handle(state: &mut OpState) -> u32 {
state.resource_table.add(CancelHandle::new())
}
pub fn get_declaration() -> PathBuf { pub fn get_declaration() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_web.d.ts") PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_web.d.ts")
} }

View file

@ -622,12 +622,6 @@ const NOT_IMPORTED_OPS = [
// TODO(bartlomieju): used in a regression test, but probably not needed // TODO(bartlomieju): used in a regression test, but probably not needed
// anymore if ops are not user accessible. // anymore if ops are not user accessible.
"op_spawn_child", "op_spawn_child",
// TODO(bartlomieju): can be removed after the `deno_core` upgrade.
"op_encode_binary_string",
"op_format_file_name",
"op_apply_source_map",
"op_apply_source_map_filename",
]; ];
function removeImportedOps() { function removeImportedOps() {