matterbridge 3.2.1-dev-20250802-f978b33 → 3.2.1-dev-20250803-c70121e

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.
@@ -106,7 +106,6 @@ export class Matterbridge extends EventEmitter {
106
106
  nodeContext;
107
107
  hasCleanupStarted = false;
108
108
  initialized = false;
109
- execRunningCount = 0;
110
109
  startMatterInterval;
111
110
  startMatterIntervalMs = 1000;
112
111
  checkUpdateInterval;
@@ -884,11 +883,10 @@ export class Matterbridge extends EventEmitter {
884
883
  if (this.nodeContext)
885
884
  this.globalModulesDirectory = this.matterbridgeInformation.globalModulesDirectory = await this.nodeContext.get('globalModulesDirectory', '');
886
885
  if (this.globalModulesDirectory === '') {
886
+ this.log.debug(`Getting global node_modules directory...`);
887
887
  try {
888
888
  const { getGlobalNodeModules } = await import('./utils/network.js');
889
- this.execRunningCount++;
890
889
  this.matterbridgeInformation.globalModulesDirectory = this.globalModulesDirectory = await getGlobalNodeModules();
891
- this.execRunningCount--;
892
890
  this.log.debug(`Global node_modules Directory: ${this.globalModulesDirectory}`);
893
891
  await this.nodeContext?.set('globalModulesDirectory', this.globalModulesDirectory);
894
892
  }
@@ -896,8 +894,18 @@ export class Matterbridge extends EventEmitter {
896
894
  this.log.error(`Error getting global node_modules directory: ${error}`);
897
895
  }
898
896
  }
899
- else
900
- this.log.debug(`Global node_modules Directory: ${this.globalModulesDirectory}`);
897
+ else {
898
+ this.log.debug(`Checking global node_modules directory: ${this.globalModulesDirectory}`);
899
+ try {
900
+ const { getGlobalNodeModules } = await import('./utils/network.js');
901
+ this.matterbridgeInformation.globalModulesDirectory = this.globalModulesDirectory = await getGlobalNodeModules();
902
+ this.log.debug(`Global node_modules Directory: ${this.globalModulesDirectory}`);
903
+ await this.nodeContext?.set('globalModulesDirectory', this.globalModulesDirectory);
904
+ }
905
+ catch (error) {
906
+ this.log.error(`Error checking global node_modules directory: ${error}`);
907
+ }
908
+ }
901
909
  const packageJson = JSON.parse(await fs.readFile(path.join(this.rootDirectory, 'package.json'), 'utf-8'));
902
910
  this.matterbridgeVersion = this.matterbridgeLatestVersion = this.matterbridgeDevVersion = packageJson.version;
903
911
  this.matterbridgeInformation.matterbridgeVersion = this.matterbridgeInformation.matterbridgeLatestVersion = this.matterbridgeInformation.matterbridgeDevVersion = packageJson.version;
@@ -100,7 +100,11 @@ export function xyColorToRgbColor(x, y, brightness = 254) {
100
100
  if (isNaN(blue) || blue < 0) {
101
101
  blue = 0;
102
102
  }
103
- return { r: Math.round(red), g: Math.round(green), b: Math.round(blue) };
103
+ return {
104
+ r: red === 0 ? 0 : red,
105
+ g: green === 0 ? 0 : green,
106
+ b: blue === 0 ? 0 : blue,
107
+ };
104
108
  }
105
109
  export function rgbColorToHslColor(rgb) {
106
110
  const r = rgb.r / 255;
@@ -1,10 +1,11 @@
1
1
  import { AnsiLogger } from 'node-ansi-logger';
2
- export const log = new AnsiLogger({ logName: 'MatterbridgeUtils', logTimestampFormat: 4, logLevel: "info" });
3
2
  export async function waiter(name, check, exitWithReject = false, resolveTimeout = 5000, resolveInterval = 500, debug = false) {
4
- if (check())
3
+ const log = new AnsiLogger({ logName: 'MatterbridgeWaiter', logTimestampFormat: 4, logLevel: "debug" });
4
+ if (check()) {
5
+ if (debug)
6
+ log.debug(`Waiter "${name}" already true`);
5
7
  return true;
6
- log.logLevel = "debug";
7
- log.logName = 'Waiter';
8
+ }
8
9
  if (debug)
9
10
  log.debug(`Waiter "${name}" started...`);
10
11
  return new Promise((resolve, reject) => {
@@ -17,7 +18,7 @@ export async function waiter(name, check, exitWithReject = false, resolveTimeout
17
18
  reject(new Error(`Waiter "${name}" finished due to timeout`));
18
19
  else
19
20
  resolve(false);
20
- }, resolveTimeout);
21
+ }, resolveTimeout).unref();
21
22
  const intervalId = setInterval(async () => {
22
23
  if (check()) {
23
24
  if (debug)
@@ -27,21 +28,20 @@ export async function waiter(name, check, exitWithReject = false, resolveTimeout
27
28
  resolve(true);
28
29
  }
29
30
  await Promise.resolve();
30
- }, resolveInterval);
31
+ }, resolveInterval).unref();
31
32
  });
32
33
  }
33
34
  export async function wait(timeout = 1000, name, debug = false) {
34
- log.logLevel = "debug";
35
- log.logName = 'Wait';
35
+ const log = new AnsiLogger({ logName: 'MatterbridgeWait', logTimestampFormat: 4, logLevel: "debug" });
36
36
  if (debug)
37
37
  log.debug(`Wait "${name}" started...`);
38
- return new Promise((resolve, reject) => {
38
+ return new Promise((resolve) => {
39
39
  const timeoutId = setTimeout(() => {
40
40
  if (debug)
41
41
  log.debug(`Wait "${name}" finished...`);
42
42
  clearTimeout(timeoutId);
43
43
  resolve();
44
- }, timeout);
44
+ }, timeout).unref();
45
45
  });
46
46
  }
47
47
  export function withTimeout(promise, timeoutMillisecs = 10000, reThrow = true) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.2.1-dev-20250802-f978b33",
3
+ "version": "3.2.1-dev-20250803-c70121e",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge",
9
- "version": "3.2.1-dev-20250802-f978b33",
9
+ "version": "3.2.1-dev-20250803-c70121e",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@matter/main": "0.15.3",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.2.1-dev-20250802-f978b33",
3
+ "version": "3.2.1-dev-20250803-c70121e",
4
4
  "description": "Matterbridge plugin manager for Matter",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",