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

778 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
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
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
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
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
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
David Sherret
bfea49f36b fix(node): cjs pkg dynamically importing esm-only pkg fails (#24730) 2024-07-26 12:04:11 -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
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
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
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
fec792ee9c
Revert "fix(cli): add NAPI support in standalone mode (#24642)"
This reverts commit 4e8f5875bc.
2024-07-23 00:54:29 +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
David Sherret
2680b09b0d
fix(publish): warn about missing license file (#24677)
Part of https://github.com/denoland/deno/issues/24676 , but just a
warning for now.
2024-07-22 22:48:40 +02:00
Nayeem Rahman
181d415ac7
fix(lsp): scope attribution for asset documents (#24663) 2024-07-22 22:48:40 +02:00
Bartek Iwańczuk
b5e5e1de4e
Revert "fix: CFunctionInfo and CTypeInfo leaks (#24634)" (#24665)
This reverts commit 6c5905dbc3.

Reverting because of errors like this in CI:
```
#
# Fatal error in , line 0
# Check failed: FastApiCallNode::ArityForArgc(c_arg_count, slow_arg_count) == value_input_count.
#
#
#
#FailureMessage Object: 0x7fd5b3ffd9d0
==== C stack trace ===============================

    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1111883) [0x55b8d2107883]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1110b6b) [0x55b8d2106b6b]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x110c6f9) [0x55b8d21026f9]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x20413cd) [0x55b8d30373cd]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x2034222) [0x55b8d302a222]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x202ff44) [0x55b8d3025f44]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1e0b253) [0x55b8d2e01253]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1dfcd96) [0x55b8d2df2d96]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1df92aa) [0x55b8d2def2aa]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1df8b71) [0x55b8d2deeb71]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x11ce49b) [0x55b8d21c449b]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x121fb23) [0x55b8d2215b23]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1221359) [0x55b8d2217359]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1112f3b) [0x55b8d2108f3b]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x111792b) [0x55b8d210d92b]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x110df0f) [0x55b8d2103f0f]
    /lib/x86_64-linux-gnu/libc.so.6(+0x94ac3) [0x7fd5cb294ac3]
    /lib/x86_64-linux-gnu/libc.so.6(+0x126850) [0x7fd5cb326850]
```
2024-07-22 22:48:39 +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
Ivancing
3c40457820
fix(cli): add NAPI support in standalone mode (#24642)
Currently, importing Node-Addons modules in a standalone binary results
in a `missing symbol called` error
(https://github.com/denoland/deno/issues/24614). Because the NAPI
symbols are not exported in this mode. This PR should fix the issue.
2024-07-22 22:48:39 +02:00
Divy Srivastava
e10e9812d8
fix: CFunctionInfo and CTypeInfo leaks (#24634)
Trying out the deno_core patch

Ref https://github.com/denoland/deno_core/pull/832

Closes https://github.com/denoland/deno/issues/24575

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-22 22:48:39 +02:00
Nathan Whitaker
9b6959129a
fix(cli): Respect implied BYONM from DENO_FUTURE in deno task (#24652)
Regression from
04f9db5b22

Originally I thought to fix the issue in the PR we needed to explicitly
pass through the `node-modules-dir` flag, but after applying the correct
fix that david pointed out (setting `NPM_PROCESS_STATE`) that wasn't
necessary (or correct).

We had a test for deno task with BYONM, but it only tested with
`"unstable": ["byonm"]` in deno.json, so it didn't catch this.
2024-07-22 22:47:58 +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
David Sherret
1469d61055
fix(lsp): support npm workspaces and fix some resolution issues (#24627)
Makes the lsp use the same code as the rest of the cli.
2024-07-22 22:47:58 +02:00
David Sherret
0dac01be83
chore: fix ci (#24633) 2024-07-22 22:47:57 +02:00
David Sherret
4945714b71
fix(publish): surface syntax errors when using --no-check (#24620) 2024-07-22 22:47:57 +02:00
Nathan Whitaker
f310e51430
chore: fix flakey lifecycle scripts test (#24629)
Failed in
https://github.com/denoland/deno/actions/runs/9982978127/job/27589707376
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