summaryrefslogtreecommitdiff
path: root/ext/node
AgeCommit message (Collapse)Author
2024-10-16fix: don't warn on ignored signals on windows (#26332)Nathan Whitaker
Closes #26183. The warnings are super noisy and not actionable for the user
2024-10-17fix(node/http): normalize header names in `ServerResponse` (#26339)Nathan Whitaker
Fixes https://github.com/denoland/deno/issues/26115. We weren't normalizing the headers to lower case, so code that attempted to delete the `Content-Length` header (but used a different case) wasn't actually removing the header.
2024-10-16chore: forward v2.0.1 release commit to main (#26338)denobot
This is the release commit being forwarded back to main for 2.0.1 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-16fix(child_process): map node `--no-warnings` flag to `--quiet` (#26288)Nathan Whitaker
Closes https://github.com/denoland/deno/issues/25899
2024-10-16fix(ext/node): fix dns.lookup result ordering (#26264)Yoshiya Hinosawa
partially unblocks #25470 This PR aligns the resolution of `localhost` hostname to Node.js behavior. In Node.js `dns.lookup("localhost", (_, addr) => console.log(addr))` prints ipv6 address `::1`, but it prints ipv4 address `127.0.0.1` in Deno. That difference causes some errors in the work of enabling `createConnection` option in `http.request` (#25470). This PR fixes the issue by aligning `dns.lookup` behavior to Node.js. This PR also changes the following behaviors (resolving TODOs): - `http.createServer` now listens on ipv6 address `[::]` by default on linux/mac - `net.createServer` now listens on ipv6 address `[::]` by default on linux/mac These changes are also alignments to Node.js behaviors.
2024-10-16fix(ext/node): timingSafeEqual account for AB byteOffset (#26292)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/26276
2024-10-15fix(ext/node): use primordials in `ext/node/polyfills/internal/buffer.mjs` ↵Kenta Moriuchi
(#24993) Towards #24236
2024-10-15fix(ext/node): handle http2 server ending stream (#26235)Toby Ealden
Closes #24845
2024-10-15fix(ext/node): implement TCP.setNoDelay (#26263)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/26177 The significant delay was caused by Nagel's algorithm + delayed ACKs in Linux kernels. Here's the [kernel patch](https://lwn.net/Articles/502585/) which added 40ms `tcp_default_delack_min` ``` $ deno run -A pg-bench.mjs # main Tue Oct 15 2024 12:27:22 GMT+0530 (India Standard Time): 42ms $ target/release/deno run -A pg-bench.mjs # this patch Tue Oct 15 2024 12:28:02 GMT+0530 (India Standard Time): 1ms ``` ```js import { Buffer } from "node:buffer"; import pg from 'pg' const { Client } = pg const client = new Client({ connectionString: 'postgresql://postgres:postgres@127.0.0.1:5432/postgres' }) await client.connect() async function fetch() { const startPerf = performance.now(); const res = await client.query(`select $1::int as int, $2 as string, $3::timestamp with time zone as timestamp, $4 as null, $5::bool as boolean, $6::bytea as bytea, $7::jsonb as json `, [ 1337, 'wat', new Date().toISOString(), null, false, Buffer.from('awesome'), JSON.stringify([{ some: 'json' }, { array: 'object' }]) ]) console.log(`${new Date()}: ${Math.round(performance.now() - startPerf)}ms`) } for(;;) await fetch(); ```
2024-10-14perf: use fast calls for microtask ops (#26236)Divy Srivastava
Updates deno_core to 0.312.0
2024-10-14fix(ext/node): compute pem length (upper bound) for key exports (#26231)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/26188
2024-10-14fix(ext/node): allow writing to tty columns (#26201)Divy Srivastava
Behave similar to Node.js where modifying `stdout.columns` doesn't really resize the terminal. Ref https://github.com/nodejs/node/issues/17529 Fixes https://github.com/denoland/deno/issues/26196
2024-10-12fix(node/util): export `styleText` from `node:util` (#26194)Nathan Whitaker
Fixes #26184. It was added but not publicly exported.
2024-10-11fix(node): make `process.stdout.isTTY` writable (#26130)Marvin Hagemeister
Fixes https://github.com/denoland/deno/issues/26123
2024-10-082.0.0 (#26063)denobot
Bumped versions for 2.0.0 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-08fix(ext/node): internal buffer length in readSync (#26064)Satya Rohith
Closes https://github.com/denoland/deno/issues/26054
2024-10-04refactor: improve node permission checks (#26028)David Sherret
Does less work when requesting permissions with `-A`
2024-10-04fix(node): fix worker_threads issues blocking Angular support (#26024)Nathan Whitaker
Fixes #22995. Fixes #23000. There were a handful of bugs here causing the hang (each with a corresponding minimized test): - We were canceling recv futures when `receiveMessageOnPort` was called, but this caused the "receive loop" in the message port to exit. This was due to the fact that `CancelHandle`s are never reset (i.e., once you `cancel` a `CancelHandle`, it remains cancelled). That meant that after `receieveMessageOnPort` was called, the subsequent calls to `op_message_port_recv_message` would throw `Interrupted` exceptions, and we would exit the loop. The cancellation, however, isn't actually necessary. `op_message_port_recv_message` only borrows the underlying port for long enough to poll the receiver, so the borrow there could never overlap with `op_message_port_recv_message_sync`. - Calling `MessagePort.unref()` caused the "receive loop" in the message port to exit. This was because we were setting `messageEventListenerCount` to 0 on unref. Not only does that break the counter when multiple `MessagePort`s are present in the same thread, but we also exited the "receive loop" whenever the listener count was 0. I assume this was to prevent the recv promise from keeping the event loop open. Instead of this, I chose to just unref the recv promise as needed to control the event loop. - The last bug causing the hang (which was a doozy to debug) ended up being an unfortunate interaction between how we implement our messageport "receive loop" and a pattern found in `npm:piscina` (which angular uses). The gist of it is that piscina uses an atomic wait loop along with `receiveMessageOnPort` in its worker threads, and as the worker is getting started, the following incredibly convoluted series of events occurs: 1. Parent sends a MessagePort `p` to worker 2. Parent sends a message `m` to the port `p` 3. Parent notifies the worker with `Atomics.notify` that a new message is available 4. Worker receives message, adds "message" listener to port `p` 5. Adding the listener triggers `MessagePort.start()` on `p` 6. Receive loop in MessagePort.start receives the message `m`, but then hits an await point and yields (before dispatching the "message" event) 7. Worker continues execution, starts the atomic wait loop, and immediately receives the existing notification from the parent that a message is available 8. Worker attempts to receive the new message `m` with `receiveMessageOnPort`, but this returns `undefined` because the receive loop already took the message in 6 9. Atomic wait loop continues to next iteration, waiting for the next message with `Atomic.wait` 10. `Atomic.wait` blocks the worker thread, which prevents the receive loop from continuing and dispatching the "message" event for the received message 11. The parent waits for the worker to respond to the first message, and waits 12. The thread can't make any more progress, and the whole process hangs The fix I've chosen here (which I don't particularly love, but it works) is to just delay the `MessagePort.start` call until the end of the event loop turn, so that the atomic wait loop receives the message first. This prevents the hang. --- Those were the main issues causing the hang. There ended up being a few other small bugs as well, namely `exit` being emitted multiple times, and not patching up the message port when it's received by `receiveMessageOnPort`.
2024-10-02chore: release deno_* crates (#25987)denobot
Testing once again if the crates are being properly released. --------- Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-02chore: release deno_* crates (#25976)denobot
Test run before Deno 2.0 release to make sure that the publishing process passes correctly. --------- Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-02feat(ext/node): buffer.transcode() (#25972)Satya Rohith
Closes https://github.com/denoland/deno/issues/25911
2024-10-02fix(ext/node): remove unimplemented promiseHook stubs (#25979)Divy Srivastava
`temporalio` sdk [will try to use](https://github.com/temporalio/sdk-typescript/blob/faa64225a7f57154931a38c1fe612fc6520943b2/packages/worker/src/workflow/vm-shared.ts#L199-L202) promiseHook if it is found. This patch removes the unimplemented stubs. ```ts if (promiseHooks) { // Node >=16.14 only this.stopPromiseHook = promiseHooks.createHook({ init: (promise: Promise<unknown>, parent: Promise<unknown>) => { ``` Fixes https://github.com/denoland/deno/issues/25977
2024-09-28refactor: use deno_path_util (#25918)David Sherret
2024-09-27fix(node): Pass NPM_PROCESS_STATE to subprocesses via temp file instead of ↵Nathan Whitaker
env var (#25896) Fixes https://github.com/denoland/deno/issues/25401. Fixes https://github.com/denoland/deno/issues/25841. Fixes https://github.com/denoland/deno/issues/25891.
2024-09-27chore: update `simd-json` (#25897)Asher Gomez
2024-09-26fix(ext/node): fix process.stdin.pause() (#25864)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/25844
2024-09-24fix(ext/node): Fix vm sandbox object panic (#24985)Divy Srivastava
2024-09-23feat(ext/crypto): import and export p521 keys (#25789)Divy Srivastava
Towards https://github.com/denoland/deno/issues/13449
2024-09-23fix(ext/node): stub cpu_info() for OpenBSD (#25807)Volker Schlecht
Add an implementation of cpu_info() for OpenBSD, that returns a correctly-sized array. Since Rust's libc bindings for OpenBSD do not contain all symbols necessary for a full implementation and it is not planned to add them, this solution at least avoids problems with code that relies on cpu_info() purely for the size of the returned array to derive the number of available CPUs. This addresses https://github.com/denoland/deno/issues/25621
2024-09-20chore: Revert child_process close ordering change (#25781)Nathan Whitaker
From https://github.com/denoland/deno/commit/18b89d948dcb849c4dc577478794c3d5fb23b59 May have caused the recent flakiness of parallel/test-child-process-ipc-next-tick.js
2024-09-19fix: cjs resolution cases (#25739)snek
Fixes cjs modules being loaded as esm.
2024-09-19fix(ext/node): support x509 certificates in `createPublicKey` (#25731)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/25681
2024-09-19fix(ext/node): don't throw error for unsupported signal binding on windows ↵Yoshiya Hinosawa
(#25699)
2024-09-18feat(ext/node): add rootCertificates to node:tls (#25707)Luca Casonato
Closes https://github.com/denoland/deno/issues/25604 Signed-off-by: Satya Rohith <me@satyarohith.com> Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-09-18Revert "feat(fmt): sort type-only named import/exports last" (#25705)David Sherret
Reverts #25690 This was not an issue with the ts compiler anymore. Discussion here: https://github.com/dprint/dprint-plugin-typescript/pull/664#issuecomment-2357000053
2024-09-17fix(ext/node): stub `inspector/promises` (#25635)Divy Srivastava
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-09-17feat(fmt): sort type-only named import/exports last (#25690)David Sherret
Closes #22583
2024-09-16refactor(permissions): split up Descriptor into Allow, Deny, and Query (#25508)David Sherret
This makes the permission system more versatile.
2024-09-16fix(ext/crypto): support md4 digest algorithm (#25656)Luca Casonato
Fixes #25646
2024-09-15fix(ext/node): add `vm.constants` (#25630)Divy Srivastava
2024-09-15fix(ext/node): export `process.allowedNodeEnvironmentFlags` (#25629)Divy Srivastava
2024-09-15fix(ext/node): add stubs for `node:trace_events` (#25628)Divy Srivastava
2024-09-13fix(ext/node): attach console stream properties (#25617)snek
`kBindStreamsLazy` should be called with `process` during init, but it never was.
2024-09-13fix(ext/node): use primordials in ext/node/polyfills/wasi.ts (#25608)Jake Abed
Toward #24236
2024-09-12feat(ext/node): export 'promises' symbol from 'node:timers' (#25589)Bartek Iwańczuk
2024-09-12fix(ext/node): Implement detached option in `child_process` (#25218)Nathan Whitaker
Fixes https://github.com/denoland/deno/issues/25193.
2024-09-13fix(ext/node): fix Decipheriv when autoPadding disabled (#25598)Yoshiya Hinosawa
This change fixes Decipheriv behavior when autoPadding disabled and enabled. By this change, the example given in https://github.com/denoland/deno/issues/20924#issuecomment-2345931295 works in the same way as Node. closes #20924
2024-09-12fix(ext/node): export request and response clases from `http2` module (#25592)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/20612 Closes https://github.com/denoland/deno/issues/23326 This makes `qwik` work.
2024-09-12feat(ext/node): expose ES modules for _ modules (#25588)Bartek Iwańczuk
Exposes following modules: - `"node:_http_agent"` - `"node:_http_common"` - `"node:_http_outgoing"` - `"node:_http_server"` - `"node:_stream_duplex"` - `"node:_stream_passthrough"` - `"node:_stream_readable"` - `"node:_stream_transform"` - `"node:_stream_writable"` - `"node:_tls_common"` - `"node:_tls_wrap"`
2024-09-12feat(ext/node): export missing symbols from domain, puncode, repl, tls (#25585)Bartek Iwańczuk