0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-04 18:12:59 -05:00
Commit graph

13222 commits

Author SHA1 Message Date
David Sherret
adf461f0df
fix(task): support --frozen flag (#28094)
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
2025-02-13 13:22:15 +01:00
Marvin Hagemeister
e1871e5291
feat(unstable): add js lint plugin source code helpers (#28065)
This PR adds a part of the `SourceCode` API in eslint (see
https://eslint.org/docs/latest/extend/custom-rules#applying-fixes) .
It's used to get the text of the current node, etc.
2025-02-13 13:19:55 +01:00
Nathan Whitaker
bb4ee0cb17
refactor: support hmr feature for lsp files (#28103)
So you can edit (e.g.) 00_typescript.js and not have to recompile during
dev
2025-02-13 11:39:44 +00:00
David Sherret
d7203c9522
fix(completions): remove problematic character for powershell (#28102)
Untested because I am not on a windows machine atm. 

Closes #28092
2025-02-13 11:32:14 +00:00
David Sherret
7946906ac5
fix: add hint to run with --no-check when type checking fails (#28091) 2025-02-13 10:54:52 +00:00
denobot
4921411bb2
chore: forward v2.1.10 release commit to main (#28099)
This is the release commit being forwarded back to main for 2.1.10

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2025-02-13 08:33:19 +00:00
Nathan Whitaker
33bccf9090
perf(check): use v8 code cache for extension sources in deno check (#28089)
In particular this helps startup of the TSC isolate because
`00_typescript.js` can use the code cache.

Overall, this offsets a fair bit of the hit we took when we removed the
TSC snapshot.

```
❯ hyperfine --warmup 5 -p "rm -rf ~/Library/Caches/deno/check_cache_v2" "./deno-this-pr check main.ts" "./deno-no-snapshot check main.ts" "./deno-with-snapshot check main.ts"
Benchmark 1: ../../deno/target/release-lite/deno check main.ts
  Time (mean ± σ):     145.7 ms ±   3.6 ms    [User: 347.6 ms, System: 36.9 ms]
  Range (min … max):   142.2 ms … 155.9 ms    19 runs

Benchmark 2: ./deno-no-snapshot check main.ts
  Time (mean ± σ):     195.4 ms ±   3.3 ms    [User: 397.7 ms, System: 34.9 ms]
  Range (min … max):   192.1 ms … 206.0 ms    15 runs

Benchmark 3: ./deno-with-snapshot check main.ts
  Time (mean ± σ):     109.0 ms ±   2.2 ms    [User: 155.9 ms, System: 19.3 ms]
  Range (min … max):   106.5 ms … 118.0 ms    26 runs

Summary
  ./deno-with-snapshot check main.ts ran
    1.34 ± 0.04 times faster than ./deno-this-pr check main.ts
    1.79 ± 0.05 times faster than ./deno-no-snapshot check main.ts
```
2025-02-12 17:47:00 +00:00
Bartek Iwańczuk
55c5b07535
perf(lsp): add built-in tracing support for the LSP (#27843)
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>
2025-02-12 08:40:40 -08:00
Nayeem Rahman
555a4ac0c4
fix(lsp): include description for auto-import completions (#28088) 2025-02-12 15:59:18 +00:00
Divy Srivastava
cda0c5b3ae
fix: do special file permission check for check_read_path (#27989)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-02-12 15:46:21 +00:00
Leo Kettmeir
7253820764
refactor: object wrap WebGPU (#27665)
Fixes #25874
Fixes #26760
Fixes #24288
Fixes #24798
Fixes #25627
Fixes #25915
Fixes #26769
2025-02-12 13:45:41 +00:00
David Sherret
7a112643f5
refactor(lsp): remove Send + Sync requirement (#28035) 2025-02-12 13:37:47 +00:00
Bartek Iwańczuk
d29f9f99dd
fix(lint): Deno.lint.runPlugin throws in deno run (#28063)
This commit changes `Deno.lint.runPlugin` to throw
in non-`deno test` subcommand, instead of returning
`undefined`.
2025-02-12 09:18:55 +00:00
Yoshiya Hinosawa
3ff9ca2533
docs(cli): update description of readFile and readFileSync (#28079) 2025-02-12 17:56:12 +09:00
Bartek Iwańczuk
795ecfdca6
refactor(lsp): make TS host use CLI snapshot (#28062)
This commit changes the TS host implementation
in the LSP to use the same snapshot as the runtime worker
and web worker use.

This is due to upcoming V8 upgrade that might require
that all isolates in the same process use the exact same
snapshot.
2025-02-11 18:33:04 +01:00
Leo Kettmeir
c1a0d63753
fix(streams): handle Resource stream error (#27975)
Fixes #27715
2025-02-11 09:27:52 -08:00
Marvin Hagemeister
a2afae46b6
fix(unstable): add missing rule context types (#28014) 2025-02-11 16:35:16 +01:00
Bartek Iwańczuk
23540c2825
refactor: remove tsc snapshot (#28056)
This reverts commit acdc7dcdcf
and relands 174e496847.

Closes https://github.com/denoland/deno/issues/28047
Closes https://github.com/denoland/deno/issues/28044
2025-02-11 15:36:07 +01:00
Jo Franchetti
07410d19cf
docs: adding examples and a see link to Websockets jdocs (#27957)
adding examples to websockets interfaces and a see link

---------

Co-authored-by: Phil Hawksworth <phil@deno.com>
2025-02-11 15:35:15 +01:00
Bartek Iwańczuk
b9183c737f
fix: allow creating TSC host without a snapshot (#28058) 2025-02-11 14:34:59 +00:00
Marvin Hagemeister
aead459fb2
feat(unstable): support multiple fixes from lint plugins (#28040)
This PR supports returning multiple changes from a lint fix. It works
the same way as eslint, see
https://eslint.org/docs/latest/extend/custom-rules#applying-fixes .

- Return a single fix
- Return an array of fixes
- Return a generator function with fixes
2025-02-11 15:24:28 +01:00
Divy Srivastava
196ceb76bb
fix(ext/node): DatabaseSync#exec should execute batch statements (#28053)
Fixes https://github.com/denoland/deno/issues/28050
2025-02-11 19:52:33 +05:30
Bartek Iwańczuk
acdc7dcdcf
Revert "refactor: remove tsc snapshot (#27987)" (#28052)
This reverts commit 174e496847.

That commit caused panic on startup like
https://github.com/denoland/deno/issues/28047
or https://github.com/denoland/deno/issues/28044.

Reverting for now, until we figure out what's going wrong.
2025-02-11 11:18:32 +00:00
Yoshiya Hinosawa
0945634127
test: clean up node_compat test runner (#28028) 2025-02-11 14:00:38 +09:00
Nathan Whitaker
174e496847
refactor: remove tsc snapshot (#27987)
Removes the TSC snapshot to unblock the V8 upgrade (which enables shared
RO heap, and is incompatible with multiple snapshots).


this compresses the sources and declaration files as well, which leads
to a roughly 4.2MB reduction in binary size.

this currently adds about 80ms to deno check times, but code cache isn't
wired up for the extension code (namely `00_typescript.js`) yet

```
❯ hyperfine --warmup 5 -p "rm -rf ~/Library/Caches/deno/check_cache_v2" "../../deno/target/release-lite/deno check main.ts" "deno check main.ts"
Benchmark 1: ../../deno/target/release-lite/deno check main.ts
  Time (mean ± σ):     184.2 ms ±   2.2 ms    [User: 378.3 ms, System: 48.2 ms]
  Range (min … max):   181.5 ms … 189.9 ms    15 runs

Benchmark 2: deno check main.ts
  Time (mean ± σ):     107.4 ms ±   1.2 ms    [User: 155.3 ms, System: 23.9 ms]
  Range (min … max):   105.3 ms … 109.6 ms    26 runs

Summary
  deno check main.ts ran
    1.72 ± 0.03 times faster than ../../deno/target/release-lite/deno check main.ts
```

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-02-10 16:39:18 +00:00
Bartek Iwańczuk
7bd210f9e8
fix(lint): don't show docs URLs for plugins (#28033)
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.
2025-02-10 17:32:31 +01:00
Nayeem Rahman
f630057243
ci(lsp): timeout tests after 5 minutes (#28036) 2025-02-10 16:15:43 +00:00
Nayeem Rahman
0ac6165390
ci(lsp): capture and echo stderr by default (#28032) 2025-02-10 14:50:16 +00:00
Bartek Iwańczuk
ad9429afbd
fix(lint): disable incremental caching if JS plugins are used (#28026)
Ref https://github.com/denoland/deno/issues/28025
2025-02-10 15:40:10 +01:00
Bartek Iwańczuk
d29d367e17
refactor(lint): remove dead documentation (#28027)
These docs have already been moved to `deno-docs` repo.
2025-02-10 15:38:11 +01:00
Bartek Iwańczuk
94a28f783d
fix(lint): out of order diagnostics for plugins (#28029)
This commit fixes racy condition in lint plugins
that could have caused diagnostics for another
file to be printed for completely unrelated file.

With this change, a oneshot channel is used
to receive diagnostics for a file, which ensures
that the caller will receive diagnostics for itself.
2025-02-10 13:22:57 +00:00
Nayeem Rahman
7d139ddd60
perf(lsp): cancellation checks in blocking code (#27997) 2025-02-10 11:52:31 +01:00
David Sherret
e94581d272
fix(lint): clear plugin diagnostics on each lint file run (#28011)
This clears the diagnostics whenever a file is about to run. For
example, what could previously occur is an error and the diagnostics
would be leftover from the previous run.
2025-02-07 17:47:28 +00:00
Marvin Hagemeister
615bf8a4b0
feat(unstable): type lint plugin visitor (#28005)
This PR strongly types the JS plugin visitor.

```ts
export default {
  name: "foo",
  rules: {
    bar: {
      create(ctx) {
        return {
          // Plain ast node visitor
          Identifier(node) {},

          // Exit visitor
          "Identifier:exit"(node) {},

          // Custom selectors, `node` needs to be typed manually
          "FunctionDeclaration > Identifier"(node: Deno.lint.Identifier) {}
        }
      }
    }
  }
}

```

Follow up to https://github.com/denoland/deno/pull/27977
2025-02-07 13:01:33 +01:00
Marvin Hagemeister
703fdd8607
fix: panic with js lint plugins and invalid js syntax (#28006)
Noticed that the LSP might panic during serialization when working on a
file with a syntax error.

This PR changes the serialization so that invalid nodes are simply
serialized to the invalid node `0`. The plugin code treats the node with
id `0` as an invalid node and will ignore it during visiting.

I'm not sure how to write a test for the LSP.
2025-02-07 12:35:44 +01:00
David Sherret
a82326d029
perf(compile): use bytes already in memory after downloading executable (#28000)
Not sure if this will help https://github.com/denoland/deno/issues/27988
but it's better anyway.
2025-02-06 23:24:06 -05:00
HasanAlrimawi
a0c5ef8ba8
fix(compile): never include the specified output executable in itself (#27877) 2025-02-06 23:23:10 +00:00
Marvin Hagemeister
dd1ee5821b
feat(unstable): align lint ast with TSEStree (#27996)
This PR fixes deviations in our AST format compared to TSEStree. They
are mostly a leftover for when I first started working on it and based
it off of babel instead.

One of the key changes why the changeset is a bit bigger is that
TSEStree uses `undefined` instead of `null` as the empty value for type
nodes. This is likely influenced by `tsc` which use `undefined`
everywhere. The rest of the nodes use `null` though. It's a little
weird, but for now it might be better to align.

(extracted from https://github.com/denoland/deno/pull/27977)
2025-02-06 21:45:56 +01:00
Marvin Hagemeister
89b1969f02
feat(unstable): add lint plugin ast types (#27977)
Add type definition for all TSEstree AST nodes in the JS lint plugin
system
2025-02-06 21:45:45 +01:00
Bartek Iwańczuk
15cfa05fa6
test: remove one of 'node_unit_tests::tls_test' tests (#27985)
It will be moved to `npm_smoke_tests` repo instead
2025-02-06 17:13:07 +01:00
Luca Casonato
6619210509
fix(otel): custom span start + end times are fractional ms (#27995)
Previously they were treated as fractional seconds.
2025-02-06 14:53:43 +01:00
Marvin Hagemeister
9213215d6d
feat(unstable): add test for lint plugin destroy hook (#27981)
Noticed that we didn't test the `destroy()` hook of lint plugins. This
PR adds a test for that.
2025-02-06 14:04:04 +01:00
Marvin Hagemeister
df02af27fd
feat(unstable): add lint.plugins to config schema (#27982)
Not sure what our handling of unstable properties in `deno.json` is.
This PR adds it to the config schema.

---------

Signed-off-by: Marvin Hagemeister <marvinhagemeister50@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-02-06 08:00:23 +00:00
Divy Srivastava
4a2b8fc22d
fix(ext/node): expose sqlite changeset constants (#27992)
https://nodejs.org/api/sqlite.html#sqliteconstants
2025-02-06 13:08:40 +05:30
Yoshiya Hinosawa
78fceb4a33
fix(ext/node): fix twitter-api-v2 compatibility (#27971) 2025-02-06 16:35:55 +09:00
Divy Srivastava
a401a79c75
fix(ext/node): fix missing privateKey.x in curve25519 JWK (#27990)
Fixes https://github.com/denoland/deno/issues/27972
2025-02-06 12:11:42 +05:30
Divy Srivastava
28faaee772
fix(ext/node): throw Session methods when database is closed (#27968) 2025-02-06 08:52:49 +05:30
Divy Srivastava
ece384c094
fix(ext/node): implement DatabaseSync#applyChangeset() (#27967)
https://nodejs.org/api/sqlite.html#databaseapplychangesetchangeset-options

```js
const sourceDb = new DatabaseSync(':memory:');
const targetDb = new DatabaseSync(':memory:');

sourceDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');
targetDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');

const session = sourceDb.createSession();

const insert = sourceDb.prepare('INSERT INTO data (key, value) VALUES (?, ?)');
insert.run(1, 'hello');
insert.run(2, 'world');

const changeset = session.changeset();
targetDb.applyChangeset(changeset);
// Now that the changeset has been applied, targetDb contains the same data as sourceDb. 
```
2025-02-06 08:52:39 +05:30
Nayeem Rahman
bc8554878e
fix(check): support sloppy imports with "compilerOptions.rootDirs" (#27973) 2025-02-05 23:08:10 +00:00
David Sherret
408d581fc1
chore: fix lockfile on main (#27978)
Every time I run `cargo test` or whatever the lockfile changes to this.
2025-02-05 19:03:45 +00:00