diff --git a/runtime/cli_apps/index.md b/runtime/cli_apps/index.md index 968485708..f2865dcb8 100644 --- a/runtime/cli_apps/index.md +++ b/runtime/cli_apps/index.md @@ -1,5 +1,5 @@ --- -last_modified: 2026-06-12 +last_modified: 2026-08-06 title: "Build CLI apps" description: "Build command-line tools with Deno: read arguments and stdin, prompt the user, set exit codes, compile to a single self-contained executable, and distribute your tool." --- @@ -169,6 +169,11 @@ with the usual `--allow-*` flags so it runs without prompting: deno compile --output greet greet.ts ``` +If binary size matters more than raw execution speed, you can build against the +experimental QuickJS engine instead of V8 with `--engine quickjs`. See +[choosing a JavaScript engine](/runtime/reference/cli/compile/#choosing-a-javascript-engine) +for the trade-offs. + ## Embed assets in the binary A single-file executable should stay single-file even when your tool needs data diff --git a/runtime/desktop/distribution.md b/runtime/desktop/distribution.md index c80aa1d15..33a643f56 100644 --- a/runtime/desktop/distribution.md +++ b/runtime/desktop/distribution.md @@ -1,5 +1,5 @@ --- -last_modified: 2026-06-25 +last_modified: 2026-08-06 title: "Distribution" description: "Cross-compile a deno desktop app for macOS, Windows, and Linux from one machine, and produce per-platform output formats: .app, .dmg, .exe directory, AppImage." --- @@ -185,6 +185,13 @@ Cross-compiling from one OS to another requires: Both downloads are SHA-256 verified and cached under `/`. +`deno desktop` also accepts `--engine v8|quickjs`, which selects the JavaScript +engine inside the downloaded runtime library. V8 is the default; the +experimental QuickJS build is smaller but does not receive the same security +updates. See +[choosing a JavaScript engine](/runtime/reference/cli/compile/#choosing-a-javascript-engine) +for the full trade-offs. + There is **no Rust toolchain involved** in cross-compiling a desktop app. You are not compiling Rust on the host; you are downloading prebuilt artifacts for the target and packaging them with your code. This is the same model as diff --git a/runtime/reference/cli/compile.md b/runtime/reference/cli/compile.md index 268790c9e..90ef68559 100644 --- a/runtime/reference/cli/compile.md +++ b/runtime/reference/cli/compile.md @@ -1,5 +1,5 @@ --- -last_modified: 2026-06-27 +last_modified: 2026-08-06 title: "deno compile" oldUrl: - /runtime/manual/tools/compile/ @@ -106,11 +106,14 @@ Deno supports cross compiling to all targets regardless of the host platform. | OS | Architecture | Target | | ------- | ------------ | --------------------------- | | Windows | x86_64 | `x86_64-pc-windows-msvc` | +| Windows | ARM64 | `aarch64-pc-windows-msvc` | | macOS | x86_64 | `x86_64-apple-darwin` | | macOS | ARM64 | `aarch64-apple-darwin` | | Linux | x86_64 | `x86_64-unknown-linux-gnu` | | Linux | ARM64 | `aarch64-unknown-linux-gnu` | +`aarch64-pc-windows-msvc` (Windows on ARM) is supported starting in Deno 2.9.3. + ## The denort binary `deno compile` embeds your program into `denort` ("Deno runtime"): a stripped @@ -128,6 +131,48 @@ To use a custom or locally built runtime as the base, set the `DENORT_BIN` environment variable to its path. Deno also picks up a `denort` binary placed next to the `deno` executable. +## Choosing a JavaScript engine + +:::caution + +`--engine quickjs` is experimental and subject to change. It landed after Deno +2.9.4, so it is available in +[canary builds](/runtime/reference/cli/upgrade/#canary-build) and in later +releases. + +::: + +Compiled binaries run on V8 by default. The `--engine` flag lets you build +against QuickJS instead, which produces a smaller executable: + +```sh +# Default, same as omitting the flag +deno compile --engine v8 main.ts + +# Build a binary that runs on QuickJS +deno compile --engine quickjs main.ts +``` + +The same flag is available on [`deno desktop`](/runtime/desktop/distribution/), +where it selects the engine embedded in the app's runtime library. + +Trade-offs to weigh before shipping a QuickJS binary: + +- **Security updates.** The QuickJS backend does not receive the same security + updates as V8. Don't use it for programs that run untrusted input. +- **Performance.** QuickJS is an interpreter with no JIT, so compute-heavy code + runs slower than on V8. Startup and memory use are lower. +- **Maturity.** The backend is experimental; behavior differences from V8 are + possible, so test your program with the engine you intend to ship. + +Each engine has its own prebuilt runtime: with `--engine quickjs`, Deno +downloads `denort-quickjs-.zip` (or `libdenort-quickjs-.zip` for +`deno desktop`) instead of the default `denort-.zip`. Both variants are +published for every [supported target](#supported-targets), so cross-compilation +works the same way. If you override the base runtime with `DENORT_BIN` (or a +`denort` binary next to `deno`), that binary is used as-is: `--engine` is then +ignored and Deno prints a warning. + ## Icons It is possible to add an icon to the executable by using the `--icon` flag when