Commit graph

915 commits

Author SHA1 Message Date
David Sherret 7ed90a20d0
fix: better handling of npm resolution occurring on workers (#24094)
Closes https://github.com/denoland/deno/issues/24063
2024-06-05 17:04:16 +02:00
David Sherret 3341c50b6a
refactor: don't share reqwest::HttpClient across tokio runtimes (#24092)
This also fixes several issues where we weren't properly creating http
clients with the user's settings.
2024-06-03 21:17:08 +00: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
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
Marvin Hagemeister 3c3076a84c
fix(task): always use npm for npm run with flags (#24028) 2024-05-29 20:16:35 +00: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
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
David Sherret 57617af16a
perf: parse source files in parallel (#23858) 2024-05-28 16:23:11 -04: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
Yoshiya Hinosawa e9cc8a2b53
fix(coverage): skip generating coverage json for http(s) scripts (#24008)
closes #21784
2024-05-28 20:25:46 +09:00
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
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
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
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
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
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
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
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
Simon Lecoq fa5c61e441
fix(cli/coverage): invalid line id in html reporter (#23908) 2024-05-21 13:37:36 +02: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
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
David Sherret f2dc3f9a94
chore(task): various small refactorings (#23793) 2024-05-13 22:55:14 +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
Nayeem Rahman 88529f0b47
refactor(lsp): reuse CliGraphResolverOptions::sloppy_imports_resolver (#23764) 2024-05-13 17:55:31 +01: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
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 2dcbef2abb
fix(compile): relative permissions should be retained as relative (#23719)
Closes #23715
2024-05-06 19:21:58 -04:00
Leo Kettmeir 1b27b58396
fix(test): proper type checking for files with doc tests (#23654)
Closes https://github.com/denoland/deno/issues/23430

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-05-02 18:13:51 +00:00
David Sherret 486437fee1
refactor(jupyter): move communication methods out of data structs (#23622)
Moves the communication methods out of the data structs and onto the
`Connection` struct.
2024-05-01 02:30:40 +00:00
Leo Kettmeir 544d248c16
chore: update deno_doc (#23621) 2024-05-01 00:43:24 +00: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
David Sherret 7d93704591
refactor: remove conditional color code in bench reporter (#23593)
There is no need for this conditional code because it's handled by the
`colors` module.
2024-04-29 09:27:55 -04:00
Leo Kettmeir 5a7414e163
chore: update deno_doc (#23544) 2024-04-24 20:34:21 +00:00
Matt Mastracci 2f8825a935
feat: Add deno serve subcommand (#23511)
By default, `deno serve` will assign port 8000 (like `Deno.serve`).
Users may choose a different port using `--port`.

`deno serve /tmp/file.ts`

`server.ts`:
```ts
export default {
  fetch(req) {
    return new Response("hello world!\n");
  },
};
```
2024-04-24 19:45:49 +00:00
David Sherret ded6afccf2
fix(publish): --dry-publish should error for gitignored excluded files (#23540)
Files that were gitignored only were not included in the diagnostic.
2024-04-24 18:52:05 +00:00
Nathan Whitaker 8a367d3cc3
fix(cli): Don't panic on invalid emit options (#23463)
Fixes #23456.
2024-04-23 08:50:50 -07: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
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
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
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