feat: add first-class Bun and Deno runtime support#309
Merged
Conversation
|
✅ Documentation preview deployed to: https://react-server-docs-nfwlm39wz-lazarv-team.vercel.app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First-class Bun & Deno runtime support
Until now,
@lazarv/react-serverhas been a Node.js-first framework with experimental adapter-level support for alternative runtimes. This PR promotes Bun and Deno to fully supported, first-class runtimes — from project scaffolding all the way through development, production builds, and deployment.What changes for users
Zero-config runtime detection — When you run
react-server buildorreact-server startunder Bun or Deno, the framework now automatically detects the runtime and applies the correct adapter. No manualadapter: "bun"oradapter: "deno"configuration is needed anymore (though explicit overrides and--no-adapterstill work).Scaffolding just works —
create-react-servernow detects the runtime you're using at project creation time and automatically configurespackage.jsonscripts accordingly:bun --bun react-server ...scripts andtrustedDependenciesdeno run -A npm:@lazarv/react-server ...scripts and adeno.jsonwithnodeModulesDir: "manual"+byonmSimplified production start — Instead of requiring users to manually run
.bun/start.mjsor.deno/start.mjs, the standardreact-server startcommand now handles everything, including import map generation for Deno and proper process spawning for both runtimes.What changes under the hood
lib/loader/bun.mjsandlib/loader/deno.mjs) handle the differences in how each runtime resolves@lazarv/react-server/dist/...specifiers, manifest files, and prebuilt configs during production serving.worker_threads, a new process-based rendering pipeline (render-process.mjs,render-process-channel.mjs,render-process-spawn.mjs) communicates over stdio, replacing the worker thread approach while keeping the same external API.sys.mjsprocess shim — The Deno process polyfill is now more robust (addson/off/once/stdout/stderrstubs) and no longer overwrites the realprocessglobal when Deno's Node compat layer already provides one.New examples
examples/bun/— A complete Bun example with SSR, client-side hydration, and interactive counterexamples/deno/— A complete Deno example with the same feature set plusreact-server.deno.jsonconfigurationTesting
create-react-servercovering Node.js, Bun, and Deno — each runtime is tested in an isolated container to verify that scaffolded projects build and start correctly..github/workflows/create-react-server.yml) runs these tests automatically on push and PR.Documentation
Updated the getting started guide and deployment docs (English and Japanese) to reflect that Deno is now fully supported, remove the "not supported yet" notices, and document automatic adapter detection along with simplified deployment commands.