matterbridge 3.2.1-dev-20250802-516a522 → 3.2.1-dev-20250802-741949b

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.
@@ -896,8 +896,20 @@ export class Matterbridge extends EventEmitter {
896
896
  this.log.error(`Error getting global node_modules directory: ${error}`);
897
897
  }
898
898
  }
899
- else
900
- this.log.debug(`Global node_modules Directory: ${this.globalModulesDirectory}`);
899
+ else {
900
+ this.log.debug(`Checking global node_modules directory: ${this.globalModulesDirectory}`);
901
+ try {
902
+ const { getGlobalNodeModules } = await import('./utils/network.js');
903
+ this.execRunningCount++;
904
+ this.matterbridgeInformation.globalModulesDirectory = this.globalModulesDirectory = await getGlobalNodeModules();
905
+ this.execRunningCount--;
906
+ this.log.debug(`Global node_modules Directory: ${this.globalModulesDirectory}`);
907
+ await this.nodeContext?.set('globalModulesDirectory', this.globalModulesDirectory);
908
+ }
909
+ catch (error) {
910
+ this.log.error(`Error checking global node_modules directory: ${error}`);
911
+ }
912
+ }
901
913
  const packageJson = JSON.parse(await fs.readFile(path.join(this.rootDirectory, 'package.json'), 'utf-8'));
902
914
  this.matterbridgeVersion = this.matterbridgeLatestVersion = this.matterbridgeDevVersion = packageJson.version;
903
915
  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-516a522",
3
+ "version": "3.2.1-dev-20250802-741949b",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge",
9
- "version": "3.2.1-dev-20250802-516a522",
9
+ "version": "3.2.1-dev-20250802-741949b",
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-516a522",
3
+ "version": "3.2.1-dev-20250802-741949b",
4
4
  "description": "Matterbridge plugin manager for Matter",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",