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

9091 commits

Author SHA1 Message Date
Bartek Iwańczuk
ed3b5db1b8
chore: upgrade hyper to 0.14.26 (#18693)
https://github.com/hyperium/hyper/releases/tag/v0.14.26
2023-04-18 17:41:51 +02:00
Bartek Iwańczuk
ebd49c4a8d
perf(core): immediately schedule another tick if there are unpolled ops (#18611)
Currently we are "waking up" the runtime if at the end of the event loop
tick there are ops that haven't been polled. Waking up incurs a syscall
and it appears we can do another tick of the event loop, without
going through the "wake up" machinery.
2023-04-18 17:41:51 +02:00
Bartek Iwańczuk
774944b250
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-18 17:41:51 +02:00
David Sherret
1a7991d7a0
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-18 17:41:51 +02:00
Nayeem Rahman
67b1b0f183
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-18 17:41:51 +02:00
David Sherret
2b35ddfc46
chore: bump child_process_test timeouts for slow CI (#18689) 2023-04-18 17:41:51 +02:00
David Sherret
d5356f6687
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-18 17:41:51 +02:00
David Sherret
e20bd85b99
ci: don't run wpt tests on debug (#18688) 2023-04-18 17:41:51 +02:00
Bartek Iwańczuk
4fa39349b3
chore: add test duration to WPT (#18680)
To make it easier to debug which tests are slowing us down.

Tests taking more than 5s have duration printed in red,
taking more than 1s in yellow and less than 1s are printed 
without color.
2023-04-18 17:41:51 +02:00
Divy Srivastava
0296b63369
chore: bump fastwebsockets to 0.1.3 (#18684)
Fixes build on aarch64 Linux. See
https://github.com/littledivy/fastwebsockets/issues/2
2023-04-18 17:41:50 +02:00
Bartek Iwańczuk
ef20aedfa8
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-18 17:41:50 +02:00
David Sherret
dc37f414ee
ci: use non-XL runners more (#18675)
![image](https://user-images.githubusercontent.com/1609021/231593822-b9d7c9db-4416-4735-bd89-f28a260607f1.png)

Non-xl runners are faster than the linux xl job, so let's use them for
now

Closes #17103
2023-04-18 17:41:50 +02:00
Geert-Jan Zwiers
b3ff0eaee0
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-18 17:41:50 +02:00
Yiyu Lin
9161e1cacf
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-18 17:41:50 +02:00
Yiyu Lin
300ced90d8
refactor(serde_v8): move to thiserror, better error output (#18202)
Ref #17318

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-18 17:41:50 +02:00
Elijah
154920a24e
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-18 17:41:50 +02:00
Divy Srivastava
0b023538a0
perf(ext/websocket): make op_server_ws_next_event deferred (#18632)
Avoid attempting to read immediately, wasting time polling the future.
2% throughput improvement on Linux.
2023-04-18 17:41:50 +02:00
Nayeem Rahman
a1845a041b
fix(test): add process sigint handler for --watch (#18678)
Fixes #18676.
2023-04-18 17:41:50 +02:00
David Sherret
babfad7113
fix(npm): eagerly reload package information when version from lockfile not found locally (#18673)
Closes #18624
2023-04-18 17:41:50 +02:00
Bartek Iwańczuk
5d2c778765
refactor(ext/webidl): remove object from 'requiredArguments' (#18674)
This should produce a little less garbage and using an object here
wasn't really required.

---------

Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
2023-04-18 17:41:49 +02:00
David Sherret
ae424ee976
refactor: ProcState::build -> ProcState::from_flags (#18672) 2023-04-18 17:41:49 +02:00
David Sherret
e556a3a962
chore: fix windows clippy errors (#18670) 2023-04-18 17:41:49 +02:00
denobot
709cfd6d91
1.32.4 (#18668)
Bumped versions for 1.32.4

Please ensure:
- [x] Target branch is correct
- [x] Crate versions are bumped correctly
- [x] deno_std version is incremented in the code (see
`cli/deno_std.rs`)
- [x] Releases.md is updated correctly

To make edits to this PR:
```shell
git fetch upstream release_1_32.4 && git checkout -b release_1_32.4 upstream/release_1_32.4
```

cc @levex

Co-authored-by: levex <levex@users.noreply.github.com>
2023-04-12 17:17:55 +02:00
Luca Casonato
e9f41bed23 refactor(ext/fs): abstract FS via FileSystem trait (#18599)
This commit abstracts out the specifics of the underlying system calls
FS operations behind a new `FileSystem` and `File` trait in the
`ext/fs` extension.

This allows other embedders to re-use ext/fs, but substituting in a
different FS backend.

This is likely not the final form of these traits. Eventually they will
be entirely `deno_core::Resource` agnostic, and will live in a seperate
crate.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-12 15:52:08 +02:00
David Sherret
4fab252153 fix(npm): cache bust npm specifiers more aggressively (#18636)
Part 1: #18622 
Part 2: This PR

Closes #16901

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-04-12 15:52:08 +02:00
Nayeem Rahman
b183737fc9 fix(core): preserve syntax error locations in dynamic imports (#18664)
Fixes #6259.

Adds the location for v8 syntax errors to the message (`message += " at
{location}"`) when rethrowing them for dynamic imports.

Discussing with @bartlomieju on discord I proposed just preserving v8's
error and not reconstructing it, allowing the standard stack trace to
just point to the syntax error instead of the dynamic import. But on
further thought this way has parity with SWC's syntax errors + has the
advantage of showing both the syntax error and dynamic import location.

```ts
// temp.js
await import("./temp2.js");

// temp2.js
function foo() {
  await Promise.resolve();
}

// Before:
// error: Uncaught (in promise) SyntaxError: Unexpected reserved word
// await import("./temp2.js");
// ^
//     at async file:///.../temp.js:1:1

// After:
// error: Uncaught (in promise) SyntaxError: Unexpected reserved word at file:///.../temp2.js:2:3
// await import("./temp2.js");
// ^
//     at async file:///.../temp.js:1:1
```
2023-04-12 15:52:08 +02:00
Satya Rohith
477f49bca2 fix(ext/cache): cache.put overwrites previous call (#18649) 2023-04-12 15:52:08 +02:00
Levente Kurusa
a72396fa84 refactor(node/crypto): port polyfill to Rust for randomInt, randomFill, randomFillSync (#18658)
Pretty much as per the title, I'd welcome some feedback especially
around the
array/buffer handling in the two randomFill functions.
2023-04-12 15:52:08 +02:00
David Sherret
0014ebb91c fix(npm): do not "npm install" when npm specifier happens to match package.json entry (#18660) 2023-04-12 15:52:08 +02:00
Geert-Jan Zwiers
dc1eb76235 chore(cli): clean up unused number value (#18661)
This PR removes an accidentally declared number value.
2023-04-12 15:52:08 +02:00
Luca Casonato
7ced470477 fix(ext/kv): keys must be arrays (#18655)
There was some leftover code from previous iterations, where keys could
be single parts instead of arrays also. This didn't match the types.
2023-04-12 15:52:08 +02:00
David Sherret
766cd5653f chore: .gitignore spring cleaning (#18644) 2023-04-12 15:52:08 +02:00
Andreu Botella
c7c439c54e cleanup(core): Move JsRealm into a separate module (#18641)
This will help make reviews easier for #15760, which moves a number of
methods related to module loading from `JsRuntime` into `JsRealm`.
2023-04-12 15:52:07 +02:00
David Sherret
3491e3e04e ci: do not run build job on draft prs (#18634)
We had a PR land that didn't actually pass the steps because it passed
on a draft pr. This prevents running the "build" job on draft prs.
2023-04-12 15:52:07 +02:00
David Sherret
2ca797bee8 chore: fix linting on main (#18633) 2023-04-12 15:52:07 +02:00
Divy Srivastava
f731dbd981 fix(ext/node): add X509Certificate (#18625)
Towards #18455
2023-04-12 15:52:07 +02:00
Bartek Iwańczuk
1613c9f5a6 refactor(ext/node): remove conditional in ServerResponse#enqueue (#18617)
It's superfluous, the issue linked is no longer relevant.

Closes https://github.com/denoland/deno/issues/18579
2023-04-12 15:52:07 +02:00
David Sherret
0117281eef fix(npm): reload an npm package's dependency's information when version not found (#18622)
This reloads an npm package's dependency's information when a
version/version req/tag is not found.

This PR applies only to dependencies of npm packages. It does NOT yet
cause npm specifiers to have their dependency information cache busted.
That requires a different solution, but this should help cache bust in
more scenarios.

Part of #16901, but doesn't close it yet
2023-04-12 15:52:07 +02:00
Bartek Iwańczuk
af6f2de1ad chore: remove lockfile/ (#18618)
New home at https://github.com/denoland/deno_lockfile.
2023-04-12 15:52:07 +02:00
David Sherret
3da1d5f8eb refactor(npm): use deno_npm and deno_semver (#18602) 2023-04-12 15:52:03 +02:00
David Sherret
acb9dca497 chore: fix flaky tests checking ms when CI is slow (#18559) 2023-04-12 15:49:40 +02:00
Divy Srivastava
05bc5e522d fix(ext/node): implement hkdf-expand (#18612)
Towards https://github.com/denoland/deno/issues/18455
2023-04-12 15:49:40 +02:00
David Sherret
c61c4f5755 refactor(ext/node): NodeFs - add back altered metadata method (#18613)
From https://github.com/denoland/deno/pull/18604/files#r1159992299

We should still have a `metadata` method because it's one system call
instead of two on most platforms.
2023-04-12 15:49:40 +02:00
Marvin Hagemeister
b7af3caf78 fix(ext/node): fix unable to resolve fraction.js (#18544)
Turns out `autoprefixer` is a better reproduction case then
`microbundle`.

Fixes #18535 
Fixes #18600

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-12 15:49:40 +02:00
Divy Srivastava
cd57451e05 perf(ext/websocket): replace tokio_tungstenite server with fastwebsockets (#18587)
https://github.com/littledivy/fastwebsockets

```
# This PR
./load_test 100 0.0.0.0 8080 0 0
Running benchmark now...
Msg/sec: 176355.000000

# main
./load_test 100 0.0.0.0 8080 0 0
Running benchmark now...
Msg/sec: 157198.750000
```
2023-04-12 15:49:40 +02:00
Divy Srivastava
63454729a2 fix(ext/node): add symmetric keygen (#18609)
Towards #18455
2023-04-12 15:49:40 +02:00
Bartek Iwańczuk
16c1e023a5 refactor(ext/node): add more methods to 'NodeFs' trait (#18604)
Added more methods to `ext/node/clippy.toml` that are not allowed
to be used in the crate.

Prerequisite for https://github.com/denoland/deno/pull/18544
2023-04-12 15:49:40 +02:00
Geert-Jan Zwiers
b039c5f5ac fix(ext/node): json encode binary command name (#18596)
Fixes https://github.com/denoland/deno/issues/18588
2023-04-12 15:49:40 +02:00
Luca Casonato
301c4f4d02 feat(core): sync io ops in core (#18603)
This commit adds op_read_sync and op_write_sync to core. These ops are
similar to op_read and op_write, but they are synchronous. Just like the
async ops, they operate on generic `deno_core::Resource` objects. These
now have new `read_byob_sync` and `write_sync` methods, with default
implementations throwing "NotSupported" errors, just like the async
counterparts.

There are no `write_all` or `read` equivalents, because the
optimizations they unlock are not useful in synchronous contexts.
2023-04-12 15:49:40 +02:00
Luca Casonato
67bf9692df perf(ext/io): remove a data copy from File write (#18601)
Removes a data copy from all async `File::write` operations.
2023-04-12 15:49:39 +02:00