Commit Graph

6503 Commits

Author SHA1 Message Date
Hajime-san
19bcb40059
feat(cli/tools): add a subcommand --hide-stacktraces for test (#24095) 2024-08-20 01:27:36 +00:00
Yazan AbdAl-Rahman
4f49f703c1
fix(cli): update permission prompt message for compiled binaries (#24081)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-08-20 01:20:06 +00:00
melbourne2991
0eba180fdb
fix(repl): Prevent panic on broken pipe (#21945) 2024-08-20 00:21:12 +00:00
Bartek Iwańczuk
1c4db2aca9
chore(release): Release Deno v1.46.0-rc.2 (#25101) 2024-08-19 21:13:04 +00:00
Yazan AbdAl-Rahman
4285cb339d
fix(lint): support linting tsx/jsx from stdin (#24955)
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-08-19 20:42:13 +00:00
Bartek Iwańczuk
b5051e25c2
feat: Deprecate "import assertions" with a warning (#24743)
This commit deprecates "import assertions" proposal that has been
replaced with "import attributes".

Any time an import assertion is encountered a warning will be printed
to the terminal. This warning will be printed for both local and 
remote files (ie. user code and dependencies).

Import assertions support will be removed in Deno 2.
2024-08-19 22:36:35 +02:00
Łukasz Czerniawski
0f2e47dd69
feat(watch): add watch paths to test subcommand (#24771) 2024-08-19 17:09:51 +00:00
David Sherret
c9edb15f15
fix(compile): make output more deterministic (#25092)
Closes https://github.com/denoland/deno/issues/25084
2024-08-19 16:41:11 +00:00
David Sherret
a20418e2e8
fix(fmt): regression with pipe in code blocks in tables (#25098) 2024-08-19 16:35:51 +00:00
Bartek Iwańczuk
c94c5cddb1
feat(upgrade): support deno upgrade 1.46.0 (#25096)
This commit changes `deno upgrade` subcommand to accept
a positional argument that can be either a version, release channel
name or a git hash, making invocations of `deno upgrade` much
more concise:

```
# before
$ deno upgrade --version 1.46.0
# after 
$ deno upgrade 1.46.0
```

```
# before
$ deno upgrade --canary
# after
$ deno upgrade canary
```

```
# specific canary version before
$ deno upgrade --canary --version f042c39180
# after
$ deno upgrade f042c39180
```

Old flags are still supported, but hidden from the help output.
2024-08-19 17:05:10 +02:00
snek
c0aa68a1e2
feat: upgrade deno_core (#25042)
- Update ffi turbocall to use revised fast call api
- Remove `v8_version` function calls
- `*mut OwnedIsolate` is no longer stored in OpCtx gotham store
2024-08-19 14:51:16 +00:00
David Sherret
526f39fbb9
feat(FUTURE): terse lockfile (v4) (#25059) 2024-08-19 03:01:39 +00:00
David Sherret
28bebce544
chore: Rust 1.80.1 (#25089) 2024-08-18 22:24:56 -04:00
Bartek Iwańczuk
5c69b4861b
fix(upgrade): support RC release with --version flag (#25091)
This commit fixes scenarios like:
```
$ deno upgrade --version=v1.46.0-rc.0
Downloading https://github.com/denoland/deno/releases/download/v1.46.0-rc.0/deno-aarch64-apple-darwin.zip
Download could not be found, aborting
```

Now:
```
$ target/debug/deno upgrade --version=v1.46.0-rc.0
Downloading https://dl.deno.land/release/v1.46.0-rc.0/deno-aarch64-apple-darwin.zip
Deno is upgrading to version 1.46.0-rc.0

Upgraded successfully to Deno v1.46.0-rc.0

```

Also some unneeded code was removed.
2024-08-19 00:27:06 +00:00
David Sherret
52681a2a29
fix: correct JSON config schema to show vendor option as stable (#25090)
This has been considered stable for some time now.
2024-08-18 22:54:07 +00:00
Luca Casonato
9bc2dd29ad
fix: clean up flag help output (#24686)
Permission flags are unified in a clearer and concise output.
Unstable flags are hidden by default with exception of the `unstable`
flag itself. the remaining unstable flags can be seen with a
`--help=unstable`.
This also cleans up to show unstable flags only for subcommands that
actually need them.
Also sorts flags alphabetically, and gorups various flags together in a
set of categories.

---------

Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-08-18 15:39:53 -07:00
Bartek Iwańczuk
1ec12a8c5d
chore(release): Release Deno v1.46.0-rc.1 (#25088)
Just bumping the version to test out `deno upgrade --rc` some more.
2024-08-19 00:30:45 +02:00
Bartek Iwańczuk
f003d6498c
fix(upgrade): correctly compute latest version based on current release channel (#25087)
This commit fixes computation of the latest available version
by taking into account which release channel the current
binary is on.

Before this commit, if user was on "RC" channel, calling
`deno upgrade` would not switch back to the "stable"
channel.
2024-08-19 00:29:59 +02:00
HasanAlrimawi
2e9d3b688c
fix: log current version when using deno upgrade (#25079)
This PR addresses a suggestion in issue #21417

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-08-18 22:07:54 +00:00
David Sherret
4cd95589ec
fix: make deno add output more deterministic (#25083)
Will fix some flaky tests.
2024-08-18 23:02:32 +02:00
David Sherret
35a17f38f6
fix(fmt): upgrade to dprint-plugin-markdown 0.17.4 (#25075)
Closes https://github.com/denoland/deno/issues/20917
Closes https://github.com/denoland/deno/issues/21285
2024-08-17 12:51:36 +02:00
Bartek Iwańczuk
2eeea0a1d2
ci: add script to promote to RC release (#25072)
This commits add a CI script that allows to promote a certain
canary build to a "Release Candidate" release.

This is done using `libsui` and `patchver` utilities.
2024-08-16 23:59:10 +02:00
Bartek Iwańczuk
db75462bd6
refactor: show release channel in deno --version (#25061)
Also simplifies handling of various release channels in `deno upgrade`
subcommand.
2024-08-16 22:42:19 +02:00
David Sherret
4d1b263e91
feat(publish): suggest importing jsr:@std/ for deno.land/std urls (#25046) 2024-08-16 10:42:11 -04:00
David Sherret
57cd2951f1
feat(config/jsr): add license field (#25056)
1. Adds a new "license" field.
1. Adds this field by default when doing `deno init --lib`
2024-08-16 13:12:52 +00:00
Yoshiya Hinosawa
105d27bc7d
fix(ext/node): improve shelljs compat with managed npm execution (#24912)
This change improves the Node.js compatibility in managed npm resolution
mode by disabling the discovery of `node_modules` when the
main specifier is inside of `DENO_DIR`.

closes #22732
closes #24589
2024-08-16 12:48:48 +09:00
Bartek Iwańczuk
2bb013f9ba
refactor: version module exports a single const struct (#25014)
This commit rewrites the internal `version` module that exported
various information about the current executable. Instead of exporting
several consts, we are now exporting a single const structure that 
contains all the necessary information.

This is the first step towards cleaning up how we use this information
and should allow us to use SUI to be able to patch this information
in already produced binary making it easier to cut new releases.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-08-15 23:47:16 +02:00
Nathan Whitaker
5ec3c5c3a4
feat(lint): Add lint for usage of node globals (with autofix) (#25048)
From upgrading `deno_lint`.

Previously if you had a node project that used a bunch of node globals
(`process.env`, etc), you would have to fix the errors by hand. This PR
includes a new lint that detects usages of node globals (`process`,
`setImmediate`, `Buffer`, etc.) and provides an autofix to import the
correct value. For instance:

```ts
// main.ts
const _foo = process.env.FOO;
```

`deno lint` gives you

```ts
error[no-node-globals]: NodeJS globals are not available in Deno
 --> /home/foo.ts:1:14
  |
1 | const _foo = process.env.FOO;
  |              ^^^^^^^
  = hint: Add `import process from "node:process";`

  docs: https://lint.deno.land/rules/no-node-globals


Found 1 problem (1 fixable via --fix)
Checked 1 file
```
And `deno lint --fix` adds the import for you:

```ts
// main.ts
import process from "node:process";
const _foo = process.env.FOO;
```
2024-08-15 20:43:04 +00:00
Bartek Iwańczuk
e8d57cd3fe
refactor: remove version::is_canary(), use ReleaseChannel instead (#25053)
In preparation for https://github.com/denoland/deno/pull/25014, this
commit removes public `is_canary()` method and instead uses an enum
`ReleaseChannel` to be able to designate more "kinds" of builds.
2024-08-15 21:59:16 +02:00
Divy Srivastava
7ca95fc999
feat: deno compile --icon <ico> (#25039)
Add `--icon` flag to set deno compile'd executable icon on Windows.

```
deno compile --icon icon.ico game.tsx
```

Depends on https://github.com/denoland/sui/pull/24

<img width="447" alt="image"
src="https://github.com/user-attachments/assets/7f6f3aa0-6872-4975-ae9d-06701b7684b8">

Closes https://github.com/denoland/deno/issues/8912
2024-08-15 10:12:23 +05:30
Nathan Whitaker
e92a05b551
feat(serve): Opt-in parallelism for deno serve (#24920)
Adds a `parallel` flag to `deno serve`. When present, we spawn multiple
workers to parallelize serving requests.


```bash
deno serve --parallel main.ts
```

Currently on linux we use `SO_REUSEPORT` and rely on the fact that the
kernel will distribute connections in a round-robin manner.

On mac and windows, we sort of emulate this by cloning the underlying
file descriptor and passing a handle to each worker. The connections
will not be guaranteed to be fairly distributed (and in practice almost
certainly won't be), but the distribution is still spread enough to
provide a significant performance increase.

---
(Run on an Macbook Pro with an M3 Max, serving `deno.com`

baseline::
```
❯ wrk -d 30s -c 125 --latency http://127.0.0.1:8000
Running 30s test @ http://127.0.0.1:8000
  2 threads and 125 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   239.78ms   13.56ms 330.54ms   79.12%
    Req/Sec   258.58     35.56   360.00     70.64%
  Latency Distribution
     50%  236.72ms
     75%  248.46ms
     90%  256.84ms
     99%  268.23ms
  15458 requests in 30.02s, 2.47GB read
Requests/sec:    514.89
Transfer/sec:     84.33MB
```

this PR (`with --parallel` flag)
```
❯ wrk -d 30s -c 125 --latency http://127.0.0.1:8000
Running 30s test @ http://127.0.0.1:8000
  2 threads and 125 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   117.40ms  142.84ms 590.45ms   79.07%
    Req/Sec     1.33k   175.19     1.77k    69.00%
  Latency Distribution
     50%   22.34ms
     75%  223.67ms
     90%  357.32ms
     99%  460.50ms
  79636 requests in 30.07s, 12.74GB read
Requests/sec:   2647.96
Transfer/sec:    433.71MB
```
2024-08-14 22:26:21 +00:00
Nayeem Rahman
4eff1e8ec4
fix(lsp): import map lookup for jsr subpath auto import (#25025) 2024-08-14 22:38:18 +01:00
Pig Fang
3a3315cc7f
feat(fmt): support HTML, Svelte, Vue, Astro and Angular (#25019)
This commit adds capability to format HTML, Svelte, Vue, Astro and Angular
files.

"--unstable-html" is required to format HTML files, and "--unstable-component"
flag is needed to format other formats. These can also be specified in the config
file.

Close #25015
2024-08-14 22:58:48 +02:00
Asher Gomez
f89b531149
feat(node): support username and _password in .npmrc file (#24793)
Closes #23950
2024-08-14 18:53:15 +02:00
Luca Casonato
130a2592f1
fix(cli): support --watch when running cjs npm packages (#25038) 2024-08-14 15:21:11 +02:00
Bartek Iwańczuk
b325bf0a35
feat(clean): add progress bar (#25026)
Closes https://github.com/denoland/deno/issues/25020
2024-08-14 13:04:07 +02:00
Łukasz Czerniawski
e2faf50375
feat(coverage): add breadcrumbs to deno coverage --html report (#24860) 2024-08-14 16:37:19 +09:00
Bartek Iwańczuk
8537c4537b
fix(upgrade): use proper version display (#25029)
This commit fixes output of `deno upgrade` subcommand,
by displaying proper version numbers. Before this PR we were
prepending "v" before the canary version hash, which was
obviously wrong.
2024-08-13 22:32:20 +00:00
Bartek Iwańczuk
25bb59d2ce
fix(tls): print a warning if a system certificate can't be loaded (#25023)
This commit changes how system certificates are loaded on startup.

Instead of hard erroring if a certificate can't be decoded, we are now
printing a warning and bumping a hex representation of the certificate
and continue execution.

Ref https://github.com/denoland/deno/issues/24137
2024-08-13 16:12:45 +00:00
David Sherret
39a21fd78e
feat(publish): error on missing license file (#25011)
Closes https://github.com/denoland/deno/issues/24676
2024-08-12 19:51:58 -04:00
Bartek Iwańczuk
631e175498
fix(upgrade): return no RC versions if fetching fails (#25013)
This commit fixes errors on CI like this:
```
---- upgrade::upgrade_prompt stdout ----
command /home/runner/work/deno/deno/target/release/deno run --log-level=debug main.js
command cwd /tmp/deno-cli-testqDw5UR
command /home/runner/work/deno/deno/target/release/deno run --log-level=debug main.js
command cwd /tmp/deno-cli-testqDw5UR
------ Start Full Text ------
"DEBUG RS - deno::args:620 - No .npmrc file found\r\nDEBUG RS - deno::args:909 - Finished config loading.\r\nDEBUG RS - deno::cache::cache_db:168 - Opening cache /tmp/deno-cli-testMKnYXP/dep_analysis_cache_v2...\r\nDEBUG RS - deno::cache::cache_db:168 - Opening cache /tmp/deno-cli-testMKnYXP/node_analysis_cache_v2...\r\nDEBUG RS - deno::cache::cache_db:168 - Opening cache /tmp/deno-cli-testMKnYXP/v8_code_cache_v2...\r\nDEBUG RS - deno::js:10 - Deno isolate init with snapshots.\r\nDEBUG RS - deno::worker:183 - main_module file:///tmp/deno-cli-testqDw5UR/main.js\r\nDEBUG RS - deno::module_loader:158 - Preparing module load.\r\nDEBUG RS - deno::module_loader:162 - Building module graph.\r\nDEBUG RS - deno::file_fetcher:573 - FileFetcher::fetch_no_follow_with_options - specifier: file:///tmp/deno-cli-testqDw5UR/main.js\r\nDEBUG RS - deno::module_loader:208 - Prepared module load.\r\nDEBUG RS - deno_runtime::worker:739 - received module evaluate Ok(\r\n    (),\r\n)\r\nDEBUG RS - deno::module_loader:831 - Updating V8 code cache for ES module: file:///tmp/deno-cli-testqDw5UR/main.js, [1577979522354460122]\r\n"
------- End Full Text -------
Next text: "DEBUG RS - deno::args:620 - No .npmrc file found\r\nDEBUG RS - deno::args:909 - Finished config loading.\r\nDEBUG RS - deno::cache::cache_db:168 - Opening cache /tmp/deno-cli-testMKnYXP/dep_analysis_cache_v2...\r\nDEBUG RS - deno::cache::cache_db:168 - Opening cache /tmp/deno-cli-testMKnYXP/node_analysis_cache_v2...\r\nDEBUG RS - deno::cache::cache_db:168 - Opening cache /tmp/deno-cli-testMKnYXP/v8_code_cache_v2...\r\nDEBUG RS - deno::js:10 - Deno isolate init with snapshots.\r\nDEBUG RS - deno::worker:183 - main_module file:///tmp/deno-cli-testqDw5UR/main.js\r\nDEBUG RS - deno::module_loader:158 - Preparing module load.\r\nDEBUG RS - deno::module_loader:162 - Building module graph.\r\nDEBUG RS - deno::file_fetcher:573 - FileFetcher::fetch_no_follow_with_options - specifier: file:///tmp/deno-cli-testqDw5UR/main.js\r\nDEBUG RS - deno::module_loader:208 - Prepared module load.\r\nDEBUG RS - deno_runtime::worker:739 - received module evaluate Ok(\r\n    (),\r\n)\r\nDEBUG RS - deno::module_loader:831 - Updating V8 code cache for ES module: file:///tmp/deno-cli-testqDw5UR/main.js, [1577979522354460122]\r\n"
thread 'upgrade::upgrade_prompt' panicked at tests/integration/upgrade_tests.rs:251:9:
Timed out.
```

These errors are caused by the fact that the test server doesn't have an
endpoint to return
RC releases. Which in turn causes an error to be raised which later just
short-circuits logic
for checking the version and storing it in file. Since fetching from a
remote host is always
fallible I elected to just return an empty vec of "rc" versions instead
of erroring. This might
lead to a slight mismatch in some situation when the request actually
failed and user is
prompted that there's a new canary version, but that is better than not
displaying
prompt at all. This issue will be fixed more robustly once we move to
using SUI for
specifying version of the binary.
2024-08-12 23:44:14 +00:00
David Sherret
085058cfff
feat: deno remove (#24952)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-08-12 16:17:25 -04:00
Leo Kettmeir
b1036e4d9c
fix: update deno_doc (#24972)
For Better HTML titles and custom JSDoc module resolving
2024-08-12 12:57:50 -07:00
Bartek Iwańczuk
3c70b9435a
feat: deno upgrade --rc (#24905)
This commit adds the "--rc" flag to "deno upgrade" subcommand.

This flag allows to upgrade to the latest "release candidate" release.

The update checker was also updated to take this into account.
2024-08-12 18:32:53 +00:00
Kenta Moriuchi
76f4f202e7
chore: update the copyright of c, mjs, and jsx (#25005) 2024-08-12 12:41:32 -04:00
Leo Kettmeir
e5f0058b74
feat: better help output (#24958) 2024-08-12 08:55:33 -07:00
Nayeem Rahman
9bdab6fb6b
fix(lsp): directly use file referrer when loading document (#24997) 2024-08-12 15:45:27 +01:00
Bartek Iwańczuk
004b74c8c6
feat: Rename --unstable-hmr to --watch-hmr (#24975)
This commit stabilizes HMR functionality and renames
`--unstable-hmr` to `--watch-hmr`. The `--unstable-hmr`
flag is still working, but hidden from the help output.
It will be removed in Deno 2.

Once https://github.com/denoland/deno/pull/24958 lands
we should improve grouping of `--watch` and `--watch-hmr`
flags.
2024-08-12 00:10:55 +02:00
Pig Fang
82884348cb
feat(fmt): support CSS, SCSS, Sass and Less (#24870)
This PR integrates [Malva](https://github.com/g-plane/malva) into `deno
fmt`, which introduces the ability to format CSS, SCSS, Sass and Less
files.

On Linux x64 6.10, this PR increases about 800KiB:

```                                                                                                                                                                      
❯ wc -c target/release/deno
125168728 target/release/deno

❯ wc -c target/release/deno
124349456 target/release/deno
```
2024-08-09 18:52:23 +02:00
Nathan Whitaker
218ee1b1ff
fix(add): Better error message when missing npm specifier (#24970)
Before:
<img width="278" alt="Screenshot 2024-08-09 at 3 15 01 PM"
src="https://github.com/user-attachments/assets/91b0ada6-93ee-4be6-a996-078aef98c2a9">

After:
<img width="888" alt="Screenshot 2024-08-09 at 3 52 15 PM"
src="https://github.com/user-attachments/assets/3c88a0e8-c761-4f70-88bf-109355ac12f0">
2024-08-09 14:29:11 +00:00