1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-29 16:30:56 -05:00
Commit graph

9319 commits

Author SHA1 Message Date
David Sherret
968f91b01d
fix(npm): improved optional dependency support (#19135)
Note: If the package information has already been cached, then this
requires running with `--reload` or for the registry information to be
fetched some other way (ex. the cache busting).

Closes #15544

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-18 17:05:03 +02:00
Matt Mastracci
5f85f742a8
feat(ext/web): Request higher-resolution timer on Windows if user requests setTimeout w/short delay (#19149)
If a timer is requested with <=100ms resolution, request the high-res
timer. Since the default Windows timer period is 15ms, this means a
100ms timer could fire at 115ms (15% late). We assume that timers longer
than 100ms are a reasonable cutoff here.

The high-res timers on Windows are still limited. Unfortuntely this
means that our shortest duration 4ms timers can still be 25% late, but
without a more complex timer system or spinning on the clock itself,
we're somewhat bounded by the OS' scheduler itself.
2023-05-18 17:05:03 +02:00
Bartek Iwańczuk
840779a4ea
fix(node): export diagnostics_channel module (#19167)
Closes https://github.com/denoland/deno/issues/19166
2023-05-18 17:05:03 +02:00
Luca Casonato
af8c26c166
fix(ext/node): make nodeGlobalThis configurable (#19163) 2023-05-18 17:05:03 +02:00
Yoshiya Hinosawa
06b5f950d7
fix(ext/node): fix whatwg url formatting (#19146) 2023-05-18 17:05:03 +02:00
Bartek Iwańczuk
8eee726097
fix(node): export punycode module (#19151)
Closes https://github.com/denoland/deno/issues/19147
2023-05-18 17:05:03 +02:00
Heyang Zhou
d45ca4cd7a
fix(kv): kv.close() interrupts in-flight operations (#19076)
Fixes https://github.com/denoland/deno/issues/19049
2023-05-18 17:05:02 +02:00
Bartek Iwańczuk
2e90110859
fix: support "fetch" over HTTPS for IP addresses (#18499)
This commit adds support for connecting to IP addresses over HTTPS.

This is done by updating "rustls" to "0.21.0" and other related crates.

Closes https://github.com/denoland/deno/issues/7660
Closes https://github.com/denoland/deno/issues/17967

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-05-18 17:05:02 +02:00
Leo Kettmeir
96c30f8afc
refactor(node): reimplement http client (#19122)
This commit reimplements most of "node:http" client APIs using
"ext/fetch".

There is some duplicated code and two removed Node compat tests that
will be fixed in follow up PRs.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-18 17:05:02 +02:00
Matt Mastracci
48df2f5e05
fix(ext/http): Ensure cancelled requests don't crash Deno.serve (#19154)
Fixes for various `Attemped to access invalid request` bugs (#19058,
#15427, #17213).

We did not wait for both a drop event and a completion event before
removing items from the slab table. This ensures that we do so.

In addition, the slab methods are refactored out into `slab.rs` for
maintainability.
2023-05-18 17:05:02 +02:00
Andreu Botella
5c117a9c15
fix(fetch): Correctly decode multipart/form-data names and filenames (#19145)
Currently the `multipart/form-data` parser in
`Request.prototype.formData` and `Response.prototype.formData` decodes
non-ASCII filenames incorrectly, as if they were encoded in Latin-1
rather than UTF-8. This happens because the header section of each
`multipart/form-data` entry is decoded as Latin-1 in order to be parsed
with `Headers`, which only allows `ByteString`s, but the names and
filenames are never decoded correctly. This PR fixes this as a
post-processing step.

Note that the `multipart/form-data` parsing for this APIs in the Fetch
spec is very much underspecified, and it does not specify that names and
filenames must be decoded as UTF-8. However, it does require that the
bodies of non-`File` entries are decoded as UTF-8, and in browsers,
names and filenames always use the same encoding as the body.

Closes #19142.
2023-05-18 17:05:02 +02:00
Lenni
d7361ed573
docs: fix typos (#19118) 2023-05-18 17:05:02 +02:00
Bartek Iwańczuk
e89f08d13d
fix(npm): add performance.markResourceTiming sham (#19123)
This commit shams "performance.markResourceTiming" API by
using a noop function. It is done to provide compatibility with
"npm:undici" package. We should look into actually implementing
this API properly, but I wanted to unblock support for "undici" and
"astro" for now.

Ref https://github.com/denoland/deno/issues/19065
2023-05-18 17:05:02 +02:00
Levente Kurusa
b25c716fab
fix(deno/upgrade): allow --version vX.Y.Z (#19139)
Instead of just supporting X.Y.Z, support vX.Y.Z. Otherwise we'll try to
download something like vvX.Y.Z
2023-05-18 17:05:02 +02:00
Luca Casonato
17b4e0627c
refactor(ext/http): simpler ws server in http_next (#19133)
Merges `op_http_upgrade_next` and `op_ws_server_create`, significantly
simplifying websocket construction in ext/http (next), and removing one
JS -> Rust call. Also WS server now doesn't bypass
`HttpPropertyExtractor`.
2023-05-18 17:05:02 +02:00
Levente Kurusa
4df46b7056
feat(node/crypto): Builtin Diffie-Hellman Groups (#19137)
Towards #18455
2023-05-18 17:05:02 +02:00
Levente Kurusa
b15cc76aba
feat(node/crypto): Diffie Hellman Support (#18943)
Support crypto.DiffieHellman class in ext/node/crypto
2023-05-18 17:05:02 +02:00
Luca Casonato
f7ef08b6ef
refactor(ext/http): generic abstract listeners (#19132)
Improve abstractions around listeners to support listener + connection
network stream combinations not previously possible (for example a
listener exposed as a Tcp, creating Unix network streams).
2023-05-18 17:05:01 +02:00
Yoshiya Hinosawa
6e9c95785d
chore: check node_compat config diff in CI (#19119) 2023-05-18 17:05:01 +02:00
Matt Mastracci
3392a8e530
refactor(core): bake single-thread assumptions into spawn/spawn_blocking (#19056)
Partially supersedes #19016.

This migrates `spawn` and `spawn_blocking` to `deno_core`, and removes
the requirement for `spawn` tasks to be `Send` given our single-threaded
executor.

While we don't need to technically do anything w/`spawn_blocking`, this
allows us to have a single `JoinHandle` type that works for both cases,
and allows us to more easily experiment with alternative
`spawn_blocking` implementations that do not require tokio (ie: rayon).

Async ops (+~35%):

Before: 

```
time 1310 ms rate 763358
time 1267 ms rate 789265
time 1259 ms rate 794281
time 1266 ms rate 789889
```

After:

```
time 956 ms rate 1046025
time 954 ms rate 1048218
time 924 ms rate 1082251
time 920 ms rate 1086956
```

HTTP serve (+~4.4%):

Before:

```
Running 10s test @ http://localhost:4500
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    68.78us   19.77us   1.43ms   86.84%
    Req/Sec    68.78k     5.00k   73.84k    91.58%
  1381833 requests in 10.10s, 167.36MB read
Requests/sec: 136823.29
Transfer/sec:     16.57MB
```

After:

```
Running 10s test @ http://localhost:4500
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    63.12us   17.43us   1.11ms   85.13%
    Req/Sec    71.82k     3.71k   77.02k    79.21%
  1443195 requests in 10.10s, 174.79MB read
Requests/sec: 142921.99
Transfer/sec:     17.31MB
```

Suggested-By: alice@ryhl.io
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-18 17:05:01 +02:00
yzy-1
e61ee44d69
fix(runtime): Example hello_runtime panic (#19125)
After commit f34fcd, running example will panic because esm_entry_point
is not set.

Closes https://github.com/denoland/deno/issues/19127
2023-05-18 17:05:01 +02:00
Yoshiya Hinosawa
e0b4ccab78
fix(dts): move BroadcastChannel type to lib.deno.unstable.d.ts (#19108) 2023-05-18 17:05:01 +02:00
Bartek Iwańczuk
6e655522cd
fix(lsp): increase default max heap size to 3Gb (#19115) 2023-05-18 17:05:01 +02:00
Bartek Iwańczuk
91f3dba709
chore: upgrade rusty_v8 to 0.71.2 (#19116)
Closes https://github.com/denoland/deno/issues/19021
2023-05-18 17:05:01 +02:00
Yoshiya Hinosawa
070a100fa5
chore(ext/node): removed skipped compat test cases (#19109) 2023-05-18 17:05:01 +02:00
Yoshiya Hinosawa
7095e449cd
chore: fix & update node compat config (#19106) 2023-05-18 17:05:01 +02:00
David Sherret
995b1e683f
refactor(lsp): make RequestMethod private (#19114) 2023-05-18 17:04:49 +02:00
denobot
12ba2d311b
1.33.3 (#19110)
Bumped versions for 1.33.3

Please ensure:
- [x] Target branch is correct (`vX.XX` if a patch release, `main` if
minor)
- [x] Crate versions are bumped correctly
- [x] deno_std version is incremented in the code (see
`cli/deno_std.rs`)
- [x] Releases.md is updated correctly (think relevancy and remove
reverts)

To make edits to this PR:
```shell
git fetch upstream release_1_33.3 && git checkout -b release_1_33.3 upstream/release_1_33.3
```

cc @levex

---------

Co-authored-by: levex <levex@users.noreply.github.com>
Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-05-12 13:06:53 +02:00
Bartek Iwańczuk
f9cc0c7149
chore: upgrade rusty_v8 to 0.71.1 (#19104)
Fixes https://github.com/denoland/deno/issues/19021
2023-05-12 04:12:41 +02:00
David Sherret
8ca92f5ca2 fix(lsp): preload documents when deno.documentPreloadLimit changes (#19103) 2023-05-11 21:53:36 -04:00
David Sherret
3f8bbc60e1 fix(ext/fs): add more context_path (#19101) 2023-05-11 19:46:20 -04:00
David Sherret
a193794eab feat(lsp): ability to configure document pre-load limit (#19097)
Adds a `deno.preloadLimit` option (ex. `"deno.preloadLimit": 2000`)
which specifies how many file entries to traverse on the file system
when the lsp loads or its configuration changes.

Closes #18955
2023-05-11 17:26:32 -04:00
Bartek Iwańczuk
ddf59b5345 fix(npm): make http2 module available, make 'nodeGlobalThisName' writable (#19092) 2023-05-11 17:26:32 -04:00
David Sherret
90ed487965 fix(lsp): hard to soft error when unable to get completion info (#19091) 2023-05-11 17:26:31 -04:00
Miroslav Bajtoš
b11c322b89 chore: upgrade thiserror and deno_lockfile (#19073)
Upgrade `thiserror` to `1.40.0`.

Remove version pinning so that consumers of deno crates can install
newer versions of `thiserrors` without waiting for us to upgrade our
Cargo.toml.

Upgrade `deno_lockfile` to `0.14.0` to bring in `thiserror` upgrade, see
https://github.com/denoland/deno_lockfile/pull/1.
2023-05-11 17:26:31 -04:00
David Sherret
ba7fd57616 fix(cli): upgrade to Typescript 5.0.4 (#19090) 2023-05-11 17:26:31 -04:00
Nayeem Rahman
14bf8dc506 fix(console): handle error when inspecting promise-like (#19083)
Fixes
https://discord.com/channels/684898665143206084/684911491035430919/1105900195406958672.

This was caused by: 
- A `TypeError` from `core.getPromiseDetails()` for promise-likes which
also lead to that code path.
- Swallowing internal formatting errors by returning `undefined`. I've
made it so that a special message is formatted in that case instead
(note that this case is fixed now):
![image](https://github.com/denoland/deno/assets/29990554/65bb9612-60b2-4e31-bf5e-e20976601593)
2023-05-11 17:26:30 -04:00
Nayeem Rahman
89d0f0c4e3 fix(runtime): ChildProcess::kill() doesn't require additional perms (#15339)
Fixes #15217.
2023-05-11 17:26:30 -04:00
Yarden Shoham
3a0b2075f7 chore(deps): bump tokio version to 1.28.1 (#19069) 2023-05-11 17:26:30 -04:00
Marvin Hagemeister
ff1403c0a1 fix(node): expose channels in worker_threads (#19086)
This PR ensures that node's `worker_threads` module exports
`MessageChannel`, `MessagePort` and the `BroadcastChannel` API. Fixing
these won't make `esbuild` work, but brings us one step closer 🎉

Fixes #19028 .
2023-05-11 17:26:30 -04:00
David Sherret
75735fbf7f feat(compile): unstable npm and node specifier support (#19005)
This is the initial support for npm and node specifiers in `deno
compile`. The npm packages are included in the binary and read from it via
a virtual file system. This also supports the `--node-modules-dir` flag,
dependencies specified in a package.json, and npm binary commands (ex.
`deno compile --unstable npm:cowsay`)

Closes #16632
2023-05-11 17:26:30 -04:00
Marvin Hagemeister
56a9a2a990 feat(node): add Module.runMain() (#19080)
This PR adds the missing `Module.runMain()` function which is required
for tools like `ts-node`.

Fixes #19033
2023-05-11 17:26:29 -04:00
Bartek Iwańczuk
610936f5b2 fix(node): conditional exports edge case (#19082)
Fixes https://github.com/denoland/deno/issues/18743
2023-05-11 17:26:29 -04:00
David Sherret
72512c95c1 fix(dts): align seekSync position arg with seek (#19077)
Closes #19060
2023-05-11 17:26:29 -04:00
Matt Mastracci
5907d959af chore(core): Parallelize all WPT tests and reduce timeouts for expected failures (#19061)
This speeds up WPT tests in two ways:

1. The `WebCryptoAPI` tests are slow, so create a parallel bucket for
each individual test instead of one for all the `WebCryptoAPI` tests.
2. If a test is expected to fail, use a shorter timeout (1 minute rather
than 4).
2023-05-11 17:26:29 -04:00
Matt Mastracci
c2faca2584 refactor(ext/http): HTTP trait structs need to be public (#19075) 2023-05-11 17:26:29 -04:00
Bartek Iwańczuk
84dc93529e chore(core): fix a warning (#19072) 2023-05-11 17:26:29 -04:00
Matt Mastracci
e6e0fa752d refactor(core): http_next generic over request extractor (#19071) 2023-05-11 17:26:28 -04:00
Matt Mastracci
a650318c0c feat(ext/http): Automatic compression for Deno.serve (#19031)
`Content-Encoding: gzip` support for `Deno.serve`. This doesn't support
Brotli (`br`) yet, however it should not be difficult to add. Heuristics
for compression are modelled after those in `Deno.serveHttp`.

Tests are provided to ensure that the gzip compression is correct. We
chunk a number of different streams (zeros, hard-to-compress data,
already-gzipped data) in a number of different ways (regular, random,
large/small, small/large).
2023-05-11 17:26:28 -04:00
Levente Kurusa
8278df52e4 chore(node/stream): unbundle/unminify readable-streams (#19045) 2023-05-11 17:26:28 -04:00