Skip to content

Add language: deno support#1516

Merged
j178 merged 10 commits intoj178:masterfrom
shaanmajid:feat/deno-support
Mar 20, 2026
Merged

Add language: deno support#1516
j178 merged 10 commits intoj178:masterfrom
shaanmajid:feat/deno-support

Conversation

@shaanmajid
Copy link
Copy Markdown
Collaborator

@shaanmajid shaanmajid commented Feb 1, 2026

Closes #619

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 1, 2026

Codecov Report

❌ Patch coverage is 91.70404% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.78%. Comparing base (c09510e) to head (2655397).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
crates/prek/src/languages/deno/installer.rs 85.71% 26 Missing ⚠️
crates/prek/src/languages/deno/deno.rs 96.59% 5 Missing ⚠️
crates/prek/src/languages/deno/version.rs 97.27% 3 Missing ⚠️
crates/prek/src/languages/mod.rs 50.00% 2 Missing ⚠️
crates/prek/src/languages/version.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1516      +/-   ##
==========================================
- Coverage   91.79%   91.78%   -0.02%     
==========================================
  Files          98      101       +3     
  Lines       20119    20565     +446     
==========================================
+ Hits        18469    18876     +407     
- Misses       1650     1689      +39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@prek-ci-bot
Copy link
Copy Markdown

prek-ci-bot bot commented Feb 1, 2026

📦 Cargo Bloat Comparison

Binary size change: +0.40% (24.8 MiB → 24.9 MiB)

Expand for cargo-bloat output

Head Branch Results

 File  .text     Size             Crate Name
 1.3%   2.7% 332.0KiB        aws_lc_sys aws_lc_0_38_0_aes_gcm_encrypt_avx512
 1.3%   2.7% 332.0KiB        aws_lc_sys aws_lc_0_38_0_aes_gcm_decrypt_avx512
 0.3%   0.6%  77.6KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6%  71.9KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6%  68.9KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.2%   0.5%  56.8KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.4%  51.0KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.4%  46.5KiB              prek prek::run::{{closure}}
 0.2%   0.3%  42.2KiB              prek prek::cli::run::run::run::{{closure}}
 0.1%   0.3%  31.8KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_38_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.8KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_38_0_edwards25519_scalarmuldouble
 0.1%   0.2%  26.7KiB             prek? <prek::config::_::<impl serde_core::de::Deserialize for prek::config::Config>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2%  26.3KiB              prek prek::cli::try_repo::try_repo::{{closure}}
 0.1%   0.2%  24.2KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2%  23.0KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2%  22.4KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  22.3KiB         [Unknown] Lp384_montjscalarmul_alt_p384_montjadd
 0.1%   0.2%  21.7KiB              prek prek::workspace::Project::init_hooks::{{closure}}
41.2%  86.0%  10.3MiB                   And 23389 smaller methods. Use -n N to show more.
47.9% 100.0%  11.9MiB                   .text section size, the file size is 24.9MiB

Base Branch Results

 File  .text     Size             Crate Name
 1.3%   2.7% 332.0KiB        aws_lc_sys aws_lc_0_38_0_aes_gcm_encrypt_avx512
 1.3%   2.7% 332.0KiB        aws_lc_sys aws_lc_0_38_0_aes_gcm_decrypt_avx512
 0.3%   0.6%  77.0KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6%  72.6KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.3%   0.6%  69.8KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.4%  51.0KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.4%  50.6KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.4%  47.1KiB              prek prek::run::{{closure}}
 0.2%   0.3%  41.9KiB              prek prek::cli::run::run::run::{{closure}}
 0.1%   0.3%  32.0KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_38_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.8KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_38_0_edwards25519_scalarmuldouble
 0.1%   0.2%  26.2KiB              prek prek::cli::try_repo::try_repo::{{closure}}
 0.1%   0.2%  25.3KiB             prek? <prek::config::_::<impl serde_core::de::Deserialize for prek::config::Config>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2%  23.1KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2%  22.4KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  22.3KiB         [Unknown] Lp384_montjscalarmul_alt_p384_montjadd
 0.1%   0.2%  22.0KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2%  21.6KiB              prek prek::workspace::Project::init_hooks::{{closure}}
