Commit graph

416 commits

Author SHA1 Message Date
Marvin Hagemeister
dbe35b03fb
fix(node): stub missing process.sourceMapsEnabled (#31358)
See https://nodejs.org/api/process.html#processsourcemapsenabled

This fixes an issue in Fresh with vite's environment API which relies on
this property to check if vite should map stack traces
https://github.com/vitejs/vite/blob/main/packages/vite/src/module-runner/sourcemap/index.ts#L17
2025-11-20 09:39:24 +00:00
Daniel Osvaldo Rahmanto
3c0f2890eb
fix(ext/node): segfault on calling StatementSync methods after connection has closed (#31331)
Some checks are pending
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Previously, running this code causes segfault:

```ts
import { DatabaseSync } from "node:sqlite";
const db = new DatabaseSync(':memory:');
const stmt = db.prepare('SELECT 1 AS value');
db.close();
stmt.get(); // segmentation fault (core dumped)
```

Changes in this PR also allows the
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-sqlite-statement-sync-columns.js
test to pass.
2025-11-19 08:56:09 +07:00
Ishita SIngh
ccc9aba580
fix(node/assert): deepStrictEqual now correctly handles Number objects (#31233)
Fixes #31172

## Description

The `deepStrictEqual` function was using `asserts.equal()` which doesn't
properly handle boxed primitives like Number objects. Changed it to use
`isDeepStrictEqual()` from `comparisons.ts` which correctly handles
Number, String, Boolean, BigInt, and Symbol objects.

## Changes

- Modified `ext/node/polyfills/assert.ts`:
- Added import for `isDeepStrictEqual` from
`ext:deno_node/internal/util/comparisons.ts`
- Updated `deepStrictEqual` function to use `isDeepStrictEqual()`
instead of `asserts.equal()`

- Added test cases in `tests/unit_node/assert_test.ts`:
- Test that `deepStrictEqual` throws `AssertionError` for different
Number objects
  - Test that `deepStrictEqual` passes for equal Number objects

## Testing

Added unit tests to verify:
- `deepStrictEqual` throws `AssertionError` for different Number objects
(e.g., `new Number(1)` vs `new Number(2)`)
- `deepStrictEqual` passes for equal Number objects (e.g., `new
Number(1)` vs `new Number(1)`)

## Related Issue

#31172 - `assert.deepStrictEqual` does not throw exception for Number
objects

---------

Co-authored-by: Daniel Rahmanto <daniel.rahmanto@gmail.com>
2025-11-18 09:02:21 +07:00
Sravanth
863abe816e
feat(ext/node): implement FileHandle.appendFile(data[, options]) (#31301)
Part of #25554

This PR adds support for the missing `FileHandle.appendFile()` API in
the Node.js compatibility layer.
2025-11-17 08:57:04 +01:00
Adriano
b0cfbf53d3
fix(ext/node): Add sqlite setAllowUnknownNamedParameters option (#31202)
Adds
[statement.setAllowUnknownNamedParameters(enabled)](https://nodejs.org/api/sqlite.html#statementsetallowunknownnamedparametersenabled)
to `node:sqlite`.

Closes #31196
2025-11-14 16:00:03 +05:30
Daniel Osvaldo Rahmanto
ffe207a859
fix(ext/node): FileHandle compatibility (#31164)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Towards #29972

Tries to reland #31094 that got reverted on #31103 due to CI test
failures. This PR differs by fixing the `[kUnref]` method to close
resource ID correctly.

Allows the following tests to pass:
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-filehandle-close.js
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-fs-filehandle-use-after-close.js

---------

Signed-off-by: Daniel Osvaldo Rahmanto <daniel.rahmanto@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-14 12:17:45 +07:00
Jake Champion
05bc6360e7
fix(node:console): ensure that the node:console implementation has an implementation for emitWarning in scope (#31263)
Introduces the emitWarning function from the process module to enable
warning capabilities within the console constructor implementation.

This fixes a bug where the `time`, `countReset` and `timeLogImpl`
functions would throw an error due to trying to call `emitWarning`, they
would throw an error for an undefined variable named `emitWarning` or if
a global function had that name` they would call that function, which is
not expected behaviour here.

---------

Signed-off-by: Jake Champion <me@jakechampion.name>
2025-11-13 10:33:50 +01:00
TarikSogukpinar
1edd1fb657
fix(ext/node): ensure 'exit' event is fired only once for worker_threads (#31231)
Closes #30013

The `'exit'` event in `node:worker_threads` was not consistently fired,
or in some cases emitted multiple times, diverging from Node.js
behavior.
2025-11-12 14:15:44 +01:00
amitihere
30cf1f4162
fix(ext/node): implement performance.timerify() (#31238)
Adds the missing implementation for `performance.timerify()` in
`node:perf_hooks`, which previously resulted in a "Not implemented"
error.

Fixes #31115
2025-11-12 13:55:02 +01:00
Daniel Osvaldo Rahmanto
19c7f1fc5d
fix(ext/node): truncate first non-hex value on Buffer.from (#31227) 2025-11-10 18:32:09 +07:00
Daniel Osvaldo Rahmanto
88aa2461c1
fix(ext/node): implement process.setgid() and process.setuid() (#31162)
Closes #31145, #31146
2025-11-05 09:15:28 +01:00
Daniel Osvaldo Rahmanto
d21201e2a0
fix(ext/node): implement process:seteuid() (#31160)
Closes #31144
2025-11-03 21:30:21 +07:00
Daniel Osvaldo Rahmanto
361c83ea35
fix(ext/node): implement process.setegid() (#31155)
Closes #31116
2025-11-03 20:27:53 +07:00
Felipe Cardozo
be1ede505b
fix(ext/node): implement util.getSystemErrorMessage() (#31147)
Solution for https://github.com/denoland/deno/issues/31132
2025-11-03 11:24:06 +01:00
Daniel Osvaldo Rahmanto
552cb3df05
fix(ext/node): respects flag option on fs.readfile and fs.readfilesync (#31129)
Closes #31099
2025-10-31 09:32:36 +01:00
Daniel Osvaldo Rahmanto
58f21ae597
fix(ext/node): inconsistent error message thrown by AssertionError (#31089)
Closes #31082
2025-10-28 09:51:09 +01:00
Felipe Cardozo
ee6c66b9e9
fix(ext/node): handle empty writes in chunked HTTP requests (#31066)
Some checks are pending
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
2025-10-28 07:08:49 +05:30
Daniel Osvaldo Rahmanto
202a8c054b
Revert "fix(ext/node): fileHandle compatibility" (#31103)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Reverts denoland/deno#31094

This has caused node compat tests to fail on main.
2025-10-27 16:27:50 +00:00
Daniel Osvaldo Rahmanto
3a1ae29327
fix(ext/node): fileHandle compatibility (#31094)
Towards #29972

Notable changes:
- Omits `path` from the `FileHandle` constructor. This includes
replacing `utimes` and `chown` with `futimes` and `fchown`.
- Handles closing resource ID gracefully to follow node's
implementation. Closed resource IDs are marked as `-1`.
- Make every fs method to call the `fsCall` function.

Allows the following tests to pass:
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-filehandle-close.js
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-fs-filehandle-use-after-close.js
2025-10-27 16:58:23 +05:30
Felipe Cardozo
c0ebacba75
fix(ext/node): handle multiple calls in inspector.Session.post() (#31067)
Some checks are pending
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
Fixes a panic that occurred when using nested session.post() calls in
the node:inspector module. The issue manifested when callbacks from
inspector commands (like Profiler.enable) called session.post() again,
causing a re-entrant invocation of op_inspector_dispatch.

Fixes https://github.com/denoland/deno/issues/31020
2025-10-27 10:46:55 +01:00
Daniel Osvaldo Rahmanto
2b0f277e96
fix(ext/node): fs.read/fs.readSync and fs.write/fs.writeSync compatibility (#31013)
Towards #29972

- `fs.read` and `fs.readSync`: accepts object option parameter.
- `fs.write` and `fs.writeSync`: negative position value defaults to the
current seek position.
- Allows several node compatibility tests to pass.
2025-10-22 10:48:42 +02:00
Edilson Pateguana
3987af2aa1
feat(ext/node): impl sqlite 'backup' capability (#29842)
Towards #29439 

This commit implements the `backup` function from the `node:sqlite` module.
2025-10-21 23:27:34 +02:00
Daniel Osvaldo Rahmanto
243857c362
fix(ext/node): false deprecation warning on crypto.createHmac (#31025)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-10-20 18:22:25 +00:00
Felipe Cardozo
48f273b8c9
fix(ext/node): process.moduleLoadList as undefined (#31022) 2025-10-20 14:51:46 +00:00
Daniel Osvaldo Rahmanto
a44f0cb99f
fix(ext/node): support option object parameter on fs.write and fs.writeSync (#30999)
Some checks are pending
ci / build libs (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Closes #30972

Other changes:
- Re-enables ignored tests on `tests/unit_node/_fs/_fs_write_test.ts`
- Ported the polyfill to `.ts`, though defining the types are tricky
since our implementation (ported from node) mutates a lot of variables.
2025-10-17 14:28:31 +02:00
Daniel Osvaldo Rahmanto
80e54a81e7
fix(ext/node): checking Symbol in env should not ask for permission (#30965)
Discovered on #30905, though not directly addressing the main issue

Given this code: 
```ts
console.log(globalThis.process.env)
```

Deno 2.5.4:
```bash
➜ deno index.ts 
 Granted env access to "Symbol(Deno.customInspect)".
 Granted env access to "Symbol(Deno.privateCustomInspect)".
 Granted env access to "Symbol(nodejs.util.inspect.custom)".
 Granted env access to "constructor".
 Granted env access to "Symbol(Symbol.iterator)".
 Granted env access.
[..result..]
```

This PR:
```bash
➜ deno index.ts
 Granted env access to "constructor".
 Granted env access.
[..result..]
```

Futhermore, it allows the following tests to pass:
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-process-env-deprecation.js
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-process-env-ignore-getter-setter.js
2025-10-14 08:25:35 +02:00
Daniel Osvaldo Rahmanto
03a5e4531b
fix(ext/node): dns.resolve6 compatibility (#30974)
Closes #30936

The `compressIPv6` function is causing this issue. Maybe it was used in
the past to compress IPv6 address returned from the op function, though
I might be wrong about this.

Both `Deno.resolveDns` and the `resolve6` polyfill use `op_dns_resolve`
op function, which returns a result that already matches with the
Node.js' `resolve6`. The incorrect result is due to our `resolve6`
polyfill applying the `compressIPv6` function to the result.
2025-10-13 11:20:08 +02:00
Daniel Osvaldo Rahmanto
805973385d
fix(ext/node): omit smi from zlib.crc32 op function (#30907)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Closes #30636
2025-10-03 13:57:30 -07:00
Daniel Osvaldo Rahmanto
1573279c12
fix(ext/node): fs.stat and fs.statSync compatibility (#30866)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
2025-10-03 11:34:01 -04:00
Yusuke Tanaka
415acdd462
fix(ext/node): avoid stack overflow in node:zlib's gunzip (#30865)
Fixes #30829

## Problem

The zlib polyfill had recursive calls between `processCallback` and
`handle.write()` that caused stack overflow when decompressing large
data.

## Solution

Defer `handle.write()` calls with `process.nextTick()` to break the
synchronous call chain.

## Changes
- `ext/node/polyfills/zlib.js`: Wrapped `handle.write()` in
`process.nextTick()`
- `tests/unit_node/zlib_test.ts`: Added test for 64MiB data
decompression
2025-10-03 17:57:23 +09:00
Daniel Osvaldo Rahmanto
926bcbc4c2
fix(ext/node): inspect X509Certificate class (#30882)
Fixes #30874
2025-10-03 13:49:56 +05:30
Daniel Osvaldo Rahmanto
0d73ac088a
fix(ext/node): setTimeout promisified to handle abort signal (#30855)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Fixes #30839
2025-09-26 17:12:15 +02:00
Daniel Osvaldo Rahmanto
dcc9474175
fix(ext/node): fs.readFile, fs.readFileSync assert encoding (#30830)
Towards #29972

- Validates the encoding of `readFile`.
- Fixes the handling of `binary` encoding where previously it returns
Buffer. On Node.js, Buffer is only returned when the encoding is not
specified.
- Allows
[parallel/test-fs-read-file-assert-encoding.js](https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-fs-read-file-assert-encoding.js)
test to pass.
2025-09-24 15:32:41 +02:00
Daniel Osvaldo Rahmanto
2ad17f7c7c
fix(ext/node): crypto Cipheriv and Decipheriv base64 encoding (#30806)
Some checks are pending
ci / build libs (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Fixes #30722

The root cause comes from the `.update()` and `.final()` methods of
`Cipheriv` and `Decipheriv`, which internally calls `.toString()` method
of Buffer. Doing so adds padding to make the output length a multiple of
4, which we don't want for this case. This PR replaces that to use
`StringDecoder` instead, making it more aligned with the Node.js
implementation.
2025-09-23 11:38:06 +02:00
snek
4772778107
refactor: http upgrade internals (#30612)
Some checks are pending
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
clean up some outdated code and implement a few performance
improvements. most notably, the response from `upgradeWebSocket` is now
actually used as a normal response.

a followup pr will rework raw upgrades to a greater extent
2025-09-19 09:33:32 +02:00
Daniel Osvaldo Rahmanto
328d5ef2a0
fix(ext/node): accept ArrayBuffer on crypto.timingSafeEqual (#30773)
Some checks are pending
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Fixes #30759

The buffer validation is based on Node.js implementation:
591ba692bf/src/crypto/crypto_util.h (L467-L472)
2025-09-18 16:51:56 +02:00
Daniel Osvaldo Rahmanto
ebcb2fa294
fix(ext/node): fs.statfsSync and fs.statfs compatibility (#30662)
Towards #29972

- Converts the polyfill to typescript.
- Implement async op.
- Allows `Buffer` type path.
- Allows
[parallel/test-fs-statfs.js](https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-fs-statfs.js)
test to pass.
2025-09-18 16:03:30 +02:00
Bartek Iwańczuk
4a1f63b930
Revert "fix(ext/node): fs.stat and fs.statSync compatibility (#30… (#30741)
Some checks are pending
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
…637)"

This reverts commit 432761aac5.

The tests are causing flakes on Windows
2025-09-15 19:25:47 -04:00
Daniel Osvaldo Rahmanto
08d9895075
chore(test): fix node:fs.close test flakiness (#30735) 2025-09-15 17:21:22 +00:00
Daniel Osvaldo Rahmanto
432761aac5
fix(ext/node): fs.stat and fs.statSync compatibility (#30637)
Some checks are pending
ci / build libs (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Closes #30570

Changes in this PR:
- Implement `ino`, `nlink`, and `blocks` properties of `Deno.FileInfo`
on Windows. These changes are automatically reflected to the
corresponding node stat function. In order to do so, I had to tinker
with the
[createByteStruct](a3a904da14/ext/fs/30_fs.js (L297))
function to create another optional int type, apart from `?u64`. It's
common for small sized files on Windows (particularly NTFS file system)
to have a `Stats.blocks` property of 0, and currently all 0 values with
type `?u64` will be coerced into `null` by `createByteStruct`.
- Refactor the `BigIntStats` and `Stats` class, to use the same class
with Node.js that are provided from
[utils.mjs](7f8e488c36/ext/node/polyfills/internal/fs/utils.mjs (L577)).
Also ensures that all properties are not `null` or `undefined`.
- Addresses the `prefer-primordials` lint rule.
2025-09-15 15:29:30 +02:00
Daniel Osvaldo Rahmanto
27fa8db5c6
fix(ext/node): handle falsy values enumerability in process.env (#30708)
Closes #30701
2025-09-15 11:59:51 +02:00
Daniel Osvaldo Rahmanto
6050aea25a
fix(ext/node): set default callback for fs.close (#30720)
Fixes #30718
2025-09-15 08:05:31 +00:00
Daniel Osvaldo Rahmanto
8244cd8e21
fix(ext/node): validate readlink arguments (#30691)
Some checks are pending
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Also accepts `Buffer` typed path. Allows
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-fs-readlink-type-check.js
test to pass.

Towards #29972
2025-09-11 18:43:48 +02:00
Alex Yang
cb4207efb6
feat(ext/node): add sqlite-type symbol for DatabaseSync (#30511)
Related:
d1eabcb044
Related: https://github.com/nodejs/node/pull/59405
Related: https://github.com/better-auth/better-auth/pull/3869
Related: https://github.com/oven-sh/bun/pull/22109

Nowadays, there are tons of database packages, like sqlite3, sqlite,
better-sqlite, bun:sqlite... Checking the difference from them is pretty
hard.
instanceof is not good, since the developer will still need to import
the module, which is costly.
I think we should provide a symbol to distinguish different SQLite
classes, at least nodejs could make the first step.

---------

Signed-off-by: Alex Yang <himself65@outlook.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-09-08 23:45:39 +00:00
Yoshiya Hinosawa
6ee7d60ce1
fix(ext/node): set socket.authorized to true for https request (#30641)
This PR sets true to `req.socket.authorized` when making https request
from `node:https` module.

This makes yarn classic's https client working (e.g. `yarn add cowsay`).

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-09-08 20:29:41 +00:00
Daniel Osvaldo Rahmanto
e60f5d2c52
fix(ext/node): fs.mkdtemp and fs.mkdtempSync compatibility (#30602)
Some checks are pending
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
`fs.mkdtemp` and `fs.mkdtempSync` now accept `Buffer` and `Uint8Array`
path. The implementation has been moved to Rust, including directory
suffix generation and directory creation.
2025-09-05 16:12:42 -04:00
EdamAmex
d5eaefc3c0
fix(ext/node): ignore Node.js' --experimental-* flags when spawning child process (#26351)
Closes https://github.com/denoland/deno/issues/26349

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-09-04 12:18:51 +00:00
Daniel Osvaldo Rahmanto
e843a115fd
fix(ext/node): fs.symlink and fs.symlinkSync compatibility (#30555) 2025-09-03 17:48:13 -04:00
Daniel Osvaldo Rahmanto
1ef0d0838e
fix(ext/node): implement http.res.setHeaders (#30586)
Closes #30540

Also fixes res.writeHead implementation to parse array values correctly.
For example, `res.writeHead(200, [["foo", "bar"]])` and
`res.writeHead(200, ["foo", "bar"])` should produce the same result.

These changes allows
[parallel/test-http-response-setheaders.js](https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-http-response-setheaders.js)
to pass.
2025-09-01 23:13:03 +02:00
Divy
36e9eb2023
fix(ext/node): support JS underlying stream in TLS (#30465)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Fixes https://github.com/denoland/deno/issues/20594

This implements `JSStreamSocket` which drives the TLS underlying stream
in `rustls_tokio_stream` using 2 sets of channels. One for piping the
encrypted protocol transport and the other for plaintext application
data.

This fixes connecting to `npm:mssql`:
```js
import sql from "npm:mssql";

const sqlConfig = {
  server: "localhost",
  user: "divy",
  password: "123",
  database: "master",
  options: {
    trustServerCertificate: true,
  },
};

const pool = await sql.connect(sqlConfig);
const result = await pool.request().query(`SELECT * FROM sys.databases`);
```
2025-08-28 17:56:17 +05:30