1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-26 16:09:27 -05:00
Commit graph

4868 commits

Author SHA1 Message Date
Matt Mastracci
8aeec47a62
chore(core): fix flaky flock_test on windows (#19477) 2023-06-15 22:50:35 +02:00
Leo Kettmeir
7e3b5b1a13
chore: update clap (#19467)
Also switches to use defer for all subcommands besides run.
2023-06-15 22:50:35 +02:00
David Sherret
8884c14a2d
chore(tests): test_util - Add PathRef (#19450)
This adds a new `PathRef` struct to test_util for making it easier to
work with paths in test code. I'm going to expand on this more in the
future.
2023-06-15 22:50:34 +02:00
David Sherret
f7cb0b44e3
chore: fix flaky package_json_auto_discovered_for_local_script_arg (#19445) 2023-06-15 22:50:34 +02:00
Gustrb
c67dfaec61
perf(node): cache realpath_sync calls in read permission check (#19379) 2023-06-15 22:50:33 +02:00
David Sherret
7ee3eec58a
chore: fix flaky stdio_streams_are_locked_in_permission_prompt (#19443) 2023-06-15 22:50:33 +02:00
David Sherret
ef9d91dec4
fix(fmt): do not panic formatting json with multiple values (#19442) 2023-06-15 22:50:33 +02:00
David Sherret
8a737f5a16
fix(config): do not canonicalize config file path before loading (#19436)
I'm unsure why we canonicalize the config file path when loading and the
canonicalization is causing issues in #19431 because everything in the
lsp is not canonicalized except the config file (actually, the config
file is only canonicalized when auto-discovered and not whens pecified).
We also don't canonicalize module paths when loading them.

Canonicalization was added in https://github.com/denoland/deno/pull/7621
2023-06-15 22:50:33 +02:00
Bartek Iwańczuk
40cd7a3cda
perf: add Tokio runtime monitor (#19415)
This commit adds ability to print metrics of the Tokio
runtime to the console by passing "DENO_TOKIO_METRICS=1"
env var.

Metrics will be printed every second, but this can be changed
by "DENO_TOKIO_METRICS_INTERVAL=500" env var.
2023-06-15 22:50:32 +02:00
denobot
acf5d44a22
1.34.2 (#19433)
Bumped versions for 1.34.2

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-09 02:13:59 +02:00
Bartek Iwańczuk
d6271e204b
chore(ext/node): revert changes to ClientRequest.onSocket (#19426)
Partially reverts https://github.com/denoland/deno/pull/19340
because it causes hangs in some situations.
2023-06-09 01:13:27 +02:00
Matt Mastracci
270ac0775a
chore: Use relative paths for assert imports to avoid test flakes (#19427)
Tests occasionally fail if we get a bad gateway attempting to fetch the
assertion module
2023-06-09 01:13:27 +02:00
David Sherret
959e795b44
refactor(compile): store the npm snapshot in the eszip (#19343) 2023-06-09 01:13:27 +02:00
Matt Mastracci
1bbf67f6ca
perf(ext/websocket): Reduce GC pressure & monomorpize op_ws_next_event (#19405)
Reduce the GC pressure from the websocket event method by splitting it
into an event getter and a buffer getter.

Before:
165.9k msg/sec

After:
169.9k msg/sec
2023-06-09 01:13:27 +02:00
nasa
94395a7750
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-09 01:13:26 +02:00
nasa
0fc19df30a
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-09 01:13:26 +02:00
Bartek Iwańczuk
220a7d544a
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-09 01:13:25 +02:00
David Sherret
7d44315ee6
refactor: helpers methods on TypeCheckMode (#19393) 2023-06-09 01:13:25 +02:00
Mike Mulchrone
82c3a56674
fix(cli): formatting bench with colors (#19323) 2023-06-09 01:13:25 +02:00
David Sherret
82b2037f6e
perf(cli): conditionally load typescript declaration files (#19392)
Closes #18583
2023-06-09 01:13:24 +02:00
sigmaSd
9a6d319e18
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-09 01:13:24 +02:00
Leo Kettmeir
b34d95667a
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-09 01:13:24 +02:00
Matt Mastracci
03ad309ccd
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-09 01:13:23 +02:00
ud2
05282308ff
fix(ext/console): fix inspecting large ArrayBuffers (#19373) 2023-06-09 01:13:23 +02:00
David Sherret
7b0a7b1976
chore: upgrade to Rust 1.70.0 (#19345)
Co-authored-by: linbingquan <695601626@qq.com>
2023-06-09 01:13:23 +02:00
David Sherret
ddba4e8c4d
fix: upgrade to deno_ast 0.27 (#19375)
Closes #19148
2023-06-09 01:13:23 +02:00
Kenta Moriuchi
fb6b518d4d
chore: update deno_lint to 0.46.0 (#19372) 2023-06-09 01:13:22 +02:00
nasa
4f7b109b93
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-09 01:13:22 +02:00
Leo Kettmeir
26506ff0c2
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-09 01:13:22 +02:00
Mathias Lafeldt
cd041fd128
feat(runtime): support creating workers using custom v8 params (#19339)
In order to limit the memory usage of isolates via heap_limits.
2023-06-09 01:13:22 +02:00
Koen
2d60600724
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-09 01:13:21 +02:00
Nayeem Rahman
d05981a611
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-09 01:13:21 +02:00
Marvin Hagemeister
08813ea25e
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-09 01:13:20 +02:00
nasa
6f02bfd181
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-09 01:13:20 +02:00
Hirotaka Tagawa / wafuwafu13
b995c13f03
chore(node_compat): fix path strings generated by setup.ts (#19347) 2023-06-09 01:13:20 +02:00
Bartek Iwańczuk
544f48c23c
fix(node): don't close stdio streams (#19256)
Closes https://github.com/denoland/deno/issues/19255

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-06-09 01:13:20 +02:00
Nayeem Rahman
6836e5a6eb
refactor(core): don't pass op state to prepare_module_load() (#19332)
It's not used anymore. Subsequently allows removing
`ModuleMap::op_state`, allowing `ModuleMap` to have a sane default so
`JsRuntime::module_map` no longer needs to be optional.
2023-06-09 01:13:19 +02:00
Matt Mastracci
8f9a05f16e
refactor(ext/http): Expose internal serveHttpOnListener API for HTTP2 (#19331)
For the first implementation of node:http2, we'll use the internal
version of `Deno.serve` which allows us to listen on a raw TCP
connection rather than a listener.

This is mostly a refactoring, and hooking up of `op_http_serve_on` that
was never previously exposed (but designed for this purpose).
2023-06-09 01:13:19 +02:00
Marvin Hagemeister
34ab009e3c
fix(runtime): add missing SIGIOT alias to SIGABRT (#19333) 2023-06-09 01:13:19 +02:00
Leo Kettmeir
a6b0866fb6
refactor: further work on node http client (#19327)
Closes https://github.com/denoland/deno/issues/18300
2023-06-09 01:13:18 +02:00
Matt Mastracci
782db80629
chore(core): Split JsRuntimeForSnapshot from JsRuntime (#19308)
This cleans up `JsRuntime` a bit more:

* We no longer print cargo's rerun-if-changed messages in `JsRuntime` --
those are printed elsewhere
* We no longer special case the OwnedIsolate for snapshots. Instead we
make use of an inner object that has the `Drop` impl and allows us to
`std::mem::forget` it if we need to extract the isolate for a snapshot
* The `snapshot` method is only available on `JsRuntimeForSnapshot`, not
`JsRuntime`.
* `OpState` construction is slightly cleaner, though I'd still like to
extract more

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-09 01:13:18 +02:00
Marvin Hagemeister
f89b2c5ca6
fix(node): add missing process.reallyExit method (#19326)
This PR adds the missing `process.reallyExit()` method to node's
`process` object.

Was [pinged on
twitter](https://twitter.com/biwanczuk/status/1663326659787862017)
regarding running the `fastify` test suite in node. They use `node-tap`
which has been around arguably the longest of the test frameworks and
relies on a couple of old APIs. They have `signal-exit` as a dependency
which in turn [makes use of
`process.reallyExit()`](8fa7fc9a9c/src/index.ts (L19)).
That function cannot be found anywhere in their documentation, but
exists at runtime. See
6a6b3c5402/lib/internal/bootstrap/node.js (L172)

This doesn't yet make `node-tap` work, but gets us one step closer.
2023-06-09 01:13:18 +02:00
David Sherret
f63b13fc96
fix: do not show cache initialization errors if stderr is piped (#18920)
Closes #18918
2023-06-09 01:13:17 +02:00
David Sherret
03398ddace
feat(runtime): add WorkerLogLevel (#19316)
This is not really used yet, but provides some infrastructure for doing
more fine grained logging in JS. I will add warn messages in a future
PR.
2023-06-09 01:13:17 +02:00
denobot
ea6cd3f1fc
1.34.1 (#19310)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-30 01:30:46 +02:00
Bartek Iwańczuk
d90a75c036
fix: use proper ALPN protocols if HTTP client is HTTP/1.1 only (#19303)
Closes https://github.com/denoland/deno/issues/16923

---------

Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-05-29 23:05:45 +02:00
egg
fc6ba92024
test(ext/node): add os_test.ts (#19305)
Part of #17840

I haven't made any changes or additions to the tests themselves, just
moved the tests over and updated to match.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-29 15:03:14 +02:00
Bartek Iwańczuk
cf8b7bb530
fix(node): http.IncomingMessageForClient.complete (#19302)
Closes https://github.com/denoland/deno/issues/19238
2023-05-29 01:29:01 +02:00
Nayeem Rahman
b6a3f8f722
refactor(core): remove ext: modules from the module map (#19040)
Rather than disallowing `ext:` resolution, clear the module map after
initializing extensions so extension modules are anonymized. This
operation is explicitly called in `deno_runtime`. Re-inject `node:`
specifiers into the module map after doing this.

Fixes #17717.
2023-05-28 12:44:41 -06:00
David Sherret
92080ff6f6
chore: maybe fix cli/standalone/virtual_fs tests on main (#19295)
Not sure why these don't fail on a PR run:
https://github.com/denoland/deno/actions/runs/5102317156/jobs/9171796164

**Merge on approval**
2023-05-28 15:55:30 +02:00