Commit Graph

11244 Commits

Author SHA1 Message Date
Matt Mastracci 9425dce6db
refactor(ext/http): extract 02_websocket.ts from 01_http.js (#23460)
Landing part of https://github.com/denoland/deno/pull/21903

This will allow us to more easily refactor `serveHttp` to live on top of
`serve` by splitting the websocket code out. There's probably a lot more
we could do here but this helps.
2024-04-19 20:02:39 -06:00
Nayeem Rahman 79e6751cf7
perf(lsp): only store parsed sources for open documents (#23454) 2024-04-20 02:00:03 +01:00
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 365e1f48f7
feat(ext/http): Add `addr` to HttpServer (#23442)
Adds an `addr` field to `HttpServer` to simplify the pattern
`Deno.serve({ onListen({ port } => listenPort = port })`. This becomes:
`const server = Deno.serve({}); port = server.addr.port`.

Changes:
- Refactors `serve` overloads to split TLS out (in preparation for
landing a place for the TLS SNI information)
- Adds an `addr` field to `HttpServer` that matches the `addr` field of
the corresponding `Deno.Listener`s.
2024-04-19 18:09:50 -06:00
dependabot[bot] 93a40c1c64
chore(deps): bump rustls from 0.21.10 to 0.21.11 (#23464)
Bumps [rustls](https://github.com/rustls/rustls) from 0.21.10 to
0.21.11.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="7b8d1dbc1e"><code>7b8d1db</code></a>
Prepare 0.21.11</li>
<li><a
href="ebcb4782f2"><code>ebcb478</code></a>
complete_io: bail out if progress is impossible</li>
<li><a
href="20f35dfb6d"><code>20f35df</code></a>
Regression test for <code>complete_io</code> infinite loop bug</li>
<li><a
href="2f2aae15a4"><code>2f2aae1</code></a>
Don't specially handle unauthenticated close_notify alerts</li>
<li><a
href="e163587b98"><code>e163587</code></a>
Don't deny warnings from nightly clippy</li>
<li><a
href="9f864874cf"><code>9f86487</code></a>
server::handy: fix new nightly clippy lint</li>
<li><a
href="7e0e8ab599"><code>7e0e8ab</code></a>
Correct assorted clippy warnings in test code</li>
<li><a
href="3587d98f4e"><code>3587d98</code></a>
Apply clippy suggestions from Rust 1.72</li>
<li><a
href="d082e837b3"><code>d082e83</code></a>
Address <code>clippy::redundant_static_lifetimes</code></li>
<li><a
href="5e7a06ca45"><code>5e7a06c</code></a>
Address <code>clippy::slow_vector_initialization</code></li>
<li>Additional commits viewable in <a
href="https://github.com/rustls/rustls/compare/v/0.21.10...v/0.21.11">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rustls&package-manager=cargo&previous-version=0.21.10&new-version=0.21.11)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts page](https://github.com/denoland/deno/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-19 18:08:31 -06:00
Nathan Whitaker b5ce9cda0d
perf(lsp): Avoid passing struct into op_resolve (#23452)
Going through serde_v8 is slow, so just pass the args separately.
`op_resolve` is especially hot, so any speedups are good.
2024-04-19 10:11:17 -07:00
Bartek Iwańczuk f4b5eec52e
feat: upgrade V8 to 12.4 (#23435) 2024-04-19 16:49:06 +02:00
Asher Gomez 05b49a803f
FUTURE: remove `Deno.customInspect` (#23453) 2024-04-19 20:50:18 +10:00
David Sherret c497e766f1
refactor: move redirect handling into deno_graph (#23444) 2024-04-19 01:43:28 +00:00
Nayeem Rahman 8e77f091ad
perf(lsp): cleanup document dependencies (#23426) 2024-04-19 00:51:16 +00:00
David Sherret 90688edcc2
fix(fmt): error for more unterminated nodes (#23449)
https://github.com/dprint/dprint-plugin-typescript/pull/628

Closes https://github.com/denoland/deno/issues/23438
2024-04-18 20:37:16 -04:00
Bartek Iwańczuk 6c90d2401b
fix(ext/node): remove unwraps from fallible conversions (#23447)
Removes `.unwrap()` calls from fallible conversion and replaces
with graceful error returns.
2024-04-18 23:53:03 +00:00
Bartek Iwańczuk 9e4ba982df
test: fix node_compat_test (#23446)
It's not clear to me how these tests worked correctly on CI,
 but they were failing hard locally because of two problems:
- missing env var that tests URL for fake npm registry
- trying to run a directory that contains native Node.js tests that
require a special harness
2024-04-19 01:42:18 +02:00
Bartek Iwańczuk 7b02f2aba6
test: deflake tests for rejection handled (#23448)
Fixes flakiness for rejection handled tests on Windows (7 failures in
the past day).
2024-04-18 23:40:15 +00:00
nokazn 3d841acf48
fix(cli): avoid `deno add` and `deno vendor` errors when deno.json is empty (#23439) 2024-04-18 15:48:15 -04:00
David Sherret c6d44dbda6
chore: make remaining submodules shallow (#23441) 2024-04-18 19:45:09 +00:00
Matt Mastracci d9d3f81f29
chore: remove unused, unstable 'http' namespace (#23436)
Landing parts of #21903 in preparation for the removal of serveHttp.
2024-04-18 11:21:25 -06:00
Bartek Iwańczuk 6a09a16d71
feat(ext/net): extract TLS key and certificate from interfaces (#23327)
Relands #23325
2024-04-18 11:21:08 -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
Asher Gomez 25a80bc523
test(publish): check specifiers outside fast check module graph (#23369)
Closes #23023
2024-04-17 23:46:33 +00:00
Nayeem Rahman 24fa5c784a
perf(lsp): release unused documents (#23398) 2024-04-17 21:40:42 +01:00
Nathan Whitaker 2dc3f6f57a
chore(lsp): Include new benchmark in the collected benchmark data (#23420)
So it will actually show up on the [deno benchmarks
site](http://deno.com/benchmarks)
2024-04-17 20:55:56 +01:00
Luca Casonato 71a1fa4c2e
fix(publish): support import equals (#23421) 2024-04-17 19:15:02 +00:00
Igor Zinkovsky b3d7df5535
perf: v8 code cache (#23081)
This PR enables V8 code cache for ES modules and for `require` scripts
through `op_eval_context`. Code cache artifacts are transparently stored
and fetched using sqlite db and are passed to V8. `--no-code-cache` can
be used to disable.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-04-17 07:19:55 -07:00
Asher Gomez 9acbf90b06
fix: allow WPT to successfully exit using `--exit-zero` (#23418)
I went with `--exit-zero`. Happy to change to `--no-exit` if feelings
are strong.

Supercedes #23417
2024-04-17 10:40:47 +00:00
Asher Gomez ebc22d9d7e
chore: update WPT (#23389)
It's best that this only gets merged with the latest version of the
suite, so there's little difference between the `ci` and `wpt_epoch`
workflows. This should make troubleshooting easier.
2024-04-17 09:33:05 +10:00
Matt Mastracci 9c0446567b
fix(cli): Identify and fix a test deadlock (#23411)
If a worker tried to flush large amounts of data right as the test was
ending, it could cause the flush sync marker to get lost.
2024-04-16 15:14:59 -06:00
Nathan Whitaker d01e4c43c8
fix(ci): Fix bench job (#23410)
Forgot to add the step to clone the new submodule added in #23395 😅.
2024-04-16 21:13:48 +00:00
David Sherret 43c8c1cc6e
feat(check): allow using side effect imports with unknown module kinds (ex. css modules) (#23392)
This allows people to use imports like:

```ts
import "./app.css";
```

...with `deno check` in systems where there's a bundle step (ex. Vite).
This will still error when using it with `deno run` or if the referenced
file does not exist.

See test cases for behaviour.
2024-04-16 16:46:31 -04:00
Nathan Whitaker 422cff1f24
chore(lsp): Add benchmark for performance on a large real-world repo (#23395)
This PR adds a benchmark intended to measure how the LSP handles larger
repos, as well as its performance on a more realistic workload.

The repo being benchmarked is
[deco-cx/apps](https://github.com/deco-cx/apps) which has been vendored
along with its dependencies. It's included as a git submodule as its
fairly large. The LSP requests used in the benchmark are the actual
requests sent by VSCode as I opened, modified, and navigated around a
file (to simulate an actual user interaction).

The main motivation is to have a more realistic benchmark that measures
how we do with a large number of files and dependencies. The
improvements made from 1.42 to 1.42.3 mostly improved performance with
larger repos, so none of our existing benchmarks showed an improvement.

Here are the results for the changes made from 1.42 to 1.42.3 (the new
benchmark is the last one listed):

**1.42.0**

```test
Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 379ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1142ms)
   - Find/Replace
      (10 runs, mean: 51ms)
   - Code Lens
      (10 runs, mean: 443ms)
   - deco-cx/apps Multiple Edits + Navigation
      (5 runs, mean: 25121ms)
<- End benchmarking lsp
```

**1.42.3**

```text
Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 383ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1135ms)
   - Find/Replace
      (10 runs, mean: 55ms)
   - Code Lens
      (10 runs, mean: 440ms)
   - deco-cx/apps Multiple Edits + Navigation
      (5 runs, mean: 11675ms)
<- End benchmarking lsp
```
2024-04-16 12:26:51 -07:00
Matt Mastracci c4d0fceec3
fix(cli): TestEventSender should be !Clone (#23405)
`TestEventSender` should not be Clone so we don't end up with multiple
copies of the same writer FD. This is probably not the cause of the test
channel lockups, but it's a lot easier to reason about.
2024-04-16 12:54:50 -06:00
Bartek Iwańczuk 760d64bc6b
fix(ext/node): worker_threads.receiveMessageOnPort doesn't panic (#23406)
Follow up to https://github.com/denoland/deno/pull/23386.
Instead of using async `recv()` method, it was replaced
with a poll based function that doesn't hold onto
RefCell borrow across await point.

Fixes https://github.com/denoland/deno/issues/23362
2024-04-16 18:41:03 +00:00
Asher Gomez 534dd34f86
fix: add `DENO_FUTURE` to `deno --help` (#23368) 2024-04-17 02:58:48 +10:00
Kenta Moriuchi 1e26508579
feat(ext/url): add `URL.parse` (#23318)
Closes #23069
2024-04-16 17:11:57 +02: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 55c27cadc8
test: add test for running in V8 jitless mode (#23054)
Fixes https://github.com/denoland/deno/issues/22453

This is fixed due to upgrade of deno_core, just adding
a test here.
2024-04-15 23:47:01 +00:00
Nayeem Rahman 9a31698207
fix(lsp): slice strings by byte index in code actions (#23387)
Fixes #23361.
2024-04-16 01:07:32 +02: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
David Sherret 46c709e52f
fix(check): cache bust when changing nodeModulesDir setting (#23355) 2024-04-15 18:58:04 -04:00
Bartek Iwańczuk b4257d6990
chore: upgrade deno_core to 0.275.0 (#23383) 2024-04-15 18:10:41 -04:00
David Sherret 6f278e5c40
fix(lsp): improved cjs tracking (#23374)
Our cjs tracking was a bit broken. It was marking stuff as esm that was
actually cjs leading to type checking errors.
2024-04-15 17:50:52 -04:00
Matt Mastracci 7e4ee02e2e
fix(ext/io): Fix NUL termination error in windows named pipes (#23379)
Due to a terminating NUL that was placed in a `r#` string, we were not
actually NUL-terminating pipe names on Windows. While this has no
security implications due to the random nature of the prefix, it would
occasionally cause random failures when the trailing garbage would make
the pipe name invalid.
2024-04-15 14:10:09 -06:00
Bartek Iwańczuk a080acc1b4
refactor: move lifecycle events dispatch to Rust (#23358)
This commit moves logic of dispatching lifecycle events (
"load", "beforeunload", "unload") to be triggered from Rust.
Before that we were executing scripts from Rust, but now we
are storing references to functions from "99_main.js" and calling
them directly.

Prerequisite for https://github.com/denoland/deno/issues/23342
2024-04-15 20:08:33 +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
David Sherret 1835b4f061
fix(lsp): ensure project version is incremented when config changes (#23366)
I'm running into a node resolution bug in the lsp only and while
tracking it down I noticed this one.

Fixed by moving the project version out of `Documents`.
2024-04-15 00:07:04 +00:00
Nayeem Rahman 8f1a92f3c3
refactor(lsp): use fallback resolution in op_resolve() (#23329) 2024-04-14 22:42:58 +01:00
David Sherret e277490c82
perf: do not clone swc `Program` when transpiling (#23365) 2024-04-14 17:15:17 -04:00
David Sherret 76df7d7c9b
fix(publish): do not error for param with initializer before required parameter (#23356)
* https://github.com/denoland/deno_graph/pull/440

Closes https://github.com/denoland/deno/issues/23331
2024-04-13 22:20:58 -04: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