MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / resolveLibsqlNative

Function resolveLibsqlNative

apps/cli/src/build.ts:289–317  ·  view source on GitHub ↗
(t: Target)

Source from the content-addressed store, hash-verified

287 */
288const LIBSQL_NATIVE_VERSION = "0.5.29";
289const resolveLibsqlNative = (t: Target): string | null => {
290 const platformMap: Record<string, string> = {
291 "darwin-arm64": "darwin-arm64",
292 "darwin-x64": "darwin-x64",
293 // The compiled binary runs on Bun, which libSQL's loader treats as glibc
294 // (its musl->gnu workaround), so non-musl linux targets need the -gnu binding.
295 "linux-arm64": "linux-arm64-gnu",
296 "linux-x64": "linux-x64-gnu",
297 "linux-arm64-musl": "linux-arm64-musl",
298 "linux-x64-musl": "linux-x64-musl",
299 "win32-arm64": "win32-arm64-msvc",
300 "win32-x64": "win32-x64-msvc",
301 };
302 const key = [t.os, t.arch, t.abi].filter(Boolean).join("-");
303 const target = platformMap[key];
304 if (!target) return null;
305 const pkg = `@libsql/${target}`;
306 try {
307 const req = createRequire(join(repoRoot, "apps/local", "package.json"));
308 const pkgJson = req.resolve(`${pkg}/package.json`);
309 return join(dirname(pkgJson), "index.node");
310 } catch {
311 const bunPath = join(
312 repoRoot,
313 `node_modules/.bun/${pkg.replace("/", "+")}@${LIBSQL_NATIVE_VERSION}/node_modules/${pkg}/index.node`,
314 );
315 return existsSync(bunPath) ? bunPath : null;
316 }
317};
318
319const resolveWorkerdBinary = (t: Target): string | null => {
320 const platformMap: Record<string, string> = {

Callers 1

buildBinariesFunction · 0.85

Calls 2

resolveMethod · 0.80
replaceMethod · 0.65

Tested by

no test coverage detected