@matterbridge/core 3.9.2-dev-20260625-1591faa → 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/backendExpress.js +3 -2
- package/dist/frontend.js +5 -4
- package/dist/matterbridge.js +34 -25
- package/dist/pluginManager.js +15 -6
- package/package.json +5 -5
package/dist/backendExpress.js
CHANGED
|
@@ -2,6 +2,7 @@ import os from 'node:os';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { BroadcastServer } from '@matterbridge/thread';
|
|
4
4
|
import { MATTER_LOGGER_FILE, MATTER_STORAGE_DIR, MATTERBRIDGE_BACKUP_FILE, MATTERBRIDGE_DIAGNOSTIC_FILE, MATTERBRIDGE_HISTORY_FILE, MATTERBRIDGE_LOGGER_FILE, MATTERBRIDGE_PLUGIN_CONFIG_FILE, MATTERBRIDGE_PLUGIN_STORAGE_FILE, NODE_STORAGE_DIR, plg, } from '@matterbridge/types';
|
|
5
|
+
import { isBun } from '@matterbridge/utils/bun';
|
|
5
6
|
import { hasParameter } from '@matterbridge/utils/cli';
|
|
6
7
|
import { getErrorMessage } from '@matterbridge/utils/error';
|
|
7
8
|
import { formatBytes } from '@matterbridge/utils/format';
|
|
@@ -411,8 +412,8 @@ export class BackendExpress {
|
|
|
411
412
|
name: 'SpawnCommand',
|
|
412
413
|
workerData: {
|
|
413
414
|
threadName: 'SpawnCommand',
|
|
414
|
-
command: 'npm',
|
|
415
|
-
args: ['install', '-g', filePath, '--omit=dev', '--verbose'],
|
|
415
|
+
command: isBun() ? 'bun' : 'npm',
|
|
416
|
+
args: isBun() ? ['install', '-g', filePath, '--production'] : ['install', '-g', filePath, '--omit=dev', '--verbose'],
|
|
416
417
|
packageCommand: 'install',
|
|
417
418
|
packageName: filename,
|
|
418
419
|
},
|
package/dist/frontend.js
CHANGED
|
@@ -9,6 +9,7 @@ import { CommissioningOptions } from '@matter/types/commissioning';
|
|
|
9
9
|
import { FabricIndex } from '@matter/types/datatype';
|
|
10
10
|
import { BroadcastServer } from '@matterbridge/thread/server';
|
|
11
11
|
import { MATTER_LOGGER_FILE, MATTER_STORAGE_DIR, MATTERBRIDGE_DIAGNOSTIC_FILE, MATTERBRIDGE_HISTORY_FILE, MATTERBRIDGE_LOGGER_FILE, NODE_STORAGE_DIR, plg, } from '@matterbridge/types';
|
|
12
|
+
import { isBun } from '@matterbridge/utils/bun';
|
|
12
13
|
import { getParameter, hasParameter } from '@matterbridge/utils/cli';
|
|
13
14
|
import { getErrorMessage, inspectError, logError } from '@matterbridge/utils/error';
|
|
14
15
|
import { formatBytes, formatPercent, formatUptime } from '@matterbridge/utils/format';
|
|
@@ -798,8 +799,8 @@ export class Frontend extends EventEmitter {
|
|
|
798
799
|
name: 'SpawnCommand',
|
|
799
800
|
workerData: {
|
|
800
801
|
threadName: 'SpawnCommand',
|
|
801
|
-
command: 'npm',
|
|
802
|
-
args: ['install', '-g', filePath, '--omit=dev', '--verbose'],
|
|
802
|
+
command: isBun() ? 'bun' : 'npm',
|
|
803
|
+
args: isBun() ? ['install', '-g', filePath, '--production'] : ['install', '-g', filePath, '--omit=dev', '--verbose'],
|
|
803
804
|
packageCommand: 'install',
|
|
804
805
|
packageName: filename,
|
|
805
806
|
},
|
|
@@ -2236,8 +2237,8 @@ export class Frontend extends EventEmitter {
|
|
|
2236
2237
|
name: 'SpawnCommand',
|
|
2237
2238
|
workerData: {
|
|
2238
2239
|
threadName: 'SpawnCommand',
|
|
2239
|
-
command: 'npm',
|
|
2240
|
-
args: [command, '-g', packageName, '--omit=dev', '--verbose'],
|
|
2240
|
+
command: isBun() ? 'bun' : 'npm',
|
|
2241
|
+
args: isBun() ? [command, '-g', packageName, '--production'] : [command, '-g', packageName, '--omit=dev', '--verbose'],
|
|
2241
2242
|
packageCommand: command,
|
|
2242
2243
|
packageName: packageName,
|
|
2243
2244
|
},
|
package/dist/matterbridge.js
CHANGED
|
@@ -14,6 +14,7 @@ import { DeviceTypeId, VendorId } from '@matter/types/datatype';
|
|
|
14
14
|
import { ManualPairingCodeCodec } from '@matter/types/schema';
|
|
15
15
|
import { BroadcastServer } from '@matterbridge/thread/server';
|
|
16
16
|
import { dev, MATTER_LOGGER_FILE, MATTER_STORAGE_DIR, MATTERBRIDGE_LOGGER_FILE, NODE_STORAGE_DIR, plg, typ } from '@matterbridge/types';
|
|
17
|
+
import { isBun, getGlobalBunModules } from '@matterbridge/utils/bun';
|
|
17
18
|
import { getIntParameter, getParameter, hasAnyParameter, hasParameter } from '@matterbridge/utils/cli';
|
|
18
19
|
import { copyDirectory } from '@matterbridge/utils/copy-dir';
|
|
19
20
|
import { createDirectory } from '@matterbridge/utils/create-dir';
|
|
@@ -675,12 +676,37 @@ export class Matterbridge extends EventEmitter {
|
|
|
675
676
|
this.virtualMode = (await this.nodeContext.get('virtualmode', 'outlet'));
|
|
676
677
|
}
|
|
677
678
|
this.log.debug(`Virtual mode ${this.virtualMode}.`);
|
|
679
|
+
if (isBun()) {
|
|
680
|
+
this.globalModulesDirectory = getGlobalBunModules();
|
|
681
|
+
this.log.debug(`Global node_modules Directory (Bun): ${this.globalModulesDirectory}`);
|
|
682
|
+
await this.nodeContext.set('globalModulesDirectory', this.globalModulesDirectory);
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
this.globalModulesDirectory = await this.nodeContext.get('globalModulesDirectory', '');
|
|
686
|
+
}
|
|
687
|
+
if (this.globalModulesDirectory === '') {
|
|
688
|
+
this.log.debug(`Getting global node_modules directory...`);
|
|
689
|
+
try {
|
|
690
|
+
const { getGlobalNodeModules } = await import('@matterbridge/utils/npm-prefix');
|
|
691
|
+
this.globalModulesDirectory = await getGlobalNodeModules();
|
|
692
|
+
this.log.debug(`Global node_modules Directory: ${this.globalModulesDirectory}`);
|
|
693
|
+
await this.nodeContext.set('globalModulesDirectory', this.globalModulesDirectory);
|
|
694
|
+
}
|
|
695
|
+
catch (error) {
|
|
696
|
+
logError(this.log, `Error getting global node_modules directory`, error);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
if (!isBun()) {
|
|
701
|
+
this.log.debug(`Global node_modules Directory: ${this.globalModulesDirectory}`);
|
|
702
|
+
this.server.request({ type: 'manager_run', src: 'matterbridge', dst: 'manager', params: { name: 'GlobalPrefix' } });
|
|
703
|
+
}
|
|
704
|
+
}
|
|
678
705
|
this.plugins.logLevel = this.log.logLevel;
|
|
679
706
|
await this.plugins.loadFromStorage();
|
|
680
707
|
this.devices.logLevel = this.log.logLevel;
|
|
681
708
|
for (const plugin of this.plugins) {
|
|
682
|
-
const
|
|
683
|
-
const isLocal = globalModulesDirectory.length > 0 && !plugin.path.startsWith(globalModulesDirectory);
|
|
709
|
+
const isLocal = fs.existsSync(plugin.path) && this.globalModulesDirectory.length > 0 && !plugin.path.startsWith(this.globalModulesDirectory);
|
|
684
710
|
this.log.debug(`Parsing plugin ${plg}${plugin.name}${db} from path ${CYAN}${plugin.path}${db} ` +
|
|
685
711
|
`with version ${CYAN}${plugin.version}${db} type ${CYAN}${plugin.type}${db} local ${CYAN}${isLocal}${db} ` +
|
|
686
712
|
`private ${CYAN}${plugin.private}${db} tarball ${CYAN}${plugin.tarballPath}${db}.`);
|
|
@@ -691,7 +717,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
691
717
|
process.env.MATTERBRIDGE_LINK_LOCAL_PLUGINS === 'jest') {
|
|
692
718
|
const { execSync } = await import('node:child_process');
|
|
693
719
|
try {
|
|
694
|
-
execSync('npm link matterbridge --no-fund --no-audit --silent', { cwd: path.dirname(plugin.path) });
|
|
720
|
+
execSync(isBun() ? 'bun link matterbridge --silent' : 'npm link matterbridge --no-fund --no-audit --silent', { cwd: path.dirname(plugin.path) });
|
|
695
721
|
this.log.info(`Matterbridge linked to plugin ${plg}${plugin.name}${nf}.`);
|
|
696
722
|
}
|
|
697
723
|
catch (error) {
|
|
@@ -708,11 +734,11 @@ export class Matterbridge extends EventEmitter {
|
|
|
708
734
|
try {
|
|
709
735
|
if (plugin.private && plugin.tarballPath && fs.existsSync(path.join(this.matterbridgeDirectory, 'uploads', plugin.tarballPath))) {
|
|
710
736
|
this.log.info(`Plugin ${plg}${plugin.name}${nf} not found. Trying to reinstall it from last tarball...`);
|
|
711
|
-
execSync(`${sudo ? 'sudo ' : ''}npm install -g ${path.join(this.matterbridgeDirectory, 'uploads', plugin.tarballPath)} --no-fund --no-audit --silent --omit=dev`);
|
|
737
|
+
execSync(`${sudo ? 'sudo ' : ''}${isBun() ? 'bun' : 'npm'} install -g ${path.join(this.matterbridgeDirectory, 'uploads', plugin.tarballPath)} ${isBun() ? '--production --silent' : '--no-fund --no-audit --silent --omit=dev'}`);
|
|
712
738
|
}
|
|
713
739
|
else {
|
|
714
740
|
this.log.info(`Plugin ${plg}${plugin.name}${nf} not found. Trying to reinstall it from npm${plugin.version.includes('-dev-') ? ' with tag @dev' : ''}...`);
|
|
715
|
-
execSync(`${sudo ? 'sudo ' : ''}npm install -g ${plugin.name}${plugin.version.includes('-dev-') ? '@dev' : ''} --no-fund --no-audit --silent --omit=dev`);
|
|
741
|
+
execSync(`${sudo ? 'sudo ' : ''}${isBun() ? 'bun' : 'npm'} install -g ${plugin.name}${plugin.version.includes('-dev-') ? '@dev' : ''} ${isBun() ? '--production --silent' : '--no-fund --no-audit --silent --omit=dev'}`);
|
|
716
742
|
}
|
|
717
743
|
this.log.info(`Plugin ${plg}${plugin.name}${nf} reinstalled.`);
|
|
718
744
|
}
|
|
@@ -1078,24 +1104,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1078
1104
|
this.log.debug(`Matterbridge Directory: ${this.matterbridgeDirectory}`);
|
|
1079
1105
|
this.log.debug(`Matterbridge Plugin Directory: ${this.matterbridgePluginDirectory}`);
|
|
1080
1106
|
this.log.debug(`Matterbridge Matter Certificate Directory: ${this.matterbridgeCertDirectory}`);
|
|
1081
|
-
|
|
1082
|
-
this.globalModulesDirectory = await this.nodeContext.get('globalModulesDirectory', '');
|
|
1083
|
-
if (this.globalModulesDirectory === '') {
|
|
1084
|
-
this.log.debug(`Getting global node_modules directory...`);
|
|
1085
|
-
try {
|
|
1086
|
-
const { getGlobalNodeModules } = await import('@matterbridge/utils/npm-prefix');
|
|
1087
|
-
this.globalModulesDirectory = await getGlobalNodeModules();
|
|
1088
|
-
this.log.debug(`Global node_modules Directory: ${this.globalModulesDirectory}`);
|
|
1089
|
-
await this.nodeContext?.set('globalModulesDirectory', this.globalModulesDirectory);
|
|
1090
|
-
}
|
|
1091
|
-
catch (error) {
|
|
1092
|
-
logError(this.log, `Error getting global node_modules directory`, error);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
else {
|
|
1096
|
-
this.log.debug(`Global node_modules Directory: ${this.globalModulesDirectory}`);
|
|
1097
|
-
this.server.request({ type: 'manager_run', src: 'matterbridge', dst: 'manager', params: { name: 'GlobalPrefix' } });
|
|
1098
|
-
}
|
|
1107
|
+
this.log.debug(`Global node_modules Directory: ${this.globalModulesDirectory}`);
|
|
1099
1108
|
this.log.debug(`Reading matterbridge package.json...`);
|
|
1100
1109
|
const packageJson = JSON.parse(await fs.promises.readFile(path.join(this.rootDirectory, 'package.json'), 'utf-8'));
|
|
1101
1110
|
this.matterbridgeVersion = this.matterbridgeLatestVersion = this.matterbridgeDevVersion = packageJson.version;
|
|
@@ -1180,8 +1189,8 @@ export class Matterbridge extends EventEmitter {
|
|
|
1180
1189
|
name: 'SpawnCommand',
|
|
1181
1190
|
workerData: {
|
|
1182
1191
|
threadName: 'SpawnCommand',
|
|
1183
|
-
command: 'npm',
|
|
1184
|
-
args: ['install', '-g', 'matterbridge', '--omit=dev', '--verbose'],
|
|
1192
|
+
command: isBun() ? 'bun' : 'npm',
|
|
1193
|
+
args: isBun() ? ['install', '-g', 'matterbridge', '--production'] : ['install', '-g', 'matterbridge', '--omit=dev', '--verbose'],
|
|
1185
1194
|
packageCommand: 'install',
|
|
1186
1195
|
packageName: 'matterbridge',
|
|
1187
1196
|
},
|
package/dist/pluginManager.js
CHANGED
|
@@ -2,6 +2,7 @@ import EventEmitter from 'node:events';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { BroadcastServer } from '@matterbridge/thread/server';
|
|
4
4
|
import { plg, typ } from '@matterbridge/types';
|
|
5
|
+
import { isBun } from '@matterbridge/utils/bun';
|
|
5
6
|
import { hasParameter } from '@matterbridge/utils/cli';
|
|
6
7
|
import { getErrorMessage, inspectError, logError } from '@matterbridge/utils/error';
|
|
7
8
|
import { logModuleLoaded } from '@matterbridge/utils/loader';
|
|
@@ -522,8 +523,8 @@ export class PluginManager extends EventEmitter {
|
|
|
522
523
|
name: 'SpawnCommand',
|
|
523
524
|
workerData: {
|
|
524
525
|
threadName: 'SpawnCommand',
|
|
525
|
-
command: 'npm',
|
|
526
|
-
args: ['install', '-g', packageName, '--omit=dev', '--verbose'],
|
|
526
|
+
command: isBun() ? 'bun' : 'npm',
|
|
527
|
+
args: isBun() ? ['install', '-g', packageName, '--production'] : ['install', '-g', packageName, '--omit=dev', '--verbose'],
|
|
527
528
|
packageCommand: 'install',
|
|
528
529
|
packageName: packageName,
|
|
529
530
|
},
|
|
@@ -540,8 +541,8 @@ export class PluginManager extends EventEmitter {
|
|
|
540
541
|
name: 'SpawnCommand',
|
|
541
542
|
workerData: {
|
|
542
543
|
threadName: 'SpawnCommand',
|
|
543
|
-
command: 'npm',
|
|
544
|
-
args: ['uninstall', '-g', packageName, '
|
|
544
|
+
command: isBun() ? 'bun' : 'npm',
|
|
545
|
+
args: isBun() ? ['uninstall', '-g', packageName] : ['uninstall', '-g', packageName, '--verbose'],
|
|
545
546
|
packageCommand: 'uninstall',
|
|
546
547
|
packageName: packageName,
|
|
547
548
|
},
|
|
@@ -635,7 +636,16 @@ export class PluginManager extends EventEmitter {
|
|
|
635
636
|
plugin = p;
|
|
636
637
|
}
|
|
637
638
|
try {
|
|
638
|
-
|
|
639
|
+
const { existsSync } = await import('node:fs');
|
|
640
|
+
this.log.debug(`Parsing package.json of plugin ${plg}${plugin.name}${db} at path ${CYAN}${plugin.path}${db}`);
|
|
641
|
+
if (!existsSync(plugin.path) && existsSync(path.join(this.matterbridge.globalModulesDirectory, plugin.name, 'package.json'))) {
|
|
642
|
+
plugin.path = path.join(this.matterbridge.globalModulesDirectory, plugin.name, 'package.json');
|
|
643
|
+
this.log.debug(`Found package.json of plugin ${plg}${plugin.name}${db} in global npm modules directory: ${CYAN}${plugin.path}${db}`);
|
|
644
|
+
}
|
|
645
|
+
if (!existsSync(plugin.path) && existsSync(path.join(this.matterbridge.matterbridgePluginDirectory, plugin.name, 'package.json'))) {
|
|
646
|
+
plugin.path = path.join(this.matterbridge.matterbridgePluginDirectory, plugin.name, 'package.json');
|
|
647
|
+
this.log.debug(`Found package.json of plugin ${plg}${plugin.name}${db} in matterbridge plugin directory: ${CYAN}${plugin.path}${db}`);
|
|
648
|
+
}
|
|
639
649
|
const packageJson = JSON.parse(await promises.readFile(plugin.path, 'utf8'));
|
|
640
650
|
if (!packageJson.name)
|
|
641
651
|
this.log.warn(`Plugin ${plg}${plugin.name}${wr} has no name in package.json`);
|
|
@@ -662,7 +672,6 @@ export class PluginManager extends EventEmitter {
|
|
|
662
672
|
if (!plugin.type)
|
|
663
673
|
this.log.warn(`Plugin ${plg}${plugin.name}${wr} has no type`);
|
|
664
674
|
const frontendPath = path.join(plugin.path.replace('package.json', ''), 'apps', 'frontend', 'build', 'index.html');
|
|
665
|
-
const { existsSync } = await import('node:fs');
|
|
666
675
|
if (existsSync(frontendPath))
|
|
667
676
|
plugin.frontendPath = frontendPath;
|
|
668
677
|
const invalidDependencies = this.findInvalidDependencies(packageJson);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/core",
|
|
3
|
-
"version": "3.9.2-dev-20260625-
|
|
3
|
+
"version": "3.9.2-dev-20260625-a8359b3",
|
|
4
4
|
"description": "Matterbridge core library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -130,10 +130,10 @@
|
|
|
130
130
|
],
|
|
131
131
|
"dependencies": {
|
|
132
132
|
"@matter/main": "0.17.4-alpha.0-20260624-ef5aefa3b",
|
|
133
|
-
"@matterbridge/dgram": "3.9.2-dev-20260625-
|
|
134
|
-
"@matterbridge/thread": "3.9.2-dev-20260625-
|
|
135
|
-
"@matterbridge/types": "3.9.2-dev-20260625-
|
|
136
|
-
"@matterbridge/utils": "3.9.2-dev-20260625-
|
|
133
|
+
"@matterbridge/dgram": "3.9.2-dev-20260625-a8359b3",
|
|
134
|
+
"@matterbridge/thread": "3.9.2-dev-20260625-a8359b3",
|
|
135
|
+
"@matterbridge/types": "3.9.2-dev-20260625-a8359b3",
|
|
136
|
+
"@matterbridge/utils": "3.9.2-dev-20260625-a8359b3",
|
|
137
137
|
"escape-html": "1.0.3",
|
|
138
138
|
"express": "5.2.1",
|
|
139
139
|
"express-rate-limit": "8.5.2",
|