@matterbridge/core 3.7.9-dev-20260514-473c140 → 3.7.9-dev-20260514-c74337a

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.
@@ -19,6 +19,7 @@ import { dev, MATTER_LOGGER_FILE, MATTER_STORAGE_DIR, MATTERBRIDGE_LOGGER_FILE,
19
19
  import { getIntParameter, getParameter, hasAnyParameter, hasParameter } from '@matterbridge/utils/cli';
20
20
  import { copyDirectory } from '@matterbridge/utils/copy-dir';
21
21
  import { createDirectory } from '@matterbridge/utils/create-dir';
22
+ import { inspectError } from '@matterbridge/utils/error';
22
23
  import { formatBytes, formatPercent, formatUptime } from '@matterbridge/utils/format';
23
24
  import { excludedInterfaceNamePattern } from '@matterbridge/utils/network';
24
25
  import { isValidNumber, isValidObject, isValidString, parseVersionString } from '@matterbridge/utils/validate';
@@ -620,18 +621,37 @@ export class Matterbridge extends EventEmitter {
620
621
  this.devices.logLevel = this.log.logLevel;
621
622
  for (const plugin of this.plugins) {
622
623
  this.log.debug(`Parsing plugin ${plg}${plugin.name}${db} from path ${CYAN}${plugin.path}${db} with version ${CYAN}${plugin.version}${db} and type ${CYAN}${plugin.type}${db}.`);
623
- if (!fs.existsSync(plugin.path) && !hasAnyParameter('add', 'remove', 'enable', 'disable', 'reset', 'factoryreset', 'systemcheck')) {
624
+ const globalModulesDirectory = await this.nodeContext.get('globalModulesDirectory', '');
625
+ const isLocal = globalModulesDirectory && !plugin.path.includes(globalModulesDirectory);
626
+ if ((isLocal &&
627
+ fs.existsSync(plugin.path) &&
628
+ !fs.existsSync(path.join(path.dirname(plugin.path), 'node_modules', 'matterbridge')) &&
629
+ !hasAnyParameter('add', 'remove', 'enable', 'disable', 'reset', 'factoryreset', 'systemcheck')) ||
630
+ process.env.MATTERBRIDGE_LINK_LOCAL_PLUGINS === 'jest') {
631
+ const { execSync } = await import('node:child_process');
632
+ try {
633
+ execSync('npm link matterbridge --no-fund --no-audit --silent', { cwd: path.dirname(plugin.path), stdio: 'inherit' });
634
+ this.log.info(`Matterbridge linked to plugin ${plg}${plugin.name}${nf}.`);
635
+ }
636
+ catch (error) {
637
+ plugin.error = true;
638
+ plugin.enabled = false;
639
+ inspectError(this.log, `Error linking matterbridge to plugin ${plg}${plugin.name}${er}. The plugin is disabled.`, error);
640
+ }
641
+ }
642
+ if ((!isLocal && !fs.existsSync(plugin.path) && !hasAnyParameter('add', 'remove', 'enable', 'disable', 'reset', 'factoryreset', 'systemcheck')) ||
643
+ process.env.MATTERBRIDGE_REINSTALL_PLUGINS === 'jest') {
624
644
  this.log.info(`Error parsing plugin ${plg}${plugin.name}${nf}. Trying to reinstall it from npm...`);
625
645
  const { execSync } = await import('node:child_process');
626
646
  const sudo = hasParameter('sudo') || (process.platform !== 'win32' && !hasParameter('docker') && !hasParameter('nosudo') && !process.env.PATH?.includes('/.nvm/versions/node/'));
627
- if (execSync(`${sudo ? 'sudo ' : ''}npm install -g ${plugin.name}${plugin.version.includes('-dev-') ? '@dev' : ''} --omit=dev`)) {
647
+ try {
648
+ execSync(`${sudo ? 'sudo ' : ''}npm install -g ${plugin.name}${plugin.version.includes('-dev-') ? '@dev' : ''} --no-fund --no-audit --silent --omit=dev`);
628
649
  this.log.info(`Plugin ${plg}${plugin.name}${nf} reinstalled.`);
629
- plugin.error = false;
630
650
  }
631
- else {
632
- this.log.error(`Error reinstalling plugin ${plg}${plugin.name}${nf}. The plugin is disabled.`);
651
+ catch (error) {
633
652
  plugin.error = true;
634
653
  plugin.enabled = false;
654
+ inspectError(this.log, `Error reinstalling plugin ${plg}${plugin.name}${er}. The plugin is disabled.`, error);
635
655
  continue;
636
656
  }
637
657
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matterbridge/core",
3
- "version": "3.7.9-dev-20260514-473c140",
3
+ "version": "3.7.9-dev-20260514-c74337a",
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.16.11",
133
- "@matterbridge/dgram": "3.7.9-dev-20260514-473c140",
134
- "@matterbridge/thread": "3.7.9-dev-20260514-473c140",
135
- "@matterbridge/types": "3.7.9-dev-20260514-473c140",
136
- "@matterbridge/utils": "3.7.9-dev-20260514-473c140",
133
+ "@matterbridge/dgram": "3.7.9-dev-20260514-c74337a",
134
+ "@matterbridge/thread": "3.7.9-dev-20260514-c74337a",
135
+ "@matterbridge/types": "3.7.9-dev-20260514-c74337a",
136
+ "@matterbridge/utils": "3.7.9-dev-20260514-c74337a",
137
137
  "escape-html": "1.0.3",
138
138
  "express": "5.2.1",
139
139
  "express-rate-limit": "8.5.1",