Commit Graph

12768 Commits

Author SHA1 Message Date
David Sherret
3fc9e49613
refactor: remove usage of full_range (#26065)
For https://github.com/denoland/deno_graph/pull/538/files

This was removed because the deserialization was not backwards
compatible.
2024-10-08 11:48:29 +00:00
Satya Rohith
ff4e682ff9
fix(ext/node): internal buffer length in readSync (#26064)
Closes https://github.com/denoland/deno/issues/26054
2024-10-08 10:41:32 +00:00
Marvin Hagemeister
2d488e4bfb
fix(console): missing cause property on non-error objects (#26061)
Fixes https://github.com/denoland/deno/issues/26047
2024-10-08 12:10:19 +02:00
Nayeem Rahman
053894b9e0
fix(lsp): exclude missing import quick fixes with bad resolutions (#26025) 2024-10-07 18:20:45 +01:00
Bartek Iwańczuk
719b8dcfde
feat(lsp): add a message when someone runs 'deno lsp' manually (#26051) 2024-10-07 16:45:50 +00:00
Nathan Whitaker
fc293c68b5
chore: remove protoc dep from CI (#26050)
It shouldn't be needed anymore
2024-10-07 15:11:31 +00:00
Leo Kettmeir
9a92603a14
fix(ext/webstorage): make getOwnPropertyDescriptor with symbol return undefined (#13348)
Closes #13347
2024-10-07 07:59:27 -07:00
Divy Srivastava
39a2034967
feat(ext/crypto): X448 support (#26043)
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-10-07 12:04:40 +01:00
David Sherret
2de4faa483
refactor: improve node permission checks (#26028)
Does less work when requesting permissions with `-A`
2024-10-04 20:55:41 +01:00
David Sherret
f288730c38
chore: enable lock_deno_json_package_json_deps (#26029) 2024-10-04 20:55:03 +01:00
Nathan Whitaker
dd8cbf5e29
fix(node): fix worker_threads issues blocking Angular support (#26024)
Fixes #22995. Fixes #23000.

There were a handful of bugs here causing the hang (each with a
corresponding minimized test):

- We were canceling recv futures when `receiveMessageOnPort` was called,
but this caused the "receive loop" in the message port to exit. This was
due to the fact that `CancelHandle`s are never reset (i.e., once you
`cancel` a `CancelHandle`, it remains cancelled). That meant that after
`receieveMessageOnPort` was called, the subsequent calls to
`op_message_port_recv_message` would throw `Interrupted` exceptions, and
we would exit the loop.

The cancellation, however, isn't actually necessary.
`op_message_port_recv_message` only borrows the underlying port for long
enough to poll the receiver, so the borrow there could never overlap
with `op_message_port_recv_message_sync`.

- Calling `MessagePort.unref()` caused the "receive loop" in the message
port to exit. This was because we were setting
`messageEventListenerCount` to 0 on unref. Not only does that break the
counter when multiple `MessagePort`s are present in the same thread, but
we also exited the "receive loop" whenever the listener count was 0. I
assume this was to prevent the recv promise from keeping the event loop
open.

Instead of this, I chose to just unref the recv promise as needed to
control the event loop.

- The last bug causing the hang (which was a doozy to debug) ended up
being an unfortunate interaction between how we implement our
messageport "receive loop" and a pattern found in `npm:piscina` (which
angular uses). The gist of it is that piscina uses an atomic wait loop
along with `receiveMessageOnPort` in its worker threads, and as the
worker is getting started, the following incredibly convoluted series of
events occurs:
   1. Parent sends a MessagePort `p` to worker
   2. Parent sends a message `m` to the port `p`
3. Parent notifies the worker with `Atomics.notify` that a new message
is available
   4. Worker receives message, adds "message" listener to port `p`
   5. Adding the listener triggers `MessagePort.start()` on `p`
6. Receive loop in MessagePort.start receives the message `m`, but then
hits an await point and yields (before dispatching the "message" event)
7. Worker continues execution, starts the atomic wait loop, and
immediately receives the existing notification from the parent that a
message is available
8. Worker attempts to receive the new message `m` with
`receiveMessageOnPort`, but this returns `undefined` because the receive
loop already took the message in 6
9. Atomic wait loop continues to next iteration, waiting for the next
message with `Atomic.wait`
10. `Atomic.wait` blocks the worker thread, which prevents the receive
loop from continuing and dispatching the "message" event for the
received message
11. The parent waits for the worker to respond to the first message, and
waits
12. The thread can't make any more progress, and the whole process hangs

The fix I've chosen here (which I don't particularly love, but it works)
is to just delay the `MessagePort.start` call until the end of the event
loop turn, so that the atomic wait loop receives the message first. This
prevents the hang.

---

Those were the main issues causing the hang. There ended up being a few
other small bugs as well, namely `exit` being emitted multiple times,
and not patching up the message port when it's received by
`receiveMessageOnPort`.
2024-10-04 09:26:32 -07:00
Satya Rohith
7b509e492e
tests: enable package_json_node_modules_none (#25825)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-10-04 09:56:13 +00:00
David Sherret
edac916604
fix(install): surface package.json dependency errors (#26023) 2024-10-04 07:52:00 +00:00
David Sherret
b8a9a4a862
Revert "feat: warn when using --allow-run with no allow list" (#26021)
Although using `--allow-run` without an allow list gives basically no
security, I think we should remove this warning because it gets in the
way and the only way to disable it is via --quiet.
2024-10-04 08:16:35 +01:00
Satya Rohith
779a98cd39
tests: enable specs::run::package_json::invalid_value (#25826)
Towards https://github.com/denoland/deno/issues/25241

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-10-03 16:26:55 +00:00
Divy Srivastava
e41df20ad9
fix(npm): root package has peer dependency on itself (#26022)
https://github.com/denoland/deno_npm/pull/70

Fixes https://github.com/denoland/deno/issues/26006
2024-10-03 14:18:36 +00:00
David Sherret
91860b34f5
fix(task): use current executable for deno even when not named deno (#26019)
Closes https://github.com/denoland/deno/issues/26005
2024-10-03 13:07:12 +00:00
Divy Srivastava
54467015e0
chore: show expectation diff for wpt tests (#26014)
Closes https://github.com/denoland/deno/issues/26012

```
========================================

failures:

        "/WebCryptoAPI/wrapKey_unwrapKey/wrapKey_unwrapKey.https.any.html - Can wrap and unwrap X25519 private key keys as non-extractable using pkcs8 and AES-CTR"

final result: failed. 1 passed; 1 failed; 0 expected failure; total 2 (15646ms)

diff --git a/Users/divy/gh/deno/tests/wpt/runner/expectation.json b/var/folders/ll/ltqsx4nx72v5_r7rlsl36pgm0000gn/T/375d79f1257b05cd
index fb2063935..4449c5d15 100644
--- a/Users/divy/gh/deno/tests/wpt/runner/expectation.json
+++ b/var/folders/ll/ltqsx4nx72v5_r7rlsl36pgm0000gn/T/375d79f1257b05cd
@@ -1531,6 +1531,7 @@
     },
     "wrapKey_unwrapKey": {
       "wrapKey_unwrapKey.https.any.html": [
+        "Can wrap and unwrap X25519 private key keys as non-extractable using pkcs8 and AES-CTR",
         "Can wrap and unwrap X25519 private key keys as non-extractable using pkcs8 and AES-CBC",
         "Can wrap and unwrap X25519 private key keys as non-extractable using pkcs8 and AES-GCM",
         "Can wrap and unwrap X25519 private key keys as non-extractable using pkcs8 and AES-KW",
```
2024-10-03 13:01:36 +00:00
Simon Lecoq
da7edf1c0c
fix: don't prompt when using Deno.permissions.request with --no-prompt (#25811) 2024-10-03 12:28:38 +00:00
Divy Srivastava
19a9990f60
chore: remove custom bench profile (#26008) 2024-10-03 16:48:40 +05:30
Divy Srivastava
e54809f2d5
fix(ext/crypto): fix identity test for x25519 derive bits (#26011) 2024-10-03 16:46:48 +05:30
David Sherret
ac73b1042b
feat(permissions): allow importing from cdn.jsdelivr.net by default (#26013)
The exploit `--allow-import` is preventing against requires a
compromised host. To make things easier and given its popularity, we're
going to have the default `--allow-import` value include
`cdn.jsdelivr.net:443`, but this can be overridden by replacing the
`--allow-import` value with something else.
2024-10-03 10:05:46 +00:00
Divy Srivastava
f5caf9dd1b
perf: Use -O3 for sui in release builds (#26010) 2024-10-03 09:33:00 +05:30
Divy Srivastava
93b29b5feb
fix: enable Win32_Security feature in windows-sys (#26007)
Fixes https://github.com/denoland/deno/issues/25922
2024-10-03 09:00:11 +05:30
Bartek Iwańczuk
c7cba4eda7
v2.0.0-rc.10 (#26002) 2024-10-03 03:24:18 +02:00
Nathan Whitaker
275418473e
fix(install): store tags associated with package in node_modules dir (#26000)
Fixes #25998. Fixes https://github.com/denoland/deno/issues/25928.

Originally I was just going to make this an error message instead of a
panic, but once I got to a minimal repro I felt that this really should
work.

The panic occurs when you have `nodeModulesDir: manual` (or a
package.json present), and you have an npm package with a tag in your
deno.json (see the spec test that illustrates this).

This code path only actually executes when trying to choose an
appropriate package version from `node_modules/.deno`, so we should be
able to fix it by storing some extra data at install time.

The fix proposed here is to repurpose the `.initialized` file that we
store in `node_modules` to store the tags associated with a package.
Basically, if you have a version requirement with a tag (e.g.
`npm:chalk@latest`), when we set up the node_modules folder for that
package, we store the tag (`latest`) in `.initialized`. Then, when doing
BYONM resolution, if we have a version requirement with a tag, we read
that file and check if the tag is present.

The downside is that we do more work when setting up `node_modules`. We
_could_ do this only when BYONM is enabled, but that would have the
downside of needing to re-run `deno install` when you switch from auto
-> manual, though maybe that's not a big deal.
2024-10-02 17:16:46 -07:00
Nathan Whitaker
1e0c9b8c5b
chore: disable flaky uv_test.js for now (#26003)
Will re-enable once I figure out the issue
2024-10-02 23:41:58 +00:00
Nathan Whitaker
cb74975ab2
fix(install): compare versions directly to decide whether to create a child node_modules dir for a workspace member (#26001)
Fixes #25861.

Previously we were attempting to match the version requirement against
the version already present in `node_modules` root, and if they didn't
match we would create a node_modules dir in the workspace member's
directory with the dependency.

Aside from the fact that this caused the panic, on second thought it
just doesn't make sense in general. We shouldn't be semver matching, as
resolution has already occurred and decided what package versions are
required. Instead, we can just compare the versions directly.
2024-10-02 15:11:43 -07:00
David Sherret
cac28b5262
feat(byonm): support deno run npm:<package> when package is not in package.json (#25981)
Closes https://github.com/denoland/deno/issues/25905
2024-10-02 21:17:39 +01:00
Nathan Whitaker
bbd4ae1bc1
fix(node): implement libuv APIs needed to support npm:sqlite3 (#25893)
Fixes #24740.

Implements the `uv_mutex_*` and `uv_async_*` APIs.

The mutex API is implemented exactly as libuv, a thin wrapper over the
OS's native mutex.

The async API is implemented in terms of napi_async_work. As documented
in the napi docs, you really shouldn't call `napi_queue_async_work`
multiple times (it is documented as undefined behavior). However, our
implementation doesn't have any issue with this, so I believe it suits
our purpose here.
2024-10-02 10:43:42 -07:00
Leo Kettmeir
1837aed79b
Revert "fix(urlpattern): fallback to empty string for undefined group values" (#25961) 2024-10-02 09:02:46 -07:00
David Sherret
18beb13f0e
fix(workspace): handle when config has members when specified via --config (#25988)
Closes #25847
2024-10-02 16:20:51 +01:00
David Sherret
ebc8a6169e
fix(no-slow-types): better override handling (#25989)
* https://github.com/denoland/deno_graph/pull/534

Closes https://github.com/denoland/deno/issues/25322
2024-10-02 16:10:49 +01:00
denobot
55c2a88099
chore: release deno_* crates (#25987)
Testing once again if the crates are being properly released.

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-02 14:27:34 +00:00
denobot
2d3e0284d9
chore: release deno_* crates (#25976)
Test run before Deno 2.0 release to make sure that the publishing
process passes correctly.

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-02 14:44:04 +02:00
Arnau Orriols
7da70f4e58
chore: relax version pinning of deno_package_json (#25985)
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-10-02 12:55:56 +02:00
Mohammad Sulaiman
3c193aef98
chore: deprecate check itests (#25963) 2024-10-02 09:22:35 +00:00
David Sherret
d116709d06
chore: remove unnecessary envs in spec tests (#25982) 2024-10-02 10:14:38 +01:00
Satya Rohith
32c1278736
feat(ext/node): buffer.transcode() (#25972)
Closes https://github.com/denoland/deno/issues/25911
2024-10-02 08:23:14 +00:00
Divy Srivastava
620e6b43a6
fix(ext/node): remove unimplemented promiseHook stubs (#25979)
`temporalio` sdk [will try to
use](faa64225a7/packages/worker/src/workflow/vm-shared.ts (L199-L202))
promiseHook if it is found. This patch removes the unimplemented stubs.

```ts
    if (promiseHooks) {
      // Node >=16.14 only
      this.stopPromiseHook = promiseHooks.createHook({
        init: (promise: Promise<unknown>, parent: Promise<unknown>) => {
```

Fixes https://github.com/denoland/deno/issues/25977
2024-10-02 12:52:05 +05:30
Nayeem Rahman
3881b71734
feat(lsp): quick fix for @deno-types="npm:@types/*" (#25954) 2024-10-01 22:55:02 +01:00
Bartek Iwańczuk
f930000415
feat: Add suggestion for packages using Node-API addons (#25975)
This commit adds a suggestion with information and hint how
to resolve situation when user tries to run an npm package
with Node-API addons using global cache (which is currently not
supported).

Closes https://github.com/denoland/deno/issues/25974
2024-10-01 21:49:32 +00:00
Ian Bull
41a70898ad
refactor(ext): align error messages (#25914)
Aligns the error messages in the ext folder to be in-line with the Deno
style guide.

https://github.com/denoland/deno/issues/25269

<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/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.
-->
2024-10-01 14:26:06 -04:00
David Sherret
4c8d57db03
BREAKING: rename "deps" remote cache folder to "remote" (#25969)
Closes https://github.com/denoland/deno/issues/25967
Closes #25968
2024-10-01 14:05:40 -04:00
MujahedSafaa
29104384c4
fix: remove the typo in the help message (#25962)
This PR fixes: https://github.com/denoland/deno/issues/25274

Remove the extra shorthand -S that attached to the --deny-sys.
2024-10-01 13:24:12 +00:00
Bartek Iwańczuk
c487a86b04
fix: Hide 'deno cache' from help output (#25960)
`deno cache` was soft-deprecated in favor of `deno install`. It should
not show up in the help output.
2024-10-01 15:05:21 +02:00
Divy Srivastava
aafe771b55
v2.0.0-rc.9 (#25957) 2024-10-01 16:18:24 +05:30
Divy Srivastava
0a75dc70aa
fix: update patchver to 0.2 (#25952)
Fixes https://github.com/denoland/deno/issues/25940

Forgot to update patchver scripts to latest sui. Ref #25942
2024-10-01 15:05:55 +05:30
Bartek Iwańczuk
218a9bf7eb
v2.0.0-rc.8 (#25950) 2024-10-01 01:19:37 +02:00
Leo Kettmeir
7ad14589f9
fix(flags): move some content from docs.deno.com into help output (#25951) 2024-09-30 16:00:54 -07:00