dprint is a pluggable and configurable code formatting platform that unifies all your formatters.
Version 0.66 is faster. It also adds ways to lock down what dprint downloads and installs, makes dprint upgrade safer, and improves the incremental cache.
Performance
Most of this release went into reducing dprint's own overhead:
- Plugins read, format, and handle files in batches on their own threads, instead of going through a single thread several times per file.
- Large files are formatted first, so that one isn't left running alone at the end.
- Gitignores are applied while reading directories in parallel, and files that can't match are skipped earlier.
- File paths provided as arguments are resolved by listing directories instead of looking up each path.
- Compiled plugins are memory mapped on Windows.
- Files that haven't changed aren't opened on macOS when using the incremental cache.
Median times of 0.65.0 → 0.66:
| Windows | Linux | macOS | |
|---|---|---|---|
| Warm incremental cache, 5,000 files | 69 → 33 ms | 27 → 8 ms | 66 → 18 ms |
| 500 file paths as arguments | 66 → 22 ms | 53 → 7 ms | 53 → 16 ms |
| Globbing | 128 → 27 ms | 25 → 12 ms | 34 → 26 ms |
| Many small files | 112 → 32 ms | 40 → 12 ms | 102 → 49 ms |
| Files with embedded code | 55 → 25 ms | 25 → 9 ms | 56 → 29 ms |
fmt where every file changes
| 49 → 41 ms | 19 → 19 ms | 63 → 63 ms |
These use plugins that do little work in order to measure dprint itself, so expect smaller gains where most of the time is spent formatting. Large files and the first run of a plugin take about the same time as before.
Incremental cache
The incremental file is now stored in node_modules/.cache/dprint when there's a node_modules folder, and otherwise in dprint's cache directory like before. It's also now a binary file instead of JSON for better performance.
Use incremental in the configuration file or --incremental=<value> to choose how changed files are detected:
content- Opens every file and compares its content.metadata- Doesn't open files whose metadata hasn't changed. On Windows, this needs Windows 11 24H2 or Windows Server 2025, and otherwise the content is used.true- Metadata on macOS when not on a CI, and otherwise content.
Locking down downloads
Two new environment variables limit what dprint does without you asking:
DPRINT_ALLOWED_HOSTS- Comma-separated list of the only hosts dprint may connect to, over https (ex.registry.npmjs.org). This includes redirects and proxies.DPRINT_AUTO_INSTALL- What dprint installs automatically. Set it to0for nothing, or to a comma separate list of what's allowed (wasmfor Wasm plugins andconfigfor remote configuration files). Install the rest explicitly withdprint install.
See Hardening dprint for how to use these together.
Safer upgrades
dprint upgrade now downloads from npm instead of GitHub, using the registry in your own ~/.npmrc.
- Only installs versions published with provenance from the dprint repository, and verifies the integrity of the download.
- Respects
min-release-agein your~/.npmrc. Use--minimum-dependency-ageto override it. - Respects
DPRINT_ALLOWED_HOSTS, always requires https, and refuses to run whenDPRINT_IGNORE_CERTSis set. - Only replaces the current executable once the new one is known to run.
- Use
dprint upgrade <version>to change to a specific version. Without a version, it never downgrades.
This applies when upgrading from 0.66 onwards. Upgrading to 0.66 uses your current version's implementation.
Plugin development
Plugins can now set skipStableFormat in the plugin info JSON when formatting their output again never changes it. dprint then skips formatting changed files an extra time to check that the output is stable.
This should only be done for plugins that actually achieve this.
Breaking change
The editor.trustedDomains setting is now editor.autoDownloadDomains. The old name still works, but with either name, each domain now only matches that exact host. Use *.example.com to match its subdomains. Editors ask before downloading from a domain that no longer matches.
Changes
- feat: let plugins skip formatting until the output is stable (#1469)
- feat: ability to specify "content" or "metadata" for incremental (#1493)
- feat: add DPRINT_AUTO_INSTALL env var (#1466, #1495)
- feat: add DPRINT_ALLOWED_HOSTS env var for limiting the hosts to connect to (#1497)
- feat(BREAKING): rename editor.trustedDomains to editor.autoDownloadDomains and require *. for subdomains (#1498)
- feat: dprint upgrade downloads from npm (#1502)
- feat: dprint upgrade requires npm provenance (#1505)
- feat: support upgrading to a specific version with dprint upgrade (#1506)
- feat: store incremental file in node_modules and use a binary format (#1473)
- perf: only check for raw mode when logging to a terminal (#1471)
- perf: handle files formatting didn't change on the runtime thread (#1472)
- perf: apply gitignores on the threads reading directories when globbing (#1474)
- perf: read, format and handle a file on the Wasm plugin's thread (#1475)
- perf: format files in batches on the Wasm plugin's threads (#1476)
- perf: do not check every CLI path for each directory of a file path (#1482)
- perf: skip matching globs for files whose name cannot match when globbing (#1484)
- perf: list directories instead of looking up each CLI path (#1483)
- perf: format small embedded text on the thread of the plugin (#1485)
- perf: do not create paths for files whose name cannot match when globbing (#1486)
- perf: start the threads reading directories as they are needed (#1487)
- perf(macos): run fewer batches when most of the time is spent reading files (#1488)
- perf(windows): memory map compiled plugins (#1489)
- perf: format large files first (#1490)
- perf(macos): do not open files that have not changed when using the incremental cache (#1491)
- fix: do not panic when the output pipe is closed (#1479)
- fix: handle more ways the output can be closed (#1480)
- fix: do not hang using all of a core when the terminal is closed while prompting (#1481)
- fix: resolve executable of process plugin in node_modules from node_modules (#1494)
Install
Run dprint upgrade or see https://dprint.dev/install/
Verification
These artifacts have build provenance attestations.
Verify a download with the GitHub CLI:
gh attestation verify dprint-x86_64-unknown-linux-gnu.zip --repo dprint/dprint
The zips are also described by a signed packslip (packslip.sigstore.json):
packslip verify packslip.sigstore.json --artifact dprint-x86_64-unknown-linux-gnu.zip
Checksums
| Artifact | SHA-256 Checksum |
|---|---|
| dprint-x86_64-apple-darwin.zip | 23d2d405acd328ebcb3c2e4264a6115f51d71819b3fa1b1fb7fa3a8b5308a173 |
| dprint-aarch64-apple-darwin.zip | 458ea1e73b12c040ce3faee82bf5ddc8bfd8e0db66754a5dc355b7e50b9aa79e |
| dprint-x86_64-pc-windows-msvc.zip | c81420613382e0a850600bd43a113b12c9f7981d7f4658049ea25a832be74e46 |
| dprint-x86_64-pc-windows-msvc-installer.exe | 1529f503ec324d405267e62cdfe6430bb1740ea15928641d47b5e1863ca88bba |
| dprint-aarch64-pc-windows-msvc.zip | 02189d20f9ca258bea28e9f2c116210cb33e1eed7df281090868912ba341bc83 |
| dprint-x86_64-unknown-linux-gnu.zip | 38096e06f17f197a9ac7d17cee7cd1c9cfb09d40803eda7b586f975724b770f4 |
| dprint-x86_64-unknown-linux-musl.zip | 861b8d774f48274fa2adc4d6e36dcfa1754b0c908694c27cecc0e1b4826d536c |
| dprint-aarch64-unknown-linux-gnu.zip | 25944f675cb060ce32286c3aab3a8ba388d96ca37b2724dcb0f5ffb5abf0610b |
| dprint-aarch64-unknown-linux-musl.zip | 67262750eed60b3cc1d42ad2328ab4dcc89609b94ae99e69b45088687606bfae |
| dprint-riscv64gc-unknown-linux-gnu.zip | 779f3336470087e6a1105af56971162060206c67a2722cb7adafe1a4b3d88278 |
| dprint-riscv64gc-unknown-linux-musl.zip | 235b75eb6784732b695dad34dce657448cf3c48e0180fd60a5011c8c066d450f |
| dprint-s390x-unknown-linux-gnu.zip | 6173fea999f94a8b9b07f6cbb6ca6d9bd7bace845de2f28b969f62151b3cd102 |
| dprint-loongarch64-unknown-linux-gnu.zip | dfcdc0f959092c030d201ea3ba10ad0e92cc4d9fbb3d0e84acf15edc39d910e4 |
| dprint-loongarch64-unknown-linux-musl.zip | 834b8911874f61b9f4f2e5265e5aa95280f86cf9a86b0fc58783ecf86a1b4041 |
| dprint-powerpc64le-unknown-linux-gnu.zip | 41972d6e179ac9101c73576d9a48bff4e0dc4e752697efcbd4c439b5b507e4ce |
| dprint-powerpc64le-unknown-linux-musl.zip | 94f1aa895ea21b6e6d211b6086d390a46b4a16c681f01dada06b2347391e0154 |
| dprint-aarch64-linux-android.zip | 46af43028c224fa683032171c4d2ddc17e38b5cad7add2258df3cfa0a76e27d4 |
| dprint-x86_64-linux-android.zip | d543954abc0c5b0b7d3eade91dd7e553ca9a94ca1f36ab5aff47a2c0b1bf2f71 |
| dprint-x86_64-unknown-freebsd.zip | 1a351b503496f04b91ec30cf3fb7e159f0f9030a40045472a2f2d612101d2b7e |
| dprint-aarch64-unknown-freebsd.zip | e2a0b7cdf408ea1965ebc29df844f3aab7228c3e56f8720c71baa09ea02b3a3c |