(t: Target)
| 238 | * up instead of trying to walk node_modules. |
| 239 | */ |
| 240 | const resolveKeyringNative = (t: Target): string | null => { |
| 241 | const platformMap: Record<string, { pkg: string; node: string }> = { |
| 242 | "darwin-arm64": { pkg: "@napi-rs/keyring-darwin-arm64", node: "keyring.darwin-arm64.node" }, |
| 243 | "darwin-x64": { pkg: "@napi-rs/keyring-darwin-x64", node: "keyring.darwin-x64.node" }, |
| 244 | "linux-arm64": { |
| 245 | pkg: "@napi-rs/keyring-linux-arm64-gnu", |
| 246 | node: "keyring.linux-arm64-gnu.node", |
| 247 | }, |
| 248 | "linux-x64": { pkg: "@napi-rs/keyring-linux-x64-gnu", node: "keyring.linux-x64-gnu.node" }, |
| 249 | "linux-arm64-musl": { |
| 250 | pkg: "@napi-rs/keyring-linux-arm64-musl", |
| 251 | node: "keyring.linux-arm64-musl.node", |
| 252 | }, |
| 253 | "linux-x64-musl": { |
| 254 | pkg: "@napi-rs/keyring-linux-x64-musl", |
| 255 | node: "keyring.linux-x64-musl.node", |
| 256 | }, |
| 257 | "win32-arm64": { |
| 258 | pkg: "@napi-rs/keyring-win32-arm64-msvc", |
| 259 | node: "keyring.win32-arm64-msvc.node", |
| 260 | }, |
| 261 | "win32-x64": { pkg: "@napi-rs/keyring-win32-x64-msvc", node: "keyring.win32-x64-msvc.node" }, |
| 262 | }; |
| 263 | const key = [t.os, t.arch, t.abi].filter(Boolean).join("-"); |
| 264 | const entry = platformMap[key]; |
| 265 | if (!entry) return null; |
| 266 | try { |
| 267 | const req = createRequire(join(repoRoot, "node_modules", "@napi-rs/keyring", "package.json")); |
| 268 | const pkgJson = req.resolve(`${entry.pkg}/package.json`); |
| 269 | return join(dirname(pkgJson), entry.node); |
| 270 | } catch { |
| 271 | const bunPath = join( |
| 272 | repoRoot, |
| 273 | `node_modules/.bun/${entry.pkg.replace("/", "+")}@1.2.0/node_modules/${entry.pkg}/${entry.node}`, |
| 274 | ); |
| 275 | if (existsSync(bunPath)) return bunPath; |
| 276 | return null; |
| 277 | } |
| 278 | }; |
| 279 | |
| 280 | /** |
| 281 | * Resolve the platform-specific `@libsql/<target>` native binding for a target. |
no test coverage detected