1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-01 16:51:13 -05:00
Commit graph

11836 commits

Author SHA1 Message Date
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
Ryan B.
bb943a8569
fix(cli): Unhide publish subcommand help string (#24787)
Fixes #24753

The help text for `deno publish` was marked hidden while in preview.
This is no longer a preview feature.

(cherry picked from commit 191de7d72b)
2024-07-31 20:26:44 +02:00
David Sherret
f6625efba6
chore: mark upgrade invalid lockfile as flaky (#24760)
Closes #24759

(cherry picked from commit 38a363dc7c)
2024-07-31 20:26:35 +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
Yoshiya Hinosawa
b5b9904285
test(ext/node): reduce http_test flakiness (#24742)
(cherry picked from commit 99e811f5eb)
2024-07-31 20:26:08 +02:00
David Sherret
ea3251effd
fix(npmrc): skip loading .npmrc in home dir on permission error (#24758)
(cherry picked from commit 086fa28348)
2024-07-31 20:26:01 +02:00
David Sherret
65ed0636e7
refactor(lint): move reporters to separate module (#24757)
(cherry picked from commit 9956737941)
2024-07-31 20:25:47 +02:00
Kyle Kelley
a3126d221b
fix: adapt to new jupyter runtime API and include session IDs (#24762)
Closes #24737, #24437.

(cherry picked from commit 63f8218a7d)
2024-07-31 20:25:44 +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
David Sherret
6429eff115 fix(publish): workspace included license file had incorrect path (#24747)
Also fixes the issue where we say a package was successfully published
before it wasn't.

Bug in https://github.com/denoland/deno/pull/24714
2024-07-26 12:04:11 -04:00
Bartek Iwańczuk
ecaf9229a6 fix: support npm:bindings and npm:callsites packages (#24727)
Adds support for `npm:bindings` and `npm:callsites` packages because of
changes in
https://github.com/denoland/deno_core/pull/838.

This `deno_core` bump causes us to stop prepending `file://` scheme for
locations
in stack traces that are for local files.

Fixes https://github.com/denoland/deno/issues/24462 , fixes
https://github.com/denoland/deno/issues/22671 , fixes
https://github.com/denoland/deno/issues/15717 , fixes
https://github.com/denoland/deno/issues/19130 , fixes
https://github.com/WiseLibs/better-sqlite3/issues/1205 , fixes
https://github.com/WiseLibs/better-sqlite3/issues/1034 , fixes
https://github.com/denoland/deno/issues/20936

---------

Co-authored-by: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com>
2024-07-26 12:04:11 -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
Asher Gomez
d49a151abf chore: fix bench task (#24718)
<!--
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.
-->
2024-07-26 12:04:10 -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
David Sherret
2a026bee33 fix(unstable): move sloppy-import warnings to lint rule (#24710)
Adds a new `no-sloppy-imports` lint rule and cleans up the lint code.

Closes #22844
Closes https://github.com/denoland/deno_lint/issues/1293
2024-07-26 12:04:10 -04:00
Asher Gomez
f726fe86f3 chore: fix WPT epoch (#24716)
This was missed in the previous `std` updates.
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
David Sherret
a818db4699 fix(workspaces/publish): include the license file from the workspace root if not in pkg (#24714) 2024-07-26 12:04:09 -04:00
Bartek Iwańczuk
0e0b5ee63c fix: upgrade deno_core to 0.298.0 (#24709)
Fixes percent-encoded filenames in stack traces:
- https://github.com/denoland/deno_core/pull/759

Closes #18983
2024-07-26 12:04:09 -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
Nathan Whitaker
4edb86496c fix(future): Emit deno install warning less often, suggest deno install in error message (#24706)
Two small changes:

- In our BYONM errors, suggest running `deno install` instead of `npm
install` if `DENO_FUTURE` is set
- Only emit warning about `deno install` changes if you do `deno install
<foo>` with deno_future unset
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
Leo Kettmeir
f7749a95b4 perf: update deno_doc (#24700)
Ref https://github.com/denoland/deno_doc/pull/616
2024-07-26 12:04:08 -04:00
HasanAlrimawi
8924b02fb6 fix: update lsp error message of 'relative import path' to 'use deno add' for npm/jsr packages (#24524) 2024-07-26 12:04:08 -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
99d8193ed2 fix(upgrade): do not error if config in cwd invalid (#24689)
```
> deno upgrade
error: Unsupported lockfile version 'invalid'. Try upgrading Deno or recreating the lockfile.
V:\scratch
> V:\deno\target\debug\deno upgrade
Looking up latest version
Local deno version 1.45.3 is the most recent release
```

Closes #24517
Closes #20729
2024-07-26 12:04:07 -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
HasanAlrimawi
e76330c49d fix: enable the reporting of parsing related problems when running deno lint (#24332) 2024-07-26 12:04:07 -04:00
Nayeem Rahman
142b9f29ae fix(lsp): rewrite import for 'infer return type' action (#24685) 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
fec792ee9c
Revert "fix(cli): add NAPI support in standalone mode (#24642)"
This reverts commit 4e8f5875bc.
2024-07-23 00:54:29 +02:00