summaryrefslogtreecommitdiff
path: root/ext/node/polyfills
AgeCommit message (Collapse)Author
2024-01-02fix(ext/node): use node:process in _streams.mjs (#21755)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/21644 `next build` works: ``` ~/gh/deno/target/debug/deno run -A --unstable-byonm ./node_modules/.bin/next build Warning: Not implemented: process.on("rejectionHandled") ▲ Next.js 14.0.4 ✓ Creating an optimized production build ✓ Compiled successfully ✓ Linting and checking validity of types Collecting page data ..Warning: Not implemented: process.on("rejectionHandled") Warning: Not implemented: process.on("rejectionHandled") Warning: Not implemented: process.on("rejectionHandled") Warning: Not implemented: process.on("rejectionHandled") Warning: Not implemented: process.on("rejectionHandled") ✓ Collecting page data Generating static pages (0/5) [ ]Warning: Not implemented: process.on("rejectionHandled") Warning: Not implemented: process.on("rejectionHandled") Warning: Not implemented: process.on("rejectionHandled") Warning: Not implemented: process.on("rejectionHandled") Warning: Not implemented: process.on("rejectionHandled") ✓ Generating static pages (5/5) ✓ Collecting build traces ✓ Finalizing page optimization Route (app) Size First Load JS ┌ ○ / 5.32 kB 87.4 kB └ ○ /_not-found 875 B 83 kB + First Load JS shared by all 82.1 kB ├ chunks/938-5e061ba0d46125b1.js 26.8 kB ├ chunks/fd9d1056-735d320b4b8745cb.js 53.5 kB ├ chunks/main-app-2945f337109ea73c.js 220 B └ chunks/webpack-e3c6517d4ab8d680.js 1.68 kB ○ (Static) prerendered as static content ```
2024-01-02fix(ext/node): implement os.machine (#21751)Divy Srivastava
2024-01-02fix(ext/node): querystring stringify without encode callback (#21740)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/21734 Changes: - Use default encode when options do not provide a encode callback. - Remove internal TS for `node:querystring`. Its not helping catching bugs like this because of invalid type assumptions and use of `any`, more of a maintenance burden.
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-31fix(node/zlib): consistently return buffer (#21747)Jovi De Croock
This fixes point 3 of https://github.com/denoland/deno/issues/20516 This PR creates consistency between the sync and async versions of the brotli compress where we will always return a buffer like Node.
2023-12-31fix(node/zlib): cast Dataview and Buffer to uint8 (#21746)Jovi De Croock
This fixes point 2 of #20516 This adds a conversion from Dataview/Buffer by returning `obj.buffer` which can be converted to a `UInt8Array`. Question: Regarding point 4 of the mentioned issue would it be appropriate to copy the toU8 helper to the `zlib.mjs` methods?
2023-12-30fix(ext/node): add process.abort() (#21742)Divy Srivastava
2023-12-30chore(runtime): internalize pipe fd for ext/node (#21570)Divy Srivastava
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-12-29fix(node): support nested tests in "node:test" (#21717)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/21679
2023-12-28chore: update deno_core to 0.240.0 (#21726)Bartek Iwańczuk
2023-12-28fix(node): Implement os.cpus() (#21697)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/21666 Zero added dependency and tries to match the libuv implementation
2023-12-27perf: remove opAsync (#21690)Matt Mastracci
`opAsync` requires a lookup by name on each async call. This is a mechanical translation of all opAsync calls to ensureFastOps. The `opAsync` API on Deno.core will be removed at a later time.
2023-12-25fix(ext/node): add ClientRequest#setNoDelay (#21694)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/18316
2023-12-20fix(node): child_process kill cancel pending IPC reads (#21647)Divy Srivastava
2023-12-20fix(node): add crypto.pseudoRandomBytes (#21649)Divy Srivastava
2023-12-19fix(node): child_process IPC on Windows (#21597)Divy Srivastava
This PR implements the child_process IPC pipe between parent and child. The implementation uses Windows named pipes created by parent and passes the inheritable file handle to the child. I've also replace parts of the initial implementation which passed the raw parent fd to JS with resource ids instead. This way no file handle is exposed to the JS land (both parent and child). `IpcJsonStreamResource` can stream upto 800MB/s of JSON data on Win 11 AMD Ryzen 7 16GB (without `memchr` vectorization)
2023-12-19fix(console): inspect for `{Set,Map}Iterator` and `Weak{Set,Map}` (#21554)Kenta Moriuchi
2023-12-15refactor: setup child process pipe in Rust (#21579)Divy Srivastava
Avoid passing the fd into JS and back into Rust. Instead we setup the child's end of the pipe directly using a special Rust op.
2023-12-14chore(node): remove process.on("disconnect") not implemented warning (#21569)Divy Srivastava
2023-12-14fix(node): return false from vm.isContext (#21568)Divy Srivastava
https://github.com/denoland/deno/issues/20851#issuecomment-1779226106 for `jsdom`
2023-12-13fix(zlib): handle no flush flag in handle_.write (#21432)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/21096
2023-12-13fix: implement child_process IPC (#21490)Divy Srivastava
This PR implements the Node child_process IPC functionality in Deno on Unix systems. For `fd > 2` a duplex unix pipe is set up between the parent and child processes. Currently implements data passing via the channel in the JSON serialization format.
2023-12-11fix(ext/node): basic vm.runInNewContext implementation (#21527)Divy Srivastava
Simple implementation to support webpack (& Next.js): https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/javascript/JavascriptParser.js#L4329
2023-12-11fix(ext/node): ServerResponse getHeader() return undefined (#21525)Divy Srivastava
Matches Node's return type. Next.js check for `if (header === undefined)`: https://github.com/vercel/next.js/blob/e02fe314dcd0ae614c65b505c6daafbdeebb920e/packages/next/src/server/base-http/node.ts#L93
2023-12-11fix(ext/node): stub ServerResponse#flushHeaders (#21526)Divy Srivastava
This commit adds a no-op flushHeaders method to the ServerResponse object. It is a nop because the ServerResponse implementation is based on top of the Deno server API instead of the Node `OutgoingMessage` base. Fixes #21509
2023-12-08fix(ext/node): use primordials in ext/node/polyfills/_util (#21444)Kenta Moriuchi
2023-12-08fix(ext/node): allow null value for req.setHeader (#21391)Yoshiya Hinosawa
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-12-08fix(node/tls): fix NotValidForName for host set via socket / servername (#21441)Max Goodhart
This PR is an attempt to fix https://github.com/denoland/deno/issues/20293, in which node modules connecting to databases fail due to TLS errors. I ran into this attempting to use [node-postgres](https://github.com/brianc/node-postgres) to connect to a [Neon](https://neon.tech) database. Investigating via `--inspect-brk` led me to notice that the hostname eventually passed to `Deno.startTls` was null. The hostname is determined by the following code: https://github.com/denoland/deno/blob/f6b889b43219e3c9be770c8b2758bff3048ddcbd/ext/node/polyfills/_tls_wrap.ts#L87-L89 This logic doesn't appear to be correct. I couldn't find reference to `servername` existing on the `secureContext` in either Node's or Deno's docs. There's a lot of scope here, and it's my first time reading through this code, so I could be missing something! Node uses [the following logic](https://github.com/nodejs/node/blob/2e458d973638d01fcb6a0d7d611e0120a94f4d35/lib/_tls_wrap.js#L1679-L1682 ) to determine the hostname for certificate validation: ``` const hostname = options.servername || options.host || (options.socket && options.socket._host) || 'localhost'; ``` This PR updates the `TLSSocket` polyfill to use behave similarly (though I omitted the default to `localhost` at the end; I'm not sure if including it is necessary or correct). With this change, `node-postgres` connects to my TLS endpoint successfully (aside: Neon requires SNI, which also works as expected). --- I tried to update the tests in https://github.com/denoland/deno/blob/main/cli/tests/unit_node/tls_test.ts to exercise this change, but the test fails for me on `main` on Linux. I investigated briefly and noticed that the test fixture `cli/tests/testdata/tls/localhost.crt` doesn't appear to include the `subjectAltName` specified in `domains.txt`. I believe the certificate isn't matching `localhost`, but that's where I ended investigating.
2023-12-07refactor: pull 'core', 'internals', 'primordials' from ES module (#21462)Bartek Iwańczuk
This commit refactors how we access "core", "internals" and "primordials" objects coming from `deno_core`, in our internal JavaScript code. Instead of capturing them from "globalThis.__bootstrap" namespace, we import them from recently added "ext:core/mod.js" file.
2023-12-04perf(node/fs): faster `existsSync` when not exists (#21458)David Sherret
2023-12-03fix(ext/node): sign with PEM private keys (#21287)Divy Srivastava
Add support for signing with a RSA PEM private key: `pkcs8` and `pkcs1`. Fixes https://github.com/denoland/deno/issues/18972 Ref #21124 Verified fix with `npm:sshpk`. Unverfied but fixes `npm:google-auth-library`, `npm:web-push` & `oracle/oci-typescript-sdk` --------- Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-12-02fix(node): setting process.exitCode should change exit code of process (#21429)David Sherret
2023-12-02chore: update std to 0.208.0 (#21318)Asher Gomez
Re-attempt at #21284. I was more thorough this time. --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2023-12-01refactor: use resourceForReadableStream for fetch (#20217)Matt Mastracci
Switch `ext/fetch` over to `resourceForReadableStream` to simplify and unify implementation with `ext/serve`. This allows us to work in Rust with resources only. Two additional changes made to `resourceForReadableStream` were required: - Add an optional length to `resourceForReadableStream` which translates to `size_hint` - Fix a bug where writing to a closed stream that was full would panic
2023-12-01fix(ext/node): add stubbed process.report (#21373)Daniel Mizerski
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-11-30fix(ext/node): fix os.freemem (#21347)Yoshiya Hinosawa
2023-11-29fix(ext/node): add util.parseArgs (#21342)Yoshiya Hinosawa
2023-11-28Reland "fix(ext/console): fix inspecting iterators error. (#20720)" (#21370)Leo Kettmeir
2023-11-28fix(ext/node): fix Buffer.copy when sourceStart > source.length (#21345)Yoshiya Hinosawa
2023-11-28fix(ext/node): fix duplexify compatibility (#21346)Yoshiya Hinosawa
2023-11-27fix(node): `spawnSync`'s `status` was incorrect (#21359)David Sherret
The exit code wasn't hooked up properly.
2023-11-23fix(ext/node): fix node:stream.Writable (#21297)Yoshiya Hinosawa
This change applies the same fix as https://github.com/nodejs/node/pull/46818, and the original example given in #20456 works as expected. closes #20456
2023-11-22refactor: replace `deferred()` from `std/async` with ↵Asher Gomez
`Promise.withResolvers()` (#21234) Closes #21041 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2023-11-14fix(ext/node): add APIs perf_hook.performance (#21192)Bartek Iwańczuk
Required for Next.js.
2023-11-13Revert "fix(ext/console): fix inspecting iterators error. (#20720)" (#21191)Bartek Iwańczuk
This reverts commit 0209f7b46954d1b7bf923b4191e5a356ec09622c. Reverting because it causes failures on `main`: https://github.com/denoland/deno/pull/20720#issuecomment-1809166755
2023-11-13fix(ext/console): fix inspecting iterators error. (#20720)Chen Su
Fixes #19776 and #20676.
2023-11-11fix(node/http): export globalAgent (#21081)Jacob Hummer
Fixes #21080 Fixes #18312 --------- Signed-off-by: Jacob Hummer <jcbhmr@outlook.com>
2023-11-10fix(ext/node): implement process.geteuid (#21151)Divy Srivastava
Fixes #21097
2023-11-10fix(node/child_process): properly normalize stdio for 'spawnSync' (#21103)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/20782
2023-11-09perf: remove knowledge of promise IDs from deno (#21132)Matt Mastracci
We can move all promise ID knowledge to deno_core, allowing us to better experiment with promise implementation in deno_core. `{un,}refOpPromise(promise)` is equivalent to `{un,}refOp(promise[promiseIdSymbol])`