1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
Commit graph

9928 commits

Author SHA1 Message Date
Marcos Casagrande
e071382768
perf(ext/node): cache IncomingMessageForServer.headers (#20147)
This PR adds caching to node's `req.headers`

```js
import express from "npm:express";
const app = express();

app.get("/", function (req, res) {
  const ua = req.header("User-Agent");
  const auth = req.header("Authorization");
  const type = req.header("Content-Type");
  const ip = req.header("X-Forwarded-For");
  res.end();
});

app.listen(3000);
```

**this PR**
```
wrk -d 10s --latency http://127.0.0.1:3000
Running 10s test @ http://127.0.0.1:3000
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   155.64us  152.14us   5.74ms   97.39%
    Req/Sec    35.00k     1.97k   39.10k    80.69%
  Latency Distribution
     50%  123.00us
     75%  172.00us
     90%  214.00us
     99%  563.00us
  703420 requests in 10.10s, 50.31MB read
Requests/sec:  69648.45
Transfer/sec:      4.98MB
```

**main**
```
wrk -d 10s --latency http://127.0.0.1:3000
Running 10s test @ http://127.0.0.1:3000
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   217.95us  786.89us  26.26ms   98.23%
    Req/Sec    32.32k     2.54k   37.19k    87.13%
  Latency Distribution
     50%  130.00us
     75%  191.00us
     90%  232.00us
     99%    1.88ms
  649411 requests in 10.10s, 46.45MB read
Requests/sec:  64300.44
Transfer/sec:      4.60MB
```
2023-08-14 15:14:02 +02:00
Kira
ca9ba87d99
fix(cli) error gracefully when script arg is not present and --v8-flags is present in deno run (#20145)
Fix #20022, fix #19627 (duplicate)

#17333 upgraded clap from version 3.1 to version 4. clap version 3.2.0
(intentionally) broke a behavior that deno was relying on to make `deno
run --v8-flags=--help` work without specifying a file, see
clap-rs/clap#3793. The workaround was to make the script argument
required _unless_ `--v8-flags` is present. This broke the expectation
that all successfully parsed `run` commands have the script argument
set, leading to the panic on
`matches.remove_many::<String>("script_arg").unwrap()`.

Clap, as far as I was able to find out, does not currently offer a neat
solution to this problem. This PR adds logic to create and return a
custom clap error when a parsed run command does not have the script
argument.

I added an appropriate test.
2023-08-13 04:04:17 +02:00
Matt Mastracci
babfba14ef
chore: deno_core -> 0.201.0 (#20135) 2023-08-12 19:04:45 +00:00
Marcos Casagrande
050ca39409
perf(ext/request): optimize validate and normalize HTTP method (#20143)
This PR optimizes `Request` constructor init method step. It doubles the
speed for known lowercased methods. I also added `PATCH` to known
methods

**this patch**

```
benchmark                   time (avg)        iter/s             (min … max)       p75       p99      p995
---------------------------------------------------------------------------- -----------------------------
method: GET                  1.49 µs/iter     669,336.9     (1.35 µs … 2.02 µs)   1.54 µs   2.02 µs   2.02 µs
method: PATCH                1.85 µs/iter     540,921.5     (1.65 µs … 2.02 µs)   1.91 µs   2.02 µs   2.02 µs
method: get                  1.49 µs/iter     669,067.9     (1.28 µs … 1.69 µs)   1.55 µs   1.69 µs   1.69 µs
```

**main**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)

benchmark                   time (avg)        iter/s             (min … max)       p75       p99      p995
---------------------------------------------------------------------------- -----------------------------
method: GET                   1.5 µs/iter     665,232.3      (1.3 µs … 2.02 µs)   1.54 µs   2.02 µs   2.02 µs
method: PATCH                2.47 µs/iter     404,052.7     (2.06 µs … 4.05 µs)   2.51 µs   4.05 µs   4.05 µs
method: get                     3 µs/iter     333,277.2     (2.72 µs … 4.04 µs)   3.05 µs   4.04 µs   4.04 µs
```

```js
Deno.bench("method: GET", () => {
  const r = new Request("https://deno.land", {
    method: "GET",
  });
});

Deno.bench("method: PATCH", () => {
  const r = new Request("https://deno.land", {
    method: "PATCH",
    body: '{"foo": "bar"}',
  });
});

Deno.bench("method: get", () => {
  const r = new Request("https://deno.land", {
    method: "get",
  });
});
```
2023-08-12 12:29:00 -06:00
Marcos Casagrande
b34bd640a6
perf(ext/headers): use regex.test instead of .exec (#20125)
This PR improves the performance of `Headers.get` by using `Regex.test`
instead of `.exec`. Also replaced the `Map` used for caching with an
object which is a bit faster

**This patch**

```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)

benchmark              time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------- -----------------------------
Headers.get           124.71 ns/iter   8,018,687.3 (115.11 ns … 265.66 ns) 126.05 ns 136.12 ns 142.37 ns
```

**1.36.1**

```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.0 (x86_64-unknown-linux-gnu)

benchmark              time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------- -----------------------------
Headers.get           218.91 ns/iter   4,568,172.3 (165.37 ns … 264.44 ns) 241.62 ns 260.94 ns 262.67 ns
```

```js
const headers = new Headers({
  "Content-Type": "application/json",
  "Date": "Thu, 10 Aug 2023 07:45:10 GMT",
  "X-Deno": "Deno",
  "Powered-By": "Deno",
  "Content-Encoding": "gzip",
  "Set-Cookie": "__Secure-ID=123; Secure; Domain=example.com",
  "Content-Length": "150",
  "Vary": "Accept-Encoding, Accept, X-Requested-With",
});

Deno.bench("Headers.get", () => {
  headers.get("x-deno");
});
```
2023-08-12 10:42:23 -06:00
Marcos Casagrande
f843a1fdff
perf(ext/headers): cache iterableHeaders for immutable Headers (#20132)
This PR caches `_iterableHeaders` for immutable `Headers` increasing the
performance of `fetch` & server if headers are iterated.

Should close #19466 

I only cached immutable headers to address this comment
https://github.com/denoland/deno/issues/19466#issuecomment-1589892373
since I didn't find any occurrence of header mutation on immutable
headers. We can discuss caching for non-immutable, but I think this is a
great first step.

## BENCHMARK

### Server
```js
const addr = Deno.args[0] ?? "127.0.0.1:4500";
const [hostname, port] = addr.split(":");
const { serve } = Deno;

serve({ hostname, port: Number(port), reusePort: true }, (req) => {
  const headers = [...req.headers]; // req.headers are immutable, cannot set/append/delete
  return new Response("ok");
});

```
Used `wrk` with 5 headers
```
wrk -d 10s --latency -H "X-Deno: true" -H "Accept: application/json" -H "X-Foo: bar" -H "User-Agent: wrk" -H "Accept-Encoding: gzip, br" http://127.0.0.1:4500
```


**This patch**
```
Running 10s test @ http://127.0.0.1:4500
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    70.18us   22.89us 679.00us   81.37%
    Req/Sec    71.55k     9.69k   82.18k    89.60%
  Latency Distribution
     50%   59.00us
     75%   89.00us
     90%   98.00us
     99%  159.00us
  1437891 requests in 10.10s, 193.35MB read
Requests/sec: 142369.83
Transfer/sec:     19.14MB
```
**main**
```
Running 10s test @ http://127.0.0.1:4500
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   112.78us   36.47us   2.09ms   77.99%
    Req/Sec    44.30k     1.65k   49.14k    74.26%
  Latency Distribution
     50%   99.00us
     75%  136.00us
     90%  162.00us
     99%  213.00us
  890588 requests in 10.10s, 118.91MB read
Requests/sec:  88176.37
Transfer/sec:     11.77MB
```
### fetch

```js
const res = await fetch('http://127.0.0.1:4500');
Deno.bench("Headers iterator", () => {
  const i = [...res.headers]; // res.headers are immutable, cannot set/append/delete
});
```

**this patch**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)

benchmark             time (avg)        iter/s             (min … max)       p75       p99      p995
---------------------------------------------------------------------- -----------------------------
Headers iterator      329.5 ns/iter   3,034,909.0 (318.55 ns … 364.34 ns)  331.1 ns 355.72 ns 364.34 ns
```
**main**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)

benchmark             time (avg)        iter/s             (min … max)       p75       p99      p995
---------------------------------------------------------------------- -----------------------------
Headers iterator       2.59 µs/iter     386,372.1     (2.56 µs … 2.68 µs)   2.59 µs   2.68 µs   2.68 µs
```
2023-08-12 10:42:06 -06:00
Marcos Casagrande
396498bf9e
perf(ext/request): optimize Request constructor (#20141)
This PR optimizes `Request` constructor when `init` is not empty. This
path is also used by `fetch` when `options` argument is used
```js
fetch("https://deno.land", {
  method: "POST",
  body: 'land'
});
```

- Removed 3 extra calls to `headerListFromHeaders`
- Avoid `Object.keys` & `headerList` clone if `init.headers` is set
- Only empty `headersList` (`.splice`) if it's not already empty. 

## Benchmarks

**this patch**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)

benchmark                    time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------------- -----------------------------
Request without headers       1.86 µs/iter     536,440.7     (1.67 µs … 2.76 µs)   1.89 µs   2.76 µs   2.76 µs
Request with headers          1.96 µs/iter     509,440.5     (1.83 µs … 2.17 µs)   1.99 µs   2.17 µs   2.17 µs
```

**main**

```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)

benchmark                    time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------------- -----------------------------
Request without headers       1.96 µs/iter     510,201.5     (1.81 µs … 2.64 µs)      2 µs   2.64 µs   2.64 µs
Request with headers          2.03 µs/iter     493,526.6     (1.84 µs … 2.31 µs)   2.08 µs   2.31 µs   2.31 µs
```

```js
Deno.bench("Request without headers", () => {
  const r = new Request("https://deno.land", {
    method: "POST",
    body: '{"foo": "bar"}',
  });
});

Deno.bench("Request with headers", () => {
  const r = new Request("https://deno.land", {
    method: "POST",
    body: '{"foo": "bar"}',
    headers: {
      "Content-Type": "application/json",
    },
  });
});
```
2023-08-12 10:41:07 -06:00
Divy Srivastava
33dc5d2622
fix(node): implement TLSSocket._start (#20120)
Closes https://github.com/denoland/deno/issues/19983
Closes https://github.com/denoland/deno/issues/18303
Closes https://github.com/denoland/deno/issues/16681
Closes https://github.com/denoland/deno/issues/19978
2023-08-11 11:57:41 +00:00
Divy Srivastava
2f00b0add4
fix(ext/node): support dictionary option in zlib init (#20035)
Fixes https://github.com/denoland/deno/issues/19540
2023-08-11 11:42:35 +00:00
Divy Srivastava
65db8814c3
fix(node): object keys in publicEncrypt (#20128)
Fixes https://github.com/denoland/deno/issues/19935
2023-08-11 07:34:23 +00:00
Bartek Iwańczuk
634f5ccd49
perf(http): use Cow<[u8]> for setting header (#20112) 2023-08-10 15:35:01 -06:00
Bartek Iwańczuk
69387f0b0c
fix(node): don't print warning on process.dlopen.flags (#20124)
Closes https://github.com/denoland/deno/issues/20075
2023-08-10 20:19:20 +02:00
Marcos Casagrande
6b1a976181
perf(ext/http): use ServeHandlerInfo class instead of object literal (#20122)
This PR improves performance of `Deno.Serve` when providing `info`
argument by creating `ServeHandlerInfo` class instead of creating an
object literal with a getter on every request.

```js
Deno.serve((_req, info) => new Response(info.remoteAddr.transport) });
```

### Benchmarks
```
wrk -d 10s --latency http://127.0.0.1:4500
Running 10s test @ http://127.0.0.1:4500
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    42.34us   16.30us   1.66ms   95.88%
    Req/Sec   118.17k     2.95k  127.38k    76.73%
  Latency Distribution
     50%   38.00us
     75%   41.00us
     90%   56.00us
     99%   83.00us
  2375298 requests in 10.10s, 319.40MB read
Requests/sec: 235177.04
Transfer/sec:     31.62MB
```

**main**
```
wrk -d 10s --latency http://127.0.0.1:4500
Running 10s test @ http://127.0.0.1:4500
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    78.86us  211.06us   3.58ms   96.52%
    Req/Sec   105.90k     4.35k  117.41k    78.22%
  Latency Distribution
     50%   41.00us
     75%   53.00us
     90%   62.00us
     99%    1.18ms
  2127534 requests in 10.10s, 286.09MB read
Requests/sec: 210647.49
Transfer/sec:     28.33MB
```

```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.0 (x86_64-unknown-linux-gnu)

benchmark                 time (avg)        iter/s             (min … max)       p75       p99      p995
-------------------------------------------------------------------------- -----------------------------
new ServeHandlerInfo      3.43 ns/iter 291,508,889.3    (3.07 ns … 12.21 ns)   3.42 ns   3.84 ns   3.87 ns
{} with getter           133.84 ns/iter   7,471,528.9   (92.9 ns … 458.95 ns) 132.45 ns 364.96 ns 429.43 ns
```


----
### Drawbacks:

`.remoteAddr` is now not enumerable

```
ServeHandlerInfo {}
```
vs
```
{ remoteAddr: [Getter] }
```
It'll break any code trying to iterate through `info` keys (Doubt
there's anyone doing it though)

```js
Deno.serve((req, info) => {
  console.log(Object.keys(info).length === 0) // true;
  return new Response("yes");
});
2023-08-10 19:45:55 +02:00
Marcos Casagrande
2d3d0a579d
perf(ext/headers): optimize getHeader using for loop (#20115)
This PR optimizes the `getHeader` function by replacing `.filter` and
`.map` with a `for` loop

**this patch**

```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.0 (x86_64-unknown-linux-gnu)

benchmark        time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------- -----------------------------
Headers.get      132.2 ns/iter   7,564,093.4 (125.81 ns … 147.66 ns) 133.79 ns 144.92 ns 145.36 ns
```

**main**

```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.0 (x86_64-unknown-linux-gnu)

benchmark        time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------- -----------------------------
Headers.get     191.48 ns/iter   5,222,523.6 (182.75 ns … 212.22 ns)  193.5 ns 205.96 ns 211.51 ns
```

```js

const headers = new Headers({
  "Content-Type": "application/json",
  "Date": "Thu, 10 Aug 2023 07:45:10 GMT",
  "X-Deno": "Deno",
  "Powered-By": "Deno",
  "Content-Encoding": "gzip",
  "Set-Cookie": "__Secure-ID=123; Secure; Domain=example.com",
  "Content-Length": "150",
  "Vary": "Accept-Encoding, Accept, X-Requested-With",
});

Deno.bench("Headers.get", () => {
  const i = headers.get("x-deno");
});
```
2023-08-10 19:41:09 +02:00
Divy Srivastava
94d664535b
chore: forward v1.36.1 to main (#20119)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2023-08-10 16:44:41 +03:00
Divy Srivastava
91dc6fa5f1
chore: upgrade fastwebsockets to 0.4.4 (#19089)
Fixes https://github.com/denoland/deno/issues/19041
2023-08-10 09:59:06 +05:30
Bartek Iwańczuk
8f854782b1
fix(ext/timers): some timers are not resolved (#20055)
Fixes https://github.com/denoland/deno/issues/19866
2023-08-10 04:01:35 +00:00
Bartek Iwańczuk
2507d6fa10
fix(node/async_hooks): don't pop async context frame if stack if empty (#20077)
Closes https://github.com/denoland/deno/issues/20076
2023-08-10 09:00:25 +05:30
Bartek Iwańczuk
04a259e2c8
fix(test): handle ASCII escape chars in test name (#20081)
Handles ASCCI espace chars in test and bench name making
test and bench reporting more reliable. This one is also tested
in the fixture of "node:test" module.
2023-08-10 01:40:34 +02:00
Marcos Casagrande
414274b68a
perf(ext/headers): use .push loop instead of spread operator (#20108) 2023-08-09 19:36:47 -04:00
Matt Mastracci
08109b1d86
chore(test_util): Increate pty timeout to 15s to avoid flakes (#20109)
Mac builds are occasionally flaking out on these.
2023-08-09 12:49:05 -06:00
Matt Mastracci
2ed85c7dd6
refactor(ext/cache): Remove custom shutdown and use fast async ops (#20107)
The original implementation of `Cache` used a custom `shutdown` method
on the resource, but to simplify fast streams work we're going to move
this to an op of its own.

While we're in here, we're going to replace `opAsync` with
`ensureFastOps`. `op2` work will have to wait because of some
limitations to our async support, however.
2023-08-09 17:45:35 +00:00
Matt Mastracci
ddfcf1add4
refactor(ext/fetch): Remove FetchRequestBodyResource from FetchHandler interface (#20100)
This is unused and will allow us to remove `FetchRequestBodyResource` in
a future PR.
2023-08-09 10:47:47 -06:00
Luca Casonato
03e963f578
chore: rename some helpers on the Fs trait (#20097)
Rename some of the helper methods on the Fs trait to be suffixed with
`_sync` / `_async`, in preparation of the introduction of more async
methods for some helpers.

Also adds a `read_text_file_async` helper to complement the renamed
`read_text_file_sync` helper.
2023-08-08 16:28:18 -04:00
Yusuke Tanaka
f2e30a6f79
refactor(cli): move snapshot_from_lockfile function to deno_npm (#20024)
This commit moves `snapshot_from_lockfile` function to [deno_npm
crate](https://github.com/denoland/deno_npm). This allows this function
to be called outside Deno CLI (in particular, Deno Deploy).
2023-08-08 10:07:29 -07:00
David Sherret
05f838a57c
refactor: use deno_cache_dir crate (#20092)
Uses https://github.com/denoland/deno_cache/pull/26
2023-08-08 14:23:02 +00:00
David Sherret
a037ed77a2
fix(fmt): do not insert expr stmt leading semi-colon in do while stmt body (#20093)
This is for when semiColons: false

Closes #20089
2023-08-08 09:15:19 -04:00
Marcos Casagrande
557b11b765
fix(ext/abort): trigger AbortSignal events in correct order (#20095)
This PR ensures that the original signal event is fired before any
dependent signal events.

---
The enabled tests fail on `main`:

```
assert_array_equals: Abort events fired in correct order expected property 0 to be 
"original-aborted" but got "clone-aborted" (expected array ["original-aborted", "clone-aborted"] 
got ["clone-aborted", "original-aborted"])
```
2023-08-08 12:05:42 +02:00
Nayeem Rahman
7ce8c2a1f1
build: remove redundant rerun-if-changed for compiler snapshot (#20094)
Not sure why `40_testing.js` is there. The other two `00_typescript.js`
and `99_main_compiler.js` should be covered by
`files_loaded_during_snapshot` at the end.

This helps with `__runtime_js_sources` wrt changing `40_testing.js`.
2023-08-08 09:21:54 +02:00
David Sherret
b9b0386948
feat(unstable): rename deno_modules to vendor (#20065)
Renames the unstable `deno_modules` directory and corresponding settings
to `vendor` after feedback. Also causes the vendoring of the
`node_modules` directory which can be disabled via
`--node-modules-dir=false` or `"nodeModulesDir": false`.
2023-08-06 21:56:56 -04:00
David Sherret
7b5bc87f29
fix(unstable): vendor cache should support adding files to hashed directories (#20070)
This changes the design of the manifest.json file to have a separate
"folders" map for mapping hashed directories. This allows, for example,
to add files in a folder like `http_localhost_8000/#testing_5de71/` and
have them be resolved automatically as long as their remaining
components are identity-mappable to the file system (not hashed). It
also saves space in the manifest.json file by only including the hashed
directory instead of each descendant file.

```
// manifest.json
{
  "folders": {
    "https://localhost/NOT_MAPPABLE/": "localhost/#not_mappable_5cefgh"
  },
  "modules": {
    "https://localhost/folder/file": {
      "headers": {
        "content-type": "application/javascript"
      }
    },
  }
}

// folder structure
localhost
  - folder
    - #file_2defn (note: I've made up the hashes in these examples)
  - #not_mappable_5cefgh
    - mod.ts
    - etc.ts
    - more_files.ts
```
2023-08-06 12:25:48 -04:00
Nayeem Rahman
c1c8eb3d55
build: allow disabling snapshots for dev (#20048)
Closes #19399 (running without snapshots at all was suggested as an
alternative solution).

Adds a `__runtime_js_sources` pseudo-private feature to load extension
JS sources at runtime for faster development, instead of building and
loading snapshots or embedding sources in the binary. Will only work in
a development environment obviously.

Try running `cargo test --features __runtime_js_sources
integration::node_unit_tests::os_test`. Then break some behaviour in
`ext/node/polyfills/os.ts` e.g. make `function cpus() {}` return an
empty array, and run it again. Fix and then run again. No more build
time in between.
2023-08-06 01:47:15 +02:00
Nayeem Rahman
b96f283064
refactor: remove snapshot_module_load_cb (#20043) 2023-08-05 23:00:38 +00:00
Matt Mastracci
85a2b281f5
chore: use zlib-ng for flate2 (#20059)
Extracted from PR #16011
2023-08-05 15:43:16 -06:00
Marcos Casagrande
a1280c36c2
chore(wpt): expose gc (#20060)
This PR exposes garbage collector for WPT

see:
3d80f7e879/common/gc.js (L34-L36)


```
/streams/readable-streams/garbage-collection.any.html


test stderr:
Tests are running without the ability to do manual garbage collection. They will still work, but coverage will be suboptimal.
Tests are running without the ability to do manual garbage collection. They will still work, but coverage will be suboptimal.
Tests are running without the ability to do manual garbage collection. They will still work, but coverage will be suboptimal.
Tests are running without the ability to do manual garbage collection. They will still work, but coverage will be suboptimal.


file result: ok. 4 passed; 0 failed; 0 expected failure; total 4 (255ms)

----------------------------------------
/streams/readable-streams/garbage-collection.any.worker.html


test stderr:
Tests are running without the ability to do manual garbage collection. They will still work, but coverage will be suboptimal.
Tests are running without the ability to do manual garbage collection. They will still work, but coverage will be suboptimal.
Tests are running without the ability to do manual garbage collection. They will still work, but coverage will be suboptimal.
Tests are running without the ability to do manual garbage collection. They will still work, but coverage will be suboptimal.


file result: ok. 4 passed; 0 failed; 0 expected failure; total 4 (277ms)
```

This PR removes that warning and improves coverage.
2023-08-05 23:34:14 +02:00
David Sherret
6b0f75d1f5
fix(unstable): vendor cache override should handle forbidden windows directory names (#20069)
Meant to do this earlier.
2023-08-05 17:34:07 -04:00
Matt Mastracci
8ae7062931
fix(ext/http): serveHttp brotli compression level should be fastest (#20058)
Use brotli's fastest mode rather than default mode
2023-08-04 12:39:39 -06:00
Luca Bruno
72d9f06090
chore(cargo): update async-compression/flate2/miniz to latest (#20049)
This bumps `async-compression` dependency in `deno_http` to latest, in
order to avoid having multiple duplicate versions.
Related, it also unpin a stale `flate2` dependency so that the whole
chain of `async-compression` -> `flate2` -> `miniz_oxide` can surface up
to current versions.
The lockfile entries for all of the above crates have been update
accordingly; the new tree of dependencies looks like this:
```
$ cargo tree -i -p miniz_oxide

miniz_oxide v0.7.1
└── flate2 v1.0.26
    └── async-compression v0.4.1
```
2023-08-04 18:30:14 +02:00
Luca Bruno
5abf4cd951
fix(ext/http): unify default gzip compression level (#20050)
This tweaks the HTTP response-writer in order to align the two possible
execution flows into using the same gzip default compression level, that
is `1` (otherwise the implicit default level is `6`).
2023-08-04 17:28:32 +02:00
Yoshiya Hinosawa
8a175a780a
fix(test): make test runner work when global setTimeout is replaced (#20052) 2023-08-04 22:29:04 +09:00
Bartek Iwańczuk
6405b5f454
fix(node): polyfill process.title (#20044)
Closes https://github.com/denoland/deno/issues/19777
2023-08-04 14:31:13 +02:00
Bartek Iwańczuk
8d8a89ceea
fix(node): repl._builtinLibs (#20046)
Ref https://github.com/denoland/deno/issues/19733
2023-08-04 14:30:48 +02:00
Marcos Casagrande
5311f69bbb
fix(ext/file): resolve unresolved Promise in Blob.stream (#20039)
This PR fixes some crashing WPT tests due to an unresolved promise.

---
This could be a [stream spec](https://streams.spec.whatwg.org) bug

When `controller.close` is called on a byob stream, there's no cleanup
of pending `readIntoRequests`. The only cleanup of pending
`readIntoRequests` happen when `.byobRequest.respond(0)` is called, it
happens
here:6ba245fe25/ext/web/06_streams.js (L2026)
which ends up calling `readIntoRequest.closeSteps(chunk);` in
6ba245fe25/ext/web/06_streams.js (L2070)



To reproduce:

```js
async function byobRead() {
  const input = [new Uint8Array([8, 241, 48, 123, 151])];
  const stream = new ReadableStream({
    type: "bytes",
    async pull(controller) {
      if(input.length === 0) {
        controller.close();
        // controller.byobRequest.respond(0); // uncomment for fix 
        return 
      }
      controller.enqueue(input.shift())
    },
  });

  const reader = stream.getReader({ mode: 'byob' });
  const r1 = await reader.read(new Uint8Array(64));
  console.log(r1);
  const r2 = await reader.read(new Uint8Array(64));
  console.log(r2);
}

await byobRead();
```

Running the script triggers:
```
error: Top-level await promise never resolved
```
2023-08-04 13:57:54 +02:00
Bartek Iwańczuk
53ab6c004a
fix(test): use only a single timeout for op sanitizers (#20042)
Chipping away at making tests faster. Appears we don't need double
timeout before sanitizing ops. This should cut baseline cost of running a test
by half.
2023-08-04 10:05:15 +02:00
Bartek Iwańczuk
433ecc9047
refactor: rewrite http_next ops to use op2 macro (#19934)
Ref #19915

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-03 20:36:32 +00:00
Matt Mastracci
7f8bf2537d
refactor(ext/fetch): refactor fetch to use new write_error method (#20029)
This is a prerequisite for fast streams work -- this particular resource
used a custom `mpsc`-style stream, and this work will allow us to unify
it with the streams in `ext/http` in time.

Instead of using Option as an internal semaphore for "correctly
completed EOF", we allow code to propagate errors into the channel which
can be picked up by downstream sinks like Hyper. EOF is signalled using
a more standard sender drop.
2023-08-03 14:27:25 -06:00
Matt Mastracci
0f07dc95f1
chore: fix pty support on Macs (#20037)
Many of the CI tests have been failing on my M2 Pro mac (Ventura 13.4)
when running inside of a vscode terminal (a strange `ENOTTY` error).
This modifies the pty-handling code to use libc directly rather than the
older pty library that appears mostly unmaintained (outside of
@littledivy's fork).

As a bonus, this should allow us to run pty tests on the mac CI runner.

After this PR, the tests now complete with 100% success on my local
machine. Before this PR, I needed to pass `CI=true` to get my local test
suite to pass.
2023-08-03 14:04:37 -06:00
denobot
6ba245fe25
1.36.0 (#20036)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-08-03 18:26:25 +02:00
Asher Gomez
6fb7e8d93b
feat(permissions): add "--deny-*" flags (#19070)
This commit adds new "--deny-*" permission flags. These are complimentary to
"--allow-*" flags.

These flags can be used to restrict access to certain resources, even if they
were granted using "--allow-*" flags or the "--allow-all" ("-A") flag.

Eg. specifying "--allow-read --deny-read" will result in a permission error,
while "--allow-read --deny-read=/etc" will allow read access to all FS but the
"/etc" directory.

Runtime permissions APIs ("Deno.permissions") were adjusted as well, mainly
by adding, a new "PermissionStatus.partial" field. This field denotes that
while permission might be granted to requested resource, it's only partial (ie.
a "--deny-*" flag was specified that excludes some of the requested resources).
Eg. specifying "--allow-read=foo/ --deny-read=foo/bar" and then querying for
permissions like "Deno.permissions.query({ name: "read", path: "foo/" })"
will return "PermissionStatus { state: "granted", onchange: null, partial: true }",
denoting that some of the subpaths don't have read access.

Closes #18804.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-08-03 13:19:19 +02:00
Bartek Iwańczuk
db287e216d
refactor: use '--reporter' and '--junit-path' flags for 'deno test' (#20031)
This commit adds "--reporter" and "--junit-path" flags to "deno test"
subcommand instead of using "--dot" and "--junit" flags.
2023-08-02 22:05:34 -04:00