summaryrefslogtreecommitdiff
path: root/ext/node
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-01-26 20:04:07 +0100
committerGitHub <noreply@github.com>2024-01-26 14:04:07 -0500
commit942fb5e0388eab02f98c02541a3f90053afd59d1 (patch)
treeaf1cd1f358a37c8eab15c1a3ef7f3ee1be9548b6 /ext/node
parent9ed713153cf357dbf103dac2b8912729b4d10186 (diff)
chore: upgrade deno_core (#22124)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
Diffstat (limited to 'ext/node')
-rw-r--r--ext/node/polyfills/_fs/_fs_open.ts6
-rw-r--r--ext/node/polyfills/internal_binding/stream_wrap.ts13
2 files changed, 10 insertions, 9 deletions
diff --git a/ext/node/polyfills/_fs/_fs_open.ts b/ext/node/polyfills/_fs/_fs_open.ts
index 9b4de4ce4..8bd989790 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 8480a7d64..d568803bf 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<number | null>;
}
@@ -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<LibuvStreamWrap>, 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));
}