- Extract 4756 source files from cli.js.map (57MB) - Set up Bun build system with bun:bundle feature flag shim - Configure 90+ compile-time feature flags matching production defaults - Inject MACRO constants (VERSION, BUILD_TIME, etc.) - Create stubs for private packages (color-diff-napi, modifiers-napi, etc.) - Install all public dependencies via pnpm - Patch commander v14 to allow multi-char short flags (-d2e) - Build output: dist/cli.js (22MB), verified working
25 lines
820 B
JavaScript
25 lines
820 B
JavaScript
import { spawnSync } from 'node:child_process';
|
|
/**
|
|
* Find the path to an executable, similar to the `which` command.
|
|
* Uses Bun.which when running in Bun, falls back to spawnSync for Node.js.
|
|
*
|
|
* @param bin - The name of the executable to find
|
|
* @returns The full path to the executable, or null if not found
|
|
*/
|
|
export function whichSync(bin) {
|
|
// Check if we're running in Bun
|
|
if (typeof globalThis.Bun !== 'undefined') {
|
|
return globalThis.Bun.which(bin);
|
|
}
|
|
// Fallback to Node.js implementation
|
|
const result = spawnSync('which', [bin], {
|
|
encoding: 'utf8',
|
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
timeout: 1000,
|
|
});
|
|
if (result.status === 0 && result.stdout) {
|
|
return result.stdout.trim();
|
|
}
|
|
return null;
|
|
}
|
|
//# sourceMappingURL=which.js.map
|