Commit graph

1874 commits

Author SHA1 Message Date
Matt Mastracci 0e4018a25b
fix(ext/net): Improve ts types for network APIs (#23228)
This currently fails to type-check in deno, but we know that listener is
a `Listener<TcpConn>` here and we should be able to improve the typing:

```
let listener = Deno.listen({ port: 0 });
console.log(listener.addr.port);

->

error: TS2339 [ERROR]: Property 'port' does not exist on type 'Addr'.
  Property 'port' does not exist on type 'UnixAddr'.
let listener = Deno.listen({ port: 0 }); console.log(listener.addr.port)
```

After:

```
Check file:///tmp/test.ts
```
2024-04-05 17:01:03 -06: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 e01bc09573
fix(ext/node): count MessagePort message listeners in hasMessageEventListener (#23209) 2024-04-04 17:08:51 +02: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
Matt Mastracci aec0e408ea
chore(ext/ffi): sym is unused on aarch64 linux (#23188)
Fix a warning on linux aarch64

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-04-02 20:57:31 +00: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
denobot 9c6eca1064
1.42.0 (#23105)
Bumped versions for 1.42.0

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-03-28 01:47:33 +01:00
Viktor Marinho fb1aa4e6d2
fix(ext/web): Fix structuredClone Web API type declaration (any -> generic) (#22968)
Closes #22958 

Used the same type as in:
https://github.com/microsoft/TypeScript/blob/main/src/lib/dom.generated.d.ts#L26114

---------

Signed-off-by: Viktor Marinho <56888067+viktormarinho@users.noreply.github.com>
2024-03-25 22:44:49 +01:00
ud2 5c1fa0cf9c
fix(ext/fetch): do not truncate field value in EventSource (#22368)
Depends on #22493. Closes #22367.
2024-03-25 07:31:13 -07:00
ud2 d263c632e3
fix(ext/fetch): make EventSource more robust (#22493)
This PR fixes all unhandled rejections and resource leaks found while
adding a test for #22368.
2024-03-24 18:49:01 +01:00
Divy Srivastava ec9342f95a
fix(ext/node): handle null in stdio array (#23048)
Fixes https://github.com/denoland/deno/issues/23045
2024-03-24 06:55:53 +01:00
Matt Mastracci 08ec6e5831
perf: warm expensive init code at snapshot time (#22714)
Slightly different approach to similar changes in #22386

Note that this doesn't use a warmup script -- we are actually just doing
more work at snapshot time.
2024-03-22 20:49:07 +00:00
Bartek Iwańczuk 9c2f9f14e7
refactor(ext/ffi): use v8::Value instead of serde_v8::Value (#23035)
Follow up to https://github.com/denoland/deno/pull/23034 that removes
another usage of `serde_v8::Value`.
2024-03-22 19:51:05 +00:00
Bartek Iwańczuk 85236576b2
refactor(ext/ffi): don't go through serde_v8::Value (#23034)
Removes unnecessary indirection - after creating `serde_v8::Value` it
was immediately unwrapped to `v8::Value` by the caller.
2024-03-22 19:05:06 +00:00
Bartek Iwańczuk b688b61036
refactor(ext/web): use relative specifiers (#23024) 2024-03-22 17:21:05 +01:00
Divy Srivastava 43be97923f
fix(ext/node): handle KeyObject in prepareAsymmetricKey (#23026)
Fixes https://github.com/denoland/deno/issues/20938
2024-03-22 19:28:28 +05:30
Divy Srivastava 22eec2b3cf
fix(ext/node): add crypto.subtle (#23027)
Alias for `crypto.webcrypto.subtle`.
https://nodejs.org/api/crypto.html#cryptosubtle
2024-03-22 18:56:36 +05:30
Divy Srivastava eb9d473974
fix(ext/node): add crypto.getRandomValues (#23028)
Alias for `crypto.webcrypto.getRandomValues`
2024-03-22 18:56:20 +05:30
Bartek Iwańczuk 2166aa8fb6
chore: upgrade deno_core to 0.272.0 (#23022) 2024-03-21 13:57:32 -07:00
David Sherret 9abc722cc3
feat(node): load ES modules defined as CJS (#22945)
Changes the behaviour in Deno to just always load ES modules in npm
packages even if they're defined as CJS.

Closes #22818
2024-03-21 11:35:51 -07:00
Eric Long 976fa489fb
feat(ext/node): add riscv64 in process.arch (#23016)
Rust triple for riscv64 is riscv64gc. Although there are no official
builds for architectures other than x86_64 and aarch64, Arch Linux
RISC-V has managed to package Deno on riscv64:
https://github.com/felixonmars/archriscv-packages/blob/master/deno/riscv64.patch

Ref: https://github.com/denoland/deno/issues/18702
2024-03-21 19:06:42 +05:30
Divy Srivastava 1f60b8af97
fix(ext/node): ECDH.publicKey() point encoding (#23013) 2024-03-21 14:11:54 +05:30
Divy Srivastava 210f2911ce
fix(ext/node): panic in op_node_ecdh_generate_keys (#23011) 2024-03-21 06:45:10 +00:00
Satya Rohith fb0744f4e1
fix(ext/node): spread args in setImmediate (#22998)
Closes https://github.com/denoland/deno/issues/22997

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-03-20 07:52:50 +00:00
Divy Srivastava 724cdcec7b
fix(ext/node): implement EventEmitterAsyncResource (#22994)
Fixes #22729
2024-03-20 11:20:18 +05:30
Divy Srivastava 5b2f689f08
fix(ext/node): FsWatcher ref and unref (#22987)
Fixes https://github.com/denoland/deno/issues/22973

---------

Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-03-20 11:19:53 +05:30
Satya Rohith 737adbe1b0
fix(ext/node): add process.setSourceMapsEnabled noop (#22993)
Closes https://github.com/denoland/deno/issues/22992
2024-03-20 05:26:41 +00:00
mash-graz 0d43a63636
fix(ext/node): worker_threads ESM handling (#22841)
Fixes #22840
Fixes #22964
2024-03-20 09:12:22 +05:30
Asher Gomez b9f8562754
chore: rename internal Datagram class to DatagramConn (#22474)
As having mismatched public and private class names may be confusing,
without good reason, to those unfamiliar with the codebase.
2024-03-19 18:03:15 +01:00
Asher Gomez b0c687c1d2
fix(ext/node): support Diffie-Hellman key type in crypto.createPrivateKey() (#22984)
Towards #22489

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-03-19 11:11:01 +05:30
Divy Srivastava bd6938ac70
fix(node): implement v8 serialize and deserialize (#22975)
Fixes https://github.com/denoland/deno/issues/22971
2024-03-18 13:48:55 +05:30
Satya Rohith becdad531f
fix(ext/node): support public key point encoding in ECDH.generateKeys() (#22976)
Towards https://github.com/denoland/deno/issues/22921

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-03-18 13:20:10 +05:30
Divy Srivastava 9c5ddf7c69
fix(ext/node): pass normalized watchFile handler to StatWatcher (#22940)
Fixes https://github.com/denoland/deno/issues/22939
2024-03-16 09:44:47 +05:30
Bartek Iwańczuk 92576fdcfd
fix(ext/node): support MessagePort in WorkerOptions.workerData (#22950)
This commit fixes passing `MessagePort` instances to
`WorkerOptions.workerData`.

Before they were not serialized and deserialized properly when spawning
a worker thread.

Closes https://github.com/denoland/deno/issues/22935
2024-03-16 01:59:18 +01:00
Nathan Whitaker ebbc897b69
fix(ext/node): Reimplement StringDecoder to match node's behavior (#22933)
Fixes #22158.

Basically reimplements the whole `StringDecoder` with a much more direct
translation (read like one-to-one) of node's current logic. The old
implementation was closer to node's super old impl and it was too hard
to keep the code structure while matching the behavior of their new
logic.

This adds support for UTF-16LE, ascii, and latin1. 

This also enables the node_compat test, which now passes without
modification.
2024-03-15 17:24:13 -07:00
Nathan Whitaker 85116226b3
chore: Forward 1.41.3 release commit (#22930)
Forward 1.41.3 release commit

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
2024-03-14 21:23:24 +00:00
Divy Srivastava b00f076017
fix(ext/node): Support private EC key signing (#22914)
Fixes https://github.com/denoland/deno/issues/18972

Support for web-push VAPID keys & jws signing

- Fixes EC keygen to return raw private key and uncompressed public key
point.
- Support for `EC PRIVATE KEY`
2024-03-14 14:53:50 +01:00