1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
Commit graph

882 commits

Author SHA1 Message Date
Marvin Hagemeister
28d2ff7bdc
chore: remove unused class private properties (#24441)
Noticed that these private class properties are never used. Maybe a
leftover from an earlier implementation.
2024-07-05 16:27:06 +02:00
Luca Casonato
08e5606c34
fix(ext/node): rewrite digest handling (#24392)
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-05 10:10:22 +02:00
Divy Srivastava
b290fd01f3
fix(ext/node): http chunked writes hangs (#24428)
Fixes https://github.com/denoland/deno/issues/24239
2024-07-05 08:49:42 +05:30
David Sherret
d91215d418
fix: revert accidentally added parentPath on DirEntry (#24438)
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-04 20:58:30 -04:00
Marvin Hagemeister
96b527b8df
fix(node/http): don't throw on .address() before .listen() (#24432)
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-04 18:28:48 +02:00
Satya Rohith
496ea5903b
fix(ext/node): don't wait for end() call to send http client request (#24390)
Closes https://github.com/denoland/deno/issues/24232
Closes https://github.com/denoland/deno/issues/24215
2024-07-03 19:00:39 +05:30
Nathan Whitaker
dadc606419
fix(ext/node): Add fs.lutimes / fs.lutimesSync (#23172)
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-02 19:33:32 -07:00
Bartek Iwańczuk
8db420d552
chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24388)
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-02 02:09:47 +02:00
snek
a555cb4d1d
feat: upgrade deno_core (#24364)
- Symbol.asyncDispose no longer needs to be polyfilled
- assorted updates for cppgc api changes
2024-07-01 15:48:52 -07:00
Filip Skokan
740c6a0998
fix(ext/node): add Symbol.toStringTag to KeyObject instances (#24377)
As per https://github.com/nodejs/node/pull/46043, this adds
Symbol.toStringTag getter to KeyObject.
2024-07-02 00:36:22 +02:00
ud2
8d14a9db2f
fix(ext/node): make next tick queue resilient to Array.prototype tampering (#24361)
Closes #24358.
2024-06-27 21:45:46 +00:00
David Sherret
0da01c0ca6
refactor: move PackageJson to deno_config (#24348) 2024-06-26 21:24:10 +00:00
ud2
86e0292733
perf(ext/node): improve Buffer.from(buffer) (#24352)
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-26 17:11:56 -04:00
David Sherret
77ba0019e7
Revert "perf: improve Buffer.from(buf) by 29x" (#24351)
https://github.com/denoland/deno/pull/24341#discussion_r1655247367

Reverts denoland/deno#24341
2024-06-26 16:23:09 -04:00
Divy Srivastava
2549e5154c
perf: optimize Buffer.from("base64") for forgiving-base64 conforming input (#24346) 2024-06-26 06:24:58 -07:00
Divy Srivastava
6da87450ed
perf: improve Buffer.from(buf) by 29x (#24341) 2024-06-26 06:24:48 -07:00
Bartek Iwańczuk
09cc473f3b
fix(node): add missing readline/promises module (#24336)
Fixes https://github.com/jsr-io/jsr-npm/issues/91
2024-06-25 19:15:54 -04:00
snek
700cd200c1
feat: add module.parent (#24333)
This field is deprecated but still used by the ecosystem, so let's just
support it.
2024-06-25 11:17:35 -07:00
Satya Rohith
13aa1d70e9
fix(ext/node): ignore stream error during enqueue (#24243) 2024-06-25 17:02:40 +05:30
Luca Casonato
1e8a6b94b1
fix(ext/node): rewrite crypto.Hash (#24302)
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-24 11:47:12 +02:00
Asher Gomez
ff53506107
fix(ext/node): use primordials in ext/node/polyfills/_fs/_fs_dir.ts (#24319)
Towards #24236

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-06-24 06:22:55 +00:00
Asher Gomez
0833a1617c
fix(ext/node): use primordials in ext/node/polyfills/_fs/_fs_cp.js (#24320)
Towards #24236
2024-06-24 16:17:26 +10:00
Asher Gomez
dc4a88b7a6
fix(ext/node): use primordials in ext/node/polyfills/timers.ts (#24311)
Towards #24236
2024-06-24 15:50:02 +10:00
Asher Gomez
1c7ae83ca1
fix(ext/node): use primordials in ext/node/polyfills/testing.ts (#24310)
Towards #24236
2024-06-24 15:49:32 +10:00
Luca Casonato
973d186e8f
chore: use sha1 crate, not sha-1 (#24306) 2024-06-23 16:39:14 +02:00
Divy Srivastava
416df1e895
fix(ext/node): add ServerResponse#appendHeader (#24216) 2024-06-21 19:21:59 +05:30
Divy Srivastava
fc197a7ac0
Revert #[cppgc] &mut T usage (#24304) 2024-06-21 16:12:44 +05:30
Luca Casonato
e6756c3e66
fix(ext/node): don't panic on invalid utf-8 in pem (#24303) 2024-06-21 10:25:07 +00:00
Divy Srivastava
5683ca4070
chore(ext/node): cleanup zlib state ops (#24300) 2024-06-21 13:11:52 +05:30
Divy Srivastava
496428b82e
chore(ext/node): cleanup net blocklist ops (#24299) 2024-06-21 06:10:01 +00:00
Asher Gomez
9168078669
fix(ext/node): use primordials in ext/node/polyfills/string_decoder.ts (#24296) 2024-06-21 15:52:20 +10:00
Divy Srivastava
b4939f3379
fix: upgrade deno_core to 0.291.0 (#24297) 2024-06-21 10:49:39 +05:30
ud2
88e3f465d3
refactor(ext): remove use of brotli::ffi (#24214) 2024-06-20 20:44:24 +05:30
Asher Gomez
6ab143335a
fix(ext/node): use primordials in ext/node/polyfills/_brotli.js (#24235)
Towards #24236
2024-06-20 17:44:23 +10:00
Asher Gomez
510db0a86e
fix(ext/node): use primordials in ext/node/polyfills/_process/ (#24282) 2024-06-20 17:26:34 +10:00
Asher Gomez
28ee0a5bdd
fix(ext/node): use primordials in ext/node/polyfills/_http_common.ts (#24281) 2024-06-20 17:26:14 +10:00
Divy Srivastava
0b65d027a1
fix(ext/node): use cppgc for node:zlib (#24267) 2024-06-20 10:31:53 +05:30
snek
293a36f98d
fix: more node-api fixes (#24220)
- 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.
2024-06-19 11:33:46 -07:00
denobot
6c6ee02dfd
chore: forward v1.44.4 release commit to main (#24271)
This is the release commit being forwarded back to main for 1.44.4

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-06-19 20:29:53 +02:00
Bartek Iwańczuk
b94707af7d
Revert "chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24056)" (#24262)
This reverts commit fb31eaa9ca.

Reverting because users reported spurious errors when downloading
dependencies - https://github.com/denoland/deno/issues/24260.

Closes https://github.com/denoland/deno/issues/24260
2024-06-19 16:09:17 +02:00
Asher Gomez
f4eead61eb
fix(ext/node): use primordials in ext/node/polyfills/_utils.ts (#24253) 2024-06-19 18:29:26 +10:00
Divy Srivastava
209b286813
fix(ext/node): Add Dirent.path and Dirent.parentPath (#24257) 2024-06-19 12:51:01 +05:30
denobot
1d6b775f81
chore: forward v1.44.3 release commit to main (#24256)
This is the release commit being forwarded back to main for 1.44.3

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-06-19 03:17:32 +02:00
David Sherret
cba212b9c6
perf(node): ensure cjs wrapper module has deterministic output (#24248) 2024-06-18 17:24:18 -04:00
Divy Srivastava
10ac3bb091
fix(ext/node): make process.versions own property (#24240) 2024-06-18 16:33:03 +05:30
Satya Rohith
8c4b33db0d
feat(ext/node): add BlockList & SocketAddress classes (#24229)
Closes https://github.com/denoland/deno/issues/24059
2024-06-18 10:46:13 +00:00
Bartek Iwańczuk
78b12a43b3
fix(ext/node): better support for node:diagnostics_channel module (#24088)
Closes https://github.com/denoland/deno/issues/24060
2024-06-15 00:07:02 +02:00
Satya Rohith
0f48313565
chore: upgrade to rust 1.79 (#24207) 2024-06-14 17:10:57 +05:30
Divy Srivastava
e19ee6eecc
fix(ext/node): server.close() does graceful shutdown (#24184) 2024-06-14 06:38:50 +05:30
Bartek Iwańczuk
fb31eaa9ca
chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24056)
This commit updates Deno to use `reqwest` at 0.12.4
and `rustls` at 0.22. Other related crates were updated
as well to match versions accepted by `reqwest` and `rustls`.

Note: we are not using the latest available `rustls` yet,
but this upgrade was non-trivial already, so a bump to
0.23 for `rustls` will be done in a separate commit.

Closes #23370

---------

Signed-off-by: Ryan Dahl <ry@tinyclouds.org>
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-06-13 22:41:26 +02:00
Divy Srivastava
5bcb46cacf
chore(ext/node): remove old vm ops (#24187)
Unused; before the recent rewrite of node:vm
2024-06-13 09:19:33 +05:30
denobot
efb2085b61
chore: forward v1.44.2 release commit to main (#24194)
Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
2024-06-13 01:57:22 +00:00
Divy Srivastava
1d290ccc2a
fix(ext/node): fix vm memory usage and context initialization (#23976)
Fixes https://github.com/denoland/deno/issues/22441
Fixes https://github.com/denoland/deno/issues/23913
Fixes  https://github.com/denoland/deno/issues/23852
Fixes https://github.com/denoland/deno/issues/23917
2024-06-12 22:32:54 +05:30
Divy Srivastava
17e1219250
chore: upgrade deno_core (#24146)
With changes for https://github.com/denoland/deno_core/pull/778
2024-06-11 15:12:38 +02:00
Bartek Iwańczuk
6a356aff13
chore: sync up Node.js test files for v20.11.1 (#24066)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-06-11 11:41:44 +00:00
Luca Casonato
3d41b486da
fix(ext/node): ServerResponse header array handling (#24149)
Previously res.setHeader("foo", ["bar", "baz"]) added a single header
with a value of `bar,baz`. Really this should add two separate headers.
This is visible in `set-cookie` for example.
2024-06-11 13:39:44 +03:00
snek
e3b2ee183b
fix: Rewrite Node-API (#24101)
Phase 1 node-api rewrite
2024-06-10 16:20:44 +00:00
Satya Rohith
4fd3d5a86e
fix(ext/node): send data frame with end_stream flag on _final call (#24147) 2024-06-10 16:30:56 +02:00
David Sherret
31154ff958
fix(check): attempt to resolve types from pkg before @types pkg (#24152)
I've been meaning to fix this for ages, but I finally ran into it here:


https://github.com/dsherret/ts-ast-viewer/actions/runs/9432038675/job/25981325408

We need to resolve the `@types` package as a fallback instead of eagerly
resolving it.
2024-06-08 20:05:28 -04:00
Luca Casonato
ed13d36e4b
fix(ext/node): add crypto and zlib constants (#24151) 2024-06-09 02:02:47 +02:00
Bartek Iwańczuk
3f3bb6a829
fix(ext/net): make node:http2 work with DENO_FUTURE=1 (#24144) 2024-06-09 01:54:26 +02:00
Luca Casonato
c1f23c5788
fix(ext/node): lossy UTF-8 read node_modules files (#24140)
Previously various reads of files in `node_modules` would error on
invalid UTF-8. These were cases involving:

- reading package.json from Rust
- reading package.json from JS
- reading CommonJS files from JS
- reading CommonJS files from Rust (for ESM translation)
- reading ESM files from Rust
2024-06-08 18:36:13 +02:00
Bartek Iwańczuk
9dc0e33e67
fix: upgrade deno_core (#24128)
Includes https://github.com/denoland/deno_core/pull/770 necessary
for https://github.com/denoland/deno/pull/24101.

Also includes https://github.com/denoland/deno_core/pull/769 that
fixes https://github.com/denoland/deno/issues/24098 and
https://github.com/denoland/deno/issues/24069 and
https://github.com/denoland/deno/issues/24089.
2024-06-07 17:47:15 +00:00
Divy Srivastava
3735a1a542
fix(ext/node): support stdin child_process IPC & fd stdout/stderr (#24106)
Add supports for "ipc" and fd options in child_process spawn API.

Internal changes: Adds a hidden rid and "ipc_for_internal_use" option to
Deno.Command. Used by `node:child_process`

Example:
```js
const out = fs.openSync("./logfile.txt", 'a')
const proc = spawn(process.execPath, ["./main.mjs", "child"], {
  stdio: ["ipc", out, "inherit"]
});
```

Ref #16753
2024-06-07 22:51:32 +05:30
Satya Rohith
708a619693
chore(ext/node): remove dead op (#24131) 2024-06-07 18:50:43 +05:30
David Sherret
386d5c8310
refactor: remove PermissionsContainer in deno_runtime (#24119)
Also removes permissions being passed in for node resolution. It was
completely useless because we only checked it for reading package.json
files, but Deno reading package.json files for resolution is perfectly
fine.

My guess is this is also a perf improvement because Deno is doing less
work.
2024-06-06 23:37:53 -04:00
denobot
4d531bf229
chore: forward v1.44.1 release commit to main (#24115)
This is the release commit being forwarded back to main for 1.44.1

Co-authored-by: devsnek <devsnek@users.noreply.github.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-06-06 03:23:10 +00:00
Kenta Moriuchi
eda43c46de
fix: validate integer values in Deno.exitCode setter (#24068) 2024-06-02 21:29:01 -04:00
denobot
9e2971d40f
1.44.0 (#24045)
Bumped versions for 1.44.0

Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-05-30 04:49:23 +00:00
Luke Edwards
13723f267e
feat: Add Deno.exitCode API (#23609)
This commits adds the ability to set a would-be exit code 
for the Deno process without forcing an immediate exit, 
through the new `Deno.exitCode` API.

- **Implements `Deno.exitCode` getter and setter**: Adds support for
setting
and retrieving a would-be exit code via `Deno.exitCode`.
This allows for asynchronous cleanup before process termination 
without immediately exiting.
- **Ensures type safety**: The setter for `Deno.exitCode` validates that
the provided value is a number, throwing a TypeError if not, to ensure
that
only valid exit codes are set.

Closes to #23605

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-29 23:16:27 +00:00
Satya Rohith
4f9b23b366
fix(ext/node): don't encode buffer data as utf8 in http2 (#24016) 2024-05-29 11:34:34 +05:30
Bartek Iwańczuk
7d8a8a0461
fix(ext/http): flush gzip streaming response (#23991)
This commit changes `gzip` compression in `Deno.serve` API to flush data
after each write. There's a slight performance regression, but provided
test shows a scenario that was not possible before.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-05-28 22:46:04 +02:00
Marvin Hagemeister
8c9d1ba1d7
fix(ext/node/fs): position argument not applied (#24009)
We didn't honour the `position` options of `fd.read` and `fd.write`
because we checked if the buffer is of type `Buffer` instead of just
`Uint8Array`. Node does the latter. In doing so I noticed that the file
handle id was written to a public property which it definitely shouldn't
be. This was probably a typo.

Fixes https://github.com/denoland/deno/issues/23707
2024-05-28 14:30:31 +02:00
Marvin Hagemeister
a0ddf73058
fix(ext/node): add throwIfNoEntry option in fs.lstatSync (#24006)
We didn't support the `throwIfNoEntry` option for Node's `fs.lstatSync`
method. Note that the async variant doesn't have this option.

Fixes https://github.com/denoland/deno/issues/23996
2024-05-28 12:24:54 +02:00
Marvin Hagemeister
8806eac634
fix(node): set default http server response code 200 (#23977)
Node sets the default HTTP response status code to 200 on the
`ServerResponse`. We initialised it as `undefined` before which caused a
problem with 11ty's dev server.

Thanks to @vrugtehagel for reporting this issue and finding the correct
fix as well 🎉

Fixes https://github.com/denoland/deno/issues/23970
2024-05-26 09:32:46 +02:00
Satya Rohith
e450c6b7cb
fix(ext/node): return cancelled flag in get_response_body_chunk op (#23962)
The flag lets us exit from read loop without throwing an error when
the stream is cancelled.

This fixes gRPC cancellation example.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-23 23:01:20 +05:30
Divy Srivastava
aeafb7b39e
fix(ext/node): add stubs for perf_hooks.PerformaceObserver (#23958)
Fixes https://github.com/denoland/deno/issues/23943
2024-05-23 04:59:20 -07:00
Bartek Iwańczuk
fabd9a214b
chore: forward v1.43.6 release commit to main (#23936)
Bumped versions for 1.43.6

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-05-22 01:35:04 +00:00
snek
8f2d171404
feat(node): buffer isUtf8/isAscii (#23928)
Fixes: https://github.com/denoland/deno/issues/23657

Implements `isUtf8` and `isAscii` as ops.
2024-05-21 15:50:59 -07:00
David Sherret
3d6ba1eaf1
perf: analyze cjs re-exports in parallel (#23894) 2024-05-21 10:35:51 -04:00
Marvin Hagemeister
eb97f110db
fix(node): stub findSourceMap for ava (#23899)
This stubs `findSourceMap` in `node:module` by always returning
`undefined` as if it never found a source map. This unblocks the `ava`
test runner.

Fixes https://github.com/denoland/deno/issues/18666
2024-05-20 16:42:42 +02:00
Marvin Hagemeister
fb3f82b9ea
fix(node): track SIG* listeners in process.listeners (#23890)
Some npm libraries like `signal-exit` rely on the length of the listener
array returned by `process.listeners("SIGNT")` to be correct to
function. We weren't tracking `SIG*` events there, which broke those npm
libraries.

Fixes https://github.com/denoland/deno/issues/22892
2024-05-20 15:24:13 +02:00
Marvin Hagemeister
d7709daaa0
fix(node): patch MessagePort in worker_thread message (#23871)
Our `MessagePort` to Node's `MessagePort` conversion logic was missing
the case where a `MessagePort` is sent _inside_ the message. This broke
`tinypool` which is used by `vitest` as it relies on some node specific
methods on `MessagePort`.

Fixes https://github.com/denoland/deno/issues/23854 , Fixes
https://github.com/denoland/deno/pull/23871
2024-05-20 15:01:40 +02:00
Bedis Nbiba
927cbb5ecd
fix: handle signal 0 in process.kill (#23473)
the last commit had a regression, where it removed this branch, I
haven't tested the code but I think it should work

---------

Signed-off-by: Bedis Nbiba <bedisnbiba@gmail.com>
2024-05-19 14:52:03 -04:00
David Sherret
a2dbcf9e0a
perf: analyze cjs exports and emit typescript in parallel (#23856) 2024-05-18 11:42:03 -04:00
Marvin Hagemeister
75efc74931
fix(node): instantiating process class without new (#23865)
Popular test runners like Jest instantiate a new `Process` object
themselves and expect the class constructor to be callable without the
`new` keyword. This PR refactors our `Process` class implementation from
a proper ES2015 class to an ES5-style class which can be invoked both
with and without the `new` keyword like in Node.

Fixes https://github.com/denoland/deno/issues/23863
2024-05-17 16:24:07 +02:00
Bartek Iwańczuk
2b560be83f
chore: forward v1.43.4 commit to main (#23861)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-05-17 03:57:53 +02:00
Satya Rohith
7893ab9f0b
fix(ext/node): fix grpc error_handling example (#23755)
gRPC depends only on the END_STREAM flag to emit "trailers" event which
is responsible to propagate the errors correctly. This patch uses
Body::is_end_stream() to determine if a stream will end and set the
END_STREAM flag.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-16 17:42:01 +05:30
Marvin Hagemeister
00e6d41a9d
fix(node): error when throwing FS_EISDIR (#23829)
The `EISDIR` error code is not available as a global variable, but must
be accessed through the `osConstants.errno` object.

Fixes https://github.com/denoland/deno/issues/23695
2024-05-16 10:30:41 +02:00
Divy Srivastava
bba553bea5
fix(ext/node): homedir() getpwuid/SHGetKnownFolderPath fallback (#23841)
**Unix**: Returns the value of the HOME environment variable if it is
set even if it is an empty string. Otherwise, it tries to determine the
home directory by invoking the
[getpwuid_r](https://linux.die.net/man/3/getpwuid_r) function with the
UID of the current user.

**Windows**: Returns the value of the USERPROFILE environment variable
if it is set and it is not an empty string. Otherwise, it tries to
determine the home directory by invoking the
[SHGetKnownFolderPath](https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath)
function with
[FOLDERID_Profile](https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid).

Fixes https://github.com/denoland/deno/issues/23824
2024-05-16 10:52:40 +05:30
Divy Srivastava
a31b81394b
fix(ext/node): export geteuid from node:process (#23840)
Fixes https://github.com/denoland/deno/issues/23827
2024-05-16 10:32:11 +05:30
Marvin Hagemeister
e02d0faedc
fix(node): wrong worker_threads.terminate() return value (#23803)
<!--
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.
-->

Fixes https://github.com/denoland/deno/issues/23801

---------

Signed-off-by: Marvin Hagemeister <marvinhagemeister50@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-15 17:08:25 +02:00
Marvin Hagemeister
e389917535
fix(node): stub AsyncResource.emitDestroy() (#23802)
<!--
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.
-->

Fixes https://github.com/denoland/deno/issues/23397
2024-05-15 00:42:43 +02:00
Leo Kettmeir
df879f9f74
chore: cleanup unused dependencies (#23787) 2024-05-13 14:23:39 -07:00
Bartek Iwańczuk
03a76f33ad
fix(ext/node): process.uptime works without this (#23786)
Fixes https://github.com/denoland/deno/issues/23761

Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-05-12 23:38:22 +00:00
denobot
dac49a116e
chore: forward v1.43.3 release commit to main (#23771)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-10 19:20:34 -04:00
David Sherret
a9708037c9
fix(node): better cjs re-export handling (#23760)
Closes #23458
2024-05-10 09:55:20 -04:00
denobot
e6dc4dfbff
chore: forward v1.43.2 release commit to main (#23749)
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED**

This is the release commit being forwarded back to main for 1.43.2

Please ensure:
- [x] Everything looks ok in the PR
- [x] The release has been published

To make edits to this PR:
```shell
git fetch upstream forward_v1.43.2 && git checkout -b forward_v1.43.2 upstream/forward_v1.43.2
```

Don't need this PR? Close it.

cc @nathanwhit

Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-05-09 00:45:01 +00:00
Satya Rohith
b2628e4a06
fix(ext/node): don't rely on Deno.env to read NODE_DEBUG (#23694)
This patch allows implementors to use ext/node without
the need to implement Deno.env API.

Closes https://github.com/denoland/deno/issues/23687
2024-05-05 16:16:02 +02:00
Satya Rohith
811280af77
fix(ext/node): check resource exists before close (#23655) 2024-05-02 18:34:42 +05:30
Satya Rohith
56ba7f3c23
fix(ext/node): support delete process.env.var (#23647)
Closes https://github.com/denoland/deno/issues/23641
2024-05-02 06:40:22 +00:00
denobot
5ff881a073
1.43.0 (#23629)
Bumped versions for 1.43.0

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-05-01 12:16:39 +05:30
David Sherret
56bf634fa9
fix(node): require.resolve - fallback to global cache when bare specifier from paths not found (#23618)
Part of #22607 (probably closes it, but I haven't done thorough testing)

Makes it so that `require.resolve` with `paths` specified will fallback
to using the global cache when the paths can't be found when using a
global cache (not when using a node_modules folder)
2024-04-30 23:41:29 -04:00
Satya Rohith
0156f82e73
fix(ext/node): support multiple message listeners on MessagePort (#23600)
Closes https://github.com/denoland/deno/issues/23561
2024-04-30 16:59:39 +05:30
Satya Rohith
8503311641
fix(ext/node): read(0) before destroying http2stream (#23505)
This patch enables gRPC hello world client example to work.

Towards #23246 #3326
2024-04-30 07:49:29 +05:30
Divy Srivastava
b02ffec37c
fix(ext/node): exporting rsa public keys (#23596)
Initial support for exporting rsa public KeyObject.

Current assumption is that RSA keys are stored in pkcs1 der format in
key storage.

Ref https://github.com/denoland/deno/issues/23471 
Ref https://github.com/denoland/deno/issues/18928
Ref https://github.com/denoland/deno/issues/21124
2024-04-29 19:16:38 +05:30
Yoshiya Hinosawa
0b454056a8
refactor: remove dead code in node stream polyfill (#23597) 2024-04-29 19:55:51 +09:00
Satya Rohith
b8444066ea
fix(ext/node): support NODE_DEBUG env (#23583) 2024-04-29 09:36:53 +00:00
Satya Rohith
455cf1743f
fix(ext/node): add support for MessagePort.removeListener/off (#23598)
Closes https://github.com/denoland/deno/issues/23564
2024-04-29 08:53:54 +00:00
Yoshiya Hinosawa
8178f758bc
fix(ext/node): support process.stdin.unref() (#22865)
This PR adds private `[REF]()` and `[UNREF]()` methods to Stdin class,
and call them from Node.js polyfill layer (`TTY` class). This enables
`process.stdin.unref()` and `process.stdin.ref()` for the case when
stdin is terminal.

closes #21796
2024-04-27 20:25:18 +09:00
denobot
8321106b78
1.43.0 (#23549)
Bumped versions for 1.43.0

Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-04-25 15:14:26 +05:30
Matt Mastracci
eed2598e6c
feat(ext/http): Implement request.signal for Deno.serve (#23425)
When the response has been successfully send, we abort the
`Request.signal` property to indicate that all resources associated with
this transaction may be torn down.
2024-04-24 14:03:37 -04:00
Bartek Iwańczuk
b424959d3e
fix(ext/node): worker_threads copies env object (#23536)
Most common argument to `env` option for `worker_threads.Worker` will be
`process.env`.

In Deno `process.env` is a `Proxy` which can't be cloned using
structured clone algorithm.

So to be safe, I'm creating a copy of actual object before it's sent to
the worker thread.

Ref #23522
2024-04-24 16:17:28 +00:00
Kenta Moriuchi
aff7a64544
fix: Float16Array support (#23512)
Ref #23490, #23277

* remove `--js-float16array` flag (This flag has already added to
deno_core)
* add some `Float16Array` support
2024-04-23 22:54:19 +02:00
Bartek Iwańczuk
14ae4f897f
fix(ext/node): define http.maxHeaderSize (#23479)
Closes https://github.com/denoland/deno/issues/23432
2024-04-21 07:31:23 +05:30
welfuture
e55087f57a
fix: Fix some typos in comments (#23470)
Signed-off-by: welfuture <wellfuture@qq.com>
2024-04-21 01:54:07 +02:00
Divy Srivastava
c0f40ed81a
fix(ext/node): implement process.kill in Rust (#23130)
Closes https://github.com/denoland/deno/issues/23056
2024-04-20 18:55:07 +05:30
Divy Srivastava
e0554ac4a2
fix(ext/node): Support env option in worker_thread (#23462)
Fixes https://github.com/denoland/deno/issues/23455
2024-04-20 09:18:10 +05:30
Matt Mastracci
472a370640
feat(runtime): Allow embedders to perform additional access checks on file open (#23208)
Embedders may have special requirements around file opening, so we add a
new `check_open` permission check that is called as part of the file
open process.
2024-04-19 18:12:03 -06:00
Matt Mastracci
5e2a747685
fix(ext/node): Correctly send ALPN on node TLS connections (#23434)
Landing work from #21903, plus fixing a node compat bug.

We were always sending the HTTP/2 ALPN on TLS connections which might
confuse upstream servers.

Changes:
- Configure HTTP/2 ALPN when making the TLS connection from the HTTP/2
code
- Read the `ALPNProtocols` property from the TLS connection options
rather than the deno `alpnProtocols` field
 - Add tests

Prereq for landing Deno.serveHttp on Deno.serve: removing older HTTP
servers from the codebase.
2024-04-18 09:37:47 -06:00
Satya Rohith
50223c5c53
fix(ext/node): dispatch beforeExit/exit events irrespective of listeners (#23382)
Closes https://github.com/denoland/deno/issues/23342
Closes https://github.com/denoland/deno/issues/21757
2024-04-16 13:45:41 +00:00
Bartek Iwańczuk
0a7f46b8c2
chore: forward v1.42.4 commit to main (#23394)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-04-16 02:41:59 +00:00
Bartek Iwańczuk
0b8d7d1d4b
fix(ext/node): panic on 'worker_threads.receiveMessageOnPort' (#23386)
Closes https://github.com/denoland/deno/issues/23362

Previously we were panicking if there was a pending read on a
port and `receiveMessageOnPort` was called. This is now fixed
by cancelling the pending read, trying to read a message and
resuming reading in a loop.
2024-04-16 01:06:39 +02:00
Divy Srivastava
f36a8951a4
fix(ext/node): add stub for AsyncResource#asyncId() (#23372)
Ref https://github.com/denoland/deno/issues/23263
2024-04-15 12:54:42 +00:00
Divy Srivastava
1fadb940f4
fix(ext/node): use ext/io stdio in WriteStream (#23354)
This is the same issue as https://github.com/denoland/deno/pull/23044
but in `WriteStream`.

Adding a docusarus test in npm_smoke_tests repo.
2024-04-13 21:25:00 +05:30
Divy Srivastava
402d59eea9
fix(ext/node): promise rejection in VM contexts (#23305)
Fixes https://github.com/denoland/deno/issues/23297

`docusaurus build` works!

```
$ deno run -A repro.js 
fish: Job 1, 'deno run -A ../../littledivy/fs…' terminated by signal SIGSEGV (Address
 boundary error)
$ denod run -A repro.js
error: Uncaught (in promise) Error: rejected
```

Depends on https://github.com/denoland/deno_core/pull/693
2024-04-13 17:02:07 +05:30
youngwendy
84e198f0d0
chore: remove repetitive words (#23341)
Signed-off-by: youngwendy <clonefetch@outlook.com>
2024-04-12 08:33:43 -06:00
denobot
c92f118652
chore: forward v1.42.3 release commit to main (#23335)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-04-12 04:19:46 +00:00
denobot
ca7432b86b
chore: forward v1.42.2 release commit to main (#23315)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-04-11 13:37:24 +05:30
林炳权
9304126be5
chore: update to Rust 1.77.2 (#23262)
update to Rust 1.77.2


---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-04-10 22:08:23 +00:00
Satya Rohith
5a3ee6d9af
fix(ext/node): implement MessagePort.unref() (#23278)
Closes https://github.com/denoland/deno/issues/23252
Closes https://github.com/denoland/deno/issues/23264
2024-04-09 20:15:55 +02:00
Divy Srivastava
fad12b7c2e
fix(ext/node): node:vm contexts (#23202)
Implement contextified objects in `node:vm`

Fixes https://github.com/denoland/deno/issues/23186
Fixes https://github.com/denoland/deno/issues/22395
Fixes https://github.com/denoland/deno/issues/20607
Fixes https://github.com/denoland/deno/issues/18299
Fixes https://github.com/denoland/deno/issues/19395
Fixes https://github.com/denoland/deno/issues/18315
Fixes https://github.com/denoland/deno/issues/18319
Fixes https://github.com/denoland/deno/issues/23183
2024-04-09 21:24:25 +05:30
Asher Gomez
a4f3e7436e
chore: update h2 crate (#23272)
Prerequisite #23273.
2024-04-09 08:42:10 +10:00
Yoshiya Hinosawa
2670c1d580
fix(ext/node): out-of-order writes of fs.createWriteStream (#23244)
This PR follows this fix (https://github.com/nodejs/node/pull/52005) in
Node.js.

Stream's construct callback happens one tick earlier by this change, and
it prevents the reordering of the first few chunks in
`node:stream.Writable`

closes #20284
2024-04-08 12:47:34 +09:00
Divy Srivastava
ee4bfe1600
fix(ext/node): hostname is valid IPv4 addr (#23243)
Fixes `docusaurus serve`
2024-04-05 17:42:26 +05:30
Divy Srivastava
f4b11db072
fix(ext/node): Add "module" to builtinsModule (#23242)
Fixes https://github.com/denoland/deno/issues/22731
2024-04-05 11:38:00 +00:00
Satya Rohith
aa08155fd1
refactor(ext/node): remove worker_threads dependency on ext:runtime (#23206) 2024-04-03 21:39:53 +02:00
Bartek Iwańczuk
778b0b8eb5
fix(ext/node): polyfill node:domain module (#23088)
Closes https://github.com/denoland/deno/issues/16852

---------

Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-04-03 21:37:10 +02:00
Satya Rohith
86bc7a4381
fix(ext/node): patch MessagePort if provided as workerData (#23198)
MessagePort if directly assigned to workerData property instead of
embedding it in an object then it is not patched to a NodeMessagePort.
This commit fixes the bug.
2024-04-03 11:12:16 +00:00
Nathan Whitaker
219a27dde5
fix(ext/node): Support returning tokens and option defaults in node:util.parseArgs (#23192)
Fixes #23179.
Fixes #22454.

Enables passing `{tokens: true}` to `parseArgs` and setting default
values for options.

With this PR, the observable framework works with deno out of the box
(no unstable flags needed).

The existing code was basically copied straight from node, so this PR
mostly just updates that (out of date) vendored code. Also fixes some
issues with error exports (before this PR, in certain error cases we
were attempting to construct error classes that weren't actually in
scope).

The last change (in the second commit) adds a small hack so that we
actually exercise the `test-parse-args.js` node_compat test, previously
it was reported as passing though it should have failed. That test now
passes.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-04-02 16:20:48 -07:00
Alex Yang
8eb2b6c61f
feat: improve AsyncLocalStorage api (#23175)
Fixes: https://github.com/denoland/deno/issues/23174
2024-04-02 22:53:29 +00:00
Asher Gomez
29085895c9
chore: move tools/node_compat to tests/node_compat/runner (#23025)
The `tools/node_compat/node` submodule has been moved to
`tests/node_compat/runner/suite` and the remaining files within
`tools/node_compat` to `tests/node_compat/runner`.

Most of the changes are of the header within `tests/node_compat/test`
files. The `setup` and `test` tasks within `tests/node_comapt` execute
successfully.

Towards #22525
CC @mmastrac
2024-04-03 09:24:55 +11:00
Satya Rohith
4d66ec91c1
fix(ext/node): MessagePort works (#22999)
Closes https://github.com/denoland/deno/issues/22951
Closes https://github.com/denoland/deno/issues/23001

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-04-02 17:06:09 +05:30
Nathan Whitaker
7ad76fd453
fix(ext/node): Add fs.readv, fs.readvSync (#23166)
Part of #18218.

Implements `fs.readv` and `fs.readvSync` and enables the corresponding
`node_compat` tests.
2024-04-01 20:42:49 -07:00
David Sherret
240b362c00
perf(node): put pkg json into an Rc (#23156)
Was doing a bit of debugging on why some stuff is not working in a
personal project and ran a quick debug profile and saw it cloning the
pkg json a lot. We should put this in an Rc.
2024-04-01 09:10:04 -04:00
denobot
8d158058e5
chore: forward v1.42.1 release commit to main (#23162)
This is the release commit being forwarded back to main for 1.42.1

Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-04-01 13:35:46 +05:30
David Sherret
8698492128
fix(node): handle empty 'main' entry in pkg json (#23155) 2024-04-01 07:07:11 +01:00
David Sherret
c53b720656
fix(node): remove unwrap in op_require_node_module_paths (#23114)
Part of #22671
2024-03-28 17:51:41 -04:00
Divy Srivastava
bca0fe1cde
fix(ext/node): support stdin: "inherit" in node:child_process (#23110)
Fixes https://github.com/denoland/deno/issues/23051
2024-03-28 19:44:42 +05:30
Divy Srivastava
de0b230078
fix(ext/node): use tty stdin from ext/io (#23044)
Fixes https://github.com/denoland/deno/issues/23043
2024-03-28 04:25:05 +01:00