initial support for bun
Massimo Melina committed
Sep 19, 2024 at 16:25 UTC
ba5a98e4ffd68b84b7c3e2d0c25c585d410099f0
1 file changed
+5
-3
src/const.ts
+5
-3
@@ -23,8 +23,8 @@ export const RUNNING_BETA = VERSION.includes('-')
23
export const HFS_REPO_BRANCH = RUNNING_BETA ? VERSION.split('.')[1] : 'main'
24
export const IS_WINDOWS = process.platform === 'win32'
25
export const IS_MAC = process.platform === 'darwin'
26
-export const IS_BINARY = !basename(process.execPath).includes('node') // this won't be node if pkg was used
27
-export const APP_PATH = dirname(IS_BINARY ? process.execPath : __dirname)
26
+export const IS_BINARY = !/node|bun/.test(basename(process.execPath)) // this won't be node if pkg was used
27
+export const APP_PATH = dirname(IS_BINARY ? process.execPath : __dirname) // __dirname's parent can be compared with cwd
28
export const MIME_AUTO = 'auto'
29
30
// we want this to be the first stuff to be printed, then we print it in this module, that is executed at the beginning
@@ -51,5 +51,7 @@ console.log('working directory', process.cwd())
51
if (APP_PATH !== process.cwd())
52
console.log('app', APP_PATH)
53
console.log('node', process.version)
54
-console.log('platform', process.platform)
54
+const bun = (globalThis as any).Bun
55
+if (bun) console.log('bun', bun.version)
56
+console.log('platform', process.platform, IS_BINARY ? 'binary' : basename(process.execPath))
57
console.log('pid', process.pid)