rclnodejs 1.5.1 → 1.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 +25 -2
- package/binding.gyp +2 -0
- package/index.js +21 -4
- package/lib/action/client.js +1 -1
- package/lib/action/graph.js +1 -1
- package/lib/action/server.js +1 -1
- package/lib/action/server_goal_handle.js +1 -1
- package/lib/client.js +1 -1
- package/lib/clock.js +1 -1
- package/lib/context.js +1 -1
- package/lib/duration.js +1 -1
- package/lib/event_handler.js +1 -1
- package/lib/guard_condition.js +1 -1
- package/lib/lifecycle.js +1 -1
- package/lib/lifecycle_publisher.js +1 -1
- package/lib/logging.js +1 -1
- package/lib/message_serialization.js +171 -0
- package/lib/native_loader.js +173 -0
- package/lib/node.js +16 -1
- package/lib/parameter.js +4 -10
- package/lib/publisher.js +1 -1
- package/lib/serialization.js +1 -1
- package/lib/service.js +1 -1
- package/lib/subscription.js +17 -2
- package/lib/time.js +1 -1
- package/lib/time_source.js +1 -1
- package/lib/timer.js +1 -1
- package/lib/type_description_service.js +1 -1
- package/lib/utils.js +324 -0
- package/lib/validator.js +1 -1
- package/package.json +14 -18
- package/prebuilds/linux-arm64/humble-jammy-arm64-rclnodejs.node +0 -0
- package/prebuilds/linux-arm64/jazzy-noble-arm64-rclnodejs.node +0 -0
- package/prebuilds/linux-arm64/kilted-noble-arm64-rclnodejs.node +0 -0
- package/prebuilds/linux-x64/humble-jammy-x64-rclnodejs.node +0 -0
- package/prebuilds/linux-x64/jazzy-noble-x64-rclnodejs.node +0 -0
- package/prebuilds/linux-x64/kilted-noble-x64-rclnodejs.node +0 -0
- package/rosidl_convertor/idl_convertor.js +3 -2
- package/rosidl_gen/deallocator.js +1 -1
- package/rosidl_gen/generate_worker.js +1 -1
- package/rosidl_gen/generator.json +1 -1
- package/rosidl_gen/idl_generator.js +11 -24
- package/rosidl_gen/index.js +1 -1
- package/rosidl_gen/primitive_types.js +2 -2
- package/rosidl_gen/templates/action-template.js +68 -0
- package/rosidl_gen/templates/message-template.js +1113 -0
- package/rosidl_gen/templates/service-event-template.js +31 -0
- package/rosidl_gen/templates/service-template.js +44 -0
- package/rosidl_parser/rosidl_parser.js +2 -2
- package/scripts/install.js +113 -0
- package/scripts/tag_prebuilds.js +70 -0
- package/src/addon.cpp +3 -0
- package/third_party/ref-napi/index.js +15 -0
- package/third_party/ref-napi/lib/ref.js +1696 -0
- package/third_party/ref-napi/src/ref_napi_bindings.cpp +736 -0
- package/third_party/ref-napi/src/ref_napi_bindings.h +26 -0
- package/types/index.d.ts +17 -0
- package/types/node.d.ts +16 -1
- package/rosidl_gen/templates/CMakeLists.dot +0 -40
- package/rosidl_gen/templates/action.dot +0 -50
- package/rosidl_gen/templates/message.dot +0 -851
- package/rosidl_gen/templates/package.dot +0 -16
- package/rosidl_gen/templates/service.dot +0 -26
- package/rosidl_gen/templates/service_event.dot +0 -10
package/lib/parameter.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
'use strict';
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const { isClose } = require('./utils.js');
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* The plus/minus tolerance for determining number equivalence.
|
|
@@ -623,8 +623,8 @@ class FloatingPointRange extends Range {
|
|
|
623
623
|
const max = Math.max(this.fromValue, this.toValue);
|
|
624
624
|
|
|
625
625
|
if (
|
|
626
|
-
|
|
627
|
-
|
|
626
|
+
isClose(value, min, this.tolerance) ||
|
|
627
|
+
isClose(value, max, this.tolerance)
|
|
628
628
|
) {
|
|
629
629
|
return true;
|
|
630
630
|
}
|
|
@@ -633,13 +633,7 @@ class FloatingPointRange extends Range {
|
|
|
633
633
|
}
|
|
634
634
|
if (this.step != 0.0) {
|
|
635
635
|
const distanceInSteps = Math.round((value - min) / this.step);
|
|
636
|
-
if (
|
|
637
|
-
!IsClose.isClose(
|
|
638
|
-
min + distanceInSteps * this.step,
|
|
639
|
-
value,
|
|
640
|
-
this.tolerance
|
|
641
|
-
)
|
|
642
|
-
) {
|
|
636
|
+
if (!isClose(min + distanceInSteps * this.step, value, this.tolerance)) {
|
|
643
637
|
return false;
|
|
644
638
|
}
|
|
645
639
|
}
|
package/lib/publisher.js
CHANGED
package/lib/serialization.js
CHANGED
package/lib/service.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
'use strict';
|
|
16
16
|
|
|
17
|
-
const rclnodejs = require('
|
|
17
|
+
const rclnodejs = require('./native_loader.js');
|
|
18
18
|
const DistroUtils = require('./distro.js');
|
|
19
19
|
const Entity = require('./entity.js');
|
|
20
20
|
const debug = require('debug')('rclnodejs:service');
|
package/lib/subscription.js
CHANGED
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
'use strict';
|
|
16
16
|
|
|
17
|
-
const rclnodejs = require('
|
|
17
|
+
const rclnodejs = require('./native_loader.js');
|
|
18
18
|
const Entity = require('./entity.js');
|
|
19
|
+
const { applySerializationMode } = require('./message_serialization.js');
|
|
19
20
|
const debug = require('debug')('rclnodejs:subscription');
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -42,6 +43,7 @@ class Subscription extends Entity {
|
|
|
42
43
|
this._topic = topic;
|
|
43
44
|
this._callback = callback;
|
|
44
45
|
this._isRaw = options.isRaw || false;
|
|
46
|
+
this._serializationMode = options.serializationMode || 'default';
|
|
45
47
|
this._node = node;
|
|
46
48
|
|
|
47
49
|
if (node && eventCallbacks) {
|
|
@@ -55,7 +57,13 @@ class Subscription extends Entity {
|
|
|
55
57
|
if (this._isRaw) {
|
|
56
58
|
this._callback(msg);
|
|
57
59
|
} else {
|
|
58
|
-
|
|
60
|
+
let message = msg.toPlainObject(this.typedArrayEnabled);
|
|
61
|
+
|
|
62
|
+
if (this._serializationMode !== 'default') {
|
|
63
|
+
message = applySerializationMode(message, this._serializationMode);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
this._callback(message);
|
|
59
67
|
}
|
|
60
68
|
}
|
|
61
69
|
|
|
@@ -109,6 +117,13 @@ class Subscription extends Entity {
|
|
|
109
117
|
return this._isRaw;
|
|
110
118
|
}
|
|
111
119
|
|
|
120
|
+
/**
|
|
121
|
+
* @type {string}
|
|
122
|
+
*/
|
|
123
|
+
get serializationMode() {
|
|
124
|
+
return this._serializationMode;
|
|
125
|
+
}
|
|
126
|
+
|
|
112
127
|
/**
|
|
113
128
|
* Test if the RMW supports content-filtered topics and that this subscription
|
|
114
129
|
* has an active wellformed content-filter.
|
package/lib/time.js
CHANGED
package/lib/time_source.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
'use strict';
|
|
16
16
|
|
|
17
|
-
const rclnodejs = require('
|
|
17
|
+
const rclnodejs = require('./native_loader.js');
|
|
18
18
|
const { Clock, ROSClock } = require('./clock.js');
|
|
19
19
|
const { ClockType } = Clock;
|
|
20
20
|
const { Parameter, ParameterType } = require('./parameter.js');
|
package/lib/timer.js
CHANGED
package/lib/utils.js
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
// Copyright (c) 2025, The Robot Web Tools Contributors
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
const fs = require('fs');
|
|
16
|
+
const fsPromises = require('fs/promises');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Ensure directory exists, create recursively if needed (async)
|
|
21
|
+
* Replaces: fse.ensureDir() / fse.mkdirs()
|
|
22
|
+
* @param {string} dirPath - Path to directory
|
|
23
|
+
* @returns {Promise<void>}
|
|
24
|
+
*/
|
|
25
|
+
async function ensureDir(dirPath) {
|
|
26
|
+
try {
|
|
27
|
+
await fsPromises.mkdir(dirPath, { recursive: true });
|
|
28
|
+
} catch (err) {
|
|
29
|
+
// Ignore if directory already exists
|
|
30
|
+
if (err.code !== 'EEXIST') throw err;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Ensure directory exists, create recursively if needed (sync)
|
|
36
|
+
* Replaces: fse.mkdirSync()
|
|
37
|
+
* @param {string} dirPath - Path to directory
|
|
38
|
+
*/
|
|
39
|
+
function ensureDirSync(dirPath) {
|
|
40
|
+
try {
|
|
41
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
42
|
+
} catch (err) {
|
|
43
|
+
// Ignore if directory already exists
|
|
44
|
+
if (err.code !== 'EEXIST') throw err;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Check if path exists (async)
|
|
50
|
+
* Replaces: fse.exists()
|
|
51
|
+
* @param {string} filePath - Path to check
|
|
52
|
+
* @returns {Promise<boolean>}
|
|
53
|
+
*/
|
|
54
|
+
async function pathExists(filePath) {
|
|
55
|
+
try {
|
|
56
|
+
await fsPromises.access(filePath);
|
|
57
|
+
return true;
|
|
58
|
+
} catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Empty a directory (remove all contents but keep the directory)
|
|
65
|
+
* Replaces: fse.emptyDir()
|
|
66
|
+
* @param {string} dirPath - Path to directory
|
|
67
|
+
* @returns {Promise<void>}
|
|
68
|
+
*/
|
|
69
|
+
async function emptyDir(dirPath) {
|
|
70
|
+
try {
|
|
71
|
+
const files = await fsPromises.readdir(dirPath);
|
|
72
|
+
await Promise.all(
|
|
73
|
+
files.map((file) =>
|
|
74
|
+
fsPromises.rm(path.join(dirPath, file), {
|
|
75
|
+
recursive: true,
|
|
76
|
+
force: true,
|
|
77
|
+
})
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
} catch (err) {
|
|
81
|
+
// Ignore if directory doesn't exist
|
|
82
|
+
if (err.code !== 'ENOENT') throw err;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Copy file or directory recursively
|
|
88
|
+
* Replaces: fse.copy()
|
|
89
|
+
* @param {string} src - Source path
|
|
90
|
+
* @param {string} dest - Destination path
|
|
91
|
+
* @param {object} options - Copy options
|
|
92
|
+
* @returns {Promise<void>}
|
|
93
|
+
*/
|
|
94
|
+
async function copy(src, dest, options = {}) {
|
|
95
|
+
const opts = {
|
|
96
|
+
recursive: true,
|
|
97
|
+
force: options.overwrite !== false,
|
|
98
|
+
...options,
|
|
99
|
+
};
|
|
100
|
+
await fsPromises.cp(src, dest, opts);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Read and parse JSON file synchronously
|
|
105
|
+
* Replaces: fse.readJsonSync()
|
|
106
|
+
* @param {string} filePath - Path to JSON file
|
|
107
|
+
* @param {object} options - Read options
|
|
108
|
+
* @returns {any} Parsed JSON data
|
|
109
|
+
*/
|
|
110
|
+
function readJsonSync(filePath, options = {}) {
|
|
111
|
+
const content = fs.readFileSync(filePath, options.encoding || 'utf8');
|
|
112
|
+
return JSON.parse(content);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Remove file or directory (async)
|
|
117
|
+
* Replaces: fse.remove()
|
|
118
|
+
* @param {string} filePath - Path to remove
|
|
119
|
+
* @returns {Promise<void>}
|
|
120
|
+
*/
|
|
121
|
+
async function remove(filePath) {
|
|
122
|
+
try {
|
|
123
|
+
await fsPromises.rm(filePath, { recursive: true, force: true });
|
|
124
|
+
} catch (err) {
|
|
125
|
+
// Ignore if path doesn't exist
|
|
126
|
+
if (err.code !== 'ENOENT') throw err;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Remove file or directory (sync)
|
|
132
|
+
* Replaces: fse.removeSync()
|
|
133
|
+
* @param {string} filePath - Path to remove
|
|
134
|
+
*/
|
|
135
|
+
function removeSync(filePath) {
|
|
136
|
+
try {
|
|
137
|
+
fs.rmSync(filePath, { recursive: true, force: true });
|
|
138
|
+
} catch (err) {
|
|
139
|
+
// Ignore if path doesn't exist
|
|
140
|
+
if (err.code !== 'ENOENT') throw err;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Write file with content (async)
|
|
146
|
+
* Replaces: fse.writeFile()
|
|
147
|
+
* @param {string} filePath - Path to file
|
|
148
|
+
* @param {string|Buffer} data - Content to write
|
|
149
|
+
* @param {object} options - Write options
|
|
150
|
+
* @returns {Promise<void>}
|
|
151
|
+
*/
|
|
152
|
+
async function writeFile(filePath, data, options = {}) {
|
|
153
|
+
await fsPromises.writeFile(filePath, data, options);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Create directory (async)
|
|
158
|
+
* Replaces: fse.mkdir()
|
|
159
|
+
* @param {string} dirPath - Path to directory
|
|
160
|
+
* @param {object} options - mkdir options
|
|
161
|
+
* @returns {Promise<void>}
|
|
162
|
+
*/
|
|
163
|
+
async function mkdir(dirPath, options = {}) {
|
|
164
|
+
await fsPromises.mkdir(dirPath, options);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Detect Ubuntu codename from /etc/os-release
|
|
169
|
+
* @returns {string|null} Ubuntu codename (e.g., 'noble', 'jammy') or null if not detectable
|
|
170
|
+
*/
|
|
171
|
+
function detectUbuntuCodename() {
|
|
172
|
+
if (process.platform !== 'linux') {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
try {
|
|
177
|
+
const osRelease = fs.readFileSync('/etc/os-release', 'utf8');
|
|
178
|
+
const match = osRelease.match(/^VERSION_CODENAME=(.*)$/m);
|
|
179
|
+
return match ? match[1].trim() : null;
|
|
180
|
+
} catch {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Check if two numbers are equal within a given tolerance.
|
|
187
|
+
*
|
|
188
|
+
* This function compares two numbers using both relative and absolute tolerance,
|
|
189
|
+
* matching the behavior of the 'is-close' npm package.
|
|
190
|
+
*
|
|
191
|
+
* The comparison uses the formula:
|
|
192
|
+
* abs(a - b) <= max(rtol * max(abs(a), abs(b)), atol)
|
|
193
|
+
*
|
|
194
|
+
* Implementation checks:
|
|
195
|
+
* 1. Absolute tolerance: abs(a - b) <= atol
|
|
196
|
+
* 2. Relative tolerance: abs(a - b) / max(abs(a), abs(b)) <= rtol
|
|
197
|
+
*
|
|
198
|
+
* @param {number} a - The first number to compare
|
|
199
|
+
* @param {number} b - The second number to compare
|
|
200
|
+
* @param {number} [rtol=1e-9] - The relative tolerance parameter (default: 1e-9)
|
|
201
|
+
* @param {number} [atol=0.0] - The absolute tolerance parameter (default: 0.0)
|
|
202
|
+
* @returns {boolean} True if the numbers are close within the tolerance
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* isClose(1.0, 1.0) // true - exact equality
|
|
206
|
+
* isClose(1.0, 1.1, 0.01) // false - relative diff: 0.1/1.1 ≈ 0.091 > 0.01
|
|
207
|
+
* isClose(10, 10.00001, 1e-6) // true - relative diff: 0.00001/10 = 1e-6 <= 1e-6
|
|
208
|
+
* isClose(0, 0.05, 0, 0.1) // true - absolute diff: 0.05 <= 0.1 (atol)
|
|
209
|
+
*/
|
|
210
|
+
function isClose(a, b, rtol = 1e-9, atol = 0.0) {
|
|
211
|
+
// Handle exact equality
|
|
212
|
+
if (a === b) {
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Handle non-finite numbers
|
|
217
|
+
if (!Number.isFinite(a) || !Number.isFinite(b)) {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const absDiff = Math.abs(a - b);
|
|
222
|
+
|
|
223
|
+
// Check absolute tolerance first (optimization)
|
|
224
|
+
if (atol >= absDiff) {
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Check relative tolerance
|
|
229
|
+
const relativeScaler = Math.max(Math.abs(a), Math.abs(b));
|
|
230
|
+
|
|
231
|
+
// Handle division by zero when both values are zero or very close to zero
|
|
232
|
+
if (relativeScaler === 0) {
|
|
233
|
+
return true; // Both are zero, already handled by absolute tolerance
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const relativeDiff = absDiff / relativeScaler;
|
|
237
|
+
|
|
238
|
+
return rtol >= relativeDiff;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Compare two semantic version strings.
|
|
243
|
+
*
|
|
244
|
+
* Supports version strings in the format: x.y.z or x.y.z.w
|
|
245
|
+
* where x, y, z, w are integers.
|
|
246
|
+
*
|
|
247
|
+
* @param {string} version1 - First version string (e.g., '1.2.3')
|
|
248
|
+
* @param {string} version2 - Second version string (e.g., '1.2.4')
|
|
249
|
+
* @param {string} operator - Comparison operator: '<', '<=', '>', '>=', '==', '!='
|
|
250
|
+
* @returns {boolean} Result of the comparison
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* compareVersions('1.2.3', '1.2.4', '<') // true
|
|
254
|
+
* compareVersions('2.0.0', '1.9.9', '>') // true
|
|
255
|
+
* compareVersions('1.2.3', '1.2.3', '==') // true
|
|
256
|
+
* compareVersions('1.2.3', '1.2.3', '>=') // true
|
|
257
|
+
*/
|
|
258
|
+
function compareVersions(version1, version2, operator) {
|
|
259
|
+
// Parse version strings into arrays of integers
|
|
260
|
+
const v1Parts = version1.split('.').map((part) => parseInt(part, 10));
|
|
261
|
+
const v2Parts = version2.split('.').map((part) => parseInt(part, 10));
|
|
262
|
+
|
|
263
|
+
// Pad arrays to same length with zeros
|
|
264
|
+
const maxLength = Math.max(v1Parts.length, v2Parts.length);
|
|
265
|
+
while (v1Parts.length < maxLength) v1Parts.push(0);
|
|
266
|
+
while (v2Parts.length < maxLength) v2Parts.push(0);
|
|
267
|
+
|
|
268
|
+
// Compare each part
|
|
269
|
+
let cmp = 0;
|
|
270
|
+
for (let i = 0; i < maxLength; i++) {
|
|
271
|
+
if (v1Parts[i] > v2Parts[i]) {
|
|
272
|
+
cmp = 1;
|
|
273
|
+
break;
|
|
274
|
+
} else if (v1Parts[i] < v2Parts[i]) {
|
|
275
|
+
cmp = -1;
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Apply operator
|
|
281
|
+
switch (operator) {
|
|
282
|
+
case '<':
|
|
283
|
+
return cmp < 0;
|
|
284
|
+
case '<=':
|
|
285
|
+
return cmp <= 0;
|
|
286
|
+
case '>':
|
|
287
|
+
return cmp > 0;
|
|
288
|
+
case '>=':
|
|
289
|
+
return cmp >= 0;
|
|
290
|
+
case '==':
|
|
291
|
+
case '===':
|
|
292
|
+
return cmp === 0;
|
|
293
|
+
case '!=':
|
|
294
|
+
case '!==':
|
|
295
|
+
return cmp !== 0;
|
|
296
|
+
default:
|
|
297
|
+
throw new Error(`Invalid operator: ${operator}`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
module.exports = {
|
|
302
|
+
// General utilities
|
|
303
|
+
detectUbuntuCodename,
|
|
304
|
+
isClose,
|
|
305
|
+
|
|
306
|
+
// File system utilities (async)
|
|
307
|
+
ensureDir,
|
|
308
|
+
mkdirs: ensureDir, // Alias for fs-extra compatibility
|
|
309
|
+
exists: pathExists, // Renamed to avoid conflict with deprecated fs.exists
|
|
310
|
+
pathExists,
|
|
311
|
+
emptyDir,
|
|
312
|
+
copy,
|
|
313
|
+
remove,
|
|
314
|
+
writeFile,
|
|
315
|
+
mkdir,
|
|
316
|
+
|
|
317
|
+
// File system utilities (sync)
|
|
318
|
+
ensureDirSync,
|
|
319
|
+
mkdirSync: ensureDirSync, // Alias for fs-extra compatibility
|
|
320
|
+
removeSync,
|
|
321
|
+
readJsonSync,
|
|
322
|
+
|
|
323
|
+
compareVersions,
|
|
324
|
+
};
|
package/lib/validator.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rclnodejs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "ROS2.0 JavaScript client with Node.js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"rebuild:dev": "npm run clean && node-gyp -j 16 rebuild --debug",
|
|
20
20
|
"generate-messages": "node scripts/generate_messages.js",
|
|
21
21
|
"generate-messages-idl": "node scripts/generate_messages.js --idl",
|
|
22
|
-
"generate-messages:dev": "node scripts/generate_messages.js --debug
|
|
22
|
+
"generate-messages:dev": "node scripts/generate_messages.js --debug",
|
|
23
23
|
"generate-tsd-messages": "node scripts/generate_tsd.js",
|
|
24
24
|
"clean": "node-gyp clean && npx rimraf ./generated",
|
|
25
|
-
"install": "
|
|
25
|
+
"install": "node scripts/install.js",
|
|
26
26
|
"postinstall": "npm run generate-messages",
|
|
27
27
|
"docs": "cd docs && make",
|
|
28
28
|
"test": "nyc node --expose-gc ./scripts/run_test.js && tsd",
|
|
@@ -30,13 +30,14 @@
|
|
|
30
30
|
"lint": "eslint && node ./scripts/cpplint.js",
|
|
31
31
|
"format": "clang-format -i -style=file ./src/*.cpp ./src/*.h && npx --yes prettier --write \"{lib,rosidl_gen,rostsd_gen,rosidl_parser,types,example,test,scripts,benchmark,rostsd_gen}/**/*.{js,md,ts}\" ./*.{js,md,ts}",
|
|
32
32
|
"prepare": "husky",
|
|
33
|
-
"coverage": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
|
|
33
|
+
"coverage": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
|
34
|
+
"prebuild": "prebuildify --napi --strip --target 16.20.2 --target electron@23.0.0 && node scripts/tag_prebuilds.js"
|
|
34
35
|
},
|
|
35
36
|
"bin": {
|
|
36
37
|
"generate-ros-messages": "./scripts/generate_messages.js"
|
|
37
38
|
},
|
|
38
39
|
"authors": [
|
|
39
|
-
"Minggang Wang <
|
|
40
|
+
"Minggang Wang <minggangw@gmail.com>",
|
|
40
41
|
"Kenny Yuan <kaining.yuan@intel.com>",
|
|
41
42
|
"Wanming Lin <wanming.lin@intel.com>",
|
|
42
43
|
"Zhong Qiu <zhongx.qiu@intel.com>"
|
|
@@ -47,8 +48,8 @@
|
|
|
47
48
|
"url": "git+https://github.com/RobotWebTools/rclnodejs.git"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
|
-
"@eslint/js": "^
|
|
51
|
-
"@types/node": "^
|
|
51
|
+
"@eslint/js": "^9.36.0",
|
|
52
|
+
"@types/node": "^24.5.2",
|
|
52
53
|
"@typescript-eslint/eslint-plugin": "^8.18.0",
|
|
53
54
|
"@typescript-eslint/parser": "^8.18.0",
|
|
54
55
|
"clang-format": "^1.8.0",
|
|
@@ -61,29 +62,24 @@
|
|
|
61
62
|
"globals": "^16.0.0",
|
|
62
63
|
"husky": "^9.1.7",
|
|
63
64
|
"jsdoc": "^4.0.4",
|
|
64
|
-
"lint-staged": "^
|
|
65
|
+
"lint-staged": "^16.2.0",
|
|
65
66
|
"mocha": "^11.0.2",
|
|
66
67
|
"nyc": "^17.1.0",
|
|
68
|
+
"prebuildify": "^6.0.1",
|
|
67
69
|
"rimraf": "^6.0.1",
|
|
68
|
-
"sinon": "^
|
|
70
|
+
"sinon": "^21.0.0",
|
|
69
71
|
"tree-kill": "^1.2.2",
|
|
70
|
-
"tsd": "^0.
|
|
72
|
+
"tsd": "^0.33.0",
|
|
71
73
|
"typescript": "^5.7.2"
|
|
72
74
|
},
|
|
73
75
|
"dependencies": {
|
|
74
76
|
"@rclnodejs/ref-array-di": "^1.2.2",
|
|
75
|
-
"@rclnodejs/ref-napi": "^4.0.0",
|
|
76
77
|
"@rclnodejs/ref-struct-di": "^1.1.1",
|
|
77
78
|
"bindings": "^1.5.0",
|
|
78
|
-
"compare-versions": "^6.1.1",
|
|
79
79
|
"debug": "^4.4.0",
|
|
80
|
-
"dot": "^1.1.3",
|
|
81
|
-
"fs-extra": "^11.2.0",
|
|
82
|
-
"is-close": "^1.3.3",
|
|
83
80
|
"json-bigint": "^1.0.0",
|
|
84
|
-
"
|
|
85
|
-
"walk": "^2.3.15"
|
|
86
|
-
"node-addon-api": "^8.3.1"
|
|
81
|
+
"node-addon-api": "^8.3.1",
|
|
82
|
+
"walk": "^2.3.15"
|
|
87
83
|
},
|
|
88
84
|
"husky": {
|
|
89
85
|
"hooks": {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -14,15 +14,16 @@
|
|
|
14
14
|
|
|
15
15
|
'use strict';
|
|
16
16
|
|
|
17
|
+
const fs = require('fs');
|
|
17
18
|
const path = require('path');
|
|
18
|
-
const fse = require('
|
|
19
|
+
const fse = require('../lib/utils.js');
|
|
19
20
|
const execFile = require('child_process').execFile;
|
|
20
21
|
const pythonExecutable =
|
|
21
22
|
require('../rosidl_parser/py_utils').getPythonExecutable('python3');
|
|
22
23
|
|
|
23
24
|
async function convertIDLToROS2IDL(pkgName, idlFilePath, outputDir) {
|
|
24
25
|
const packagePath = path.join(outputDir, pkgName);
|
|
25
|
-
if (!
|
|
26
|
+
if (!fs.existsSync(packagePath)) {
|
|
26
27
|
fse.mkdirSync(packagePath);
|
|
27
28
|
}
|
|
28
29
|
return new Promise((resolve, reject) => {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
|
|
15
|
-
const fse = require('
|
|
15
|
+
const fse = require('../lib/utils.js');
|
|
16
16
|
const generateJSStructFromIDL = require('./idl_generator.js');
|
|
17
17
|
const packages = require('./packages.js');
|
|
18
18
|
const path = require('path');
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "Generate JavaScript object from ROS IDL(.msg/.srv/.action/.idl) files",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"authors": [
|
|
7
|
-
"Minggang Wang <
|
|
7
|
+
"Minggang Wang <minggangw@gmail.com>",
|
|
8
8
|
"Kenny Yuan <kaining.yuan@intel.com>"
|
|
9
9
|
],
|
|
10
10
|
"license": "Apache-2.0"
|