Commit graph

5867 commits

Author SHA1 Message Date
David Sherret 190776f30d
perf: linter lsp memory leak fix and deno_graph executor (#22519)
Updates dependent crates which includes an investigation fix by @irbull
in Deno's LSP when linting code. Huge thanks to Ian for tracking down
this issue.

Also includes Divy's deno_graph executor change, which reduces memory
usage when loading jsr specifiers and makes them faster.

Co-authored-by: irbull <irbull@users.noreply.github.com>
Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-02-21 21:58:37 +00:00
Matt Mastracci 76ebf567e2
fix(ext/fs): make errors in tempfile creation clearer (#22498)
When using a prefix or suffix containing an invalid filename character,
it's not entirely clear where the errors come from. We make these errors
more consistent across platforms.

In addition, all permission prompts for tempfile and tempdir were
printing the same API name.

We also take the opportunity to make the tempfile random space larger by
2x (using a base32-encoded u64 rather than a hex-encoded u32).
2024-02-21 20:11:04 +00:00
David Sherret a2c1cc5a1a
fix(publish): better no-slow-types type discovery (#22517) 2024-02-21 14:12:36 -05:00
Bartek Iwańczuk 5020705011
chore: bump deno_lint to 0.57.0 (#22513) 2024-02-21 10:43:49 -05:00
David Sherret 9166d8a4e9
feat(publish): type check on publish (#22506)
Supersedes #22501 and also fixes that issue.
2024-02-21 08:35:25 -05:00
Nayeem Rahman e32c704970
feat(lsp): auto-import completions for jsr specifiers (#22462) 2024-02-21 02:45:00 +00:00
David Sherret f90889e5ee
perf(jsr): fast check cache and lazy fast check graph (#22485) 2024-02-20 21:29:57 +00:00
Luca Casonato 4201f17936
fix(lsp): add schema for JSR related config options (#22497) 2024-02-20 13:49:24 +00:00
Luca Casonato 54a3eb585d
fix(publish): print files that will be published (#22495) 2024-02-20 13:30:34 +01:00
Asher Gomez 123653a01a
chore: add missing @category tags to runtime APIs (#22486) 2024-02-20 03:49:33 +01:00
Luca Casonato ef43d51497
fix(publish): ignore .DS_Store while publishing (#22478) 2024-02-19 10:48:35 -05:00
David Sherret 66424032a2
feat(unstable/lint): no-slow-types for JSR packages (#22430)
1. Renames zap/fast-check to instead be a `no-slow-types` lint rule.
1. This lint rule is automatically run when doing `deno lint` for
packages (deno.json files with a name, version, and exports field)
1. This lint rules still occurs on publish. It can be skipped by running
with `--no-slow-types`
2024-02-19 15:28:41 +00:00
Asher Gomez 2b279ad630
chore: move test_util to tests/util/server (#22444)
As discussed with @mmastrac.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-19 06:34:24 -07:00
Asher Gomez eb542bc185
chore(fs): rename op_fs_file_stat_{async/sync} ops (#22476)
Renames `op_fs_fstat_{sync/async}` to `op_fs_file_stat_{async/sync}` in
preparation of the upcoming removal of `Deno.fstat()` in v2.
2024-02-19 06:33:42 -07:00
Luca Casonato 15c64365a2
fix: write lockfile in deno info (#22272) 2024-02-19 13:02:40 +01:00
Asher Gomez c1fac11dfa
feat(fs): Deno.FsFile.{isTerminal,setRaw}() (#22234)
Closes #22229.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-02-18 07:27:44 -07:00
Asher Gomez 7abd72a80f
BREAKING(unstable): remove Deno.HttpClient.rid (#22075)
As part of ongoing works to make `rid` private.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-18 07:27:06 -07:00
Asher Gomez 3a243c8272
BREAKING: add Deno.CreateHttpClientOptions.{cert,key} (#22280)
This change deprecates
`Deno.CreateHttpClientOptions.{certChain,privateKey}` in favour of
`Deno.CreateHttpClientOptions.{cert,key}`.

Closes #22278

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-18 07:26:16 -07:00
Matt Mastracci 08071f9561
chore: bump deno_core (#22443)
Migrations:

 - Use the new SnapshotSerializer for TSC/compiler snapshots
2024-02-17 22:22:46 +00:00
David Sherret 828d9b8485
refactor: remove module graph setup from ModuleLoader (#22442)
`ModuleLoader` was doing too much duplicate work.
2024-02-16 22:10:06 +00:00
Matt Mastracci 67a4231bb6
refactor(cli): move op sanitizer to Rust (#22413)
The format of the sanitizers will change a little bit:

- If multiple async ops leak and traces are on, we repeat the async op
header once per stack trace.
- All leaks are aggregated under a "Leaks detected:" banner as the new
timers are eventually going to be added, and these are neither ops nor
resources.
 - `1 async op` is now `An async op`
- If ops and resources leak, we show both (rather than op leaks masking
resources)

Follow-on to https://github.com/denoland/deno/pull/22226
2024-02-16 21:22:12 +00:00
Matt Mastracci f705906256
chore(ext/web): refactor timer ops before landing op sanitizer (#22435)
Splitting the sleep and interval ops allows us to detect an interval
timer. We also remove the use of the `op_async_void_deferred` call.

A future PR will be able to split the op sanitizer messages for timers
and intervals.
2024-02-16 15:35:51 +00:00
David Sherret e06934fe77
fix(fmt): remove debug output when formatting dynamic imports (#22433)
deno fmt sometimes had stuff like:

```
NODE: Evaluation
```

...in the output.
2024-02-16 14:19:24 +00:00
David Sherret 4f80d83774
feat(unstable): single checksum per JSR package in the lockfile (#22421)
This changes the lockfile to not store JSR specifiers in the "remote"
section. Instead a single JSR integrity is stored per package in the
lockfile, which is a hash of the version's `x.x.x_meta.json` file, which
contains hashes for every file in the package. The hashes in this file
are then compared against when loading.

Additionally, when using `{ "vendor": true }` in a deno.json, the files
can be modified without causing lockfile errors—the checksum is only
checked when copying into the vendor folder and not afterwards
(eventually we should add this behaviour for non-jsr specifiers as
well). As part of this change, the `vendor` folder creation is not
always automatic in the LSP and running an explicit cache command is
necessary. The code required to track checksums in the LSP would have
been too complex for this PR, so that all goes through deno_graph now.
The vendoring is still automatic when running from the CLI.
2024-02-15 14:49:35 -05:00
denobot 7d47a85b57
chore: forward v1.40.5 release commit to main (#22424)
This is the release commit being forwarded back to main for 1.40.5

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-02-15 12:15:36 +05:30
Divy Srivastava b72f0be27c
chore: add DENO_FUTURE env var (#22318)
Closes https://github.com/denoland/deno/issues/22315

```
~> DENO_FUTURE=1 target/debug/deno

> globalThis.window
undefined
```
2024-02-15 04:50:17 +00:00
Nayeem Rahman 1ad754b412
feat(lsp): jsr support with cache probing (#22418) 2024-02-14 22:48:39 +00:00
Asher Gomez 66baff763f
docs: add missing @category tags (#22411)
Fixes the stray, uncategorised symbols seen in the left pane menu on
https://deno.land/api@v1.40.4.
2024-02-14 13:49:49 -07:00
Nayeem Rahman 012a9d8aeb
chore: rename DENO_REGISTRY_URL to JSR_URL (#22414) 2024-02-14 18:30:44 +00:00
Leo Kettmeir b5d122de32
feat(publish): allow passing config flag (#22416) 2024-02-14 17:13:07 +00:00
Leo Kettmeir 981a19f067
feat(unstable): define config in publish url (#22406) 2024-02-14 12:53:15 +01:00
Matt Mastracci e23fc6d88c
chore: deno_core bump (#22407)
- Adding `None` flag for warmup script.
 - Modify opcall trace interface to match new Rust implementation
2024-02-13 19:44:37 -07:00
Asher Gomez 6be389ce29
chore: move test_util/std to tests/util/std (#22402)
Note: tests are not the only part of the codebase that uses `std`. Other
parts, like `tools/`, do too. So, it could be argued that this is a
little misleading. Either way, I'm doing this as discussed with
@mmastrac.
2024-02-13 09:22:49 -07:00
Divy Srivastava a68eb3fcc3
feat: denort binary for deno compile (#22205)
This introduces the `denort` binary - a slim version of deno without
tooling. The binary is used as the default for `deno compile`.

Improves `deno compile` final size by ~2.5x (141 MB -> 61 MB) on Linux
x86_64.
2024-02-13 21:52:30 +05:30
Lino Le Van d236fc8b43
chore: bump deno_graph to 0.65.3 (#22397) 2024-02-13 00:56:10 +00:00
Matt Mastracci 3d2e52ae7e
chore: continue tests/ re-org (#22396)
Split `node_compat_tests` into its own top-level test so its stdout
doesn't stomp on the remainder of the tests.
2024-02-12 17:13:14 -07:00
Nayeem Rahman 49d82e609f
feat(lsp): jsr support first pass (#22382)
This implementation heavily depends on there being a lockfile, meaning
JSR specifiers will always diagnose as uncached unless it's there. In
practice this affects cases where a `deno.json` isn't being used. Our
NPM specifier support isn't subject to this.

The reason for this is that the version constraint solving code is
currently buried in `deno_graph` and not usable from the LSP, so the
only way to reuse that logic is the solved-version map in the lockfile's
`packages.specifiers`.
2024-02-12 22:12:49 +00:00
Matt Mastracci f60720090c
chore: move test_ffi and test_nap to tests/ [WIP] (#22394)
Moving some additional NAPI and. FFI tests out of the tree root.
2024-02-12 13:46:50 -07:00
林炳权 80d5ffbe7c
chore: update to Rust 1.76 (#22376)
Update to Rust 1.76
2024-02-12 03:00:33 +00:00
Matt Mastracci 26d9b2f317
chore: deno_core bump (#22379)
- Updates to V8 12.1.285.27

https://github.com/denoland/rusty_v8/pull/1383

 - Swaps Box for Rc for `source_map_getter`
2024-02-10 19:08:02 -07:00
Matt Mastracci f5e46c9bf2
chore: move cli/tests/ -> tests/ (#22369)
This looks like a massive PR, but it's only a move from cli/tests ->
tests, and updates of relative paths for files.

This is the first step towards aggregate all of the integration test
files under tests/, which will lead to a set of integration tests that
can run without the CLI binary being built.

While we could leave these tests under `cli`, it would require us to
keep a more complex directory structure for the various test runners. In
addition, we have a lot of complexity to ignore various test files in
the `cli` project itself (cargo publish exclusion rules, autotests =
false, etc).

And finally, the `tests/` folder will eventually house the `test_ffi`,
`test_napi` and other testing code, reducing the size of the root repo
directory.

For easier review, the extremely large and noisy "move" is in the first
commit (with no changes -- just a move), while the remainder of the
changes to actual files is in the second commit.
2024-02-10 20:22:13 +00:00
David Sherret d2477f7806
fix: cache bust jsr deps on constraint failure (#22372)
Removes the `FileFetcher`'s internal cache because I don't believe it's
necessary (we already cache this kind of stuff in places like deno_graph
or config files in different places). Removing it fixes this bug because
this functionality was already implemented in deno_graph and lowers
memory usage of the CLI a little bit.
2024-02-10 10:02:31 -05:00
Nayeem Rahman 34c8d17140
fix(lsp): complete npm specifier versions correctly (#22332) 2024-02-10 01:27:04 +00:00
David Sherret f232c36c48
fix: lockfile was sometimes getting corrupt when changing config deps (#22359)
Tests are in the deno_lockfile repo.

Closes #22250
2024-02-09 18:03:05 -05:00
Matt Mastracci dcbbcd23f5
refactor: split integration tests from CLI (part 1) (#22308)
This PR separates integration tests from CLI tests into a new project
named `cli_tests`. This is a prerequisite for an integration test runner
that can work with either the CLI binary in the current project, or one
that is built ahead of time.

## Background

Rust does not have the concept of artifact dependencies yet
(https://github.com/rust-lang/cargo/issues/9096). Because of this, the
only way we can ensure a binary is built before running associated tests
is by hanging tests off the crate with the binary itself.

Unfortunately this means that to run those tests, you _must_ build the
binary and in the case of the deno executable that might be a 10 minute
wait in release mode.

## Implementation

To allow for tests to run with and without the requirement that the
binary is up-to-date, we split the integration tests into a project of
their own. As these tests would not require the binary to build itself
before being run as-is, we add a stub integration `[[test]]` target in
the `cli` project that invokes these tests using `cargo test`.

The stub test runner we add has `harness = false` so that we can get
access to a `main` function. This `main` function's sole job is to
`execvp` the command `cargo test -p deno_cli`, effectively "calling"
another cargo target.

This ensures that the deno executable is always correctly rebuilt before
running the stub test runner from `cli`, and gets us closer to be able
to run the entire integration test suite on arbitrary deno executables
(and therefore split the build into multiple phases).

The new `cli_tests` project lives within `cli` to avoid a large PR. In
later PRs, the test data will be split from the `cli` project. As there
are a few thousand files, it'll be better to do this as a completely
separate PR to avoid noise.
2024-02-09 13:33:05 -07:00
David Sherret b0119134f7
fix: handle non-file scopes in synthetic import map (#22361)
Closes #22353
2024-02-09 02:13:08 +00:00
Matt Mastracci 2fc8d2a354
chore: completely disable websocketstream_test (#22360) 2024-02-09 02:09:19 +00:00
David Sherret e5e2c45998
fix: upgrade to deno_ast 0.33 (#22341)
* Uses diagnostics from deno_ast
* Real fix for https://github.com/denoland/deno/pull/22310
* Moves `deno lint --json` code here
* Upgrades swc
   
 Closes #22117
 Closes #22109
 Closes #21927
 Closes #20993
2024-02-09 01:40:26 +00:00
Matt Mastracci b07a156b1d
chore(cli): disable some of the restored WSS tests (#22357) 2024-02-08 18:36:07 -05:00
Matt Mastracci a417772bd7
chore: Promote some integration tests to js_unit_tests (#22355)
- Move a workers test to js_unit_tests and make it work
- (slightly) repair the websocketstream_test and make it a JS unit test.
This test was being ignored and rotted quite a bit, but there's some
value in running as much of it as we can.
 - Merge the two websocket test files
2024-02-08 13:09:47 -07:00