0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-10 06:07:03 -04:00
Commit graph

7215 commits

Author SHA1 Message Date
Marvin Hagemeister
1f6f561979
fix(unstable): lint plugin fix :has(), :is/where/matches and :not() selectors (#28348)
This PR adds support for `:has/:is/:where()` and `:not()`. The latter
was already present, but found a bunch of issues with it and I'd say
that it didn't really work before this PR.


Fixes https://github.com/denoland/deno/issues/28335
2025-03-04 16:04:39 +01:00
Marvin Hagemeister
842a906295
fix(unstable): lint plugin child combinator not working with groups (#28360)
Internally, we use a group node for array-like children, which is hidden
from the user. When we're asking for a parent of a node we need to take
group nodes into account and walk over them.

Fixes one issue reported in
https://github.com/denoland/deno/issues/28355
2025-03-03 21:44:04 +01:00
Marvin Hagemeister
9bcbef6d2f
fix(unstable): lint plugin swapped exported and source for ExportAllDeclaration (#28357)
The `source` and `exported` property were swapped for the
`ExportAllDeclaration` node.

Fixes one issue reported at
https://github.com/denoland/deno/issues/28355
2025-03-03 11:03:29 +01:00
Marvin Hagemeister
62bc07884b
fix(unstable): Missing PrivateIdentifier type for PropertyDefinition key (#28358)
The `PropertyDefinition` node also allows `PrivateIdentifier` as a type
for the `key`. Example:

```ts
class Foo {
  #foo = 2;
}
```

Fixes one issue reported in
https://github.com/denoland/deno/issues/28355
2025-03-03 11:03:06 +01:00
Marvin Hagemeister
287bde1f72
fix(unstable): lint plugin ObjectPattern inconsistencies (#28359)
Fixes inconsistencies with `ObjectPattern` node to match TSESTree.

Fixes one issue reported in
https://github.com/denoland/deno/issues/28355
2025-03-03 11:02:52 +01:00
Marvin Hagemeister
b6b5c7d7d9
fix(unstable/lint): remove duplicated Fix vs FixData interface (#28344)
Noticed that we have two interfaces describing the same thing: `Fix` and
`FixData`. This PR removes the `FixData` one.
2025-02-28 16:20:23 +01:00
David Sherret
2a803fe2de
fix(check/npm): move not found errors inside npm packages to tsc diagnostics (#28337) 2025-02-28 10:06:20 -05:00
Marvin Hagemeister
3a1f3455b0
feat(unstable): lint plugins support field selectors (#28324)
This PR adds support for field selectors (`.<field>`) in the lint plugin
API. This is supported in ESLint as well, but was missing in our
implementation.

```css
/* Only search the test expression of an IfStatement */
IfStatement.test
```

Fixes https://github.com/denoland/deno/issues/28314
2025-02-28 15:10:02 +01:00
Marvin Hagemeister
b4aa3e6d1e
fix(unstable): lint plugin regex attribute selector not working (#28340)
The code to support regex matching on attribute values was already
there. I just forgot to wire it up properly in the selector matching
code.

Fixes https://github.com/denoland/deno/issues/28336
2025-02-28 12:59:41 +01:00
Nayeem Rahman
eea5eb1c40
fix(lsp): include prefix and suffix for rename edits (#28327) 2025-02-27 21:34:32 +00:00
David Sherret
ff970bd9fe
fix: deno_ast 0.46 (#28331) 2025-02-27 21:28:36 +00:00
Nayeem Rahman
1fe721f1f8
fix(lsp): limit languages in semantic tokens provider (#28310) 2025-02-26 16:00:40 +00:00
Dimitris Apostolou
cdf6ea32c4
chore: prefer workspace dependencies in order to avoid duplicate crates (#28281) 2025-02-26 14:55:47 +00:00
Bartek Iwańczuk
9f877ac5bd
fix(lint): run with --no-prompt (#28305)
Ref https://github.com/denoland/deno/issues/28258

This commit forces lint plugins to run with `--no-prompt` flag,
bringing parity between running plugins in the LSP and via
`deno lint`.

There's no agreement how to handle permissions in the lint
plugins yet, so it's better to make both subcommands behave
identically for the time being.
2025-02-26 09:15:56 -05:00
Bartek Iwańczuk
cbdbc75031
fix(add): better help text for --dev arg (#28304)
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
2025-02-25 23:50:45 +00:00
Nayeem Rahman
0f76f6c211
perf(lsp): don't set resolver npm reqs if unchanged (#28302) 2025-02-25 21:56:50 +00:00
Nathan Whitaker
ee4c14a550
chore: update to rust 1.85 (#28236)
Updates to use rust 1.85. Doesn't move to the 2024 edition, as that's a
fair bit more involved.

A nice side benefit is that the new rustc version seems to lead to a
slight reduction in binary size (at least on mac):

```
    FILE SIZE   
 -------------- 
  +4.3%  +102Ki    __DATA_CONST,__const
  [NEW] +69.3Ki    __TEXT,__literals
  [NEW] +68.5Ki    Rebase Info
  +5.0% +39.9Ki    __TEXT,__unwind_info
   +57% +8.85Ki    [__TEXT]
  [NEW] +8.59Ki    Lazy Binding Info
  [NEW] +5.16Ki    __TEXT,__stub_helper
  [NEW] +3.58Ki    Export Info
  [NEW] +3.42Ki    __DATA,__la_symbol_ptr
  -0.1%    -726    [12 Others]
 -21.4% -3.10Ki    [__DATA_CONST]
 -95.8% -3.39Ki    __DATA_CONST,__got
 -20.9% -3.43Ki    [__DATA]
  -0.5% -4.52Ki    Code Signature
 -100.0% -11.6Ki    [__LINKEDIT]
  -1.0% -43.5Ki    Symbol Table
  -1.6% -44.0Ki    __TEXT,__gcc_except_tab
  -0.2% -48.1Ki    __TEXT,__const
  -3.3% -78.6Ki    __TEXT,__eh_frame
  -0.7%  -320Ki    __TEXT,__text
  -1.5%  -334Ki    String Table
  -0.5%  -586Ki    TOTAL
```
2025-02-25 08:50:01 -08:00
denobot
b9cffda7c9
chore: forward v2.2.2 release commit to main (#28292)
This is the release commit being forwarded back to main for 2.2.2

Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2025-02-25 14:36:11 +05:30
Leo Kettmeir
4ba166b207
fix(http): generate OtelInfo only when otel metrics are enabled (#28286) 2025-02-24 20:27:35 -08:00
Marvin Hagemeister
f9166797d2
fix(lint): plugins ignored when no rust rule active (#28269)
When all Rust-based rules where filtered out we were bailing out early
instead of checking if there are plugin rules we need to run. This meant
we errored out with a "No lint rules to run" message, even though plugin
rules were active.

Fixes https://github.com/denoland/deno/issues/28267
2025-02-24 23:35:49 +01:00
David Sherret
234deac856
fix(config): allow specifying absolute path for patch and fix panic with exports in package.json (#28279)
Closes #28250
Closes #26031
2025-02-24 17:33:01 +00:00
Marvin Hagemeister
6ac6e933dc
fix(lint): update deno_lint (#28271)
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2025-02-24 18:05:17 +01:00
Bartek Iwańczuk
93a1bb738a
fix(lint): give access to SourceCode in 'deno test' (#28278)
Closes https://github.com/denoland/deno/issues/28273
2025-02-24 17:21:16 +01:00
Leo Kettmeir
0fbab02d0f
fix: add info suggestion for unsafely-ignore-certificate-errors and add --help=full (#28203)
For #27865
2025-02-24 08:20:59 -08:00
Kenta Moriuchi
bc71eb9541
refactor(cli): update JSON schemas versions (#28252) 2025-02-24 10:11:06 -05:00
Nayeem Rahman
0dc3e87cb7
fix(fmt): support "--ext vto" and "--ext njk" (#28262) 2025-02-24 12:09:53 +00:00
Luca Casonato
55dc6f4b93
fix(lint): don't recurse infinitely for large ASTs (#28265)
We previously failed to lint `./cli/tsc/00_typescript.js` with plugins,
because every "next" node would cause a new stack frame to be added.
2025-02-24 11:51:30 +01:00
Kenta Moriuchi
f373a20a6f
fix(cli): add compilerOptions.lib examples to config-file.v1.json (#28226)
closes #28222
2025-02-24 10:49:32 +01:00
Nathan Whitaker
37462c0890
perf(install): only read initialized file if we care about the tags (#28242)
Speeds up the caching part of this arbitrary `"nodeModulesDir": "auto"`
project by about 22%

We write the tags associated with a given npm package to the
`.initialized` file, so that byonm can correctly resolve tags. When
setting up the node modules dir, we read that file to see if we need to
update the tags.

If we don't have any tags associated with the package though, we can
just check for existence (which is a fair bit faster than trying to
`open` + `read` a file).

```
❯ hyperfine --warmup 3 "deno check src/**/*.ts" "../deno/target/release-lite/deno check src/**/*.ts"
Benchmark 1: deno check src/**/*.ts
  Time (mean ± σ):     369.9 ms ±   5.5 ms    [User: 286.9 ms, System: 128.9 ms]
  Range (min … max):   361.7 ms … 377.7 ms    10 runs

Benchmark 2: ../deno/target/release-lite/deno check src/**/*.ts
  Time (mean ± σ):     303.5 ms ±   5.9 ms    [User: 210.9 ms, System: 124.5 ms]
  Range (min … max):   292.7 ms … 315.0 ms    10 runs

Summary
  ../deno/target/release-lite/deno check src/**/*.ts ran
    1.22 ± 0.03 times faster than deno check src/**/*.ts
```
2025-02-22 01:16:00 +00:00
David Sherret
0261106414
fix(lsp): create cacheable ExportInfoMap per language service (#28240)
This needs to be created per language service so that it can provide the
current program correctly.
2025-02-22 00:48:50 +00:00
Yoshiya Hinosawa
0a1b01d5a2
refactor(coverage): simplify CoverageReporter trait (#28219) 2025-02-22 09:04:57 +09:00
David Sherret
29c4661d0b
refactor: separate publish from pm subcommands (#28237) 2025-02-21 17:02:33 -05:00
David Sherret
761a9b62ce
refactor(cli): extract TypeChecker to separate module (#28235)
Extracts it out of tools/check.rs to type_checker.rs which makes more
sense because this is used across sub commands.
2025-02-21 21:00:29 +00:00
Nathan Whitaker
d20c6b5b7d
fix(install): don't error on unknown media types in install (#28234)
Fixes https://github.com/denoland/deno/issues/28223

This is kind of an ugly fix, but it works, and I think is the easiest
way to handle the fact that when caching the module graph we might
encounter imports that won't actually error at runtime (for instance in
files that will be bundled).
2025-02-21 12:20:55 -08:00
Nayeem Rahman
876bac445a
fix(lsp): close server on exit notification (#28232) 2025-02-21 20:02:56 +00:00
David Sherret
a9f404e479
fix(check): regression - implicit jsxImportSource was not resolving (#28228) 2025-02-21 14:09:57 -05:00
Marvin Hagemeister
063299353d
fix(unstable): lint plugin :exit called at wrong time (#28229)
The `:exit` selectors were called at the wrong time during visiting.

They need to be called when going upwards and a node and all its
children have been fully visited. Instead we called it when the node +
all its sibling were visited which is wrong.

Fixes https://github.com/denoland/deno/issues/28227
2025-02-21 17:50:26 +00:00
Leo Kettmeir
f800f5444a
chore: remove unused dependencies (#28204) 2025-02-21 02:46:56 -08:00
denobot
84fabecc9b
chore: forward v2.2.1 release commit to main (#28213)
This is the release commit being forwarded back to main for 2.2.1

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2025-02-21 01:35:34 +00:00
David Sherret
4523ddd8d7
fix(publish): support jsx/tsx (#28188) 2025-02-20 22:39:51 +00:00
Nathan Whitaker
ce4e788430
fix(outdated): hint to use --latest if new versions are available in outdated --update (#28190) 2025-02-20 23:24:07 +01:00
Nathan Whitaker
e5de22b0b5
fix(coverage): exclude scripts with invalid URLs from raw coverage output (#28210)
Fixes https://github.com/denoland/deno/issues/28206.

Basically if you execute a script with `node:vm`, this produces a
"script" with the file name `evalmachine.<anonymous>`, which ends up
producing coverage like

```json
{
  "scriptId": "319",
  "url": "evalmachine.<anonymous>",
  "functions": [
    {
      "functionName": "",
      "ranges": [{ "startOffset": 0, "endOffset": 18, "count": 1 }],
      "isBlockCoverage": true
    }
  ]
}
```

We assume that the `url` field here (the specifier of the script) is a
valid URL, and so we error out when processing that coverage.

There are two potential fixes: either don't write the coverage files for
those scripts, or ignore the errors when we process the data. I went
with the former here.
2025-02-20 23:23:43 +01:00
Phil Hawksworth
b20f98ccf7
docs: add examples for SubtleCrypto (#28068)
Adds examples for subtleCrypto
(https://docs.deno.com/api/web/~/SubtleCrypto)

- generateKey
- importKey
- exportKey
- sign
- verify
- digest
- encrypt
- decrypt
- deriveBits
- deriveKey
- wrapKey
- unwrapKey

---------

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-02-20 22:57:54 +01:00
Jo Franchetti
5b24b67a6e
docs(canvas): Add examples to createImageBitmap jsdocs (#28055)
Adding examples to the JSDocs for createImageBitmap and
formatting/linting file

---------

Co-authored-by: Phil Hawksworth <phil@deno.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-02-20 21:24:18 +00:00
Jo Franchetti
c6c2fa8cec
docs(console): update console documentation (#28196)
Signed-off-by: Jo Franchetti <jofranchetti@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-02-20 21:50:57 +01:00
Jo Franchetti
ae8481a2f7
docs(web): update docs for globalThis.caches (#28061)
Co-authored-by: Phil Hawksworth <phil@deno.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-02-20 20:37:23 +00:00
David Sherret
03e4234962
fix(check): remove instability in loading lib files (#28202)
Also reduces memory usage.

Closes #28201
2025-02-20 12:41:58 -05:00
Leo Kettmeir
64abe902e5
fix: don't panic when running with // as a filepath (#28189)
Fixes #28128
2025-02-19 19:29:11 -08:00
Nathan Whitaker
08f5e797b6
fix(check/lsp): fall back to @types/* packages if npm package doesn't have types (#28185)
Fixes https://github.com/denoland/deno/issues/27569.
Fixes https://github.com/denoland/deno/issues/27215.

This PR makes it so type resolution falls back to looking for definitely
typed packages (`@types/foo`) if a given NPM package does not contain
type declarations.

One complication is choosing _which_ version of the `@types/*` package
to use, if the project depends on multiple versions. The heuristic here
is to try to match the major and minor versions, falling back to the
latest version. So if you have
```
@types/foo: 0.1.0, 0.2.0, 3.1.0, 3.1.2, 4.0.0
foo: 3.1.0
```
we would choose `@types/foo@3.1.2` when resolving types for `foo`.

---

Note that this only uses `@types/` packages if you _already_ depend on
them. So a follow up to this PR could be to add a diagnostic and
quickfix to install `@types/foo` if we don't find types for `foo`.
2025-02-19 23:55:06 +00:00
David Sherret
3da3fe8f7b
fix: better jsx workspace config resolution (#28186)
* https://github.com/denoland/deno_config/pull/158
2025-02-19 18:50:44 -05:00