Skip to content

Commit ba3f966

Browse files
authored
build: bump opentui to 0.4.5 (anomalyco#37616)
1 parent b95fe7b commit ba3f966

5 files changed

Lines changed: 37 additions & 43 deletions

File tree

bun.lock

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
"@octokit/rest": "22.0.0",
4141
"@hono/standard-validator": "0.2.0",
4242
"@hono/zod-validator": "0.4.2",
43-
"@opentui/core": "0.4.3",
44-
"@opentui/keymap": "0.4.3",
45-
"@opentui/solid": "0.4.3",
43+
"@opentui/core": "0.4.5",
44+
"@opentui/keymap": "0.4.5",
45+
"@opentui/solid": "0.4.5",
4646
"@tanstack/solid-virtual": "3.13.32",
4747
"@shikijs/stream": "4.2.0",
4848
"ulid": "3.0.1",

packages/cli/script/build.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env bun
22

33
import { $ } from "bun"
4-
import fs from "fs"
54
import { rm } from "fs/promises"
65
import path from "path"
76
import { Script } from "@opencode-ai/script"
@@ -51,10 +50,6 @@ const targets = singleFlag
5150

5251
if (!skipInstall) await $`bun install --os="*" --cpu="*" @opentui/core@${pkg.dependencies["@opentui/core"]}`
5352

54-
const localParserWorker = path.resolve(dir, "node_modules/@opentui/core/parser.worker.js")
55-
const rootParserWorker = path.resolve(dir, "../../node_modules/@opentui/core/parser.worker.js")
56-
const parserWorker = fs.realpathSync(fs.existsSync(localParserWorker) ? localParserWorker : rootParserWorker)
57-
5853
for (const item of targets) {
5954
const target = [
6055
binary,
@@ -68,7 +63,7 @@ for (const item of targets) {
6863
const name = target.replace(binary, "cli")
6964
console.log(`building ${name}`)
7065
const result = await Bun.build({
71-
entrypoints: ["./src/index.ts", parserWorker],
66+
entrypoints: ["./src/index.ts"],
7267
tsconfig: "./tsconfig.json",
7368
plugins: [plugin],
7469
external: ["node-gyp"],
@@ -94,10 +89,6 @@ for (const item of targets) {
9489
OPENCODE_LIBC: item.os === "linux" ? `'${item.abi ?? "glibc"}'` : "undefined",
9590
// FFF_LIBC selects the fff native lib variant: "musl" or "gnu".
9691
FFF_LIBC: item.os === "linux" ? `'${item.abi ?? "gnu"}'` : "undefined",
97-
OTUI_TREE_SITTER_WORKER_PATH:
98-
(item.os === "win32" ? '"B:/~BUN/root/' : '"/$bunfs/root/') +
99-
path.relative(dir, parserWorker).replaceAll("\\", "/") +
100-
'"',
10192
...(item.os === "linux" ? { "process.env.OPENTUI_LIBC": JSON.stringify(item.abi ?? "glibc") } : {}),
10293
},
10394
})

packages/opencode/script/build.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env bun
22

33
import { $ } from "bun"
4-
import fs from "fs"
54
import path from "path"
65
import { fileURLToPath } from "url"
76
import { createSolidTransformPlugin } from "@opentui/solid/bun-plugin"
@@ -49,6 +48,7 @@ const createEmbeddedWebUIBundle = async () => {
4948
}
5049

5150
const embeddedFileMap = skipEmbedWebUi ? null : await createEmbeddedWebUIBundle()
51+
const treeSitterWorker = await Bun.file(fileURLToPath(import.meta.resolve("@opentui/core/parser.worker"))).text()
5252

5353
const allTargets: {
5454
os: string
@@ -156,14 +156,9 @@ for (const item of targets) {
156156
console.log(`building ${name}`)
157157
await $`mkdir -p dist/${name}/bin`
158158

159-
const localPath = path.resolve(dir, "node_modules/@opentui/core/parser.worker.js")
160-
const rootPath = path.resolve(dir, "../../node_modules/@opentui/core/parser.worker.js")
161-
const parserWorker = fs.realpathSync(fs.existsSync(localPath) ? localPath : rootPath)
162159
const workerPath = "./src/cli/tui/worker.ts"
163-
164-
// Use platform-specific bunfs root path based on target OS
160+
const treeSitterWorkerPath = "opentui-tree-sitter-worker.js"
165161
const bunfsRoot = item.os === "win32" ? "B:/~BUN/root/" : "/$bunfs/root/"
166-
const workerRelativePath = path.relative(dir, parserWorker).replaceAll("\\", "/")
167162

168163
await Bun.build({
169164
conditions: ["bun", "node"],
@@ -184,13 +179,21 @@ for (const item of targets) {
184179
execArgv: [`--user-agent=opencode/${Script.version}`, "--use-system-ca", "--"],
185180
windows: {},
186181
},
187-
files: embeddedFileMap ? { "opencode-web-ui.gen.ts": embeddedFileMap } : {},
188-
entrypoints: ["./src/index.ts", parserWorker, workerPath, ...(embeddedFileMap ? ["opencode-web-ui.gen.ts"] : [])],
182+
files: {
183+
[treeSitterWorkerPath]: treeSitterWorker,
184+
...(embeddedFileMap ? { "opencode-web-ui.gen.ts": embeddedFileMap } : {}),
185+
},
186+
entrypoints: [
187+
"./src/index.ts",
188+
workerPath,
189+
treeSitterWorkerPath,
190+
...(embeddedFileMap ? ["opencode-web-ui.gen.ts"] : []),
191+
],
189192
define: {
190193
FFF_LIBC: JSON.stringify(item.abi === "musl" ? "musl" : "gnu"),
191194
OPENCODE_VERSION: `'${Script.version}'`,
192195
OPENCODE_MODELS_DEV: generated.modelsData,
193-
OTUI_TREE_SITTER_WORKER_PATH: bunfsRoot + workerRelativePath,
196+
OTUI_TREE_SITTER_WORKER_PATH: bunfsRoot + treeSitterWorkerPath,
194197
OPENCODE_WORKER_PATH: workerPath,
195198
OPENCODE_CHANNEL: `'${Script.channel}'`,
196199
OPENCODE_LIBC: item.os === "linux" ? `'${item.abi ?? "glibc"}'` : "",

packages/plugin/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
"zod": "catalog:"
2828
},
2929
"peerDependencies": {
30-
"@opentui/core": ">=0.4.3",
31-
"@opentui/keymap": ">=0.4.3",
32-
"@opentui/solid": ">=0.4.3"
30+
"@opentui/core": ">=0.4.5",
31+
"@opentui/keymap": ">=0.4.5",
32+
"@opentui/solid": ">=0.4.5"
3333
},
3434
"peerDependenciesMeta": {
3535
"@opentui/core": {

0 commit comments

Comments
 (0)