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