Conversation
- Switch terminal PTY layer selection to dynamic imports - Avoid bundling the Bun adapter in Node-only runtimes
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment Tip CodeRabbit can generate a title for your PR based on the changes with custom instructions.Set the |
- Detect Bun at startup and select the matching Effect runtime layer - Keep the server entrypoint working in both Bun and Node environments
- Remove Bun runtime branching from `apps/server/src/index.ts` - Run the server with the Node platform layer and runtime
What Changed
Updated the server PTY adapter wiring in
apps/server/src/serverLayers.tsto lazy-load the runtime-specific adapter instead of eagerly importing bothBunPTYandNodePTY.The server now:
process.versions.bun./terminal/Layers/BunPTYonly for Bun on non-Windows platforms./terminal/Layers/NodePTYfor Node and other fallback casesFixes
Why
bunx t3should use the Bun terminal API path, whilenpx t3should use the Node PTY path. The previous implementation imported both adapters up front and only selected between them later, which made runtime-specific loading less explicit.This change makes PTY adapter resolution match the actual runtime in use and keeps Bun-only code out of the Node path and Node-only code out of the Bun path. It also aligns the PTY loading pattern with the existing runtime-specific lazy loading already used in the SQLite layer.
UI Changes
Not applicable.
Checklist
Note
Load PTY adapter via dynamic import at runtime instead of static import
BunPtyAdapterLiveandNodePtyAdapterLivewith amakeRuntimePtyAdapterLayerfunction in serverLayers.ts that selects and loads the adapter at runtime.process.versions.bunis defined and the platform is notwin32, otherwise falls back to the Node adapter.import()viaEffect.promiseso neither adapter module is bundled or evaluated unless it is needed.Macroscope summarized d3ebbe6.