Commit graph

9185 commits

Author SHA1 Message Date
Matt Mastracci e2761df3fe
fix(ext/http): internal upgradeHttpRaw works with "Deno.serve()" API (#18859)
Fix internal "upgradeHttpRaw" API restoring capability to upgrade HTTP
connection in polyfilles "node:http" API.
2023-04-27 00:58:18 +02:00
David Sherret a8b4e346b4
refactor(ext/node): use a snapshottable global name for Node's globalThis (#18860) 2023-04-26 18:53:13 -04:00
Bartek Iwańczuk 7415aff983
bench: fix more benchmarks (#18864) 2023-04-26 21:59:32 +00:00
Nayeem Rahman 3d8a4d3b81
feat(cli): don't check permissions for statically analyzable dynamic imports (#18713)
Closes #17697
Closes #17658
2023-04-26 16:23:28 -04:00
David Sherret c2f5c09692
chore: fix benchmarks (#18863) 2023-04-26 19:09:28 +00:00
Bartek Iwańczuk 77e25a656e
refactor(core): simplify op types and codegeneration (#18843)
About 2% improvement on WS/HTTP benchmarks, possibly unlocking more
optimizations in the future.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-04-26 20:02:27 +02:00
Bartek Iwańczuk 14aaa73c02
refactor: don't expose Deno[Deno.internal].core namespace (#18816) 2023-04-26 19:57:38 +02:00
Ryan Dahl 2df6db36c8
feat(ext/kv): add more atomic operation helpers (#18854)
Co-authored-by: losfair <zhy20000919@hotmail.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-04-26 17:14:01 +00:00
David Sherret 55a9977c62
refactor(compile): remove usage of ProcState and CliOptions (#18855) 2023-04-26 13:07:15 -04:00
Divy Srivastava 5f7db93d0b
perf(ext/http): optimize away code based on callback length (#18849)
hello world on macOS:

```
divy@mini ~> 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    80.82us   42.95us   2.91ms   96.40%
    Req/Sec    56.91k     1.94k   60.77k    95.54%
  Latency Distribution
     50%   77.00us
     75%   89.00us
     90%  105.00us
     99%  146.00us
  1143455 requests in 10.10s, 138.49MB read
Requests/sec: 113212.38
Transfer/sec:     13.71MB

divy@mini ~> 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    88.63us   78.77us   2.55ms   98.72%
    Req/Sec    54.84k     2.16k   57.35k    98.51%
  Latency Distribution
     50%   80.00us
     75%   93.00us
     90%  109.00us
     99%  249.00us
  1102313 requests in 10.10s, 133.51MB read
Requests/sec: 109136.61
Transfer/sec:     13.22MB
```

Expected to have a larger impact on Linux
2023-04-26 22:11:54 +05:30
Bartek Iwańczuk 17d1c7e444
Revert "chore(ext/websocket): Add autobahn|testsuite fuzzingclient (#… (#18856)
…18846)"

This reverts commit 036778c2e8.

Keeps failing on `main` branch.
2023-04-26 15:48:23 +00:00
Matt Mastracci 38681dfa88
perf(ext/http): optimize for zero or one-packet response streams (#18834)
Improve `deno_reactdom_ssr_flash.jsx` by optimizing for zero/one-packet response streams.
2023-04-26 15:33:30 +02:00
Bartek Iwańczuk 1b450015e7
BREAKING(unstable): remove "Deno.serve(handler, options)" overload (#18759)
In preparation to stabilization of the API this overload was decided to
be removed.
2023-04-26 14:54:03 +02:00
Divy Srivastava 036778c2e8
chore(ext/websocket): Add autobahn|testsuite fuzzingclient (#18846)
Closes #17242
2023-04-26 17:55:48 +05:30
Divy Srivastava fbefceeb56
perf(ext/http): use smi for slab IDs (#18848) 2023-04-26 15:38:13 +05:30
Divy Srivastava 18170f2326
perf(ext/http): avoid spread arg deopt in op_http_wait (#18850)
2% improvement on macOS hello world.
2023-04-26 15:37:57 +05:30
Divy Srivastava 9d7e3f84c8
chore(ext/websocket): remove ping frame handling (#18847)
Automatically done in the fastwebsockets crate
2023-04-26 15:37:38 +05:30
Bartek Iwańczuk 106e4c475f
chore: upgrade rusty_v8 to 0.70.0 (#18844)
Closes https://github.com/denoland/deno/issues/18369
2023-04-26 10:02:03 +02:00
Leo Kettmeir 78b630d92a
ci: switch release doc to mention dotcom (#18845) 2023-04-26 03:38:49 +00:00
David Sherret 041d1e093b
refactor(cli): extract out NpmModuleLoader from CliModuleLoader (#18842)
Need to share this with the loader used in deno compile
2023-04-25 18:36:31 -04:00
Kenta Moriuchi 9b49de4644
fix(core): Wrap safe collections' argument of primordials (#18750) 2023-04-26 00:36:22 +02:00
Bartek Iwańczuk 97820fe8ab
refactor(ext/kv): don't use bigint literals (#18841)
This causes `DCHECK` fail in V8 when pointer compression
is disabled.
2023-04-25 20:43:39 +00:00
Bartek Iwańczuk 531754c354
refactor(ext/websocket): use specialized ops (#18819)
Instead of relying on `op_ws_send` to send different kinds of messages,
use specialized ops everywhere.
2023-04-25 13:53:06 +02:00
Matt Mastracci 21c888d4db
refactor(ext/http): comments for h2c code (#18833) 2023-04-25 12:41:01 +02:00
Yoshiya Hinosawa 63befe9377
fix(ext/node): fix hash.flush (#18818) 2023-04-25 11:21:26 +09:00
David Sherret 5b4a9b48ae
refactor(ext/node): enforce interior mutable for NodePermissions to remove clones (#18831)
We can make `NodePermissions` rely on interior mutability (which the
`PermissionsContainer` is already doing) in order to not have to clone
everything all the time. This also reduces the chance of an accidental
`borrow` while `borrrow_mut`.
2023-04-24 21:07:48 -04:00
Nayeem Rahman 667acb075c
fix(lsp): show dependency errors for repeated imports (#18807) 2023-04-24 23:52:27 +00:00
David Sherret aa286fdecb
refactor(ext/node): allow injecting NodeFs from CLI (#18829)
This allows providing a `NodeFs` as part of the `WorkerOptions`.
2023-04-24 19:44:35 -04:00
Matt Mastracci bb74e75a04
feat(ext/http): h2c for http/2 (#18817)
This implements HTTP/2 prior-knowledge connections, allowing clients to
request HTTP/2 over plaintext or TLS-without-ALPN connections. If a
client requests a specific protocol via ALPN (`h2` or `http/1.1`),
however, the protocol is forced and must be used.
2023-04-24 23:24:40 +02:00
David Sherret 0e97fa4d5f
fix(npm): only include top level packages in top level node_modules directory (#18824)
We were indeterministically including packages in the top level
`node_modules/` folder when using a local node_modules directory. This
change aligns with pnpm and only includes top level packages in this
folder. This should be faster for initializing the folder, but may
expose issues in packages that reference other packages not defined in
their dependencies. That said, the behaviour previously was previously
broken.

This has exposed a bug in the require implementation where it doesn't
find a package (which is the main underlying issue here). There is a
failing test already for this in the test suite after this change.

Closes #18822

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-24 17:08:11 -04:00
Leo Kettmeir be9e3c430f
docs: add categories to APIs without (#18826) 2023-04-24 20:24:18 +00:00
Bartek Iwańczuk ebfc75fe8c
test: disable flaky Node test (#18821)
If we hit a slow runner this test almost always fails.
2023-04-24 22:55:06 +09:00
Tristan F 652694f15d
docs(security): clarify storage explosion attacks in policy (#18697)
Deno does not cover storage explosion attacks from evaluated runtime
code.

I've chosen the following parts for this clarification:
- _Evaluated_ code - storage explosion attacks caused by services in
Deno such as the HTTP server should still be covered.
- Isolated - If the storage explosion attack can happen at arbitrary
different files, it may leave a much more lasting impact on a targeted
host system than on simply the Deno cache.
2023-04-24 13:03:53 +02:00
Bartek Iwańczuk 1f0360c073
refactor(ext/node): reorganize ops (#18799)
Move all op related code of "ext/node" to "ext/node/ops" module.

These files were unnecessarily scattered around the extension.
2023-04-24 12:22:21 +02:00
Bartek Iwańczuk 28e2c7204f
chore: remove tokio-tungstenite dependency (#18814) 2023-04-23 23:56:55 -04:00
Bartek Iwańczuk ea0694bbfd
test: deflake worker tests (#18813) 2023-04-23 23:48:25 +00:00
Bartek Iwańczuk 5a524a9a5a
refactor: rewrite client side tests to 'fastwebsockets' crate (#18800)
Follow up to https://github.com/denoland/deno/pull/18781.
2023-04-23 22:55:45 +02:00
Matt Mastracci fafb2584ef
refactor(ext/websocket): Remove dep on tungstenite by reworking code (#18812) 2023-04-23 14:07:37 -06:00
Leo Kettmeir c95477c49f
tests: update tests relying on deno.land (#18811) 2023-04-23 20:07:30 +02:00
Matt Mastracci 13f7f8c415
fix(ext/http): ensure that multiple upgrades and multiple simultaneous requests cannot cause a panic (#18810)
Fix a bug where we weren't saving `slabId` in #18619, plus add some
robustness checks around multiple upgrades (w/test).
2023-04-23 09:59:46 -06:00
Matt Mastracci bdffcb409f
feat(ext/http): Rework Deno.serve using hyper 1.0-rc3 (#18619)
This is a rewrite of the `Deno.serve` API to live on top of hyper
1.0-rc3. The code should be more maintainable long-term, and avoids some
of the slower mpsc patterns that made the older code less efficient than
it could have been.

Missing features:

- `upgradeHttp` and `upgradeHttpRaw` (`upgradeWebSocket` is available,
however).
- Automatic compression is unavailable on responses.
2023-04-22 11:48:21 -06:00
Levente Kurusa d137501a63
feat(node/http): implement ClientRequest.setTimeout() (#18783)
- implement setTimeout with matching semantics of Node
- add the test from Node but leave it turned off because ClientRequest
has no underlying socket
2023-04-22 13:20:00 +02:00
Bartek Iwańczuk 068228cb45
refactor: rewrite tests to "fastwebsockets" crate (#18781)
Migrating off of `tokio-tungstenite` crate.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-04-22 11:17:31 +02:00
David Sherret a615eb3b56
refactor(node): move most of cli/node to ext/node (#18797)
This is just a straight refactor and I didn't do any cleanup in
ext/node. After this PR we can start to clean it up and make things
private that don't need to be public anymore.
2023-04-21 21:02:46 -04:00
Bartek Iwańczuk 779d379c68
chore: upgrade rusty_v8 to 0.69.0 (#18796) 2023-04-22 00:36:52 +00:00
David Sherret cf9fb18494
feat: upgrade deno_ast to 0.26 (#18795)
Closes #18792
2023-04-21 21:16:25 +00:00
David Sherret 4a33c349af
refactor: move some CJS and ESM code analysis to ext/node (#18789) 2023-04-21 16:38:10 -04:00
Nayeem Rahman 065d8771ad
fix(test): allow explicit undefined for boolean test options (#18786)
Fixes #18784.
2023-04-21 15:32:37 +02:00
Bartek Iwańczuk 1d447cb7c3
refactor(core): remove ops from Deno.core.ops that are disabled (#18793)
This commit changes how "disabled" ops behave. Instead of using "void"
functions under the hood, they now explicitly throw errors saying
that a given op doesn't exist.
2023-04-21 15:22:45 +02:00
Divy Srivastava 4e944dea1d
fix(ext/websocket): upgrade fastwebsockets to 0.2.4 (#18791)
Fixes https://github.com/denoland/deno/issues/18775
2023-04-21 08:55:02 +02:00