41.2%  86.0%  10.2MiB                   And 23349 smaller methods. Use -n N to show more.
47.9% 100.0%  11.9MiB                   .text section size, the file size is 24.8MiB

shaanmajid and others added 3 commits March 19, 2026 15:16
Add first-class support for Deno as a hook language, enabling pre-commit
hooks to run Deno scripts, built-in commands (fmt, lint, check), and
npm/jsr packages.

Features:
- Automatic Deno version management with downloads from GitHub releases
- Support for language_version specs: major, minor, patch, semver ranges
- Isolated DENO_DIR cache per hook environment
- Built-in command detection (fmt, lint, test, etc.) without "deno run"
- Script file execution with automatic "deno run" prefix
- npm/jsr package support via additional_dependencies
- Copies deno.json and deno.lock from repos for reproducible builds

The implementation follows the patterns established by Bun and other
managed language runtimes in the codebase.

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
Add comprehensive test coverage and CI integration for Deno support:

Tests (10 integration tests):
- Basic inline eval execution
- TypeScript script file execution
- Built-in commands (fmt, lint)
- Explicit deno prefix handling
- npm package dependencies
- language_version specifications
- Auto-download without system deno
- Semver range versions
- Hook failure propagation
- Permission flags

CI:
- Add Deno to language test matrix
- Run on Linux only (downloads deno internally)

Documentation:
- Update languages.md with Deno usage examples
- Regenerate CLI reference
@j178 j178 force-pushed the feat/deno-support branch from ca36577 to 2c78323 Compare March 19, 2026 07:18
@prek-ci-bot
Copy link
Copy Markdown

prek-ci-bot bot commented Mar 19, 2026

⚡️ Hyperfine Benchmarks

Summary: 0 regressions, 0 improvements above the 10% threshold.

Environment
  • OS: Linux 6.14.0-1017-azure
  • CPU: 4 cores
  • prek version: prek 0.3.6+27 (7f7453f 2026-03-19)
  • Rust version: rustc 1.94.0 (4a4ef493e 2026-03-02)
  • Hyperfine version: hyperfine 1.20.0
CLI Commands

Benchmarking basic commands in the main repo:

prek --version

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base --version 2.3 ± 0.1 2.2 2.9 1.00 ± 0.06
prek-head --version 2.3 ± 0.1 2.2 3.0 1.00

prek list

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base list 8.9 ± 0.1 8.7 9.2 1.00
prek-head list 8.9 ± 0.1 8.7 9.4 1.00 ± 0.02

prek validate-config .pre-commit-config.yaml

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base validate-config .pre-commit-config.yaml 3.2 ± 0.0 3.1 3.3 1.00 ± 0.02
prek-head validate-config .pre-commit-config.yaml 3.2 ± 0.0 3.1 3.3 1.00

prek sample-config

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base sample-config 2.6 ± 0.0 2.5 2.7 1.00
prek-head sample-config 2.6 ± 0.0 2.5 2.7 1.01 ± 0.02
Cold vs Warm Runs

Comparing first run (cold) vs subsequent runs (warm cache):

