summaryrefslogtreecommitdiff
path: root/ext
AgeCommit message (Collapse)Author
2023-05-22fix(ext/web): improve timers resolution for 0ms timeouts (#19212)Bartek Iwańczuk
This commit changes the implementation of `ext/web` timers, by using "op_void_async_deferred" for timeouts of 0ms. 0ms timeout is meant to be run at the end of the event loop tick and currently Tokio timers that we use to back timeouts have at least 1ms resolution. That means that 0ms timeout actually take >1ms. This commit changes that and runs 0ms timeout at the end of the event loop tick. One consequence is that "unrefing" a 0ms timer will actually keep the event loop alive (which I believe actually makes sense, the test we had only worked because the timeout took more than 1ms). Ref https://github.com/denoland/deno/issues/19034
2023-05-22fix(node): add http.Server.unref() (#19201)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/19113
2023-05-21feat(unstable): add more options to Deno.createHttpClient (#17385)Leo Kettmeir
2023-05-19feat(ext/http): ref/unref for server (#19197)Matt Mastracci
Add `ref` and `unref` to return value from `Deno.serve`. Unblocks #3326.
2023-05-18feat(ext/http): Add support for trailers w/internal API (HTTP/2 only) (#19182)Matt Mastracci
Necessary for #3326. Requested in #10214 as well.
2023-05-19BREAKING(unstable): change return type of Deno.serve() API (#19189)Bartek Iwańczuk
This commit changes the return type of an unstable `Deno.serve()` API to instead return a `Deno.Server` object that has a `finished` field. This change is done in preparation to be able to ref/unref the HTTP server.
2023-05-18fix(npm): `process` not defined in readline (#19184)Marvin Hagemeister
Issue was that we create node globals much later, so pulling `process` via a module import is the way to go. Fixes #19183
2023-05-18chore: forward v1.33.4 release commit to main (#19181)denobot
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED** This is the release commit being forwarded back to main for 1.33.4 Please ensure: - [x] Everything looks ok in the PR - [ ] The release has been published To make edits to this PR: ```shell git fetch upstream forward_v1.33.4 && git checkout -b forward_v1.33.4 upstream/forward_v1.33.4 ``` Don't need this PR? Close it. cc @levex Co-authored-by: levex <levex@users.noreply.github.com> Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-05-18fix(ext/websocket): order of ws writes (#19131)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/19041
2023-05-18refactor(napi): simplify types (#19179)Bartek Iwańczuk
This commit removes "Error" and "Result" structs from "ext/napi". In turn all NAPI functions now return "napi_status" instead of "napi::Result".
2023-05-18fix(ext/webidl): change createPromiseConverter (#16367)Marcos Casagrande
2023-05-18fix(cli/napi): handle finalizers (#19168)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/17325
2023-05-18fix(node): support passing parent stdio streams (#19171)Marvin Hagemeister
This is a bit bare bones but gets `npm-run-all` working. For full stdio compatibility with node more work is needed which is probably better done in follow up PRs. Fixes #19159
2023-05-17feat(ext/web): Request higher-resolution timer on Windows if user requests ↵Matt Mastracci
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-17fix(node): export diagnostics_channel module (#19167)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/19166
2023-05-17fix(ext/node): make nodeGlobalThis configurable (#19163)Luca Casonato
2023-05-17fix(ext/node): fix whatwg url formatting (#19146)Yoshiya Hinosawa
2023-05-17fix(node): export punycode module (#19151)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/19147
2023-05-17fix: support "fetch" over HTTPS for IP addresses (#18499)Bartek Iwańczuk
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-17refactor(node): reimplement http client (#19122)Leo Kettmeir
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-16fix(ext/http): Ensure cancelled requests don't crash Deno.serve (#19154)Matt Mastracci
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-16fix(fetch): Correctly decode `multipart/form-data` names and filenames (#19145)Andreu Botella
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-16fix(npm): add performance.markResourceTiming sham (#19123)Bartek Iwańczuk
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-16refactor(ext/http): simpler ws server in http_next (#19133)Luca Casonato
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-16feat(node/crypto): Builtin Diffie-Hellman Groups (#19137)Levente Kurusa
Towards #18455
2023-05-15feat(node/crypto): Diffie Hellman Support (#18943)Levente Kurusa
Support crypto.DiffieHellman class in ext/node/crypto
2023-05-15refactor(ext/http): generic abstract listeners (#19132)Luca Casonato
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-14refactor(core): bake single-thread assumptions into spawn/spawn_blocking ↵Matt Mastracci
(#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-12chore: forward v1.33.3 release commit to main (#19111)denobot
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED** This is the release commit being forwarded back to main for 1.33.3 Please ensure: - [x] Everything looks ok in the PR - [x] The release has been published To make edits to this PR: ```shell git fetch upstream forward_v1.33.3 && git checkout -b forward_v1.33.3 upstream/forward_v1.33.3 ``` Don't need this PR? Close it. cc @levex Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-05-11fix(ext/fs): add more context_path (#19101)David Sherret
2023-05-11fix(npm): make http2 module available, make 'nodeGlobalThisName' writable ↵Bartek Iwańczuk
(#19092)
2023-05-11fix(console): handle error when inspecting promise-like (#19083)Nayeem Rahman
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-11fix(node): expose channels in worker_threads (#19086)Marvin Hagemeister
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-10feat(compile): unstable npm and node specifier support (#19005)David Sherret
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-11feat(node): add `Module.runMain()` (#19080)Marvin Hagemeister
This PR adds the missing `Module.runMain()` function which is required for tools like `ts-node`. Fixes #19033
2023-05-10fix(node): conditional exports edge case (#19082)Bartek Iwańczuk
Fixes https://github.com/denoland/deno/issues/18743
2023-05-10refactor(ext/http): HTTP trait structs need to be public (#19075)Matt Mastracci
2023-05-10refactor(core): http_next generic over request extractor (#19071)Matt Mastracci
2023-05-10feat(ext/http): Automatic compression for Deno.serve (#19031)Matt Mastracci
`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-10chore(node/stream): unbundle/unminify readable-streams (#19045)Levente Kurusa
2023-05-09bench: fix benchmarks with extensions (#19059)Bartek Iwańczuk
They broke in f34fcd16ea4d504c8a87c0873c65598d70bb1d07
2023-05-09fix(core): let V8 drive extension ESM loads (#18997)Luca Casonato
This now allows circular imports across extensions. Instead of load + eval of all ESM files in declaration order, all files are only loaded. Eval is done recursively by V8, only evaluating files that are listed in `Extension::esm_entry_point` fields. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-09perf(fmt): faster formatting for minified object literals (#19050)David Sherret
Has fix for https://github.com/dprint/dprint-plugin-typescript/issues/520
2023-05-08refactor: prefix ops w/ crate they are defined in (#19044)Luca Casonato
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-08refactor(ext/fs): `deno_fs::FileSystem` - conditional `Send + Sync` (#18993)David Sherret
This allows for having a conditional `Send + Sync` on the file system trait for Deploy.
2023-05-08perf(ext/ffi): Use `Box<[NativeType]>` in CallbackInfo parameters (#19032)Aapo Alasuutari
2023-05-08fix(ext/http): Ensure Deno.serve works across --watch restarts (#18998)Matt Mastracci
Fixes #16699 and #18960 by ensuring that we release our HTTP `spawn_local` tasks when the HTTP resource is dropped. Because our cancel handle was being projected from the resource via `RcMap`, the resource was never `Drop`ped. By splitting the handle out into its own `Rc`, we can avoid keeping the resource alive and let it drop to cancel everything.
2023-05-07chore: lint ext/fs/std_fs.rs (#19036)Bartek Iwańczuk
2023-05-07fix(ext/ffi): Callbacks panic on returning isize (#19022)Aapo Alasuutari
2023-05-07fix(ext/ffi): UnsafeCallback can hang with 'deno test' (#19018)Aapo Alasuutari