Files
openchamber-android-native/third_party/mygo/packages/bridge/build.ts
T
OpenChamber 6c0ee61750 feat: port the client to MyGo native UI (0.3.0)
Switch from Asuka to MyGo, keeping the API client and the feature set:

- servers: saved servers, passwordless and password login, proxy,
  self-signed certificates, per-server device tokens (Keystore), connect
  form, instance list sheet with switch/disconnect
- sessions: virtualized list, search, new session, rename/archive/delete,
  running indicator, event stream keeps it live
- chat: pushed window with system back bar, streaming Markdown via
  ui/markdown, reasoning and tool rows with image previews, footer menu
  (read aloud via a Kotlin TTS plugin, copy, fork), user message menu
  (copy, revert, fork), context usage ring and detail sheet, attachments
  (photos/files via the document picker), permissions
- release builds allow plain http:// LAN servers (Go's net/http dials
  directly, no cleartext manifest needed)
- a local fork of MyGo (third_party/mygo) lowers the Android host's
  minSdk to 24 (Android 7.0); Go 1.27.4 via mise

Version 0.3.0.
2026-11-18 13:22:59 +08:00

28 lines
1.0 KiB
TypeScript

// Bundles the runtime MyGo injects into every page into
// internal/bridge/bridge.js, which the Go package embeds, and the script
// WebView2's web views in native UI run in an isolated world into
// internal/windows/keys.js. The output is committed, so Go users never
// need Bun.
import { join } from "node:path";
const outputs: [entry: string, out: string][] = [
["src/bridge.ts", "../../internal/bridge/bridge.js"],
["src/keys-world.ts", "../../internal/windows/keys.js"],
];
for (const [entry, file] of outputs) {
const out = join(import.meta.dir, file);
const result = await Bun.build({
entrypoints: [join(import.meta.dir, entry)],
format: "iife",
target: "browser",
minify: true,
});
if (!result.success) {
for (const log of result.logs) console.error(log);
process.exit(1);
}
const code = (await result.outputs[0]!.text()).trim();
await Bun.write(out, "// Code generated by `bun run build` from packages/bridge. DO NOT EDIT.\n" + code + "\n");
console.log(`wrote ${out} (${code.length} bytes)`);
}