prek run --all-files (cold - no cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 157.1 ± 2.5 152.6 160.6 1.00
prek-head run --all-files 164.2 ± 10.0 155.9 188.2 1.05 ± 0.07

prek run --all-files (warm - with cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 156.6 ± 3.4 151.4 164.6 1.00
prek-head run --all-files 157.3 ± 2.7 150.4 161.0 1.00 ± 0.03
Full Hook Suite

Running the builtin hook suite on the benchmark workspace:

prek run --all-files (full builtin hook suite)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 158.3 ± 4.0 153.6 178.3 1.00
prek-head run --all-files 161.5 ± 27.5 150.5 350.8 1.02 ± 0.18
Individual Hook Performance

Benchmarking each hook individually on the test repo:

prek run trailing-whitespace --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run trailing-whitespace --all-files 21.8 ± 0.3 21.1 22.3 1.00 ± 0.02
prek-head run trailing-whitespace --all-files 21.8 ± 0.3 21.2 22.4 1.00

prek run end-of-file-fixer --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run end-of-file-fixer --all-files 29.0 ± 1.8 25.7 32.6 1.00
prek-head run end-of-file-fixer --all-files 29.4 ± 2.2 25.7 35.6 1.01 ± 0.10

prek run check-json --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-json --all-files 12.1 ± 0.2 11.8 12.6 1.00 ± 0.03
prek-head run check-json --all-files 12.1 ± 0.3 11.6 12.6 1.00

prek run check-yaml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-yaml --all-files 11.9 ± 0.2 11.6 12.5 1.01 ± 0.02
prek-head run check-yaml --all-files 11.8 ± 0.1 11.6 12.2 1.00

prek run check-toml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-toml --all-files 12.0 ± 0.2 11.6 12.6 1.00
prek-head run check-toml --all-files 12.1 ± 0.3 11.5 13.0 1.00 ± 0.03

prek run check-xml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-xml --all-files 12.1 ± 0.4 11.5 13.1 1.01 ± 0.04
prek-head run check-xml --all-files 11.9 ± 0.2 11.4 12.5 1.00

prek run detect-private-key --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run detect-private-key --all-files 19.4 ± 1.6 16.8 23.3 1.05 ± 0.13
prek-head run detect-private-key --all-files 18.4 ± 1.6 16.3 22.0 1.00

prek run fix-byte-order-marker --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run fix-byte-order-marker --all-files 23.8 ± 1.5 21.2 26.5 1.00
prek-head run fix-byte-order-marker --all-files 24.2 ± 1.9 21.2 27.9 1.02 ± 0.10
Installation Performance

Benchmarking hook installation (fast path hooks skip Python setup):

prek install-hooks (cold - no cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base install-hooks 4.7 ± 0.1 4.7 4.8 1.00 ± 0.02
prek-head install-hooks 4.7 ± 0.1 4.7 4.8 1.00

prek install-hooks (warm - with cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base install-hooks 4.8 ± 0.0 4.7 4.8 1.00
prek-head install-hooks 4.8 ± 0.0 4.8 4.9 1.01 ± 0.01
File Filtering/Scoping Performance

Testing different file selection modes:

prek run (staged files only)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run 52.5 ± 0.8 51.4 54.7 1.00
prek-head run 53.0 ± 1.1 51.4 54.8 1.01 ± 0.03

prek run --files '*.json' (specific file type)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --files '*.json' 9.0 ± 0.1 8.9 9.3 1.01 ± 0.02
prek-head run --files '*.json' 8.9 ± 0.1 8.7 9.1 1.00
Workspace Discovery & Initialization

Benchmarking hook discovery and initialization overhead:

prek run --dry-run --all-files (measures init overhead)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --dry-run --all-files 14.0 ± 0.4 13.6 15.3 1.01 ± 0.03
prek-head run --dry-run --all-files 13.8 ± 0.1 13.6 14.1 1.00
Meta Hooks Performance

Benchmarking meta hooks separately:

prek run check-hooks-apply --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-hooks-apply --all-files 12.5 ± 0.1 12.4 12.9 1.00
prek-head run check-hooks-apply --all-files 12.6 ± 0.1 12.5 12.7 1.00 ± 0.01

prek run check-useless-excludes --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-useless-excludes --all-files 12.4 ± 0.1 12.3 12.8 1.00
prek-head run check-useless-excludes --all-files 12.5 ± 0.1 12.3 12.8 1.00 ± 0.01

prek run identity --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run identity --all-files 10.8 ± 0.1 10.7 11.0 1.00
prek-head run identity --all-files 10.9 ± 0.1 10.8 11.0 1.01 ± 0.01

@shaanmajid
Copy link
Copy Markdown
Collaborator Author

Ahhh thanks for the ping haha. I can take this back up today if you'd like, otherwise if you're taking it over that'd be great as well :)

@j178 j178 changed the title Feat/deno support Add language: deno support Mar 19, 2026
@j178 j178 marked this pull request as ready for review March 19, 2026 08:26
Copilot AI review requested due to automatic review settings March 19, 2026 08:26
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9a18d5a87

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class language: deno support to prek, including toolchain resolution/download, schema + docs updates, and CI + integration tests to exercise Deno hooks.

Changes:

  • Register deno as a supported language across config parsing, schema, CLI docs, and language dispatch.
  • Implement Deno toolchain install/version resolution plus hook install/run plumbing.
  • Add Deno language integration tests and run them in CI via a new nextest profile and setup-deno.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
prek.schema.json Adds deno to schema definitions/enums.
docs/languages.md Documents Deno as supported and describes version formats/usage examples.
docs/cli.md Adds deno to the CLI “language” listing.
crates/prek/tests/languages/main.rs Registers the new Deno test module.
crates/prek/tests/languages/deno.rs Adds integration coverage for Deno execution, caching, versions, etc.
crates/prek/src/store.rs Introduces tool/cache buckets for Deno.
crates/prek/src/languages/version.rs Wires LanguageRequest::Deno into version request parsing/satisfaction checks.
crates/prek/src/languages/mod.rs Adds Deno language implementation to install/health/run dispatch and capability flags.
crates/prek/src/languages/deno/* Implements Deno language runner + installer + version request parsing.
crates/prek/src/config.rs Adds Language::Deno to the enum.
crates/prek-consts/src/env_vars.rs Adds PREK_INTERNAL__DENO_BINARY_NAME and DENO_DIR.
.github/workflows/ci.yml Adds a deno language-test matrix entry and installs Deno in that job.
.config/nextest.toml Adds profile.lang-deno filter for Deno language tests.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class language: deno support to prek (toolchain install + hook execution), wiring it through the language dispatch layer, CI, schema, and docs to close #619.

Changes:

  • Introduces a Deno language implementation with toolchain resolution/download + additional_dependencies installation via deno install --global.
  • Wires Deno through language parsing/dispatch, store buckets, env var constants, and CI/nextest profiles.
  • Adds end-to-end integration tests and expands docs/schema/CLI references to include deno.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
prek.schema.json Adds deno to the schema’s language/version surfaces.
docs/languages.md Documents Deno language behavior, language_version, and dependency rules.
docs/cli.md Updates CLI language listing to include deno.
crates/prek/tests/languages/main.rs Registers the new deno language test module.
crates/prek/tests/languages/deno.rs Adds integration coverage for Deno execution, deps, remote hooks, and version selection.
crates/prek/src/store.rs Adds ToolBucket::Deno and CacheBucket::Deno for toolchain + caching.
crates/prek/src/languages/version.rs Adds LanguageRequest::Deno to parse/satisfy Deno language_version.
crates/prek/src/languages/mod.rs Plumbs Language::Deno into install/run/health checks and bucket selection.
crates/prek/src/languages/deno/mod.rs Introduces the Deno language module layout and exports.
crates/prek/src/languages/deno/installer.rs Implements system lookup + download/install for requested Deno versions.
crates/prek/src/languages/deno/deno.rs Implements Deno hook env creation, dependency installs, and runtime execution.
crates/prek/src/languages/deno/version.rs Defines Deno version/request parsing and matching.
crates/prek/src/config.rs Adds Language::Deno to the config language enum.
crates/prek-consts/src/env_vars.rs Adds Deno-related env var constants used by installer/runtime.
.github/workflows/ci.yml Installs Deno in CI language matrix and adds DENO_VERSION env.
.config/nextest.toml Adds a nextest profile to run only Deno language tests.

@j178 j178 force-pushed the feat/deno-support branch from 65fca65 to 2655397 Compare March 19, 2026 17:40
@j178 j178 merged commit f0066e2 into j178:master Mar 20, 2026
53 checks passed
j178 added a commit that referenced this pull request Mar 20, 2026
---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
@shaanmajid shaanmajid deleted the feat/deno-support branch March 25, 2026 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add language: deno and language: bun support

4 participants