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

922 commits

Author SHA1 Message Date
Matt Mastracci
09a1fda8e4 fix(ext/web): add stream tests to detect v8slice split bug (#20253)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-08-24 09:01:07 -06:00
David Sherret
1dd571578c refactor: upgrade deno_ast 0.28 and deno_semver 0.4 (#20193) 2023-08-21 18:23:28 +05:30
Divy Srivastava
9771a9e825 chore: remove third_party submodule (#20201)
removes third_party submodule, tools are installed on-demand.

- removed `load_test` and websocket benchmark (covered by benchy)
- removed node/bun http benchmarks (covered by benchy)
- `dlint` & `dprint` downloaded on-demand. 
- `wrk` & `hyperfine` downloaded before CI benchmark run. 
   Install locally using: `./tools/install_prebuilt.js wrk hyperfine`

#### updating dlint/dprint

update version in `tools/util.js` and place binary in
`denoland/deno_third_party`.
2023-08-21 18:23:28 +05:30
Marcos Casagrande
3b4efd339d perf(ext/event): optimize Event constructor (#20181)
This PR optimizes `Event` constructor

- ~Added a fast path for empty `eventInitDict`~ Removed `EventInit`
dictionary converter
- Don't make `isTrusted` a
[LegacyUnforgeable](https://webidl.spec.whatwg.org/#LegacyUnforgeable)
property. Doing so makes it non-spec compliant but calling
`Object/Reflect.defineProperty` on the constructor is a big bottleneck.
Node did the same a few months ago
https://github.com/nodejs/node/pull/46974. In my opinion, the
performance gains are worth deviating from the spec for a
browser-related property.

**This PR**

```
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
------------------------------------------------------------------------------- -----------------------------
event constructor no init      36.69 ns/iter  27,257,504.6   (33.36 ns … 42.45 ns)  37.71 ns  39.61 ns  40.07 ns
event constructor               36.7 ns/iter  27,246,776.6   (33.35 ns … 56.03 ns)  37.73 ns  40.14 ns  41.74 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
------------------------------------------------------------------------------- -----------------------------
event constructor no init     380.48 ns/iter   2,628,275.8 (366.66 ns … 399.39 ns) 384.58 ns 398.27 ns 399.39 ns
event constructor             480.33 ns/iter   2,081,882.6 (466.67 ns … 503.47 ns) 484.27 ns 501.28 ns 503.47 ns
```

```js
Deno.bench("event constructor no init", () => {
  const event = new Event("foo");
});

Deno.bench("event constructor", () => {
  const event = new Event("foo", { bubbles: true, cancelable: false });
});
```

towards https://github.com/denoland/deno/issues/20167
2023-08-21 18:23:27 +05:30
await-ovo
3ba09eacd2 fix(runtime): navigator.userAgent in web worker (#20129)
Fixes https://github.com/denoland/deno/issues/20079

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-08-21 18:23:27 +05:30
Marcos Casagrande
7895d154c3 fix(ext/fetch): clone second branch chunks in Body.clone() (#20057)
This PR makes `Body.clone()` spec compliant:
https://fetch.spec.whatwg.org/#concept-body-clone

> 1, Let « out1, out2 » be the result of
[teeing](https://streams.spec.whatwg.org/#readablestream-tee) body’s
[stream](https://fetch.spec.whatwg.org/#concept-body-stream).
> ...
> To tee a
[ReadableStream](https://streams.spec.whatwg.org/#readablestream)
stream, return ?
[ReadableStreamTee](https://streams.spec.whatwg.org/#readable-stream-tee)(stream,
true).

---
Closes #10994
2023-08-21 18:23:27 +05:30
Matt Mastracci
3abe95baf4 chore: deno_core -> 0.201.0 (#20135) 2023-08-21 18:23:27 +05:30
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
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
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
Ricardo Iván Vieitez Parra
98403691d1
fix: call setIsTrusted for generated events (MessageEvent) (#19919)
This addresses issue #19918.

## Issue description

Event messages have the wrong isTrusted value when they are not
triggered by user interaction, which differs from the browser. In
particular, all MessageEvents created by Deno have isTrusted set to
false, even though it should be true.

This is my first ever contribution to Deno, so I might be missing
something.
2023-07-31 23:22:07 +02:00
Marcos Casagrande
ee7f36afdb
fix(ext/compression): throw TypeError on corrupt input (#19979)
`TypeError` should be thrown when decompressing a corrupt input
2023-07-30 09:15:29 -04:00
Bartek Iwańczuk
a9951e360c
refactor(cli/tools): split bench into multiple modules (#19974)
I was asked to add "iter/s" to the benchmark output, before attempting
that I wanted to split this into multiple modules.
2023-07-28 11:27:10 -04:00
Leo Kettmeir
cbfa98ea0b
feat(ext/websocket): allow HTTP(S) protocol in URL (#19862)
Closes #19093
2023-07-28 06:29:41 +00:00
Bartek Iwańczuk
01f0d03ae8
refactor: rename built-in node modules from ext:deno_node/ to node: (#19680)
Closes https://github.com/denoland/deno/issues/19510
2023-07-02 20:19:30 +02:00
Leo Kettmeir
805497a9a5
feat: ReadableStream.from (#19446)
Closes #19417
2023-07-02 19:30:05 +02:00
Lino Le Van
17ddf2f97c
feat(ext/url): URLSearchParams two-argument delete() and has() (#19654) 2023-07-02 17:26:48 +02:00
Luca Casonato
d8e8e60f9f
feat(ext/fetch): add Headers#getSetCookie (#13542)
Spec change: https://github.com/whatwg/fetch/pull/1346
Tests: https://github.com/web-platform-tests/wpt/pull/31442 (ran against
this PR and they all pass)

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-07-02 13:20:56 +02:00
Matt Mastracci
93b3ff0170
fix(ext/websocket): Ensure that errors are available after async response returns (#19642)
Fixes the WPT tests that test w/invalid codes. Also explicitly ignoring
some h2 tests to hopefully prevent flakes.

The previous changes to WebSocketStream introduced a bug where the close
errors were not made available if the `pull` method was re-entrant.
2023-06-29 07:24:01 -06:00
Kenta Moriuchi
e16b74d792
chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
Matt Mastracci
fa935e553a
chore: Ensure copyright line is the first in the file (#19608)
The copyright checker was allowing files with code above the copyright
line in a few places, mainly as a result of IDEs ordering imports
improperly.

This makes the check more robust, and adds a whitelist of valid lines
that may appear before the copyright line.
2023-06-26 09:38:55 -06:00
Martin Fischer
801b9ec62d
chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
Bartek Iwańczuk
3fe44a50c3
chore: disable /websocket/stream/tentative/close.any.worker.html?wss (#19606)
This test is very flaky.
2023-06-25 11:21:23 +02:00
Divy Srivastava
4a18c76135
fix(ext/node): support brotli APIs (#19223)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-24 19:42:08 +05:30
VlkrS
ea97af312f
feat: Adaptations to support OpenBSD port (#19153) 2023-06-12 13:14:27 +03:00
Bartek Iwańczuk
a4c760702b
chore: update release doc template (#19441)
That action is not working properly.
2023-06-09 14:59:15 +02:00
Leo Kettmeir
4bc95427b9
chore: update wpt (#19422) 2023-06-08 22:56:05 +02:00
Matt Mastracci
40d77c5605
chore(core): build_bench tool (#19387)
This is a quick tool that I've been using to build benchmarking builds
for Deno.

Usage:

Build a benchmark `HEAD~1` and `origin/main` executable:

```sh
deno run tools/build_bench.ts HEAD~1 origin/main
```

Build debug benchmark executables of the last three commits:

```sh
deno run tools/build_bench.ts --profile debug HEAD HEAD~1 HEAD~2
```
2023-06-06 18:53:41 +00:00
Levente Kurusa
11dd5a0ae7
fix(ext/crypto): fix JWK import of Ed25519 (#19279)
Fixes: #18049

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-05 14:52:02 +02:00
Aapo Alasuutari
98461e2559
chore(tools): Add core import-map (#19346)
Adds an import map of the core and ext JavaScript files. This was
created manually but a script to create one automatically wouldn't be
too much of a big thing either.

This should make working on especially the Node polyfills much more
pleasant, as it gives you feedback on if your imports are correct.
Unfortunately the TypeScript declaration files of some of the internal
modules clash with the import map and override the data from the actual
files with data from the declaration files. Those do not contain all
exports nor is their data always up to date. Still, this is much better
than not having one.
2023-06-02 09:38:36 -04:00
Hirotaka Tagawa / wafuwafu13
0104741d6f
chore(node_compat): fix path strings generated by setup.ts (#19347) 2023-06-02 15:05:32 +09:00
Matt Mastracci
11791ee260
chore(core): Update certs for WPT (#19351) 2023-06-01 21:32:07 -06:00
Hirotaka Tagawa / wafuwafu13
1a0445dc6b
chore(node_compat): add deno task for setting up and running tests (#19293) 2023-06-01 17:31:06 +09:00
David Sherret
047edf6a75
ci: bump CI cache version on CLI version bump (#19318)
Automatically bump the CI cache version
2023-05-30 17:09:07 -04:00
Bartek Iwańczuk
d90a75c036
fix: use proper ALPN protocols if HTTP client is HTTP/1.1 only (#19303)
Closes https://github.com/denoland/deno/issues/16923

---------

Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-05-29 23:05:45 +02:00
Leo Kettmeir
be59e93220
refactor(node/http): don't use readablestream for writing to request (#19282)
Refactors the internal usage of a readablestream to write to the
resource directly

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-27 15:42:20 +02:00
Hirotaka Tagawa / wafuwafu13
0a3d355ce6
chore(node_compat): fix broken link and typo (#19265) 2023-05-26 05:00:29 +02:00
Bartek Iwańczuk
5874fc3d0a
feat: add support for globs in the config file and CLI arguments for files (#19102)
Follow up to https://github.com/denoland/deno/pull/19084.

This commit adds support for globs in the configuration file as well 
as CLI arguments for files. 

With this change users can now use glob syntax for "include" and 
"exclude" fields, like so:

```json
{
  "lint": {
    "include": [
      "directory/test*.ts",
      "other_dir/"
    ],
    "exclude": [
      "other_dir/foo*.ts",
      "nested/nested2/*"
    ]
  },
  "test": {
    "include": [
      "data/test*.ts",
      "nested/",
      "tests/test[1-9].ts"
    ],
    "exclude": [
      "nested/foo?.ts",
      "nested/nested2/*"
    ]
  }
}
```

Or in CLI args like so:
```
// notice quotes here; these values will be passed to Deno verbatim
// and deno will perform glob expansion

$ deno fmt --ignore="data/*.ts"
$ deno lint "data/**/*.ts"
```

Closes https://github.com/denoland/deno/issues/17971
Closes https://github.com/denoland/deno/issues/6365
2023-05-23 03:39:59 +02:00
Marcos Casagrande
b0f13560cb
fix(ext/webidl): change createPromiseConverter (#16367) 2023-05-18 17:05:11 +03:00
Yoshiya Hinosawa
243d9c846d
fix(ext/node): fix whatwg url formatting (#19146) 2023-05-17 14:51:51 +09:00
Leo Kettmeir
867a6d3032
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-17 01:20:32 +02:00
Levente Kurusa
1171c54952
feat(node/crypto): Builtin Diffie-Hellman Groups (#19137)
Towards #18455
2023-05-16 00:07:58 +02:00
Levente Kurusa
3356173d00
feat(node/crypto): Diffie Hellman Support (#18943)
Support crypto.DiffieHellman class in ext/node/crypto
2023-05-15 19:41:53 +02:00
Yoshiya Hinosawa
0ccfccdcd2
chore: check node_compat config diff in CI (#19119) 2023-05-15 21:22:53 +09:00
Matt Mastracci
9845361153
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-14 15:40:01 -06:00
Bartek Iwańczuk
cf6f965e25
chore: upgrade rusty_v8 to 0.71.2 (#19116)
Closes https://github.com/denoland/deno/issues/19021
2023-05-13 21:11:40 +02:00
Yoshiya Hinosawa
ab88dc2c68
chore(ext/node): removed skipped compat test cases (#19109) 2023-05-13 15:26:16 +09:00
Yoshiya Hinosawa
2a0c664840
chore: fix & update node compat config (#19106) 2023-05-13 14:49:11 +09:00
Matt Mastracci
d55e07f627
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-10 21:35:42 +02:00