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

2170 commits

Author SHA1 Message Date
Luca Casonato
f8a9d8defc
perf(ext/fetch): speed up resp.clone() (#24812)
(cherry picked from commit b153065e44)
2024-07-31 20:27:52 +02:00
Luca Casonato
e23512fde3
fix(ext/node): handle node child_process with --v8-options flag (#24804)
Makes `v8flags` package from NPM work.

(cherry picked from commit 1faac2dce3)
2024-07-31 20:27:18 +02:00
Luca Casonato
55ae9bfc40
fix(ext/webgpu): don't crash while constructing GPUOutOfMemoryError (#24807)
(cherry picked from commit f6fad68d7b)
2024-07-31 20:27:16 +02:00
Marvin Hagemeister
95d7375d05
fix(node/fs/promises): watch should be async iterable (#24805)
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

(cherry picked from commit 9e6288ec61)
2024-07-31 20:27:13 +02:00
Marvin Hagemeister
634afebe58
fix(node/timers/promises): add scheduler APIs (#24802)
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

(cherry picked from commit 1e2581e57b)
2024-07-31 20:27:10 +02:00
Nathan Whitaker
b6c0313d7e
fix(node): Rework node:child_process IPC (#24763)
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

(cherry picked from commit cd59fc53a5)
2024-07-31 20:27:08 +02:00
David Sherret
14d18d9e13
fix(compile/windows): handle cjs re-export of relative path with parent component (#24795)
Closes https://github.com/denoland/deno/issues/24785

(cherry picked from commit fe884c557a)
2024-07-31 20:27:00 +02:00
David Sherret
a910bc71d8
fix(node): support wildcards in package.json imports (#24794)
(cherry picked from commit 7a3810195d)
2024-07-31 20:26:57 +02:00
Divy Srivastava
98ecb562d0
perf(ext/node): improve Buffer from string performance (#24567)
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
```

(cherry picked from commit 1ba88a7892)
2024-07-31 20:26:53 +02:00
Bartek Iwańczuk
313b0268bf
refactor(ext/node): create separate ops for node:http module (#24788)
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.

(cherry picked from commit c6ecf70a09)
2024-07-31 20:26:49 +02:00
Satya Rohith
ec2c30e4c9
chore: upgrade to rust 1.80 (#24778)
(cherry picked from commit 8c2f1f5a55)
2024-07-31 20:26:27 +02:00
Satya Rohith
a3fb3bc3d8
fix(ext/node): prevent panic in http2.connect with uppercase header names (#24780)
Closes https://github.com/denoland/deno/issues/24678

(cherry picked from commit 8bab761bcc)
2024-07-31 20:26:24 +02:00
Kenta Moriuchi
99ed40a606
fix(types): fix streams types (#24770)
(cherry picked from commit ad5cec27d3)
2024-07-31 20:26:19 +02:00
Yazan AbdAl-Rahman
4473e81a93
fix(http): Adjust hostname display for Windows when using 0.0.0.0 (#24698)
Fixes #24687

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
(cherry picked from commit 41f8988dc7)
2024-07-31 20:26:17 +02:00
David Sherret
bcb7e600c0
fix: actually add missing node:readline/promises module (#24772)
Closes #24768

(cherry picked from commit 50fa4d7ef5)
2024-07-31 20:26:13 +02:00
David Sherret
1a87be73e6
fix(unstable/compile): handle byonm import in sub dir (#24755)
Regression in 1.45.0 caused by storing relative paths instead of
absolute paths in the binary.

Closes #24654

(cherry picked from commit 06b6352292)
2024-07-31 20:25:33 +02:00
denobot
c0b1d19d55
1.45.4 (#24751)
Co-authored-by: dsherret <dsherret@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-07-26 12:38:02 -04:00
MrEconomical
3ba50bf0c9 fix(ext/node): read correct CPU usage stats on Linux (#24732)
Fixes #24731

<img width="554" alt="deno_fixed"
src="https://github.com/user-attachments/assets/691f2f89-d979-4ca5-be9a-cf51446cd9b2">

The total CPU usage row is ignored and info from `cpu0` and `cpu1` is
correctly read.

---------

Signed-off-by: MrEconomical <47700125+MrEconomical@users.noreply.github.com>
2024-07-26 12:04:11 -04:00
David Sherret
bfea49f36b fix(node): cjs pkg dynamically importing esm-only pkg fails (#24730) 2024-07-26 12:04:11 -04:00
David Sherret
80b479d63e refactor: decouple node resolution from deno_core (#24724) 2024-07-26 12:04:10 -04:00
Marvin Hagemeister
eeaceff32b fix(node/worker_threads): support port.once() (#24725)
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-26 12:04:10 -04:00
Asher Gomez
d2b9a4e7c3 chore: update to std@2024.07.19 (#24715) 2024-07-26 12:04:10 -04:00
Asher Gomez
ef64585d13 chore: use @std prefix for internal module specifiers (#24543)
This change aims to replace all relative import specifiers targeted at
`tests/util/std` with mapped ones (using a `deno.json` file). Towards
updating the `std` git submodule.
2024-07-26 12:04:09 -04:00
Bartek Iwańczuk
a8817fe8cc fix(ext/fetch): respect authority from URL (#24705)
This commit fixes handling of "authority" in the URL by properly
sending "Authorization Basic..." header in `fetch` API.

This is a regression from https://github.com/denoland/deno/pull/24593
Fixes https://github.com/denoland/deno/issues/24697

CC @seanmonstar
2024-07-26 12:04:09 -04:00
Sean McArthur
3b98c6edaf fix(ext/fetch): use correct ALPN to proxies (#24696)
Sending ALPN to a proxy, and then when tunneling, requires better
juggling of TLS configs. This improves the choice of TLS config in the
proxy connector, based on what reqwest does. It also includes some
`ext/fetch/tests.rs` that check the different combinations.

Fixes #24632
Fixes #24691
2024-07-26 12:04:09 -04:00
Yoshiya Hinosawa
b57789687b fix(ext/node/net): emit error before close when connection is refused (#24656) 2024-07-26 12:04:08 -04:00
Nathan Whitaker
0632b4e44e fix(node): Run node compat tests listed in the ignore field (and fix the 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-26 12:04:08 -04:00
David Sherret
815354adee fix(node): better detection for when to surface node resolution errors (#24653) 2024-07-26 12:04:08 -04:00
Bartek Iwańczuk
57e0f40812 Reland "fix: CFunctionInfo and CTypeInfo leaks (#24634)" (#24692)
Reverted in
95847f4e94.
2024-07-26 12:04:08 -04:00
David Sherret
b8c16eda9b refactor: update to use deno_package_json (#24688)
This is in preparation for extracting out node resolution code from
ext/node (which is something I'm going to do gradually over time).

Uses https://github.com/denoland/deno_package_json
2024-07-26 12:04:07 -04:00
Bartek Iwańczuk
607fd2d314
chore: release deno_napi 0.93.0, release deno_runtime 0.171.0 2024-07-23 01:07:40 +02:00
Bartek Iwańczuk
b812e7cb60
Revert "chore: move all node-api impl to ext (#24662)"
This reverts commit d00fbd7025.
2024-07-23 00:34:29 +02:00
denobot
87ce64e574
1.45.3 (#24679)
Bumped versions for 1.45.3

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-22 23:34:15 +02:00
Kenta Moriuchi
a115a10100
fix(types): Conform lib.deno_web.d.ts to lib.dom.d.ts and lib.webworker.d.ts (#24599)
Fix #24578
Fix #21981
2024-07-22 22:48:40 +02:00
snek
d00fbd7025
chore: move all node-api impl to ext (#24662)
these symbols are re-exported from runtime/cli using `build.rs`, so we
don't need them in the same crate.
2024-07-22 22:48:40 +02:00
MujahedSafaa
94a5eaf5b8
fix(ext/console): Error Cause Not Inspect-Formatted when printed (#24526)
This pull request addresses an issue where the Error.cause property was
not formatted correctly when printed using console.log, leading to
confusion.

solution:
Implemented a fix to ensure that Error.cause is formatted properly when
printed by console.log, and the fix done by using JSON.stringify

This PR fixes https://github.com/denoland/deno/issues/23416

---------

Signed-off-by: MujahedSafaa <168719085+MujahedSafaa@users.noreply.github.com>
2024-07-22 22:48:39 +02:00
Marvin Hagemeister
2dd8992ec7
fix: missing emitWarning import (#24587)
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>
2024-07-22 22:48:38 +02:00
Marvin Hagemeister
a2ca399227
fix(node): support tty.hasColors() and tty.getColorDepth() (#24619)
This PR adds support for
[`tty.WriteStream.prototype.hasColors()`](https://nodejs.org/api/tty.html#writestreamhascolorscount-env)
and
[`tty.WriteStream.prototype.getColorDepth()`](https://nodejs.org/api/tty.html#writestreamgetcolordepthenv).

I couldn't find any usage on GitHub which passes parameters to it.
Therefore I've skipped adding support for the `env` parameter to keep
our snapshot size small.

Based on https://github.com/denoland/deno_terminal/pull/3

Fixes https://github.com/denoland/deno/issues/24616
2024-07-22 22:47:58 +02:00
Yoshiya Hinosawa
600b32fdc1
fix(ext/node): do not expose self global in node (#24637)
closes #23727
2024-07-22 22:47:58 +02:00
Ian Bull
e0e03e3f6b
fix(cron): improve error message for invalid cron names (#24644)
When a cron name is invalid, it wasn't necessarily clear why. This
change-set improves the error message to inform the user of the valid
characters in a cron name.
2024-07-22 22:47:58 +02:00
Divy Srivastava
dae5cc7e7c
fix(ext/node): stat.mode on windows (#24434) 2024-07-22 22:47:57 +02:00
Bartek Iwańczuk
b2bacd969c
Reland "refactor(fetch): reimplement fetch with hyper instead of reqwest" (#24593)
Originally landed in
f6fd6619e7.
Reverted in https://github.com/denoland/deno/pull/24574.

This reland contains a fix that sends "Accept: */*" header for calls made
from "FileFetcher". Absence of this header made downloading source code
from JSR broken. This is tested by ensuring this header is present in the
test server that servers JSR packages.

---------

Co-authored-by: Sean McArthur <sean@seanmonstar.com>
2024-07-22 22:47:57 +02:00
Divy Srivastava
3628895471
perf(ext/node): optimize fs.exists[Sync] (#24613)
Use `access` on *nix and `GetFileAttributesW` on Windows.

[Benchmark](https://paste.divy.work/p/-gq8Ark.js):
```
$ deno run -A bench.mjs # main (568dd)
existsSync: 8980.636629ms

$ target/release/deno run -A bench.mjs # this PR
existsSync: 6448.7604519999995ms

$ bun bench.mjs
existsSync: 6562.88671ms

$ node bench.mjs
existsSync: 7740.064653ms
```

Ref https://github.com/denoland/deno/pull/24434#discussion_r1679777912
2024-07-22 22:47:08 +02:00
David Sherret
35cbe2937d
refactor(node): internally add .code() to node resolution errors (#24610)
This makes it easier to tell what kind of error something is (even for
deeply nested errors) and will help in the future once we add error
codes to the JS errors this returns.
2024-07-22 22:47:08 +02:00
Satya Rohith
1ec76fb22a
fix(ext/node): http request uploads of subarray of buffer should work (#24603)
Closes https://github.com/denoland/deno/issues/24571
2024-07-22 22:47:08 +02:00
snek
b9c475000e
chore: upgrade dependencies (#24565)
rustls + hyper + deno_core
2024-07-22 22:47:08 +02:00
Rano | Ranadeep
c97451977e
fix(std/http2): release window capacity back to remote stream (#24576)
This PR adds logic to release window capacity after reading the chunks
from the stream. Without it, large response (more than `u16::MAX`) may
fill up the capacity and the whole response can't be read.

Closes https://github.com/denoland/deno/issues/24552
Closes https://github.com/denoland/deno/issues/24305
2024-07-22 22:46:40 +02:00
Igor Borisoglebski
9c2adb0b4f
fix(docs): fix some deno.land/manual broken urls (#24557)
Fixing some broken urls found after the docs migration
2024-07-22 22:46:39 +02:00
Ryan Dahl
dd83e3fb71
Revert "refactor(fetch): reimplement fetch with hyper instead of reqwest (#24237)" (#24574)
This reverts commit f6fd6619e7.

I'm seeing a difference between canary and 1.45.2. In
`deno-docs/reference_gen` I can't download dax when running `deno task
types`

```
~/src/deno-docs/reference_gen# deno upgrade --canary
Looking up latest canary version
Found latest version f6fd6619e7
Downloading https://dl.deno.land/canary/f6fd6619e708a515831f707438368d81b0c9aa56/deno-aarch64-apple-darwin.zip
Deno is upgrading to version f6fd6619e7
Archive:  /var/folders/9v/kys6gqns6kl8nksyn4l1f9v40000gn/T/.tmpb5lDnq/deno.zip
  inflating: deno
Upgraded successfully

~/src/deno-docs/reference_gen# deno -v
deno 1.45.2+f6fd661

~/src/deno-docs/reference_gen# rm -rf /Users/ry/Library/Caches/deno

~/src/deno-docs/reference_gen# deno task types
Task types deno task types:deno && deno task types:node
Task types:deno deno run --allow-read --allow-write --allow-run --allow-env --allow-sys deno-docs.ts
error: JSR package manifest for '@david/dax' failed to load. expected value at line 1 column 1
    at file:///Users/ry/src/deno-docs/reference_gen/deno-docs.ts:2:15

~/src/deno-docs/reference_gen# deno upgrade --version 1.45.2
Downloading https://github.com/denoland/deno/releases/download/v1.45.2/deno-aarch64-apple-darwin.zip
Deno is upgrading to version 1.45.2
Archive:  /var/folders/9v/kys6gqns6kl8nksyn4l1f9v40000gn/T/.tmp3R7uhF/deno.zip
  inflating: deno
Upgraded successfully

~/src/deno-docs/reference_gen# rm -rf /Users/ry/Library/Caches/deno

~/src/deno-docs/reference_gen# deno task types
Task types deno task types:deno && deno task types:node
Task types:deno deno run --allow-read --allow-write --allow-run --allow-env --allow-sys deno-docs.ts
Task types:node deno run --allow-read --allow-write=. --allow-env --allow-sys node-docs.ts
```
2024-07-22 22:46:39 +02:00
Sean McArthur
aa7e1fc362
refactor(fetch): reimplement fetch with hyper instead of reqwest (#24237)
This commit re-implements `ext/fetch` and all dependent crates
using `hyper` and `hyper-util`, instead of `reqwest`.

The reasoning is that we want to have greater control and access
to low level `hyper` APIs when implementing `fetch` API as well
as `node:http` module.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-22 22:46:39 +02:00