Skip to content

runtime(bun-compat): provide plugin / Bun.plugin as an inert registrar so OpenTUI's runtime-plugin support installs #10100

Description

@proggeramlug

Parent: #10107. Depends on / pairs with: 01 (compile-time Solid JSX).

Problem

At TUI startup OpenCode runs ensureRuntimePluginSupport() (packages/opencode/src/plugin/tui/runtime.ts:44). That code does import { plugin as registerBunPlugin } from "bun" (node_modules/@opentui/solid/scripts/runtime-plugin-support-configure.js:1 and scripts/solid-plugin.js:1) and calls registerBunPlugin(createSolidTransformPlugin()) and registerBunPlugin(createRuntimePlugin(...)) (the @opentui/core/runtime-plugin specifier rewriter for user TUI plugins). Bun's plugin(p) invokes p.setup(build) synchronously; the plugin registers build.onLoad(...) loaders and records state.installed = true on globalThis[Symbol.for("opentui.solid.transform")].
Perry's bun module exposes stringWidth, file, write, stdin, hash, semver, JSONL, deepEquals, stripANSI, wrapAnsi, which, zstdDecompress*, gc, generateHeapSnapshot, Glob, pathToFileURL, fileURLToPath, TOML, YAML, spawn, … (crates/perry-hir/src/lower/expr_member.rs:340-360, crates/perry-runtime/src/bun_compat/) but no plugin; the member falls to js_bun_unsupported and the TUI dies before its first frame.

Scope

Acceptance

  • import { plugin } from "bun"; plugin({ name: "x", setup(b) { b.onLoad({ filter: /a/ }, () => ({})); } }) compiles and returns without throwing; Bun.plugin(fn) likewise.
  • ensureRuntimePluginSupport() from @opentui/solid/runtime-plugin-support/configure returns true under perry and a second call returns false (installed-state bookkeeping works).
  • The OpenCode TUI proceeds past src/plugin/tui/runtime.ts module init in the native binary.
  • API manifest / docs drift gate updated (--print-api-manifest).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew capability or improvementparityCompatibility gap with Node.js, ECMAScript, or the supported ecosystem

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions