0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-04 01:44:26 -05:00

chore: upgrade deno_core (#22124)

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
This commit is contained in:
Bartek Iwańczuk 2024-01-26 20:04:07 +01:00 committed by GitHub
parent 9ed713153c
commit 942fb5e038
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 42 additions and 44 deletions

12
Cargo.lock generated
View file

@ -1196,9 +1196,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_core" name = "deno_core"
version = "0.254.0" version = "0.255.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd747cfefb65613073c71303f1b9817c541111dae68a2ce31b2ead5120f4222d" checksum = "66349d0fd8e9cad751435b59cf9e09e9fad9433301e9529ca4edf130ea3a06a0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bit-set", "bit-set",
@ -1653,9 +1653,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_ops" name = "deno_ops"
version = "0.130.0" version = "0.131.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2eaf696534fd715236131bbc23502c3acc975a987aaf0457528cefa4c4ccf51" checksum = "ee3363343cd15758aa02792e93b53b1def9cf1e8b23dd82bdce0f223e6046e76"
dependencies = [ dependencies = [
"proc-macro-rules", "proc-macro-rules",
"proc-macro2", "proc-macro2",
@ -5357,9 +5357,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_v8" name = "serde_v8"
version = "0.163.0" version = "0.164.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16e8193fbdd173c08fceb226d14bef66f1d8a84ed201b3e24c1404f2171b0734" checksum = "f96a94476f3d22fe9f70c2d992d020173ccd61ad6fa1b62ed8090abe835c4e9f"
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.254.0" } deno_core = { version = "0.255.0" }
deno_bench_util = { version = "0.129.0", path = "./bench_util" } deno_bench_util = { version = "0.129.0", path = "./bench_util" }
deno_lockfile = "0.18.0" deno_lockfile = "0.18.0"

View file

@ -3,6 +3,7 @@
import { core, internals, primordials } from "ext:core/mod.js"; import { core, internals, primordials } from "ext:core/mod.js";
const { const {
isDate, isDate,
internalRidSymbol,
} = core; } = core;
const { const {
op_fs_chdir, op_fs_chdir,
@ -655,14 +656,14 @@ function create(path) {
} }
class FsFile { class FsFile {
[SymbolFor("Deno.internal.rid")] = 0; [internalRidSymbol] = 0;
#rid = 0; #rid = 0;
#readable; #readable;
#writable; #writable;
constructor(rid, symbol) { constructor(rid, symbol) {
this[SymbolFor("Deno.internal.rid")] = rid; this[internalRidSymbol] = rid;
this.#rid = rid; this.#rid = rid;
if (!symbol || symbol !== SymbolFor("Deno.internal.FsFile")) { if (!symbol || symbol !== SymbolFor("Deno.internal.FsFile")) {
internals.warnOnDeprecatedApi( internals.warnOnDeprecatedApi(

View file

@ -4,6 +4,7 @@ import { core, internals, primordials } from "ext:core/mod.js";
const { const {
BadResourcePrototype, BadResourcePrototype,
InterruptedPrototype, InterruptedPrototype,
internalRidSymbol,
} = core; } = core;
const { const {
op_http_close_after_finish, op_http_close_after_finish,
@ -33,7 +34,6 @@ const {
PromisePrototypeCatch, PromisePrototypeCatch,
PromisePrototypeThen, PromisePrototypeThen,
Symbol, Symbol,
SymbolFor,
TypeError, TypeError,
TypedArrayPrototypeGetSymbolToStringTag, TypedArrayPrototypeGetSymbolToStringTag,
Uint8Array, Uint8Array,
@ -618,7 +618,7 @@ function serve(arg1, arg2) {
function serveHttpOnListener(listener, signal, handler, onError, onListen) { function serveHttpOnListener(listener, signal, handler, onError, onListen) {
const context = new CallbackContext( const context = new CallbackContext(
signal, signal,
op_http_serve(listener[SymbolFor("Deno.internal.rid")]), op_http_serve(listener[internalRidSymbol]),
listener, listener,
); );
const callback = mapToCallback(context, handler, onError); const callback = mapToCallback(context, handler, onError);
@ -634,7 +634,7 @@ function serveHttpOnListener(listener, signal, handler, onError, onListen) {
function serveHttpOnConnection(connection, signal, handler, onError, onListen) { function serveHttpOnConnection(connection, signal, handler, onError, onListen) {
const context = new CallbackContext( const context = new CallbackContext(
signal, signal,
op_http_serve_on(connection[SymbolFor("Deno.internal.rid")]), op_http_serve_on(connection[internalRidSymbol]),
null, null,
); );
const callback = mapToCallback(context, handler, onError); const callback = mapToCallback(context, handler, onError);

View file

@ -4,6 +4,7 @@ import { core, internals, primordials } from "ext:core/mod.js";
const { const {
BadResourcePrototype, BadResourcePrototype,
InterruptedPrototype, InterruptedPrototype,
internalRidSymbol,
} = core; } = core;
const { const {
op_dns_resolve, op_dns_resolve,
@ -40,7 +41,6 @@ const {
SetPrototypeForEach, SetPrototypeForEach,
SymbolAsyncIterator, SymbolAsyncIterator,
Symbol, Symbol,
SymbolFor,
TypeError, TypeError,
TypedArrayPrototypeSubarray, TypedArrayPrototypeSubarray,
Uint8Array, Uint8Array,
@ -91,7 +91,7 @@ async function resolveDns(query, recordType, options) {
} }
class Conn { class Conn {
[SymbolFor("Deno.internal.rid")] = 0; [internalRidSymbol] = 0;
#rid = 0; #rid = 0;
#remoteAddr = null; #remoteAddr = null;
#localAddr = null; #localAddr = null;
@ -102,7 +102,7 @@ class Conn {
#writable; #writable;
constructor(rid, remoteAddr, localAddr) { constructor(rid, remoteAddr, localAddr) {
this[SymbolFor("Deno.internal.rid")] = rid; this[internalRidSymbol] = rid;
this.#rid = rid; this.#rid = rid;
this.#remoteAddr = remoteAddr; this.#remoteAddr = remoteAddr;
this.#localAddr = localAddr; this.#localAddr = localAddr;
@ -201,12 +201,12 @@ class Conn {
} }
class TcpConn extends Conn { class TcpConn extends Conn {
[SymbolFor("Deno.internal.rid")] = 0; [internalRidSymbol] = 0;
#rid = 0; #rid = 0;
constructor(rid, remoteAddr, localAddr) { constructor(rid, remoteAddr, localAddr) {
super(rid, remoteAddr, localAddr); super(rid, remoteAddr, localAddr);
this[SymbolFor("Deno.internal.rid")] = rid; this[internalRidSymbol] = rid;
this.#rid = rid; this.#rid = rid;
} }
@ -229,12 +229,12 @@ class TcpConn extends Conn {
} }
class UnixConn extends Conn { class UnixConn extends Conn {
[SymbolFor("Deno.internal.rid")] = 0; [internalRidSymbol] = 0;
#rid = 0; #rid = 0;
constructor(rid, remoteAddr, localAddr) { constructor(rid, remoteAddr, localAddr) {
super(rid, remoteAddr, localAddr); super(rid, remoteAddr, localAddr);
this[SymbolFor("Deno.internal.rid")] = rid; this[internalRidSymbol] = rid;
this.#rid = rid; this.#rid = rid;
} }
@ -249,14 +249,14 @@ class UnixConn extends Conn {
} }
class Listener { class Listener {
[SymbolFor("Deno.internal.rid")] = 0; [internalRidSymbol] = 0;
#rid = 0; #rid = 0;
#addr = null; #addr = null;
#unref = false; #unref = false;
#promise = null; #promise = null;
constructor(rid, addr) { constructor(rid, addr) {
this[SymbolFor("Deno.internal.rid")] = rid; this[internalRidSymbol] = rid;
this.#rid = rid; this.#rid = rid;
this.#addr = addr; this.#addr = addr;
} }

View file

@ -1,6 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { core, internals, primordials } from "ext:core/mod.js"; import { core, internals, primordials } from "ext:core/mod.js";
const { internalRidSymbol } = core;
const { const {
op_net_accept_tls, op_net_accept_tls,
op_net_connect_tls, op_net_connect_tls,
@ -10,7 +11,6 @@ const {
} = core.ensureFastOps(); } = core.ensureFastOps();
const { const {
Number, Number,
SymbolFor,
TypeError, TypeError,
} = primordials; } = primordials;
@ -25,12 +25,12 @@ function opTlsHandshake(rid) {
} }
class TlsConn extends Conn { class TlsConn extends Conn {
[SymbolFor("Deno.internal.rid")] = 0; [internalRidSymbol] = 0;
#rid = 0; #rid = 0;
constructor(rid, remoteAddr, localAddr) { constructor(rid, remoteAddr, localAddr) {
super(rid, remoteAddr, localAddr); super(rid, remoteAddr, localAddr);
this[SymbolFor("Deno.internal.rid")] = rid; this[internalRidSymbol] = rid;
this.#rid = rid; this.#rid = rid;
} }
@ -78,12 +78,12 @@ async function connectTls({
} }
class TlsListener extends Listener { class TlsListener extends Listener {
[SymbolFor("Deno.internal.rid")] = 0; [internalRidSymbol] = 0;
#rid = 0; #rid = 0;
constructor(rid, addr) { constructor(rid, addr) {
super(rid, addr); super(rid, addr);
this[SymbolFor("Deno.internal.rid")] = rid; this[internalRidSymbol] = rid;
this.#rid = rid; this.#rid = rid;
} }
@ -151,7 +151,7 @@ async function startTls(
} = {}, } = {},
) { ) {
const { 0: rid, 1: localAddr, 2: remoteAddr } = await opStartTls({ const { 0: rid, 1: localAddr, 2: remoteAddr } = await opStartTls({
rid: conn[SymbolFor("Deno.internal.rid")], rid: conn[internalRidSymbol],
hostname, hostname,
certFile, certFile,
caCerts, caCerts,

View file

@ -3,6 +3,8 @@
// TODO(petamoriken): enable prefer-primordials for node polyfills // TODO(petamoriken): enable prefer-primordials for node polyfills
// deno-lint-ignore-file prefer-primordials // deno-lint-ignore-file prefer-primordials
import { core } from "ext:core/mod.js";
const { internalRidSymbol } = core;
import { import {
O_APPEND, O_APPEND,
O_CREAT, O_CREAT,
@ -137,7 +139,7 @@ export function open(
path as string, path as string,
convertFlagAndModeToOptions(flags as openFlags, mode), convertFlagAndModeToOptions(flags as openFlags, mode),
).then( ).then(
(file) => callback!(null, file[Symbol.for("Deno.internal.rid")]), (file) => callback!(null, file[internalRidSymbol]),
(err) => (callback as (err: Error) => void)(err), (err) => (callback as (err: Error) => void)(err),
); );
} }
@ -189,7 +191,7 @@ export function openSync(
return Deno.openSync( return Deno.openSync(
path as string, path as string,
convertFlagAndModeToOptions(flags, mode), convertFlagAndModeToOptions(flags, mode),
)[Symbol.for("Deno.internal.rid")]; )[internalRidSymbol];
} }
function existenceCheckRequired(flags: openFlags | number) { function existenceCheckRequired(flags: openFlags | number) {

View file

@ -31,6 +31,7 @@
// deno-lint-ignore-file prefer-primordials // deno-lint-ignore-file prefer-primordials
import { core } from "ext:core/mod.js"; import { core } from "ext:core/mod.js";
const { internalRidSymbol } = core;
const { const {
op_can_write_vectored, op_can_write_vectored,
op_raw_write_vectored, op_raw_write_vectored,
@ -46,8 +47,6 @@ import {
} from "ext:deno_node/internal_binding/async_wrap.ts"; } from "ext:deno_node/internal_binding/async_wrap.ts";
import { codeMap } from "ext:deno_node/internal_binding/uv.ts"; import { codeMap } from "ext:deno_node/internal_binding/uv.ts";
const DENO_RID_SYMBOL = Symbol.for("Deno.internal.rid");
interface Reader { interface Reader {
read(p: Uint8Array): Promise<number | null>; read(p: Uint8Array): Promise<number | null>;
} }
@ -205,7 +204,7 @@ export class LibuvStreamWrap extends HandleWrap {
allBuffers: boolean, allBuffers: boolean,
): number { ): number {
const supportsWritev = this.provider === providerType.TCPSERVERWRAP; 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. // Fast case optimization: two chunks, and all buffers.
if ( if (
chunks.length === 2 && allBuffers && supportsWritev && chunks.length === 2 && allBuffers && supportsWritev &&
@ -319,14 +318,14 @@ export class LibuvStreamWrap extends HandleWrap {
async #read() { async #read() {
let buf = this.#buf; let buf = this.#buf;
let nread: number | null; let nread: number | null;
const ridBefore = this[kStreamBaseField]![DENO_RID_SYMBOL]; const ridBefore = this[kStreamBaseField]![internalRidSymbol];
try { try {
nread = await this[kStreamBaseField]!.read(buf); nread = await this[kStreamBaseField]!.read(buf);
} catch (e) { } catch (e) {
// Try to read again if the underlying stream resource // Try to read again if the underlying stream resource
// changed. This can happen during TLS upgrades (eg. STARTTLS) // changed. This can happen during TLS upgrades (eg. STARTTLS)
if ( if (
ridBefore != this[kStreamBaseField]![DENO_RID_SYMBOL] ridBefore != this[kStreamBaseField]![internalRidSymbol]
) { ) {
return this.#read(); return this.#read();
} }
@ -377,7 +376,7 @@ export class LibuvStreamWrap extends HandleWrap {
async #write(req: WriteWrap<LibuvStreamWrap>, data: Uint8Array) { async #write(req: WriteWrap<LibuvStreamWrap>, data: Uint8Array) {
const { byteLength } = data; const { byteLength } = data;
const ridBefore = this[kStreamBaseField]![DENO_RID_SYMBOL]; const ridBefore = this[kStreamBaseField]![internalRidSymbol];
let nwritten = 0; let nwritten = 0;
try { try {
@ -391,7 +390,7 @@ export class LibuvStreamWrap extends HandleWrap {
// Try to read again if the underlying stream resource // Try to read again if the underlying stream resource
// changed. This can happen during TLS upgrades (eg. STARTTLS) // changed. This can happen during TLS upgrades (eg. STARTTLS)
if ( if (
ridBefore != this[kStreamBaseField]![DENO_RID_SYMBOL] ridBefore != this[kStreamBaseField]![internalRidSymbol]
) { ) {
return this.#write(req, data.subarray(nwritten)); return this.#write(req, data.subarray(nwritten));
} }

View file

@ -1,11 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { core, internals, primordials } from "ext:core/mod.js"; import { core, internals } from "ext:core/mod.js";
const { const { internalRidSymbol } = core;
op_http_start, const { op_http_start } = core.ensureFastOps();
} = core.ensureFastOps();
const {
SymbolFor,
} = primordials;
import { HttpConn } from "ext:deno_http/01_http.js"; import { HttpConn } from "ext:deno_http/01_http.js";
@ -15,7 +11,7 @@ function serveHttp(conn) {
new Error().stack, new Error().stack,
"Use `Deno.serve()` instead.", "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); return new HttpConn(rid, conn.remoteAddr, conn.localAddr);
} }