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

1266 commits

Author SHA1 Message Date
Nayeem Rahman
38c7af4565
feat(lsp): "typescript.preferences.preferTypeOnlyAutoImports" setting (#26546) 2024-10-25 18:35:09 +01:00
David Sherret
e162306247
chore: remove print debugging from test server (#26529)
Accidentally added in https://github.com/denoland/deno/pull/26473/files
2024-10-24 22:06:17 +00:00
Nicola Bovolato
8dd6177c62
fix(ext/node): refactor http.ServerResponse into function class (#26210)
While testing, I found out that light-my-request relies on
`ServerResponse.connection`, which is deprecated, so I added that and
`socket`, the non deprecated property.

It also relies on an undocumented `_header` property, apparently for
[raw header
processing](https://github.com/fastify/light-my-request/blob/v6.1.0/lib/response.js#L180-L186).
I added it as an empty string, feel free to provide other approaches.

Fixes #19901

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-25 00:02:26 +02:00
David Sherret
eedf243b5e
perf(compile): pass module source data from binary directly to v8 (#26494)
This changes denort to pass a static reference of the moude source bytes found in the binary to v8 instead of copying it.
2024-10-24 19:48:48 +00:00
Marvin Hagemeister
5f0bb3c6f4
fix: .npmrc settings not being passed to install/add command (#26473)
We weren't passing the resolved npmrc settings to the install commands.
This lead us to always fall back to the default registry url instead of
using the one from npmrc.

Fixes https://github.com/denoland/deno/issues/26139
Fixes https://github.com/denoland/deno/issues/26033
Fixes https://github.com/denoland/deno/issues/25924
Fixes https://github.com/denoland/deno/issues/25822
Fixes https://github.com/denoland/deno/issues/26152

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-24 20:03:56 +02:00
Marvin Hagemeister
ef53ce3ac4
fix(node/util): support array formats in styleText (#26507)
We missed adding support for an array of formats being passed to
`util.styleText`.

Fixes https://github.com/denoland/deno/issues/26496
2024-10-24 11:46:51 +02:00
Nathan Whitaker
7c57105cc4
fix(ext/node): only set our end of child process pipe to nonblocking mode (#26495)
Fixes playwright on linux, as reported in
https://github.com/denoland/deno/issues/16899#issuecomment-2378268454.

The issue was that we were opening the socket in nonblocking mode, which
meant that subprocesses trying to use it would get a `EWOULDBLOCK` error
(unexpectedly). The fix here is to only set nonblocking mode on our end
(which we need to use asynchronously)
2024-10-23 21:13:30 -07:00
Divy Srivastava
fa49fd404b
fix(ext/ffi): return u64/i64 as bigints from nonblocking ffi calls (#26486)
Fixes https://github.com/denoland/deno/issues/25194
2024-10-24 09:41:38 +05:30
Nathan Whitaker
6d587cbfc8
fix(install): cache all exports of JSR packages listed in deno.json (#26501)
Fixes #26498.

This was a sort of intentional decision originally, as I wanted to avoid
caching extra files that may not be needed. It seems like that behavior
is unintuitive, so I propose we cache all of the exports of listed jsr
packages when you run a bare `deno install`.
2024-10-23 20:12:52 -07:00
Nathan Whitaker
69e1d7a4ed
fix(install): cache type only module deps in deno install (#26497)
Fixes https://github.com/denoland/deno/issues/26180.
2024-10-23 15:01:45 -07:00
Satya Rohith
92ed4d38db
fix(node:tls): set TLSSocket.alpnProtocol for client connections (#26476)
Towards https://github.com/denoland/deno/issues/26127
2024-10-23 07:47:43 +00:00
Yoshiya Hinosawa
285635daa6
fix(ext/node): map ERROR_INVALID_NAME to ENOENT on windows (#26475)
In libuv on windows, `ERROR_INVALID_NAME` is mapped to `ENOENT`, but it
is mapped to `EINVAL` in our compat implementation, which causes the
issue #24899.

ref:
d4ab6fbba4/src/win/error.c (L138)

closes #24899 
closes #26411
closes #23635
closes #21165
closes #19067
2024-10-23 11:28:04 +09:00
Nathan Whitaker
5e020ebc35
fix(check): support --frozen on deno check (#26479)
Fixes https://github.com/denoland/deno/issues/26391
2024-10-22 21:15:00 +00:00
Bartek Iwańczuk
28b5640657
refactor: add 'docs' suggestion (#26463)
Adds another kind to `FixSuggestionKind` specifically for links
documentation pages.
2024-10-22 22:22:26 +02:00
Leo Kettmeir
9696e0b378
fix(ext/console): ignore casing for named colors in css parsing (#26466) 2024-10-22 10:57:58 +02:00
Leo Kettmeir
f26c8bcf31
refactor(runtime/ops): use concrete error types (#26409) 2024-10-22 01:41:08 -07:00
Bartek Iwańczuk
67280f8b55
fix(install): update lockfile when using package.json (#26458)
This commit makes sure that `deno add`, `deno install` and `deno remove`
update the lockfile if only `package.json` file is present.

Fixes https://github.com/denoland/deno/issues/26270
2024-10-22 01:08:45 +02:00
Nayeem Rahman
9e25a4ebbf
fix(lsp): import-map-remap quickfix for type imports (#26454) 2024-10-21 22:16:39 +01:00
David Sherret
39fb55096e
fix(install): better json editing (#26450)
1. Respects the formatting of the file (ex. keeps four space indents or
tabs).
2. Handles editing of comments.
3. Handles trailing commas.
4. Code is easier to maintain.
2024-10-21 14:17:08 -04:00
Nayeem Rahman
9fe2bf42dc
feat(lsp): interactive inlay hints (#26382) 2024-10-21 17:15:52 +01:00
Leo Kettmeir
473e3069de
chore: update nix crate (#26422)
Dedupes nix dependency, since `rustyline` depends on a newer version
that what we currently use
2024-10-19 21:59:39 +00:00
Marvin Hagemeister
0e60bb9cf7
fix(info): resolve workspace member mappings (#26350)
This PR fixes the issue where mapped specifiers in a workspace member
would never be found. Only mapped paths from the workspace root would
resolve.

This was caused by always passing the workspace root url to the import
map resolver instead of the workspace member one.

Fixes https://github.com/denoland/deno/issues/26138
Fixes https://github.com/denoland/fresh/issues/2615

---------

Signed-off-by: Marvin Hagemeister <marvinhagemeister50@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-10-18 21:45:05 +02:00
Marvin Hagemeister
4b99cde504
fix(npm): ensure scoped package name is encoded in URLs (#26390)
Fixes https://github.com/denoland/deno/issues/26385
2024-10-18 20:38:57 +02:00
Nathan Whitaker
50724d014a
fix(install): don't attempt to cache specifiers that point to directories (#26369)
Fixes https://github.com/denoland/deno/issues/26162
2024-10-17 22:25:22 +00:00
Nathan Whitaker
2435a361c6
chore: fix flaky COPYFILE_EXCL test (#26370)
It was missing an await
2024-10-17 22:19:37 +00:00
Nathan Whitaker
9fde5cb5e0
fix(node/fs): copyFile with COPYFILE_EXCL should not throw if the destination doesn't exist (#26360)
Fixes #26313.

We were checking for the NotFound error, but still calling the callback
with the error / throwing.
2024-10-17 19:51:15 +00:00
LongYinan
5689585888
fix(cli): set napi object property properly (#26344)
<!--
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-17 12:44:51 +02:00
Nathan Whitaker
167f674c7c
fix: don't warn on ignored signals on windows (#26332)
Closes #26183.

The warnings are super noisy and not actionable for the user
2024-10-16 19:58:11 -07:00
Nathan Whitaker
458d6278d2
fix(node/http): normalize header names in ServerResponse (#26339)
Fixes https://github.com/denoland/deno/issues/26115.

We weren't normalizing the headers to lower case, so code that attempted
to delete the `Content-Length` header (but used a different case) wasn't
actually removing the header.
2024-10-17 00:42:15 +00:00
Nayeem Rahman
72dd74d83a
Reland feat(lsp): deno/didRefreshDenoConfigurationTree notifications (#26325) 2024-10-16 22:43:26 +01:00
Bartek Iwańczuk
1fd8d092ea
Revert "feat(lsp): "deno/didRefreshDenoConfigurationTree" notificatio… (#26320)
…ns (#26215)"

This reverts commit 06778e4e9b because
benchmarks are failing on `main`.
2024-10-16 19:05:47 +00:00
Nathan Whitaker
f7dba52133
fix(child_process): map node --no-warnings flag to --quiet (#26288)
Closes https://github.com/denoland/deno/issues/25899
2024-10-16 18:25:25 +00:00
Marvin Hagemeister
e515f3dd0e
fix(add): exact version should not have range ^ specifier (#26302)
Fixes https://github.com/denoland/deno/issues/26299
2024-10-16 18:34:33 +02:00
Nayeem Rahman
06778e4e9b
feat(lsp): "deno/didRefreshDenoConfigurationTree" notifications (#26215) 2024-10-16 17:05:13 +01:00
Yoshiya Hinosawa
d59599fc18
fix(ext/node): fix dns.lookup result ordering (#26264)
partially unblocks #25470

This PR aligns the resolution of `localhost` hostname to Node.js
behavior.

In Node.js `dns.lookup("localhost", (_, addr) => console.log(addr))`
prints ipv6 address `::1`, but it prints ipv4 address `127.0.0.1` in
Deno. That difference causes some errors in the work of enabling
`createConnection` option in `http.request` (#25470). This PR fixes the
issue by aligning `dns.lookup` behavior to Node.js.

This PR also changes the following behaviors (resolving TODOs):
- `http.createServer` now listens on ipv6 address `[::]` by default on
linux/mac
- `net.createServer` now listens on ipv6 address `[::]` by default on
linux/mac

These changes are also alignments to Node.js behaviors.
2024-10-16 20:58:44 +09:00
snek
ea9c3ffaa2
fix: node-api function call should use preamble (#26297)
`napi_call_function` should use our equiv of NAPI_PREAMBLE (`&mut Env`
instead of `*mut Env`) since it needs to set error codes based on
whether the body of the function raised a JS exception.

Fixes: https://github.com/denoland/deno/issues/26282
2024-10-16 10:30:19 +00:00
Satya Rohith
2929d583d2
fix(cli): consolidate pkg parser for install & remove (#26298)
Closes https://github.com/denoland/deno/issues/26283
2024-10-16 09:20:41 +00:00
Divy Srivastava
21fa953f32
fix(ext/node): timingSafeEqual account for AB byteOffset (#26292)
Fixes https://github.com/denoland/deno/issues/26276
2024-10-16 14:27:28 +05:30
Bartek Iwańczuk
40b1c42138
fix: improve suggestions and hints when using CommonJS modules (#26287)
Ref https://github.com/denoland/deno/issues/26225
2024-10-15 23:25:24 +00:00
Bartek Iwańczuk
ee904ec06c
fix: add hint for missing document global in terminal error (#26218)
This came up on Discord as a question so I thought it's worth adding a
hint for this as it might be a common pitfall.

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-10-15 21:51:39 +00:00
Nathan Whitaker
797405fc61
fix(add): create deno.json when running deno add jsr:<pkg> (#26275)
Fixes https://github.com/denoland/deno/issues/26119.

Originally I wanted to put them in package.json if there's no deno.json,
but on second thought it makes more sense to just create a deno.json
2024-10-15 16:38:42 +00:00
林炳权
533a9b1086
chore: upgrade to rust 1.81.0 (#26261) 2024-10-15 21:40:07 +05:30
Divy Srivastava
c7153838ec
fix(ext/node): implement TCP.setNoDelay (#26263)
Fixes https://github.com/denoland/deno/issues/26177

The significant delay was caused by Nagel's algorithm + delayed ACKs in
Linux kernels. Here's the [kernel
patch](https://lwn.net/Articles/502585/) which added 40ms
`tcp_default_delack_min`

```
$ deno run -A pg-bench.mjs # main
Tue Oct 15 2024 12:27:22 GMT+0530 (India Standard Time): 42ms

$ target/release/deno run -A pg-bench.mjs # this patch
Tue Oct 15 2024 12:28:02 GMT+0530 (India Standard Time): 1ms
```

```js
import { Buffer } from "node:buffer";

import pg from 'pg'
const { Client } = pg
const client = new Client({
    connectionString: 'postgresql://postgres:postgres@127.0.0.1:5432/postgres'
})
await client.connect()

async function fetch() {
    const startPerf = performance.now();
    const res = await client.query(`select
        $1::int as int,
        $2 as string,
        $3::timestamp with time zone as timestamp,
        $4 as null,
        $5::bool as boolean,
        $6::bytea as bytea,
        $7::jsonb as json
      `, [
        1337,
        'wat',
        new Date().toISOString(),
        null,
        false,
        Buffer.from('awesome'),
        JSON.stringify([{ some: 'json' }, { array: 'object' }])
    ])
    console.log(`${new Date()}: ${Math.round(performance.now() - startPerf)}ms`)
}

for(;;) await fetch();
```
2024-10-15 14:47:12 +05:30
David Sherret
ae6a2b23ba
fix: do not panic running remote cjs module (#26259)
Instead error.
2024-10-15 03:57:31 +00:00
David Sherret
1a0cb5b531
feat(unstable): --unstable-detect-cjs for respecting explicit "type": "commonjs" (#26149)
When using the `--unstable-detect-cjs` flag or adding `"unstable":
["detect-cjs"]` to a deno.json, it will make a JS file CJS if the
closest package.json contains `"type": "commonjs"` and the file is not
an ESM module (no TLA, no `import.meta`, no `import`/`export`).
2024-10-14 20:48:39 -04:00
Mohammad Sulaiman
8dbe77dd29
fix(console/ext/repl): support using parseFloat() (#25900)
Fixes #21428

Co-authored-by: tannal <tannal2409@gmail.com>
2024-10-14 15:04:18 -07:00
David Sherret
c5449d71da
fix(install): support installing npm package with alias (#26246)
Just tried this out today and it wasn't properly implemented in
https://github.com/denoland/deno/pull/24156
2024-10-14 19:35:52 +00:00
Luca Casonato
3eda179220
feat(cli): improve deno info output for npm packages (#25906) 2024-10-14 14:29:50 +02:00
Divy Srivastava
bbad7c5922
fix(ext/node): compute pem length (upper bound) for key exports (#26231)
Fixes https://github.com/denoland/deno/issues/26188
2024-10-14 14:24:26 +05:30
Divy Srivastava
68b388a93a
fix(ext/node): allow writing to tty columns (#26201)
Behave similar to Node.js where modifying `stdout.columns` doesn't
really resize the terminal. Ref
https://github.com/nodejs/node/issues/17529

Fixes https://github.com/denoland/deno/issues/26196
2024-10-14 14:00:02 +05:30
Divy Srivastava
d22195e741
fix(ext/napi): pass user context to napi_threadsafe_fn finalizers (#26229)
Fixes https://github.com/denoland/deno/issues/26228
2024-10-14 12:41:34 +05:30
Nathan Whitaker
4f89225f76
fix(node/util): export styleText from node:util (#26194)
Fixes #26184.

It was added but not publicly exported.
2024-10-12 19:36:23 +00:00
Nathan Whitaker
7a990d9d42
feat(npm): support --allow-scripts on deno run (and deno add, deno test, etc) (#26075)
Fixes https://github.com/denoland/deno/issues/25533. Fixes
https://github.com/denoland/deno/issues/25396.

Previously we only supported it on `deno install` and `deno cache`,
which is annoying if you're using `nodeModulesDir: auto`.

Also changes from printing output of lifecycle scripts directly to
capturing the output and only printing it on error.
2024-10-12 12:14:32 -07:00
Marvin Hagemeister
9117a9a43c
fix(node): make process.stdout.isTTY writable (#26130)
Fixes https://github.com/denoland/deno/issues/26123
2024-10-11 19:14:10 +02:00
Nayeem Rahman
94b588ce66
fix(lsp): relative completions for bare import-mapped specifiers (#26137) 2024-10-11 07:40:17 +01:00
Marvin Hagemeister
ccdbeb433b
fix(install): duplicate dependencies in package.json (#26128)
Fixes https://github.com/denoland/deno/issues/26120
2024-10-10 21:31:45 +02:00
David Sherret
66929de3ba
fix(unstable/worker): ensure import permissions are passed (#26101)
We only had integration tests for this and not an integration test.

Closes #26074
2024-10-10 14:01:42 +01:00
David Sherret
251840a60d
fix: do not panic on wsl share file paths on windows (#26081)
A test is going to fail on windows (I'm not on a windows machine atm, so
running the CI to see what fails)

Closes #26080
2024-10-09 18:49:56 +01:00
Bartek Iwańczuk
20ae8db50d
fix(repl): importing json files (#26053)
Closes https://github.com/denoland/deno/issues/26041
2024-10-09 10:04:44 +02:00
Bartek Iwańczuk
0dfd333649
fix(jupyter): keep running event loop when waiting for messages (#26049)
Closes https://github.com/denoland/deno/issues/24421
2024-10-09 10:04:15 +02:00
Leo Kettmeir
b2504b7b4d
fix: disable same-origin.html WPT (#26067)
It's very flaky on CI
2024-10-08 06:15:28 -07: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
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
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
e54809f2d5
fix(ext/crypto): fix identity test for x25519 derive bits (#26011) 2024-10-03 16:46:48 +05:30
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
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
Nayeem Rahman
3881b71734
feat(lsp): quick fix for @deno-types="npm:@types/*" (#25954) 2024-10-01 22:55:02 +01: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
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
David Sherret
d7b787792c
fix(info): error instead of panic for npm specifiers when using byonm (#25947) 2024-09-30 19:46:43 +00:00
Marvin Hagemeister
c5c1869992
fix: precompile preserve SVG camelCase attributes (#25945)
See https://github.com/denoland/deno_ast/pull/278

Fixes https://github.com/denoland/deno/issues/25810
2024-09-30 21:25:30 +02:00
Nathan Whitaker
fbddd5a2eb
fix(node): Pass NPM_PROCESS_STATE to subprocesses via temp file instead of env var (#25896)
Fixes https://github.com/denoland/deno/issues/25401. Fixes
https://github.com/denoland/deno/issues/25841. Fixes
https://github.com/denoland/deno/issues/25891.
2024-09-27 12:35:37 -07:00
David Sherret
a8d1ab5276
fix(flags): --allow-all should conflict with lower permissions (#25909)
Using `--allow-all` with other `--allow-x` permission flags should cause
an error since `--allow-all` is a superset of `--allow-x`.

Closes #25901
2024-09-27 16:49:43 +00:00
Luca Casonato
6f0fbceaf2
fix(lint): correctly handle old jsx in linter (#25902)
Previously the CLI was incorrectly reporting `React` as unused in a JSX
file that uses the "old" transform.

The LSP was already handling this correctly.
2024-09-27 14:14:17 +00:00
Luca Casonato
3134abefa4
BREAKING(ext/net): improved error code accuracy (#25383)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-27 14:07:20 +00:00
Bartek Iwańczuk
09a7cc4723
refactor(fmt): rewrite HTML syntax error handling (#25892) 2024-09-26 20:44:36 -04:00
David Sherret
7cccb7422b
fix(info): move "version" field to top of json output (#25890) 2024-09-26 15:57:12 -04:00
Nathan Whitaker
543c687c34
feat(install): warn repeatedly about not-run lifecycle scripts on explicit installs (#25878)
Currently we only warn once. With this PR, we continue to warn about
not-run scripts on explicit `deno install` (or cache). For `run` (or
other subcommands) we only warn the once, as we do currently.
2024-09-26 17:13:33 +00:00
Nathan Whitaker
13c53d9727
fix(installl): make bin entries executable even if not put in node_modules/.bin (#25873)
Fixes https://github.com/denoland/deno/issues/25862.

npm only makes bin entries executable if they get linked into `.bin`, as
we did before this PR. So this PR actually deviates from npm, because
it's the only reasonable way to fix this that I can think of.

---

The reason this was broken in moment is the following:

Moment has dependencies on two typescript versions: 1.8 and 3.1

If you have two packages with conflicting bin entries (i.e. two
typescript versions which both have a bin entry `tsc`), in npm it is
non-deterministic and undefined which one will end up in `.bin`.

npm, due to implementation differences, chooses to put typescript 1.8
into the `.bin` directory, and so `node_modules/typescript/bin/tsc` ends
up getting marked executable. We, however, choose typescript 3.2, and so
we end up making `node_modules/typescript3/bin/tsc` executable.

As part of its tests, moment executes `node_modules/typescript/bin/tsc`.
Because we didn't make it executable, this fails.

Since the conflict resolution is undefined in npm, instead of trying to
match it, I think it makes more sense to just make bin entries
executable even if they aren't chosen in the case of a conflict.
2024-09-26 09:36:25 -07:00
David Sherret
7437f9d944
fix(doc): surface graph errors as warnings (#25888) 2024-09-26 12:31:03 -04:00
Bartek Iwańczuk
5504acea67
feat: add --allow-import flag (#25469)
This replaces `--allow-net` for import permissions and makes the
security sandbox stricter by also checking permissions for statically
analyzable imports.

By default, this has a value of
`--allow-import=deno.land:443,jsr.io:443,esm.sh:443,raw.githubusercontent.com:443,gist.githubusercontent.com:443`,
but that can be overridden by providing a different set of hosts.

Additionally, when no value is provided, import permissions are inferred
from the CLI arguments so the following works because
`fresh.deno.dev:443` will be added to the list of allowed imports:

```ts
deno run -A -r https://fresh.deno.dev
```

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-09-26 01:50:54 +00:00