Commit graph

6082 commits

Author SHA1 Message Date
Nathan Whitaker 736f73b008
perf(lsp): Only evict caches on JS side when things actually change (#23293)
Currently we evict a lot of the caches on the JS side of things on every
request, namely script versions, script file names, and compiler
settings (as of #23283, it's not quite every request but it's still
unnecessarily often).

This PR reports changes to the JS side, so that it can evict exactly the
caches that it needs too. We might want to do some batching in the
future so as not to do 1 request per change.
2024-04-10 18:06:37 -07:00
林炳权 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
Bartek Iwańczuk 6b95c53e48
feat(add): always produce multiline config file (#23077)
This commit changes `deno add` to always produce a multiline config
file.

In v1.41.3:
```
$ mkdir foo
$ cd foo
$ deno add @std/assert
Created deno.json configuration file.
Add @std/assert - jsr:@std/assert@^0.220.0

$ cat deno.json
{ "imports": { "@std/assert": "jsr:@std/assert@^0.220.0" } }
```

Now:
```
$ mkdir foo
$ cd foo
$ deno add @std/assert
Created deno.json configuration file.
Add @std/assert - jsr:@std/assert@^0.220.0

$ cat deno.json
{ 
  "imports": {
    "@std/assert": "jsr:@std/assert@^0.220.0"
  }
}
```
2024-03-26 17:40:24 -04:00
Don Jayamanne 9841d3fdf1
fix(kernel): Do not increase counter if store_history=false (#20848)
Fixes https://github.com/denoland/deno/issues/20847

Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-03-26 18:48:23 +00:00
Nathan Whitaker a2a537e196
fix(bench): Fix group header printing logic + don't filter out the warmup benchmark (#23083)
Fixes #23053.
Two small bugs here:
- the existing condition for printing out the group header was broken.
it worked in the reproducer (in the issue above) without filtering only
by accident, due to setting `self.has_ungrouped = true` once we see the
warmup bench. Knowing that we sort benchmarks to put ungrouped benches
first, there are only two cases: 1) we are starting the first group 2)
we are ending the previous group and starting a new group
- when you passed `--filter` we were applying that filter to the warmup
bench (which is not visible to users), so we suffered from jit bias if
you were filtering (unless your filter was `<warmup>`)

TLDR;

Running
```bash
deno bench main.js --filter="G"
```
```js
// main.js
Deno.bench({
  group: "G1",
  name: "G1-A",
  fn() {},
});

Deno.bench({
  group: "G1",
  name: "G1-B",
  fn() {},
});
```


Before this PR:
```
benchmark      time (avg)        iter/s             (min … max)       p75       p99      p995
--------------------------------------------------------------- -----------------------------

G1-A          303.52 ps/iter3,294,726,102.1     (254.2 ps … 7.8 ns) 287.5 ps 391.7 ps 437.5 ps
G1-B             3.8 ns/iter 263,360,635.9     (2.24 ns … 8.36 ns) 3.84 ns 4.73 ns 4.94 ns

summary
  G1-A
   12.51x faster than G1-B
```

After this PR:
```
benchmark      time (avg)        iter/s             (min … max)       p75       p99      p995
--------------------------------------------------------------- -----------------------------

group G1
G1-A            3.85 ns/iter 259,822,096.0     (2.42 ns … 9.03 ns) 3.83 ns 4.62 ns 4.83 ns
G1-B            3.84 ns/iter 260,458,274.5     (3.55 ns … 7.05 ns) 3.83 ns 4.45 ns 4.7 ns

summary
  G1-B
   1x faster than G1-A
```
2024-03-26 09:19:24 -07:00
Nayeem Rahman 3b61104e2a
refactor(lsp): unify config file data into ConfigTree (#23032) 2024-03-26 15:52:20 +00:00
Nathan Whitaker d6452b3946
chore(tests): Introduce integration tests for jupyter subcommand (#23074)
Before this PR, we didn't have any integration tests set up for the
`jupyter` subcommand.

This PR adds a basic jupyter client and helpers for writing integration
tests for the jupyter kernel. A lot of the code here is boilerplate,
mainly around the message format for jupyter.

This also adds a few basic integration tests, most notably for
requesting execution of a snippet of code and getting the correct
results.
2024-03-25 17:53:50 -07:00
David Sherret 0346e597bf
feat(lint): automatically opt-in packages to jsr lint tag (#23072)
This automatically opts packages (deno.json's with a name, version, and
exports field) into the "jsr" lint tag.
2024-03-25 18:20:15 -04:00
Yusuke Tanaka 64e8c36805
fix(cli): output more detailed information for steps when using JUnit reporter (#22797)
This patch gets JUnit reporter to output more detailed information for
test steps (subtests).

## Issue with previous implementation

In the previous implementation, the test hierarchy was represented using
several XML tags like the following:

- `<testsuites>` corresponds to the entire test (one execution of `deno
test` has exactly one `<testsuites>` tag)
- `<testsuite>` corresponds to one file, such as `main_test.ts`
- `<testcase>` corresponds to one `Deno.test(...)`
- `<property>` corresponds to one `t.step(...)`

This structure describes the test layers but one problem is that
`<property>` tag is used for any use cases so some tools that can ingest
a JUnit XML file might not be able to interpret `<property>` as
subtests.

## How other tools address it

Some of the testing frameworks in the ecosystem address this issue by
fitting subtests into the `<testcase>` layer. For instance, take a look
at the following Go test file:

```go
package main_test

import "testing"

func TestMain(t *testing.T) {
  t.Run("child 1", func(t *testing.T) {
    // OK
  })

  t.Run("child 2", func(t *testing.T) {
    // Error
    t.Fatal("error")
  })
}
```

Running [gotestsum], we can get the output like this:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3" failures="2" errors="0" time="1.013694">
	<testsuite tests="3" failures="2" time="0.510000" name="example/gosumtest" timestamp="2024-03-11T12:26:39+09:00">
		<properties>
			<property name="go.version" value="go1.22.1 darwin/arm64"></property>
		</properties>
		<testcase classname="example/gosumtest" name="TestMain/child_2" time="0.000000">
			<failure message="Failed" type="">=== RUN   TestMain/child_2&#xA;    main_test.go:12: error&#xA;--- FAIL: TestMain/child_2 (0.00s)&#xA;</failure>
		</testcase>
		<testcase classname="example/gosumtest" name="TestMain" time="0.000000">
			<failure message="Failed" type="">=== RUN   TestMain&#xA;--- FAIL: TestMain (0.00s)&#xA;</failure>
		</testcase>
		<testcase classname="example/gosumtest" name="TestMain/child_1" time="0.000000"></testcase>
	</testsuite>
</testsuites>
``` 

This output shows that nested test cases are squashed into the
`<testcase>` layer by treating them as the same layer as their parent,
`TestMain`. We can still distinguish nested ones by their `name`
attributes that look like `TestMain/<subtest_name>`.

As described in #22795, [vitest] solves the issue in the same way as
[gotestsum].

One downside of this would be that one test failure that happens in a
nested test case will end up being counted multiple times, because not
only the subtest but also its wrapping container(s) are considered to be
failures. In fact, in the [gotestsum] output above, `TestMain/child_2`
failed (which is totally expected) while its parent, `TestMain`, was
also counted as failure. As
https://github.com/denoland/deno/pull/20273#discussion_r1307558757
pointed out, there is a test runner that offers flexibility to prevent
this, but I personally don't think the "duplicate failure count" issue
is a big deal.

## How to fix the issue in this patch

This patch fixes the issue with the same approach as [gotestsum] and
[vitest].
More specifically, nested test cases are put into the `<testcase>` level
and their names are now represented as squashed test names concatenated
by `>` (e.g. `parent 2 > child 1 > grandchild 1`). This change also
allows us to put a detailed error message as `<failure>` tag within the
`<testcase>` tag, which should be handled nicely by third-party tools
supporting JUnit XML.

## Extra fix

Also, file paths embedded into XML outputs are changed from absolute
path to relative path, which is helpful when running the test suites in
several different environments like CI.

Resolves #22795

[gotestsum]: https://github.com/gotestyourself/gotestsum
[vitest]: https://vitest.dev/

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-03-26 00:08:46 +09:00
Bartek Iwańczuk d043dd86f7
fix: don't panic in test and bench if ops not available (#23055)
Fixes regression introduced in
https://github.com/denoland/deno/pull/22112 that
removed checks if `Deno.test` or `Deno.bench` are not used in respective
subcommands.

Closes https://github.com/denoland/deno/issues/23041
2024-03-24 16:16:45 -07:00
Sol Boucher ae52b49dd6
docs(dts): Update edge case in prompt() docs (#22954)
This has been incorrect since the function adopted its (more intuitive)
current behavior in 9268df5f3. The same behavior change was backported
to v1.39.3 in 87e954f54.
2024-03-24 08:04:57 +01:00
Bartek Iwańczuk c940205353
refactor(bench): align ops to testing ops (#23038)
Internal refactor that changes how we use ops in `deno bench`
subcommand.

This brings it in line to what we do in `deno test` subcommand.
2024-03-24 06:22:37 +01:00
Matt Mastracci 86cdf37033
perf(cli): use args_os (#23039)
Extracted from #22718
2024-03-22 14:03:56 -07:00
Asher Gomez 2d59372e7a
feat(publish): check for uncommitted files in deno publish --dry-run (#22981)
Closes #22936
2024-03-22 12:41:33 -07:00
David Sherret f96f167dc8
feat(unstable/publish): error when a package's module is excluded from publishing (#22948)
Closes #22657
2024-03-21 21:42:23 +00:00
David Sherret ffbcad3800
feat(lint): deno lint --fix and lsp quick fixes (#22615)
Adds a `--fix` option to deno lint. This currently doesn't work for
basically any rules, but we can add them over time to deno lint.
2024-03-21 14:18:59 -07:00
Bartek Iwańczuk 2166aa8fb6
chore: upgrade deno_core to 0.272.0 (#23022) 2024-03-21 13:57:32 -07:00
David Sherret 9abc722cc3
feat(node): load ES modules defined as CJS (#22945)
Changes the behaviour in Deno to just always load ES modules in npm
packages even if they're defined as CJS.

Closes #22818
2024-03-21 11:35:51 -07:00
David Sherret e55777568e
feat: deno_task_shell 0.15 (#23019)
* feat: implement exit status var
(https://github.com/denoland/deno_task_shell/pull/110)
* feat: support input redirects
(https://github.com/denoland/deno_task_shell/pull/106)
* feat: support output fd redirects for stdout and stderr
(https://github.com/denoland/deno_task_shell/pull/111)
* feat: support parsing fd redirects
(https://github.com/denoland/deno_task_shell/pull/107)
* fix: exit error code on arg parse failure
(https://github.com/denoland/deno_task_shell/pull/112)

Closes #22989
2024-03-21 16:43:17 +00:00
Nayeem Rahman 5a716d1d06
refactor(lsp): factor out workspace walk from resolver update (#22937) 2024-03-21 04:29:52 +00:00
Bartek Iwańczuk e45f433a16
chore: make DENO_FUTURE a singleton (#23009)
Just making sure we read this env var once per process.
2024-03-21 07:32:44 +05:30
Asher Gomez 9593cf2852
chore(ext/io): remove use of deprecated Deno.writeSync() (#22872) 2024-03-20 10:39:25 -07:00
Nathan Whitaker ab67b4c645
fix(coverage): Error if no files are included in the report (#22952)
Fixes #22941.

In that case, the only file with coverage was the `test.ts` file. The
coverage reporter filters out test files before compiling its report, so
after filtering we were left with an empty set of files. Later on it's
assumed that there is at least 1 file to be reported on, and we panic.
Instead of panicking, just issue an error after filtering.
2024-03-15 20:58:57 -07:00
Bartek Iwańczuk c342cd36ba
fix(ext/node): worker_threads doesn't exit if there are message listeners (#22944)
Closes https://github.com/denoland/deno/issues/22934
2024-03-15 21:38:16 +01:00
David Sherret 36e6e4a009
fix: handle cache body file not existing when using etag (#22931) 2024-03-15 09:57:24 -04:00
Matt Mastracci dae162f738
fix(cli): sanitizer should ignore count of ops started before tests begin (#22932) 2024-03-14 18:19:07 -06:00
Łukasz Czerniawski 5403e4f06b
chore(cli): move away from PathBuf in clap (#22036) 2024-03-14 23:53:46 +00:00
Nathan Whitaker 85116226b3
chore: Forward 1.41.3 release commit (#22930)
Forward 1.41.3 release commit

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
2024-03-14 21:23:24 +00:00
Matt Mastracci 1f3c4c9763
fix(cli): show asserts before leaks (#22904)
Fixes #22837
2024-03-13 20:49:54 -06:00
David Sherret 43d066cb70
fix: stop type checking during runtime (#22854)
In addition to the reasons for this outlined by @nayeemrmn in #14877
(which I think are reasons alone to not do this), this simplifies things
a lot because then we don't need to implement the following:

1. Need to handle a JSR module dynamically importing a module within it.
2. Need to handle importing an export of a JSR dep then another export
dynamically loaded later.

Additionally, people should be running `deno check dynamic_import.ts`
instead of relying on this behaviour.

Landing this as a fix because it's blocking people in some scenarios and
the current behaviour is broken (I didn't even have to change any tests
to remove this, which is bad).

Closes #22852
Closes #14877
Closes #22580
2024-03-13 16:38:01 -04:00
Matt Mastracci c9a9d040a3
perf(permissions): Fast exit from checks when permission is in "fully-granted" state (#22894)
Skips the access check if the specific unary permission is in an
all-granted state. Generally prevents an allocation or two.

Hooks up a quiet "all" permission that is automatically inherited. This
permission will be used in the future to indicate that the user wishes
to accept all side-effects of the permissions they explicitly granted.

The "all" permission is an "ambient flag"-style permission that states
whether "allow-all" was passed on the command-line.
2024-03-13 14:30:48 -06:00
Nayeem Rahman eca7b0cddd
chore(lsp): remove enablePaths compat path (#22895) 2024-03-13 20:22:02 +00:00
Satya Rohith 0fd8f549e2
fix(ext/node): allow automatic worker_thread termination (#22647)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-03-13 17:22:25 +00:00
David Sherret b3ca3b2f25
chore: rough first pass on spec tests (#22877) 2024-03-13 16:21:13 +00:00
Matt Mastracci eccdb0e99a
chore(permissions): add allow_all flag (#22890)
Unlocking a potential perf optimization at a later date -- carry the
`allow_all` flag into the permission container.
2024-03-13 16:07:24 +00:00
David Sherret c10d96cb21
fix(slow-types): improved exports tracing and infer type literals in as exprs (#22849)
Several fixes in deno_graph:

* https://github.com/denoland/deno_graph/pull/411
* https://github.com/denoland/deno_graph/pull/413
* https://github.com/denoland/deno_graph/pull/414
* https://github.com/denoland/deno_graph/pull/415
* https://github.com/denoland/deno_graph/pull/416
* https://github.com/denoland/deno_graph/pull/417

Also created https://github.com/denoland/publish_smoke_tests to help
prevent regressions in the future.

Closes https://github.com/denoland/deno/issues/22829
Closes https://github.com/denoland/deno/issues/22819
Closes https://github.com/denoland/deno/issues/22802
2024-03-12 17:45:38 +00:00
Divy Srivastava de28e6fc09
refactor: add deno_permissions crate (#22236)
Issue https://github.com/denoland/deno/issues/22222


![image](https://github.com/denoland/deno/assets/34997667/2af8474b-b919-4519-98ce-9d29bc7829f2)

This PR moves `runtime/permissions` code to a upstream crate called
`deno_permissions`. The `deno_permissions::PermissionsContainer` is put
into the OpState and can be used instead of the current trait-based
permissions system.

For this PR, I've migrated `deno_fetch` to the new crate but kept the
rest of the trait-based system as a wrapper of `deno_permissions` crate.
Doing the migration all at once is error prone and hard to review.

Comparing incremental compile times for `ext/fetch` on Mac M1:

| profile | `cargo build --bin deno` | `cargo plonk build --bin deno` |
| --------- | ------------- | ------------------- |
| `debug`   | 20 s          | 0.8s                |
| `release` | 4 mins 12 s   | 1.4s                  |
2024-03-12 10:42:26 -07:00
David Sherret ad6b00a2bf
chore: enable clippy unused_async rule (#22834) 2024-03-11 23:48:00 -04:00
Matt Mastracci 61d86b906f
fix(cli): use Instant for test times (#22853)
Fixes https://github.com/denoland/deno_std/issues/4473
2024-03-11 19:30:15 -06:00
Bartek Iwańczuk d69aab62b0
fix(ext/node): make worker setup synchronous (#22815)
This commit fixes race condition in "node:worker_threads" module were
the first message did a setup of "threadId", "workerData" and
"environmentData".
Now this data is passed explicitly during workers creation and is set up
before any user code is executed.

Closes https://github.com/denoland/deno/issues/22783
Closes https://github.com/denoland/deno/issues/22672

---------

Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-03-11 23:18:03 +01:00
David Sherret 644ac0fe43
chore: hidden tool for overwriting files with fast check output (#22822)
Not sure if we should do this, but it's a nice hidden tool that
overwrites the working tree with the fast check output.
2024-03-11 11:42:12 -04:00
David Sherret f8543a9fd8
fix(publish): regression - publishing with vendor folder (#22830)
In
https://github.com/denoland/deno/pull/22720/files#diff-d62d85de2a7ffb816cd2fdbaa47e588352f521c7c43d058b75649bbb255e0ae1R70
, I copy and pasted from another area of the code and didn't think about
removing how it ignores the vendor folder by default.
2024-03-09 20:40:53 -05:00
Divy Srivastava 0bed4d3e51
fix(ext/node): support junction symlinks on Windows (#22762)
Fixes https://github.com/denoland/deno/issues/20609

Vitepress support! `vitepress dev` and `vitepress build` via BYONM
2024-03-09 09:07:29 +05:30
David Sherret 58c28d9879
fix(config): remove pkg name example and add pattern to schema (#22813) 2024-03-08 23:13:25 +00:00
David Sherret 0146abd9fe
fix(config): add unstable features as examples to config schema (#22814) 2024-03-08 23:11:05 +00:00
David Sherret 119744c285
fix(publish): suggest using --allow-dirty on uncommitted changes (#22810) 2024-03-08 22:49:15 +00:00
tuhana 66d1b155dd
fix(cli): occasional panics on progress bar (#22809)
Uses `Instant` instead of `SystemTime` for
`cli/util/progress_bar/mod.rs`. Fixes #22558
2024-03-08 14:27:58 -07:00
David Sherret 5d85efd595
fix(publish): ability to un-exclude when .gitignore ignores everything (#22805)
This is an unrealistic scenario, but it's still a good thing to fix and
have a test for because it probably fixes some other underlying issues
with how the gitignore was being resolved for the root directory.

From https://github.com/denoland/deno/pull/22720#issuecomment-1986134425
2024-03-08 14:25:22 -05:00
mimikun 8fdc376b4a
fix(publish): typo in --allow-dirty help text (#22799) 2024-03-08 18:03:32 +00:00
Luca Casonato 5d671e079a
fix: support sloppy resolution to file where directory exists (#22800)
Previously the sloppy resolver could not resolve the following:

- foo/bar.ts
- foo.ts
- index.ts

Where `index.ts` contains `import "./foo"`, because it did not consider
`foo.ts` a valid target for this directory import.

This commit fixes this bug.
2024-03-08 17:25:55 +00:00
denobot 44da066359
chore: forward v1.41.2 release commit to main (#22793)
This is the release commit being forwarded back to main for 1.41.2

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-03-08 09:12:36 +00:00