( metaDir: string = import.meta.dir, execPath: string = process.execPath )
| 62 | * Falls back to null if not found (server will use Bun instead). |
| 63 | */ |
| 64 | export function resolveNodeServerScript( |
| 65 | metaDir: string = import.meta.dir, |
| 66 | execPath: string = process.execPath |
| 67 | ): string | null { |
| 68 | // Dev mode |
| 69 | if (!metaDir.includes('$bunfs')) { |
| 70 | const distScript = path.resolve(metaDir, '..', 'dist', 'server-node.mjs'); |
| 71 | if (fs.existsSync(distScript)) return distScript; |
| 72 | } |
| 73 | |
| 74 | // Compiled binary: browse/dist/browse → browse/dist/server-node.mjs |
| 75 | if (execPath) { |
| 76 | const adjacent = path.resolve(path.dirname(execPath), 'server-node.mjs'); |
| 77 | if (fs.existsSync(adjacent)) return adjacent; |
| 78 | } |
| 79 | |
| 80 | return null; |
| 81 | } |
| 82 | |
| 83 | const NODE_SERVER_SCRIPT = IS_WINDOWS ? resolveNodeServerScript() : null; |
| 84 |
no outgoing calls
no test coverage detected