@homebridge/dbus-native 0.5.0 → 0.6.0

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/README.md CHANGED
@@ -1,17 +1,25 @@
1
- node-dbus
2
- ===========
1
+ <p align="center">
2
+ <a href="https://homebridge.io"><img src="https://raw.githubusercontent.com/homebridge/branding/latest/logos/homebridge-color-round-stylized.png" height="140"></a>
3
+ </p>
4
+
5
+ <span align="center">
6
+
7
+ # D-Bus Native
3
8
 
4
9
  [![Greenkeeper badge](https://badges.greenkeeper.io/sidorares/dbus-native.svg)](https://greenkeeper.io/)
5
- D-bus protocol client and server for node.js
10
+ [![Node Test](https://github.com/homebridge/dbus-native/actions/workflows/run-test.yml/badge.svg)](https://github.com/homebridge/dbus-native/actions/workflows/run-test.yml)
6
11
 
7
- [![Build Status](https://secure.travis-ci.org/sidorares/dbus-native.png)](http://travis-ci.org/sidorares/dbus-native)
12
+ </span>
13
+
14
+ D-bus protocol client and server for node.js
8
15
 
9
16
  Fork Status
10
17
  ------------
11
18
 
12
- This fork is maintained with the following two changes:
19
+ This fork is maintained with the following changes:
13
20
  * Removed the optional `abstract-socket` dependency for faster installs
14
21
  * Moved to our `long.js` fork to work around a crash on `ARMv6` platforms running node 16.1+
22
+ * Updated dependencies (including `prettier`, which has made style changes to a lot of files)
15
23
 
16
24
  Installation
17
25
  ------------
package/bin/dbus2js.js CHANGED
@@ -37,20 +37,20 @@ function getXML(callback) {
37
37
  }
38
38
 
39
39
  if (argv.dump) {
40
- getXML(function(err, xml) {
40
+ getXML(function (err, xml) {
41
41
  console.log(xml);
42
42
  bus.connection.end();
43
43
  });
44
44
  }
45
45
 
46
46
  if (!argv.server) {
47
- getXML(function(err, xml) {
47
+ getXML(function (err, xml) {
48
48
  if (err) die(err);
49
49
 
50
50
  var output = [];
51
51
 
52
52
  var parser = new xml2js.Parser(xml2js_opts);
53
- parser.parseString(xml, function(err, result) {
53
+ parser.parseString(xml, function (err, result) {
54
54
  if (err) die(err);
55
55
 
56
56
  var ifaceName, method, property, iface, arg, signature;
package/index.js CHANGED
@@ -27,7 +27,7 @@ function createStream(opts) {
27
27
  var familyParams = address.split(':');
28
28
  var family = familyParams[0];
29
29
  var params = {};
30
- familyParams[1].split(',').map(function(p) {
30
+ familyParams[1].split(',').map(function (p) {
31
31
  var keyVal = p.split('=');
32
32
  params[keyVal[0]] = keyVal[1];
33
33
  });
@@ -76,25 +76,25 @@ function createConnection(opts) {
76
76
  var stream = (self.stream = createStream(opts));
77
77
  stream.setNoDelay();
78
78
 
79
- stream.on('error', function(err) {
79
+ stream.on('error', function (err) {
80
80
  // forward network and stream errors
81
81
  self.emit('error', err);
82
82
  });
83
83
 
84
- stream.on('end', function() {
84
+ stream.on('end', function () {
85
85
  self.emit('end');
86
- self.message = function() {
86
+ self.message = function () {
87
87
  console.warn("Didn't write bytes to closed stream");
88
88
  };
89
89
  });
90
90
 
91
- self.end = function() {
91
+ self.end = function () {
92
92
  stream.end();
93
93
  return self;
94
94
  };
95
95
 
96
96
  var handshake = opts.server ? serverHandshake : clientHandshake;
97
- handshake(stream, opts, function(error, guid) {
97
+ handshake(stream, opts, function (error, guid) {
98
98
  if (error) {
99
99
  return self.emit('error', error);
100
100
  }
@@ -102,7 +102,7 @@ function createConnection(opts) {
102
102
  self.emit('connect');
103
103
  message.unmarshalMessages(
104
104
  stream,
105
- function(message) {
105
+ function (message) {
106
106
  self.emit('message', message);
107
107
  },
108
108
  opts
@@ -112,11 +112,11 @@ function createConnection(opts) {
112
112
  self._messages = [];
113
113
 
114
114
  // pre-connect version, buffers all messages. replaced after connect
115
- self.message = function(msg) {
115
+ self.message = function (msg) {
116
116
  self._messages.push(msg);
117
117
  };
118
118
 
119
- self.once('connect', function() {
119
+ self.once('connect', function () {
120
120
  self.state = 'connected';
121
121
  for (var i = 0; i < self._messages.length; ++i) {
122
122
  stream.write(message.marshall(self._messages[i]));
@@ -124,7 +124,7 @@ function createConnection(opts) {
124
124
  self._messages.length = 0;
125
125
 
126
126
  // no need to buffer once connected
127
- self.message = function(msg) {
127
+ self.message = function (msg) {
128
128
  stream.write(message.marshall(msg));
129
129
  };
130
130
  });
@@ -132,12 +132,12 @@ function createConnection(opts) {
132
132
  return self;
133
133
  }
134
134
 
135
- module.exports.createClient = function(params) {
135
+ module.exports.createClient = function (params) {
136
136
  var connection = createConnection(params || {});
137
137
  return new MessageBus(connection, params || {});
138
138
  };
139
139
 
140
- module.exports.systemBus = function() {
140
+ module.exports.systemBus = function () {
141
141
  return module.exports.createClient({
142
142
  busAddress:
143
143
  process.env.DBUS_SYSTEM_BUS_ADDRESS ||
@@ -145,7 +145,7 @@ module.exports.systemBus = function() {
145
145
  });
146
146
  };
147
147
 
148
- module.exports.sessionBus = function(opts) {
148
+ module.exports.sessionBus = function (opts) {
149
149
  return module.exports.createClient(opts);
150
150
  };
151
151
 
@@ -6,27 +6,36 @@ const os = require('os');
6
6
 
7
7
  function getDbusAddress(callback) {
8
8
  // read machine uuid
9
- fs.readFile('/var/lib/dbus/machine-id', 'ascii', function(err, uuid) {
9
+ fs.readFile('/var/lib/dbus/machine-id', 'ascii', function (err, uuid) {
10
10
  if (err) return callback(err);
11
11
  var hostname = os.hostname().split('-')[0];
12
- x11.createClient(function(err, display) {
12
+ x11.createClient(function (err, display) {
13
13
  var X = display.client;
14
14
  var selectionName = `_DBUS_SESSION_BUS_SELECTION_${hostname}_${uuid.trim()}`;
15
- X.InternAtom(false, selectionName, function(err, id) {
15
+ X.InternAtom(false, selectionName, function (err, id) {
16
16
  if (err) return callback(err);
17
- X.GetSelectionOwner(id, function(err, win) {
17
+ X.GetSelectionOwner(id, function (err, win) {
18
18
  if (err) return callback(err);
19
- X.InternAtom(false, '_DBUS_SESSION_BUS_ADDRESS', function(
20
- err,
21
- propId
22
- ) {
23
- if (err) return callback(err);
24
- win = display.screen[0].root;
25
- X.GetProperty(0, win, propId, 0, 0, 10000000, function(err, val) {
19
+ X.InternAtom(
20
+ false,
21
+ '_DBUS_SESSION_BUS_ADDRESS',
22
+ function (err, propId) {
26
23
  if (err) return callback(err);
27
- callback(null, val.data.toString());
28
- });
29
- });
24
+ win = display.screen[0].root;
25
+ X.GetProperty(
26
+ 0,
27
+ win,
28
+ propId,
29
+ 0,
30
+ 0,
31
+ 10000000,
32
+ function (err, val) {
33
+ if (err) return callback(err);
34
+ callback(null, val.data.toString());
35
+ }
36
+ );
37
+ }
38
+ );
30
39
  });
31
40
  });
32
41
  });
package/lib/bus.js CHANGED
@@ -17,21 +17,21 @@ module.exports = function bus(conn, opts) {
17
17
  this.signals = new EventEmitter();
18
18
  this.exportedObjects = {};
19
19
 
20
- this.invoke = function(msg, callback) {
20
+ this.invoke = function (msg, callback) {
21
21
  if (!msg.type) msg.type = constants.messageType.methodCall;
22
22
  msg.serial = self.serial++;
23
23
  this.cookies[msg.serial] = callback;
24
24
  self.connection.message(msg);
25
25
  };
26
26
 
27
- this.invokeDbus = function(msg, callback) {
27
+ this.invokeDbus = function (msg, callback) {
28
28
  if (!msg.path) msg.path = '/org/freedesktop/DBus';
29
29
  if (!msg.destination) msg.destination = 'org.freedesktop.DBus';
30
30
  if (!msg['interface']) msg['interface'] = 'org.freedesktop.DBus';
31
31
  self.invoke(msg, callback);
32
32
  };
33
33
 
34
- this.mangle = function(path, iface, member) {
34
+ this.mangle = function (path, iface, member) {
35
35
  var obj = {};
36
36
  if (typeof path === 'object') {
37
37
  // handle one argumant case mangle(msg)
@@ -46,7 +46,7 @@ module.exports = function bus(conn, opts) {
46
46
  return JSON.stringify(obj);
47
47
  };
48
48
 
49
- this.sendSignal = function(path, iface, name, signature, args) {
49
+ this.sendSignal = function (path, iface, name, signature, args) {
50
50
  var signalMsg = {
51
51
  type: constants.messageType.signal,
52
52
  serial: self.serial++,
@@ -62,7 +62,7 @@ module.exports = function bus(conn, opts) {
62
62
  };
63
63
 
64
64
  // Warning: errorName must respect the same rules as interface names (must contain a dot)
65
- this.sendError = function(msg, errorName, errorText) {
65
+ this.sendError = function (msg, errorName, errorText) {
66
66
  var reply = {
67
67
  type: constants.messageType.error,
68
68
  serial: self.serial++,
@@ -75,7 +75,7 @@ module.exports = function bus(conn, opts) {
75
75
  this.connection.message(reply);
76
76
  };
77
77
 
78
- this.sendReply = function(msg, signature, body) {
78
+ this.sendReply = function (msg, signature, body) {
79
79
  var reply = {
80
80
  type: constants.messageType.methodReturn,
81
81
  serial: self.serial++,
@@ -88,14 +88,14 @@ module.exports = function bus(conn, opts) {
88
88
  };
89
89
 
90
90
  // route reply/error
91
- this.connection.on('message', function(msg) {
91
+ this.connection.on('message', function (msg) {
92
92
  function invoke(impl, func, resultSignature) {
93
93
  Promise.resolve()
94
- .then(function() {
94
+ .then(function () {
95
95
  return func.apply(impl, (msg.body || []).concat(msg));
96
96
  })
97
97
  .then(
98
- function(methodReturnResult) {
98
+ function (methodReturnResult) {
99
99
  var methodReturnReply = {
100
100
  type: constants.messageType.methodReturn,
101
101
  serial: self.serial++,
@@ -108,7 +108,7 @@ module.exports = function bus(conn, opts) {
108
108
  }
109
109
  self.connection.message(methodReturnReply);
110
110
  },
111
- function(e) {
111
+ function (e) {
112
112
  self.sendError(
113
113
  msg,
114
114
  e.dbusName || 'org.freedesktop.DBus.Error.Failed',
@@ -137,7 +137,7 @@ module.exports = function bus(conn, opts) {
137
137
  args = [null].concat(args); // first argument - no errors, null
138
138
  handler.apply(props, args); // body as array of arguments
139
139
  } else {
140
- handler.call(props, {name: msg.errorName, message: args}); // body as first argument
140
+ handler.call(props, { name: msg.errorName, message: args }); // body as first argument
141
141
  }
142
142
  }
143
143
  } else if (msg.type === constants.messageType.signal) {
@@ -185,12 +185,12 @@ module.exports = function bus(conn, opts) {
185
185
  }
186
186
  });
187
187
 
188
- this.setMethodCallHandler = function(objectPath, iface, member, handler) {
188
+ this.setMethodCallHandler = function (objectPath, iface, member, handler) {
189
189
  var key = self.mangle(objectPath, iface, member);
190
190
  self.methodCallHandlers[key] = handler;
191
191
  };
192
192
 
193
- this.exportInterface = function(obj, path, iface) {
193
+ this.exportInterface = function (obj, path, iface) {
194
194
  var entry;
195
195
  if (!self.exportedObjects[path]) {
196
196
  entry = self.exportedObjects[path] = {};
@@ -201,7 +201,7 @@ module.exports = function bus(conn, opts) {
201
201
  // monkey-patch obj.emit()
202
202
  if (typeof obj.emit === 'function') {
203
203
  var oldEmit = obj.emit;
204
- obj.emit = function() {
204
+ obj.emit = function () {
205
205
  var args = Array.prototype.slice.apply(arguments);
206
206
  var signalName = args[0];
207
207
  if (!signalName) throw new Error('Trying to emit undefined signa');
@@ -234,7 +234,7 @@ module.exports = function bus(conn, opts) {
234
234
 
235
235
  // register name
236
236
  if (opts.direct !== true) {
237
- this.invokeDbus({ member: 'Hello' }, function(err, name) {
237
+ this.invokeDbus({ member: 'Hello' }, function (err, name) {
238
238
  if (err) throw new Error(err);
239
239
  self.name = name;
240
240
  });
@@ -245,7 +245,7 @@ module.exports = function bus(conn, opts) {
245
245
  function DBusObject(name, service) {
246
246
  this.name = name;
247
247
  this.service = service;
248
- this.as = function(name) {
248
+ this.as = function (name) {
249
249
  return this.proxy[name];
250
250
  };
251
251
  }
@@ -253,11 +253,11 @@ module.exports = function bus(conn, opts) {
253
253
  function DBusService(name, bus) {
254
254
  this.name = name;
255
255
  this.bus = bus;
256
- this.getObject = function(name, callback) {
256
+ this.getObject = function (name, callback) {
257
257
  if (name === undefined)
258
258
  return callback(new Error('Object name is null or undefined'));
259
259
  var obj = new DBusObject(name, this);
260
- introspect(obj, function(err, ifaces, nodes) {
260
+ introspect(obj, function (err, ifaces, nodes) {
261
261
  if (err) return callback(err);
262
262
  obj.proxy = ifaces;
263
263
  obj.nodes = nodes;
@@ -265,25 +265,25 @@ module.exports = function bus(conn, opts) {
265
265
  });
266
266
  };
267
267
 
268
- this.getInterface = function(objName, ifaceName, callback) {
269
- this.getObject(objName, function(err, obj) {
268
+ this.getInterface = function (objName, ifaceName, callback) {
269
+ this.getObject(objName, function (err, obj) {
270
270
  if (err) return callback(err);
271
271
  callback(null, obj.as(ifaceName));
272
272
  });
273
273
  };
274
274
  }
275
275
 
276
- this.getService = function(name) {
276
+ this.getService = function (name) {
277
277
  return new DBusService(name, this);
278
278
  };
279
279
 
280
- this.getObject = function(path, name, callback) {
280
+ this.getObject = function (path, name, callback) {
281
281
  var service = this.getService(path);
282
282
  return service.getObject(name, callback);
283
283
  };
284
284
 
285
- this.getInterface = function(path, objname, name, callback) {
286
- return this.getObject(path, objname, function(err, obj) {
285
+ this.getInterface = function (path, objname, name, callback) {
286
+ return this.getObject(path, objname, function (err, obj) {
287
287
  if (err) return callback(err);
288
288
  callback(null, obj.as(name));
289
289
  });
@@ -292,49 +292,49 @@ module.exports = function bus(conn, opts) {
292
292
  // TODO: refactor
293
293
 
294
294
  // bus meta functions
295
- this.addMatch = function(match, callback) {
295
+ this.addMatch = function (match, callback) {
296
296
  this.invokeDbus(
297
297
  { member: 'AddMatch', signature: 's', body: [match] },
298
298
  callback
299
299
  );
300
300
  };
301
301
 
302
- this.removeMatch = function(match, callback) {
302
+ this.removeMatch = function (match, callback) {
303
303
  this.invokeDbus(
304
304
  { member: 'RemoveMatch', signature: 's', body: [match] },
305
305
  callback
306
306
  );
307
307
  };
308
308
 
309
- this.getId = function(callback) {
309
+ this.getId = function (callback) {
310
310
  this.invokeDbus({ member: 'GetId' }, callback);
311
311
  };
312
312
 
313
- this.requestName = function(name, flags, callback) {
313
+ this.requestName = function (name, flags, callback) {
314
314
  this.invokeDbus(
315
315
  { member: 'RequestName', signature: 'su', body: [name, flags] },
316
- function(err, name) {
316
+ function (err, name) {
317
317
  if (callback) callback(err, name);
318
318
  }
319
319
  );
320
320
  };
321
321
 
322
- this.releaseName = function(name, callback) {
322
+ this.releaseName = function (name, callback) {
323
323
  this.invokeDbus(
324
324
  { member: 'ReleaseName', signature: 's', body: [name] },
325
325
  callback
326
326
  );
327
327
  };
328
328
 
329
- this.listNames = function(callback) {
329
+ this.listNames = function (callback) {
330
330
  this.invokeDbus({ member: 'ListNames' }, callback);
331
331
  };
332
332
 
333
- this.listActivatableNames = function(callback) {
333
+ this.listActivatableNames = function (callback) {
334
334
  this.invokeDbus({ member: 'ListActivatableNames' }, callback);
335
335
  };
336
336
 
337
- this.updateActivationEnvironment = function(env, callback) {
337
+ this.updateActivationEnvironment = function (env, callback) {
338
338
  this.invokeDbus(
339
339
  {
340
340
  member: 'UpdateActivationEnvironment',
@@ -345,35 +345,35 @@ module.exports = function bus(conn, opts) {
345
345
  );
346
346
  };
347
347
 
348
- this.startServiceByName = function(name, flags, callback) {
348
+ this.startServiceByName = function (name, flags, callback) {
349
349
  this.invokeDbus(
350
350
  { member: 'StartServiceByName', signature: 'su', body: [name, flags] },
351
351
  callback
352
352
  );
353
353
  };
354
354
 
355
- this.getConnectionUnixUser = function(name, callback) {
355
+ this.getConnectionUnixUser = function (name, callback) {
356
356
  this.invokeDbus(
357
357
  { member: 'GetConnectionUnixUser', signature: 's', body: [name] },
358
358
  callback
359
359
  );
360
360
  };
361
361
 
362
- this.getConnectionUnixProcessId = function(name, callback) {
362
+ this.getConnectionUnixProcessId = function (name, callback) {
363
363
  this.invokeDbus(
364
364
  { member: 'GetConnectionUnixProcessID', signature: 's', body: [name] },
365
365
  callback
366
366
  );
367
367
  };
368
368
 
369
- this.getNameOwner = function(name, callback) {
369
+ this.getNameOwner = function (name, callback) {
370
370
  this.invokeDbus(
371
371
  { member: 'GetNameOwner', signature: 's', body: [name] },
372
372
  callback
373
373
  );
374
374
  };
375
375
 
376
- this.nameHasOwner = function(name, callback) {
376
+ this.nameHasOwner = function (name, callback) {
377
377
  this.invokeDbus(
378
378
  { member: 'NameHasOwner', signature: 's', body: [name] },
379
379
  callback
@@ -14,53 +14,53 @@ function DBusBuffer(buffer, startPos, options) {
14
14
  (this.startPos = startPos ? startPos : 0), (this.pos = 0);
15
15
  }
16
16
 
17
- DBusBuffer.prototype.align = function(power) {
17
+ DBusBuffer.prototype.align = function (power) {
18
18
  var allbits = (1 << power) - 1;
19
19
  var paddedOffset = ((this.pos + this.startPos + allbits) >> power) << power;
20
20
  this.pos = paddedOffset - this.startPos;
21
21
  };
22
22
 
23
- DBusBuffer.prototype.readInt8 = function() {
23
+ DBusBuffer.prototype.readInt8 = function () {
24
24
  this.pos++;
25
25
  return this.buffer[this.pos - 1];
26
26
  };
27
27
 
28
- DBusBuffer.prototype.readSInt16 = function() {
28
+ DBusBuffer.prototype.readSInt16 = function () {
29
29
  this.align(1);
30
30
  var res = this.buffer.readInt16LE(this.pos);
31
31
  this.pos += 2;
32
32
  return res;
33
33
  };
34
34
 
35
- DBusBuffer.prototype.readInt16 = function() {
35
+ DBusBuffer.prototype.readInt16 = function () {
36
36
  this.align(1);
37
37
  var res = this.buffer.readUInt16LE(this.pos);
38
38
  this.pos += 2;
39
39
  return res;
40
40
  };
41
41
 
42
- DBusBuffer.prototype.readSInt32 = function() {
42
+ DBusBuffer.prototype.readSInt32 = function () {
43
43
  this.align(2);
44
44
  var res = this.buffer.readInt32LE(this.pos);
45
45
  this.pos += 4;
46
46
  return res;
47
47
  };
48
48
 
49
- DBusBuffer.prototype.readInt32 = function() {
49
+ DBusBuffer.prototype.readInt32 = function () {
50
50
  this.align(2);
51
51
  var res = this.buffer.readUInt32LE(this.pos);
52
52
  this.pos += 4;
53
53
  return res;
54
54
  };
55
55
 
56
- DBusBuffer.prototype.readDouble = function() {
56
+ DBusBuffer.prototype.readDouble = function () {
57
57
  this.align(3);
58
58
  var res = this.buffer.readDoubleLE(this.pos);
59
59
  this.pos += 8;
60
60
  return res;
61
61
  };
62
62
 
63
- DBusBuffer.prototype.readString = function(len) {
63
+ DBusBuffer.prototype.readString = function (len) {
64
64
  if (len === 0) {
65
65
  this.pos++;
66
66
  return '';
package/lib/handshake.js CHANGED
@@ -24,7 +24,7 @@ function getCookie(context, id, cb) {
24
24
 
25
25
  var filename = path.join(dirname, context);
26
26
  // check it's not writable by others and readable by user
27
- fs.stat(dirname, function(err, stat) {
27
+ fs.stat(dirname, function (err, stat) {
28
28
  if (err) return cb(err);
29
29
  if (stat.mode & 0o22)
30
30
  return cb(
@@ -39,7 +39,7 @@ function getCookie(context, id, cb) {
39
39
  'Keyrings directory is not owned by the current user. Aborting authentication!'
40
40
  )
41
41
  );
42
- fs.readFile(filename, 'ascii', function(err, keyrings) {
42
+ fs.readFile(filename, 'ascii', function (err, keyrings) {
43
43
  if (err) return cb(err);
44
44
  var lines = keyrings.split('\n');
45
45
  for (var l = 0; l < lines.length; ++l) {
@@ -78,7 +78,7 @@ function tryAuth(stream, methods, cb) {
78
78
  var id = hexlify(uid);
79
79
 
80
80
  function beginOrNextAuth() {
81
- readLine(stream, function(line) {
81
+ readLine(stream, function (line) {
82
82
  var ok = line.toString('ascii').match(/^([A-Za-z]+) (.*)/);
83
83
  if (ok && ok[1] === 'OK') {
84
84
  stream.write('BEGIN\r\n');
@@ -101,14 +101,8 @@ function tryAuth(stream, methods, cb) {
101
101
  break;
102
102
  case 'DBUS_COOKIE_SHA1':
103
103
  stream.write(`AUTH ${authMethod} ${id}\r\n`);
104
- readLine(stream, function(line) {
105
- var data = Buffer.from(
106
- line
107
- .toString()
108
- .split(' ')[1]
109
- .trim(),
110
- 'hex'
111
- )
104
+ readLine(stream, function (line) {
105
+ var data = Buffer.from(line.toString().split(' ')[1].trim(), 'hex')
112
106
  .toString()
113
107
  .split(' ');
114
108
  var cookieContext = data[0];
@@ -116,7 +110,7 @@ function tryAuth(stream, methods, cb) {
116
110
  var serverChallenge = data[2];
117
111
  // any random 16 bytes should work, sha1(rnd) to make it simplier
118
112
  var clientChallenge = crypto.randomBytes(16).toString('hex');
119
- getCookie(cookieContext, cookieId, function(err, cookie) {
113
+ getCookie(cookieContext, cookieId, function (err, cookie) {
120
114
  if (err) return cb(err);
121
115
  var response = sha1(
122
116
  [serverChallenge, clientChallenge, cookie].join(':')
@@ -1,7 +1,7 @@
1
1
  const Buffer = require('safe-buffer').Buffer;
2
2
 
3
3
  // Pre-serialised hello message. serial = 1
4
- module.exports = function() {
4
+ module.exports = function () {
5
5
  return Buffer.from(
6
6
  `6c01 0001 0000 0000 0100 0000 6d00 0000
7
7
  0101 6f00 1500 0000 2f6f 7267 2f66 7265
package/lib/introspect.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const xml2js = require('xml2js');
2
2
 
3
- module.exports.introspectBus = function(obj, callback) {
3
+ module.exports.introspectBus = function (obj, callback) {
4
4
  var bus = obj.service.bus;
5
5
  bus.invoke(
6
6
  {
@@ -9,16 +9,16 @@ module.exports.introspectBus = function(obj, callback) {
9
9
  interface: 'org.freedesktop.DBus.Introspectable',
10
10
  member: 'Introspect'
11
11
  },
12
- function(err, xml) {
12
+ function (err, xml) {
13
13
  module.exports.processXML(err, xml, obj, callback);
14
14
  }
15
15
  );
16
16
  };
17
17
 
18
- module.exports.processXML = function(err, xml, obj, callback) {
18
+ module.exports.processXML = function (err, xml, obj, callback) {
19
19
  if (err) return callback(err);
20
20
  var parser = new xml2js.Parser();
21
- parser.parseString(xml, function(err, result) {
21
+ parser.parseString(xml, function (err, result) {
22
22
  if (err) return callback(err);
23
23
  if (!result.node) throw new Error('No root XML node');
24
24
  result = result.node; // unwrap the root node
@@ -84,17 +84,17 @@ function DBusInterface(parent_obj, ifname) {
84
84
  this.$callbacks = [];
85
85
  this.$sigHandlers = [];
86
86
  }
87
- DBusInterface.prototype.$getSigHandler = function(callback) {
87
+ DBusInterface.prototype.$getSigHandler = function (callback) {
88
88
  var index;
89
89
  if ((index = this.$callbacks.indexOf(callback)) === -1) {
90
90
  index = this.$callbacks.push(callback) - 1;
91
- this.$sigHandlers[index] = function(messageBody) {
91
+ this.$sigHandlers[index] = function (messageBody) {
92
92
  callback.apply(null, messageBody);
93
93
  };
94
94
  }
95
95
  return this.$sigHandlers[index];
96
96
  };
97
- DBusInterface.prototype.addListener = DBusInterface.prototype.on = function(
97
+ DBusInterface.prototype.addListener = DBusInterface.prototype.on = function (
98
98
  signame,
99
99
  callback
100
100
  ) {
@@ -107,7 +107,7 @@ DBusInterface.prototype.addListener = DBusInterface.prototype.on = function(
107
107
  var match = getMatchRule(this.$parent.name, this.$name, signame);
108
108
  bus.addMatch(
109
109
  match,
110
- function(err) {
110
+ function (err) {
111
111
  if (err) throw new Error(err);
112
112
  bus.signals.on(signalFullName, this.$getSigHandler(callback));
113
113
  }.bind(this)
@@ -117,38 +117,36 @@ DBusInterface.prototype.addListener = DBusInterface.prototype.on = function(
117
117
  bus.signals.on(signalFullName, this.$getSigHandler(callback));
118
118
  }
119
119
  };
120
- DBusInterface.prototype.removeListener = DBusInterface.prototype.off = function(
121
- signame,
122
- callback
123
- ) {
124
- var bus = this.$parent.service.bus;
125
- var signalFullName = bus.mangle(this.$parent.name, this.$name, signame);
126
- bus.signals.removeListener(signalFullName, this.$getSigHandler(callback));
127
- if (!bus.signals.listeners(signalFullName).length) {
128
- // There is no event handlers for this match
129
- var match = getMatchRule(this.$parent.name, this.$name, signame);
130
- bus.removeMatch(
131
- match,
132
- function(err) {
133
- if (err) throw new Error(err);
134
- // Now it is safe to empty these arrays
135
- this.$callbacks.length = 0;
136
- this.$sigHandlers.length = 0;
137
- }.bind(this)
138
- );
139
- }
140
- };
141
- DBusInterface.prototype.$createMethod = function(mName, signature) {
120
+ DBusInterface.prototype.removeListener = DBusInterface.prototype.off =
121
+ function (signame, callback) {
122
+ var bus = this.$parent.service.bus;
123
+ var signalFullName = bus.mangle(this.$parent.name, this.$name, signame);
124
+ bus.signals.removeListener(signalFullName, this.$getSigHandler(callback));
125
+ if (!bus.signals.listeners(signalFullName).length) {
126
+ // There is no event handlers for this match
127
+ var match = getMatchRule(this.$parent.name, this.$name, signame);
128
+ bus.removeMatch(
129
+ match,
130
+ function (err) {
131
+ if (err) throw new Error(err);
132
+ // Now it is safe to empty these arrays
133
+ this.$callbacks.length = 0;
134
+ this.$sigHandlers.length = 0;
135
+ }.bind(this)
136
+ );
137
+ }
138
+ };
139
+ DBusInterface.prototype.$createMethod = function (mName, signature) {
142
140
  this.$methods[mName] = signature;
143
- this[mName] = function() {
141
+ this[mName] = function () {
144
142
  this.$callMethod(mName, arguments);
145
143
  };
146
144
  };
147
- DBusInterface.prototype.$callMethod = function(mName, args) {
145
+ DBusInterface.prototype.$callMethod = function (mName, args) {
148
146
  var bus = this.$parent.service.bus;
149
147
  if (!Array.isArray(args)) args = Array.from(args); // Array.prototype.slice.apply(args)
150
148
  var callback =
151
- typeof args[args.length - 1] === 'function' ? args.pop() : function() {};
149
+ typeof args[args.length - 1] === 'function' ? args.pop() : function () {};
152
150
  var msg = {
153
151
  destination: this.$parent.service.name,
154
152
  path: this.$parent.name,
@@ -161,17 +159,21 @@ DBusInterface.prototype.$callMethod = function(mName, args) {
161
159
  }
162
160
  bus.invoke(msg, callback);
163
161
  };
164
- DBusInterface.prototype.$createProp = function(propName, propType, propAccess) {
162
+ DBusInterface.prototype.$createProp = function (
163
+ propName,
164
+ propType,
165
+ propAccess
166
+ ) {
165
167
  this.$properties[propName] = { type: propType, access: propAccess };
166
168
  Object.defineProperty(this, propName, {
167
169
  enumerable: true,
168
- get: () => callback => this.$readProp(propName, callback),
169
- set: function(val) {
170
+ get: () => (callback) => this.$readProp(propName, callback),
171
+ set: function (val) {
170
172
  this.$writeProp(propName, val);
171
173
  }
172
174
  });
173
175
  };
174
- DBusInterface.prototype.$readProp = function(propName, callback) {
176
+ DBusInterface.prototype.$readProp = function (propName, callback) {
175
177
  var bus = this.$parent.service.bus;
176
178
  bus.invoke(
177
179
  {
@@ -182,7 +184,7 @@ DBusInterface.prototype.$readProp = function(propName, callback) {
182
184
  signature: 'ss',
183
185
  body: [this.$name, propName]
184
186
  },
185
- function(err, val) {
187
+ function (err, val) {
186
188
  if (err) {
187
189
  callback(err);
188
190
  } else {
@@ -196,7 +198,7 @@ DBusInterface.prototype.$readProp = function(propName, callback) {
196
198
  }
197
199
  );
198
200
  };
199
- DBusInterface.prototype.$writeProp = function(propName, val) {
201
+ DBusInterface.prototype.$writeProp = function (propName, val) {
200
202
  var bus = this.$parent.service.bus;
201
203
  bus.invoke({
202
204
  destination: this.$parent.service.name,
@@ -10,7 +10,7 @@ const Long = require('@homebridge/long');
10
10
  * check returns nothing - it only raises errors if the data is
11
11
  * invalid for the signature
12
12
  */
13
- var MakeSimpleMarshaller = function(signature) {
13
+ var MakeSimpleMarshaller = function (signature) {
14
14
  var marshaller = {};
15
15
  function checkValidString(data) {
16
16
  if (typeof data !== 'string') {
@@ -55,43 +55,39 @@ var MakeSimpleMarshaller = function(signature) {
55
55
  // TODO: verify object path here?
56
56
  case 's': // eslint-disable-line no-fallthrough
57
57
  //STRING
58
- marshaller.check = function(data) {
58
+ marshaller.check = function (data) {
59
59
  checkValidString(data);
60
60
  };
61
- marshaller.marshall = function(ps, data) {
61
+ marshaller.marshall = function (ps, data) {
62
62
  this.check(data);
63
63
  // utf8 string
64
64
  align(ps, 4);
65
65
  const buff = Buffer.from(data, 'utf8');
66
- ps.word32le(buff.length)
67
- .put(buff)
68
- .word8(0);
66
+ ps.word32le(buff.length).put(buff).word8(0);
69
67
  ps._offset += 5 + buff.length;
70
68
  };
71
69
  break;
72
70
  case 'g':
73
71
  //SIGNATURE
74
- marshaller.check = function(data) {
72
+ marshaller.check = function (data) {
75
73
  checkValidString(data);
76
74
  checkValidSignature(data);
77
75
  };
78
- marshaller.marshall = function(ps, data) {
76
+ marshaller.marshall = function (ps, data) {
79
77
  this.check(data);
80
78
  // signature
81
79
  const buff = Buffer.from(data, 'ascii');
82
- ps.word8(data.length)
83
- .put(buff)
84
- .word8(0);
80
+ ps.word8(data.length).put(buff).word8(0);
85
81
  ps._offset += 2 + buff.length;
86
82
  };
87
83
  break;
88
84
  case 'y':
89
85
  //BYTE
90
- marshaller.check = function(data) {
86
+ marshaller.check = function (data) {
91
87
  checkInteger(data);
92
88
  checkRange(0x00, 0xff, data);
93
89
  };
94
- marshaller.marshall = function(ps, data) {
90
+ marshaller.marshall = function (ps, data) {
95
91
  this.check(data);
96
92
  ps.word8(data);
97
93
  ps._offset++;
@@ -99,10 +95,10 @@ var MakeSimpleMarshaller = function(signature) {
99
95
  break;
100
96
  case 'b':
101
97
  //BOOLEAN
102
- marshaller.check = function(data) {
98
+ marshaller.check = function (data) {
103
99
  checkBoolean(data);
104
100
  };
105
- marshaller.marshall = function(ps, data) {
101
+ marshaller.marshall = function (ps, data) {
106
102
  this.check(data);
107
103
  // booleans serialised as 0/1 unsigned 32 bit int
108
104
  data = data ? 1 : 0;
@@ -113,11 +109,11 @@ var MakeSimpleMarshaller = function(signature) {
113
109
  break;
114
110
  case 'n':
115
111
  //INT16
116
- marshaller.check = function(data) {
112
+ marshaller.check = function (data) {
117
113
  checkInteger(data);
118
114
  checkRange(-0x7fff - 1, 0x7fff, data);
119
115
  };
120
- marshaller.marshall = function(ps, data) {
116
+ marshaller.marshall = function (ps, data) {
121
117
  this.check(data);
122
118
  align(ps, 2);
123
119
  const buff = Buffer.alloc(2);
@@ -128,11 +124,11 @@ var MakeSimpleMarshaller = function(signature) {
128
124
  break;
129
125
  case 'q':
130
126
  //UINT16
131
- marshaller.check = function(data) {
127
+ marshaller.check = function (data) {
132
128
  checkInteger(data);
133
129
  checkRange(0, 0xffff, data);
134
130
  };
135
- marshaller.marshall = function(ps, data) {
131
+ marshaller.marshall = function (ps, data) {
136
132
  this.check(data);
137
133
  align(ps, 2);
138
134
  ps.word16le(data);
@@ -141,11 +137,11 @@ var MakeSimpleMarshaller = function(signature) {
141
137
  break;
142
138
  case 'i':
143
139
  //INT32
144
- marshaller.check = function(data) {
140
+ marshaller.check = function (data) {
145
141
  checkInteger(data);
146
142
  checkRange(-0x7fffffff - 1, 0x7fffffff, data);
147
143
  };
148
- marshaller.marshall = function(ps, data) {
144
+ marshaller.marshall = function (ps, data) {
149
145
  this.check(data);
150
146
  align(ps, 4);
151
147
  const buff = Buffer.alloc(4);
@@ -156,11 +152,11 @@ var MakeSimpleMarshaller = function(signature) {
156
152
  break;
157
153
  case 'u':
158
154
  //UINT32
159
- marshaller.check = function(data) {
155
+ marshaller.check = function (data) {
160
156
  checkInteger(data);
161
157
  checkRange(0, 0xffffffff, data);
162
158
  };
163
- marshaller.marshall = function(ps, data) {
159
+ marshaller.marshall = function (ps, data) {
164
160
  this.check(data);
165
161
  // 32 t unsigned int
166
162
  align(ps, 4);
@@ -170,10 +166,10 @@ var MakeSimpleMarshaller = function(signature) {
170
166
  break;
171
167
  case 't':
172
168
  //UINT64
173
- marshaller.check = function(data) {
169
+ marshaller.check = function (data) {
174
170
  return checkLong(data, false);
175
171
  };
176
- marshaller.marshall = function(ps, data) {
172
+ marshaller.marshall = function (ps, data) {
177
173
  data = this.check(data);
178
174
  align(ps, 8);
179
175
  ps.word32le(data.low);
@@ -183,10 +179,10 @@ var MakeSimpleMarshaller = function(signature) {
183
179
  break;
184
180
  case 'x':
185
181
  //INT64
186
- marshaller.check = function(data) {
182
+ marshaller.check = function (data) {
187
183
  return checkLong(data, true);
188
184
  };
189
- marshaller.marshall = function(ps, data) {
185
+ marshaller.marshall = function (ps, data) {
190
186
  data = this.check(data);
191
187
  align(ps, 8);
192
188
  ps.word32le(data.low);
@@ -196,7 +192,7 @@ var MakeSimpleMarshaller = function(signature) {
196
192
  break;
197
193
  case 'd':
198
194
  //DOUBLE
199
- marshaller.check = function(data) {
195
+ marshaller.check = function (data) {
200
196
  if (typeof data !== 'number') {
201
197
  throw new Error(`Data: ${data} was not of type number`);
202
198
  } else if (Number.isNaN(data)) {
@@ -205,7 +201,7 @@ var MakeSimpleMarshaller = function(signature) {
205
201
  throw new Error('Number outside range');
206
202
  }
207
203
  };
208
- marshaller.marshall = function(ps, data) {
204
+ marshaller.marshall = function (ps, data) {
209
205
  this.check(data);
210
206
  align(ps, 8);
211
207
  const buff = Buffer.alloc(8);
@@ -221,13 +217,13 @@ var MakeSimpleMarshaller = function(signature) {
221
217
  };
222
218
  exports.MakeSimpleMarshaller = MakeSimpleMarshaller;
223
219
 
224
- var checkRange = function(minValue, maxValue, data) {
220
+ var checkRange = function (minValue, maxValue, data) {
225
221
  if (data > maxValue || data < minValue) {
226
222
  throw new Error('Number outside range');
227
223
  }
228
224
  };
229
225
 
230
- var checkInteger = function(data) {
226
+ var checkInteger = function (data) {
231
227
  if (typeof data !== 'number') {
232
228
  throw new Error(`Data: ${data} was not of type number`);
233
229
  }
@@ -236,14 +232,14 @@ var checkInteger = function(data) {
236
232
  }
237
233
  };
238
234
 
239
- var checkBoolean = function(data) {
235
+ var checkBoolean = function (data) {
240
236
  if (!(typeof data === 'boolean' || data === 0 || data === 1))
241
237
  throw new Error(`Data: ${data} was not of type boolean`);
242
238
  };
243
239
 
244
240
  // This is essentially a tweaked version of 'fromValue' from Long.js with error checking.
245
241
  // This can take number or string of decimal characters or 'Long' instance (or Long-style object with props low,high,unsigned).
246
- var makeLong = function(val, signed) {
242
+ var makeLong = function (val, signed) {
247
243
  if (val instanceof Long) return val;
248
244
  if (val instanceof Number) val = val.valueOf();
249
245
  if (typeof val === 'number') {
@@ -304,7 +300,7 @@ var makeLong = function(val, signed) {
304
300
  }
305
301
  };
306
302
 
307
- var checkLong = function(data, signed) {
303
+ var checkLong = function (data, signed) {
308
304
  if (!Long.isLong(data)) {
309
305
  data = makeLong(data, signed);
310
306
  }
package/lib/message.js CHANGED
@@ -15,7 +15,7 @@ module.exports.unmarshalMessages = function messageParser(
15
15
  var fieldsLength, fieldsLengthPadded;
16
16
  var fieldsAndBodyLength = 0;
17
17
  var bodyLength = 0;
18
- stream.on('readable', function() {
18
+ stream.on('readable', function () {
19
19
  while (1) {
20
20
  if (state === 0) {
21
21
  header = stream.read(16);
@@ -96,7 +96,7 @@ module.exports.marshall = function marshallMessage(message) {
96
96
  ];
97
97
  var headerBuff = marshall('yyyyuu', header);
98
98
  var fields = [];
99
- constants.headerTypeName.forEach(function(fieldName) {
99
+ constants.headerTypeName.forEach(function (fieldName) {
100
100
  var fieldVal = message[fieldName];
101
101
  if (fieldVal) {
102
102
  fields.push([
@@ -6,32 +6,32 @@ var address = process.env.DBUS_SESSION_BUS_ADDRESS;
6
6
  var m = address.match(/abstract=([^,]+)/);
7
7
 
8
8
  net
9
- .createServer(function(s) {
9
+ .createServer(function (s) {
10
10
  var buff = '';
11
11
  var connected = false;
12
12
  var cli = abs.createConnection(`\0${m[1]}`);
13
- s.on('data', function(d) {
13
+ s.on('data', function (d) {
14
14
  if (connected) {
15
15
  cli.write(d);
16
16
  } else {
17
17
  buff += d.toString();
18
18
  }
19
19
  });
20
- setTimeout(function() {
20
+ setTimeout(function () {
21
21
  console.log('CONNECTED!');
22
22
  connected = true;
23
23
  cli.write(buff);
24
24
  }, 100);
25
25
  cli.pipe(s);
26
26
 
27
- cli.on('data', function(b) {
27
+ cli.on('data', function (b) {
28
28
  console.log(hexy(b, { prefix: 'from client ' }));
29
29
  });
30
- s.on('data', function(b) {
30
+ s.on('data', function (b) {
31
31
  console.log(hexy(b, { prefix: 'from server ' }));
32
32
  });
33
33
  })
34
- .listen(3334, function() {
34
+ .listen(3334, function () {
35
35
  console.log(
36
36
  'Server started. connect with DBUS_SESSION_BUS_ADDRESS=tcp:host=127.0.0.1,port=3334'
37
37
  );
@@ -3,20 +3,20 @@ const readLine = require('./readline');
3
3
 
4
4
  module.exports = function serverHandshake(stream, opts, cb) {
5
5
  stream.name = 'SERVER SERVER';
6
- readLine(stream, function(hello) {
6
+ readLine(stream, function (hello) {
7
7
  console.log(['hello string: ', hello.toString(), hello]);
8
8
  stream.write('REJECTED EXTERNAL DBUS_COOKIE_SHA1 ANONYMOUS\r\n');
9
- readLine(stream, function() {
9
+ readLine(stream, function () {
10
10
  stream.write(
11
11
  `DATA ${Buffer.from(
12
12
  'org_freedesktop_general 642038150 b9ce247a275f427c8586e4c9de9bb951'
13
13
  ).toString('hex')}\r\n`
14
14
  );
15
- readLine(stream, function() {
15
+ readLine(stream, function () {
16
16
  stream.write(
17
17
  'OK 6f72675f667265656465736b746f705f67656e6572616c20353631303331333937206239636532343761323735663432376338353836653463396465396262393531\r\n'
18
18
  );
19
- readLine(stream, function(begin) {
19
+ readLine(stream, function (begin) {
20
20
  console.log(['AFTER begin: ', begin.toString()]);
21
21
  cb(null);
22
22
  });
package/lib/server.js CHANGED
@@ -1,10 +1,10 @@
1
1
  const dbus = require('../index');
2
2
  const net = require('net');
3
3
 
4
- module.exports.createServer = function(handler) {
4
+ module.exports.createServer = function (handler) {
5
5
  function Server() {
6
6
  var id = 123;
7
- this.server = net.createServer(function(socket) {
7
+ this.server = net.createServer(function (socket) {
8
8
  socket.idd = id;
9
9
  id++;
10
10
 
package/lib/signature.js CHANGED
@@ -6,7 +6,7 @@ var match = {
6
6
  };
7
7
 
8
8
  var knownTypes = {};
9
- '(){}ybnqiuxtdsogarvehm*?@&^'.split('').forEach(function(c) {
9
+ '(){}ybnqiuxtdsogarvehm*?@&^'.split('').forEach(function (c) {
10
10
  knownTypes[c] = true;
11
11
  });
12
12
 
package/lib/stdifaces.js CHANGED
@@ -8,7 +8,7 @@ var xmlHeader =
8
8
  ' "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">';
9
9
  var stdIfaces;
10
10
 
11
- module.exports = function(msg, bus) {
11
+ module.exports = function (msg, bus) {
12
12
  if (
13
13
  msg['interface'] === 'org.freedesktop.DBus.Introspectable' &&
14
14
  msg.member === 'Introspect'
@@ -145,10 +145,10 @@ module.exports = function(msg, bus) {
145
145
  // TODO: move to introspect.js
146
146
  function interfaceToXML(iface) {
147
147
  var result = [];
148
- var dumpArgs = function(argsSignature, argsNames, direction) {
148
+ var dumpArgs = function (argsSignature, argsNames, direction) {
149
149
  if (!argsSignature) return;
150
150
  var args = parseSignature(argsSignature);
151
- args.forEach(function(arg, num) {
151
+ args.forEach(function (arg, num) {
152
152
  var argName = argsNames ? argsNames[num] : direction + num;
153
153
  var dirStr = direction === 'signal' ? '' : `" direction="${direction}`;
154
154
  result.push(
@@ -190,7 +190,7 @@ function interfaceToXML(iface) {
190
190
 
191
191
  function dumpSignature(s) {
192
192
  var result = [];
193
- s.forEach(function(sig) {
193
+ s.forEach(function (sig) {
194
194
  result.push(sig.type + dumpSignature(sig.child));
195
195
  if (sig.type === '{') result.push('}');
196
196
  if (sig.type === '(') result.push(')');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@homebridge/dbus-native",
3
3
  "author": "Andrey Sidorov <sidorares@yandex.com>",
4
- "version": "0.5.0",
4
+ "version": "0.6.0",
5
5
  "keywords": [
6
6
  "dbus",
7
7
  "dcop",
@@ -32,19 +32,19 @@
32
32
  "license": "MIT",
33
33
  "repository": {
34
34
  "type": "git",
35
- "url": "https://github.com/homebridge/dbus-native.git"
35
+ "url": "git+https://github.com/homebridge/dbus-native.git"
36
36
  },
37
37
  "bin": {
38
- "dbus2js": "./bin/dbus2js.js"
38
+ "dbus2js": "bin/dbus2js.js"
39
39
  },
40
40
  "dependencies": {
41
41
  "@homebridge/long": "^5.2.1",
42
- "event-stream": "^4.0.0",
43
- "hexy": "^0.2.10",
42
+ "@homebridge/put": "^0.0.8",
43
+ "event-stream": "^4.0.1",
44
+ "hexy": "^0.3.5",
44
45
  "minimist": "^1.2.6",
45
- "@homebridge/put": "~0.0.8",
46
- "safe-buffer": "^5.1.1",
47
- "xml2js": "^0.4.17"
46
+ "safe-buffer": "^5.1.2",
47
+ "xml2js": "^0.6.2"
48
48
  },
49
49
  "comment": {
50
50
  "optionalDependencies": {
@@ -53,15 +53,15 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/minimist": "^1.2.2",
56
- "eslint": "^6.0.0",
57
- "eslint-config-prettier": "^3.0.0",
58
- "eslint-plugin-markdown": "^3.0.0",
59
- "eslint-plugin-prettier": "^3.0.0",
60
- "husky": "^1.0.0",
61
- "lint-staged": "^13.0.3",
62
- "mocha": "*",
56
+ "eslint": "^8.57.0",
57
+ "eslint-config-prettier": "^9.1.0",
58
+ "eslint-plugin-markdown": "^4.0.1",
59
+ "eslint-plugin-prettier": "^5.1.3",
60
+ "husky": "^9.0.11",
61
+ "lint-staged": "^15.2.2",
62
+ "mocha": "^10.0.0",
63
63
  "nyc": "^15.1.0",
64
- "prettier": "^1.7.4"
64
+ "prettier": "^3.2.5"
65
65
  },
66
66
  "scripts": {
67
67
  "lint": "npm run lint:docs && npm run lint:code",