1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-28 16:20:57 -05:00
Commit graph

4629 commits

Author SHA1 Message Date
David Sherret
772e4c033f
refactor(npm): add CliNodeResolver (#18742) 2023-04-18 17:41:53 +02:00
Yoshiya Hinosawa
7762566a6a
chore: update node compat config (#18736) 2023-04-18 17:41:53 +02:00
Cre3per
f6e90abb81
refactor(tests): Watcher test timeout (#18459)
Closes #17438
2023-04-18 17:41:53 +02:00
David Sherret
49a697e4bb
fix(lsp): ensure language server status works on unix (#18727)
Closes #18724
2023-04-18 17:41:52 +02:00
Bartek Iwańczuk
d9279e3dd6
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-18 17:41:52 +02:00
Bartek Iwańczuk
f9ae88c1b7
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-18 17:41:52 +02:00
Ryan Dahl
4e0bfafb24
feat(kv): AtomicOperation#sum (#18704) 2023-04-18 17:41:52 +02:00
David Sherret
f8d9ba79dd
chore: fix running node tests in parallel on Windows (#18711) 2023-04-18 17:41:52 +02:00
David Sherret
d3bb6ad0af
refactor: add TypeChecker struct (#18709)
Adds a `TypeChecker` struct and pushes more shared functionality into
it.
2023-04-18 17:41:52 +02:00
David Sherret
317e722220
chore: remove node_modules folder being created in testdata directory (#18708) 2023-04-18 17:41:52 +02:00
David Sherret
eef96d1414
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-18 17:41:52 +02:00
Divy Srivastava
001a9a5856
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-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
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
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
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
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
David Sherret
ae424ee976
refactor: ProcState::build -> ProcState::from_flags (#18672) 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
Divy Srivastava
f731dbd981 fix(ext/node): add X509Certificate (#18625)
Towards #18455
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
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
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
63454729a2 fix(ext/node): add symmetric keygen (#18609)
Towards #18455
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
Divy Srivastava
4f5d637841 chore(cli/bench): add ws echo bench (#18595) 2023-04-12 15:49:39 +02:00
Bartek Iwańczuk
aec781cf8f tests: cleanup "node_compat_tests" (#18594)
A few drive-by cleanup while I'm working on the "crypto"
module. It makes it easier and faster to debug the failing
test case.
2023-04-12 15:49:39 +02:00
Bartek Iwańczuk
5e8209abb3 refactor(ext/http): bring back 'reusePort' option for 'Deno.serve()' (#18590)
Closes https://github.com/denoland/deno/issues/18582
2023-04-12 15:49:39 +02:00
Matt Mastracci
fcb5a89d91 refactor(core): Improve ergonomics of managing ASCII strings (#18498)
This is a follow-on to the earlier work in reducing string copies,
mainly focused on ensuring that ASCII strings are easy to provide to the
JS runtime.

While we are replacing a 16-byte reference in a number of places with a
24-byte structure (measured via `std::mem::size_of`), the reduction in
copies wins out over the additional size of the arguments passed into
functions.

Benchmarking shows approximately the same if not slightly less wallclock
time/instructions retired, but I believe this continues to open up
further refactoring opportunities.
2023-04-12 15:49:39 +02:00
Bartek Iwańczuk
aa3f85ddd2 refactor: remove "ext/flash" (#18578)
With https://github.com/denoland/deno/pull/18568 landed we no longer
need "ext/flash". 

This commit removes "deno_flash" extension completely.

This should have some impact on the binary and snapshot size.

Closes https://github.com/denoland/deno/issues/17356
2023-04-12 15:44:07 +02:00
Bartek Iwańczuk
fe21f65b6b refactor: "Deno.serve()" API uses "Deno.serveHttp()" internally (#18568)
This commit changes implementation of "Deno.serve()" API to use
"Deno.serveHttp()" under the hood. This change will allow us to
remove the "flash" server implementation, bringing stability to the
"Deno.serve()" API.

"cli/tests/unit/flash_test.ts" was renamed to "serve_test.ts".

Closes https://github.com/denoland/deno/issues/15574
Closes https://github.com/denoland/deno/issues/15504
Closes https://github.com/denoland/deno/issues/15646
Closes https://github.com/denoland/deno/issues/15909
Closes https://github.com/denoland/deno/issues/15911
Closes https://github.com/denoland/deno/issues/16828
Closes https://github.com/denoland/deno/issues/18046
Closes https://github.com/denoland/deno/issues/15869
2023-04-12 15:44:04 +02:00
Yoshiya Hinosawa
bb7b58a991 Revert "fix(cli): don't store blob and data urls in the module cache (#18261)" (#18572)
This reverts commit b4c61c146a.

cc @nayeemrmn
2023-04-12 15:44:00 +02:00
denobot
73d472149c
1.32.3 (#18558)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-04-01 18:51:46 -04:00
Nayeem Rahman
f6f48bcec2 fix(test): don't swallow sanitizer errors with permissions (#18550)
Missing `return` from #18246.
2023-04-01 17:34:09 -04:00