summaryrefslogtreecommitdiff
path: root/cli/main.rs
AgeCommit message (Collapse)Author
2024-05-18perf: analyze cjs exports and emit typescript in parallel (#23856)David Sherret
2024-05-16fix(node): seperate worker module cache (#23634)Divy Srivastava
Construct a new module graph container for workers instead of sharing it with the main worker. Fixes #17248 Fixes #23461 --------- Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-08chore: enable clippy::print_stdout and clippy::print_stderr (#23732)David Sherret
1. Generally we should prefer to use the `log` crate. 2. I very often accidentally commit `eprintln`s. When we should use `println` or `eprintln`, it's not too bad to be a bit more verbose and ignore the lint rule.
2024-04-29FUTURE: remove import assertions support for JavaScript (#23541)Kenta Moriuchi
Ref #17944, https://github.com/swc-project/swc/issues/8893 TypeScript removes the `assert` keywords in the transpile, so this PR only works for JavaScript files
2024-04-24feat: Add `deno serve` subcommand (#23511)Matt Mastracci
By default, `deno serve` will assign port 8000 (like `Deno.serve`). Users may choose a different port using `--port`. `deno serve /tmp/file.ts` `server.ts`: ```ts export default { fetch(req) { return new Response("hello world!\n"); }, }; ```
2024-04-23fix: Float16Array support (#23512)Kenta Moriuchi
Ref #23490, #23277 * remove `--js-float16array` flag (This flag has already added to deno_core) * add some `Float16Array` support
2024-04-23feat: enable Float16Array support (#23490)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/23450
2024-03-31refactor: cleanup main entrypoint (#23145)David Sherret
2024-03-27feat(install): require -g / --global flag (#23060)Bartek Iwańczuk
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-27feat(init): use jsr specifier for @std/assert (#23073)Bartek Iwańczuk
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-22perf(cli): use args_os (#23039)Matt Mastracci
Extracted from #22718
2024-03-11chore: enable clippy unused_async rule (#22834)David Sherret
2024-03-08fix: respect unstable "temporal" configuration in config file (#22134)Bartek Iwańczuk
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-05perf(cli): faster standalone executable determination (#22717)Matt Mastracci
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-04chore: fix typos (#22677)cui fliter
2024-03-01feat(unstable/pm): support version contraints in 'deno add' (#22646)Nayeem Rahman
2024-02-29feat(unstable): `deno add` subcommand (#22520)Bartek Iwańczuk
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-09fix: upgrade to deno_ast 0.33 (#22341)David Sherret
* 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-07refactor: extract out `runtime::colors` to `deno_terminal::colors` (#22324)David Sherret
2024-01-23feat(cli): improved diagnostics printing (#22049)Luca Casonato
This initially uses the new diagnostic printer in `deno lint`, `deno doc` and `deno publish`. In the limit we should also update `deno check` to use this printer.
2024-01-23feat: warn when using --unstable, prefer granular flags (#21452)Bartek Iwańczuk
This commit deprecates "--unstable" flag. When "--unstable" flag is encountered a warning like this is printed: ``` The `--unstable` flag is deprecated, use granular `--unstable-*` flags instead. Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags ``` When "--unstable" flag is used and an unstable API is called an additional warning like this is printed for each API call: ``` The `Deno.dlopen` API was used with `--unstable` flag. The `--unstable` flag is deprecated, use granular `--unstable-ffi` instead. Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags ``` When no "--unstable-*" flag is provided and an unstable API is called following warning is issued before exiting: ``` Unstable API 'Deno.dlopen'. The `--unstable-ffi` flag must be provided. ``` --------- Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com> Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com> Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-01-22feat(lockfile): track JSR and npm dependencies in config file (#22004)David Sherret
See overview in https://github.com/denoland/deno_lockfile/pull/13
2024-01-22refactor: add "UnstableConfig" struct to cli/args/flags.rs (#21993)Bartek Iwańczuk
This commit adds "UnstableConfig" struct which centralizes handling of all "--unstable-*" flags. Closes https://github.com/denoland/deno/issues/21920
2024-01-15feat(unstable): add Temporal API support (#21738)Bartek Iwańczuk
This commit adds support for [Stage 3 Temporal API proposal](https://tc39.es/proposal-temporal/docs/). The API is available when `--unstable-temporal` flag is passed. --------- Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: David Sherret <dsherret@gmail.com> Co-authored-by: Kenta Moriuchi <moriken@kimamass.com>
2024-01-14feat: remove conditional unstable type-checking (#21825)Bartek Iwańczuk
This commit removes conditional type-checking of unstable APIs. Before this commit `deno check` (or any other type-checking command and the LSP) would error out if there was an unstable API in the code, but not `--unstable` flag provided. This situation hinders DX and makes it harder to configure Deno. Failing during runtime unless `--unstable` flag is provided is enough in this case.
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-09feat: bring back WebGPU (#20812)Leo Kettmeir
Signed-off-by: Leo Kettmeir <crowlkats@toaxl.com> Co-authored-by: Kenta Moriuchi <moriken@kimamass.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-12-06fix: display unstable flags at bottom of help text (#21468)David Sherret
Moves the unstable flags to be at the bottom of the help text. They were previously all over the place for some reason.
2023-11-29build(cli): allow to build without upgrade feature (#19910)Jakub Jirutka
The self-upgrade feature is undesirable when deno is installed from (Linux) distribution repository - using a system package manager. This change will allow package maintainers to build deno with the "upgrade" subcommand and background check disabled. When the user runs `deno upgrade <args>` and the upgrade feature is disabled, it will exit with error message explaining that this deno binary was built without the upgrade feature. Note: This patch is already used in the Alpine Linux’s [deno](https://pkgs.alpinelinux.org/packages?name=deno) package.
2023-11-25feat(unstable): --unstable-unsafe-proto (#21313)David Sherret
Closes https://github.com/denoland/deno/issues/21276
2023-11-23feat(unstable): tar up directory with deno.json (#21228)Bartek Iwańczuk
Co-authored-by: David Sherret <dsherret@gmail.com> Co-authored-by: Luca Casonato <lucacasonato@yahoo.com> Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-11-05refactor: unify CDP types in a single module (#21094)Bartek Iwańczuk
This commit moves all Chrome Devtools Protocol messages to `cli/cdp.rs` and refactors all places using these types to pull them from a common place. No functional changes.
2023-11-05chore: migrate to new deno_core and metrics (#21057)Matt Mastracci
- Uses the new OpMetrics system for sync and async calls - Partial revert of #21048 as we moved Array.fromAsync upstream to deno_core
2023-11-04perf: lazy `atexit` setup (#21053)Divy Srivastava
`libc::atexit` incurrs 2% dyld cost at startup on macOS. This PR moves the setup to when the tty mode is changed using op_stdin_set_raw.
2023-11-01feat: enable Array.fromAsync (#21048)Bartek Iwańczuk
2023-11-01feat: granular --unstable-* flags (#20968)Bartek Iwańczuk
This commit adds granular `--unstable-*` flags: - "--unstable-broadcast-channel" - "--unstable-ffi" - "--unstable-fs" - "--unstable-http" - "--unstable-kv" - "--unstable-net" - "--unstable-worker-options" - "--unstable-cron" These flags are meant to replace a "catch-all" flag - "--unstable", that gives a binary control whether unstable features are enabled or not. The downside of this flag that allowing eg. Deno KV API also enables the FFI API (though the latter is still gated with a permission). These flags can also be specified in `deno.json` file under `unstable` key. Currently, "--unstable" flag works the same way - I will open a follow up PR that will print a warning when using "--unstable" and suggest to use concrete "--unstable-*" flag instead. We plan to phase out "--unstable" completely in Deno 2.
2023-11-01feat: deno doc --html (#21015)Bartek Iwańczuk
This commit adds static documentation site generate to "deno doc" subcommand. Example: ``` $ deno doc --html --name="My library" ./mod.ts # outputs to ./docs/ $ deno doc --html --name="My library" --output=./documentation/ ./mod.ts ./file2.js # outputs to ./documentation/ $ deno doc --html --name="My library" ./**/mod.ts # generate docs for all files with "mod.ts" name ``` Closes https://github.com/denoland/deno/issues/8233
2023-10-30fix: implement node:tty (#20892)Divy Srivastava
Fixes #21012 Closes https://github.com/denoland/deno/issues/20855 Fixes https://github.com/denoland/deno/issues/20890 Fixes https://github.com/denoland/deno/issues/20611 Fixes https://github.com/denoland/deno/issues/20336 Fixes `create-svelte` from https://github.com/denoland/deno/issues/17248 Fixes more reports here: - https://github.com/denoland/deno/issues/6529#issuecomment-1432690559 - https://github.com/denoland/deno/issues/6529#issuecomment-1522059006 - https://github.com/denoland/deno/issues/6529#issuecomment-1695803570
2023-10-12refactor: FeatureChecker integration in ext/ crates (#20797)Bartek Iwańczuk
Towards https://github.com/denoland/deno/issues/20779.
2023-09-30refactor(npm): create `cli::npm::managed` module (#20740)David Sherret
Creates the `cli::npm::managed` module and starts moving more functionality into it.
2023-09-16feat: Add "deno jupyter" subcommand (#20337)Bartek Iwańczuk
This commit adds "deno jupyter" subcommand which provides a Deno kernel for Jupyter notebooks. The implementation is mostly based on Deno's REPL and reuses large parts of it (though there's some clean up that needs to happen in follow up PRs). Not all functionality of Jupyter kernel is implemented and some message type are still not implemented (eg. "inspect_request") but the kernel is fully working and provides all the capatibilities that the Deno REPL has; including TypeScript transpilation and npm packages support. Closes https://github.com/denoland/deno/issues/13016 --------- Co-authored-by: Adam Powers <apowers@ato.ms> Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2023-09-15fix: init v8 platform once on main thread (#20495)Luca Casonato
This is a mitigation for segfaults happening in V8 on CPU with MPK (memory protected keys). After much trail and error we found that unless V8 platform is initialized on main thread the segfaults start appears once JIT kicks in. "deno test" and "deno bench" were affected by this problem. Fixes https://github.com/denoland/deno/issues/19926 Fixes https://github.com/denoland/deno/issues/20243 Fixes https://github.com/denoland/deno/issues/20450 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-08-23fix(ext/web): add stream tests to detect v8slice split bug (#20253)Matt Mastracci
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-07-25fix(lint): allow to use --rules with --rules-tags (#19754)Bartek Iwańczuk
2023-06-15refactor(flags): move watch flags into subcommand structs (#19516)David Sherret
Moves the watch setting out of the `Flags` struct and into the individual subcommands
2023-06-14fix: reload config files on watcher restarts (#19487)David Sherret
Closes #19468
2023-06-09perf: add Tokio runtime monitor (#19415)Bartek Iwańczuk
This commit adds ability to print metrics of the Tokio runtime to the console by passing "DENO_TOKIO_METRICS=1" env var. Metrics will be printed every second, but this can be changed by "DENO_TOKIO_METRICS_INTERVAL=500" env var.
2023-05-19Revert "perf: use jemalloc as global allocator (#18957)" (#19187)Bartek Iwańczuk
This reverts commit 798c1ad0f1de80ff0e7196b6140a3f74e31fe111. Reverting because this change caused a spike in memory usage, but we can't fully realise gains from lower GC pressure from more optimal malloc/ free provided by "jemalloc". We might revisit the topic in future.
2023-05-17fix(runtime): Box the main future to avoid blowing up the stack (#19155)Matt Mastracci
This fixes `Unhandled exception at [...] Stack overflow` on Windows, caused by the large size of the main future.
2023-05-14refactor(core): bake single-thread assumptions into spawn/spawn_blocking ↵Matt Mastracci
(#19056) Partially supersedes #19016. This migrates `spawn` and `spawn_blocking` to `deno_core`, and removes the requirement for `spawn` tasks to be `Send` given our single-threaded executor. While we don't need to technically do anything w/`spawn_blocking`, this allows us to have a single `JoinHandle` type that works for both cases, and allows us to more easily experiment with alternative `spawn_blocking` implementations that do not require tokio (ie: rayon). Async ops (+~35%): Before: ``` time 1310 ms rate 763358 time 1267 ms rate 789265 time 1259 ms rate 794281 time 1266 ms rate 789889 ``` After: ``` time 956 ms rate 1046025 time 954 ms rate 1048218 time 924 ms rate 1082251 time 920 ms rate 1086956 ``` HTTP serve (+~4.4%): Before: ``` Running 10s test @ http://localhost:4500 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 68.78us 19.77us 1.43ms 86.84% Req/Sec 68.78k 5.00k 73.84k 91.58% 1381833 requests in 10.10s, 167.36MB read Requests/sec: 136823.29 Transfer/sec: 16.57MB ``` After: ``` Running 10s test @ http://localhost:4500 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 63.12us 17.43us 1.11ms 85.13% Req/Sec 71.82k 3.71k 77.02k 79.21% 1443195 requests in 10.10s, 174.79MB read Requests/sec: 142921.99 Transfer/sec: 17.31MB ``` Suggested-By: alice@ryhl.io Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>