Commit graph

4123 commits

Author SHA1 Message Date
David Sherret 4a64ca8501
chore: fix recent regression with deno upgrade not handling redirects (#17045) 2022-12-14 08:47:18 -05:00
David Sherret 392cca87a8
fix(fmt): panic in yaml header with multi-byte characters (#17042)
Closes #17010
2022-12-13 23:36:02 +00:00
David Sherret 878590b773
fix(npm): support loose node semver ranges like >= ^x.x.x (#17037) 2022-12-13 13:01:42 -05:00
Divy Srivastava ac4b5de656
feat(napi): improve napi coverage (#16198) 2022-12-13 19:56:53 +05:30
Leo Kettmeir 76a9df1ed8
docs: use example & default tags (#17032) 2022-12-13 14:14:41 +01:00
Bartek Iwańczuk 435948e470
feat(repl): support npm packages (#16770)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-12-13 13:53:32 +01:00
Leo Kettmeir 5d9bb8b4b0
feat: support createNew in Deno.writeFile (#17023) 2022-12-13 05:12:49 +01:00
Leo Kettmeir a2ba573e77
fix: default to "inherit" for Deno.Command#spawn()'s stdout & stderr (#17025) 2022-12-13 05:12:19 +01:00
David Sherret 8972ebc9cc
fix: always derive http client from cli flags (#17029)
I'm not sure how to test this. It doesn't seem to have an existing test.

Closes #15921
2022-12-12 21:30:44 -05:00
Bartek Iwańczuk 8c026dab92
feat: improve download progress bar (#16984)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-12-12 20:52:10 -05:00
Bartek Iwańczuk 4a17c93088
feat: add --inspect-wait flag (#17001)
This commit adds new "--inspect-wait" flag which works similarly
to "--inspect-brk" in that it waits for inspector session to be
established before running code. However it doesn't break on the first
statement of user code, but instead runs it as soon as a session
is established.
2022-12-12 15:33:30 +01:00
Geert-Jan Zwiers 890b065310
feat(cli): support deno bench in the config file (#16608)
This PR adds the ability to set `include/exclude` fields for `deno
bench` in the configuration file.
2022-12-10 02:30:47 +01:00
sigmaSd 4eb8e875fd
feat(init): Generate main_bench.ts by default (#16786)
This commit changes "deno init" to generate "main_bench.ts" file
which scaffold two example bench cases.
2022-12-10 00:34:08 +01:00
Bartek Iwańczuk 6794d9fe5d
feat(init): Use jsonc for configuration file (#17002)
Generate "deno.jsonc" instead of "deno.json" when running "deno init"
subcommand.
2022-12-09 23:55:03 +01:00
David Sherret 653aebfa1a
fix: respect the --quiet flag in more cases (#16998) 2022-12-09 10:54:24 -05:00
Bartek Iwańczuk cb6700fa5a
unstable: remove Deno.spawn, Deno.spawnSync, Deno.spawnChild APIs (#16893)
This commit removes three unstable Deno APIs:
- "Deno.spawn()"
- "Deno.spawnSync()"
- "Deno.spawnChild()"

These APIs were replaced by a unified "Deno.Command" API.
2022-12-09 16:43:36 +01:00
David Sherret 6541a0a9fd
refactor: cleanup main.rs (#16996)
1. Extracts out some code from main.rs
2. Inlines all the `x_command` functions in main.rs
2022-12-09 09:40:48 -05:00
Lino Le Van a9d2154110
fix(cli/upgrade): properly cleanup after finished (#16930)
Co-authored-by: kidonng <kidonng@users.noreply.github.com>
2022-12-08 17:48:48 -05:00
David Sherret 01afb672e1
chore: fix pty_complete_imports test (#16992)
This test doesn't run on the CI.
2022-12-08 16:56:47 +00:00
David Sherret 91443bbc0b
fix(compile): ensure import map is used when specified in deno config file (#16990)
Closes #14246
2022-12-08 11:50:09 -05:00
Bartek Iwańczuk a6b5d05311
feat(init): Generate deno.json by default (#16389)
Updates `deno init` subcommand to create a `deno.json` when initializing
a new project.

Slightly changes the output, to make it more readable.
2022-12-08 06:34:28 +01:00
Roj 44b2b950fd
feat(cli): support configuring the lock file in the config file (#16781)
This allows the user to completely opt out from the lock file or rename
it without having to use `--no-lock` and/or `--lock` in all commands.

## Don’t Use Lock File

```json
{
  "lock": false
}
```

## Use Lock File With a Different Name

```json
{
  "lock": "deno2.lock"
}
```

The CLI args `--no-lock` and `--lock` will always override what is in
the config file.

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2022-12-08 00:13:45 +01:00
David Sherret dac30af151
feat(fmt): improve width calculation (#16982)
Formats code according to Unicode Standard Annex #11 rules
(https://crates.io/crates/unicode-width).

This aligns `deno fmt` more with prettier.
2022-12-07 17:32:24 -05:00
David Sherret f8bcf6be28
feat(npm): add support for NPM_CONFIG_REGISTRY (#16980) 2022-12-07 16:10:50 -05:00
Bartek Iwańczuk 1a472ad06b
feat(repl): run "deno repl" with no permissions (#16795)
This commit changes "deno repl" command to run with no permissions by
default and accept "--allow-*" flags. 

This change is dictated by the fact that currently there is no way to
run REPL with limited permissions. Technically it's a breaking 
change in the CLI command, but there's agreement in the team 
that it has merit and it's a good solution.

Running just "deno" command still starts the REPL with full permissions
allowed, but now a banner is printed to inform users about that:
2022-12-07 20:21:18 +01:00
David Sherret 192f07bb7e
feat(flags): add deno check --all as new preferred alias for --remote (#16702)
Closes #16374
2022-12-07 13:33:26 -05:00
David Sherret 9c1ab39e19
feat: ignore node_modules and .git folders when collecting files everywhere (#16862)
We currently only do this for fmt. This makes it so they're excluded by
default, but you can still opt into these directories by explicitly
specifying them.
2022-12-07 13:10:10 -05:00
David Sherret f4385866f8
feat: upgrade to TypeScript 4.9.3 (#16973)
Updated from: https://github.com/denoland/TypeScript/pull/2
2022-12-07 12:59:59 -05:00
David Sherret 5dbc07935d
fix(test): handle scenario where --trace-ops would cause an unhandled promise rejection (#16970)
Closes #16969
2022-12-06 15:58:18 -05:00
David Sherret c03e0f3853
refactor: remove deno_graph::Locker usage (#16877)
This is just a straight refactor and doesn't make any improvements to
the code that could now be made.

Closes #16493
2022-12-06 14:12:51 -05:00
Bartek Iwańczuk 3e47a27f4f
tests: Refactor inspector tests (#16967)
This commit adds "InspectorTester" struct which is used in
inspector tests - it encapsulated various functionalities that
we need (like reading/writing to WebSocket), but also adds
better error handling which should help with debugging flaky
tests.
2022-12-06 18:55:29 +01:00
Luca Casonato 923370f18f
fix(ext/fetch): new Request should soft clone (#16869)
Previously the inner request object of the original and the new request
were the same, causing the requests to be entangled and mutable changes
to one to be visible to the other. This fixes that.
2022-12-06 09:39:04 +01:00
David Sherret 3973ceb634
fix(npm): dependency types were sometimes not being resolved when package had no types entry (#16958)
Closes #16957
2022-12-05 20:09:31 -05:00
Bartek Iwańczuk 79285fa83b
npm: ensure runtime exceptions are surfaced when debugger is attached (#16943)
Currently runtime exception are only displayed at the program end in
terminal, which makes it only a partial fix, as a full fix requires
https://github.com/denoland/rusty_v8/pull/1149 which adds new bindings 
to the inspector that allows to notify it about thrown exceptions.
This will be handled in a follow up commit.
2022-12-06 02:00:10 +01:00
David Sherret a7dd28a07c
fix(task): improve word parsing (#16911)
Ref https://github.com/denoland/deno_task_shell/pull/67
2022-12-05 19:02:20 -05:00
David Sherret 2fab4583ef
fix(test): improve how --fail-fast shuts down when hitting limit (#16956)
Closes #15650
2022-12-05 16:17:49 -05:00
Bartek Iwańczuk 3863aaf8ae
refactor: remove references to Deno.core in bootstrap code (#16937)
Prerequisite for https://github.com/denoland/deno/pull/16881
2022-12-05 17:11:57 +01:00
Bartek Iwańczuk 918518b506
napi: respect --quiet flag in unimplemented warnings (#16935) 2022-12-05 14:25:25 +01:00
Bartek Iwańczuk 83b6085604
revert: Inspector changes (#16939)
Reverts 66dc54a7f and e2a0c3f0

Closes https://github.com/denoland/deno/issues/16926
2022-12-04 21:08:53 +01:00
阿豪 8b5b327b18
feat(ext/ffi): better type hints for Deno.dlopen (#16874) 2022-12-03 17:45:35 +05:30
Bartek Iwańczuk 0169949c29
test: reenable inspector_break_on_first_line_in_test test (#16908) 2022-12-03 02:48:10 +01:00
Bartek Iwańczuk e2a0c3f0dc
fix(inspector): allow to poll session with reentry (#16863)
This commit completely rewrites inspector session polling.

Until now, there was a single function responsible for polling inspector
sessions which could have been called when polling the "JsRuntime"
as well as from internal inspector functions. There are some cases
where it's required to have reentrant polling of sessions (eg. when 
"debugger" statement is run) which should be blocking until inspector
sends appropriate message to continue execution. This was not possible
before, because polling of sessions didn't have reentry ability.

As a consequence, session polling was split into two separate functions:
a) one to be used when polling from async context (on each tick of event
loop in "JsRuntime")
b) one to be used when polling synchronously and potentially blocking
(used by various inspector methods).

There are further cleanups and simplifications to be made in inspector
code, but this rewrite solves the problem at hand (being able to
evaluate
"debugger" JS statement and continue inspector functionality).

Co-authored-by: Bert Belder <bertbelder@gmail.com>
2022-12-02 23:17:02 +01:00
David Sherret 868068c847
chore(windows): fix flaky pty_complete_imports (#16905) 2022-12-02 14:59:04 -05:00
David Sherret 83bc8c473d
fix(upgrade/windows): show informative message on access denied error (#16887)
Closes #16886
2022-12-02 14:53:10 -05:00
David Sherret f4b8c2ea7d
chore: fix flaky netListenUnrefAndRef (#16892)
Closes #16890
2022-12-02 12:41:52 -05:00
David Sherret b638bc183d
fix(task): support redirects in pipe sequences (#16903)
Categorizing this as a fix because it currently fails silently.
2022-12-02 12:02:44 -05:00
Bartek Iwańczuk 4d07ed0efa
chore: rewrite tests and utils to use Deno.Command API (#16895)
Since "Deno.spawn()", "Deno.spawnSync()" and "Deno.spawnChild"
are getting deprecated, this commits rewrites all tests and utilities to
use "Deno.Command" API instead.
2022-12-02 14:43:17 +01:00
Divy Srivastava 6982c74e11
perf: use fast api for io read/write sync (#15863)
```
$ dd if=/dev/zero bs=65536 count=500000 | ./stdio # C baseline

500000+0 records in
500000+0 records out
32768000000 bytes transferred in 4.126087 secs (7941664827 bytes/sec)
c: size 32768000000 reads 500000 blocksize 65536
```

```
$ dd if=/dev/zero bs=65536 count=500000 | deno run stdio.js # Deno

500000+0 records in
500000+0 records out
32768000000 bytes transferred in 4.279032 secs (7657806719 bytes/sec)
deno: size 32768000000 reads 500000 blocksize 65536
```
2022-12-02 11:35:18 +05:30
Divy Srivastava 9b2b8df927
feat(ops): Fast zero copy string arguments (#16777)
Uses SeqOneByteString optimization to do zero-copy `&str` arguments in
fast calls.

- [x] Depends on https://github.com/denoland/rusty_v8/pull/1129
- [x] Depends on
https://chromium-review.googlesource.com/c/v8/v8/+/4036884
- [x] Disable in async ops
- [x] Make it work with owned `String` with an extra alloc in fast path.
- [x] Support `Cow<'_, str>`. Owned for slow case, Borrowed for fast
case

```rust
#[op]
fn op_string_len(s: &str) -> u32 { 
  str.len() as u32 
}
```
2022-12-02 05:29:15 +00:00
David Sherret 05469fc382
fix(upgrade): respect the --quiet flag (#16888)
Also, use `ProgressBar` for upgrading.
2022-12-01 18:05:49 -05:00