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

4660 commits

Author SHA1 Message Date
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
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
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
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
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
David Sherret
c2e9c8cce5
fix(compile): write bytes directly to output file (#18777)
1. Adds cli/standalone folder
2. Writes the bytes directly to the output file. When adding npm
packages this might get quite large, so let's not keep the final output
in memory just in case.
2023-04-19 21:50:56 +00:00
Levente Kurusa
c336755881
fix(test/coverage): exclude test files (#18748)
Fixes: #18454
2023-04-19 23:30:52 +02:00
Divy Srivastava
9496dfc685
fix(ext/node): implement asymmetric keygen (#18651)
Towards #18455 

This commit implements the keypair generation for asymmetric keys for
the `generateKeyPair` API.

See how key material is managed in this implementation:
https://www.notion.so/denolandinc/node-crypto-design-99fc33f568d24e47a5e4b36002c5325d?pvs=4

Private and public key encoding depend on `KeyObject#export` which is
not implemented. I've also skipped ED448 and X448 since we need a crate
for that in WebCrypto too.
2023-04-19 22:27:34 +05:30
Yoshiya Hinosawa
53c9f5918c
fix(ext/node): improve vm.runInThisContext (#18767) 2023-04-19 23:26:16 +09:00
Yoshiya Hinosawa
fdebb7e793
fix(ext/node): add crypto.sign|verify methods (#18765) 2023-04-19 23:24:26 +09:00
Bartek Iwańczuk
972469d309
tests: disable another flaky test (#18762)
This test is flaky too, it actually shouldn't be running since it's not
listed in `cli/tests/node_compat/config.jsonc` at all.
2023-04-19 00:10:01 +00:00
Bartek Iwańczuk
edca01c35e
chore: disable flaky Node compat tests (#18760)
I'm not able to reproduce any of the failures from CI on my machine.

I'm going to disable these tests for now as they are holding us back.
2023-04-19 00:32:21 +02:00
Bartek Iwańczuk
40d9e918ea
test: fix flaky worker test (#18754)
https://github.com/denoland/deno/actions/runs/4734585198/jobs/8403719901?pr=18753
2023-04-18 22:24:47 +02:00
denobot
4e5d370b56
chore: forward v1.32.5 release commit to main (#18758)
Co-authored-by: levex <levex@users.noreply.github.com>
Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-04-18 22:20:49 +02:00
Levente Kurusa
530963c34c
refactor(node/crypto): scrypt polyfill to rust (#18746) 2023-04-18 14:29:10 +02:00
Yoshiya Hinosawa
74aee8b305
chore(ext/node): restore http_test from std (#18747) 2023-04-18 21:06:25 +09:00
Yoshiya Hinosawa
5f44396a9e
fix(ext/node): implement crypto.createVerify (#18703) 2023-04-18 21:04:51 +09:00
Yoshiya Hinosawa
de21a780fd
fix(ext/node): add req.socket.remoteAddress (#18733) 2023-04-18 16:00:51 +09:00
Yoshiya Hinosawa
6efaef606a
fix(ext/node): polyfill response._implicitHeader method (#18738) 2023-04-18 15:20:36 +09:00
David Sherret
d2d62b6312
refactor(npm): add CliNodeResolver (#18742) 2023-04-17 15:36:23 -04:00
Yoshiya Hinosawa
559a61b879
chore: update node compat config (#18736) 2023-04-18 00:36:49 +09:00
Cre3per
bad4b7554b
refactor(tests): Watcher test timeout (#18459)
Closes #17438
2023-04-17 09:49:03 -04:00
David Sherret
94744ae25a
fix(lsp): ensure language server status works on unix (#18727)
Closes #18724
2023-04-16 16:02:48 -04:00
Bartek Iwańczuk
02dd09a36f
bench: add benchmark for deferred async ops (#18722)
```
./target/release/deno run cli/bench/async_ops_deferred.js
time 794 ms rate 1259445
time 786 ms rate 1272264
time 770 ms rate 1298701
time 784 ms rate 1275510
time 775 ms rate 1290322
time 786 ms rate 1272264
time 773 ms rate 1293661
time 771 ms rate 1297016
time 774 ms rate 1291989
time 767 ms rate 1303780
time 764 ms rate 1308900
time 768 ms rate 1302083
time 763 ms rate 1310615
time 761 ms rate 1314060
time 761 ms rate 1314060
time 762 ms rate 1312335
time 763 ms rate 1310615
time 759 ms rate 1317523
time 760 ms rate 1315789
time 761 ms rate 1314060
time 769 ms rate 1300390
time 763 ms rate 1310615
time 760 ms rate 1315789
time 763 ms rate 1310615
time 761 ms rate 1314060
time 759 ms rate 1317523
time 765 ms rate 1307189
time 760 ms rate 1315789
time 764 ms rate 1308900
time 763 ms rate 1310615
time 760 ms rate 1315789
time 757 ms rate 1321003
time 763 ms rate 1310615
time 759 ms rate 1317523
time 771 ms rate 1297016
time 759 ms rate 1317523
time 759 ms rate 1317523
time 763 ms rate 1310615
time 754 ms rate 1326259
time 755 ms rate 1324503
time 762 ms rate 1312335
time 752 ms rate 1329787
time 755 ms rate 1324503
time 754 ms rate 1326259
time 759 ms rate 1317523
time 754 ms rate 1326259
time 749 ms rate 1335113
time 753 ms rate 1328021
time 756 ms rate 1322751
time 753 ms rate 1328021
```

```
samply record -r 20000 target/release/deno run cli/bench/async_ops_deferred.js
```

https://share.firefox.dev/43Efvm6
2023-04-16 19:47:06 +00:00
Bartek Iwańczuk
1564595f6b
Revert "perf(core): immediately schedule another tick if there are un… (#18718)
…polled ops (#18611)"

This reverts commit 4317055a3e.

Reverting because we discovered while working on
https://github.com/denoland/deno/pull/18619 that it doesn't work
correctly (sometimes waker just stops working).
2023-04-16 14:05:13 +00:00
Ryan Dahl
2184103a5e
feat(kv): AtomicOperation#sum (#18704) 2023-04-15 10:33:31 +02:00
David Sherret
1bca994143
chore: fix running node tests in parallel on Windows (#18711) 2023-04-14 18:50:58 -04:00
David Sherret
0a67a3965f
refactor: add TypeChecker struct (#18709)
Adds a `TypeChecker` struct and pushes more shared functionality into
it.
2023-04-14 18:05:46 -04:00
David Sherret
f6a28e3e62
chore: remove node_modules folder being created in testdata directory (#18708) 2023-04-14 21:56:14 +00:00
David Sherret
136dce67ce
refactor: break up ProcState (#18707)
1. Breaks up functionality within `ProcState` into several other structs
to break out the responsibilities (`ProcState` is only a data struct
now).
2. Moves towards being able to inject dependencies more easily and have
functionality only require what it needs.
3. Exposes `Arc<T>` around the "service structs" instead of it being
embedded within them. The idea behind embedding them was to reduce the
verbosity of needing to pass around `Arc<...>`, but I don't think it was
exactly working and as we move more of these structs to be more
injectable I don't think the extra verbosity will be a big deal.
2023-04-14 16:22:33 -04:00
Divy Srivastava
a411144219
fix(ext/websocket): Avoid write deadlock that requires read_frame to complete (#18705)
Fixes https://github.com/denoland/deno/issues/18700

Timeline of the events that lead to the bug.

1. WebSocket handshake complete
2. Server on `read_frame` holding an AsyncRefCell borrow of the
WebSocket stream.
3. Client sends a TXT frame after a some time
4. Server recieves the frame and goes back to `read_frame`.
5. After some time, Server starts a `write_frame` but `read_frame` is
still holding a borrow!
^--- Locked. read_frame needs to complete so we can resume the write.

This commit changes all writes to directly borrow the
`fastwebsocket::WebSocket` resource under the assumption that it won't
affect ongoing reads.
2023-04-14 22:17:39 +05:30
Bartek Iwańczuk
cb2ca234bb
refactor(core): limit number of boundary crossings between Rust and V8 (#18652)
This commit refactors "deno_core" to do fewer boundary crossings
from Rust to V8. In other words we are now calling V8 from Rust fewer
times.

This is done by merging 3 distinct callbacks into a single one. Instead
of having "op resolve" callback, "next tick" callback and "macrotask
queue" callback, we now have only "Deno.core.eventLoopTick" callback,
which is responsible for doing the same actions previous 3 callbacks.

On each of the event loop we were doing at least 2 boundary crosses
(timers macrotask queue callback and unhandled promise rejection
callback) and up to 4 crosses if there were op response and next tick
callbacks coming from Node.js compatibility layer. Now this is all done
in a single callback.

Closes https://github.com/denoland/deno/issues/18620
2023-04-14 02:41:32 +02:00
David Sherret
d192d84a0e
refactor(cli): add Emitter struct (#18690)
Removes the functions in the `emit` module and replaces them with an
`Emitter` struct that can have "ctor dependencies" injected rather than
using functions to pass along the dependencies.

This is part of a long term refactor to move more functionality out of
proc state.
2023-04-13 18:03:07 +00:00
Nayeem Rahman
6e8618ae0f
refactor(cli): move runTests() and runBenchmarks() to rust (#18563)
Stores the test/bench functions in rust op state during registration.
The functions are wrapped in JS first so that they return a directly
convertible `TestResult`/`BenchResult`. Test steps are still mostly
handled in JS since they are pretty much invoked by the user. Allows
removing a bunch of infrastructure for communicating between JS and
rust. Allows using rust utilities for things like shuffling tests
(`Vec::shuffle`). We can progressively move op and resource sanitization
to rust as well.

Fixes #17122.
Fixes #17312.
2023-04-13 19:43:23 +02:00
David Sherret
4e53bc5a94
chore: bump child_process_test timeouts for slow CI (#18689) 2023-04-13 13:30:30 -04:00
David Sherret
efa7c19890
refactor: upgrade to deno_npm 0.3.0 (#18671)
This allows us to specify the `@types/node` version constraint in the
CLI instead of in deno_npm.
2023-04-13 10:47:45 -04:00
Bartek Iwańczuk
702284dc22
perf(ops): directly respond for eager ops (#18683)
This commit changes "eager ops" to directly return a response value
instead of calling "opresponse" callback in JavaScript. This saves
one boundary crossing and has a fantastic impact on the "async_ops.js"
benchmark:

```
v1.32.4
$ deno run cli/bench/async_ops.js
time 329 ms rate 3039513
time 322 ms rate 3105590
time 307 ms rate 3257328
time 301 ms rate 3322259
time 303 ms rate 3300330
time 306 ms rate 3267973
time 300 ms rate 3333333
time 301 ms rate 3322259
time 301 ms rate 3322259
time 301 ms rate 3322259
time 302 ms rate 3311258
time 301 ms rate 3322259
time 302 ms rate 3311258
time 302 ms rate 3311258
time 303 ms rate 3300330
```

```
this branch
$ ./target/release/deno run -A cli/bench/async_ops.js
time 257 ms rate 3891050
time 248 ms rate 4032258
time 251 ms rate 3984063
time 246 ms rate 4065040
time 238 ms rate 4201680
time 227 ms rate 4405286
time 228 ms rate 4385964
time 229 ms rate 4366812
time 228 ms rate 4385964
time 226 ms rate 4424778
time 226 ms rate 4424778
time 227 ms rate 4405286
time 228 ms rate 4385964
time 227 ms rate 4405286
time 228 ms rate 4385964
time 227 ms rate 4405286
time 229 ms rate 4366812
time 228 ms rate 4385964
```

Prerequisite for https://github.com/denoland/deno/pull/18652
2023-04-13 14:32:47 +02:00
Geert-Jan Zwiers
aaebd6eb42
chore(docs): clarify what subcommands do not type-check by default (#18520)
The CLI docs suggested that all deno subcommands no longer type-check by
default. This is only the case for some subcommands, and this PR
clarifies the CLI docs in this regard.
2023-04-13 03:42:28 +02:00
Yiyu Lin
d790ea7d53
refactor(cli,ext,ops): cleanup regex with lazy-regex (#17296)
- bump deps: the newest `lazy-regex` need newer `oncecell` and
`regex`
- reduce `unwrap`
- remove dep `lazy_static`
- make more regex cached

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-13 03:08:01 +02:00
Elijah
e2853a955c
test(runtime): support Windows in resolve_from_cwd_absolute (#18379)
`current_dir().unwrap()` joined with a Path is equivalent to the
implementation in `resolve_from_cwd()`. Manually tested on Ubuntu 22.04
and Windows 11.

Signed-off-by: Elijah Conners <business@elijahpepe.com>
2023-04-13 01:45:53 +02:00
Nayeem Rahman
d97f9d22b3
fix(test): add process sigint handler for --watch (#18678)
Fixes #18676.
2023-04-13 00:51:04 +02:00
David Sherret
17e4782140
fix(npm): eagerly reload package information when version from lockfile not found locally (#18673)
Closes #18624
2023-04-12 18:04:45 -04:00