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
```
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
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).
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.
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 patches Temporal to support the `getTimeZoneTransition` method on
`ZonedDateTime`.
See https://github.com/denoland/deno/issues/27731.
Co-authored-by: printfn <printfn@users.noreply.github.com>
- upgrade v8 to 13.4
- turbocall conversion for arraybuffers is now much more complex, so use
cranelift
- misc updates for deprecated fns
- v8 default stack size is too small now, causing stack overflow
exceptions in some tests
- add syscall shim to support new syscall in old sysroot
Cache busts the http cache when the lockfile integrity doesn't match
what's in the cache. This will help when someone's lockfile is in line
with the remote server, but their local cache isn't.
Supports `deno task --frozen=false some_task`, which is necessary
because with `"nodeModulesDir": "auto"` or `"global"` (the default with
no package.json) we do an auto-install of npm packages.
Closes https://github.com/denoland/deno/issues/28070
adds tracing and opentelemetry exporting to the LSP.
enable it in `.vscode/settings.json` (or wherever you configure the
LSP), like
```
{
"deno.tracing": true
}
```
which will by default export opentelemetry traces to `localhost:4317`
or
```
{
"deno.tracing": {
// all fields optional
"collector": "openTelemetry" (default) | "logging" (output in lsp log window)
"collectorEndpoint": "http://localhost:4318" (for opentelemetry)
"enable": true | false,
"filter": "info" // defaults to "info", but can be any span filter
}
}
```
---
a full working setup would be
1: Run jaeger (an opentelemetry collector with a nice UI):
```
docker run --rm -p 16686:16686 -p 4317:4317 jaegertracing/jaeger
```
2. Enable in .vscode/settings.json
```
{
"deno.tracing": true
}
```
3. Restart LSP (right now it only will start the opentelemetry exporter
on LSP startup)
3. open `http://localhost:16686` in your browser
---------
Co-authored-by: Nathan Whitaker <nathan@deno.com>
This commit removes the docs URL for diagnostics coming
from JS plugins. Before, we mistakenly printed
URLs pointing to `docs.deno.com`, even though they did not
exist.
An ability to actually specify a custom URL for plugin rules,
will be added in a follow up PR.
This commit adds an unstable lint plugin API.
Plugins are specified in the `deno.json` file under
`lint.plugins` option like so:
```
{
"lint": {
"plugins": [
"./plugins/my-plugin.ts",
"jsr:@deno/lint-plugin1",
"npm:@deno/lint-plugin2"
]
}
}
```
The API is considered unstable and might be subject
to changes in the future.
Plugin API was modelled after ESLint API for the
most part, but there are no guarantees for compatibility.
The AST format exposed to plugins is closely modelled
after the AST that `typescript-eslint` uses.
Lint plugins use the visitor pattern and can add
diagnostics like so:
```
export default {
name: "lint-plugin",
rules: {
"plugin-rule": {
create(context) {
return {
Identifier(node) {
if (node.name === "a") {
context.report({
node,
message: "should be b",
fix(fixer) {
return fixer.replaceText(node, "_b");
},
});
}
},
};
},
},
},
} satisfies Deno.lint.Plugin;
```
Besides reporting errors (diagnostics) plugins can provide
automatic fixes that use text replacement to apply changes.
---------
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
This PR adds the `--permit-no-files` cli options to the `bench`
subcommand. This will cause `deno bench --permit-no-files` to not return
an error when no bench files where found.
Shows directory import and missing extension suggestions in error
messages similar but not exactly to node.
Closes #26802
Co-authored-by: Hajime-san <Hajime-san@users.noreply.github.com>
This PR adds support for passing wildcard tasks. All matched tasks are
sorted in case they have dependencies. Tasks already in the dependency
tree will be pruned so that every task only runs once.
```json
{
"tasks": {
"foo-1": "echo 'foo-1'",
"foo-2": "echo 'foo-2'"
}
}
```
```sh
$ deno task "foo-*"
Task foo-1 echo 'foo-1'
foo-1
Task foo-2 echo 'foo-2'
foo-2
```
The changes in the PR look a little bigger than they really are due to
formatting. For the most part, I've only needed to hoist up the task
matching logic.
Closes https://github.com/denoland/deno/issues/26944
Closes https://github.com/denoland/deno/issues/21530
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Initial implementation of WebTransport client and server!
This is very unstable because the interface should eventually shift to
use hyper (h3 is on the [2025
roadmap](https://hyper.rs/contrib/roadmap/)) instead of manually messing
with the the protocol, which will enable integration with
Deno.serveHttp/etc and allow WebTransport over h2. This will also let us
expose multiplexing.
WebTransport stats will be a followup due to their complexity.
Fixes: https://github.com/denoland/deno/issues/9017