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
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
```
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).
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
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.
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>
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`.
This commits moves all `.d.ts` files from `ext/*` to `cli/tsc/dts`.
Due to TSC snapshot removal, `cargo publish` is now erroring out,
unable to find the declaration files. These files were moved to
"cli/tsc/dts", because it's much easier than keeping them in
extension directories, while still providing them compressed
or uncompressed depending on the build type.