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

9478 commits

Author SHA1 Message Date
David Sherret
bc87252c7a Keep using actions/cache for now because we aren't using buildjet for everything atm 2023-06-08 11:46:14 -04:00
David Sherret
e97d950013 Run [ci] 2023-06-08 11:23:52 -04:00
David Sherret
b231c69502
Merge branch 'main' into will/test-buildjet 2023-06-08 11:21:04 -04:00
Matt Mastracci
f35161d3c5
chore: Ensure we only end up with the clang version we want & upgrade libffi (#19421)
The number of clang versions installed on the build machines is too dang
high.
2023-06-08 15:16:24 +00:00
nasa
caad79ef78
feat(node_compat): Add a write method to the FileHandle class (#19385)
## WHY 

ref: https://github.com/denoland/deno/issues/19165

The FileHandle class has many missing methods compared to node.

## WHAT


Add write method
2023-06-08 08:47:12 -06:00
nasa
262571e63e
feat(node_compat): Add a read method to the FileHandle class (#19359)
ref: #19165

The FileHandle class has many missing methods compared to node.
2023-06-08 06:37:19 -06:00
Bartek Iwańczuk
0197f42e6b
perf: use sendto syscalls (#19414)
This switches syscall used in HTTP and WS server from "writev"
to "sendto".

"DENO_USE_WRITEV=1" can be used to enable using "writev" syscall.
Doing this for easier testing of various setups.
2023-06-08 12:55:33 +02:00
Bartek Iwańczuk
dd6458b30a
chore: upgrade to Rust 1.68.2 (#19416)
Also prints disk size in release builds.
2023-06-08 04:04:07 +02:00
Bartek Iwańczuk
90c2bcdcf8
fix(napi): don't panic if symbol can't be found (#19397)
This should return an error to the caller to make it
easier to track what went wrong. 

Should help with debugging https://github.com/denoland/deno/issues/19389
2023-06-07 23:26:41 +00:00
David Sherret
a800fbf502 Run [ci] 2023-06-07 18:44:41 -04:00
David Sherret
8e7427ab22 Use buildjet's cache 2023-06-07 18:41:12 -04:00
David Sherret
e1aa6b469e Merge branch 'main' into will/test-buildjet 2023-06-07 18:40:59 -04:00
David Sherret
21084a127f
chore: downgrade to Rust 1.68 (#19411)
Problems still persist from https://github.com/denoland/deno/pull/19407
-- downgrading to try out 1.68
2023-06-07 22:40:44 +00:00
David Sherret
f48e7ebccd Run [ci] 2023-06-07 18:06:02 -04:00
David Sherret
fc6b8d15bd I think the version is necessary. Let's see what the error is 2023-06-07 18:04:34 -04:00
David Sherret
d489baef01 Merge branch 'main' into will/test-buildjet 2023-06-07 18:02:34 -04:00
David Sherret
794f731238
ci: output file system space before and after building (#19409)
This will help give us better insight.
2023-06-07 17:57:36 -04:00
Bartek Iwańczuk
19f82b0eaa
refactor(core): use JoinSet instead of FuturesUnordered (#19378)
This commit migrates "deno_core" from using "FuturesUnordered" to
"tokio::task::JoinSet". This makes every op to be a separate Tokio task
and should unlock better utilization of kqueue/epoll.

There were two quirks added to this PR:
- because of the fact that "JoinSet" immediately polls spawn tasks,
op sanitizers can give false positives in some cases, this was
alleviated by polling event loop once before running a test with 
"deno test", which gives canceled ops an opportunity to settle
- "JsRuntimeState::waker" was moved to "OpState::waker" so that FFI
API can still use threadsafe functions - without this change the
registered wakers were wrong as they would not wake up the 
whole "JsRuntime" but the task associated with an op

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-06-07 23:50:14 +02:00
David Sherret
7e91f74d2b
chore: downgrade to Rust 1.69 (#19407) 2023-06-07 21:02:43 +00:00
David Sherret
da9db887e3
refactor: helpers methods on TypeCheckMode (#19393) 2023-06-07 10:09:10 -04:00
Mike Mulchrone
28ce0ef583
fix(cli): formatting bench with colors (#19323) 2023-06-07 12:27:25 +02:00
Bartek Iwańczuk
42c10ecfdb
perf(ext/websocket): monomorphize code (#19394)
Using `deopt-explorer` I found that a bunch of fields on `WebSocket`
class were polymorphic. 

Fortunately it was enough to initialize them to `undefined`
to fix the problem.
2023-06-07 11:54:49 +02:00
David Sherret
2aba4365ae
perf(cli): conditionally load typescript declaration files (#19392)
Closes #18583
2023-06-06 17:07:46 -04:00
sigmaSd
455b0eb8bb
fix(repl): correctly print string exception (#19391)
Fixes a recent regression where `throw "hello"` in the repl prints
`Uncaught undefined` instead of `throw "hello"`
2023-06-06 23:06:30 +02:00
Matt Mastracci
40d77c5605
chore(core): build_bench tool (#19387)
This is a quick tool that I've been using to build benchmarking builds
for Deno.

Usage:

Build a benchmark `HEAD~1` and `origin/main` executable:

```sh
deno run tools/build_bench.ts HEAD~1 origin/main
```

Build debug benchmark executables of the last three commits:

```sh
deno run tools/build_bench.ts --profile debug HEAD HEAD~1 HEAD~2
```
2023-06-06 18:53:41 +00:00
Marvin Hagemeister
1c3d2132c2
perf(http): avoid flattening http headers (#19384) 2023-06-06 16:55:37 +02:00
Leo Kettmeir
5aca8b9e5d
fix(node/http): use fake socket and proper url handling (#19340)
Fixes https://github.com/denoland/deno/issues/19349

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-06 14:37:10 +00:00
Bartek Iwańczuk
c76f9a0227
refactor(serde_v8): don't access backing store twice (#19382)
I did that change recently, did spot that we're calling 
`get_backing_store()` in succession and that API call
is not cheap.
2023-06-06 08:02:16 -06:00
Matt Mastracci
df76a062fa
perf(ext/websocket): Make send sync for non-stream websockets (#19376)
No need to go through the async machinery for `send(String | Buffer)` --
we can fire and forget, and then route any send errors into the async
call we're already making (`op_ws_next_event`).

Early benchmark on MacOS:

Before: 155.8k msg/sec
After: 166.2k msg/sec (+6.6%)

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-06 07:58:18 -06:00
Matt Mastracci
42991017e9
feat(ext/node): Very basic node:http2 support (#19344)
This commit adds basic support for "node:http2" module. Not
all APIs have been yet implemented, but this change already
allows to use this module for some basic functions. 

The "grpc" package is still not working, but it's a good stepping
stone.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-06 12:29:55 +02:00
ud2
2052ba343c
fix(ext/console): fix inspecting large ArrayBuffers (#19373) 2023-06-06 11:06:00 +02:00
Matt Mastracci
0bbdbace02
refactor(core): ensureFastOps is an op-generating proxy (#19377)
Startup benchmark shows no changes (within 1ms, identical system/user
times).
2023-06-06 11:01:28 +02:00
David Sherret
5c55f2b4fb
chore: upgrade to Rust 1.70.0 (#19345)
Co-authored-by: linbingquan <695601626@qq.com>
2023-06-06 00:35:39 +00:00
David Sherret
8829a1d362
fix: upgrade to deno_ast 0.27 (#19375)
Closes #19148
2023-06-05 19:03:39 -04:00
Kenta Moriuchi
d54ef02dfe
chore: update deno_lint to 0.46.0 (#19372) 2023-06-05 15:57:01 -04:00
Levente Kurusa
11dd5a0ae7
fix(ext/crypto): fix JWK import of Ed25519 (#19279)
Fixes: #18049

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-05 14:52:02 +02:00
nasa
d2047f1337
feat(node_compat): Add a close method to the FileHandle class. (#19357)
## WHY 

ref: https://github.com/denoland/deno/issues/19165

The FileHandle class has many missing methods compared to node.
Add these.

## WHAT

- Add close method

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-06-05 06:43:04 -06:00
VlkrS
3d582156b6
feat(runtime): Add an OpenBSD implementation for rss() (#19221)
In case you would consider including specific implementations and not
only build fixes, here's the implementation of the ```rss()``` function
for OpenBSD.
2023-06-05 14:24:19 +02:00
Leo Kettmeir
08bd23970d
feat: add more options to Deno.inspect (#19337)
For https://github.com/denoland/deno_std/issues/3404

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-06-05 12:25:47 +02:00
Mathias Lafeldt
77a950aac4
feat(runtime): support creating workers using custom v8 params (#19339)
In order to limit the memory usage of isolates via heap_limits.
2023-06-05 09:22:32 +00:00
Bartek Iwańczuk
21c2c01ebe
perf: optimize RegExp usage in JS (#19364)
Towards https://github.com/denoland/deno/issues/19330

Shows about 1% improvement in the HTTP benchmark.
2023-06-05 10:52:40 +02:00
Koen
adf41edda1
fix(ext/web): Copy EventTarget list before dispatch (#19360)
Related issue: https://github.com/denoland/deno/issues/19358.

This is a regression that seems to have been introduced in
https://github.com/denoland/deno/pull/18905. It looks to have been a
performance optimization.

The issue is probably easiest described with some code:
```ts
const target = new EventTarget();
const event = new Event("foo");
target.addEventListener("foo", () => {
  console.log('base');
  target.addEventListener("foo", () => {
    console.log('nested');
  });
});
target.dispatchEvent(event);
```
Essentially, the second event listener is being attached while the `foo`
event is still being dispatched. It should then not fire that second
event listener, but Deno currently does.
2023-06-04 18:03:44 -06:00
Nayeem Rahman
34dac6c6ef
refactor(core): remove force_op_registration and cleanup JsRuntimeForSnapshot (#19353)
Addresses
https://github.com/denoland/deno/pull/19308#discussion_r1212248194. 

Removes force_op_registration as it is no longer necessary.
2023-06-03 14:22:32 -06:00
Kamil Ogórek
7d0853d158
perf(ext/http): Migrate op_http_get_request_method_and_url to v8::Array (#19355)
Tackles 3rd item from https://github.com/denoland/deno/issues/19330
list.

Before: 113.9k
After: 114.3k
2023-06-03 12:15:53 -06:00
Kamil Ogórek
260d2ec3a1
perf(ext/http): Migrate op_http_get_request_headers to v8::Array (#19354) 2023-06-02 22:31:27 +00:00
Igor Zinkovsky
ce5bf9fb2a
fix(kv) run sqlite transactions via spawn_blocking (#19350)
`rusqlite` does not support async operations; with this PR SQLite
operations will run through `spawn_blocking` to ensure that the event
loop does not get blocked.

There is still only a single SQLite connection. So all operations will
do an async wait on the connection. In the future we can add a
connection pool if needed.
2023-06-02 11:12:26 -07:00
Kamil Ogórek
98320ff1f8
perf(ext/http): Use flat list of headers for multiple set/get methods (#19336)
This PR attempts to resolve the first item on the list from
https://github.com/denoland/deno/issues/19330 which is about using a
flat list of interleaved key/value pairs, instead of a nested array of
tuples.

I can tackle some more if you can provide a quick example of using raw
v8 arrays, cc @mmastrac
2023-06-02 09:59:16 -06:00
Marvin Hagemeister
f5c1ff08e6
fix(node): map stdio [0, 1, 2] to "inherit" (#19352)
<!--
Before submitting a PR, please read https://deno.com/manual/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
Internally, `node-tap` spawns a child process with `stdio: [0, 1, 2]`.
Whilst we don't support passing fd numbers as an argument so far, it
turns out that `[0, 1, 2]` is equivalent to `"inherit"` which we already
support. See: https://nodejs.org/api/child_process.html#optionsstdio

Mapping it to `"inherit"` is fine for us and gets us one step closer in
getting `node-tap` working. I'm now at the stage where already the
coverage table is shown 🎉
2023-06-02 09:46:50 -06:00
nasa
25fdc7bf6c
feat(node_compat): Added base implementation of FileHandle (#19294)
<!--
Before submitting a PR, please read https://deno.com/manual/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->


## WHY

ref: https://github.com/denoland/deno/issues/19165

Node's fs/promises includes a FileHandle class, but deno does not. The
open function in Node's fs/promises returns a FileHandle, which provides
an IO interface to the file. However, deno's open function returns a
resource id.


### deno 

```js
> const fs = await import("node:fs/promises");
undefined
> const file3 = await fs.open("./README.md");
undefined
> file3
3
> file3.read
undefined
Node:
```

### Node
```js
> const fs = await import("fs/promises");
undefined
>   const file3 = await fs.open("./tests/e2e_unit/testdata/file.txt");
undefined
> file3
FileHandle {
  _events: [Object: null prototype] {},
  _eventsCount: 0,
  _maxListeners: undefined,
  close: [Function: close],
  [Symbol(kCapture)]: false,
  [Symbol(kHandle)]: FileHandle {},
  [Symbol(kFd)]: 24,
  [Symbol(kRefs)]: 1,
  [Symbol(kClosePromise)]: null
}
> file3.read
[Function: read]
```


To be compatible with Node, deno's open function should also return a
FileHandle.

## WHAT

I have implemented the first step in adding a FileHandle.

- Changed the return value of the open function to a FileHandle object
- Implemented the readFile method in FileHandle
- Add test code


## What to do next
This PR is the first step in adding a FileHandle, and there are things
that should be done next.

- Add functionality equivalent to Node's FileHandle to FileHandle
(currently there is only readFile)

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-06-02 08:28:05 -06:00
Aapo Alasuutari
98461e2559
chore(tools): Add core import-map (#19346)
Adds an import map of the core and ext JavaScript files. This was
created manually but a script to create one automatically wouldn't be
too much of a big thing either.

This should make working on especially the Node polyfills much more
pleasant, as it gives you feedback on if your imports are correct.
Unfortunately the TypeScript declaration files of some of the internal
modules clash with the import map and override the data from the actual
files with data from the declaration files. Those do not contain all
exports nor is their data always up to date. Still, this is much better
than not having one.
2023-06-02 09:38:36 -04:00