1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
Commit graph

172 commits

Author SHA1 Message Date
Yoshiya Hinosawa
0ef1c774f6
fix(coverage): add tooltip to line count in html report (#23971)
closes #21582
2024-05-26 13:22:57 +09: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
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
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
Leo Kettmeir
7ab7a14db7
refactor(docs): use @experimental instead of @tags unstable (#23884) 2024-05-22 04:31:51 -07: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
Nayeem Rahman
a5111fbc4d
fix(cli): use CliNodeResolver::resolve() for managed node_modules (#23902) 2024-05-21 17:54:15 +01:00
Simon Lecoq
fa5c61e441
fix(cli/coverage): invalid line id in html reporter (#23908) 2024-05-21 13:37:36 +02:00
David Sherret
a2dbcf9e0a
perf: analyze cjs exports and emit typescript in parallel (#23856) 2024-05-18 11:42:03 -04:00
Marvin Hagemeister
812f2e4c22
fix: serve handler error with 0 arguments (#23652)
Fixes https://github.com/denoland/deno/issues/23651

Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-05-17 18:05:19 +05:30
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
Nayeem Rahman
f8956eb763
fix(lsp): respect types dependencies for tsc roots (#23825) 2024-05-16 22:12:25 +01:00
Nathan Whitaker
3cea44abde
chore: Fix flaky semantic tokens caching test (#23831)
The stderr stream from the LSP is consumed by a separate thread, so it
may not have processed the part we care about yet. Instead, wait until
you see the measure for the request you care about.
2024-05-15 11:38: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
1a788b58a0
chore: fix flaky rejection_handled_web_process (#23817)
Closes https://github.com/denoland/deno/issues/23712
2024-05-14 23:51:51 +00:00
Nayeem Rahman
dda8979cb1
fix(lsp): show reference code lens on methods (#23804) 2024-05-14 22:42:35 +01:00
David Sherret
1e2b0a2219
chore(tests): increase repl timeout on ci (#23812)
https://github.com/denoland/deno/actions/runs/9084225162/job/24964698935

```
---- run::file_fetcher_preserves_permissions stdout ----
command /Users/runner/work/deno/deno/target/debug/deno repl --quiet
command cwd /Users/runner/work/deno/deno/tests/testdata
------ Start Full Text ------
"const a = await import('http://localhost:4545/run/019_media_types.ts');\r\n"
------- End Full Text -------
Next text: "\r\n"
thread 'run::file_fetcher_preserves_permissions' panicked at tests/integration/run_tests.rs:4615:15:
Timed out.
```

Closes https://github.com/denoland/deno/issues/23690
Closes https://github.com/denoland/deno/issues/23682
Closes https://github.com/denoland/deno/issues/23625
2024-05-14 15:59:32 -04:00
David Sherret
432792a46c
chore: 045_proxy output stdout & stderr on failure (#23810)
Part of https://github.com/denoland/deno/issues/23624
2024-05-14 16:47:57 +00: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
Nathan Whitaker
19c0633a94
refactor(lsp): Have JS drive TSC event loop in LSP (#23565) 2024-05-09 13:49:10 -07:00
David Sherret
f0e8ec0146
fix(lsp): completions for using decl identifiers (#23748)
Closes #23688
2024-05-09 13:18:13 -04:00
Matt Mastracci
684377c92c
refactor(ext/tls): Implement required functionality for later SNI support (#23686)
Precursor to #23236 

This implements the SNI features, but uses private symbols to avoid
exposing the functionality at this time. Note that to properly test this
feature, we need to add a way for `connectTls` to specify a hostname.
This is something that should be pushed into that API at a later time as
well.

```ts
Deno.test(
  { permissions: { net: true, read: true } },
  async function listenResolver() {
    let sniRequests = [];
    const listener = Deno.listenTls({
      hostname: "localhost",
      port: 0,
      [resolverSymbol]: (sni: string) => {
        sniRequests.push(sni);
        return {
          cert,
          key,
        };
      },
    });

    {
      const conn = await Deno.connectTls({
        hostname: "localhost",
        [serverNameSymbol]: "server-1",
        port: listener.addr.port,
      });
      const [_handshake, serverConn] = await Promise.all([
        conn.handshake(),
        listener.accept(),
      ]);
      conn.close();
      serverConn.close();
    }

    {
      const conn = await Deno.connectTls({
        hostname: "localhost",
        [serverNameSymbol]: "server-2",
        port: listener.addr.port,
      });
      const [_handshake, serverConn] = await Promise.all([
        conn.handshake(),
        listener.accept(),
      ]);
      conn.close();
      serverConn.close();
    }

    assertEquals(sniRequests, ["server-1", "server-2"]);
    listener.close();
  },
);
```

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-05-09 10:54:47 -06: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
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
David Sherret
547ce6c3b8
chore: cleanup some coverage tests (#23738) 2024-05-08 16:07:56 -04:00
David Sherret
998036b399
chore: fix flaky net_listen_allow_localhost_4555 (#23726)
Moves the test npm registry server port from `4558` to `426x`
2024-05-07 17:21:56 +00:00
David Sherret
1587387bcc
chore(test): move npm registries to separate servers and to the tests/registry folder (#23717)
1. Moves the npm registries to their own dedicated ports.
2. Moves the data files out of `tests/testdata/npm/registry` to
`tests/registry/npm`.
2024-05-07 01:06:01 +00:00
Nathan Whitaker
672216d65a
fix(lsp): Pass diagnostic codes to TSC as numbers (#23720)
Fixes the `Debug Failure` errors described in
https://github.com/denoland/deno/issues/23643#issuecomment-2094552765 .

The issue here was that we were passing diagnostic codes as strings but
TSC expects the codes to be numbers. This resulted in some quick fixes
not working (as illustrated by the test added here which fails before
this PR).

The first commit is the actual fix. The rest are just test related.
2024-05-06 23:54:52 +00:00
Nathan Whitaker
8eb1f11112
chore: (Hopefully) make jupyter_execute_request test less flaky (#23689)
A bunch of small things, mostly around timing and making sure the
jupyter kernel is actually running and ready to respond to requests. I
reproduced the flakiness by running a script to run a bunch of instances
of the test in parallel, where I could get failures consistently. After
this PR, I can't reproduce the flakiness locally which hopefully means
that applies to CI as well
2024-05-06 23:32:22 +00:00
Jo Franchetti
a69b4646a0
docs: update categories to match new planned sitemap (#23677)
Updating categories for new sitemap as documented here:

https://lucid.app/lucidspark/744b0498-a133-494d-981c-76059dd18885/edit?view_items=jpvBwFdYlNdB&invitationId=inv_50c83415-2aa5-423f-b438-ea156695c08b
2024-05-05 18:56:55 -07:00
David Sherret
397be1a22c
chore: maybe make fmt_check_all_files_on_each_change_test less flaky (#23704)
https://github.com/denoland/deno/actions/runs/8958830735/job/24603538912
2024-05-05 18:09:45 -04:00
Leo Kettmeir
cd12d41627
chore: update wgpu (#23684) 2024-05-05 07:22:18 -07:00
David Sherret
d81e97f92f
chore: maybe make watcher tests less flaky (#23683)
Closes #23637
2024-05-03 17:31:12 -04:00
David Sherret
121769844d
fix(lsp): always cache all npm packages (#23679)
Closes #23659
2024-05-03 16:44:41 -04:00
Nayeem Rahman
1fce59281c
refactor(lsp): cleanup cache and module registry update (#23620) 2024-05-03 20:52:58 +01:00
Satya Rohith
02d0ff58d2
refactor(tests): move worker_threads itests to spec tests (#23648) 2024-05-03 05:52:47 +00:00
David Sherret
b7945a218e
chore: move cert itests to spec tests (#23607) 2024-05-03 00:43:12 +00:00
David Sherret
e0069c87c0
chore: make a couple repl tests less flaky (#23636)
These were both failing for me from time to time locally.
2024-05-01 16:37:17 +00:00
Nayeem Rahman
ac9e07bdfa
chore(lsp): revert import map pre-resolution for jsxImportSource (#23619) 2024-05-01 01:44:20 +01:00
Luca Casonato
6cdf81db7c
feat(cli): add support for jsxImportSourceTypes (#23419)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-04-30 18:12:35 +00:00
Kenta Moriuchi
783533d2e3
FUTURE: remove import assertions support for JavaScript (#23541)
Ref #17944, https://github.com/swc-project/swc/issues/8893

TypeScript removes the `assert` keywords in the transpile, so this PR
only works for JavaScript files
2024-04-29 22:43:05 +02:00
David Sherret
48daf2dc88
chore: add tests for moduleGraph2 (#23603)
Also did some renames from underscores to hyphens
2024-04-29 14:09:58 -04:00
David Sherret
da52058a94
chore: migrate bench, publish, and more itests to spec tests (#23584) 2024-04-29 10:08:27 -04:00
Yoshiya Hinosawa
8178f758bc
fix(ext/node): support process.stdin.unref() (#22865)
This PR adds private `[REF]()` and `[UNREF]()` methods to Stdin class,
and call them from Node.js polyfill layer (`TTY` class). This enables
`process.stdin.unref()` and `process.stdin.ref()` for the case when
stdin is terminal.

closes #21796
2024-04-27 20:25:18 +09:00
Leo Kettmeir
c519355624
feat(ci): category & unstable tags checker (#23568) 2024-04-26 09:04:29 -07:00
Matt Mastracci
8c9caeb418
chore: rework TLS code in test server (#23566)
In order to make the reqwest/rustls upgrade more straightforward, we
refactor the test server to depend on deno_tls.
2024-04-25 17:00:04 -04:00