Commit graph

6290 commits

Author SHA1 Message Date
Kenta Moriuchi eda43c46de
fix: validate integer values in Deno.exitCode setter (#24068) 2024-06-02 21:29:01 -04:00
David Sherret 38ff9faff6
fix: retry writing lockfile on failure (#24052)
Ran into this running the deno_graph ecosystem tests where many
processes writing to the same path at the same time would cause an
error.
2024-05-31 23:25:08 -04:00
denobot 9e2971d40f
1.44.0 (#24045)
Bumped versions for 1.44.0

Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-05-30 04:49:23 +00:00
David Sherret 2d3b596cf5
feat: do not require DENO_FUTURE=1 for npmrc support (#24043) 2024-05-30 04:07:57 +00:00
Nayeem Rahman 556012320e
feat(lsp): support .npmrc (#24042)
Closes #24040
2024-05-30 03:16:15 +00:00
Aapo Alasuutari d67ee9a08b
BREAKING(ffi/unstable): use BigInt representation in turbocall (#23983)
Built ontop of #23981, this sets FFI
turbocalls (Fast Call API) to use the BigInt representation.
2024-05-30 08:00:11 +05:30
Nathan Whitaker a379009bfd
fix(cli): Prefer npm bin entries provided by packages closer to the root (#24024)
Fixes #24012.

In the case of multiple packages providing a binary with a same name, we
were basically leaving the results undefined (since we set up things in
parallel, and whichever got set up first won). In addition, we were
warning about these cases, even though it's a situation that's expected
to occur.

Instead, in the case of a collision in the binary names, we prefer the
binary provided by the package with the least depth in the dependency
tree.

While I was at it, I also took moved more code to `bin_entries.rs` since
it was starting to get a bit cluttered.
2024-05-29 17:45:22 -07:00
Luca Casonato e084fe10a9
feat(lint): add no-boolean-literal-for-arguments rule and enable no-unused-vars for jsx files (#24034)
* https://github.com/denoland/deno_lint/pull/1271
* https://github.com/denoland/deno_lint/pull/1277

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-30 00:09:16 +00:00
Luke Edwards 13723f267e
feat: Add Deno.exitCode API (#23609)
This commits adds the ability to set a would-be exit code 
for the Deno process without forcing an immediate exit, 
through the new `Deno.exitCode` API.

- **Implements `Deno.exitCode` getter and setter**: Adds support for
setting
and retrieving a would-be exit code via `Deno.exitCode`.
This allows for asynchronous cleanup before process termination 
without immediately exiting.
- **Ensures type safety**: The setter for `Deno.exitCode` validates that
the provided value is a number, throwing a TypeError if not, to ensure
that
only valid exit codes are set.

Closes to #23605

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-29 23:16:27 +00:00
Kyle Kelley cf611fbf54
chore: upgrade jupyter runtimelib to 0.11.0 (#24036)
Brings in:

* More fully typed structures (for when we get to implementing more)
* `with_metadata`, `with_buffers`, etc. from
https://github.com/runtimed/runtimed/pull/99

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-29 22:46:47 +00:00
Nayeem Rahman 3d3722507e
perf(repl): don't walk workspace in repl language server (#24037) 2024-05-29 21:31:09 +01:00
Marvin Hagemeister 3c3076a84c
fix(task): always use npm for npm run with flags (#24028) 2024-05-29 20:16:35 +00:00
David Sherret 814ac9a75d
perf: avoid building module graph if dynamic specifier already in graph (#24035) 2024-05-29 14:59:35 -04:00
David Sherret 94f040ac28
fix: bump cache sqlite dbs to v2 for WAL journal mode change (#24030)
In https://github.com/denoland/deno/pull/23955 we changed the sqlite db
journal mode to WAL. This causes issues when someone is running an old
version of Deno using TRUNCATE and a new version because the two fight
against each other.
2024-05-29 18:38:18 +00:00
Nayeem Rahman fada25b0dd
fix(lsp): don't discover deno.json in vendor dir (#24032) 2024-05-29 18:08:54 +01:00
David Sherret a8923534ed
chore: set lockfile as having no content changes after write (#24023)
Slight perf regression when updating deno_lockfile in
https://github.com/denoland/deno/pull/23979
2024-05-28 23:40:40 -04:00
Nayeem Rahman 14a74600de
perf(lsp): lock out requests until init is complete (#23998) 2024-05-29 01:26:43 +01:00
Nathan Whitaker 2024c974b6
perf(cli): Improve concurrency when setting up node_modules and loading cached npm package info (#24018)
The same issue in two different places - doing blocking FS work in an
async task, limiting the amount of work that happens concurrently.

- When setting up node_modules, where we try to set up entries
concurrently but were blocking other tasks from actually running.
- When loading package info from the npm registry file cache, loading
and deserializing is expensive and prevents concurrency. This was
especially noticeable when loading an npm resolution snapshot from a
lockfile (`snapshot_from_lockfile` in `deno_npm`).

Installing deps in `deno-docs`:

```
❯ hyperfine -i -p 'rm -rf node_modules/' '../d7/deno-main i' '../d7/target/release/deno i'
Benchmark 1: ../d7/deno-main i
  Time (mean ± σ):      2.193 s ±  0.027 s    [User: 0.589 s, System: 1.033 s]
  Range (min … max):    2.151 s …  2.242 s    10 runs

Benchmark 2: ../d7/target/release/deno i
  Time (mean ± σ):      1.597 s ±  0.021 s    [User: 0.977 s, System: 1.337 s]
  Range (min … max):    1.550 s …  1.627 s    10 runs

Summary
  ../d7/target/release/deno i ran
    1.37 ± 0.02 times faster than ../d7/deno-main i
```

Caching `npm:@11ty/eleventy`:
```
❯ hyperfine -i -p 'rm -rf node_modules/' --warmup 5 '../../d7/deno-main cache npm:@11ty/eleventy' '../../d7/target/release/deno cache npm:@11ty/eleventy'
Benchmark 1: ../../d7/deno-main cache npm:@11ty/eleventy
  Time (mean ± σ):     129.9 ms ±   2.2 ms    [User: 27.5 ms, System: 101.3 ms]
  Range (min … max):   127.5 ms … 135.8 ms    10 runs

Benchmark 2: ../../d7/target/release/deno cache npm:@11ty/eleventy
  Time (mean ± σ):     100.6 ms ±   1.3 ms    [User: 38.8 ms, System: 233.8 ms]
  Range (min … max):    99.3 ms … 103.2 ms    10 runs

Summary
  ../../d7/target/release/deno cache npm:@11ty/eleventy ran
    1.29 ± 0.03 times faster than ../../d7/deno-main cache npm:@11ty/eleventy
```

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-28 21:17:36 +00:00
David Sherret 69da5d8290
perf: skip npm install if graph has no new packages (#24017) 2024-05-28 16:24:07 -04:00
David Sherret 57617af16a
perf: parse source files in parallel (#23858) 2024-05-28 16:23:11 -04:00
Nathan Whitaker 3e8f29ae41
perf(cli): Optimize setting up node_modules on macOS (#23980)
Hard linking (`linkat`) is ridiculously slow on mac. `copyfile` is
better, but what's even faster is `clonefile`. It doesn't have the space
savings that comes with hardlinking, but the performance difference is
worth it imo.

```
❯ hyperfine -i -p 'rm -rf node_modules/' '../../d7/target/release/deno cache npm:@11ty/eleventy' 'deno cache npm:@11ty/eleventy'
Benchmark 1: ../../d7/target/release/deno cache npm:@11ty/eleventy
  Time (mean ± σ):     115.4 ms ±   1.2 ms    [User: 27.2 ms, System: 87.3 ms]
  Range (min … max):   113.7 ms … 117.5 ms    10 runs

Benchmark 2: deno cache npm:@11ty/eleventy
  Time (mean ± σ):     619.3 ms ±   6.4 ms    [User: 34.3 ms, System: 575.6 ms]
  Range (min … max):   612.2 ms … 633.3 ms    10 runs

Summary
  ../../d7/target/release/deno cache npm:@11ty/eleventy ran
    5.37 ± 0.08 times faster than deno cache npm:@11ty/eleventy
```
2024-05-28 11:59:17 -07:00
David Sherret 448fe67b7a
feat(vendor): support modifying remote files in vendor folder without checksum errors (#23979)
Includes:

* https://github.com/denoland/deno_graph/pull/486
* https://github.com/denoland/deno_graph/pull/488
* https://github.com/denoland/deno_lockfile/pull/25
* https://github.com/denoland/deno_lockfile/pull/22
* https://github.com/denoland/deno_graph/pull/483
* https://github.com/denoland/deno_graph/pull/470
2024-05-28 14:58:43 -04:00
Yoshiya Hinosawa 8b5089e41f
fix(coverage): do not generate script coverage with empty url (#24007)
closes #24004
2024-05-28 23:01:32 +09:00
Hajime-san 9aa593cd5d
fix(cli/test): decoding percent-encoding(non-ASCII) file path correctly (#23200)
# Summary

This PR resolves about the issue.
fixes #10810

And the formerly context is in the PR. 
#22582

Here is an expected behaviour example with this change.

- 🦕.test.ts
```ts
import { assertEquals } from "https://deno.land/std@0.215.0/assert/mod.ts";

Deno.test("example test", () => {
  assertEquals("🍋", "🦕");
});
```
2024-05-28 13:34:57 +00:00
Mike Mulchrone dc5c799c39
fix(deno_task): more descriptive error message (#24001)
Signed-off-by: Mike Mulchrone <mikemulchrone987@gmail.com>
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-05-28 13:33:08 +00:00
Asher Gomez adbd564758
FUTURE(ext/ffi,ext/webgpu): stabilize FFI and WebGPU APIs (#24011)
Closes #23906
2024-05-28 11:37:43 +00:00
Yoshiya Hinosawa e9cc8a2b53
fix(coverage): skip generating coverage json for http(s) scripts (#24008)
closes #21784
2024-05-28 20:25:46 +09:00
Divy Srivastava 53606de634
BREAKING(ffi/unstable): always return u64 as bigint (#23981)
The mixed `number | bigint` representation was useful optimization for
pointers. Now, pointers are represented as V8 externals. As part of the
FFI stabilization effort we want to make `bigint` the only
representation for `u64` and `i64`.

BigInt representation performance is almost on par with mixed
representation with the added benefit that its less confusing and users
don't need manual checks and conversions for doing operations on the
value.

```
cpu: AMD Ryzen 5 7530U with Radeon Graphics
runtime: deno 1.43.6+92a8d09 (x86_64-unknown-linux-gnu)

file:///home/divy/gh/ffi/main.ts
benchmark                 time (avg)        iter/s             (min … max)       p75       p99      p995
-------------------------------------------------------------------------- -----------------------------
nop                        4.01 ns/iter 249,533,690.5     (3.97 ns … 10.8 ns) 3.97 ns 4.36 ns 9.03 ns
ret bigint                 7.74 ns/iter 129,127,186.8    (7.72 ns … 10.46 ns) 7.72 ns 8.11 ns 8.82 ns
ret i32                    7.81 ns/iter 128,087,100.5    (7.77 ns … 12.72 ns) 7.78 ns 8.57 ns 9.75 ns
ret bigint (add op)       15.02 ns/iter  66,588,253.2   (14.64 ns … 24.99 ns) 14.76 ns 19.13 ns 19.44 ns
ret i32    (add op)       12.02 ns/iter  83,209,131.8   (11.95 ns … 18.18 ns) 11.98 ns 13.11 ns 14.5 ns
```
2024-05-28 09:31:09 +05:30
Yoshiya Hinosawa d99c6c1ea4
fix(coverage): handle ignore patterns (#23974)
closes #23972
2024-05-28 12:37:30 +09:00
David Sherret c4211e2ffc
fix(publish): raise diagnostics for triple-slash directives for --dry-run instead of just publish (#23811) 2024-05-28 01:35:08 +00:00
Bartek Iwańczuk 1667e28a15
FUTURE(ext/fs): stabilize file system APIs (#23968)
Closes https://github.com/denoland/deno/issues/23906

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-05-27 23:43:07 +00:00
Hasan-Alrimawi e44c538f37
fix: --env flag confusing message on syntax error (#23915)
Enhanced warning message for --env flag with run and eval subcommands. 

The commit is specifically made to address issue #23674 by improving the
warning messages that appear when using the --env flag with run or eval
subcommands in the following scenarios:

1. Missing environment file.
2. Incorrect syntax in the environment file content.


**Changes made**

- Distinguishes between cases of missing environment file and wrong
syntax in the environment file content.
- Shows a concise warning message to convey the case/issue occurred.

**Code changes & enhancements**
- Implemented a match statement to handle different types of errors
received while getting and parsing the file content to display a concise
warning message, rather than simple error check and then displaying the
same warning message for whatever the type of error is.
- Updated the related existing tests to reflect the new warning
messages.
- Added two test cases to cover the wrong environment file content
syntax with both run and eval subcommands.

**Impact**
The use of --env flag with both run/eval would be more user-friendly as
it gives a precise description of what is not right when using
incorrectly.

If you could give it a look, @dsherret , I appreciate your feedback on
these changes.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-27 15:06:18 +02:00
Alex Gleason f8975a8ecb
fix(ext/websocket): change default idleTimeout to 30s (#23985)
Change the default server websocket `idleTimeout` to 30s to work with common Nginx setups which have a default timeout of 60 seconds
2024-05-26 10:46:05 +05:30
Yoshiya Hinosawa 0ef1c774f6
fix(coverage): add tooltip to line count in html report (#23971)
closes #21582
2024-05-26 13:22:57 +09:00
Divy Srivastava 16ed81f62c
chore(cli): remove extract_standalone path from CLI (#23982)
No longer needed as standalone binaries use `denort`
2024-05-26 09:43:20 +05:30
David Sherret b21004b1d1
fix: use hash of in-memory bytes only for code cache (#23966)
* https://github.com/denoland/deno_core/pull/752
* https://github.com/denoland/deno_core/pull/753

Did benchmarking on this and it's slightly faster (couple ms) or equal
to in performance as main.

Closes #23904
2024-05-24 10:15:46 -04:00
Bartek Iwańczuk 92a8d09e49
fix(npm): set up node_modules/.bin/ entries for package that provide bin entrypoints (#23496)
Closes https://github.com/denoland/deno/issues/23036

---------

Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-05-23 23:43:38 +00:00
Bartek Iwańczuk 959739f609
FUTURE: initial support for .npmrc file (#23560)
This commit adds initial support for ".npmrc" files.

Currently we only discover ".npmrc" files next to "package.json" files
and discovering these files in user home dir is left for a follow up.

This pass supports "_authToken" and "_auth" configuration
for providing authentication.

LSP support has been left for a follow up PR.

Towards https://github.com/denoland/deno/issues/16105
2024-05-23 23:26:23 +02:00
Nathan Whitaker 5de30c5323
fix(cli): Support deno.lock with only package.json present + fix DENO_FUTURE install interactions with lockfile (#23918)
Fixes #23571.

Previously, we required a `deno.json` to be present (or the `--lock`
flag) in order for us to resolve a `deno.lock` file. This meant that if
you were using deno in an npm-first project deno wouldn't use a
lockfile.

Additionally, while I was fixing that, I discovered there were a couple
bugs keeping the future `install` command from using a lockfile.

With this PR, `install` will actually resolve the lockfile (or create
one if not present), and update it if it's not up-to-date. This also
speeds up `deno install`, as we can use the lockfile to skip work during
npm resolution.
2024-05-23 12:31:05 -07:00
Nayeem Rahman 0a30897925
refactor(lsp): determine file referrer for each document (#23867) 2024-05-23 17:31:56 +01:00
David Sherret 143ea4759f
feat(task): run npm run commands with Deno more often (#23794)
Closes #23036
2024-05-23 15:39:48 +00:00
Felipe Baltor fa1ba256d2
refactor: remove custom utc_now in favor of chrono::Utc:now feature (#23888)
This PR removes the use of the custom `utc_now` function in favor of the
`chrono` implementation. It resolves #22864.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-23 13:59:11 +02:00
Bert Belder de5b47b13c
perf(startup): use WAL journal for sqlite databases in DENO_DIR (#23955)
While investigating poor cold start performance on my GCP VM (32 cores,
130GB SSD), I found that writing to the various sqlite databases in
DENO_DIR was quite slow. The slowness seems to primarily be caused by
excessive latency from a number of `fsync()` calls.

The performance difference is best demonstrated by deleting the sqlite
databases from DENO_DIR while leaving the downloaded sources in place.

The benchmark (see notes below):

```
piscisaureus@bert-us:~/erofs/source$ export DENO_DIR=./.deno
piscisaureus@bert-us:~/erofs/source$ hyperfine --warmup 3   \
  --prepare "rm -rf .deno/*_v1*"                            \
  "deno run -A --cached-only demo.ts"                       \
  "eatmydata deno run -A --cached-only demo.ts"             \
  "~/deno/target/release/deno run -A --cached-only demo.ts"
Benchmark 1: deno run -A --cached-only demo.ts
  Time (mean ± σ):      1.174 s ±  0.037 s    [User: 0.153 s, System: 0.184 s]
  Range (min … max):    1.104 s …  1.212 s    10 runs
 
Benchmark 2: eatmydata deno run -A --cached-only demo.ts
  Time (mean ± σ):     265.5 ms ±   3.6 ms    [User: 138.5 ms, System: 135.1 ms]
  Range (min … max):   260.6 ms … 271.2 ms    11 runs
 
Benchmark 3: ~/deno/target/release/deno run -A --cached-only demo.ts
  Time (mean ± σ):     226.2 ms ±   9.2 ms    [User: 136.7 ms, System: 93.3 ms]
  Range (min … max):   218.8 ms … 247.1 ms    13 runs
 
Summary
  ~/deno/target/release/deno run -A --cached-only demo.ts ran
    1.17 ± 0.05 times faster than eatmydata deno run -A --cached-only demo.ts
    5.19 ± 0.27 times faster than deno run -A --cached-only demo.ts
```

Notes:
* Benchmark 1: unmodified Deno 1.43.6
* Benchmark 2: unmodified Deno 1.43.6 wrapped with `eatmydata` (which is
a tool to neuter `fsync()` calls)
* Benchmark 3: this PR applied on top of Deno 1.43.6


The script that got benchmarked:

```typescript
// demo.ts
import * as express from "npm:express@4.16.3";
import * as postgres from "https://deno.land/x/postgres/mod.ts";

let _dummy = [express, postgres]; // Force use of imports.
console.log("hello world");
```
2024-05-23 00:33:47 -04:00
Asher Gomez 71375491d1
feat(cli/test): deno test --clean (#23519)
The result of the call is ignored as it throws even when the directory
does not exist.

Closes #23491
2024-05-23 03:04:12 +00:00
Asher Gomez 8a636d0600
feat(ext/fetch): Request.bytes() and Response.bytes() (#23823)
Closes #23790
2024-05-23 00:27:58 +00:00
David Sherret f5d0c4b1ea
feat: add lowercase -v version flag (#23750)
Ref https://github.com/denoland/deno/issues/5289
2024-05-23 00:20:20 +00:00
Asher Gomez 4908d45758
feat(ext/fs): stabilize Deno.FsFile.unlock[Sync]() and Deno.FsFile.lock[Sync]() (#23754)
Related #22230
CC @dyedgreen
2024-05-23 09:17:00 +10:00
Luca Casonato 971f09abe4
fix(runtime): use more null proto objects (#23921)
This is a primordialization effort to improve resistance against users
tampering with the global `Object` prototype.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-23 00:03:35 +02:00
Asher Gomez 6c167c64d6
feat(ext/fs): stabilize Deno.FsFile.syncData[Sync]() and Deno.FsFile.sync[Sync]() (#23733)
Closes #22230
2024-05-22 21:59:51 +00:00
Hajime-san cbddf468e3
fix(lsp): process Fenced Code Block in JSDoc on completion correctly (#23822)
partially fixing https://github.com/denoland/deno/issues/23820


https://github.com/denoland/deno/assets/41257923/0adb5d4e-cfd5-4195-9045-19d1c0a07a43

BTW, it is out of scope on this PR that to process type of `@param` to
be an code block due to it's a bit complicated.
2024-05-22 12:00:14 -07:00
Matt Mastracci 596a2996cf
feat(cli): Add slow test warning (#23874)
By default, uses a 60 second timeout, backing off 2x each time (can be
overridden using the hidden `DENO_SLOW_TEST_TIMEOUT` which we implement
only really for spec testing.

```
Deno.test(async function test() {
  await new Promise(r => setTimeout(r, 130_000));
});
```

```
$ target/debug/deno test /tmp/test_slow.ts 
Check file:///tmp/test_slow.ts
running 1 test from ../../../../../../tmp/test_slow.ts
test ...'test' is running very slowly (1m0s)
'test' is running very slowly (2m0s)
 ok (2m10s)

ok | 1 passed | 0 failed (2m10s)
```

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-22 08:08:27 -06:00
Leo Kettmeir 7ab7a14db7
refactor(docs): use @experimental instead of @tags unstable (#23884) 2024-05-22 04:31:51 -07:00
Bartek Iwańczuk fabd9a214b
chore: forward v1.43.6 release commit to main (#23936)
Bumped versions for 1.43.6

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-05-22 01:35:04 +00:00
Nathan Whitaker db82e8b557
fix(lsp): Fix display of JSDoc named examples (#23927)
We were wrapping the display string in an unnecessary pair of triple
backticks, breaking highlighting

Before:
![Screenshot 2024-05-21 at 12 16
12 PM](https://github.com/denoland/deno/assets/17734409/1cf5a3ce-56dd-443d-9d1a-bd33625ff1f2)

After:
![Screenshot 2024-05-21 at 12 16
36 PM](https://github.com/denoland/deno/assets/17734409/646c4c48-9b5a-4326-bb95-b1374627d969)
2024-05-21 14:04:19 -07:00
Kyle Kelley 8698e80304
refactor(jupyter): use runtimelib for Jupyter structures and directory paths (#23826)
This brings in [`runtimelib`](https://github.com/runtimed/runtimed) to
use:

## Fully typed structs for Jupyter Messages

```rust
let msg = connection.read().await?;

self
  .send_iopub(
    runtimelib::Status::busy().as_child_of(msg),
  )
  .await?;
```

## Jupyter paths

Jupyter paths are implemented in Rust, allowing the Deno kernel to be
installed completely via Deno without a requirement on Python or
Jupyter. Deno users will be able to install and use the kernel with just
VS Code or other editors that support Jupyter.

```rust
pub fn status() -> Result<(), AnyError> {
  let user_data_dir = user_data_dir()?;

  let kernel_spec_dir_path = user_data_dir.join("kernels").join("deno");
  let kernel_spec_path = kernel_spec_dir_path.join("kernel.json");

  if kernel_spec_path.exists() {
    log::info!(" Deno kernel already installed");
    Ok(())
  } else {
    log::warn!("ℹ️ Deno kernel is not yet installed, run `deno jupyter --install` to set it up");
    Ok(())
  }
}
```

Closes https://github.com/denoland/deno/issues/21619
2024-05-21 22:35:21 +02:00
Nayeem Rahman cc8c0609eb
fix(lsp): apply import fix to missing declaration code action (#23924) 2024-05-21 21:15:16 +01:00
David Sherret ddb5449f42
chore: add test to ensure parsing only happens once on first load (#23837) 2024-05-21 16:12:40 -04:00
David Sherret 9795637724
fix(task): do not error if node_modules folder not exists (#23920)
Revealed https://github.com/denoland/deno/issues/23919

Closes #23914
2024-05-21 16:12:14 -04:00
Nayeem Rahman a5111fbc4d
fix(cli): use CliNodeResolver::resolve() for managed node_modules (#23902) 2024-05-21 17:54:15 +01:00
David Sherret 54eb930e8c
perf: resolver - skip cwd lookup if able (#23851)
The cwd lookup was taking 2% of a flamegraph I was looking at.
2024-05-21 10:38:06 -04:00
Simon Lecoq fa5c61e441
fix(cli/coverage): invalid line id in html reporter (#23908) 2024-05-21 13:37:36 +02:00
Bartek Iwańczuk c703ddd965
chore: force import assertion support (#23855)
https://github.com/denoland/deno/pull/23838 might accidentally disable
import assertions support because of V8 12.6 unshipping it, but we want
import assertions to be supported until Deno 2.
2024-05-21 00:10:43 +00:00
David Sherret c89f9f9ad1
perf(cache): compile ts to js in parallel for deno cache (#23892)
Closes https://github.com/denoland/deno/issues/23860
2024-05-20 13:49:12 -04:00
Kenta Moriuchi 9e890399fc
fix: add missing URL.parse types (#23893) 2024-05-19 15:55:15 +01:00
David Sherret a2dbcf9e0a
perf: analyze cjs exports and emit typescript in parallel (#23856) 2024-05-18 11:42:03 -04:00
denobot fcb6a18b2b
chore: forward v1.43.5 release commit to main (#23877)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-17 21:49:44 -04:00
David Sherret 1a0fbc4c3c
fix(npm): regression deserializing JSON for some npm packages (#23868)
* https://github.com/denoland/deno_npm/pull/53

Closes https://github.com/denoland/deno/issues/23862
2024-05-17 17:14:36 +00:00
Satya Rohith 20cb0e8863
feat(serve): support --port 0 to use an open port (#23846)
Closes https://github.com/denoland/deno/issues/23845
2024-05-17 05:38:50 +00:00
Bartek Iwańczuk 2b560be83f
chore: forward v1.43.4 commit to main (#23861)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-05-17 03:57:53 +02:00
Nayeem Rahman f8956eb763
fix(lsp): respect types dependencies for tsc roots (#23825) 2024-05-16 22:12:25 +01:00
Divy Srivastava 88983fb3eb
fix(node): seperate worker module cache (#23634)
Construct a new module graph container for workers instead of sharing it
with the main worker.

Fixes #17248
Fixes #23461

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-16 07:09:35 +00:00
Arnau Orriols f6c6e768c8
perf(compile): Do not checksum eszip content (#23839)
Related: https://github.com/denoland/eszip/pull/181

eszip < v0.69.0 hashes all its contents to ensure data integrity. This
feature is not necessary in Deno CLI as the binary integrity guarantee
is deemed an external responsibility (ie it is to be assumed that, if
necessary, the compiled binary will be checksumed externally prior to
being executed).

eszip >= v0.69.0 no longer performs this checksum by default. This
reduces the cold-start time of the compiled binaries, proportionally to
their size.
2024-05-15 21:13:53 -04:00
David Sherret 5385a42ec4
perf(jsr): download metadata files as soon as possible and in parallel (#23836)
* https://github.com/denoland/deno_graph/pull/471
* https://github.com/denoland/deno_graph/pull/473
2024-05-16 00:58:57 +02:00
David Sherret cb4d77421f
fix(doc): --lint - private ref diagnostic was displaying incorrect information (#23834)
* https://github.com/denoland/deno_doc/pull/576

Closes #23303
2024-05-15 14:53:45 -07:00
Nathan Whitaker 36d877be4a
perf(lsp): Cache semantic tokens for open documents (#23799)
VScode will typically send a `textDocument/semanticTokens/full` request
followed by `textDocument/semanticTokens/range`, and occassionally
request semantic tokens even when we know nothing has changed. Semantic
tokens also get refreshed on each change. Computing semantic tokens is
relatively heavy in TSC, so we should avoid it as much as possible.

Caches the semantic tokens for open documents, to avoid making TSC do
unnecessary work. Results in a noticeable improvement in local
benchmarking

before:
```
Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 383ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1079ms)
   - Find/Replace
      (10 runs, mean: 59ms)
   - Code Lens
      (10 runs, mean: 440ms)
   - deco-cx/apps Multiple Edits + Navigation
      (5 runs, mean: 9921ms)
<- End benchmarking lsp
```

after:
```
Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 395ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1024ms)
   - Find/Replace
      (10 runs, mean: 56ms)
   - Code Lens
      (10 runs, mean: 438ms)
   - deco-cx/apps Multiple Edits + Navigation
      (5 runs, mean: 8927ms)
<- End benchmarking lsp
```
2024-05-15 01:51:48 +00:00
David Sherret 4ddc85e1da
fix(emit): regression - keep comments in emit (#23815)
Closes https://github.com/denoland/deno/discussions/23814
2024-05-14 22:01:31 +00:00
Nayeem Rahman dda8979cb1
fix(lsp): show reference code lens on methods (#23804) 2024-05-14 22:42:35 +01:00
David Sherret e39b94f3aa
fix(runtime): output to stderr with colors if a tty and stdout is piped (#23813)
This also fixes a bug where Deno would output to stderr with colours
when piped and stdout was not piped.
2024-05-14 17:32:09 -04:00
David Sherret f16b4d4df8
fix(npm): make tarball extraction more reliable (#23759)
1. Extracts to a directory beside the destination.
2. Renames to the destination with retries.
2024-05-14 14:26:48 -04:00
David Sherret c0e3b6ed9d
fix(publish): always include config file when publishing (#23797)
Closes https://github.com/denoland/deno/issues/23796
2024-05-14 18:15:43 +00:00
David Sherret c6189e2070
fix(publish): error for missing version constraints on dry-publish instead of just publish (#23798)
Closes https://github.com/denoland/deno/issues/22835
2024-05-14 10:30:09 -04:00
futsuuu c0a600786e
fix: Add missing "junction" type for SymlinkOptions.types (#23756)
Junction symlink support is added in #22762, but `SymlinkOptions` and
its documents are not updated.
2024-05-14 15:06:21 +02:00
David Sherret 6084cf60ba
fix(doc/publish): support expando properties (#23795)
* https://github.com/denoland/deno_graph/pull/428
* https://github.com/denoland/deno_doc/pull/575

Closes https://github.com/denoland/deno/issues/23276
2024-05-14 00:00:33 +00:00
David Sherret f2dc3f9a94
chore(task): various small refactorings (#23793) 2024-05-13 22:55:14 +00:00
Leo Kettmeir df879f9f74
chore: cleanup unused dependencies (#23787) 2024-05-13 14:23:39 -07:00
Evan 329a8ae0c0
fix(cli): panic with deno coverage (#23353)
This PR directly addresses the issue raised in #23282 where Deno panics
if `deno coverage` is called with `--include` regex that returns no
matches.

I've opted not to change the return value of `collect_summary` for
simplicity and return an empty `HashMap` instead
2024-05-13 23:18:38 +02:00
Nayeem Rahman 88529f0b47
refactor(lsp): reuse CliGraphResolverOptions::sloppy_imports_resolver (#23764) 2024-05-13 17:55:31 +01:00
David Sherret 2b62a5b814
fix(npm): handle null fields in npm registry JSON (#23785)
* https://github.com/denoland/deno_npm/pull/52

Closes https://github.com/denoland/deno/issues/23776
2024-05-12 22:19:04 +00:00
denobot dac49a116e
chore: forward v1.43.3 release commit to main (#23771)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-10 19:20:34 -04:00
Nathan Whitaker 19c0633a94
refactor(lsp): Have JS drive TSC event loop in LSP (#23565) 2024-05-09 13:49:10 -07:00
Nayeem Rahman 439b3b8db9
refactor(lsp): unify caching into LspCache (#23746) 2024-05-09 20:22:27 +01:00
David Sherret f0e8ec0146
fix(lsp): completions for using decl identifiers (#23748)
Closes #23688
2024-05-09 13:18:13 -04:00
Nathan Whitaker dc29986ae5
fix(lsp): move sloppy import resolution from loader to resolver (#23751)
Moves sloppy import resolution from the loader to the resolver.

Also adds some test helper functions to make the lsp tests less verbose

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-09 14:17:31 +00:00
David Sherret 263b6b971d
fix(task): regression where npx <command> sometimes couldn't find command (#23730)
Closes https://github.com/denoland/deno/issues/23724
2024-05-09 03:16:44 +00:00
David Sherret 47f7bed677
chore: enable clippy::print_stdout and clippy::print_stderr (#23732)
1. Generally we should prefer to use the `log` crate.
2. I very often accidentally commit `eprintln`s.

When we should use `println` or `eprintln`, it's not too bad to be a bit
more verbose and ignore the lint rule.
2024-05-08 22:45:06 -04:00
denobot e6dc4dfbff
chore: forward v1.43.2 release commit to main (#23749)
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED**

This is the release commit being forwarded back to main for 1.43.2

Please ensure:
- [x] Everything looks ok in the PR
- [x] The release has been published

To make edits to this PR:
```shell
git fetch upstream forward_v1.43.2 && git checkout -b forward_v1.43.2 upstream/forward_v1.43.2
```

Don't need this PR? Close it.

cc @nathanwhit

Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-05-09 00:45:01 +00:00
Bartek Iwańczuk 4e23a5b1fc
FUTURE: deno install changes (#23498)
This PR implements the changes we plan to make to `deno install` in deno
2.0.
- `deno install` without arguments caches dependencies from
`package.json` / `deno.json` and sets up the `node_modules` folder
- `deno install <pkg>` adds the package to the config file (either
`package.json` or `deno.json`), i.e. it aliases `deno add`
- `deno add` can also add deps to `package.json` (this is gated behind
`DENO_FUTURE` due to uncertainty around handling projects with both
`deno.json` and `package.json`)
- `deno install -g <bin>` installs a package as a globally available
binary (the same as `deno install <bin>` in 1.0)

---------

Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-05-08 12:34:46 -07:00
David Sherret 525b3c8d74
fix: upgrade TypeScript from 5.4.3 to 5.4.5 (#23740)
https://github.com/denoland/TypeScript/pull/11
2024-05-08 13:54:56 -04:00
Nayeem Rahman 5e6c72d39f
refactor(lsp): cleanup partially locking methods (#23723) 2024-05-08 06:34:42 +01:00
David Sherret 5379bb0289
fix(jsr): panic when importing jsr package with deps via https (#23728)
Closes #23644
2024-05-07 21:53:17 +00:00