@matterbridge/utils 3.9.3-dev-20260701-2965af1 → 3.9.3-dev-20260704-f23e430
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtimeBun.d.ts +1 -0
- package/dist/runtimeBun.js +17 -0
- package/package.json +1 -1
package/dist/runtimeBun.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function isBun(): boolean;
|
|
2
|
+
export declare function bunAvailable(): boolean;
|
|
2
3
|
export declare function getBunVersion(): string | undefined;
|
|
3
4
|
export declare function getBunRevision(): string | undefined;
|
|
4
5
|
export declare function getNodeCompatVersion(): string | undefined;
|
package/dist/runtimeBun.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
1
3
|
import os from 'node:os';
|
|
2
4
|
import path from 'node:path';
|
|
3
5
|
import { logModuleLoaded } from './loader.js';
|
|
@@ -6,6 +8,21 @@ const HAS_BUN_GLOBAL = typeof Bun !== 'undefined';
|
|
|
6
8
|
export function isBun() {
|
|
7
9
|
return HAS_BUN_GLOBAL || typeof process?.versions?.bun === 'string';
|
|
8
10
|
}
|
|
11
|
+
export function bunAvailable() {
|
|
12
|
+
if (isBun()) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
const home = process.env.HOME ?? '';
|
|
16
|
+
if (home && existsSync(`${home}/.bun/bin/bun`))
|
|
17
|
+
return true;
|
|
18
|
+
try {
|
|
19
|
+
execFileSync('bun', ['--version'], { stdio: 'ignore' });
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
9
26
|
export function getBunVersion() {
|
|
10
27
|
if (HAS_BUN_GLOBAL)
|
|
11
28
|
return Bun.version;
|
package/package.json
CHANGED