Compare commits

...

4 Commits

Author SHA1 Message Date
Dax Raad b5539f13c6 fix(opencode): select target fff binary 2026-06-09 15:43:21 -04:00
Dax Raad 97f94854a0 fix(opencode): restore valid fff patch 2026-06-09 15:27:58 -04:00
Dax Raad 0195d3d4b6 chore(opencode): clean fff dependency patch 2026-06-09 15:25:54 -04:00
Dax Raad e29203f603 fix(opencode): bundle fff native library 2026-06-09 15:25:16 -04:00
5 changed files with 38 additions and 1 deletions
+2
View File
@@ -525,6 +525,7 @@
"@clack/prompts": "1.0.0-alpha.1",
"@effect/opentelemetry": "catalog:",
"@effect/platform-node": "catalog:",
"@ff-labs/fff-bun": "0.9.3",
"@gitlab/opencode-gitlab-auth": "1.3.3",
"@modelcontextprotocol/sdk": "1.29.0",
"@octokit/graphql": "9.0.2",
@@ -914,6 +915,7 @@
"patchedDependencies": {
"solid-js@1.9.10": "patches/solid-js@1.9.10.patch",
"virtua@0.49.1": "patches/virtua@0.49.1.patch",
"@ff-labs/fff-bun@0.9.3": "patches/@ff-labs%2Ffff-bun@0.9.3.patch",
"gcp-metadata@8.1.2": "patches/gcp-metadata@8.1.2.patch",
"@ai-sdk/google@3.0.73": "patches/@ai-sdk%2Fgoogle@3.0.73.patch",
"@ai-sdk/xai@3.0.82": "patches/@ai-sdk%2Fxai@3.0.82.patch",
+1
View File
@@ -140,6 +140,7 @@
"@types/node": "catalog:"
},
"patchedDependencies": {
"@ff-labs/fff-bun@0.9.3": "patches/@ff-labs%2Ffff-bun@0.9.3.patch",
"@npmcli/agent@4.0.2": "patches/@npmcli%2Fagent@4.0.2.patch",
"@silvia-odwyer/photon-node@0.3.4": "patches/@silvia-odwyer%2Fphoton-node@0.3.4.patch",
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
+1
View File
@@ -78,6 +78,7 @@
"@clack/prompts": "1.0.0-alpha.1",
"@effect/opentelemetry": "catalog:",
"@effect/platform-node": "catalog:",
"@ff-labs/fff-bun": "0.9.3",
"@gitlab/opencode-gitlab-auth": "1.3.3",
"@modelcontextprotocol/sdk": "1.29.0",
"@octokit/graphql": "9.0.2",
+3 -1
View File
@@ -140,6 +140,7 @@ const binaries: Record<string, string> = {}
if (!skipInstall) {
await $`bun install --os="*" --cpu="*" @opentui/core@${pkg.dependencies["@opentui/core"]}`
await $`bun install --os="*" --cpu="*" @parcel/watcher@${pkg.dependencies["@parcel/watcher"]}`
await $`bun install --os="*" --cpu="*" @ff-labs/fff-bun@${pkg.dependencies["@ff-labs/fff-bun"]}`
}
for (const item of targets) {
const name = [
@@ -165,7 +166,7 @@ for (const item of targets) {
const workerRelativePath = path.relative(dir, parserWorker).replaceAll("\\", "/")
await Bun.build({
conditions: ["node"],
conditions: ["bun", "node"],
tsconfig: "./tsconfig.json",
plugins: [plugin],
external: ["node-gyp"],
@@ -186,6 +187,7 @@ for (const item of targets) {
files: embeddedFileMap ? { "opencode-web-ui.gen.ts": embeddedFileMap } : {},
entrypoints: ["./src/index.ts", parserWorker, workerPath, ...(embeddedFileMap ? ["opencode-web-ui.gen.ts"] : [])],
define: {
FFF_LIBC: JSON.stringify(item.abi === "musl" ? "musl" : "gnu"),
OPENCODE_VERSION: `'${Script.version}'`,
OPENCODE_MODELS_DEV: generated.modelsData,
OTUI_TREE_SITTER_WORKER_PATH: bunfsRoot + workerRelativePath,
+31
View File
@@ -0,0 +1,31 @@
diff --git a/src/download.ts b/src/download.ts
index 3454256..6dca25a 100644
--- a/src/download.ts
+++ b/src/download.ts
@@ -7,7 +7,7 @@
*/
+declare const FFF_LIBC: "gnu" | "musl";
import { existsSync } from "node:fs";
-import { createRequire } from "node:module";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { getLibFilename, getNpmPackageName } from "./platform";
@@ -54,14 +54,10 @@ export function binaryExists(): boolean {
* in the same directory.
*/
function resolveFromNpmPackage(): string | null {
- const packageName = getNpmPackageName();
-
try {
- // Use createRequire to resolve the platform package's location
- const require = createRequire(join(getPackageDir(), "package.json"));
- const packageJsonPath = require.resolve(`${packageName}/package.json`);
- const packageDir = dirname(packageJsonPath);
- const binaryPath = join(packageDir, getLibFilename());
+ const binaryPath = require(
+ `@ff-labs/fff-bin-${process.platform === "linux" ? `linux-${process.arch}-${typeof FFF_LIBC === "string" ? FFF_LIBC : getNpmPackageName().endsWith("musl") ? "musl" : "gnu"}` : `${process.platform}-${process.arch}`}/${process.platform === "win32" ? "fff_c.dll" : process.platform === "darwin" ? "libfff_c.dylib" : "libfff_c.so"}`,
+ );
if (existsSync(binaryPath)) {
return binaryPath;