@matterbridge/utils 3.9.2-dev-20260624-82fe77f → 3.9.2-dev-20260625-a8359b3
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/bunPrefix.d.ts +2 -0
- package/dist/bunPrefix.js +14 -0
- package/dist/export.d.ts +1 -0
- package/dist/export.js +1 -0
- package/dist/npmPrefix.js +3 -0
- package/package.json +5 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { logModuleLoaded } from './loader.js';
|
|
4
|
+
logModuleLoaded('BunPrefix');
|
|
5
|
+
export function isBun() {
|
|
6
|
+
return typeof process !== 'undefined' && process.versions?.bun !== undefined;
|
|
7
|
+
}
|
|
8
|
+
export function getGlobalBunModules() {
|
|
9
|
+
if (!isBun()) {
|
|
10
|
+
throw new Error('getGlobalBunModules can only be called in a Bun environment.');
|
|
11
|
+
}
|
|
12
|
+
const bunInstall = process.env.BUN_INSTALL ?? path.join(os.homedir(), '.bun');
|
|
13
|
+
return path.join(bunInstall, 'install', 'global', 'node_modules');
|
|
14
|
+
}
|
package/dist/export.d.ts
CHANGED
package/dist/export.js
CHANGED
package/dist/npmPrefix.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { getGlobalBunModules, isBun } from './bunPrefix.js';
|
|
1
2
|
import { logModuleLoaded } from './loader.js';
|
|
2
3
|
logModuleLoaded('NpmPrefix');
|
|
3
4
|
export async function getGlobalNodeModules() {
|
|
5
|
+
if (isBun())
|
|
6
|
+
return getGlobalBunModules();
|
|
4
7
|
const { exec } = await import('node:child_process');
|
|
5
8
|
return new Promise((resolve, reject) => {
|
|
6
9
|
exec('npm root -g', (error, stdout) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/utils",
|
|
3
|
-
"version": "3.9.2-dev-
|
|
3
|
+
"version": "3.9.2-dev-20260625-a8359b3",
|
|
4
4
|
"description": "Matterbridge utils library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
"types": "./dist/export.d.ts",
|
|
51
51
|
"import": "./dist/export.js"
|
|
52
52
|
},
|
|
53
|
+
"./bun": {
|
|
54
|
+
"types": "./dist/bunPrefix.d.ts",
|
|
55
|
+
"import": "./dist/bunPrefix.js"
|
|
56
|
+
},
|
|
53
57
|
"./cli": {
|
|
54
58
|
"types": "./dist/commandLine.d.ts",
|
|
55
59
|
"import": "./dist/commandLine.js"
|