summaryrefslogtreecommitdiff
path: root/ext/node/polyfills
AgeCommit message (Collapse)Author
2024-08-23fix(ext/node): import JWK octet key pairs (#25180)Divy Srivastava
Ref https://github.com/denoland/deno/issues/24129 `kty: "okp"` is defined in [rfc8037](https://www.rfc-editor.org/rfc/rfc8037.html)
2024-08-22fix(ext/node): http2session ready state (#25143)Caleb Lloyd
Fixes #25142 Signed-off-by: Caleb Lloyd <caleblloyd@gmail.com>
2024-08-22fix(ext/node): register `node:wasi` built-in (#25134)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/23531
2024-08-21fix(ext/node): pass content-disposition header as string instead of bytes ↵Satya Rohith
(#25128) Closes https://github.com/denoland/deno/issues/25117
2024-08-20chore: enable no-console dlint rule (#25113)David Sherret
2024-08-20chore: Remove stray `console.error` log in `node:child_process` (#25111)Nathan Whitaker
Missed removing it before committing
2024-08-19fix(node/tty): fix `tty.WriteStream.hasColor` with different args (#25094)Marvin Hagemeister
The check in `tty.WriteStream.prototype.hasColors()` was incorrect leading to the [`yoctocolors`](https://github.com/sindresorhus/yoctocolors) package not printing any colors. Fixes https://github.com/denoland/deno/issues/24407
2024-08-18fix(node/http): wrong `req.url` value (#25081)Marvin Hagemeister
This PR addresses a regression introduced in https://github.com/denoland/deno/pull/25021 that would cause the `req.url` parameter in Node's http server to always be a single character instead of the expected value. The regression was caused by effectively calling `.indexOf()` on an empty string and thus passing the wrong index for slicing. ```js "".indexOf("/") // -> -1 request.url.slice(-1) // effectively only giving us the last character ``` Fixes https://github.com/denoland/deno/issues/25080
2024-08-16fix(node/fs): Use correct offset and length in node:fs.read and write (#25049)Nathan Whitaker
My fix in #25030 was buggy, I forgot to pass the `byteOffset` and `byteLength`. Whoops. I also discovered that fs.read was not respecting the `offset` argument, and we were constructing a new `Buffer` for the callback instead of just passing the original one (which is what node does, and the @types/node definitions also indicate the callback should get the same type). Fixes #25028.
2024-08-15fix(node): Create additional pipes for child processes (#25016)Nathan Whitaker
Linux/macos only currently. Part of https://github.com/denoland/deno/issues/23524 (fixes it on platforms other than windows). Part of #16899 (fixes it on platforms other than windows). After this PR, playwright is functional on mac/linux.
2024-08-14feat(ext/node): support http2session.socket (#24786)Sean McArthur
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-08-14fix(node/fs): node:fs.read and write should accept typed arrays other than ↵Nathan Whitaker
Uint8Array (#25030) Part of #25028. Our underlying read/write operations in `io` assume the buffer is a Uint8Array, but we were passing in other typed arrays (in the case above it was `Int8Array`).
2024-08-14fix(node/inspector): Session constructor should not throw (#25041)Marvin Hagemeister
There is no constructor code when creating an inspector `Session` instance in Node. Also get rid of some symbols which should've been private properties. This PR doesn't yet add any new implementations though as these are mostly cosmetic changes.
2024-08-14fix: `node:inspector` not being registered (#25007)Marvin Hagemeister
For some reason we didn't register the `node:inspector` module, which lead to a panic when trying to import it. This PR registers it. Related: https://github.com/denoland/deno/issues/25004
2024-08-14fix(ext/node): don't throw when calling PerformanceObserver.observe (#25036)Luca Casonato
2024-08-14fix: dd-trace http message compat (#25021)snek
make this http incoming constructor match with node, and also handle arbitrary duplex inputs
2024-08-12chore: update the copyright of c, mjs, and jsx (#25005)Kenta Moriuchi
2024-08-12fix(ext/node): don't concat set-cookie in ServerResponse.appendHeader (#25000)Luca Casonato
Follow-on to https://github.com/denoland/deno/pull/24216/files#r1642188672
2024-08-11fix(ext/node): rewrite X509Certificate resource and add `publicKey()` (#24988)Divy Srivastava
**Changes**: - Remove unsafe usage, rewrite Rust representation with `yoke`. - Implement `X509Certificate.prototype.publicKey()` Fixes https://github.com/denoland/deno/issues/23307
2024-08-11fix(ext/node): support ieee-p1363 ECDSA signatures and pss salt len (#24981)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/22919
2024-08-11fix(ext/node): createBrotliCompress params (#24984)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/24416
2024-08-09fix: stub `node:module.register()` (#24965)Marvin Hagemeister
This is commonly used to register loading non standard file types. But some libs also register TS loaders which Deno supports natively, like the npm `payload` package. This PR unblocks those. Fixes https://github.com/denoland/deno/issues/24902
2024-08-09fix(ext/node): ed25519 signing and cipheriv autopadding fixes (#24957)Luca Casonato
- Return auth tag for GCM ciphers from auto padding shortcircuit - Use _ring_ for ed25519 signing --------- Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-08-09chore: make node:http.OutgoingMessage a function (#24853)snek
For dd-trace tests to succeed, `OutgoingMessage` should be a function instead of a class.
2024-08-08fix(ext/node): add `CipherIv.setAutoPadding()` (#24940)Divy Srivastava
Co-Authored-By: Luca Casonato <hello@lcas.dev> Fixes https://github.com/denoland/deno/issues/21804 Ref https://github.com/denoland/deno/issues/20924 --------- Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com> Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-08-08fix(node/util): add missing `debug` alias of `debuglog` (#24944)Marvin Hagemeister
Add the missing `node:util.debug` export which is an alias of `node:util.debuglog`, see https://nodejs.org/api/util.html#utildebugsection
2024-08-08fix(ext/node): client closing streaming request shouldn't terminate http ↵Satya Rohith
server (#24946) Closes https://github.com/denoland/deno/issues/22820
2024-08-08fix(node/crypto): Assign publicKey and privateKey with let instead of const ↵Birk Skyum
(#24943) Because public/private key are reassigned, they should be `let` instead of `const`. Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-08-08fix(ext/node): add crypto.diffieHellman (#24938)Luca Casonato
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com> Closes #21806
2024-08-07fix: `rename` watch event missing (#24893)Marvin Hagemeister
This PR ensures that we forward a `rename` event in our file watcher. The rust lib we use combines that with the `modify` event. This fixes a compatibility issue with Node too, which sends the `rename` event as well. Fixes https://github.com/denoland/deno/issues/24880
2024-08-07feat(ext/node): rewrite crypto keys (#24463)Luca Casonato
This completely rewrites how we handle key material in ext/node. Changes in this PR: - **Signing** - RSA - RSA-PSS 🆕 - DSA 🆕 - EC - ED25519 🆕 - **Verifying** - RSA - RSA-PSS 🆕 - DSA 🆕 - EC 🆕 - ED25519 🆕 - **Private key import** - Passphrase encrypted private keys 🆕 - RSA - PEM - DER (PKCS#1) 🆕 - DER (PKCS#8) 🆕 - RSA-PSS - PEM - DER (PKCS#1) 🆕 - DER (PKCS#8) 🆕 - DSA 🆕 - EC - PEM - DER (SEC1) 🆕 - DER (PKCS#8) 🆕 - X25519 🆕 - ED25519 🆕 - DH - **Public key import** - RSA - PEM - DER (PKCS#1) 🆕 - DER (PKCS#8) 🆕 - RSA-PSS 🆕 - DSA 🆕 - EC 🆕 - X25519 🆕 - ED25519 🆕 - DH 🆕 - **Private key export** - RSA 🆕 - DSA 🆕 - EC 🆕 - X25519 🆕 - ED25519 🆕 - DH 🆕 - **Public key export** - RSA - DSA 🆕 - EC 🆕 - X25519 🆕 - ED25519 🆕 - DH 🆕 - **Key pair generation** - Overhauled, but supported APIs unchanged This PR adds a lot of new individual functionality. But most importantly because of the new key material representation, it is now trivial to add new algorithms (as shown by this PR). Now, when adding a new algorithm, it is also widely supported - for example previously we supported ED25519 key pair generation, but we could not import, export, sign or verify with ED25519. We can now do all of those things.
2024-08-06feat: vm rewrite (#24596)snek
rewrite vm implementation to increase compat. vm.Module+importModuleDynamically callbacks should be added in a followup.
2024-08-02Revert "feat: async context" (#24856)snek
Reverts denoland/deno#24402 deno_web can't depend on code in runtime
2024-08-02feat: async context (#24402)snek
We are switching to ContinuationPreservedEmbedderData. This allows adding async context tracking to the various async operations that deno provides. Fixes: https://github.com/denoland/deno/issues/7010 Fixes: https://github.com/denoland/deno/issues/22886 Fixes: https://github.com/denoland/deno/issues/24368
2024-08-02fix(ext/node): node:zlib coerces quality 10 to 9.5 (#24850)Bartek Iwańczuk
Fixes https://github.com/denoland/deno/issues/24572
2024-08-02Revert "perf(ext/node): improve `Buffer` from string performance" (#24851)Luca Casonato
2024-08-02docs: fix typos (#24820)Andreas Deininger
This PR fixes various typos I spotted in the project.
2024-08-01fix(ext/crypto): respect offsets when writing into ab views in ↵Luca Casonato
randomFillSync (#24816)
2024-07-31feat: upgrade V8 to 12.8 (#24693)snek
- upgrade to v8 12.8 - optimizes DataView bigint methods - fixes global interceptors - includes CPED methods for ALS - fix global resolution - makes global resolution consistent using host_defined_options. originally a separate patch but due to the global interceptor bug it needs to be included in this pr for all tests to pass.
2024-07-31fix(ext/node): handle node child_process with --v8-options flag (#24804)Luca Casonato
Makes `v8flags` package from NPM work.
2024-07-31fix(node/fs/promises): watch should be async iterable (#24805)Marvin Hagemeister
The way `fs.watch` works is different in `node:fs/promises` than `node:fs`. It has a different function signature and it returns an async iterable instead, see https://nodejs.org/api/fs.html#fspromiseswatchfilename-options Fixes https://github.com/denoland/deno/issues/24661
2024-07-31fix(node/timers/promises): add scheduler APIs (#24802)Marvin Hagemeister
This PR adds the experimental `scheduler` APIs in Node's `timers/promises` module. See https://nodejs.org/api/timers.html#timerspromisesschedulerwaitdelay-options Fixes https://github.com/denoland/deno/issues/24800
2024-07-30fix(node): Rework node:child_process IPC (#24763)Nathan Whitaker
Fixes https://github.com/denoland/deno/issues/24756. Fixes https://github.com/denoland/deno/issues/24796. This also gets vitest working when using [`--pool=forks`](https://vitest.dev/guide/improving-performance#pool) (which is the default as of vitest 2.0). Ref https://github.com/denoland/deno/issues/23882. --- This PR resolves a handful of issues with child_process IPC. In particular: - We didn't support sending typed array views over IPC - Opening an IPC channel resulted in the event loop never exiting - Sending a `null` over IPC would terminate the channel - There was some UB in the read implementation (transmuting an `&[u8]` to `&mut [u8]`) - The `send` method wasn't returning anything, so there was no way to signal backpressure (this also resulted in the benchmark `child_process_ipc.mjs` being misleading, as it tried to respect backpressure. That gave node much worse results at larger message sizes, and gave us much worse results at smaller message sizes). - We weren't setting up the `channel` property on the `process` global (or on the `ChildProcess` object), and also didn't have a way to ref/unref the channel - Calling `kill` multiple times (or disconnecting the channel, then calling kill) would throw an error - Node couldn't spawn a deno subprocess and communicate with it over IPC
2024-07-30perf(ext/node): improve `Buffer` from string performance (#24567)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/24323 - Use a Buffer pool for `fromString` - Implement fast call base64 writes - Direct from string `create` method for each encoding op ``` $ deno bench -A bench.mjs # 1.45.1+fee4d3a cpu: Apple M1 Pro runtime: deno 1.45.1+fee4d3a (aarch64-apple-darwin) benchmark time (avg) (min … max) p75 p99 p999 ----------------------------------------------------------- ----------------------------- Buffer.from base64 550 ns/iter (490 ns … 1'265 ns) 572 ns 606 ns 1'265 ns Buffer#write base64 285 ns/iter (259 ns … 371 ns) 307 ns 347 ns 360 ns $ ~/gh/deno/target/release/deno bench -A bench.mjs # this PR cpu: Apple M1 Pro runtime: deno dev (aarch64-apple-darwin) benchmark time (avg) (min … max) p75 p99 p999 ----------------------------------------------------------- ----------------------------- Buffer.from base64 151 ns/iter (145 ns … 770 ns) 148 ns 184 ns 648 ns Buffer#write base64 62.58 ns/iter (60.79 ns … 157 ns) 61.65 ns 75.79 ns 141 ns $ node bench.mjs # v22.4.0 cpu: Apple M1 Pro runtime: node v22.4.0 (arm64-darwin) benchmark time (avg) (min … max) p75 p99 p999 ----------------------------------------------------------- ----------------------------- Buffer.from base64 163 ns/iter (96.92 ns … 375 ns) 99.45 ns 127 ns 220 ns Buffer#write base64 75.48 ns/iter (74.97 ns … 134 ns) 75.17 ns 81.83 ns 96.84 ns ```
2024-07-30refactor(ext/node): create separate ops for node:http module (#24788)Bartek Iwańczuk
This commit duplicates ops from "ext/fetch" to "ext/node" to kick off a bigger rewrite of "node:http". Most of duplication is temporary and will be removed as these ops evolve.
2024-07-28fix: actually add missing `node:readline/promises` module (#24772)David Sherret
Closes #24768
2024-07-25fix(node/worker_threads): support `port.once()` (#24725)Marvin Hagemeister
Support `MessagePort.once` in Node mode and enable relevant `worker_threads` test. Noticed that another Node test was passing as well, so I enabled that too.
2024-07-24fix(ext/node/net): emit `error` before `close` when connection is refused ↵Yoshiya Hinosawa
(#24656)
2024-07-24fix(node): Run node compat tests listed in the `ignore` field (and fix the ↵Nathan Whitaker
ones that fail) (#24631) The intent is that those tests will be executed, but our check that the files are up to date won't overwrite the contents of the tests. This is useful when a test needs some manual edits to work. It turns out we weren't actually running them. --- This ended up turning into a couple of small bug fixes to get the tests passing: - We weren't canonicalizing the exec path properly (it sometimes still had `..` or `.` in it) - We weren't accepting strings in `process.exit` There was one failure I couldn't figure out quickly, so I disabled the test for now, and filed a follow up issue: #24694
2024-07-19fix: missing `emitWarning` import (#24587)Marvin Hagemeister
We were missing an import of `emitWarning` in our streams implementation. The code prior to this PR assumed that `process` would be available as a global. Fixes https://github.com/denoland/deno/issues/23709 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>