Commit Graph

6031 Commits

Author SHA1 Message Date
林炳权
9304126be5
chore: update to Rust 1.77.2 (#23262)
update to Rust 1.77.2


---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-04-10 22:08:23 +00:00
Asher Gomez
c6f1107e9c
chore: update references to deno_std to use JSR (#23239)
There are more uses of `deno.land/std` in the codebase, but for URL
parsing purposes rather than network calls or documentation.
2024-04-10 17:26:35 -04:00
Nayeem Rahman
7c5745a204
refactor(lsp): cleanup documents dependents calculation (#23295) 2024-04-10 19:58:49 +01:00
Asher Gomez
08f46ac446
fix(ext/fs): account for all ops in leak checks (#23300)
This is PR a smaller retry of #23066 that simply ensures all async
`ext/fs` ops are accounted for if left hanging in tests. This also sorts
the `OP_DETAILS` in alphabetical order for easy future reading.

When reviewing, it might be best to look at the commits in order for
better understanding.
2024-04-10 02:47:01 +00:00
Matt Mastracci
e190acbfa8
refactor(ext/net): extract TLS key and certificate from interfaces (#23296)
Removes the certificate options from all the interfaces and replaces
them with a new `TlsCertifiedKeyOptions`. This allows us to centralize
the documentation for TLS key management for both client and server, and
will allow us to add key object support in the future.

Also adds an option `keyFormat` field to the cert/key that must be
omitted or set to `pem`. This will allow us to load other format keys in
the future `der`, `pfx`, etc.

In a future PR, we will add a way to load a certified key object, and we
will add another option to `TlsCertifiedKeyOptions` like so:

```ts
export interface TlsCertifiedKeyOptions =
    | TlsCertifiedKeyPem
    | TlsCertifiedKeyFromFile
    | TlsCertifiedKeyConnectTls
    | { key: Deno.CertifiedKey }
```
2024-04-09 16:23:22 -06:00
Nathan Whitaker
f23155bca7
perf(lsp): More granular locking of FileSystemDocuments (#23291)
Previously we locked the entire `FileSystemDocuments` even for lookups,
causing contention. This was particularly bad because some of the hot
ops (namely `op_resolve`) can end up hitting that lock under contention.

This PR replaces the mutex with synchronization internal to
`FileSystemDocuments` (an `AtomicBool` for the dirty flag, and then a
`DashMap` for the actual documents).

I need to think a bit more about whether or not this introduces any
problematic race conditions.
2024-04-09 15:12:55 -07:00
Carlos Precioso
ecfc6b6413
docs: Fix typo "discreet" to "discrete" (#23290)
Changes `discreet` in the documentation for `discrete`

"Discreet" means careful to avoid being noticed, "discrete" means
separate parts, and is what the documentation refers to.
2024-04-09 13:59:54 -06:00
Asher Gomez
6157c85634
refactor: use chrono::DateTime::from_timestamp (#23273)
`chrono::NaiveDateTime::from_timestamp_opt()` was deprecated in
https://github.com/chronotope/chrono/pull/1473.

Prerequisite for #23272.
2024-04-08 21:46:54 +00:00
Nayeem Rahman
214bfa37aa
perf(lsp): cache ts config in isolate until new project version (#23283) 2024-04-08 22:20:20 +01:00
Asher Gomez
3826598974
chore: update deprecation notices of APIs to be soft-removed (#23076) 2024-04-09 06:53:02 +10:00
Asher Gomez
03b84197a0
chore: update WPT (#23111)
Should fix some of the current issues with the `wpt_epoch` workflow.

See
https://github.com/denoland/deno/actions/runs/8460701853/job/23179358486

---------

Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-04-08 20:46:53 +02:00
Nayeem Rahman
3c346c8ea6
perf(lsp): don't pass remote modules as tsc roots (#23259) 2024-04-08 19:45:20 +01:00
Nayeem Rahman
9752a153ea
Revert "perf(lsp): Don't retain SourceFileObjects in sourceFileCache longer than necessary (#23258)" (#23285) 2024-04-08 18:57:25 +01:00
Nathan Whitaker
b74a4f29f2
perf(lsp): Don't retain SourceFileObjects in sourceFileCache longer than necessary (#23258)
The TS language service requests source files via
[getSourceFile](7a25fd5ef0/cli/tsc/99_main_compiler.js (L560)).
In that function, we [unconditionally
add](7a25fd5ef0/cli/tsc/99_main_compiler.js (L613-L614))
the source file to our sourceFileCache. The issue is that we only remove
things from that cache if the source file [becomes out of
date](7a25fd5ef0/cli/tsc/99_main_compiler.js (L777-L783)).
For files that don't get changed, we keep them in the cache
indefinitely. So sometimes we keep SourceFile objects from being GC'ed
because they're retained in our cache, even though TS doesn't refer to
them any more. I see this in pretty much all of the heap snapshots I've
taken.

---

The fix here is pretty direct - just store weak references to the
sourcefiles in the cache. It doesn't really change our caching behavior,
it just prevents us from being the only retainer of a `SourceFile`. I
also split the `sourceFileCache` into a separate cache just for assets,
as we rely on those being alive.

The simpler fix is to only cache assets, but presumably that has a perf
impact.

---
In local testing, this PR reduced the size of the JS heap by about 1 GB
when using `deno lsp` in the Typescript repo.
2024-04-06 19:22:37 -07:00
Nayeem Rahman
f9f37963b7
refactor(lsp): remove DocumentInner (#23251) 2024-04-06 15:36:43 +01:00
David Sherret
83f92474c5
perf(lsp): use lockfile to reduce npm pkg resolution time (#23247)
This functionality was broken. The series of events was:

1. Load the npm resolution from the lockfile.
2. Discover only a subset of the specifiers in the documents.
3. Clear the npm snapshot.
4. Redo npm resolution with the new specifiers (~500ms).

What this now does:

1. Load the npm resolution from the lockfile.
2. Discover only a subset of the specifiers in the documents and take
into account the specifiers from the lockfile.
3. Do not redo resolution (~1ms).
2024-04-05 22:33:01 +00:00
Nayeem Rahman
61f1b8e8dc
fix(lsp): respect DENO_FUTURE for BYONM config (#23207) 2024-04-05 16:18:48 +01:00
David Sherret
049e703331
FUTURE: override byonm with nodeModulesDir setting (#23222)
Makes the `"nodeModulesDir"` setting take precedence over byonm when
using `DENO_FUTURE`.
2024-04-05 10:34:51 -04:00
Nayeem Rahman
7446b0163d
perf(lsp): don't keep remote module ast's in memory (#23230) 2024-04-04 23:39:17 +01:00
JOTSR
5dda32088a
fix(cli): update deno doc help to fit current usage (#23224) 2024-04-04 22:03:29 +00:00
Matt Mastracci
7cc584ed79
fix(cli): fix deadlock in test writer when test pipe is full (#23210)
The tests would deadlock if we tried to write the sync marker into a
pipe that was full because one test streamed just enough data to fill
the pipe, so when we went to actually write the sync marker we blocked
when nobody was reading.

We use a two-phase lock for sync markers now: one to indicate "ready to
sync" and the second to indicate that the sync bytes have been received.
2024-04-04 18:06:58 +00:00
Asher Gomez
207349cfb7
FUTURE: remove deprecated APIs within workers (#23220) 2024-04-05 03:27:18 +11:00
Bartek Iwańczuk
de3f0b93f5
refactor(flags): prepare for deno install changes (#23217)
This commit adds enum to "InstallFlags" and "UninstallFlags" that will
allow to support both local and global (un)installation.

Currently the local variant is not used.

Towards https://github.com/denoland/deno/issues/23062
2024-04-04 14:40:54 +00:00
Nathan Whitaker
92a8ada719
fix(lsp): Remove client-facing format failure warning (#23196)
Fixes #23163.

The client-facing warning doesn't provide any value and is super
annoying. We still emit a warning message on the server side for format
errors, which should fulfill the same (less intrusive) purpose.
2024-04-02 19:10:40 -07:00
Bartek Iwańczuk
c0b7454175
FUTURE: enable BYONM by default (#23194)
When `DENO_FUTURE=1` env var is present, then BYONM
("bring your own node_modules") is enabled by default.
That means that is there's a `package.json` present, users
are expected to explicitly install dependencies from that file.

Towards https://github.com/denoland/deno/issues/23151
2024-04-03 00:43:03 +02:00
Nayeem Rahman
2b1c6e172e
feat(lsp): respect nested deno.json for fmt and lint config (#23159) 2024-04-02 23:02:50 +01:00
David Sherret
b0c1bd82a8
fix: prevent cache db errors when deno_dir not exists (#23168)
Closes #20202
2024-04-01 18:58:52 -04:00
David Sherret
240b362c00
perf(node): put pkg json into an Rc (#23156)
Was doing a bit of debugging on why some stuff is not working in a
personal project and ran a quick debug profile and saw it cloning the
pkg json a lot. We should put this in an Rc.
2024-04-01 09:10:04 -04:00
denobot
8d158058e5
chore: forward v1.42.1 release commit to main (#23162)
This is the release commit being forwarded back to main for 1.42.1

Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-04-01 13:35:46 +05:30
David Sherret
b8af46e007
fix(check): ignore certain diagnostics in remote modules and when publishing (#23119)
Unused locals and parameters don't make sense to surface in remote
modules. Additionally, fast check can cause these kind of diagnostics
when publishing, so they should be ignored.

Closes #22959
2024-03-31 16:39:40 -04:00
Nayeem Rahman
0144594044
fix(lsp): don't apply preload limit to workspace walk (#23123) 2024-03-31 21:39:23 +01:00
David Sherret
db89ce33f4
chore(lsp): remove recursion in recurse_dependents (#23153)
Was investigating a separate stack overflow (that I've now found in the
node resolution code) and came across this. We should avoid recursion
(this is very old code).
2024-03-31 13:04:42 -04:00
David Sherret
eb6f6ff33d
refactor: cleanup main entrypoint (#23145) 2024-03-31 10:58:19 -04:00
David Sherret
d0a579a7b2
fix: deno_graph 0.69.10 (#23147)
* https://github.com/denoland/deno_graph/issues/420
* https://github.com/denoland/deno_graph/pull/424
2024-03-31 04:06:29 +01:00
Nayeem Rahman
524e451bfb
fix(lsp): implement missing ts server host apis (#23131) 2024-03-29 20:00:58 +00:00
Nayeem Rahman
d347e73f5a
fix(jsr): exclude yanked versions from 'deno add' and completions (#23113) 2024-03-28 19:02:07 +00:00
denobot
9c6eca1064
1.42.0 (#23105)
Bumped versions for 1.42.0

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-03-28 01:47:33 +01:00
Leo Kettmeir
dc985954e1
chore: update deno_doc to 0.119.0 (#23103) 2024-03-28 00:25:39 +01:00
Łukasz Czerniawski
08d5d32dfc
feat: add --watch-exclude flag (#21935)
This PR introduces the ability to exclude certain paths from the file watcher
in Deno. This is particularly useful when running scripts in watch mode,
as it allows developers to prevent unnecessary restarts when changes are
made to files that do not affect the running script, or when executing
scripts that generate new files which results in an infinite restart
loop.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-03-27 22:47:46 +00:00
Bartek Iwańczuk
d31f2307ee
feat(install): require -g / --global flag (#23060)
In preparation for upcoming changes to `deno install` in Deno 2.

If `-g` or `--global` flag is not provided a warning will be emitted:
```
⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use `-g` or `--global` flag.
```

The same will happen for `deno uninstall` - unless `-g`/`--global` flag
is provided
a warning will be emitted.

Towards https://github.com/denoland/deno/issues/23062

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-03-27 23:45:57 +01:00
Nathan Whitaker
2dc37f411e
feat(task): Task description in the form of comments (#23101)
Closes #22786.

TLDR;
```jsonc
{
  "tasks": {
    // Some comment
    //
    // describing what the task does
    "dev": "deno run -A --watch main.ts"
  }
}
```
```bash
deno task
```
![Screenshot 2024-03-27 at 1 43
49 PM](https://github.com/denoland/deno/assets/17734409/7a14da8c-8e63-45ba-9bfb-590d250b56a9)
2024-03-27 14:14:27 -07:00
David Sherret
68fecc6de4
fix: less aggressive vendor folder ignoring (#23100)
This is slightly breaking as some users want the `vendor` folder
excluded and may not have that specified in their deno.json.

Closes #22833
2024-03-27 14:25:39 -04:00
Bartek Iwańczuk
0e4d1cb5f9
feat(init): use jsr specifier for @std/assert (#23073)
This commit changes "deno init" subcommand to use "jsr:" specifier for
standard library "assert" module. It is unversioned, but we will change
it to `@^1` once `@std/assert` release version 1.0.

This allows us to start decoupling `deno` and `deno_std` release. The
release scripts have been updated to take that into account.
2024-03-27 18:51:52 +01:00
David Sherret
624e3a04e7
feat(task): cross-platform shebang support (#23091)
Adds cross-platform shebang support (supports using shebangs in `deno
task` on Windows)

https://github.com/denoland/deno_task_shell/pull/113
2024-03-27 13:19:25 -04:00
Nayeem Rahman
726ddabf1f
fix(lsp): use registry cache for completion search (#23094) 2024-03-27 16:02:05 +00:00
David Sherret
49f97d5f85
fix(check): do not suggest running with --unstable (#23092)
Closes #23079
2024-03-27 11:58:36 -04:00
Hajime-san
feb744cebd
fix(lsp): decoding percent-encoding(non-ASCII) file path correctly (#22582) 2024-03-27 15:58:18 +00:00
Nayeem Rahman
e1e1da2a04
fix(lsp): prefer cache over tsc quick fixes (#23093) 2024-03-27 03:10:23 +00:00
David Sherret
34a651ea2e
feat: type declarations for new Set methods (#23090)
Closes #22851
2024-03-26 21:59:24 -04:00
David Sherret
ac4a5f74b8
feat: TypeScript 5.4 (#23086)
Fork PR: https://github.com/denoland/TypeScript/pull/10

Closes #23080
2024-03-26 18:52:57 -04:00