rclnodejs 0.31.0 → 0.32.1

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.
Files changed (59) hide show
  1. package/README.md +1 -1
  2. package/lib/action/client.js +1 -1
  3. package/lib/clock_type.js +0 -2
  4. package/lib/distro.js +1 -1
  5. package/lib/interface_loader.js +1 -2
  6. package/lib/lifecycle.js +0 -5
  7. package/lib/lifecycle_publisher.js +1 -1
  8. package/lib/node.js +3 -3
  9. package/lib/parameter.js +6 -9
  10. package/lib/parameter_service.js +1 -2
  11. package/lib/publisher.js +1 -1
  12. package/lib/qos.js +0 -2
  13. package/lib/rate.js +0 -1
  14. package/lib/rmw.js +12 -0
  15. package/lib/time_source.js +0 -1
  16. package/package.json +23 -21
  17. package/rosidl_gen/action_msgs.js +0 -1
  18. package/rosidl_gen/filter.js +14 -1
  19. package/rosidl_gen/generator.json +1 -1
  20. package/rosidl_gen/index.js +0 -1
  21. package/rosidl_gen/message_translator.js +2 -9
  22. package/rosidl_gen/packages.js +1 -3
  23. package/rosidl_gen/primitive_types.js +0 -4
  24. package/rosidl_gen/templates/message.dot +4 -0
  25. package/rostsd_gen/index.js +0 -3
  26. package/scripts/cpplint.js +3 -4
  27. package/scripts/generate_messages.js +1 -1
  28. package/scripts/npmjs-readme.md +1 -1
  29. package/scripts/ros_distro.js +12 -0
  30. package/scripts/run_test.js +0 -2
  31. package/src/executor.hpp +3 -3
  32. package/src/handle_manager.hpp +3 -3
  33. package/src/macros.hpp +3 -3
  34. package/src/rcl_action_bindings.hpp +3 -3
  35. package/src/rcl_bindings.cpp +7 -7
  36. package/src/rcl_bindings.hpp +3 -3
  37. package/src/rcl_handle.hpp +3 -3
  38. package/src/rcl_lifecycle_bindings.hpp +3 -3
  39. package/src/rcl_utilities.hpp +3 -3
  40. package/src/shadow_node.hpp +3 -3
  41. package/types/action_client.d.ts +0 -1
  42. package/types/action_server.d.ts +0 -1
  43. package/types/base.d.ts +27 -28
  44. package/types/index.d.ts +1 -2
  45. package/types/lifecycle.d.ts +1 -3
  46. package/types/node.d.ts +0 -1
  47. package/types/parameter.d.ts +0 -2
  48. package/types/publisher.d.ts +0 -1
  49. package/types/time.d.ts +1 -5
  50. package/.gitattributes +0 -117
  51. package/CONTRIBUTORS.md +0 -63
  52. package/electron_demo/README.md +0 -54
  53. package/electron_demo/electron-demo.gif +0 -0
  54. package/electron_demo/index.html +0 -25
  55. package/electron_demo/main.js +0 -66
  56. package/electron_demo/package.json +0 -22
  57. package/electron_demo/renderer.js +0 -22
  58. package/suppr.txt +0 -3
  59. package/types/interfaces.d.ts +0 -4482
package/README.md CHANGED
@@ -45,7 +45,7 @@ npm i rclnodejs@x.y.z
45
45
 
46
46
  | RCLNODEJS Version | Compatible ROS 2 LTS |
47
47
  | :------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------: |
