1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-19 04:16:00 -05:00
Commit graph

1450 commits

Author SHA1 Message Date
Marvin Hagemeister
3fb8fc1ba7
feat(unstable): refactor js lint plugin AST (#27615)
This PR changes the underlying buffer backed AST format we use for
JavaScript-based linting plugins. It adds support for various new types,
makes traversal code a lot easier and is more polished compared to
previous iterations.

Here is a quick summary (in no particular order):

- Node prop data is separate from traversal, which makes traversal code
so much easier to reason about. Previously, it was interleaved with node
prop data
- spans are in a separate table as well, as they are rarely needed.
- schema is separate from SWC conversion logic, which makes 
- supports recursive plain objects
- supports numbers
- supports bigint
- supports regex
- adds all SWC nodes

Apologies, this is kinda a big PR, but it's worth it imo.

_Marking as draft because I need to update some tests tomorrow._
2025-01-14 13:31:02 +01:00
David Sherret
1e95c20561
refactor: deno_config 0.45 (#27660) 2025-01-14 13:00:31 +01:00
siaeyy
a1f50a7422
fix(node/fs): add utimes method to the FileHandle class (#27582) 2025-01-14 18:08:22 +09:00
Aaron Ang
9cb089f6db
fix(ext/node): add writev method to FileHandle (#27563)
Part of #25554
2025-01-14 18:01:14 +09:00
TateKennington
5a39f2f096
fix(node): Prevent node:child_process from always inheriting the parent environment (#27343) (#27340)
Fixes #27343

Currently the node:child_process polyfill is always passing the full
parent environment to all spawned subprocesses. In the case where
`options.env` is provided those keys are overridden but the rest of the
parent environment is still passed through.

On Node the behaviour is for child processes to only inherit the parent
environment when `options.env` isn't specified. When `options.env` is
specified the child process inherits only those keys.

This PR updates the internal node child_process polyfill so that the
`clearEnv` argument is set to true when spawning the subprocess to
prevent the parent environment always being inherited by default. It
also fixes an issue where `normalizeSpawnArguments` wasn't returning the
`env` option if `options.env` was unset.
2025-01-13 13:46:56 -08:00
David Sherret
2a2b39eb2e
fix(compile): store embedded fs case sensitivity (#27653) 2025-01-13 12:02:37 -05:00
Nayeem Rahman
f912aac2cb
fix(lsp): handle pathless untitled URIs (#27637) 2025-01-13 15:31:08 +00:00
Yoshiya Hinosawa
2091691164
fix(ext/node): apply @npmcli/agent workaround to npm-check-updates (#27639)
See the comment
https://github.com/denoland/deno/pull/25470#issuecomment-2435077722 for
the reason why we do this workaround to make `make-fetch-happen` work in
Deno

This PR applies the same workaround to `npm-check-updates` package.
`npm-check-updates` internally uses
[`npm-registry-fetch`](https://www.npmjs.com/package/npm-registry-fetch)
which uses
[`make-fetch-happen`](https://www.npmjs.com/package/make-fetch-happen)
(the problematic package) for making http request to npm registry.

The detection of `make-fetch-happen` doesn't work for
`npm-check-updates` because we use call stack at `net.Socket`
constructor to check if it's called from `make-fetch-happen`, but
`npm-check-updates` bundles its dependency and the check doesn't work.

This PR adds the check of `npm-check-updates` string in call stack in
net.Socket constructor to trigger the workaroud.

closes #27629
2025-01-13 18:11:26 +09:00
Nathan Whitaker
70c822bfe2
fix(lsp/check): don't resolve unknown media types to a .js extension (#27631)
Fixes https://github.com/denoland/deno/issues/25762. Note that some of
the things in that issue are not resolved (vite/client types not working
properly which has other root causes), but the wildcard module
augmentation specifically is fixed by this.

We were telling TSC that files with unknown media types had an extension
of `.js`, so the ambient module declarations weren't applying. Instead,
just don't resolve them, so the ambient declaration applies.
2025-01-11 03:26:01 +00:00
David Sherret
f6dcc13537
fix(regression): show bare-node-builtin hint when using an import map (#27632) 2025-01-11 01:39:43 +00:00
Nayeem Rahman
318f524c5c
fix(lsp): use verbatim specifier for URL auto-imports (#27605) 2025-01-09 17:54:14 +00:00
Leo Kettmeir
ea30e188a8
refactor: update deno_core for error refactor (#26867)
Closes #26171

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2025-01-08 14:52:32 -08:00
Divy Srivastava
e233173653
fix(ext/websocket): Fix close code without reason (#27578)
Fixes https://github.com/denoland/deno/issues/27566

The close code wasn't sent if reason was None, defaulting to 1005. This
patch allows sending close code without reason.
2025-01-08 20:07:47 +05:30
Marvin Hagemeister
cabdfa8c2d
fix(lint): fix single char selectors being ignored (#27576)
The selector splitting code that's used for JS linting plugins didn't
properly account for selectors being a single character. This can happen
in the case of `*`.

Instead of comparing against the length, we'll now check if the
remaining string portion is not empty, which is more robust. It also
allows us to detect trailing whitespace, which we didn't before.
2025-01-08 00:21:50 +01:00
Nikolay Karadzhov
8cda4cf53d
feat(node/fs): Add a chmod method to the FileHandle class (#27522)
Add the chmod method to the FileHandle class in node compat as part of
#25554
2025-01-07 14:58:14 +01:00
Yoshiya Hinosawa
888ab9f4f7
test(ext/node): disable flaky dgram tests (#27549)
Closes #27316
2025-01-06 23:18:45 +01:00
Luca Casonato
f483996658
feat(unstable): no config npm:@opentelemetry/api integration (#27541)
After this PR, one does not need to import `jsr:@deno/otel` anymore.
2025-01-06 17:00:32 +01:00
snek
ccd375802a
refactor(quic): introduce endpoint, 0rtt, cleanup (#27444)
A QUIC endpoint is a UDP socket which multiplexes QUIC sessions, which
may be initiated in either direction. This PR exposes endpoints and
moves things around as needed.

Now that endpoints can be reused between client connections, we have a
way to share tls tickets between them and allow 0rtt. This interface
currently works by conditionally returning a promise.

Also cleaned up the rust op names, fixed some lingering problems in the
data transmission, and switched to explicit error types.
2025-01-06 15:24:59 +01:00
Luca Casonato
4b35ba6b13
feat(unstable): replace SpanExporter with TracerProvider (#27473) 2025-01-06 14:28:29 +01:00
Yoshiya Hinosawa
9ad0d4c3db
fix(ext/http): improve error message when underlying resource of request body unavailable (#27463)
The error message is currently `Bad Resource ID`. This commit changes it to
`Cannot read request body as underlying resource unavailable`

closes #27133
2025-01-06 16:12:21 +09:00
Kitson Kelly
7cabd02c59
fix(kv): improve backoff error message and inline documentation (#27537)
Ref: #27536
2025-01-04 00:04:14 +01:00
David Sherret
89c92b84fa
fix(check): move module not found errors to typescript diagnostics (#27533)
Instead of hard erroring, we now surface module not found errors as
TypeScript diagnostics (we have yet to show the source code of the
error, but something we can improve over time).
2025-01-03 21:49:56 +00:00
Nayeem Rahman
18b813b93f
fix(check): line-break between diagnostic message chain entries (#27543) 2025-01-03 18:30:41 +00:00
Bartek Iwańczuk
e9af7f8ebd
refactor: Use 'await using' in serve_test (#27532)
To make sure the servers are torn down when they throw an error during
test execution.
2025-01-02 23:56:36 +00:00
David Sherret
2092f0c697
fix(permissions): implicit --allow-import when using --cached-only (#27530)
`--cached-only` cannot communicate with a remote server

Closes https://github.com/denoland/deno/issues/27498
2025-01-02 16:55:03 -05:00
Nayeem Rahman
79c0b2ce73
fix(lsp): css preprocessor formatting (#27526) 2025-01-02 13:31:47 +00:00
Kenta Moriuchi
8fb073d7b4
chore: Happy New Year 2025 (#27509) 2024-12-31 19:12:39 +00:00
David Sherret
ac7b33a340
chore: cargo fmt - turn on group_imports=StdExternalCrate (#26646) 2024-12-31 12:13:39 -05:00
Bartek Iwańczuk
1cd36009b0
fix(ext/node): support private key export in JWK format (#27325)
Closes https://github.com/denoland/deno/issues/26643

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-12-31 13:49:02 +01:00
Je Xia
7b491a28df
fix(node): Add missing inspector/promises (#27491)
Add missing `inspector/promises` in node builtin module list, that
causes types checking error.
2024-12-31 11:06:21 +01:00
David Sherret
c391ad315e
refactor: use sys_traits (#27480) 2024-12-30 12:38:20 -05:00
Divy Srivastava
5194222e02
fix(ext/node): convert brotli chunks with proper byte offset (#27455)
Fixes https://github.com/denoland/deno/issues/27029
Fixes https://github.com/denoland/deno/issues/26086
2024-12-28 12:44:37 +05:30
Marvin Hagemeister
fdd0edf23c
fix(unstable): don't error on non-existing attrs or type attr (#27456)
When running selectors for JS linting plugins we would error when
encountering an unknown attribute name:

```js
// selector
Foo[non-existant]

// error
Error: Missing string id: <number>
```

This was caused by using `0` as the invalid marker, but also overloading
`0` with an actual node type. So the fix is to reserve `0` as the
invalid marker and move the property type to the next index.
2024-12-27 22:46:29 +01:00
Yoshiya Hinosawa
c45d0dadb3
fix(ext/node): add support of any length IV for aes-(128|256)-gcm ciphers (#27476) 2024-12-27 17:46:01 +09:00
Divy Srivastava
6061f22abd
fix(ext/node): RangeError timingSafeEqual with different byteLength (#27470)
Fixes https://github.com/denoland/deno/issues/27214
2024-12-27 11:20:49 +05:30
Luca Casonato
f4e321342f
feat(unstable): add OTEL MeterProvider (#27240)
This commit replaces `Deno.telemetry.MetricsExporter` with
`Deno.telemetry.MeterProvider`.

Signed-off-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: snek <snek@deno.com>
2024-12-26 09:01:39 +01:00
Yoshiya Hinosawa
91150706d8
fix(ext/node): make getCiphers return supported ciphers (#27466)
Currently we only supports 7 ciphers (`aes-(128|192|256)-ecb` and
`aes-(128|256)-(cbc|gcm)`) in `node:crypto`, but `crypto.getCiphers`
returns other supported cipher names. That confuses `npm:openpgp`
package and causes https://github.com/denoland/deno/issues/26875.

This PR makes `getCiphers` return actually supported cipher names.

With this change, the example given in #26875 can create private and
public key files.

closes #26875
2024-12-26 13:24:28 +09:00
Marvin Hagemeister
1a809b8115
feat(unstable): support selectors in JS lint plugins (#27452)
This PR adds support for using selectors in the JS linting plugin API.
Supported at the moment are:

- `Foo Bar` (descendant)
- `Foo > Bar` (child combinator)
- `Foo + Foo` (next sibling)
- `Foo ~ Foo` (subsequent sibling)
- `[attr]`, `[attr=value]` (attribute selectors, supported operators:
`=`, `!=`, `<`, `>`, `<=`, `>=`)
- `:first-child`
- `:last-child`
- `:nth-child(2)`, `:nth-child(2n + 1)`
2024-12-23 08:45:47 +01:00
Yoshiya Hinosawa
3cc861cdca
fix(ext/fetch): better error message when body resource is unavailable (#27429)
fixes #27132

When the body resource is unavailable when start reading it, the error
message is `Bad Resource ID` and that doesn't tell what's wrong very
well.

This PR changes that error message to `Cannot read body as underlying
resource unavailable`
2024-12-23 13:59:04 +09:00
David Sherret
e6869d7fa6
fix(node): handle cjs exports with escaped chars (#27438)
Closes https://github.com/denoland/deno/issues/27422
2024-12-21 10:00:18 -05:00
Marvin Hagemeister
26425a137b
feat(unstable): add JS linting plugin infrastructure (#27416)
This PR extracts the core part of
https://github.com/denoland/deno/pull/27203 to make it easier to review
and land in parts.

It contains:
-  The JS plugin code the deserializes and walks the buffer
- The Rust portion to serialize SWC to the buffer format (a bunch of
nodes are still todos, but imo these can land anytime later)
- Basic lint plugin types, without the AST node types to make this PR
easier to review
- Added more code comments to explain the format etc.


More fixes and changes will be done in follow-up PRs.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-12-21 00:58:03 +01:00
David Sherret
ece718eb3e
perf: upgrade to deno_semver 0.7 (#27426) 2024-12-20 21:14:37 +00:00
snek
65b647909d
feat(unstable): Implement QUIC (#21942)
Implements a QUIC interface, loosely based on the WebTransport API (a
future change could add the WebTransport API, built on top of this one).

[quinn](https://docs.rs/quinn/latest/quinn/) is used for the underlying
QUIC implementation, for a few reasons:
- A cloneable "handle" api which fits quite nicely into deno resources.
- Good collaboration with the rust ecosystem, especially rustls.
- I like it.

<!--
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.
-->
2024-12-20 13:48:48 +01:00
Filip Stevanovic
23f7032d56
fix(ext/node): add truncate method to the FileHandle class (#27389) 2024-12-20 13:23:51 +09:00
Nayeem Rahman
feb94d09e7
fix(lsp): rewrite imports for 'Move to a new file' action (#27427) 2024-12-20 02:33:35 +00:00
Marvin Hagemeister
351e79642a
fix(task): support tasks without commands (#27191)
Support running tasks that have no command and only dependencies. This
is useful for when you want to group tasks only.
2024-12-19 18:10:58 +00:00
David Sherret
074444ab6c
fix(compile): be more deterministic when compiling the same code in different directories (#27395)
Additionaly, this no longer unnecessarily stores the source twice for
file specifiers and fixes some sourcemap issues.

Closes https://github.com/denoland/deno/issues/27284
2024-12-19 12:53:52 -05:00
Yoshiya Hinosawa
350d9dce41
fix(ext/node): do not exit worker thread when there is pending async op (#27378)
This change fixes the premature exit of worker threads when there are still
remaining pending ops.

This change reuses the idea of #22647 (unref'ing `op_worker_recv_message` in
worker threads if closeOnIdle specified) and uses
`web_worker.has_message_event_listener` check in the opposite way as
#22944. (Now we continue the worker when `has_message_event_listener` is
true instead of stopping it when `has_message_event_listener` is false.

closes #23061
closes #26154
2024-12-19 17:39:20 +09:00
Filip Stevanovic
8fc4796ed5
fix(ext/node): Fix fs.access/fs.promises.access with X_OK mode parameter on Windows (#27407)
- Fixes an issue on Windows where the `fs.constants.X_OK` flag caused
`fs.access` and `fs.promises.access` to incorrectly throw a "permission
denied" error
- Introduced formatting changes due to the formatting tool
- Fixed the issue by always removing the `X_OK` bit from the mode
variable m (not sure if it's necessary to check for the presence of it
in the `mode` param first?)
- Updated unit tests to handle the mentioned constant
- `X_OK` bit is ignored in the Node implementation and should behave
like `F_OK`

fs constants Node documentation:
https://nodejs.org/api/fs.html#fsconstants

fixes https://github.com/denoland/deno/issues/27405
2024-12-18 14:52:37 -08:00
Bartek Iwańczuk
8590aa9cee
fix(ext/node): sort list of built-in modules alphabetically (#27410) 2024-12-18 14:44:53 +01:00