Commit graph

11388 commits

Author SHA1 Message Date
Satya Rohith 02d0ff58d2
refactor(tests): move worker_threads itests to spec tests (#23648) 2024-05-03 05:52:47 +00:00
David Sherret 3e98ea4e69
chore(tests/specs): ability to have sub tests in file (#23667)
Allows writing named sub-tests. These are:

1. Filterable on the command line via `cargo test ...`
2. Run in parallel
3. Use a fresh temp and deno dir for each test (unlike steps)
2024-05-03 10:19:42 +05:30
David Sherret b7945a218e
chore: move cert itests to spec tests (#23607) 2024-05-03 00:43:12 +00:00
Bartek Iwańczuk cf0579c7d4
test: npm registry handles two test scopes (#23663)
This commit updates our testing npm registry to handle
additional `@denotest2` scope in addition to `@denotest`
scope. I might have to update it further in the future to handle
additional scopes, but it's good enough for now.
2024-05-03 00:00:38 +00:00
Leo Kettmeir 1b27b58396
fix(test): proper type checking for files with doc tests (#23654)
Closes https://github.com/denoland/deno/issues/23430

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-05-02 18:13:51 +00:00
Satya Rohith 811280af77
fix(ext/node): check resource exists before close (#23655) 2024-05-02 18:34:42 +05:30
Satya Rohith 56ba7f3c23
fix(ext/node): support delete process.env.var (#23647)
Closes https://github.com/denoland/deno/issues/23641
2024-05-02 06:40:22 +00:00
Nathan Whitaker 66b66de96a
fix(lsp): Catch cancellation exceptions thrown by TSC, stop waiting for TS result upon cancellation (#23645)
Fixes #23643.

We weren't catching the cancellation exception thrown by TSC on the JS
side, so the rust side was catching this exception and then attempting
to print out the exception via `toString`. That last bit resulted in a
cryptic `[object Object]` showing up in the logs like so:

```
Error during TS request "getCompletionEntryDetails":
  [object Object]
```

I'm not 100% sure how we weren't seeing this in the past. My guess is
that #23409 and the subsequent PR to improve the exception catching and
logging surfaced this, but I'm still not quite clear on it.

My initial fix here returned `null` to rust when a server request was
cancelled, but this resulted in a deserialization error when we
attempted to deserialize that into the expected response type. So now,
as soon as the request's cancellation token signals we'll stop waiting
for a response and return an error (which will get swallowed as the LSP
request is being cancelled).

I was a bit surprised to find that [this
branch](0c671c9792/cli/lsp/tsc.rs (L1093))
actually executes sometimes, I believe due to the fact that aborting a
future may not [immediately stop its
execution](https://docs.rs/futures/latest/futures/stream/struct.AbortHandle.html#method.abort).
2024-05-01 20:31:11 -07:00
Mathias Lafeldt ee122c5af6
feat(runtime): allow adding custom extensions to snapshot (#23569)
This makes `create_runtime_snapshot` more useful for embedders who add
their own extension(s) to the runtime in build scripts.

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-05-01 22:00:32 +00:00
Matt Mastracci 505130d813
chore(cli): add permission test (#23633) 2024-05-01 13:17:05 -06:00
David Sherret e0069c87c0
chore: make a couple repl tests less flaky (#23636)
These were both failing for me from time to time locally.
2024-05-01 16:37:17 +00:00
Nayeem Rahman f270e41aae
ci: use -A for wpt script (#23631)
Fixes CI. The wpt setup script writes to `/etc/hosts` which now needs
`--allow-all`. We use the latest release for the deno binary there so
it's only impacted as of the 1.43.0 release.
2024-05-01 09:15:29 -06:00
denobot 5ff881a073
1.43.0 (#23629)
Bumped versions for 1.43.0

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-05-01 12:16:39 +05:30
Divy Srivastava 4817fd983f
chore: 1.43 release notes (#23628)
Update release notes for 1.43.0. The crate versions have already been
bumped in the previous attempt.
2024-05-01 11:24:37 +05:30
Divy Srivastava 7f80d90f1c
Revert "refactor(lsp): move fields from Documents to LspResolver" (#23626)
This reverts commit 5cae343991.


![image](https://github.com/denoland/deno/assets/34997667/e68e40a1-7baf-453b-80d9-f8b6aae186c7)

Caused a +3.3s regression in one of the LSP benchmarks at
deno.land/benchmarks.
2024-05-01 05:54:25 +00:00
David Sherret 56bf634fa9
fix(node): require.resolve - fallback to global cache when bare specifier from paths not found (#23618)
Part of #22607 (probably closes it, but I haven't done thorough testing)

Makes it so that `require.resolve` with `paths` specified will fallback
to using the global cache when the paths can't be found when using a
global cache (not when using a node_modules folder)
2024-04-30 23:41:29 -04:00
David Sherret 486437fee1
refactor(jupyter): move communication methods out of data structs (#23622)
Moves the communication methods out of the data structs and onto the
`Connection` struct.
2024-05-01 02:30:40 +00:00
David Sherret f2216c90a7
chore: fix flaky module graph cache tests (#23623) 2024-05-01 01:36:52 +00:00
Nayeem Rahman ac9e07bdfa
chore(lsp): revert import map pre-resolution for jsxImportSource (#23619) 2024-05-01 01:44:20 +01:00
Leo Kettmeir 544d248c16
chore: update deno_doc (#23621) 2024-05-01 00:43:24 +00:00
David Sherret 641356bb16
fix(publish): handle variable declarations with a declare keyword (#23616) 2024-04-30 13:02:39 -07:00
Luca Casonato 6cdf81db7c
feat(cli): add support for jsxImportSourceTypes (#23419)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-04-30 18:12:35 +00:00
Kenta Moriuchi 8c3f8ba136
chore(tools): chmod +x for scripts (#23610) 2024-04-30 09:18:11 -06:00
Satya Rohith 0156f82e73
fix(ext/node): support multiple message listeners on MessagePort (#23600)
Closes https://github.com/denoland/deno/issues/23561
2024-04-30 16:59:39 +05:30
findmyhappy ce4a7773cc
docs: fix some typos in comments (#23520) 2024-04-30 17:59:56 +10:00
Satya Rohith 8503311641
fix(ext/node): read(0) before destroying http2stream (#23505)
This patch enables gRPC hello world client example to work.

Towards #23246 #3326
2024-04-30 07:49:29 +05:30
Nayeem Rahman 5cae343991
refactor(lsp): move fields from Documents to LspResolver (#23585) 2024-04-30 02:41:19 +01:00
Kenta Moriuchi 783533d2e3
FUTURE: remove import assertions support for JavaScript (#23541)
Ref #17944, https://github.com/swc-project/swc/issues/8893

TypeScript removes the `assert` keywords in the transpile, so this PR
only works for JavaScript files
2024-04-29 22:43:05 +02:00
David Sherret 4384a126bb
fix: handle specifying an import map in an ancestor dir of deno.json (#23602)
* https://github.com/denoland/deno_config/pull/51

Closes https://github.com/denoland/deno/issues/21440
2024-04-29 14:32:27 -04:00
David Sherret e6f4c8f531
fix(fmt/md): better handling of lists in block quotes (#23604)
* https://github.com/dprint/dprint-plugin-markdown/pull/94
2024-04-29 20:29:00 +02:00
David Sherret 48daf2dc88
chore: add tests for moduleGraph2 (#23603)
Also did some renames from underscores to hyphens
2024-04-29 14:09:58 -04:00
Leo Kettmeir 67d00fb1e3
fix: reenable syntax highlighting for doc html generator (#23570)
This was forgotten to be renabled a while back when we made it optional
2024-04-29 11:03:51 -07:00
Matt Mastracci 56fec538e1
fix(ext/http): ensure signal is created iff requested (#23601)
This correctly creates the `AbortSignal` regardless of when we request
it. If the signal is requested after the request has completed, the
signal is created in the aborted state.

Using GC counts, we can see a reduction in object creation:

This PR: 440
deno 1.42.4: 1650
deno 1.43.0+b02ffec: 874
2024-04-29 09:40:02 -06:00
David Sherret da52058a94
chore: migrate bench, publish, and more itests to spec tests (#23584) 2024-04-29 10:08:27 -04:00
Divy Srivastava b02ffec37c
fix(ext/node): exporting rsa public keys (#23596)
Initial support for exporting rsa public KeyObject.

Current assumption is that RSA keys are stored in pkcs1 der format in
key storage.

Ref https://github.com/denoland/deno/issues/23471 
Ref https://github.com/denoland/deno/issues/18928
Ref https://github.com/denoland/deno/issues/21124
2024-04-29 19:16:38 +05:30
David Sherret 7d93704591
refactor: remove conditional color code in bench reporter (#23593)
There is no need for this conditional code because it's handled by the
`colors` module.
2024-04-29 09:27:55 -04:00
Yoshiya Hinosawa 0b454056a8
refactor: remove dead code in node stream polyfill (#23597) 2024-04-29 19:55:51 +09:00
Satya Rohith b8444066ea
fix(ext/node): support NODE_DEBUG env (#23583) 2024-04-29 09:36:53 +00:00
Satya Rohith 455cf1743f
fix(ext/node): add support for MessagePort.removeListener/off (#23598)
Closes https://github.com/denoland/deno/issues/23564
2024-04-29 08:53:54 +00:00
Yoshiya Hinosawa 021a0dc9b1
chore(tools): update release template (#23582) 2024-04-28 20:22:17 +09:00
David Sherret 651e3e9e6d
fix(compile): certain jsr specifiers sometimes can't load (#23567)
When returning a jsr specifier for resolve it seems like deno core does
not work properly and hangs.

Closes https://github.com/denoland/deno/issues/23551
Closes https://github.com/denoland/deno/issues/23139
2024-04-27 21:11:57 +00:00
Nayeem Rahman e0f849289f
chore(lsp): remove ConfigSnapshot (#23579) 2024-04-27 21:35:41 +01:00
Yoshiya Hinosawa 8178f758bc
fix(ext/node): support process.stdin.unref() (#22865)
This PR adds private `[REF]()` and `[UNREF]()` methods to Stdin class,
and call them from Node.js polyfill layer (`TTY` class). This enables
`process.stdin.unref()` and `process.stdin.ref()` for the case when
stdin is terminal.

closes #21796
2024-04-27 20:25:18 +09:00
Bartek Iwańczuk e3d79c1703
test: cleanup npm test registry code (#23578)
Required for https://github.com/denoland/deno/pull/23560
2024-04-26 22:55:43 +02:00
Nayeem Rahman f8ddcc4f78
refactor(lsp): unify resolver types into LspResolver (#23514) 2024-04-26 21:39:33 +01:00
Leo Kettmeir c519355624
feat(ci): category & unstable tags checker (#23568) 2024-04-26 09:04:29 -07:00
Bartek Iwańczuk 0b0af5c635
test: update for private npm registry test server (#23572)
Factored out from https://github.com/denoland/deno/pull/23560 to make it
easier to review.
2024-04-26 15:41:53 +00:00
Matt Mastracci 8c9caeb418
chore: rework TLS code in test server (#23566)
In order to make the reqwest/rustls upgrade more straightforward, we
refactor the test server to depend on deno_tls.
2024-04-25 17:00:04 -04:00
Matt Mastracci 084eafe508
perf(ext/http): recover memory for serve and optimize AbortController (#23559)
Max rps without a signal is unchanged, however we can drastically reduce
memory usage by not creating the signal until needed, and we can
optimize the rps in the case where the signal is created.

With a quick memory benchmark, it looks like this helps pretty
drastically with # of GCs when benchmarking w/wrk:

 - 1.42.4: 1763
 - canary: 1093
 - this patch: 874

This branch:
```

Running 10s test @ http://localhost:8080/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    87.33us  439.95us  20.68ms   99.67%
    Req/Sec    66.70k     6.39k   74.11k    83.66%
  1340255 requests in 10.10s, 191.73MB read
Requests/sec: 132696.90
Transfer/sec:     18.98MB

cpu: Apple M2 Pro
runtime: deno 1.43.0 (aarch64-apple-darwin)

file:///Users/matt/Documents/scripts/bench_request.js
benchmark                                      time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------------------------------- -----------------------------
newRequest                                     986.5 ns/iter   1,013,682.6    (878.2 ns … 1.18 µs) 1.01 µs 1.18 µs 1.18 µs
newAbortController                                18 ns/iter  55,541,104.1    (15.6 ns … 42.62 ns) 17.71 ns 25.05 ns 26.27 ns
newAbortControllerSignal                       18.66 ns/iter  53,578,966.7   (16.49 ns … 32.16 ns) 18.71 ns 25.67 ns 26.39 ns
newAbortControllerSignalOnAbort               106.49 ns/iter   9,390,164.9  (97.87 ns … 120.61 ns) 108.6 ns 114.24 ns 115.89 ns
newAbortControllerSignalAddEventListener       86.92 ns/iter  11,504,880.2  (81.88 ns … 103.15 ns) 90 ns 98.28 ns 99.55 ns
newAbortControllerSignalOnAbortNoListener       3.01 µs/iter     331,964.4      (2.97 µs … 3.1 µs) 3.06 µs 3.1 µs 3.1 µs
newAbortControllerSignalOnAbortAbort            3.26 µs/iter     306,662.6     (3.22 µs … 3.36 µs) 3.27 µs 3.36 µs 3.36 µs


```

Latest canary:
```
Running 10s test @ http://localhost:8080/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    72.86us   71.23us   4.47ms   99.05%
    Req/Sec    64.66k     5.54k   72.48k    82.18%
  1299015 requests in 10.10s, 185.83MB read
Requests/sec: 128616.02
Transfer/sec:     18.40MB


cpu: Apple M2 Pro
runtime: deno 1.43.0+bc4aa5f (aarch64-apple-darwin)

file:///Users/matt/Documents/scripts/bench_request.js
benchmark                                      time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------------------------------- -----------------------------
newRequest                                      1.25 µs/iter     800,005.2     (1.01 µs … 4.18 µs) 1.16 µs 4.18 µs 4.18 µs
newAbortController                             18.56 ns/iter  53,868,204.3   (16.04 ns … 38.73 ns) 18.38 ns 26.1 ns 26.63 ns
newAbortControllerSignal                       18.72 ns/iter  53,430,746.1   (16.13 ns … 36.71 ns) 18.71 ns 26.19 ns 26.98 ns
newAbortControllerSignalOnAbort               193.91 ns/iter   5,156,992.4 (184.25 ns … 211.41 ns) 194.96 ns 207.87 ns 209.4 ns
newAbortControllerSignalAddEventListener      171.45 ns/iter   5,832,569.2    (153 ns … 182.03 ns) 176.17 ns 180.75 ns 181.05 ns
newAbortControllerSignalOnAbortNoListener       3.07 µs/iter     326,263.3     (2.98 µs … 3.17 µs) 3.08 µs 3.17 µs 3.17 µs
newAbortControllerSignalOnAbortAbort            3.32 µs/iter     301,344.6      (3.29 µs … 3.4 µs) 3.33 µs 3.4 µs 3.4 µs
```
2024-04-25 14:52:24 -04:00
David Sherret bc4aa5f901
fix(npm): do not panic hitting root dir while resolving npm package (#23556)
Closes https://github.com/denoland/deno/issues/23029
2024-04-25 14:13:55 +00:00