48
- | latest version (currently [v0.31.0](https://github.com/RobotWebTools/rclnodejs/tree/0.31.0)) | [Humble](https://github.com/RobotWebTools/rclnodejs/tree/humble-hawksbill)<br>[Jazzy](https://github.com/RobotWebTools/rclnodejs/tree/jazzy) |
48
+ | latest version (currently [v0.32.1](https://github.com/RobotWebTools/rclnodejs/tree/0.32.1)) | [Humble](https://github.com/RobotWebTools/rclnodejs/tree/humble-hawksbill)<br>[Jazzy](https://github.com/RobotWebTools/rclnodejs/tree/jazzy) |
49
49
 
50
50
  ## Documentation
51
51
 
@@ -172,7 +172,7 @@ class ActionClient extends Entity {
172
172
  goalHandle.status = status;
173
173
 
174
174
  // Remove done handles from the list
175
- // eslint-disable-next-line max-depth
175
+
176
176
  if (
177
177
  status === ActionInterfaces.GoalStatus.STATUS_SUCCEEDED ||
178
178
  status === ActionInterfaces.GoalStatus.STATUS_CANCELED ||
package/lib/clock_type.js CHANGED
@@ -14,8 +14,6 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- /* eslint-disable camelcase */
18
-
19
17
  /**
20
18
  * Enum for ClockType
21
19
  * @readonly
package/lib/distro.js CHANGED
@@ -63,7 +63,7 @@ const DistroUtils = {
63
63
  return process.env.ROS_DISTRO;
64
64
  }
65
65
 
66
- return [...DistroNameIdMap].find(([key, val]) => val == distroId)[0];
66
+ return [...DistroNameIdMap].find(([, val]) => val == distroId)[0];
67
67
  },
68
68
 
69
69
  getKnownDistroNames: function () {
@@ -59,7 +59,6 @@ let interfaceLoader = {
59
59
  // Suppose the name is a package, and traverse the path to collect the IDL files.
60
60
  let packagePath = path.join(generator.generatedRoot, name);
61
61
 
62
- // eslint-disable-next-line
63
62
  let interfaces = fs.readdirSync(packagePath);
64
63
  if (interfaces.length > 0) {
65
64
  return this.loadInterfaceByPath(packagePath, interfaces);
@@ -108,7 +107,7 @@ let interfaceLoader = {
108
107
  packageName,
109
108
  packageName + '__' + type + '__' + messageName + '.js'
110
109
  );
111
- // eslint-disable-next-line
110
+
112
111
  if (fs.existsSync(filePath)) {
113
112
  return require(filePath);
114
113
  }
package/lib/lifecycle.js CHANGED
@@ -588,8 +588,6 @@ class LifecycleNode extends Node {
588
588
  * @throws {Error} If transition is invalid for the current state.
589
589
  */
590
590
  shutdown(callbackReturnValue) {
591
- let state = this.currentState;
592
-
593
591
  return this._changeState(SHUTDOWN_TRANSITION_LABEL, callbackReturnValue);
594
592
  }
595
593
 
@@ -603,7 +601,6 @@ class LifecycleNode extends Node {
603
601
  _onGetState(request, response) {
604
602
  let result = response.template;
605
603
 
606
- // eslint-disable-next-line camelcase
607
604
  result.current_state = this.currentState;
608
605
 
609
606
  response.send(result);
@@ -619,7 +616,6 @@ class LifecycleNode extends Node {
619
616
  _onGetAvailableStates(request, response) {
620
617
  let result = response.template;
621
618
 
622
- // eslint-disable-next-line camelcase
623
619
  result.available_states = this.availableStates;
624
620
 
625
621
  response.send(result);
@@ -634,7 +630,6 @@ class LifecycleNode extends Node {
634
630
  _onGetAvailableTransitions(request, response) {
635
631
  let result = response.template;
636
632
 
637
- // eslint-disable-next-line camelcase
638
633
  result.available_transitions = this.availableTransitions;
639
634
 
640
635
  response.send(result);
@@ -37,7 +37,7 @@ class LifecyclePublisher extends Publisher {
37
37
  * Publish a message only when activated; otherwise do nothing (nop);
38
38
  *
39
39
  * @param {object|Buffer} message - The message to be sent, could be kind of JavaScript message generated from .msg
40
- * or be a Buffer for a raw message.
40
+ * or be a Buffer for a raw message.
41
41
  * @returns {undefined}
42
42
  */
43
43
  publish(message) {
package/lib/node.js CHANGED
@@ -1496,7 +1496,7 @@ class Node extends rclnodejs.ShadowNode {
1496
1496
  );
1497
1497
  }
1498
1498
 
1499
- // publish ParameterEvent
1499
+ // Publish ParameterEvent.
1500
1500
  this._parameterEventPublisher.publish(parameterEvent);
1501
1501
 
1502
1502
  return {
@@ -1549,7 +1549,7 @@ class Node extends rclnodejs.ShadowNode {
1549
1549
  // detect invalid parameter
1550
1550
  try {
1551
1551
  parameter.validate();
1552
- } catch (e) {
1552
+ } catch {
1553
1553
  return {
1554
1554
  successful: false,
1555
1555
  reason: `Invalid ${parameter.name}`,
@@ -1577,7 +1577,7 @@ class Node extends rclnodejs.ShadowNode {
1577
1577
  if (parameter.type != ParameterType.PARAMETER_NOT_SET) {
1578
1578
  try {
1579
1579
  descriptor.validateParameter(parameter);
1580
- } catch (e) {
1580
+ } catch {
1581
1581
  return {
1582
1582
  successful: false,
1583
1583
  reason: `Parameter ${parameter.name} does not readonly`,
package/lib/parameter.js CHANGED
@@ -1,5 +1,3 @@
1
- /* eslint-disable camelcase */
2
-
3
1
  // Copyright (c) 2020 Wayne Parrott. All rights reserved.
4
2
  //
5
3
  // Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +20,6 @@
22
20
  'use strict';
23
21
 
24
22
  const IsClose = require('is-close');
25
- const rclnodejs = require('bindings')('rclnodejs');
26
23
 
27
24
  /**
28
25
  * The plus/minus tolerance for determining number equivalence.
@@ -274,7 +271,6 @@ class ParameterDescriptor {
274
271
  static fromParameter(parameter) {
275
272
  const name = parameter.name;
276
273
  const type = parameter.type;
277
- const value = parameter.value;
278
274
  return new ParameterDescriptor(name, type, 'Created from parameter.');
279
275
  }
280
276
 
@@ -387,7 +383,7 @@ class ParameterDescriptor {
387
383
  return;
388
384
  }
389
385
  if (!(range instanceof Range)) {
390
- throw TypeException('Expected instance of Range.');
386
+ throw TypeError('Expected instance of Range.');
391
387
  }
392
388
  if (!range.isValidType(this.type)) {
393
389
  throw TypeError('Incompatible Range');
@@ -443,14 +439,14 @@ class ParameterDescriptor {
443
439
  // ensure parameter is valid
444
440
  try {
445
441
  parameter.validate();
446
- } catch (e) {
442
+ } catch {
447
443
  throw new TypeError('Parameter is invalid');
448
444
  }
449
445
 
450
446
  // ensure this descriptor is valid
451
447
  try {
452
448
  this.validate();
453
- } catch (e) {
449
+ } catch {
454
450
  throw new Error('Descriptor is invalid.');
455
451
  }
456
452
 
@@ -567,6 +563,7 @@ class Range {
567
563
  * @param {ParameterType} parameterType - The parameter type to test.
568
564
  * @return {boolean} - True if parameterType is compatible; otherwise return false.
569
565
  */
566
+ // eslint-disable-next-line no-unused-vars
570
567
  isValidType(parameterType) {
571
568
  return false;
572
569
  }
@@ -702,6 +699,7 @@ class IntegerRange extends Range {
702
699
  * @param {any} value - The value to infer it's ParameterType
703
700
  * @returns {ParameterType} - The ParameterType that best scribes the value.
704
701
  */
702
+ // eslint-disable-next-line no-unused-vars
705
703
  function parameterTypeFromValue(value) {
706
704
  if (!value) return ParameterType.PARAMETER_NOT_SET;
707
705
  if (typeof value === 'boolean') return ParameterType.PARAMETER_BOOL;
@@ -778,8 +776,7 @@ function validValue(value, type) {
778
776
  case ParameterType.PARAMETER_INTEGER_ARRAY:
779
777
  case ParameterType.PARAMETER_DOUBLE_ARRAY:
780
778
  case ParameterType.PARAMETER_STRING_ARRAY:
781
- const values = value;
782
- result = _validArray(values, type);
779
+ result = _validArray(value, type);
783
780
  break;
784
781
  default:
785
782
  result = false;
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-depth */
2
1
  // Copyright (c) 2020 Wayne Parrott. All rights reserved.
3
2
  //
4
3
  // Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,7 +14,6 @@
15
14
 
16
15
  'use strict';
17
16
 
18
- const rclnodejs = require('bindings')('rclnodejs');
19
17
  const { Parameter, PARAMETER_SEPARATOR } = require('./parameter.js');
20
18
 
21
19
  /**
@@ -27,6 +25,7 @@ const { Parameter, PARAMETER_SEPARATOR } = require('./parameter.js');
27
25
  * rcl_interfaces/srv/GetParameters
28
26
  * rcl_interfaces/srv/SetParameters
29
27
  * rcl_interfaces/srv/SetParametersAtomically
28
+ * rcl_interfaces/srv/GetParameterTypes
30
29
  *
31
30
  * Call start() to begin receiving client request.
32
31
  * All service requests are forwarded to the node this service works for.
package/lib/publisher.js CHANGED
@@ -38,7 +38,7 @@ class Publisher extends Entity {
38
38
  /**
39
39
  * Publish a message
40
40
  * @param {object|Buffer} message - The message to be sent, could be kind of JavaScript message generated from .msg
41
- * or be a Buffer for a raw message.
41
+ * or be a Buffer for a raw message.
42
42
  * @return {undefined}
43
43
  */
44
44
  publish(message) {
package/lib/qos.js CHANGED
@@ -14,8 +14,6 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- /* eslint-disable */
18
-
19
17
  /**
20
18
  * Enum for HistoryPolicy
21
19
  * @readonly
package/lib/rate.js CHANGED
@@ -1,4 +1,3 @@
1
- //
2
1
  // Licensed under the Apache License, Version 2.0 (the "License");
3
2
  // you may not use this file except in compliance with the License.
4
3
  // You may obtain a copy of the License at
package/lib/rmw.js CHANGED
@@ -1,3 +1,15 @@
1
+ // Licensed under the Apache License, Version 2.0 (the "License");
2
+ // you may not use this file except in compliance with the License.
3
+ // You may obtain a copy of the License at
4
+ //
5
+ // http://www.apache.org/licenses/LICENSE-2.0
6
+ //
7
+ // Unless required by applicable law or agreed to in writing, software
8
+ // distributed under the License is distributed on an "AS IS" BASIS,
9
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ // See the License for the specific language governing permissions and
11
+ // limitations under the License.
12
+
1
13
  'use strict';
2
14
 
3
15
  const DistroUtils = require('./distro');
@@ -17,7 +17,6 @@
17
17
  const rclnodejs = require('bindings')('rclnodejs');
18
18
  const { Clock, ROSClock } = require('./clock.js');
19
19
  const { ClockType } = Clock;
20
- const Node = require('./node.js');
21
20
  const { Parameter, ParameterType } = require('./parameter.js');
22
21
  const Time = require('./time.js');
23
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rclnodejs",
3
- "version": "0.31.0",
3
+ "version": "0.32.1",
4
4
  "description": "ROS2.0 JavaScript client with Node.js",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -17,17 +17,17 @@
17
17
  "build:dev": "node-gyp -j 16 build --debug",
18
18
  "rebuild": "npm run clean && node-gyp -j 16 rebuild",
19
19
  "rebuild:dev": "npm run clean && node-gyp -j 16 rebuild --debug",
20
- "generate-messages": "node scripts/generate_messages.js",
21
- "generate-messages:dev": "node scripts/generate_messages.js --debug",
20
+ "generate-messages": "node scripts/generate_messages.js && node scripts/generate_tsd.js",
21
+ "generate-messages:dev": "node scripts/generate_messages.js --debug && node scripts/generate_tsd.js",
22
22
  "clean": "node-gyp clean && rimraf ./generated",
23
23
  "install": "npm run rebuild",
24
24
  "postinstall": "npm run generate-messages",
25
25
  "docs": "cd docs && make",
26
- "test": "node --expose-gc ./scripts/run_test.js && npm run dtslint",
27
- "dtslint": "node scripts/generate_tsd.js",
28
- "lint": "eslint --max-warnings=0 --ext js,ts index.js types scripts lib example rosidl_gen rosidl_parser test benchmark/rclnodejs && node ./scripts/cpplint.js",
26
+ "test": "nyc node --expose-gc ./scripts/run_test.js && npx tsd",
27
+ "lint": "eslint && node ./scripts/cpplint.js",
29
28
  "format": "clang-format -i -style=file ./src/*.cpp ./src/*.hpp && prettier --write \"{lib,rosidl_gen,rostsd_gen,rosidl_parser,types,example,test,scripts,benchmark}/**/*.{js,md,ts}\" ./*.{js,md,ts}",
30
- "prepare": "husky"
29
+ "prepare": "husky",
30
+ "coverage": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
31
31
  },
32
32
  "bin": {
33
33
  "generate-ros-messages": "./scripts/generate_messages.js"
@@ -43,46 +43,45 @@
43
43
  "type": "git",
44
44
  "url": "git+https://github.com/RobotWebTools/rclnodejs.git"
45
45
  },
46
- "//": "Pin deep-equal to ^1.1.1",
47
46
  "devDependencies": {
48
- "@babel/eslint-parser": "^7.25.9",
47
+ "@eslint/js": "^10.0.0",
48
+ "@types/node": "^22.13.9",
49
49
  "@typescript-eslint/eslint-plugin": "^8.18.0",
50
50
  "@typescript-eslint/parser": "^8.18.0",
51
- "babel-eslint": "^10.1.0",
52
51
  "clang-format": "^1.8.0",
53
52
  "commander": "^13.1.0",
54
- "deep-equal": "^1.1.1",
53
+ "coveralls": "^3.1.1",
54
+ "deep-equal": "^2.2.3",
55
55
  "eslint": "^9.16.0",
56
- "eslint-config-prettier": "^10.0.1",
56
+ "eslint-config-prettier": "^10.0.2",
57
57
  "eslint-plugin-prettier": "^5.2.1",
58
+ "globals": "^16.0.0",
58
59
  "husky": "^9.1.7",
59
60
  "jsdoc": "^4.0.4",
60
61
  "lint-staged": "^15.2.10",
61
62
  "mocha": "^11.0.2",
63
+ "nyc": "^17.1.0",
62
64
  "sinon": "^19.0.2",
63
65
  "tree-kill": "^1.2.2",
64
- "typescript": "^5.7.2"
66
+ "tsd": "^0.31.2",
67
+ "typescript": "^5.7.2",
68
+ "uuid": "^11.0.3"
65
69
  },
66
70
  "dependencies": {
67
71
  "@rclnodejs/ref-array-di": "^1.2.2",
68
72
  "@rclnodejs/ref-napi": "^4.0.0",
69
73
  "@rclnodejs/ref-struct-di": "^1.1.1",
70
- "array.prototype.flat": "^1.3.2",
71
74
  "bindings": "^1.5.0",
72
75
  "compare-versions": "^6.1.1",
73
76
  "debug": "^4.4.0",
74
77
  "dot": "^1.1.3",
75
- "dtslint": "^4.2.1",
76
78
  "fs-extra": "^11.2.0",
77
- "json-bigint": "^1.0.0",
78
79
  "is-close": "^1.3.3",
79
- "mkdirp": "^3.0.1",
80
- "mz": "^2.7.0",
80
+ "json-bigint": "^1.0.0",
81
81
  "nan": "^2.22.0",
82
+ "prettier": "^3.4.2",
82
83
  "rimraf": "^6.0.1",
83
- "uuid": "^11.0.3",
84
- "walk": "^2.3.15",
85
- "prettier": "^3.4.2"
84
+ "walk": "^2.3.15"
86
85
  },
87
86
  "husky": {
88
87
  "hooks": {
@@ -97,6 +96,9 @@
97
96
  "clang-format -i -style=file"
98
97
  ]
99
98
  },
99
+ "tsd": {
100
+ "directory": "test/types"
101
+ },
100
102
  "engines": {
101
103
  "node": ">= 16.13.0"
102
104
  }
@@ -12,7 +12,6 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- /* eslint-disable camelcase */
16
15
  const GOAL_ID_FIELD = {
17
16
  name: 'goal_id',
18
17
  type: {
@@ -1,3 +1,17 @@
1
+ // Licensed under the Apache License, Version 2.0 (the "License");
2
+ // you may not use this file except in compliance with the License.
3
+ // You may obtain a copy of the License at
4
+ //
5
+ // http://www.apache.org/licenses/LICENSE-2.0
6
+ //
7
+ // Unless required by applicable law or agreed to in writing, software
8
+ // distributed under the License is distributed on an "AS IS" BASIS,
9
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ // See the License for the specific language governing permissions and
11
+ // limitations under the License.
12
+
13
+ 'use strict';
14
+
1
15
  const fs = require('fs');
2
16
  const path = require('path');
3
17
  const os = require('os');
@@ -73,7 +87,6 @@ const RosPackageFilters = {
73
87
 
74
88
  if (!fs.existsSync(blocklistPath)) return;
75
89
 
76
- // eslint-disable-next-line
77
90
  let blocklistData = JSON.parse(fs.readFileSync(blocklistPath, 'utf8'));
78
91
 
79
92
  let filters = blocklistData.map((pkgFilterData) => {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rosidl-generator",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Generate JavaScript object from ROS IDL(.msg) files",
5
5
  "main": "index.js",
6
6
  "authors": [
@@ -64,7 +64,6 @@ async function generateAll(forcedGenerating) {
64
64
 
65
65
  const generator = {
66
66
  version() {
67
- // eslint-disable-next-line
68
67
  return fse.readJsonSync(path.join(__dirname, 'generator.json')).version;
69
68
  },
70
69
 
@@ -14,10 +14,6 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- /* eslint-disable max-depth */
18
-
19
- const debug = require('debug')('rclnodejs:message_translator');
20
-
21
17
  function isTypedArray(value) {
22
18
  return ArrayBuffer.isView(value) && !(value instanceof DataView);
23
19
  }
@@ -39,7 +35,6 @@ function copyMsgObject(msg, obj) {
39
35
  // It's an array
40
36
  if (typeof obj[i][0] === 'object') {
41
37
  // It's an array of objects: converting to ROS message objects
42
-
43
38
  // 1. Extract the element-type first
44
39
  // 2. Build the array by translate every elements
45
40
  let msgArray = [];
@@ -66,8 +61,7 @@ function copyMsgObject(msg, obj) {
66
61
  function verifyMessage(message, obj) {
67
62
  if (message.constructor.isROSArray) {
68
63
  // It's a ROS message array
69
- // Note: there won't be any JavaScript array in message
70
-
64
+ // Note: there won't be any JavaScript array in message.
71
65
  if (!Array.isArray(obj)) {
72
66
  return false;
73
67
  }
@@ -131,13 +125,12 @@ function toPlainObject(message, enableTypedArray = true) {
131
125
 
132
126
  if (message.constructor.isROSArray) {
133
127
  // It's a ROS message array
134
- // Note: there won't be any JavaScript array in message
128
+ // Note: there won't be any JavaScript array in message.
135
129
  let array = [];
136
130
  message.data.forEach((e) => {
137
131
  array.push(toPlainObject(e, enableTypedArray)); // Translate every elements
138
132
  });
139
133
  return array;
140
- // eslint-disable-next-line no-else-return
141
134
  } else {
142
135
  // It's a ROS message
143
136
  const def = message.constructor.ROSMessageDef;
@@ -20,7 +20,6 @@ const readline = require('readline');
20
20
  const path = require('path');
21
21
  const walk = require('walk');
22
22
  const os = require('os');
23
- const flat = require('array.prototype.flat');
24
23
  const pkgFilters = require('../rosidl_gen/filter.js');
25
24
 
26
25
  const fsp = fs.promises;
@@ -193,8 +192,7 @@ async function findAmentPackagesInDirectory(dir) {
193
192
  pkgs.map((pkg) => getPackageDefinitionsFiles(pkg, dir))
194
193
  );
195
194
 
196
- // Support flat() method for nodejs < 11.
197
- const rosFiles = Array.prototype.flat ? files.flat() : flat(files);
195
+ const rosFiles = files.flat();
198
196
  const pkgMap = new Map();
199
197
  await Promise.all(
200
198
  rosFiles.map((filePath) => addInterfaceInfos(filePath, dir, pkgMap))
@@ -18,8 +18,6 @@ const ref = require('@rclnodejs/ref-napi');
18
18
  const StructType = require('@rclnodejs/ref-struct-di')(ref);
19
19
  const rclnodejs = require('bindings')('rclnodejs');
20
20
 
21
- /* eslint-disable camelcase */
22
-
23
21
  const StringRefStruct = StructType({
24
22
  data: ref.types.CString,
25
23
  size: ref.types.size_t,
@@ -65,5 +63,3 @@ module.exports = {
65
63
  wstring: StringRefStruct,
66
64
  initString: initString,
67
65
  };
68
-
69
- /* eslint-enable camelcase */
@@ -824,6 +824,10 @@ class {{=arrayWrapper}} {
824
824
  get classType() {
825
825
  return {{=arrayWrapper}};
826
826
  }
827
+
828
+ toPlainObject(enableTypedArray) {
829
+ return translator.toPlainObject(this, enableTypedArray);
830
+ }
827
831
  }
828
832
 
829
833
  {{? it.spec.constants != undefined && it.spec.constants.length}}
@@ -1,6 +1,3 @@
1
- /* eslint-disable max-depth */
2
- /* eslint-disable no-sync */
3
- /* eslint-disable camelcase */
4
1
  // Licensed under the Apache License, Version 2.0 (the "License");
5
2
  // you may not use this file except in compliance with the License.
6
3
  // You may obtain a copy of the License at
@@ -18,10 +18,9 @@ const exec = require('child_process').exec;
18
18
 
19
19
  const cmd = 'wget -nc ';
20
20
  const cpplintUrl =
21
- 'https://raw.githubusercontent.com/google/styleguide' +
22
- '/gh-pages/cpplint/cpplint.py';
21
+ 'https://raw.githubusercontent.com/cpplint/cpplint/refs/heads/develop/cpplint.py';
23
22
  const root = `${__dirname}/../src`;
24
- const args = `--extensions=cpp,h,hpp,cc ${root}/*`;
23
+ const args = `--filter=-build/include_subdir,-whitespace/indent_namespace --extensions=cpp,h,hpp,cc ${root}/*`;
25
24
 
26
25
  console.log('Downloading the cpplint...');
27
26
  exec(cmd + cpplintUrl, (err, stdout, stderr) => {
@@ -29,7 +28,7 @@ exec(cmd + cpplintUrl, (err, stdout, stderr) => {
29
28
  console.log(`Downloading failed: ${stderr}`);
30
29
  } else {
31
30
  console.log('Running the cpplint...');
32
- exec('python cpplint.py ' + args, (err, stdout, stderr) => {
31
+ exec('python3 cpplint.py ' + args, (err, stdout, stderr) => {
33
32
  console.log(stdout);
34
33
  if (err) {
35
34
  console.log(stderr);
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- /* eslint-disable camelcase */
4
3
  // Copyright (c) 2018 Intel Corporation. All rights reserved.
5
4
 
6
5
  // Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,6 +14,7 @@
15
14
  // See the License for the specific language governing permissions and
16
15
  // limitations under the License.
17
16
 
17
+ /* eslint-disable camelcase */
18
18
  'use strict';
19
19
 
20
20
  const generator = require('../rosidl_gen/index.js');
@@ -45,7 +45,7 @@ npm i rclnodejs@x.y.z
45
45
 
46
46
  | RCLNODEJS Version | Compatible ROS 2 LTS |
47
47
  | :------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------: |
48
- | latest version (currently [v0.31.0](https://github.com/RobotWebTools/rclnodejs/tree/0.31.0)) | [Humble](https://github.com/RobotWebTools/rclnodejs/tree/humble-hawksbill)<br>[Jazzy](https://github.com/RobotWebTools/rclnodejs/tree/jazzy) |
48
+ | latest version (currently [v0.32.1](https://github.com/RobotWebTools/rclnodejs/tree/0.32.1)) | [Humble](https://github.com/RobotWebTools/rclnodejs/tree/humble-hawksbill)<br>[Jazzy](https://github.com/RobotWebTools/rclnodejs/tree/jazzy) |
49
49
 
50
50
  ## Documentation
51
51
 
@@ -1,3 +1,15 @@
1
+ // Licensed under the Apache License, Version 2.0 (the "License");
2
+ // you may not use this file except in compliance with the License.
3
+ // You may obtain a copy of the License at
4
+
5
+ // http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ // Unless required by applicable law or agreed to in writing, software
8
+ // distributed under the License is distributed on an "AS IS" BASIS,
9
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ // See the License for the specific language governing permissions and
11
+ // limitations under the License.
12
+
1
13
  'use strict';
2
14
 
3
15
  const DistroUtils = require('../lib/distro');
@@ -19,8 +19,6 @@ const Mocha = require('mocha');
19
19
  const os = require('os');
20
20
  const path = require('path');
21
21
 
22
- let rootDir = path.dirname(__dirname);
23
-
24
22
  fs.remove(path.join(path.dirname(__dirname), 'generated'), (err) => {
25
23
  if (!err) {
26
24
  let mocha = new Mocha();
package/src/executor.hpp CHANGED
@@ -12,8 +12,8 @@
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
 
15
- #ifndef RCLNODEJS_EXECUTOR_HPP_
16
- #define RCLNODEJS_EXECUTOR_HPP_
15
+ #ifndef SRC_EXECUTOR_HPP_
16
+ #define SRC_EXECUTOR_HPP_
17
17
 
18
18
  #include <rcl/wait.h>
19
19
  #include <uv.h>
@@ -74,4 +74,4 @@ class Executor {
74
74
 
75
75
  } // namespace rclnodejs
76
76
 
77
- #endif
77
+ #endif // SRC_EXECUTOR_HPP_
@@ -12,8 +12,8 @@
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
 
15
- #ifndef RCLNODEJS_HANDLE_MANAGER_HPP_
16
- #define RCLNODEJS_HANDLE_MANAGER_HPP_
15
+ #ifndef SRC_HANDLE_MANAGER_HPP_
16
+ #define SRC_HANDLE_MANAGER_HPP_
17
17
 
18
18
  #include <nan.h>
19
19
  #include <rcl/wait.h>
@@ -132,4 +132,4 @@ class HandleManager {
132
132
 
133
133
  } // namespace rclnodejs
134
134
 
135
- #endif
135
+ #endif // SRC_HANDLE_MANAGER_HPP_
package/src/macros.hpp CHANGED
@@ -12,8 +12,8 @@
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
 
15
- #ifndef RCLNODEJS_MARCOS_HPP_
16
- #define RCLNODEJS_MARCOS_HPP_
15
+ #ifndef SRC_MACROS_HPP_
16
+ #define SRC_MACROS_HPP_
17
17
 
18
18
  #include "rcutils/logging_macros.h"
19
19
 
@@ -43,4 +43,4 @@
43
43
  #define RCLNODEJS_DEBUG(...)
44
44
  #endif
45
45
 
46
- #endif
46
+ #endif // SRC_MACROS_HPP_