Defer Node HTTP adapter loading until Node startup

KH
3d ago
+38-1

Importing createApp currently resolves and initializes @hono/node-server, even when an embedding host provides storage and never starts a Node HTTP server. Load the adapter only inside startServer(), before startup can initialize storage. Existing application/startup exports and the serve() call are unchanged.

The regression uses an isolated child-process loader that refuses the Node HTTP module. Application exports must import successfully, while calling startServer() must resolve the module before accessing storage. Reverting the import change makes the test fail; the final change passes.

Validation:

  • npm ci.
  • npm run build -- --filter=@relayauth/server...: all four dependency packages pass, including declaration emission.
  • npm --workspace @relayauth/server test: 741 tests pass, including existing Node startup/bootstrap behavior.
  • Exact old/new regression check: old source exits 1 for the intended loader guard, final source exits 0.
  • Whitespace and host-assisted Veto code/security/secrets review pass.

No dependency or version bump, publication, migration, configuration, platform-specific cloud code, or deployment change. This import-timing fix does not claim to remove all Node-only bytes from bundles or resolve the dependency's advisory. Those remain separate release review requirements for an embedding consumer. Keep draft for review.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.