(t: Target)
| 164 | * up instead of trying to walk node_modules. |
| 165 | */ |
| 166 | const resolveKeyringNative = (t: Target): string | null => { |
| 167 | const platformMap: Record<string, { pkg: string; node: string }> = { |
| 168 | "darwin-arm64": { pkg: "@napi-rs/keyring-darwin-arm64", node: "keyring.darwin-arm64.node" }, |
| 169 | "darwin-x64": { pkg: "@napi-rs/keyring-darwin-x64", node: "keyring.darwin-x64.node" }, |
| 170 | "linux-arm64": { |
| 171 | pkg: "@napi-rs/keyring-linux-arm64-gnu", |
| 172 | node: "keyring.linux-arm64-gnu.node", |
| 173 | }, |
| 174 | "linux-x64": { pkg: "@napi-rs/keyring-linux-x64-gnu", node: "keyring.linux-x64-gnu.node" }, |
| 175 | "linux-arm64-musl": { |
| 176 | pkg: "@napi-rs/keyring-linux-arm64-musl", |
| 177 | node: "keyring.linux-arm64-musl.node", |
| 178 | }, |
| 179 | "linux-x64-musl": { |
| 180 | pkg: "@napi-rs/keyring-linux-x64-musl", |
| 181 | node: "keyring.linux-x64-musl.node", |
| 182 | }, |
| 183 | "win32-arm64": { |
| 184 | pkg: "@napi-rs/keyring-win32-arm64-msvc", |
| 185 | node: "keyring.win32-arm64-msvc.node", |
| 186 | }, |
| 187 | "win32-x64": { pkg: "@napi-rs/keyring-win32-x64-msvc", node: "keyring.win32-x64-msvc.node" }, |
| 188 | }; |
| 189 | const key = [t.os, t.arch, t.abi].filter(Boolean).join("-"); |
| 190 | const entry = platformMap[key]; |
| 191 | if (!entry) return null; |
| 192 | try { |
| 193 | const req = createRequire(join(repoRoot, "node_modules", "@napi-rs/keyring", "package.json")); |
| 194 | const pkgJson = req.resolve(`${entry.pkg}/package.json`); |
| 195 | return join(dirname(pkgJson), entry.node); |
| 196 | } catch { |
| 197 | const bunPath = join( |
| 198 | repoRoot, |
| 199 | `node_modules/.bun/${entry.pkg.replace("/", "+")}@1.2.0/node_modules/${entry.pkg}/${entry.node}`, |
| 200 | ); |
| 201 | if (existsSync(bunPath)) return bunPath; |
| 202 | return null; |
| 203 | } |
| 204 | }; |
| 205 | |
| 206 | /** |
| 207 | * Resolve the platform-specific `@libsql/<target>` native binding for a target. |
no test coverage detected