perf(tui): shrink standalone builds and target native bindings (#6432)
* perf(tui): shrink standalone builds without dropping features * fix(tui): resolve macOS diagram fonts through CoreText * fix(webui): preserve history pagination at the page boundary * docs(tui): streamline release preflight guidance --------- Co-authored-by: Xubin Ren <52506698+Re-bin@users.noreply.github.com>
This commit is contained in:
1 parent
0e0df327c8
commit
ae7fed88e2
21 files changed
+424
-82
No files matched your search
@@ -0,0 +1,54 @@
|
||||
type NativePair = Readonly<{ opentui: string; resvg: string }>
|
||||
|
||||
type TargetSpec = Readonly<{
|
||||
bunTarget: Bun.Build.CompileTarget
|
||||
executableBudgetBytes: number
|
||||
}> & (
|
||||
| { platform: "linux"; bindings: { gnu: NativePair; musl: NativePair } }
|
||||
| { platform: "darwin" | "win32"; bindings: { native: NativePair } }
|
||||
)
|
||||
|
||||
const MiB = 1024 * 1024
|
||||
// Wheels cannot select CPU features: every x64 target uses Bun's baseline runtime.
|
||||
// Unmeasured arm64/macOS targets retain the existing 150 MiB archive limit.
|
||||
const targets = {
|
||||
"darwin-arm64": {
|
||||
platform: "darwin", bunTarget: "bun-darwin-arm64", executableBudgetBytes: 150 * MiB,
|
||||
bindings: { native: { opentui: "@opentui/core-darwin-arm64", resvg: "@resvg/resvg-js-darwin-arm64" } },
|
||||
},
|
||||
"darwin-x64": {
|
||||
platform: "darwin", bunTarget: "bun-darwin-x64-baseline", executableBudgetBytes: 150 * MiB,
|
||||
bindings: { native: { opentui: "@opentui/core-darwin-x64", resvg: "@resvg/resvg-js-darwin-x64" } },
|
||||
},
|
||||
"linux-arm64": {
|
||||
platform: "linux", bunTarget: "bun-linux-arm64", executableBudgetBytes: 150 * MiB,
|
||||
bindings: {
|
||||
gnu: { opentui: "@opentui/core-linux-arm64", resvg: "@resvg/resvg-js-linux-arm64-gnu" },
|
||||
musl: { opentui: "@opentui/core-linux-arm64-musl", resvg: "@resvg/resvg-js-linux-arm64-musl" },
|
||||
},
|
||||
},
|
||||
"linux-x64": {
|
||||
platform: "linux", bunTarget: "bun-linux-x64-baseline", executableBudgetBytes: 135 * MiB,
|
||||
bindings: {
|
||||
gnu: { opentui: "@opentui/core-linux-x64", resvg: "@resvg/resvg-js-linux-x64-gnu" },
|
||||
musl: { opentui: "@opentui/core-linux-x64-musl", resvg: "@resvg/resvg-js-linux-x64-musl" },
|
||||
},
|
||||
},
|
||||
"win32-x64": {
|
||||
platform: "win32", bunTarget: "bun-windows-x64-baseline", executableBudgetBytes: 135 * MiB,
|
||||
bindings: { native: { opentui: "@opentui/core-win32-x64", resvg: "@resvg/resvg-js-win32-x64-msvc" } },
|
||||
},
|
||||
} as const satisfies Record<string, TargetSpec>
|
||||
|
||||
export type TargetPlan = TargetSpec & { id: keyof typeof targets; executable: string }
|
||||
|
||||
export function targetPlan(raw: string): TargetPlan {
|
||||
if (!Object.hasOwn(targets, raw)) throw new Error(`unsupported target: ${raw}`)
|
||||
const id = raw as keyof typeof targets
|
||||
const spec = targets[id]
|
||||
return { ...spec, id, executable: `nanobot-tui-${id}${spec.platform === "win32" ? ".exe" : ""}` }
|
||||
}
|
||||
|
||||
export function nativePackages(plan: TargetPlan): string[] {
|
||||
return Object.values(plan.bindings).flatMap((pair: NativePair) => [pair.opentui, pair.resvg])
|
||||
}
|
||||
Reference in new issue
Block a user