mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
3de555f5e5
* fix(opencode): add host-compatible runtime bridge * fix(opencode): preserve parity in cli bridge * test(opencode): add isolated sandbox launcher * test(opencode): keep reusable sandbox launchers * test(opencode): export local plugin default * test(opencode): install OpenChamber deps when needed * test(opencode): avoid OpenChamber default port collision * fix(opencode): harden cli bridge fallback * test(opencode): clean isolated sandbox helpers
25 lines
875 B
TypeScript
25 lines
875 B
TypeScript
export function recoverNativeFetchConstructors(): void {
|
|
// OpenCode's @hono/node-server can patch global.Response/Request with
|
|
// polyfills that Bun.serve() rejects. Recover the native constructors from
|
|
// the polyfill prototype chain before loading Bun-only server modules.
|
|
if (typeof Response === "undefined" || typeof Request === "undefined") return;
|
|
|
|
const responseProto = Object.getPrototypeOf(Response.prototype);
|
|
if (
|
|
responseProto?.constructor &&
|
|
responseProto.constructor !== Response &&
|
|
responseProto.constructor !== Object
|
|
) {
|
|
globalThis.Response = responseProto.constructor;
|
|
}
|
|
|
|
const requestProto = Object.getPrototypeOf(Request.prototype);
|
|
if (
|
|
requestProto?.constructor &&
|
|
requestProto.constructor !== Request &&
|
|
requestProto.constructor !== Object
|
|
) {
|
|
globalThis.Request = requestProto.constructor;
|
|
}
|
|
}
|