Summary
Implement a Bun-compatible serve facade over Perry's existing native HTTP/HTTPS stack. This is a synthetic parity target, independent of any application corpus.
Minimal fixture
import { serve } from "bun";
const server = serve({
hostname: "127.0.0.1",
port: 0,
idleTimeout: 0,
development: false,
fetch(request, server) {
const address = server.requestIP(request)?.address ?? "unknown";
return new Response(`${request.method}:${address}`);
},
error(error) {
return new Response(error.message, { status: 500 });
},
});
console.log(server.hostname, server.port > 0);
const response = await fetch(`http://127.0.0.1:${server.port}/`);
console.log(response.status, await response.text());
server.unref();
server.stop(true);
Initial acceptance surface
- ephemeral
port: 0, hostname binding, hostname and port properties;
- Fetch API request/response handler, async handlers, and
error handler;
requestIP(request);
stop(closeActiveConnections?), ref, and unref;
- TLS options can be a follow-up if a clear unsupported diagnostic is emitted.
A Bun-native CLI has two reachable call sites: a loopback MCP server in a normal plugin path and a gateway HTTP server using requestIP, TLS options, idleTimeout, and stop(true).
Official API: https://bun.sh/docs/runtime/http/server.
Current Perry lowers neither Bun.serve nor an equivalent named export from "bun". Verified at 898e531590d874923314e48cf11950fc47c7f098.
Summary
Implement a Bun-compatible
servefacade over Perry's existing native HTTP/HTTPS stack. This is a synthetic parity target, independent of any application corpus.Minimal fixture
Initial acceptance surface
port: 0, hostname binding,hostnameandportproperties;errorhandler;requestIP(request);stop(closeActiveConnections?),ref, andunref;A Bun-native CLI has two reachable call sites: a loopback MCP server in a normal plugin path and a gateway HTTP server using
requestIP, TLS options,idleTimeout, andstop(true).Official API: https://bun.sh/docs/runtime/http/server.
Current Perry lowers neither
Bun.servenor an equivalent named export from"bun". Verified at898e531590d874923314e48cf11950fc47c7f098.