summaryrefslogtreecommitdiff
path: root/ext/node
AgeCommit message (Collapse)Author
2024-07-10fix(check): CJS types importing dual ESM/CJS package should prefer CJS types ↵David Sherret
(#24492) Closes #16370
2024-07-10fix(node/perf_hooks): stub eventLoopUtilization (#24501)Marvin Hagemeister
This PR stubs `perf_hooks.eventLoopUtilization` to make the tests of [hapi](https://github.com/hapijs/hapi) start. Previously, they'd all error because of this function throwing a not implemented error. This brings down the test failures in their suite from 982 to 68 failures.
2024-07-10fix(node/v8): stub serializer methods (#24502)Marvin Hagemeister
Stubbing a few of Node's `v8` serializer methods makes the `tap` test runner at least start. Previously, it would fail to boot up as some instances of `DefaultSerializer` are constructed eagerly :tada: Before: <img width="1041" alt="Screenshot 2024-07-10 at 16 41 30" src="https://github.com/denoland/deno/assets/1062408/58f1157f-cef8-4176-9239-9d724ca0a677"> After: <img width="830" alt="Screenshot 2024-07-10 at 16 39 35" src="https://github.com/denoland/deno/assets/1062408/710ef673-8120-405a-b9d3-a5ca826b4829"> Fixes https://github.com/denoland/deno/issues/24409
2024-07-10fix: Add sys permission kinds for node compat (#24242)Adam Gregory
Fixes #24241 * Support "statfs", "username", "getPriority" and "setPriority" kinds for `--allow-sys`. * Check individual permissions in `node:os.userInfo()` instead of a single "userInfo" permission. * Check for "uid" permission in `node:process.geteuid()` instead of "geteuid". * Add missing "homedir" to `SysPermissionDescriptor.kind` union Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-10fix(node/http): don't send destroyed requests (#24498)Marvin Hagemeister
Make sure that already destroyed requests are not actually sent. This error was discovered in jsdom's test suite.
2024-07-10fix(node/http): don't error if request destroyed before send (#24497)Marvin Hagemeister
A request can be destroyed before it was even made in the Node http API. We errored on that. This issue was discovered in the JSDOM test suite.
2024-07-10feat(node): Support executing npm package lifecycle scripts ↵Nathan Whitaker
(preinstall/install/postinstall) (#24487) Adds support for running npm package lifecycle scripts, opted into via a new `--allow-scripts` flag. With this PR, when running `deno cache` (or `DENO_FUTURE=1 deno install`) you can specify the `--allow-scripts=pkg1,pkg2` flag to run lifecycle scripts attached to the given packages. Note at the moment this only works when `nodeModulesDir` is true (using the local resolver). When a package with un-run lifecycle scripts is encountered, we emit a warning suggesting things may not work and to try running lifecycle scripts. Additionally, if a package script implicitly requires `node-gyp` and it's not found on the system, we emit a warning. Extra things in this PR: - Extracted out bits of `task.rs` into a separate module for reuse - Added a couple fields to `process.config` in order to support `node-gyp` (it relies on a few variables being there) - Drive by fix to downloading new npm packages to test registry --- TODO: - [x] validation for allow-scripts args (make sure it looks like an npm package) - [x] make allow-scripts matching smarter - [ ] figure out what issues this closes --- Review notes: - This adds a bunch of deps to our test registry due to using `node-gyp`, so it's pretty noisy
2024-07-09fix: do not return undefined for missing global properties (#24474)snek
accessing e.g. `Buffer` in `Mode::Deno` mode should throw, not return undefined. --------- Signed-off-by: snek <snek@deno.com>
2024-07-09refactor: use concrete error types for node resolution (#24470)David Sherret
This will help clean up some of the code in the CLI because we'll be able to tell how the resolution failed (not part of this PR).
2024-07-09fix(node/http): support all `.writeHead()` signatures (#24469)Marvin Hagemeister
Implement the missing `.writeHead()` signatures from Node's `ServerResponse` class that we didn't support. Fixes https://github.com/denoland/deno/issues/24468
2024-07-08fix(node/assert): throws not checking error instance (#24466)Marvin Hagemeister
The implementation for `assert.throws()` from `node:assert` didn't work when the expected value was an `Error` constructor. In this case the thrown error should checked if it's an instance of said constructor. Fixes https://github.com/denoland/deno/issues/24464
2024-07-05fix(node): Implement `fs.lchown` (and `process.getegid`) (#24418)Nathan Whitaker
Closes https://github.com/denoland/deno/issues/21260. Part of https://github.com/denoland/deno/issues/18218. Implements `node:fs.lchown`, and enables the node_compat test for it. The test uses `process.getegid`, which we didn't have implemented, so I went ahead and implemented that as well to get the test working.
2024-07-05chore: remove unused class private properties (#24441)Marvin Hagemeister
Noticed that these private class properties are never used. Maybe a leftover from an earlier implementation.
2024-07-05fix(ext/node): rewrite digest handling (#24392)Luca Casonato
Previously we had many different code paths all handling digests in different places, all with wildly different digest support. This commit rewrites this to use a single digest handling mechanism for all digest operations. It adds various aliases for digest algorithms, like node does. For example `sha1WithRSAEncryption` is an alias for `sha1`. It also adds support for `md5-sha1` digests in various places.
2024-07-05fix(ext/node): http chunked writes hangs (#24428)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/24239
2024-07-04fix: revert accidentally added `parentPath` on `DirEntry` (#24438)David Sherret
Reverts the accidentally added `.parentPath` on dir entries in https://github.com/denoland/deno/pull/24257/files This should not have been added to the public api and is not documented.
2024-07-04fix(node/http): don't throw on .address() before .listen() (#24432)Marvin Hagemeister
It's perfectly valid to access `server.address()` before calling `.listen()`. Until a server actively listens on a socket Node will return `null` here, but we threw a "Cannot access property 'port' of undefined" instead. This was discovered when inspecting failures in Koa's test suite with Deno.
2024-07-03fix(ext/node): don't wait for end() call to send http client request (#24390)Satya Rohith
Closes https://github.com/denoland/deno/issues/24232 Closes https://github.com/denoland/deno/issues/24215
2024-07-02fix(ext/node): Add `fs.lutimes` / `fs.lutimesSync` (#23172)Nathan Whitaker
Part of #18218 - Adds `fs.lutimes` and `fs.lutimesSync` to our node polyfills. To do this I added methods to the `FileSystem` trait + ops to expose the functionality to JS. - Exports `fs._toUnixTimestamp`. Node exposes an internal util `toUnixTimestamp` from the fs module to be used by unit tests (so we need it for the unit test to pass unmodified). It's weird because it's only supposed to be used internally but it's still publicly accessible - Matches up error handling and timestamp handling for fs.futimes and fs.utimes with node - Enables the node_compat utimes test - this exercises futimes, lutimes, and utimes.
2024-07-02chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24388)Bartek Iwańczuk
Reland of https://github.com/denoland/deno/pull/24056 that doesn't suffer from the problem that was discovered in https://github.com/denoland/deno/pull/24261. It uses upgraded `hyper` and `hyper-util` that fixed the previous problem in https://github.com/hyperium/hyper/pull/3691.
2024-07-01feat: upgrade deno_core (#24364)snek
- Symbol.asyncDispose no longer needs to be polyfilled - assorted updates for cppgc api changes
2024-07-02fix(ext/node): add Symbol.toStringTag to KeyObject instances (#24377)Filip Skokan
As per https://github.com/nodejs/node/pull/46043, this adds Symbol.toStringTag getter to KeyObject.
2024-06-27fix(ext/node): make next tick queue resilient to `Array.prototype` tampering ↵ud2
(#24361) Closes #24358.
2024-06-26refactor: move PackageJson to deno_config (#24348)David Sherret
2024-06-26perf(ext/node): improve `Buffer.from(buffer)` (#24352)ud2
Benchmark code from #24341. ```shellsession $ deno run --allow-hrtime bench.mjs 6479.111583 $ target/release/deno run --allow-hrtime bench.mjs 962.753875 $ node bench.mjs 855.174875 ```
2024-06-26Revert "perf: improve Buffer.from(buf) by 29x" (#24351)David Sherret
https://github.com/denoland/deno/pull/24341#discussion_r1655247367 Reverts denoland/deno#24341
2024-06-26perf: optimize Buffer.from("base64") for forgiving-base64 conforming input ↵Divy Srivastava
(#24346)
2024-06-26perf: improve Buffer.from(buf) by 29x (#24341)Divy Srivastava
2024-06-25fix(node): add missing readline/promises module (#24336)Bartek Iwańczuk
Fixes https://github.com/jsr-io/jsr-npm/issues/91
2024-06-25feat: add module.parent (#24333)snek
This field is deprecated but still used by the ecosystem, so let's just support it.
2024-06-25fix(ext/node): ignore stream error during enqueue (#24243)Satya Rohith
2024-06-24fix(ext/node): rewrite crypto.Hash (#24302)Luca Casonato
Changes in this PR: - Added new fixed size hash algorithms (blake2b512, blake2s256, sha512-224, sha512-256, sha3-224, sha3-256, sha3-384, sha3-512, sm3) - Added variable size hash algorithms (the concept), with the algorithms shake128 and shake256 - Use cppgc instead of resources for the hasher - Enable Node's crypto.Hash tests and fix found bugs
2024-06-24fix(ext/node): use primordials in `ext/node/polyfills/_fs/_fs_dir.ts` (#24319)Asher Gomez
Towards #24236 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com> Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-06-24fix(ext/node): use primordials in `ext/node/polyfills/_fs/_fs_cp.js` (#24320)Asher Gomez
Towards #24236
2024-06-24fix(ext/node): use primordials in `ext/node/polyfills/timers.ts` (#24311)Asher Gomez
Towards #24236
2024-06-24fix(ext/node): use primordials in `ext/node/polyfills/testing.ts` (#24310)Asher Gomez
Towards #24236
2024-06-23chore: use sha1 crate, not sha-1 (#24306)Luca Casonato
2024-06-21fix(ext/node): add ServerResponse#appendHeader (#24216)Divy Srivastava
2024-06-21Revert `#[cppgc] &mut T` usage (#24304)Divy Srivastava
2024-06-21fix(ext/node): don't panic on invalid utf-8 in pem (#24303)Luca Casonato
2024-06-21chore(ext/node): cleanup zlib state ops (#24300)Divy Srivastava
2024-06-21chore(ext/node): cleanup net blocklist ops (#24299)Divy Srivastava
2024-06-21fix(ext/node): use primordials in `ext/node/polyfills/string_decoder.ts` ↵Asher Gomez
(#24296)
2024-06-21fix: upgrade deno_core to 0.291.0 (#24297)Divy Srivastava
2024-06-20refactor(ext): remove use of `brotli::ffi` (#24214)ud2
2024-06-20fix(ext/node): use primordials in `ext/node/polyfills/_brotli.js` (#24235)Asher Gomez
Towards #24236
2024-06-20fix(ext/node): use primordials in `ext/node/polyfills/_process/` (#24282)Asher Gomez
2024-06-20fix(ext/node): use primordials in `ext/node/polyfills/_http_common.ts` (#24281)Asher Gomez
2024-06-20fix(ext/node): use cppgc for node:zlib (#24267)Divy Srivastava
2024-06-19fix: more node-api fixes (#24220)snek
- add fallback impls of external string apis which always copy. after upstream changes to rusty_v8 we can support non-copying api as well. - `napi_get_buffer_data` needs to work on all TypedArray instances. - Fixes: https://github.com/denoland/deno/issues/24209 - `target_defaults.default_configuration` is used by some modules to find the corresponding node file from node-gyp - `node_api_get_module_filename` expects the filename to be a `file:` url.