Skip to content

feat: add bunny preset#4025

Open
sandros94 wants to merge 6 commits intonitrojs:mainfrom
sandros94:feat/bunny-preset
Open

feat: add bunny preset#4025
sandros94 wants to merge 6 commits intonitrojs:mainfrom
sandros94:feat/bunny-preset

Conversation

@sandros94
Copy link
Contributor

@sandros94 sandros94 commented Feb 11, 2026

🔗 Linked issue

Discussed privately

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This is an experimental preset to be used on Bunny.net Edge Scripting.

The serverless platform is built ontop of Deno, with accessible pricing and ease of use, but it does come at the cost of some challanging limitations (single-file bundle artifact, 10MB max; 500ms max startup; 128MB memory; etc.), nothing that Nitro is not currently able to handle.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@sandros94 sandros94 requested a review from pi0 as a code owner February 11, 2026 18:04
@vercel
Copy link

vercel bot commented Feb 11, 2026

@sandros94 is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

@sandros94
Copy link
Contributor Author

Typecheck should be failing because of d3b1f7b

@sandros94 sandros94 marked this pull request as draft February 11, 2026 18:14
@coderabbitai
Copy link

coderabbitai bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

Adds a Bunny edge-scripting Nitro preset: updates preset aggregation and types, adds a Bunny preset module and runtime script, and includes tests and test helper updates to validate build artifacts and runtime behavior.

Changes

Cohort / File(s) Summary
Preset Aggregation & Types
src/presets/_all.gen.ts, src/presets/_types.gen.ts
Added ..._bunny to aggregated presets and extended PresetName / PresetNameInput unions with bunny, bunny-edge-scripting and alias variants.
Bunny Preset Implementation
src/presets/bunny/preset.ts
New Bunny preset (edgeScripting) defining entry, export conditions, preview command, output layout, Rollup options, inline static serving enforcement, and a compiled hook to remove publicDir. Exported as default array.
Bunny Runtime
src/presets/bunny/runtime/edge-scripting.ts
New runtime script that calls Bunny.v1.serve(nitroApp.fetch) when Bunny is present; otherwise starts a Deno.serve fallback using Nitro's fetch, with host/port resolution.
Tests & Test Helpers
test/presets/bunny.test.ts, test/tests.ts
Added bunny-edge-scripting test verifying generated bunny-edge-scripting.mjs, inlined assets, minification, and Bunny usage; updated test setup to treat this preset as a worker and adjust sourcemap test skipping.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description is related to the changeset, explaining the new Bunny.net Edge Scripting preset and its constraints.
Title check ✅ Passed The pull request title 'feat: add bunny preset' follows conventional commits format with a 'feat' type prefix and clearly describes the main change of adding a new Bunny preset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sandros94 sandros94 marked this pull request as ready for review February 11, 2026 18:21
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@src/presets/bunny/runtime/edge-scripting.ts`:
- Around line 11-16: The preset for the bunny runtime is missing the unenv
configuration so process.env polyfills aren't injected; update the preset config
to include unenv: unenvDeno alongside exportConditions: ["deno"] so references
like process.env (used when computing _parsedPort and in the Deno.serve options)
are properly polyfilled at runtime. Locate the bunny runtime preset object that
currently sets exportConditions: ["deno"] (or similar) and add the unenv:
unenvDeno property to that same config.

In `@test/presets/bunny.test.ts`:
- Around line 16-29: The spawned Deno process from the execa(...) call is never
captured and therefore never killed; update the test to store the returned child
process (from execa(...)) into a variable (e.g., proc) and replace the no-op
ctx.server.close with a callback that terminates that process (e.g., proc.kill()
/ proc.kill("SIGKILL") or proc.cancel() per execa API) so the Deno process
running bunny-edge-scripting.mjs is reliably stopped when ctx.server.close() is
invoked; keep the same env/NITRO_PORT setup and use ctx.outDir to locate the
script as before.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 13, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nitrojs/nitro@4025

commit: 9dfded7

@pi0 pi0 changed the title feat(bunny): add new preset feat: add bunny preset Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants