Commit Graph

6314 Commits

Author SHA1 Message Date
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
Matt Mastracci
9c0446567b
fix(cli): Identify and fix a test deadlock (#23411)
If a worker tried to flush large amounts of data right as the test was
ending, it could cause the flush sync marker to get lost.
2024-04-16 15:14:59 -06:00
David Sherret
43c8c1cc6e
feat(check): allow using side effect imports with unknown module kinds (ex. css modules) (#23392)
This allows people to use imports like:

```ts
import "./app.css";
```

...with `deno check` in systems where there's a bundle step (ex. Vite).
This will still error when using it with `deno run` or if the referenced
file does not exist.

See test cases for behaviour.
2024-04-16 16:46:31 -04:00
Nathan Whitaker
422cff1f24
chore(lsp): Add benchmark for performance on a large real-world repo (#23395)
This PR adds a benchmark intended to measure how the LSP handles larger
repos, as well as its performance on a more realistic workload.

The repo being benchmarked is
[deco-cx/apps](https://github.com/deco-cx/apps) which has been vendored
along with its dependencies. It's included as a git submodule as its
fairly large. The LSP requests used in the benchmark are the actual
requests sent by VSCode as I opened, modified, and navigated around a
file (to simulate an actual user interaction).

The main motivation is to have a more realistic benchmark that measures
how we do with a large number of files and dependencies. The
improvements made from 1.42 to 1.42.3 mostly improved performance with
larger repos, so none of our existing benchmarks showed an improvement.

Here are the results for the changes made from 1.42 to 1.42.3 (the new
benchmark is the last one listed):

**1.42.0**

```test
Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 379ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1142ms)
   - Find/Replace
      (10 runs, mean: 51ms)
   - Code Lens
      (10 runs, mean: 443ms)
   - deco-cx/apps Multiple Edits + Navigation
      (5 runs, mean: 25121ms)
<- End benchmarking lsp
```

**1.42.3**

```text
Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 383ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1135ms)
   - Find/Replace
      (10 runs, mean: 55ms)
   - Code Lens
      (10 runs, mean: 440ms)
   - deco-cx/apps Multiple Edits + Navigation
      (5 runs, mean: 11675ms)
<- End benchmarking lsp
```
2024-04-16 12:26:51 -07:00
Matt Mastracci
c4d0fceec3
fix(cli): TestEventSender should be !Clone (#23405)
`TestEventSender` should not be Clone so we don't end up with multiple
copies of the same writer FD. This is probably not the cause of the test
channel lockups, but it's a lot easier to reason about.
2024-04-16 12:54:50 -06:00
Asher Gomez
534dd34f86
fix: add DENO_FUTURE to deno --help (#23368) 2024-04-17 02:58:48 +10:00
Satya Rohith
50223c5c53
fix(ext/node): dispatch beforeExit/exit events irrespective of listeners (#23382)
Closes https://github.com/denoland/deno/issues/23342
Closes https://github.com/denoland/deno/issues/21757
2024-04-16 13:45:41 +00:00
Bartek Iwańczuk
0a7f46b8c2
chore: forward v1.42.4 commit to main (#23394)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-04-16 02:41:59 +00:00
Nayeem Rahman
9a31698207
fix(lsp): slice strings by byte index in code actions (#23387)
Fixes #23361.
2024-04-16 01:07:32 +02:00
David Sherret
46c709e52f
fix(check): cache bust when changing nodeModulesDir setting (#23355) 2024-04-15 18:58:04 -04:00
David Sherret
6f278e5c40
fix(lsp): improved cjs tracking (#23374)
Our cjs tracking was a bit broken. It was marking stuff as esm that was
actually cjs leading to type checking errors.
2024-04-15 17:50:52 -04:00
Matt Mastracci
7e4ee02e2e
fix(ext/io): Fix NUL termination error in windows named pipes (#23379)
Due to a terminating NUL that was placed in a `r#` string, we were not
actually NUL-terminating pipe names on Windows. While this has no
security implications due to the random nature of the prefix, it would
occasionally cause random failures when the trailing garbage would make
the pipe name invalid.
2024-04-15 14:10:09 -06:00
Bartek Iwańczuk
a080acc1b4
refactor: move lifecycle events dispatch to Rust (#23358)
This commit moves logic of dispatching lifecycle events (
"load", "beforeunload", "unload") to be triggered from Rust.
Before that we were executing scripts from Rust, but now we
are storing references to functions from "99_main.js" and calling
them directly.

Prerequisite for https://github.com/denoland/deno/issues/23342
2024-04-15 20:08:33 +02:00
David Sherret
1835b4f061
fix(lsp): ensure project version is incremented when config changes (#23366)
I'm running into a node resolution bug in the lsp only and while
tracking it down I noticed this one.

Fixed by moving the project version out of `Documents`.
2024-04-15 00:07:04 +00:00
Nayeem Rahman
8f1a92f3c3
refactor(lsp): use fallback resolution in op_resolve() (#23329) 2024-04-14 22:42:58 +01:00
David Sherret
e277490c82
perf: do not clone swc Program when transpiling (#23365) 2024-04-14 17:15:17 -04:00
David Sherret
76df7d7c9b
fix(publish): do not error for param with initializer before required parameter (#23356)
* https://github.com/denoland/deno_graph/pull/440

Closes https://github.com/denoland/deno/issues/23331
2024-04-13 22:20:58 -04:00
David Sherret
720e45d25b
fix(publish): handle definite assignment on ts private properties (#23345) 2024-04-12 19:56:29 -04:00
Nathan Whitaker
3dacba5057
perf(lsp): Only deserialize response from op_respond once (#23349)
Previously we were deserializing it twice - once to `serde_json::Value`,
and then again from the `serde_json::Value` to a concrete type
2024-04-12 16:04:54 -07:00
Divy Srivastava
c56f2e0fc0
chore: upgrade deno_core to 0.274.0 (#23344)
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-04-12 21:45:38 +02:00
youngwendy
84e198f0d0
chore: remove repetitive words (#23341)
Signed-off-by: youngwendy <clonefetch@outlook.com>
2024-04-12 08:33:43 -06:00
Luca Casonato
650db71e35
chore: update deno_graph (#23340) 2024-04-12 13:10:57 +00:00
denobot
c92f118652
chore: forward v1.42.3 release commit to main (#23335)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-04-12 04:19:46 +00:00
David Sherret
98077e4b3c
fix(publish): do not warn about excluded external modules in node_modules directory (#23173) 2024-04-11 23:52:35 +00:00
Bartek Iwańczuk
f358ae6278
fix(inspector): don't panic if port is not free (#22745)
Closes https://github.com/denoland/deno/issues/22113
Closes https://github.com/denoland/deno/issues/23177
Closes https://github.com/denoland/deno/issues/22883
Closes https://github.com/denoland/deno/issues/22377
2024-04-12 01:17:10 +02:00
David Sherret
ade0cd5e97
fix: upgrade deno_ast related crates (#23187)
Had to revert back swc due to
https://github.com/swc-project/swc/issues/8840

Fixes:

- https://github.com/denoland/deno_lint/pull/1262
- https://github.com/denoland/deno_doc/pull/538
- https://github.com/denoland/deno_doc/pull/537
- https://github.com/denoland/deno_graph/pull/430
- https://github.com/denoland/deno_graph/pull/425
- https://github.com/denoland/deno_graph/pull/432
2024-04-11 23:00:17 +00:00
Nayeem Rahman
f1ea8ca358
perf(lsp): use a stub module in tsc for failed resolutions (#23313) 2024-04-11 21:55:27 +01:00
Bartek Iwańczuk
5758470ee4
Revert "refactor(ext/net): extract TLS key and certificate from inter… (#23325)
…faces (#23296)"

This reverts commit e190acbfa8.

Reverting because it broke stable API type declarations. We will reland
it for v1.43 with updated interfaces
2024-04-11 20:31:11 +00:00
Nathan Whitaker
4ab0215727
fix(lsp): Denormalize specifiers before calling $projectChanged (#23322)
Fixes the regression described in
https://github.com/denoland/deno/pull/23293#issuecomment-2049819724.
This affected jupyter notebooks, as the LSP was passing in already
denormalized specifiers, while the jupyter kernel was not. We need to
denormalize the specifiers to evict the proper keys from our caches.
2024-04-11 18:33:03 +00:00
David Sherret
df73db671b
fix(npm): local nodeModulesDir was sometimes resolving duplicates of same package (#23320) 2024-04-11 13:18:19 -04:00
denobot
ca7432b86b
chore: forward v1.42.2 release commit to main (#23315)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-04-11 13:37:24 +05:30
Nayeem Rahman
34e1d0cdd4
perf(lsp): replace document registry source cache on update (#23311) 2024-04-11 02:57:22 +01:00
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
David Sherret
40089b37c0
fix(publish): include explicitly specified .gitignored files and directories (#22790)
This allows explicitly overriding a .gitignore by specifying files and
directories in "include". This does not apply to globs in an include as
files matching those will still be gitignored. Additionally,
individually gitignored files within an included directory will still be
ignored.
2024-03-08 05:46:06 +00:00
David Sherret
2c6e9107b6
fix(publish): do not include .gitignore (#22789)
Regression from https://github.com/denoland/deno/pull/22720
2024-03-08 04:16:19 +00:00
David Sherret
2dfc0aca7c
fix(publish): make include and exclude work (#22720)
1. Stops `deno publish` using some custom include/exclude behaviour from
other sub commands
2. Takes ancestor directories into account when resolving gitignore
3. Backards compatible change that adds ability to unexclude an exclude
by using a negated glob at a more specific level for all sub commands
(see https://github.com/denoland/deno_config/pull/44).
2024-03-07 20:16:32 -05:00
Bartek Iwańczuk
2ed984ba3a
fix: respect unstable "temporal" configuration in config file (#22134)
Actual fix happened in https://github.com/denoland/deno/pull/22782, but
this commit adds additional tests and cleans up V8 flags passed on init.

Closes https://github.com/denoland/deno/issues/22123
Closes https://github.com/denoland/deno/issues/22560
Closes https://github.com/denoland/deno/issues/22557
2024-03-08 01:32:11 +01:00
Bartek Iwańczuk
914b7495a8
fix(publish): reland error if there are uncommitted changes (#22613) (#22632)
Reverted in https://github.com/denoland/deno/pull/22625
2024-03-07 22:13:36 +01:00
Divy Srivastava
e0c9102b49
perf: hard link npm cache (#22773) 2024-03-07 13:10:19 -05:00
Nayeem Rahman
8df47882c9
fix(lsp): don't apply renames to remote modules (#22765) 2024-03-07 17:27:24 +00:00
Matt Mastracci
0fdb33c3aa
fix(cli): limit test parallelism on Windows to avoid pipe error (#22776)
One last attempt to fix the parallelism issue on Windows.
2024-03-07 10:04:39 -07:00
Matt Mastracci
4791d16a8e
perf(cli): use faster_hex (#22761)
`cli::util::checksum` was showing up on flame graphs because it was
concatenating allocated strings. We can use `faster-hex` to improve it.
2024-03-07 10:00:43 -07:00
David Sherret
594d8397ad
fix(publish): properly display graph validation errors (#22775)
The graph validation errors were displaying cryptically during publish.
This fixes that.
2024-03-07 17:30:30 +01:00
Luca Casonato
87a08fc3b2
fix(tools/publish): correctly handle importing from self in unfurling (#22774)
We emitted `import "./` rather than `import "./$NAME"`. This is now
fixed.

Also makes a cosmetic change so that `../` imports are now just imported
as `../`, not `./../`.
2024-03-07 17:29:17 +01:00
Bartek Iwańczuk
f0ec4fe1b8
fix(publish): silence warnings for sloppy imports and node builtins with env var (#22760)
An undocumented "DENO_DISABLE_PEDANTIC_NODE_WARNINGS" env
var can be used to silence warnings for sloppy imports and node builtins
without `node:` prefix.
2024-03-07 14:59:57 +01:00
Nayeem Rahman
01bc2f530e
feat(unstable/pm): support npm packages in 'deno add' (#22715) 2024-03-06 13:24:15 +00:00
Divy Srivastava
156950828e
fix(publish): permissionless dry-run in GHA (#22679)
Fixes https://github.com/denoland/deno/issues/22658
2024-03-06 18:26:20 +05:30
Divy Srivastava
adb0226927
chore: Reuse linux symbols list on openbsd and freebsd (#22706) 2024-03-06 08:33:15 +05:30
Matt Mastracci
ace25161c7
chore(cli): remove problematic snapshot test (#22722)
This test crashes often on windows.
2024-03-05 19:11:33 -07:00
David Sherret
3eaf174bfc
fix(node): improve cjs tracking (#22673)
We were missing saying that a file is CJS when some Deno code imported
from the node_modules directory at runtime.
2024-03-06 00:23:51 +00:00
Matt Mastracci
3fd4b882a4
perf(cli): faster standalone executable determination (#22717)
This was showing up on the flamegraph.

```
14:54 $ hyperfine -S none --warmup 25 '/tmp/deno run /tmp/empty.js' 'target/release/deno run /tmp/empty.js'
Benchmark 1: /tmp/deno run /tmp/empty.js
  Time (mean ± σ):      17.2 ms ±   4.7 ms    [User: 11.2 ms, System: 4.0 ms]
  Range (min … max):    15.1 ms …  72.9 ms    172 runs
 
  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
 
Benchmark 2: target/release/deno run /tmp/empty.js
  Time (mean ± σ):      16.7 ms ±   1.1 ms    [User: 11.1 ms, System: 4.0 ms]
  Range (min … max):    15.0 ms …  20.1 ms    189 runs
 
Summary
  'target/release/deno run /tmp/empty.js' ran
    1.03 ± 0.29 times faster than '/tmp/deno run /tmp/empty.js'
✔ ~/Documents/github/deno/deno [faster_extract|…5⚑ 23] 
```
2024-03-05 15:14:49 -07:00
David Sherret
942dcbad84
refactor: move deno json functionality to args module (#22710) 2024-03-05 15:45:44 -05:00
Matt Mastracci
72d34a79ac
fix(cli): remove possible deadlock in test channel (#22662)
The stderr stream could possibly starve the other bits of the
output-redirecting event loop.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-03-04 20:14:21 -07:00
Bartek Iwańczuk
d9fa2dd550
chore: upgrade deno_core (#22699)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-03-05 01:17:39 +00:00
David Sherret
902a1137ea
fix(lsp): do not warn about local file "redirects" from .js to .d.ts files (#22670)
The diagnostic was incorrect when importing a `.js` file with a
corresponding `.d.ts` file with sloppy imports because it would say to
change the `.js` extension to `.d.ts`, which is incorrect. We might as
well just hide this diagnostic.
2024-03-04 17:34:31 +00:00
David Sherret
6650019935
fix(lsp): ignore code errors when type passes for non-@deno-types reolution (#22682) 2024-03-04 16:10:39 +00:00
Nayeem Rahman
625a9319f6
feat(lsp): include registry url in jsr import hover text (#22676) 2024-03-04 15:48:23 +00:00
cui fliter
d4b3b39cc0
chore: fix typos (#22677) 2024-03-04 14:28:57 +00:00
Divy Srivastava
11db68ce96
feat(publish): add npm: suggestion for esm.sh specifiers (#22343)
![image](https://github.com/denoland/deno/assets/34997667/f32642ed-c109-4519-84c5-6f78e9452703)

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-03-04 09:55:28 +05:30
David Sherret
942b2aaca5
fix(lsp): output more information on error (#22665) 2024-03-01 21:25:38 -05:00
David Sherret
0973e8e859
fix(lsp): regression - caching in lsp broken when config with imports has comments (#22666)
Caused by https://github.com/denoland/deno/pull/22553

Closes #22664
2024-03-01 21:13:04 -05:00
Nayeem Rahman
15f5f74eb7
feat(unstable/pm): support version contraints in 'deno add' (#22646) 2024-03-01 21:34:13 +00:00
Matt Mastracci
2e4a1fc3e8
fix(cli): force flush output after test unloads (#22660)
Fixes flake in load_unload test
2024-03-01 21:26:57 +00:00
Matt Mastracci
736b91edd0
perf(cli): use new deno_core timers (#22569)
Improves #19100 

Fixes #20356

Replaces #20428



Changes made in deno_core to support this:

 - [x] Errors must be handled in setTimeout callbacks
 - [x] Microtask ordering is not-quite-right
 - [x] Timer cancellation must be checked right before dispatch
 - [x] Timer sanitizer
 - [x] Move high-res timer to deno_core
 - [x] Timers need opcall tracing
2024-03-01 11:15:18 -07:00
David Sherret
878384aefa
fix(unstable/publish): repect --no-check in no-slow-types (#22653) 2024-03-01 15:54:46 +00:00
denobot
404422519c
chore: forward v1.41.1 release commit to main (#22643)
Co-authored-by: dsherret <dsherret@users.noreply.github.com>
2024-02-29 20:56:08 -05:00
Bartek Iwańczuk
ea3651a1ac
fix(publish): disable provenance if not in GHA (#22638)
The condition was wrong
2024-02-29 21:19:30 +00:00
Kenta Moriuchi
e4ef6a4b8e
fix(unstable): add Date#toTemporalInstant type (#22637) 2024-02-29 14:47:10 -05:00
Bartek Iwańczuk
fb31ae73e4
feat(unstable): deno add subcommand (#22520)
This commit adds "deno add" subcommand that has a basic support for
adding "jsr:" packages to "deno.json" file. 

This currently doesn't support "npm:" specifiers and specifying version
constraints.
2024-02-29 19:12:04 +00:00
David Sherret
8d9a54ca18
fix(publish): reduce warnings about dynamic imports (#22636) 2024-02-29 11:34:07 -05:00
Divy Srivastava
9ffc34c159
feat(publish): enable package provenance by default on github actions (#22635) 2024-02-29 21:48:47 +05:30
Bartek Iwańczuk
211b3ff244
fix(publish): print a warning when .jsx or .tsx is imported (#22631)
This commit adds a warning when .jsx or .tsx is encountered during
publishing.

This is a stop-gap solution before we fix it proper.
2024-02-29 12:54:57 +01:00
Nayeem Rahman
3a43568481
feat(lsp): jsr specifier completions (#22612) 2024-02-29 03:54:16 +00:00
David Sherret
814eb42060
fix: relative dynamic imports in jsr packages (#22624)
Relative dynamic imports were broken. It now properly allows them and
verifies the checksum.

Fix in https://github.com/denoland/deno_graph/pull/408
2024-02-29 00:06:16 +01:00
Matt Mastracci
b6e44f91ad
fix(cli): ensure that pre- and post-test output is flushed at the appropriate times (#22611)
Some `deno_std` tests were failing to print output that was resolved
after the last test finished. In addition, output printed before tests
began would sometimes appear above the "running X tests ..." line, and
sometimes below it depending on timing.

We now guarantee that all output is flushed before and after tests run,
making the output consistent.

Pre-test and post-test output are captured in `------ pre-test output
------` and `------ post-test output ------` blocks to differentiate
them from the regular output blocks.

Here's an example of a test (that is much noisier than normal, but an
example of what the output will look like):

```
Check ./load_unload.ts
------- pre-test output -------
load
----- output end -----
running 1 test from ./load_unload.ts
test ...
------- output -------
test
----- output end -----
test ... ok ([WILDCARD])
------- post-test output -------
unload
----- output end -----
```
2024-02-28 22:12:21 +00:00
Bartek Iwańczuk
c9b2139b1e
Revert "fix(publish): error if there are uncommitted changes (#22613)" (#22625)
This reverts commit c2c4e745a5.
2024-02-28 21:35:02 +00:00
David Sherret
918c5e648f
fix(jsr): do not allow importing a non-JSR url via unanalyzable dynamic import from JSR (#22623)
A security feature of JSR is that it is self contained other than npm
dependencies. At publish time, the registry rejects packages that write
code like this:

```ts
const data = await import("https://example.com/evil.js");
```

However, this can be trivially bypassed by writing code that the
registry cannot statically analyze for. This PR prevents Deno from
loading dynamic imports that do this.
2024-02-28 16:30:45 -05:00
Ryan Dahl
f54acb53ed
fix(publish): make the already published message look like a warning (#22620) 2024-02-28 21:30:20 +01:00
Matt Mastracci
a3f982c1d5
chore(cli): rename --trace-ops to --trace-leaks (#22598)
As we add tracing to more types of runtime activity, `--trace-ops` is
less useful of a name. `--trace-leaks` better reflects that this feature
traces both ops and timers, and will eventually trace resource opening
as well.

This keeps `--trace-ops` as an alias for `--trace-leaks`, but prints a
warning to the console suggesting migration to `--trace-leaks`.

One test continues to use `--trace-ops` to test the deprecation warning.

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-02-28 09:12:43 -07:00
Bartek Iwańczuk
c2c4e745a5
fix(publish): error if there are uncommitted changes (#22613)
Closes https://github.com/denoland/deno/issues/22330
2024-02-28 10:21:12 +01:00
Matt Mastracci
96cfe82664
perf(cli): reduce overhead in test registration (#22552)
- Removes the origin call, since all origins are the same for an isolate
(ie: the main module)
- Collects the `TestDescription`s and sends them all at the same time
inside of an Arc, allowing us to (later on) re-use these instead of
cloning.

Needs a follow-up pass to remove all the cloning, but that's a thread
that is pretty long to pull

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-02-27 20:30:17 -07:00
Divy Srivastava
9b5d2f8c1b
feat(publish): provenance attestation (#22573)
Supply chain security for JSR.

```
$ deno publish --provenance

Successfully published @divy/test_provenance@0.0.3
Provenance transparency log available at https://search.sigstore.dev/?logIndex=73657418
```

0. Package has been published.
1. Fetches the version manifest and verifies it's matching with uploaded
files and exports.
2. Builds the attestation SLSA payload using Github actions env.
3. Creates an ephemeral key pair for signing the github token
(aud=sigstore) and DSSE pre authentication tag.
4. Requests a X.509 signing certificate from Fulcio using the challenge
and ephemeral public key PEM.
5. Prepares a DSSE envelop for Rekor to witness. Posts an intoto entry
to Rekor and gets back the transparency log index.
6. Builds the provenance bundle and posts it to JSR.
2024-02-28 07:58:02 +05:30
David Sherret
e9fe71acb5
fix(unstable): sloppy imports should resolve .d.ts files during types resolution (#22602) 2024-02-27 18:30:21 +00:00
Luca Casonato
8d5c231349
feat(publish): support sloppy imports and bare node built-ins (#22588) 2024-02-27 15:13:16 +00:00
Matt Mastracci
47c2a63d87
chore: bump deno_core (#22596)
Migrations:

 - snapshot code updated
 - runtime stats API tweaks
2024-02-27 08:05:57 -07:00
Bartek Iwańczuk
f1a691274e
feat(publish): discover jsr.json and jsr.jsonc files (#22587)
Closes https://github.com/denoland/deno/issues/22491
2024-02-27 08:27:21 +00:00
David Sherret
6567dc94a9
fix(lsp): import map expansion (#22553) 2024-02-24 00:21:09 -05:00
David Sherret
33fa49a100
chore: improve not implemented npm system info message (#22571) 2024-02-23 16:34:24 -05:00
David Sherret
22cd8ebf1f
perf(fmt): reduce memory usage and improve performance (#22570)
Reduces memory usage of the fmt command and fixes a memory leak.

Also improves slightly improves performance.
2024-02-23 16:11:45 -05:00
tuhana
bcf2156dbf
fix(compile): add aarch64 linux to CliOptions::npm_system_info (#22567)
Follow-up for #22542.
2024-02-23 19:18:39 +01:00
Matt Mastracci
5193834cf2
refactor(cli): clean up test runner channels (#22422)
Gets us closer to solving #20707.

Rewrites the `TestEventSender`:

- Allow for explicit creation of multiple streams. This will allow for
one-std{out,err}-per-worker
- All test events are received along with a worker ID, allowing for
eventual, proper parallel threading of test events.
 
In theory this should open up proper interleaving of test output,
however that is left for a future PR.

I had some plans for a better performing synchronization primitive, but
the inter-thread communication is tricky. This does, however, speed up
the processing of large numbers of tests 15-25% (possibly even more on
100,000+).

Before

```
ok | 1000 passed | 0 failed (32ms)
ok | 10000 passed | 0 failed (276ms)
```

After

```
ok | 1000 passed | 0 failed (25ms)
ok | 10000 passed | 0 failed (230ms)
```
2024-02-23 11:11:15 -07:00
Bartek Iwańczuk
619acce305
fix(compile): allow to compile for ARM linux (#22542)
Closes https://github.com/denoland/deno/issues/22527
2024-02-23 18:08:17 +00:00
Satya Rohith
47dee65e4a
fix(ext/node): set correct process.argv0 (#22555) 2024-02-23 17:30:29 +01:00
Marvin Hagemeister
cddefecfff
feat: infer dependencies from package.json (#22563)
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
This PR enhances the `deno publish` command to infer dependencies from
`package.json` if present.
2024-02-23 15:56:49 +01:00
Asher Gomez
55fa61abc6
chore(cli): swap CreateHttpClientOptions.{cert,key} descriptions (#22543)
Fixes https://github.com/denoland/deno/pull/22280#discussion_r1499615986
2024-02-23 07:52:23 -07:00
Divy Srivastava
f49abcc1ac
feat(publish): respect .gitignore during deno publish (#22514)
Files from `.gitignore`, global git config, `.git/info/exclude` and
`deno.json`'s `exclude` are ignored.
2024-02-23 07:56:34 +05:30
denobot
118445103b
1.41.0 (#22524)
Bumped versions for 1.41.0

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-02-22 02:44:05 +01:00
Bartek Iwańczuk
197d2480bb
fix(compile): respect compiler options for emit (#22521)
`deno compile` was ignoring configuration file and thus not applying
`compilerOptions` to influence the way files were emitted.
2024-02-21 23:03:11 +00:00
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
denobot
ed34429a5f
chore: forward v1.40.4 release commit to main (#22345)
This is the release commit being forwarded back to main for 1.40.4

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-02-08 12:39:39 +00:00
Jason Ford
9714cc3136
docs(cli): add unit info for idleTimeout (#22335)
Signed-off-by: Jason Ford <fordjason@gmail.com>
2024-02-07 18:09:08 -07:00
Asher Gomez
046ed6e86a
fix(lint): point to migration docs in deprecated APIs rule (#22338) 2024-02-08 00:37:45 +00:00
Matt Mastracci
64ebd441e9
chore: use @test_util for node_compat tests (#22331) 2024-02-07 23:21:32 +00:00
Asher Gomez
96c07e90ca
docs: correct JSDoc @category for Deno.fsync[Sync]() and Deno.fdatasync[Sync]() (#22177)
As other APIs with the "f" prefix denote being part of the "File System"
`@category`.
2024-02-07 23:42:17 +01:00
Matt Mastracci
ffbb1bad03
chore(cli): Use @test_util for relative path for unit tests (#22327)
This removes the majority of `../../../../../../test_util` relative
imports from the codebase, allowing us to move this code more easily in
the future.
2024-02-07 09:51:28 -07:00
David Sherret
83d72e5c1c
refactor: extract out runtime::colors to deno_terminal::colors (#22324) 2024-02-07 11:25:14 -05:00
Divy Srivastava
a32e7f0eb2
fix(node): handle brotli compression end chunk sizes (#22322)
Fixes https://github.com/denoland/deno/issues/22259
2024-02-07 21:53:32 +05:30
restlessronin
b16e6220a2
fix: enable "--allow-sys=cpus" for "deno run" (#22260)
Fixes #22221 with the suggested fix, and added "cpus" to the existing
tests.
2024-02-07 06:38:40 +00:00
Bartek Iwańczuk
6c15dc3f06
chore: remove op_spawn_child test (#22314)
This test is not needed because the op is not available to user code
anymore.

This brings number of ops exposed to user code down to 15.
2024-02-07 04:44:51 +01:00
Bartek Iwańczuk
edab1bb927
chore: don't expose FFI ops to user code (#22313)
This commit removes some not really necessary FFI tests and in effect
removes them from being accessible from the user code.

This lowers the number of ops accessible to user code to 16.
2024-02-07 04:15:11 +01:00
David Sherret
227ec14e6c
chore: use same test server for jsr tests (#22303)
We had two test servers.
2024-02-07 02:06:34 +00:00
Bartek Iwańczuk
043fee48fd
chore: upgrade deno_core to 0.259.0 (#22311)
This update brings number of ops available to user code down to 45.
2024-02-07 02:16:08 +01:00
David Sherret
e54684864d
fix(publish): handle diagnostic outside graph (#22310)
Hacky quick fix. The real fix is a lot more work to do (move the
`SourceTextInfo` into all the diagnostics in order to make this less
error pone). I've already started on it, but it will require a lot of
downstream create changes.

Closes #22288
2024-02-06 19:21:26 -05:00
Bartek Iwańczuk
89ae2d88b8
chore: remove unneeded benchmark (#22300)
Brings down the number of ops available to user code to 49.
2024-02-07 01:00:18 +01:00
John Spurlock
82401e9fe0
fix(publish): 'explit' typo (#22296) 2024-02-06 18:49:24 -05:00
David Sherret
c6def993e0
fix(publish): lazily parse sources (#22301)
Closes #22290
2024-02-06 15:57:10 -05:00
Matt Mastracci
a6b2a4474e
fix(cli): Add IP address support to DENO_AUTH_TOKEN (#22297)
Auth tokens may be specified for one of the following:

 - `abc123@deno.land`: `deno.land`, `www.deno.land`, etc
 - `abc123@deno.land:8080`: `deno.land:8080`, `www.deno.land:8080`, etc
 - `abc123@1.1.1.1`: IP `1.1.1.1` only
 - `abc123@1.1.1.1:8080`: IP `1.1.1.1`, port 8080 only
 - `abc123@[ipv6]`: IPv6 `[ipv6]` only
 - `abc123@[ipv6]:8080`: IPv6 `[ipv6]`, port 8080 only

Leading dots are ignored, so `.deno.dev` is equivalent to `deno.dev`.
2024-02-06 19:45:40 +01:00
Nayeem Rahman
327b5b280b
fix(lsp): disable no-cache diagnostics for jsr specifiers (#22284) 2024-02-06 14:56:26 +00:00
Bartek Iwańczuk
7c111da5f6
fix: Support Symbol.metadata (#22282)
This commit adds support for "Symbol.metadata" which was 
omitted when adding support for the Decorators Proposal.

Closes https://github.com/denoland/deno/issues/22111
2024-02-06 14:57:25 +01:00
Divy Srivastava
e568cb8bf8
chore(ws): remove unused op_ws_send_pong (#22283) 2024-02-06 13:37:20 +01:00
Divy Srivastava
428266c06a
fix(node): add cp to fs/promises (#22263) 2024-02-06 12:32:58 +05:30
Bartek Iwańczuk
28576db10e
refactor: don't expose some ops (#22281)
This commit brings down the number of ops exposed to user
code to 51.
2024-02-06 02:47:10 +01:00
Bartek Iwańczuk
1fd4b46dd0
bench: fix benchmark (#22279)
Missed in https://github.com/denoland/deno/pull/22277
2024-02-06 00:36:17 +00:00
Bartek Iwańczuk
838f7c257f
chore: remove benchmarks for ops (#22277)
These are not useful, as we bench them in `deno_core` already.
2024-02-06 00:05:05 +00:00
Bartek Iwańczuk
b94dabdb81
refactor: don't expose ops to user code (#22273)
Brings the number of ops exposed to user code down to 58.
2024-02-06 00:26:36 +01:00
Matt Mastracci
2c621f5894
refactor(cli): Move op descriptions into Rust and prepare for op import (#22271)
This moves the op sanitizer descriptions into Rust code and prepares for
eventual op import from `ext:core/ops`. We cannot import these ops from
`ext:core/ops` as the testing infrastructure ops are not always present.

Changes:
- Op descriptions live in `cli` code and are currently accessible via an
op for the older sanitizer code
 - `phf` dep moved to workspace root so we can use it here
- `ops.op_XXX` changed to to `op_XXX` to prepare for op imports later
on.
2024-02-05 20:26:59 +00:00
Matt Mastracci
0a3d329dd8
Reland refactor(cli): use new sanitizer for resources (#22226)
Originally in #22125
Reverted in #22153 because of #22148

Fixed in deno_core https://github.com/denoland/deno_core/pull/538

Test plan: 

1. Check out: https://github.com/poolifier/poolifier-deno.git

2. `PATH=.../deno/target/release/:$PATH deno task test`

3. `ok | 13 passed (188 steps) | 0 failed (18s)`
2024-02-05 12:21:29 -07:00
Matt Mastracci
aecad7f353
refactor(cli): Add TestFailureDescription (#22267)
Extract zero-risk changes from #22226
2024-02-05 17:27:17 +00:00
Alessandro Cosentino
cb407bb546
fix: Fix segmentation fault in tests on CPUs with PKU support (#22152)
This is a followup on denoland/deno_core#471.

Fixes #21439.
2024-02-05 09:30:14 -07:00
Heyang Zhou
e53ced0b8d
fix(unstable): validate kv list selector (#22265)
Check that in a `KvListSelector`, `start` and `end` are actually within
the keyspace bounds defined by `prefix`, if both are present.
2024-02-06 00:27:03 +08:00
Yoshiya Hinosawa
961fa27c76
fix(ext/node): fix timeout param validation in cp.execFile (#22262) 2024-02-05 14:28:28 +09:00
Asher Gomez
0f7f987951
feat(unstable): Deno.FsFile.lock[Sync]() and Deno.FsFile.unlock[Sync]() (#22235)
Closes #22178.
2024-02-05 00:11:54 +01:00
Bartek Iwańczuk
07a94984e1
chore: remove opcall_test.ts (#22227)
This test should be in `deno_core`.

Ref https://github.com/denoland/deno_core/issues/533
2024-02-04 12:10:24 -07:00
David Sherret
a284f50732
perf: remove duplicate env::current_dir call in package.json search (#22255)
Micro-optimization.
2024-02-04 00:11:12 -05:00
David Sherret
0bfa0cc027
fix(test/regression): handle CLI arg directory using ../ in path (#22244)
Closes #22239
2024-02-03 00:02:12 +00:00
Dan Rose
6c6e49629c
chore: fix typo in docs (#22232)
Signed-off-by: Dan Rose <danoftheroses@gmail.com>
2024-02-02 21:50:58 +01:00
Asher Gomez
3f4639c330
docs: point to new "Deno 1.x to 2.x Migration Guide" (#22199)
Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-02-02 02:32:46 +01:00
Bartek Iwańczuk
aba91490d6
fix(publish): use lighter crate for opening browser (#22224)
Alternative to https://github.com/denoland/deno/pull/22223 which
switches `webbrowser` crate to `open` (https://crates.io/crates/open)
which is lighterweight.
2024-02-01 16:25:56 +01:00
Divy Srivastava
ca11536f3f
chore: forward v1.40.3 release commit to main (#22220)
This is the release commit being forwarded back to main for 1.40.3

Ref https://github.com/denoland/deno/pull/22219
2024-02-01 18:11:35 +09:00
Divy Srivastava
4f914dd161
fix(fs): copyFile NUL path on macOS (#22216)
Fixes https://github.com/denoland/deno/issues/22211
2024-02-01 10:06:09 +05:30
Leo Kettmeir
e58b1900a7
fix(publish): add node specifiers (#22213) 2024-02-01 05:18:44 +01:00
Yusuke Tanaka
66e6ed65e9
fix(node): add ppid getter for node:process (#22167)
This commit adds `ppid` getter for `node:process` to improve Node
compatibility one step further.

There is one problem though, which is that `Deno.ppid`, which
`process.ppid` internally calls, is actually of type `bigint` although
it's supposed to be `number`. I filed an issue for this (#22166). For
the time being, explciit type conversion from `bigint` to `number` is
applied to match the Node.js behavior.
2024-02-01 09:18:27 +05:30
Bartek Iwańczuk
cfb57b1855
fix(install): forward granular --unstable-* flags (#22164)
Closes https://github.com/denoland/deno/issues/22154
2024-02-01 09:16:37 +05:30
Asher Gomez
6512be458f
fix(ext/node): add aes256 algorithm support (#22198)
Towards #21804
2024-02-01 09:13:24 +05:30
Divy Srivastava
02c65fad45
fix(node): util.callbackify (#22200)
Fixes https://github.com/denoland/deno/issues/22180

Matches the Node.js implementation more closely. Removed types, they do
not help just make it harder to debug with stack traces.
2024-02-01 08:51:10 +05:30
David Sherret
4b7c6049ef
refactor: load bytes in deno_graph (#22212)
Upgrades deno_graph to 0.64 where deno_graph is now responsible for
turning bytes into a string. This is in preparation for Wasm modules.
2024-02-01 03:15:22 +00:00
Bartek Iwańczuk
830d096b66
fix(publish): rename --no-fast-check to --no-zap (#22214)
Also prints an information about the flag when there are `zap` errors.
2024-02-01 02:16:52 +00:00
Bartek Iwańczuk
fddbb018c1
chore: temporarily disable deprecation warnings (#22204) 2024-01-31 23:18:14 +01:00
Bartek Iwańczuk
13a91a69f8
refactor: remove imported ops from Deno.core.ops (#22194)
This commit adds a list of ops to `runtime/99_main.js` that are
currently relying on getting them from `Deno.core.ops`. All ops that are not
present in the list are removed from `Deno.core.ops` on startup (they are
imported from "virtual op module" - `ext:core/ops`) making them effectively
inaccessible to user code.

This change lowers the number of ops exposed to user code from 650 to
around 260. This number should be gradually decreased in follow-up PRs.
2024-01-31 22:39:56 +01:00
Bartek Iwańczuk
163491f237
chore(publish): try to automatically open the web browser (#22208) 2024-01-31 22:38:57 +01:00
Leo Kettmeir
b91ae88860
chore: update deno_doc (#22174) 2024-01-31 17:34:15 +00:00
Bartek Iwańczuk
54d18f3d28
chore: disable test-fs-watchfile.js on Mac ARM (#22209)
This is super flaky on new Mac ARM runner. Disabling for now to unblock
main branch.
2024-01-31 17:01:14 +00:00