Commit graph

4760 commits

Author SHA1 Message Date
Michael Lazarev 2ee55145c0
docs: correct example of piping the output of a subprocess to a file (#18933)
Fixes #18909
2023-05-01 21:52:56 +00:00
David Sherret 913176313b
perf: lazily create RootCertStore (#18938) 2023-05-01 16:42:05 -04:00
David Sherret 9efed4c7a3
refactor(cli): remove ProcState - add CliFactory (#18900)
This removes `ProcState` and replaces it with a new `CliFactory` which
initializes our "service structs" on demand. This isn't a performance
improvement at the moment for `deno run`, but might unlock performance
improvements in the future.
2023-05-01 14:35:23 -04:00
David Sherret 30628288ce
perf: lazily retrieve ppid (#18940)
This is very apparent on Windows.

Before: 45.74ms (Hello world)
After: 33.92ms

Closes #18939
2023-05-01 18:21:27 +00:00
David Sherret 94a148cdb6
refactor(cli): use CliMainWorker in standalone (#18880)
Uses `CliMainWorker` in all the cli code.
2023-05-01 08:59:38 -04:00
Divy Srivastava d856bfd336
perf(ext/web): fast path for ws events (#18905)
- Do not use `ReflectHas` in `isNode`.
- Avoid copying handler array when handlers.length == 1
- Avoid searching for path target when path.length == 1

```
Linux divy-2 5.19.0-1022-gcp #24~22.04.1-Ubuntu SMP Sun Apr 23 09:51:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
32GiB System memory
Intel(R) Xeon(R) CPU @ 3.10GHz

# main + https://github.com/denoland/deno/pull/18904
Msg/sec: 89326.750000
Msg/sec: 90320.000000
Msg/sec: 89576.250000

# this patch
Msg/sec: 97250.000000
Msg/sec: 97125.500000
Msg/sec: 97964.500000
```
2023-05-01 10:39:30 +05:30
David Sherret 9a9473533e
refactor(cli): remove Clone on ProcState (#18874)
Slowly phasing this out.
2023-04-30 16:51:31 -04:00
David Sherret 96e214d9d0
fix(fmt/json): support formatting number with exponent and no sign (#18894)
Numbers with an exponent and no sign (ex. `1e1`) would fail to parse.
2023-04-30 10:03:39 -04:00
Kenta Moriuchi 74bb09aa38
fix(ext/url): throw TypeError for empty argument (#18896)
Fixes #18893
2023-04-30 12:24:34 +02:00
Leo Kettmeir 59825a95b4
refactor: remove ext/console/01_colors.js (#18927) 2023-04-30 09:11:37 +00:00
Matt Mastracci bb1f5e4262
perf(core): async op pseudo-codegen and performance work (#18887)
Performance:

```
async_ops.js: 760k -> 1030k (!)
async_ops_deferred.js: 730k -> 770k
Deno.serve bench: 118k -> 124k
WS test w/ third_party/prebuilt/mac/load_test 100 localhost 8000 0 0: unchanged

Startup time: approx 0.5ms slower (13.7 -> 14.2ms)
```
2023-04-30 08:50:24 +00:00
Leo Kettmeir 9c8ebce3dc
refactor: merge Deno & Node inspectors (#18691) 2023-04-30 07:24:13 +00:00
Luca Casonato 1066490847
fix(ext/kv): stricter structured clone serializer (#18914) 2023-04-29 17:43:07 +02:00
denobot 6369098ad7
chore: forward v1.33.1 release commit to main (#18897)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-28 21:14:26 +02:00
Bartek Iwańczuk 142c1ab9fc
fix(ext/websocket): restore op_ws_send_ping (#18891)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-04-28 16:48:00 +02:00
Nayeem Rahman 0b296c6378
fix(repl): don't panic on undefined exception (#18888)
Fixes regression from #18878 where `Promise.reject()`,
`Promise.reject(undefined)` and `reportError(undefined)` panic in the
REPL.
Fixes `throw undefined` printing `Uncaught Unknown exception` instead of
`Uncaught undefined`.
2023-04-28 15:21:55 +02:00
Luca Casonato 84b921555f
fix(ext/fetch): subview Uint8Array in Req/Resp (#18890) 2023-04-28 14:26:21 +02:00
denobot 39ece1fe0d
1.33.0 (#18879)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-28 01:18:57 +02:00
Bartek Iwańczuk 683dbd7f3b
Revert "refactor: don't expose Deno[Deno.internal].core namespace" (#18881)
Also conditionally disabled one test if there's not enough space on
device.
2023-04-28 00:37:03 +02:00
Nayeem Rahman 504482dadd
fix(repl): print unhandled rejections and event errors (#18878)
Fixes #8858.
Fixes #8869.

```
$ target/debug/deno
Deno 1.32.5
exit using ctrl+d, ctrl+c, or close()
REPL is running with all permissions allowed.
To specify permissions, run `deno repl` with allow flags.
> Promise.reject(new Error("bar"));
Promise { <rejected> Error: bar
    at <anonymous>:2:16 }
Uncaught (in promise) Error: bar
    at <anonymous>:2:16
> reportError(new Error("baz"));
undefined
Uncaught Error: baz
    at <anonymous>:2:13
>
2023-04-27 23:36:49 +02:00
Bartek Iwańczuk 6cd62ea5e9
chore: upgrade rusty_v8 to 0.71.0 (#18868) 2023-04-27 20:50:46 +02:00
Luca Casonato 3fbb31c3c1
feat(kv): return ok bool from atomic commit (#18873) 2023-04-27 16:59:02 +02:00
Divy Srivastava b0264bea7d
fix(ext/node): prime generation (#18861)
Towards https://github.com/denoland/deno/issues/18455

`safe`, `add` and `rem` options are not implemented because there is no
rust crate that provides this functionality (except rust-openssl maybe)
and its just not clear if this API is used widely.
2023-04-27 19:40:59 +05:30
David Sherret 742cc3111c
refactor(cli): extract out ProcState from CliMainWorker (#18867) 2023-04-27 10:05:20 -04:00
Nayeem Rahman 03132e19da
fix(test): handle dispatched exceptions from test functions (#18853)
Fixes #18852.
2023-04-27 14:40:03 +02:00
scarf 90a5ef5e34
feat(cli): flatten deno.json configuaration (#17799) 2023-04-26 23:02:36 -04:00
Bartek Iwańczuk 4192978c3a
feat(lint): add Deno.run to no-deprecated-deno-api (#18869)
This upgrade includes a warning for the deprecated "Deno.run()" API.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2023-04-27 02:52:52 +00:00
Kevin Whinnery a16ad526e9
docs: Improve inline docs for permissions (deno run --help) (#18757)
Hey there! I took a crack at improving these embedded docs [as requested
here](https://github.com/denoland/deno/issues/18685). These should
accurately reflect the functionality of the permission-related flags for
`deno run`.

### Highlights
* Adds human-readable argument string in the format [prescribed in the
docs](https://docs.rs/clap/latest/clap/struct.Arg.html#method.value_name)
* Keeps text description terse, but includes a relevant copy/pasteable
docs link
* Includes example argument usage/formatting
2023-04-27 02:49:59 +02:00
Bartek Iwańczuk 09b6dbc0a6
feat: Deprecate Deno.run API in favor of Deno.Command (#17630) (#18866)
This commit adds `@deprecated` comments to `Deno.run` API declarations.
Since stabilization of `Deno.Command` API in [Deno
v1.31](https://deno.com/blog/v1.31#api-stabilizations), `Deno.Command`
is the preferred (more reliable) API to interact with subprocesses.
This is the preparation for the removal of `Deno.run` API in Deno 2.0.
2023-04-27 02:11:23 +02:00
David Sherret f4e442da4d
fix(dts): URLPatternComponentResult groups should have possibly undefined key values (#18643)
Closes #18640
2023-04-26 19:15:25 -04:00
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
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 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
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
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
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 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
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
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