| 63 | // Resolve the launcher from the installed per-platform optionalDependency. |
| 64 | // Returns {command, args} or null if the package isn't installed. |
| 65 | function resolveInstalledBundle() { |
| 66 | try { |
| 67 | if (isWindows) { |
| 68 | // Modern Node refuses to spawn the bundle's .cmd directly (EINVAL, the |
| 69 | // CVE-2024-27980 hardening on Node 24), so invoke the bundled node.exe |
| 70 | // against the app entry point and pass --liftoff-only here. |
| 71 | var nodeExe = require.resolve(pkg + '/node.exe'); |
| 72 | var entry = require.resolve(pkg + '/lib/dist/bin/codegraph.js'); |
| 73 | return { command: nodeExe, args: liftoff(entry) }; |
| 74 | } |
| 75 | return { command: require.resolve(pkg + '/bin/codegraph'), args: process.argv.slice(2) }; |
| 76 | } catch (e) { |
| 77 | return null; |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | // Locate the launcher inside an extracted GitHub bundle directory (same |
| 82 | // node/lib/bin layout as the npm platform package). Returns {command, args} or |