| 105 | let cached: KernelModule | null | undefined; |
| 106 | |
| 107 | function candidatePaths(): string[] { |
| 108 | const candidates: string[] = []; |
| 109 | if (process.env.CODEGRAPH_KERNEL_PATH) candidates.push(process.env.CODEGRAPH_KERNEL_PATH); |
| 110 | const packageRoot = path.resolve(__dirname, '..', '..', '..'); |
| 111 | candidates.push(path.join(packageRoot, 'kernel', 'codegraph-kernel.node')); |
| 112 | candidates.push( |
| 113 | path.join( |
| 114 | packageRoot, |
| 115 | 'codegraph-kernel', |
| 116 | 'prebuilds', |
| 117 | `${process.platform}-${process.arch}`, |
| 118 | 'codegraph-kernel.node' |
| 119 | ) |
| 120 | ); |
| 121 | return candidates; |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * Verify the binary speaks our wire contract: same ABI version and byte-equal |