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

1295 commits

Author SHA1 Message Date
Bartek Iwańczuk
64e887083a
fix(fmt): don't use self-closing tags in HTML (#26754)
Closes https://github.com/denoland/deno/issues/26748
2024-11-06 13:56:03 +01:00
Nayeem Rahman
5088b25f23
feat(lsp): auto-import completions from byonm dependencies (#26680) 2024-11-06 06:26:46 +00:00
Mohammad Sulaiman
89f0b796bd
chore: deprecate run itests (#26444) 2024-11-05 06:39:05 +00:00
Nathan Whitaker
706b1dfcea
fix(add): better error message when adding package that only has pre-release versions (#26724)
Fixes https://github.com/denoland/deno/issues/26597

A small refactor as well to reduce some code duplication
2024-11-05 02:45:00 +00:00
Nathan Whitaker
44eca0505c
chore: fix serve_watch_all test (#26725)
It's been failing a ton lately, it looks like the test is just
incorrectly using TS syntax in a JS file
https://github.com/denoland/deno/actions/runs/11672972415/job/32502710624?pr=26724#step:43:2791

I'm not really sure how this ever passes
2024-11-05 01:09:17 +00:00
Bartek Iwańczuk
051552172c
fix(workspace): support wildcard packages (#26568)
This commit adds support for wildcard packages in `workspace`
configuration option in `deno.json`. This is now supported:
```
{
  "workspace": [
    "./packages/*"
  ]
}
```

Closes https://github.com/denoland/deno/issues/25783
2024-11-05 00:42:18 +01:00
Nayeem Rahman
d67765b0b4
fix(lsp): scope attribution for lazily loaded assets (#26699) 2024-11-04 20:01:31 +00:00
Bartek Iwańczuk
9a39a98b57
fix(fmt): ignore file directive for YAML files (#26717)
Closes https://github.com/denoland/deno/issues/26712

Support `# deno-fmt-ignore-file` directive for YAML files.

Also added tests for single line ignores.
2024-11-04 17:57:29 +00:00
Kenta Moriuchi
fb1d33a711
chore: update dlint to v0.68.0 for internal (#26711) 2024-11-04 12:17:11 -05:00
Nathan Whitaker
2c8a0e7917
fix(add): only add npm deps to package.json if it's at least as close as deno.json (#26683)
Fixes https://github.com/denoland/deno/issues/26653
2024-11-01 19:10:35 -07:00
David Sherret
826e42a5b5
fix: improved support for cjs and cts modules (#26558)
* cts support
* better cjs/cts type checking
* deno compile cjs/cts support
* More efficient detect cjs (going towards stabilization)
* Determination of whether .js, .ts, .jsx, or .tsx is cjs or esm is only
done after loading
* Support `import x = require(...);`

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-01 12:27:00 -04:00
Divy Srivastava
4774eab64d
chore: upgrade to rust 1.82 and LLVM 19 (#26615)
Upgrade to rust 1.82 and LLVM 19 . Removes one webusb test because
`requestAdapter` not working on new ubuntu 24 runners
2024-11-01 16:13:02 +05:30
Nathan Whitaker
04ae1a5517
fix(cli): set npm_config_user_agent when running npm packages or tasks (#26639)
Fixes #25342.

Still not sure on the exact user agent to set (should it include
`node`?).

After this PR, here's the state of running some `create-*` packages
(just ones I could think of off the top of my head):

| package                  | prints/runs/suggests deno install | notes |
| ---------------- | ------------- | ------ |
| `create-next-app` |  | falls back to npm, needs a PR
([code](c32e280209/packages/create-next-app/helpers/get-pkg-manager.ts (L3)))
| `sv create` |  | uses `package-manager-detector`, needs a PR
([code](https://github.com/antfu-collective/package-manager-detector/tree/main))
| `create-qwik` |  | runs `deno install` but suggests `deno start`
which doesn't work (should be `deno task start` or `deno run start`)
| `create-astro` |  | runs `deno install` but suggests `npm run dev`
later in output, probably needs a PR
| `nuxi init` |  | deno not an option in dialog, needs a PR
([code](f04e2e8944/src/commands/init.ts (L96-L102)))
| `create-react-app` |  | uses npm
| `ng new` (`@angular/cli`) |  | uses npm
| `create-vite` |  | suggests working deno commands 🎉 
| `create-solid` |   | suggests npm commands, needs PR

It's possible that fixing `package-manager-detector` or other packages
might make some of these just work, but haven't looked too carefully at
each
2024-10-31 22:19:19 -07:00
Nathan Whitaker
6c6bbeb974
fix(node): Implement os.userInfo properly, add missing toPrimitive (#24702)
Fixes the implementation of `os.userInfo`, and adds a missing
`toPrimitive` for `tmpdir`. This allows us to enable the corresponding
node_compat test.
2024-10-31 22:18:33 -07:00
Nathan Whitaker
6d44952d4d
fix(ext/node): resolve exports even if parent module filename isn't present (#26553)
Fixes https://github.com/denoland/deno/issues/26505

I'm not exactly sure how this case comes about (I tried to write tests
for it but couldn't manage to reproduce it), but what happens is the
parent filename ends up null, and we bail out of resolving the specifier
in package exports.

I've checked, and in node the parent filename is also null (so that's
not a bug on our part), but node continues to resolve even in that case.
So this PR should match node's behavior more closely than we currently
do.
2024-10-31 10:02:31 -07:00
David Sherret
90edca21a2
fix: surface package.json location on dep parse failure (#26665)
Related: https://github.com/denoland/deno/issues/26653
2024-10-31 15:35:17 +00:00
Taku Amano
50ea707b58
fix(coverage): exclude comment lines from coverage reports (#25939) 2024-10-31 23:20:26 +09:00
Nayeem Rahman
2f0c25d33f
fix(lsp): include unstable features from editor settings (#26655) 2024-10-31 10:52:43 +00:00
McSneaky
1431ffa9f8
docs(console): Update docstrings for install and uninstall (#26623)
When running `deno -h` then `install` and `uninstall` scripts had
description since deno 1 times :)
2024-10-30 16:32:04 +01:00
HasanAlrimawi
3b28446000
fix: support watch flag to enable watching other files than the main module on serve subcommand (#26622)
Closes #26618
2024-10-29 22:55:41 +01:00
Yoshiya Hinosawa
a69224ea5b
Revert "fix(ext/node): fix dns.lookup result ordering (#26264)" (#26621)
This reverts commit d59599fc18.

Closes #26588
2024-10-29 18:41:16 +01:00
Bartek Iwańczuk
484f8ca9c3
fix: provide hints in terminal errors for Node.js globals (#26610)
Add info/hint for terminal errors related to Node.js globals:
- __filename
- __dirname
- Buffer
- global
- setImmediate
- clearImmediate

Closes https://github.com/denoland/deno/issues/17494
2024-10-29 00:55:51 +01:00
David Sherret
0e641632c3
fix(check): expose more globals from @types/node (#26603)
Extracted out of https://github.com/denoland/deno/pull/26558

Closes https://github.com/denoland/deno/issues/26578
2024-10-28 17:43:41 -04:00
snek
4e38fbd0a3
fix: report exceptions from nextTick (#26579)
Fixes: https://github.com/denoland/deno/issues/24713
Fixes: https://github.com/denoland/deno/issues/25855
2024-10-28 18:16:43 +01:00
David Sherret
f61af864df
fix(compile): regression handling redirects (#26586)
Closes https://github.com/denoland/deno/issues/26583
2024-10-28 09:31:58 -04:00
Marvin Hagemeister
5389972ba5
fix(npm): match npm bearer token generation (#26544)
Spend some time stepping through the npm client code and noticed that
the bearer token was different from ours. They do some double encoding
and @dsherret helped me in matching the encoding behavior.

Fixes https://github.com/denoland/deno/issues/26033
2024-10-28 12:08:51 +01:00
familyboat
c314b2d857
fix(ext/node): add path to fs.stat and fs.statSync error (#26037) 2024-10-27 08:34:35 +05:30
Nathan Whitaker
ec968aa5ae
fix(install): cache json exports of JSR packages (#26552)
Fixes https://github.com/denoland/deno/issues/26509.

Ended up being a `deno_graph` bug causing the error to surface. This PR
updates `deno_graph` to pick up the fix and reverts the temporary
workaround that skipped JSON exports.
2024-10-25 20:19:03 +00:00
David Sherret
e70341e65e
fix(check): ignore resolving jsxImportSource when jsx is not used in graph (#26548) 2024-10-25 17:56:40 +00:00
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