Commit Graph

6083 Commits

Author SHA1 Message Date
Marvin Hagemeister
9686a8803e
feat: add jsx precompile skip element option (#23457)
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/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.
-->
This PR wires up a new `jsxPrecompileSkipElements` option in
`compilerOptions` that can be used to exempt a list of elements from
being precompiled with the `precompile` JSX transform.
2024-04-22 17:07:36 +02:00
Nathan Whitaker
aac7a8cb7c
perf(lsp): Batch "$projectChanged" notification in with the next JS request (#23451)
The actual handling of `$projectChanged` is quick, but JS requests are
not. The cleared caches only get repopulated on the next actual request,
so just batch the change notification in with the next actual request.

No significant difference in benchmarks on my machine, but this speeds
up `did_change` handling and reduces our total number of JS requests (in
addition to coalescing multiple JS change notifs into one).
2024-04-22 08:03:16 -07:00
Bartek Iwańczuk
a2bd1a724b
chore: update deno_config to 0.16.1 (#23480)
Closes https://github.com/denoland/deno/issues/23343
2024-04-21 03:04:30 +02:00
David Sherret
695f314a91
feat(task): support running npm binary commands in deno.json (#23478)
npm binary commands like `vite` from a `node_modules/.bin` folder will
now execute when defined in a deno.json

Closes https://github.com/denoland/deno/issues/23477
2024-04-20 20:13:46 -04:00
welfuture
e55087f57a
fix: Fix some typos in comments (#23470)
Signed-off-by: welfuture <wellfuture@qq.com>
2024-04-21 01:54:07 +02:00
Nathan Whitaker
f62018e80f
perf(lsp): Pass code action trigger kind to TSC (#23466) 2024-04-20 13:18:43 -07:00
Nayeem Rahman
79e6751cf7
perf(lsp): only store parsed sources for open documents (#23454) 2024-04-20 02:00:03 +01:00
Matt Mastracci
472a370640
feat(runtime): Allow embedders to perform additional access checks on file open (#23208)
Embedders may have special requirements around file opening, so we add a
new `check_open` permission check that is called as part of the file
open process.
2024-04-19 18:12:03 -06:00
Matt Mastracci
365e1f48f7
feat(ext/http): Add addr to HttpServer (#23442)
Adds an `addr` field to `HttpServer` to simplify the pattern
`Deno.serve({ onListen({ port } => listenPort = port })`. This becomes:
`const server = Deno.serve({}); port = server.addr.port`.

Changes:
- Refactors `serve` overloads to split TLS out (in preparation for
landing a place for the TLS SNI information)
- Adds an `addr` field to `HttpServer` that matches the `addr` field of
the corresponding `Deno.Listener`s.
2024-04-19 18:09:50 -06:00
Nathan Whitaker
b5ce9cda0d
perf(lsp): Avoid passing struct into op_resolve (#23452)
Going through serde_v8 is slow, so just pass the args separately.
`op_resolve` is especially hot, so any speedups are good.
2024-04-19 10:11:17 -07:00
David Sherret
c497e766f1
refactor: move redirect handling into deno_graph (#23444) 2024-04-19 01:43:28 +00:00
Nayeem Rahman
8e77f091ad
perf(lsp): cleanup document dependencies (#23426) 2024-04-19 00:51:16 +00:00
David Sherret
90688edcc2
fix(fmt): error for more unterminated nodes (#23449)
https://github.com/dprint/dprint-plugin-typescript/pull/628

Closes https://github.com/denoland/deno/issues/23438
2024-04-18 20:37:16 -04:00
Bartek Iwańczuk
6c90d2401b
fix(ext/node): remove unwraps from fallible conversions (#23447)
Removes `.unwrap()` calls from fallible conversion and replaces
with graceful error returns.
2024-04-18 23:53:03 +00:00
nokazn
3d841acf48
fix(cli): avoid deno add and deno vendor errors when deno.json is empty (#23439) 2024-04-18 15:48:15 -04:00
Bartek Iwańczuk
6a09a16d71
feat(ext/net): extract TLS key and certificate from interfaces (#23327)
Relands #23325
2024-04-18 11:21:08 -06:00
Nayeem Rahman
24fa5c784a
perf(lsp): release unused documents (#23398) 2024-04-17 21:40:42 +01:00
Nathan Whitaker
2dc3f6f57a
chore(lsp): Include new benchmark in the collected benchmark data (#23420)
So it will actually show up on the [deno benchmarks
site](http://deno.com/benchmarks)
2024-04-17 20:55:56 +01:00
Luca Casonato
71a1fa4c2e
fix(publish): support import equals (#23421) 2024-04-17 19:15:02 +00:00
Igor Zinkovsky
b3d7df5535
perf: v8 code cache (#23081)
This PR enables V8 code cache for ES modules and for `require` scripts
through `op_eval_context`. Code cache artifacts are transparently stored
and fetched using sqlite db and are passed to V8. `--no-code-cache` can
be used to disable.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-04-17 07:19:55 -07:00
Matt Mastracci
9c0446567b
fix(cli): Identify and fix a test deadlock (#23411)
If a worker tried to flush large amounts of data right as the test was
ending, it could cause the flush sync marker to get lost.
2024-04-16 15:14:59 -06:00
David Sherret
43c8c1cc6e
feat(check): allow using side effect imports with unknown module kinds (ex. css modules) (#23392)
This allows people to use imports like:

```ts
import "./app.css";
```

...with `deno check` in systems where there's a bundle step (ex. Vite).
This will still error when using it with `deno run` or if the referenced
file does not exist.

See test cases for behaviour.
2024-04-16 16:46:31 -04:00
Nathan Whitaker
422cff1f24
chore(lsp): Add benchmark for performance on a large real-world repo (#23395)
This PR adds a benchmark intended to measure how the LSP handles larger
repos, as well as its performance on a more realistic workload.

The repo being benchmarked is
[deco-cx/apps](https://github.com/deco-cx/apps) which has been vendored
along with its dependencies. It's included as a git submodule as its
fairly large. The LSP requests used in the benchmark are the actual
requests sent by VSCode as I opened, modified, and navigated around a
file (to simulate an actual user interaction).

The main motivation is to have a more realistic benchmark that measures
how we do with a large number of files and dependencies. The
improvements made from 1.42 to 1.42.3 mostly improved performance with
larger repos, so none of our existing benchmarks showed an improvement.

Here are the results for the changes made from 1.42 to 1.42.3 (the new
benchmark is the last one listed):

**1.42.0**

```test
Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 379ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1142ms)
   - Find/Replace
      (10 runs, mean: 51ms)
   - Code Lens
      (10 runs, mean: 443ms)
   - deco-cx/apps Multiple Edits + Navigation
      (5 runs, mean: 25121ms)
<- End benchmarking lsp
```

**1.42.3**

```text
Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 383ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1135ms)
   - Find/Replace
      (10 runs, mean: 55ms)
   - Code Lens
      (10 runs, mean: 440ms)
   - deco-cx/apps Multiple Edits + Navigation
      (5 runs, mean: 11675ms)
<- End benchmarking lsp
```
2024-04-16 12:26:51 -07:00
Matt Mastracci
c4d0fceec3
fix(cli): TestEventSender should be !Clone (#23405)
`TestEventSender` should not be Clone so we don't end up with multiple
copies of the same writer FD. This is probably not the cause of the test
channel lockups, but it's a lot easier to reason about.
2024-04-16 12:54:50 -06:00
Asher Gomez
534dd34f86
fix: add DENO_FUTURE to deno --help (#23368) 2024-04-17 02:58:48 +10:00
Satya Rohith
50223c5c53
fix(ext/node): dispatch beforeExit/exit events irrespective of listeners (#23382)
Closes https://github.com/denoland/deno/issues/23342
Closes https://github.com/denoland/deno/issues/21757
2024-04-16 13:45:41 +00:00
Bartek Iwańczuk
0a7f46b8c2
chore: forward v1.42.4 commit to main (#23394)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-04-16 02:41:59 +00:00
Nayeem Rahman
9a31698207
fix(lsp): slice strings by byte index in code actions (#23387)
Fixes #23361.
2024-04-16 01:07:32 +02:00
David Sherret
46c709e52f
fix(check): cache bust when changing nodeModulesDir setting (#23355) 2024-04-15 18:58:04 -04:00
David Sherret
6f278e5c40
fix(lsp): improved cjs tracking (#23374)
Our cjs tracking was a bit broken. It was marking stuff as esm that was
actually cjs leading to type checking errors.
2024-04-15 17:50:52 -04:00
Matt Mastracci
7e4ee02e2e
fix(ext/io): Fix NUL termination error in windows named pipes (#23379)
Due to a terminating NUL that was placed in a `r#` string, we were not
actually NUL-terminating pipe names on Windows. While this has no
security implications due to the random nature of the prefix, it would
occasionally cause random failures when the trailing garbage would make
the pipe name invalid.
2024-04-15 14:10:09 -06:00
Bartek Iwańczuk
a080acc1b4
refactor: move lifecycle events dispatch to Rust (#23358)
This commit moves logic of dispatching lifecycle events (
"load", "beforeunload", "unload") to be triggered from Rust.
Before that we were executing scripts from Rust, but now we
are storing references to functions from "99_main.js" and calling
them directly.

Prerequisite for https://github.com/denoland/deno/issues/23342
2024-04-15 20:08:33 +02:00
David Sherret
1835b4f061
fix(lsp): ensure project version is incremented when config changes (#23366)
I'm running into a node resolution bug in the lsp only and while
tracking it down I noticed this one.

Fixed by moving the project version out of `Documents`.
2024-04-15 00:07:04 +00:00
Nayeem Rahman
8f1a92f3c3
refactor(lsp): use fallback resolution in op_resolve() (#23329) 2024-04-14 22:42:58 +01:00
David Sherret
e277490c82
perf: do not clone swc Program when transpiling (#23365) 2024-04-14 17:15:17 -04:00
David Sherret
76df7d7c9b
fix(publish): do not error for param with initializer before required parameter (#23356)
* https://github.com/denoland/deno_graph/pull/440

Closes https://github.com/denoland/deno/issues/23331
2024-04-13 22:20:58 -04:00
David Sherret
720e45d25b
fix(publish): handle definite assignment on ts private properties (#23345) 2024-04-12 19:56:29 -04:00
Nathan Whitaker
3dacba5057
perf(lsp): Only deserialize response from op_respond once (#23349)
Previously we were deserializing it twice - once to `serde_json::Value`,
and then again from the `serde_json::Value` to a concrete type
2024-04-12 16:04:54 -07:00
Divy Srivastava
c56f2e0fc0
chore: upgrade deno_core to 0.274.0 (#23344)
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-04-12 21:45:38 +02:00
youngwendy
84e198f0d0
chore: remove repetitive words (#23341)
Signed-off-by: youngwendy <clonefetch@outlook.com>
2024-04-12 08:33:43 -06:00
Luca Casonato
650db71e35
chore: update deno_graph (#23340) 2024-04-12 13:10:57 +00:00
denobot
c92f118652
chore: forward v1.42.3 release commit to main (#23335)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-04-12 04:19:46 +00:00
David Sherret
98077e4b3c
fix(publish): do not warn about excluded external modules in node_modules directory (#23173) 2024-04-11 23:52:35 +00:00
Bartek Iwańczuk
f358ae6278
fix(inspector): don't panic if port is not free (#22745)
Closes https://github.com/denoland/deno/issues/22113
Closes https://github.com/denoland/deno/issues/23177
Closes https://github.com/denoland/deno/issues/22883
Closes https://github.com/denoland/deno/issues/22377
2024-04-12 01:17:10 +02:00
David Sherret
ade0cd5e97
fix: upgrade deno_ast related crates (#23187)
Had to revert back swc due to
https://github.com/swc-project/swc/issues/8840

Fixes:

- https://github.com/denoland/deno_lint/pull/1262
- https://github.com/denoland/deno_doc/pull/538
- https://github.com/denoland/deno_doc/pull/537
- https://github.com/denoland/deno_graph/pull/430
- https://github.com/denoland/deno_graph/pull/425
- https://github.com/denoland/deno_graph/pull/432
2024-04-11 23:00:17 +00:00
Nayeem Rahman
f1ea8ca358
perf(lsp): use a stub module in tsc for failed resolutions (#23313) 2024-04-11 21:55:27 +01:00
Bartek Iwańczuk
5758470ee4
Revert "refactor(ext/net): extract TLS key and certificate from inter… (#23325)
…faces (#23296)"

This reverts commit e190acbfa8.

Reverting because it broke stable API type declarations. We will reland
it for v1.43 with updated interfaces
2024-04-11 20:31:11 +00:00
Nathan Whitaker
4ab0215727
fix(lsp): Denormalize specifiers before calling $projectChanged (#23322)
Fixes the regression described in
https://github.com/denoland/deno/pull/23293#issuecomment-2049819724.
This affected jupyter notebooks, as the LSP was passing in already
denormalized specifiers, while the jupyter kernel was not. We need to
denormalize the specifiers to evict the proper keys from our caches.
2024-04-11 18:33:03 +00:00
David Sherret
df73db671b
fix(npm): local nodeModulesDir was sometimes resolving duplicates of same package (#23320) 2024-04-11 13:18:19 -04:00
denobot
ca7432b86b
chore: forward v1.42.2 release commit to main (#23315)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-04-11 13:37:24 +05:30