From 942fb5e0388eab02f98c02541a3f90053afd59d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 26 Jan 2024 20:04:07 +0100 Subject: [PATCH] chore: upgrade deno_core (#22124) Co-authored-by: Matt Mastracci --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- ext/fs/30_fs.js | 5 +++-- ext/http/00_serve.js | 6 +++--- ext/net/01_net.js | 18 +++++++++--------- ext/net/02_tls.js | 12 ++++++------ ext/node/polyfills/_fs/_fs_open.ts | 6 ++++-- .../polyfills/internal_binding/stream_wrap.ts | 13 ++++++------- runtime/js/40_http.js | 12 ++++-------- 9 files changed, 42 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa3f6de9b5..af01744264 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1196,9 +1196,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.254.0" +version = "0.255.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd747cfefb65613073c71303f1b9817c541111dae68a2ce31b2ead5120f4222d" +checksum = "66349d0fd8e9cad751435b59cf9e09e9fad9433301e9529ca4edf130ea3a06a0" dependencies = [ "anyhow", "bit-set", @@ -1653,9 +1653,9 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.130.0" +version = "0.131.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2eaf696534fd715236131bbc23502c3acc975a987aaf0457528cefa4c4ccf51" +checksum = "ee3363343cd15758aa02792e93b53b1def9cf1e8b23dd82bdce0f223e6046e76" dependencies = [ "proc-macro-rules", "proc-macro2", @@ -5357,9 +5357,9 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.163.0" +version = "0.164.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e8193fbdd173c08fceb226d14bef66f1d8a84ed201b3e24c1404f2171b0734" +checksum = "f96a94476f3d22fe9f70c2d992d020173ccd61ad6fa1b62ed8090abe835c4e9f" dependencies = [ "bytes", "derive_more", diff --git a/Cargo.toml b/Cargo.toml index 6868fac1fb..3de8949e82 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.254.0" } +deno_core = { version = "0.255.0" } deno_bench_util = { version = "0.129.0", path = "./bench_util" } deno_lockfile = "0.18.0" diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js index 0a3e1ceb9f..35a9d304b4 100644 --- a/ext/fs/30_fs.js +++ b/ext/fs/30_fs.js @@ -3,6 +3,7 @@ import { core, internals, primordials } from "ext:core/mod.js"; const { isDate, + internalRidSymbol, } = core; const { op_fs_chdir, @@ -655,14 +656,14 @@ function create(path) { } class FsFile { - [SymbolFor("Deno.internal.rid")] = 0; + [internalRidSymbol] = 0; #rid = 0; #readable; #writable; constructor(rid, symbol) { - this[SymbolFor("Deno.internal.rid")] = rid; + this[internalRidSymbol] = rid; this.#rid = rid; if (!symbol || symbol !== SymbolFor("Deno.internal.FsFile")) { internals.warnOnDeprecatedApi( diff --git a/ext/http/00_serve.js b/ext/http/00_serve.js index 977497c0bb..30f85cdf32 100644 --- a/ext/http/00_serve.js +++ b/ext/http/00_serve.js @@ -4,6 +4,7 @@ import { core, internals, primordials } from "ext:core/mod.js"; const { BadResourcePrototype, InterruptedPrototype, + internalRidSymbol, } = core; const { op_http_close_after_finish, @@ -33,7 +34,6 @@ const { PromisePrototypeCatch, PromisePrototypeThen, Symbol, - SymbolFor, TypeError, TypedArrayPrototypeGetSymbolToStringTag, Uint8Array, @@ -618,7 +618,7 @@ function serve(arg1, arg2) { function serveHttpOnListener(listener, signal, handler, onError, onListen) { const context = new CallbackContext( signal, - op_http_serve(listener[SymbolFor("Deno.internal.rid")]), + op_http_serve(listener[internalRidSymbol]), listener, ); const callback = mapToCallback(context, handler, onError); @@ -634,7 +634,7 @@ function serveHttpOnListener(listener, signal, handler, onError, onListen) { function serveHttpOnConnection(connection, signal, handler, onError, onListen) { const context = new CallbackContext( signal, - op_http_serve_on(connection[SymbolFor("Deno.internal.rid")]), + op_http_serve_on(connection[internalRidSymbol]), null, ); const callback = mapToCallback(context, handler, onError); diff --git a/ext/net/01_net.js b/ext/net/01_net.js index f761aed14a..8dbf32625c 100644 --- a/ext/net/01_net.js +++ b/ext/net/01_net.js @@ -4,6 +4,7 @@ import { core, internals, primordials } from "ext:core/mod.js"; const { BadResourcePrototype, InterruptedPrototype, + internalRidSymbol, } = core; const { op_dns_resolve, @@ -40,7 +41,6 @@ const { SetPrototypeForEach, SymbolAsyncIterator, Symbol, - SymbolFor, TypeError, TypedArrayPrototypeSubarray, Uint8Array, @@ -91,7 +91,7 @@ async function resolveDns(query, recordType, options) { } class Conn { - [SymbolFor("Deno.internal.rid")] = 0; + [internalRidSymbol] = 0; #rid = 0; #remoteAddr = null; #localAddr = null; @@ -102,7 +102,7 @@ class Conn { #writable; constructor(rid, remoteAddr, localAddr) { - this[SymbolFor("Deno.internal.rid")] = rid; + this[internalRidSymbol] = rid; this.#rid = rid; this.#remoteAddr = remoteAddr; this.#localAddr = localAddr; @@ -201,12 +201,12 @@ class Conn { } class TcpConn extends Conn { - [SymbolFor("Deno.internal.rid")] = 0; + [internalRidSymbol] = 0; #rid = 0; constructor(rid, remoteAddr, localAddr) { super(rid, remoteAddr, localAddr); - this[SymbolFor("Deno.internal.rid")] = rid; + this[internalRidSymbol] = rid; this.#rid = rid; } @@ -229,12 +229,12 @@ class TcpConn extends Conn { } class UnixConn extends Conn { - [SymbolFor("Deno.internal.rid")] = 0; + [internalRidSymbol] = 0; #rid = 0; constructor(rid, remoteAddr, localAddr) { super(rid, remoteAddr, localAddr); - this[SymbolFor("Deno.internal.rid")] = rid; + this[internalRidSymbol] = rid; this.#rid = rid; } @@ -249,14 +249,14 @@ class UnixConn extends Conn { } class Listener { - [SymbolFor("Deno.internal.rid")] = 0; + [internalRidSymbol] = 0; #rid = 0; #addr = null; #unref = false; #promise = null; constructor(rid, addr) { - this[SymbolFor("Deno.internal.rid")] = rid; + this[internalRidSymbol] = rid; this.#rid = rid; this.#addr = addr; } diff --git a/ext/net/02_tls.js b/ext/net/02_tls.js index 021ad93716..17d5240fb6 100644 --- a/ext/net/02_tls.js +++ b/ext/net/02_tls.js @@ -1,6 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. import { core, internals, primordials } from "ext:core/mod.js"; +const { internalRidSymbol } = core; const { op_net_accept_tls, op_net_connect_tls, @@ -10,7 +11,6 @@ const { } = core.ensureFastOps(); const { Number, - SymbolFor, TypeError, } = primordials; @@ -25,12 +25,12 @@ function opTlsHandshake(rid) { } class TlsConn extends Conn { - [SymbolFor("Deno.internal.rid")] = 0; + [internalRidSymbol] = 0; #rid = 0; constructor(rid, remoteAddr, localAddr) { super(rid, remoteAddr, localAddr); - this[SymbolFor("Deno.internal.rid")] = rid; + this[internalRidSymbol] = rid; this.#rid = rid; } @@ -78,12 +78,12 @@ async function connectTls({ } class TlsListener extends Listener { - [SymbolFor("Deno.internal.rid")] = 0; + [internalRidSymbol] = 0; #rid = 0; constructor(rid, addr) { super(rid, addr); - this[SymbolFor("Deno.internal.rid")] = rid; + this[internalRidSymbol] = rid; this.#rid = rid; } @@ -151,7 +151,7 @@ async function startTls( } = {}, ) { const { 0: rid, 1: localAddr, 2: remoteAddr } = await opStartTls({ - rid: conn[SymbolFor("Deno.internal.rid")], + rid: conn[internalRidSymbol], hostname, certFile, caCerts, diff --git a/ext/node/polyfills/_fs/_fs_open.ts b/ext/node/polyfills/_fs/_fs_open.ts index 9b4de4ce43..8bd989790b 100644 --- a/ext/node/polyfills/_fs/_fs_open.ts +++ b/ext/node/polyfills/_fs/_fs_open.ts @@ -3,6 +3,8 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials +import { core } from "ext:core/mod.js"; +const { internalRidSymbol } = core; import { O_APPEND, O_CREAT, @@ -137,7 +139,7 @@ export function open( path as string, convertFlagAndModeToOptions(flags as openFlags, mode), ).then( - (file) => callback!(null, file[Symbol.for("Deno.internal.rid")]), + (file) => callback!(null, file[internalRidSymbol]), (err) => (callback as (err: Error) => void)(err), ); } @@ -189,7 +191,7 @@ export function openSync( return Deno.openSync( path as string, convertFlagAndModeToOptions(flags, mode), - )[Symbol.for("Deno.internal.rid")]; + )[internalRidSymbol]; } function existenceCheckRequired(flags: openFlags | number) { diff --git a/ext/node/polyfills/internal_binding/stream_wrap.ts b/ext/node/polyfills/internal_binding/stream_wrap.ts index 8480a7d644..d568803bf3 100644 --- a/ext/node/polyfills/internal_binding/stream_wrap.ts +++ b/ext/node/polyfills/internal_binding/stream_wrap.ts @@ -31,6 +31,7 @@ // deno-lint-ignore-file prefer-primordials import { core } from "ext:core/mod.js"; +const { internalRidSymbol } = core; const { op_can_write_vectored, op_raw_write_vectored, @@ -46,8 +47,6 @@ import { } from "ext:deno_node/internal_binding/async_wrap.ts"; import { codeMap } from "ext:deno_node/internal_binding/uv.ts"; -const DENO_RID_SYMBOL = Symbol.for("Deno.internal.rid"); - interface Reader { read(p: Uint8Array): Promise; } @@ -205,7 +204,7 @@ export class LibuvStreamWrap extends HandleWrap { allBuffers: boolean, ): number { const supportsWritev = this.provider === providerType.TCPSERVERWRAP; - const rid = this[kStreamBaseField]![DENO_RID_SYMBOL]; + const rid = this[kStreamBaseField]![internalRidSymbol]; // Fast case optimization: two chunks, and all buffers. if ( chunks.length === 2 && allBuffers && supportsWritev && @@ -319,14 +318,14 @@ export class LibuvStreamWrap extends HandleWrap { async #read() { let buf = this.#buf; let nread: number | null; - const ridBefore = this[kStreamBaseField]![DENO_RID_SYMBOL]; + const ridBefore = this[kStreamBaseField]![internalRidSymbol]; try { nread = await this[kStreamBaseField]!.read(buf); } catch (e) { // Try to read again if the underlying stream resource // changed. This can happen during TLS upgrades (eg. STARTTLS) if ( - ridBefore != this[kStreamBaseField]![DENO_RID_SYMBOL] + ridBefore != this[kStreamBaseField]![internalRidSymbol] ) { return this.#read(); } @@ -377,7 +376,7 @@ export class LibuvStreamWrap extends HandleWrap { async #write(req: WriteWrap, data: Uint8Array) { const { byteLength } = data; - const ridBefore = this[kStreamBaseField]![DENO_RID_SYMBOL]; + const ridBefore = this[kStreamBaseField]![internalRidSymbol]; let nwritten = 0; try { @@ -391,7 +390,7 @@ export class LibuvStreamWrap extends HandleWrap { // Try to read again if the underlying stream resource // changed. This can happen during TLS upgrades (eg. STARTTLS) if ( - ridBefore != this[kStreamBaseField]![DENO_RID_SYMBOL] + ridBefore != this[kStreamBaseField]![internalRidSymbol] ) { return this.#write(req, data.subarray(nwritten)); } diff --git a/runtime/js/40_http.js b/runtime/js/40_http.js index 313adcbee9..2e932c968d 100644 --- a/runtime/js/40_http.js +++ b/runtime/js/40_http.js @@ -1,11 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { core, internals, primordials } from "ext:core/mod.js"; -const { - op_http_start, -} = core.ensureFastOps(); -const { - SymbolFor, -} = primordials; +import { core, internals } from "ext:core/mod.js"; +const { internalRidSymbol } = core; +const { op_http_start } = core.ensureFastOps(); import { HttpConn } from "ext:deno_http/01_http.js"; @@ -15,7 +11,7 @@ function serveHttp(conn) { new Error().stack, "Use `Deno.serve()` instead.", ); - const rid = op_http_start(conn[SymbolFor("Deno.internal.rid")]); + const rid = op_http_start(conn[internalRidSymbol]); return new HttpConn(rid, conn.remoteAddr, conn.localAddr); }