Commit graph

1568 commits

Author SHA1 Message Date
denobot
9cd8077757
2.6.2 (#31674)
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
Bumped versions for 2.6.2

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-12-19 14:04:14 +00:00
Bartek Iwańczuk
bd7b0a8f3a
fix(ext/node): stub out Module.register and Module.registerHooks (#31666)
Stubs out `Module.register` and `Module.registerHooks` functions that
are meant to be used for Module Loader hooks as per
https://nodejs.org/api/module.html#customization-hooks.

This is a follow up to https://github.com/denoland/deno/pull/24965

Ref https://github.com/denoland/deno/issues/31665.
Improves error message from
https://github.com/denoland/deno/issues/30538#issuecomment-3658925471.
2025-12-19 13:28:29 +01:00
Felipe Cardozo
dd47e25a30
feat: support named pipe listen, connect and open (#31624)
Co-authored-by:  Cyan Changes <contact@cyans.me>

Add support to Pipe.prototype.listen, Pipe.prototype.connect for windows
with named pipes.
Also support to Pipe.prototype.open for unix.

Alternative of https://github.com/denoland/deno/pull/29308, but without
`Deno:pipe`.
Only with node compatibilities.


Solution for:
https://github.com/denoland/deno/issues/25867
https://github.com/denoland/deno/issues/28332
https://github.com/denoland/deno/issues/31032


Maybe related:
https://github.com/denoland/deno/issues/10244


I tested the Nuxt and Nx, they are working fine on Windows now.
I also tested node-pty, and it's working on Unix.

Co-authored-by: Cyan Changes <contact@cyans.me>
2025-12-19 09:18:48 +01:00
Takuro Kitahara
bf919416b3
fix(ext/node): avoid env permission for TERM in console and readline (#31638)
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
Fixes #30372
2025-12-18 13:28:33 +01:00
Mert Can Altin
719132d265
fix(ext/node): add error handling functions and tests for UV bindings (#31639) 2025-12-18 13:14:47 +01:00
Leo Kettmeir
26fdc29fe0
fix: update glob implementation to match with latest node (#31627)
Fixes #31625
2025-12-17 17:05:08 +01:00
Daniel Osvaldo Rahmanto
2ec057b3e0
fix(ext/node): sqlite:backup compatibility (#31610)
Notable changes:
- Respect progress callback function option.
- Set default backup rate to 100 to follow Node's implementation.
- Various validation and error handling.

Note that the op implementation in this PR is still sync.

Given this code:
```js
import { backup, DatabaseSync } from "node:sqlite";

const populate = (database, rows) => {
  database.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT);");
  let values = "";
  for (let i = 0; i < rows; i++) {
    values += `(${i}, 'Name ${i}'),`;
  }
  values = values.slice(0, -1);
  database.exec(`INSERT INTO test (id, name) VALUES ${values}`);
};

const backupPath = "backup.sqlite";
const database = new DatabaseSync(":memory:");
populate(database, 1000);

const t0 = performance.now();
await backup(database, backupPath, { rate: 1 });
const t1 = performance.now();
database.close();
console.log(`Backup completed in ${(t1 - t0).toFixed(2)} ms`);
```

Results:
```bash
# Node.js v25.2.1
➜ node ./backup-benchmark.js
Backup completed in 0.71 ms

# This PR (debug build mode)
➜ ddeno -A ./backup-benchmark.js
Backup completed in 0.71 ms

# Deno v2.6.0
➜ deno -A ./backup-benchmark.js
Backup completed in 1272.16 ms
```

The current implementation is slow because it sleeps 250ms after each
`sqlite3_backup_step` call.
2025-12-16 15:26:12 +07:00
denobot
abf630fb20
2.6.1 (#31615)
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
Bumped versions for 2.6.1

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-12-15 13:45:57 +01:00
Daniel Osvaldo Rahmanto
80e36fc36a
fix(ext/node): DatabaseSync compatibility (#31515)
Closes #29439

Notable changes:
- `DatabaseSync`:
  - accept Buffer and URL paths.
  - implement `.location()` method.
  - add `isTransaction` and `isOpen` getters.
  - respect timeout option.
- `backup`: accept Buffer and URL paths.

Allows
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-sqlite-database-sync.js
test to pass.
2025-12-11 20:04:20 +07:00
denobot
d5b1548eba
2.6.0 (#31549)
Bumped versions for 2.6.0

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-12-10 14:29:22 +01:00
Divy
0bc213b15b
fix(ext/node): prevent cipher operations after finalize (#31533)
Throw a state error for operations if the cipher is already finalized.
2025-12-09 16:03:37 +05:30
Daniel Osvaldo Rahmanto
2353b9ba6a
fix(ext/node): implement DatabaseSync.aggregate() (#31461)
Implementation is based on
https://github.com/nodejs/node/blob/v24.2.0/src/node_sqlite.cc

It passes all tests from
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-sqlite-aggregate-function.mjs
except for two test cases where it uses `mock()` from `node:test`, which
we don't yet implement. The tests on `sqlite_test.ts` are copied from
the node compat test cases.

---------

Co-authored-by: Divy <dj.srivastava23@gmail.com>
2025-12-08 10:34:31 +00:00
Marvin Hagemeister
b8b549d574
fix(node): missing statfs export from node:fs/promises (#31528)
We already had the functionality, we just didn't export it.

Fixes https://github.com/denoland/deno/issues/31526
2025-12-08 09:45:01 +00:00
Nicholas R
bc9d356059
fix(node/net): return string family in server.address() (#31465)
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
## Summary

Aligns Deno's Node.js compatibility layer (`node:net`, `node:http`,
`node:https`,
`node:http2`, `node:dns`) with Node.js v18.4.0+ behavior by returning
the `family`
property as a string (`"IPv4"` or `"IPv6"`) rather than a number in
`server.address()`
   and socket address methods.

Node.js briefly changed `family` from string to number in v18.0.0
(nodejs/node#41431),
   but reverted in v18.4.0 (nodejs/node#43054) due to ecosystem breakage
   (nodejs/node#43014).

This fix ensures compatibility with npm packages that rely on the string
format, which
   has been the stable API since Node.js v18.4.0.

   ## Changes

- Modified `ext/node/polyfills/http.ts` to add `family` property to
`address()` return
- Modified `ext/node/polyfills/internal_binding/tcp_wrap.ts` to return
string `family`
instead of number in `getsockname()`, `getpeername()`, and `#connect()`
- Modified `ext/node/polyfills/net.ts` to fix `socket.remoteFamily`
getter (no longer
   needs conversion since `family` is now a string)
   - Modified `ext/node/polyfills/dns.ts` and
`ext/node/polyfills/internal/dns/promises.ts` to accept string family
values (`"IPv4"`,
`"IPv6"`) in `lookup()`, matching [Node.js
behavior](https://nodejs.org/api/dns.html#dnslookuphostname-options-callback)
- Added tests in `tests/unit_node/http_test.ts`,
`tests/unit_node/http2_test.ts`,
   `tests/unit_node/https_test.ts`, `tests/unit_node/dns_test.ts`, and
   `tests/unit_node/net_test.ts`

   ## Node.js Compatibility Note

For non-IP addresses (when `isIP()` returns 0), the `family` property is
`undefined`.
This matches Node.js C++ behavior in
[`AddressToJS`](https://github.com/nodejs/node/blob/main/src/tcp_wrap.cc)
where family
is only set for `AF_INET` (`"IPv4"`) and `AF_INET6` (`"IPv6"`), and left
undefined
   otherwise.

   ## Refs

   - nodejs/node#43054
   - nodejs/node@70b516e


<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Daniel Rahmanto <daniel.rahmanto@gmail.com>
2025-12-06 10:51:55 +07:00
Bartek Iwańczuk
5b2dc85a3c
Revert "feat: use Node.js timers by default (#31272)" (#31490)
Some checks are pending
ci / test release windows-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 / 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
This reverts commit 7ada8d6589.

This is a breaking change and is postponed until Deno 3.0.
2025-12-04 00:50:11 +00:00
Bartek Iwańczuk
4b5a26d271
Revert "refactor: remove 'managed globals' infra (#31318)" (#31491)
This reverts commit 9498b36170.

This is a breaking change and is postponed until Deno 3.0.
Related to https://github.com/denoland/deno/pull/31490
2025-12-03 15:27:09 -08:00
denobot
49fa02d988
fix(ext/node): url.domainToASCII returns empty string for invalid domains (#31219)
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
## Summary

This PR fixes the behavior of `url.domainToASCII` to match Node.js by
returning an empty string when an invalid domain is passed, instead of
throwing an error.

## Changes

- Modified `op_node_idna_domain_to_ascii` in `ext/node/ops/idna.rs` to
return an empty string on error instead of propagating the error
- Updated documentation in `ext/node/polyfills/internal/idna.ts` to
clarify this behavior
- Added spec test in `tests/specs/node/url_domain_to_ascii/` to verify
the fix

## Test Plan

### Manual Testing
Tested with the example from the issue:
```javascript
import url from 'node:url';
console.log(url.domainToASCII('xn--iñvalid.com')); // Returns empty string instead of throwing
```

Also tested with various valid and invalid domains to ensure
compatibility:
- Valid domains: `example.com` → `example.com`
- Valid unicode: `münchen.de` → `xn--mnchen-3ya.de`
- Invalid punycode: `xn--iñvalid.com` → `` (empty string)
- Invalid domain: `xn--` → `` (empty string)

### Automated Tests
Added spec test that verifies the behavior matches Node.js for both
valid and invalid domains.

## Closes

Fixes #31133

---

_This PR was autogenerated and may require review and adjustments._

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Daniel Rahmanto <daniel.rahmanto@gmail.com>
2025-12-03 21:57:53 +07:00
Daniel Osvaldo Rahmanto
95e434eb37
fix(ext/node): respect abort signal option on FileHandle.readFile (#31462)
Towards #29972

Allows
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-fs-promises-file-handle-readFile.js
test to pass.
2025-12-02 08:13:11 +07:00
Nicholas R
42b6c82254
fix(node/process): make process.stdin.isTTY writable (#31464)
## Summary

In Node.js, `tty.ReadStream` sets `isTTY` as a simple instance property
(`this.isTTY = true`), making it naturally writable. Deno's polyfill
used a getter-only property definition, preventing assignment.

Some npm packages need to override `isTTY` at runtime. For example,
Playwright's test server sets `process.stdin.isTTY = undefined` to
prevent reporters from blocking on user input during UI mode
(microsoft/playwright#37867).

This aligns stdin with the stdout/stderr fix from #26130, ensuring all
stdio streams behave consistently with Node.js.

## Refs
-
6a1a3ba045/lib/tty.js (L71)
-
3a5a32d26d/packages/playwright/src/runner/testServer.ts (L257-L266)

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-02 00:37:23 +01:00
Bartek Iwańczuk
4c228b455d
fix(ext/node): reimplement setImmediate API (#30328)
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 / 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 / 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 / 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
Closes https://github.com/denoland/deno/issues/28016
2025-11-28 11:05:41 +01:00
David Sherret
ef3192d879
fix(node/timers): ensure active timers entry is deleted on Timeout.prototype.refresh (#31436)
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
Closes https://github.com/denoland/deno/issues/31435
2025-11-27 14:03:27 -05:00
Nathan Whitaker
faf9505814
fix(node): support advanced serialization in IPC (#31380)
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 / 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 / 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 / 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
Fixes #31354.
2025-11-26 23:15:32 +00:00
Nathan Whitaker
3e22a737ed
perf(node): optimize Buffer compare (#31425)
Implements the comparison part in native code, which effectively uses
memcmp instead of comparing byte by byte

Benchmark:
```ts
import { bench, run } from "mitata";
import { Buffer } from "node:buffer";

const a = Buffer.from(new Array(8 * 1024 * 1024).fill(2));
const b = Buffer.from(new Array(8 * 1024 * 1024).fill(2));

bench("Buffer.compare offset", () => a.compare(b, 6, undefined, 10));

bench("Buffer.compare full", () => Buffer.compare(a, b));

await run();
```

Before:
```
❯ deno run -A compare.mjs
cpu: Apple M3 Max
runtime: deno 3.0.0-rc.0+0bd52c4 (aarch64-apple-darwin)

benchmark                   avg (min … max) p75 / p99    
------------------------------------------- ---------
Buffer.compare offset         14.95 ms/iter  15.22 ms
                      (14.29 ms … 17.19 ms)  16.83 ms  
                    (  1.09 kb …   9.75 kb)   1.64 kb 

Buffer.compare full           17.67 ms/iter  19.75 ms
                      (14.17 ms … 23.50 ms)  22.59 ms
                    (696.00  b … 776.00  b) 698.05  b
```

After:
```
❯ devdeno run -A compare.mjs
cpu: Apple M3 Max
runtime: deno 3.0.0-rc.0 (aarch64-apple-darwin)

benchmark                   avg (min … max) p75 / p99   
------------------------------------------- ---------
Buffer.compare offset        172.66 µs/iter 173.21 µs
                    (162.38 µs … 284.37 µs) 212.33 µs 
                    (  0.00  b … 352.40 kb)   1.03 kb

Buffer.compare full          167.45 µs/iter 167.33 µs
                    (151.21 µs … 266.63 µs) 224.79 µs 
                    (  0.00  b … 448.40 kb)   1.12 kb
```
2025-11-26 23:39:14 +01:00
Daniel Osvaldo Rahmanto
0bd52c4640
fix(ext/node): implement DatabaseSync.function() and better error details (#31386)
Some checks are pending
ci / test release windows-x86_64 (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 / 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 / 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
Closes #30097

Implementation is based on
https://github.com/nodejs/node/blob/v24.2.0/src/node_sqlite.cc

Changes in this PR allows
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-sqlite-custom-functions.js
test to pass.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-11-25 14:14:27 +00:00
Nathan Whitaker
7ad8750fe9
perf(node): implement getOwnNonIndexProperties in native code (#31393)
This speeds up assertions on typed arrays by a ton. This unblocks one of
the node compat tests for advanced serialization, which times out
because the assertion is too slow.

Bench:
```
import assert from "node:assert";

const iters = 10;
let total = 0;
for (let i = 0; i < iters; i++) {
  const start = performance.now();
  assert.deepStrictEqual(
    new Uint8Array(8 * 1024 * 1024).fill(0),
    new Uint8Array(8 * 1024 * 1024).fill(0),
  );
  const end = performance.now();
  total += end - start;
}

console.log("took", total / iters, "per iter");
```

Before:

```
took 2634.9984669 per iter
```

After:

```
took 15.0644873 per iter
```

So over 100x faster
2025-11-24 21:25:19 +00:00
Daniel Osvaldo Rahmanto
f881b2f9a7
fix(ext/node): autopadding behavior on crypto.Cipheriv (#31389)
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
2025-11-24 18:33:57 +07:00
Daniel Osvaldo Rahmanto
f61f5ffe7b
fix(ext/node): StatementSync.iterate() should reset is_iter_finished flag on every call (#31361) 2025-11-20 23:22:26 +07:00
Bartek Iwańczuk
9498b36170
refactor: remove 'managed globals' infra (#31318)
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
This should also solve problems in
https://github.com/denoland/deno/issues/30905#issuecomment-3517418642.
2025-11-20 12:29:00 +01:00
Daniel Osvaldo Rahmanto
491274d6ed
fix(ext/node): implement dns.lookupService (#31310)
Closes #26300

Allows the following node compatibility tests to pass:
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-dns-lookupService-promises.js
-
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-dns-lookupService.js

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added `dns.lookupService()` for reverse DNS lookups, supporting both
callback and Promise-based APIs.
* Returns hostname and service information for a given IP address and
port combination.

* **Tests**
* Added unit tests for new DNS lookupService functionality across
callback and Promise variants.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-11-20 11:12:26 +00:00
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
Vamshi Krishna Pendyala
5b53514e8a
fix(node): ensure process.argv is an array of strings (#31322)
Some checks are pending
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 / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (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
This PR resolves #30964 where process.argv returned getter functions
rather than string values.

---------

Co-authored-by: Daniel Rahmanto <daniel.rahmanto@gmail.com>
2025-11-18 10:39:00 +01: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
Nathan Whitaker
5421a29944
refactor: remove permission traits + generics from extension crates (#31284)
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
I also moved the `RuntimePermissionDescriptorParser` struct from
deno_runtime into deno_permissions, so that extension crates can use it
in tests and stuff like that
2025-11-17 10:30:36 -08:00
Daniel Osvaldo Rahmanto
74eff7bcd4
fix(ext/node): sqlite setAllowUnknownNamedParameters error message (#31319)
Allows
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-sqlite-named-parameters.js
to pass.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Corrected an error message for SQLite named parameters validation to
display the expected parameter name accurately.

* **Tests**
  * Added new test coverage for SQLite named parameters functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-11-17 23:04:13 +07:00
Daniel Osvaldo Rahmanto
f48bd04877
fix(ext/node): sqlite.DatabaseSync explicit resource management compatibility (#31311)
Allows
https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-sqlite-database-sync-dispose.js
to pass
2025-11-17 14:58:49 +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
Bartek Iwańczuk
7ada8d6589
feat: use Node.js timers by default (#31272)
This commit changes global `setTimeout` and `setInterval` APIs (along
their `clear*` counterparts) to use Node.js APIs instead of the Web
APIs.

For real world usage we expect no difference in code and behavior,
unless user relies on following checks:
```
const id = setTimeout(...);
if (typeof id === "number") {
  // ...
}
```
In which case the conditional should be changed to `if (id)`
2025-11-13 20:09:41 +01:00
David Sherret
54405bc450
feat(permissions): allow Deno.env.toObject() for partial env permission (#31267)
Allow calling `Deno.env.toObject()` or getting the entire `process.env`
when only having partial permissions.

For example, you can now do `--allow-env --deny-env=SOMETHING` and the
object will have all the env vars except `SOMETHING`

We discussed just never throwing here, but we think it would be a bad
idea because someone might get confused why their program isn't working
whereas now they get alerted about env permissions ("I set this
environment variable, but it's not working!").
2025-11-13 18:01:26 +00:00
Bartek Iwańczuk
4e144a8fbf
fix(ext/node): define process.versions.sqlite (#31277)
This will make Node.js compat tests for sqlite run (previously they were
skipped because the version was not defined).
2025-11-13 17:48:06 +00: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
Nathan Whitaker
c106a8dd31
feat(cli): filter out common internal frames that add noise, dim and grey internal frames in stack traces (#31247)
Before:
<img width="777" height="214" alt="Screenshot 2025-11-10 at 6 43 25 PM"
src="https://github.com/user-attachments/assets/64faf089-738f-4b01-a075-e0e898f6b4d8"
/>
After:
<img width="777" height="134" alt="Screenshot 2025-11-10 at 6 41 41 PM"
src="https://github.com/user-attachments/assets/4cf78714-5248-471f-8e73-7286f8e7b276"
/>
2025-11-12 07:40:40 -08: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
prempyla
5ed0646bc4
fix(node/crypto): respect authTagLength in createCipheriv for GCM cip… (#31253)
This PR fixes a bug in `node:crypto.createCipheriv` where the
`authTagLength` option was ignored for AES-GCM ciphers, resulting in a
fixed 16-byte authentication tag regardless of the specified value.

The fix ensures both encryption and decryption paths correctly honor
`authTagLength`, matching Node.js behavior.

Fixes #31102
2025-11-12 13:58:17 +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
snek
0d838faf17
fix(ext/napi): suppress deprecated Buffer warnings (#31245)
Some checks failed
ci / pre-build (push) Has been cancelled
ci / test debug windows-x86_64 (push) Has been cancelled
ci / test release windows-x86_64 (push) Has been cancelled
ci / test debug linux-aarch64 (push) Has been cancelled
ci / test release linux-aarch64 (push) Has been cancelled
ci / test debug macos-aarch64 (push) Has been cancelled
ci / test release macos-aarch64 (push) Has been cancelled
ci / bench release linux-x86_64 (push) Has been cancelled
ci / test debug linux-x86_64 (push) Has been cancelled
ci / test release linux-x86_64 (push) Has been cancelled
ci / test debug macos-x86_64 (push) Has been cancelled
ci / test release macos-x86_64 (push) Has been cancelled
ci / lint debug linux-x86_64 (push) Has been cancelled
ci / lint debug macos-x86_64 (push) Has been cancelled
ci / lint debug windows-x86_64 (push) Has been cancelled
ci / build libs (push) Has been cancelled
ci / publish canary (push) Has been cancelled
2025-11-11 15:02:29 +09: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
Bartek Iwańczuk
4d2b56911f
refactor: merge deno_broadcast_channel into deno_web (#31198)
This commit deprecated `deno_broadcast_channel` crate and merges it into
`deno_web`.

This will allow us to limit number of crates we need to publish and
(maybe) improve compile and link times.

The actual `ext/broadcast_channel` directory will be removed in a follow
up PR, once a new version is published and points to deno_web crate.
2025-11-06 08:36:16 +01:00