rclnodejs 1.5.1 → 1.5.2

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 (46) hide show
  1. package/README.md +25 -2
  2. package/binding.gyp +2 -0
  3. package/index.js +1 -1
  4. package/lib/action/client.js +1 -1
  5. package/lib/action/graph.js +1 -1
  6. package/lib/action/server.js +1 -1
  7. package/lib/action/server_goal_handle.js +1 -1
  8. package/lib/client.js +1 -1
  9. package/lib/clock.js +1 -1
  10. package/lib/context.js +1 -1
  11. package/lib/duration.js +1 -1
  12. package/lib/event_handler.js +1 -1
  13. package/lib/guard_condition.js +1 -1
  14. package/lib/lifecycle.js +1 -1
  15. package/lib/lifecycle_publisher.js +1 -1
  16. package/lib/logging.js +1 -1
  17. package/lib/native_loader.js +173 -0
  18. package/lib/node.js +1 -1
  19. package/lib/publisher.js +1 -1
  20. package/lib/serialization.js +1 -1
  21. package/lib/service.js +1 -1
  22. package/lib/subscription.js +1 -1
  23. package/lib/time.js +1 -1
  24. package/lib/time_source.js +1 -1
  25. package/lib/timer.js +1 -1
  26. package/lib/type_description_service.js +1 -1
  27. package/lib/utils.js +37 -0
  28. package/lib/validator.js +1 -1
  29. package/package.json +13 -12
  30. package/prebuilds/linux-arm64/humble-jammy-arm64-rclnodejs.node +0 -0
  31. package/prebuilds/linux-arm64/jazzy-noble-arm64-rclnodejs.node +0 -0
  32. package/prebuilds/linux-arm64/kilted-noble-arm64-rclnodejs.node +0 -0
  33. package/prebuilds/linux-x64/humble-jammy-x64-rclnodejs.node +0 -0
  34. package/prebuilds/linux-x64/jazzy-noble-x64-rclnodejs.node +0 -0
  35. package/prebuilds/linux-x64/kilted-noble-x64-rclnodejs.node +0 -0
  36. package/rosidl_gen/deallocator.js +1 -1
  37. package/rosidl_gen/generator.json +1 -1
  38. package/rosidl_gen/primitive_types.js +2 -2
  39. package/rosidl_gen/templates/message.dot +2 -2
  40. package/scripts/install.js +113 -0
  41. package/scripts/tag_prebuilds.js +70 -0
  42. package/src/addon.cpp +3 -0
  43. package/third_party/ref-napi/index.js +15 -0
  44. package/third_party/ref-napi/lib/ref.js +1741 -0
  45. package/third_party/ref-napi/src/ref_napi_bindings.cpp +736 -0
  46. package/third_party/ref-napi/src/ref_napi_bindings.h +26 -0
package/README.md CHANGED
@@ -31,6 +31,26 @@ npm i rclnodejs
31
31
 
32
32
  - **Note:** to install rclnodejs from GitHub: add `"rclnodejs":"RobotWebTools/rclnodejs#<branch>"` to your `package.json` dependency section.
33
33
 
34
+ ### Prebuilt Binaries
35
+
36
+ rclnodejs ships with prebuilt native binaries for common Linux configurations since `v1.5.2`, eliminating the need for compilation during installation. This significantly speeds up installation and reduces dependencies.
37
+
38
+ **Supported Platforms:**
39
+
40
+ - **Ubuntu 22.04 (Jammy)** - ROS 2 Humble
41
+ - **Ubuntu 24.04 (Noble)** - ROS 2 Jazzy, Kilted
42
+ - **Architectures:** x64, arm64
43
+ - **Node.js:** >= 16.20.2 (N-API compatible)
44
+
45
+ **Force Building from Source:**
46
+
47
+ If you need to build from source even when a prebuilt binary is available, set the environment variable:
48
+
49
+ ```bash
50
+ export RCLNODEJS_FORCE_BUILD=1
51
+ npm install rclnodejs
52
+ ```
53
+
34
54
  ## Documentation
35
55
 
36
56
  API [documentation](https://robotwebtools.github.io/rclnodejs/docs/index.html) is available online.
@@ -73,9 +93,12 @@ See [TypeScript demos](https://github.com/RobotWebTools/rclnodejs/tree/develop/t
73
93
 
74
94
  Create rich, interactive desktop applications using Electron and web technologies like Three.js. Build 3D visualizations, monitoring dashboards, and control interfaces that run on Windows, macOS, and Linux.
75
95
 
76
- Try the `electron_demo/turtle_tf2` demo for real-time coordinate frame visualization with dynamic transforms and keyboard-controlled turtle movement. More examples in [electron_demo](https://github.com/RobotWebTools/rclnodejs/tree/develop/electron_demo).
96
+ | Demo | Description | Screenshot |
97
+ | :-----------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------: |
98
+ | **🐢 [turtle_tf2](https://github.com/RobotWebTools/rclnodejs/tree/develop/electron_demo/turtle_tf2)** | Real-time coordinate frame visualization with turtle control. Features TF2 transforms, keyboard control, and dynamic frame updates. | ![turtle_tf2](https://github.com/RobotWebTools/rclnodejs/blob/develop/electron_demo/turtle_tf2/turtle-tf2-demo.png?raw=true) |
99
+ | **🦾 [manipulator](https://github.com/RobotWebTools/rclnodejs/tree/develop/electron_demo/manipulator)** | Interactive two-joint robotic arm simulation. Features 3D joint visualization, manual/automatic control, and visual movement markers. | ![manipulator](https://github.com/RobotWebTools/rclnodejs/blob/develop/electron_demo/manipulator/manipulator-demo.png?raw=true) |
77
100
 
78
- ![demo screenshot](https://github.com/RobotWebTools/rclnodejs/blob/develop/electron_demo/turtle_tf2/turtle-tf2-demo.gif?raw=true)
101
+ Explore more examples in [electron_demo](https://github.com/RobotWebTools/rclnodejs/tree/develop/electron_demo).
79
102
 
80
103
  ## License
81
104
 
package/binding.gyp CHANGED
@@ -42,9 +42,11 @@
42
42
  './src/rcl_timer_bindings.cpp',
43
43
  './src/rcl_utilities.cpp',
44
44
  './src/shadow_node.cpp',
45
+ './third_party/ref-napi/src/ref_napi_bindings.cpp',
45
46
  ],
46
47
  'include_dirs': [
47
48
  '.',
49
+ './third_party/ref-napi/src',
48
50
  '<(ros_include_root)',
49
51
  "<!@(node -p \"require('node-addon-api').include\")",
50
52
  ],
package/index.js CHANGED
@@ -37,7 +37,7 @@ const {
37
37
  } = require('./lib/parameter.js');
38
38
  const path = require('path');
39
39
  const QoS = require('./lib/qos.js');
40
- const rclnodejs = require('bindings')('rclnodejs');
40
+ const rclnodejs = require('./lib/native_loader.js');
41
41
  const tsdGenerator = require('./rostsd_gen/index.js');
42
42
  const validator = require('./lib/validator.js');
43
43
  const Time = require('./lib/time.js');
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('../native_loader.js');
18
18
  const ActionInterfaces = require('./interfaces.js');
19
19
  const ActionUuid = require('./uuid.js');
20
20
  const ClientGoalHandle = require('./client_goal_handle.js');
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('../native_loader.js');
18
18
 
19
19
  /**
20
20
  * Get a list of action names and types for action clients associated with a node.
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('../native_loader.js');
18
18
  const ActionInterfaces = require('./interfaces.js');
19
19
  const ActionUuid = require('./uuid.js');
20
20
  const DistroUtils = require('../distro.js');
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('../native_loader.js');
18
18
  const ActionInterfaces = require('./interfaces.js');
19
19
  const Deferred = require('./deferred.js');
20
20
  const { GoalEvent } = require('./response.js');
package/lib/client.js CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
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:client');
package/lib/clock.js CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
  const Time = require('./time.js');
19
19
  const ClockType = require('./clock_type.js');
20
20
 
package/lib/context.js CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
 
19
19
  let defaultContext = null;
20
20
 
package/lib/duration.js CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
  const S_TO_NS = 10n ** 9n;
19
19
 
20
20
  /**
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
  const DistroUtils = require('./distro.js');
19
19
  const Entity = require('./entity.js');
20
20
 
@@ -12,7 +12,7 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const rclnodejs = require('bindings')('rclnodejs');
15
+ const rclnodejs = require('./native_loader.js');
16
16
  const Entity = require('./entity.js');
17
17
  const Context = require('./context.js');
18
18
 
package/lib/lifecycle.js CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
  const LifecyclePublisher = require('./lifecycle_publisher.js');
19
19
  const loader = require('./interface_loader.js');
20
20
  const Context = require('./context.js');
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
  const Logging = require('./logging.js');
19
19
  const Publisher = require('./publisher.js');
20
20
 
package/lib/logging.js CHANGED
@@ -15,7 +15,7 @@
15
15
  'use strict';
16
16
 
17
17
  const path = require('path');
18
- const rclnodejs = require('bindings')('rclnodejs');
18
+ const rclnodejs = require('./native_loader.js');
19
19
 
20
20
  /**
21
21
  * Enum for LoggingSeverity
@@ -0,0 +1,173 @@
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
+ 'use strict';
16
+
17
+ const fs = require('fs');
18
+ const path = require('path');
19
+ const { execSync } = require('child_process');
20
+ const bindings = require('bindings');
21
+ const debug = require('debug')('rclnodejs');
22
+ const { detectUbuntuCodename } = require('./utils');
23
+
24
+ let nativeModule = null;
25
+
26
+ // Simplified loader: only use prebuilt binaries with exact Ubuntu/ROS2/arch match
27
+ // Note: Prebuilt binaries are only supported on Linux (Ubuntu) platform
28
+ function customFallbackLoader() {
29
+ // Prebuilt binaries are only for Linux platform
30
+ if (process.platform !== 'linux') {
31
+ debug('Prebuilt binaries are only supported on Linux platform');
32
+ return null;
33
+ }
34
+
35
+ const rosDistro = process.env.ROS_DISTRO;
36
+ const arch = process.arch;
37
+ const ubuntuCodename = detectUbuntuCodename();
38
+
39
+ // Require all three components for exact match
40
+ if (!rosDistro || !ubuntuCodename || !arch) {
41
+ debug(
42
+ `Missing environment info - ROS: ${rosDistro}, Ubuntu: ${ubuntuCodename}, Arch: ${arch}`
43
+ );
44
+ return null;
45
+ }
46
+
47
+ const prebuildDir = path.join(
48
+ __dirname,
49
+ '..',
50
+ 'prebuilds',
51
+ `${process.platform}-${arch}`
52
+ );
53
+
54
+ if (!fs.existsSync(prebuildDir)) {
55
+ debug('No prebuilds directory found');
56
+ return null;
57
+ }
58
+
59
+ try {
60
+ // Look for exact match binary: {ros_distro}-{ubuntu_codename}-{arch}-rclnodejs.node
61
+ const exactMatchFilename = `${rosDistro}-${ubuntuCodename}-${arch}-rclnodejs.node`;
62
+ const exactMatchPath = path.join(prebuildDir, exactMatchFilename);
63
+
64
+ if (fs.existsSync(exactMatchPath)) {
65
+ debug(`Found exact match binary: ${exactMatchFilename}`);
66
+ return require(exactMatchPath);
67
+ }
68
+
69
+ debug(`No exact match found for: ${exactMatchFilename}`);
70
+ return null;
71
+ } catch (e) {
72
+ debug('Error in simplified prebuilt loader:', e.message);
73
+ }
74
+
75
+ return null;
76
+ }
77
+
78
+ // Simplified prebuilt binary loader: exact match or build from source
79
+ function loadNativeAddon() {
80
+ if (nativeModule) {
81
+ return nativeModule;
82
+ }
83
+
84
+ // Environment variable to force building from source
85
+ if (process.env.RCLNODEJS_FORCE_BUILD === '1') {
86
+ debug('Forcing build from source (RCLNODEJS_FORCE_BUILD=1)');
87
+
88
+ // Trigger actual compilation
89
+ try {
90
+ debug('Running forced node-gyp rebuild...');
91
+ execSync('npm run rebuild', {
92
+ stdio: 'inherit',
93
+ cwd: path.join(__dirname, '..'),
94
+ timeout: 300000, // 5 minute timeout
95
+ });
96
+
97
+ // Load the newly built binary
98
+ nativeModule = bindings('rclnodejs');
99
+ debug('Successfully force compiled and loaded from source');
100
+ return nativeModule;
101
+ } catch (compileError) {
102
+ debug('Forced compilation failed:', compileError.message);
103
+ throw new Error(
104
+ `Failed to force build rclnodejs from source: ${compileError.message}`
105
+ );
106
+ }
107
+ }
108
+
109
+ const rosDistro = process.env.ROS_DISTRO;
110
+ const ubuntuCodename = detectUbuntuCodename();
111
+
112
+ debug(
113
+ `Platform: ${process.platform}, Arch: ${process.arch}, Ubuntu: ${ubuntuCodename || 'unknown'}, ROS: ${rosDistro || 'unknown'}`
114
+ );
115
+
116
+ // Prebuilt binaries are only supported on Linux (Ubuntu)
117
+ if (process.platform === 'linux') {
118
+ // Try exact match prebuilt binary first
119
+ try {
120
+ const prebuiltModule = customFallbackLoader();
121
+ if (prebuiltModule) {
122
+ nativeModule = prebuiltModule;
123
+ return nativeModule;
124
+ }
125
+ } catch (e) {
126
+ debug('Exact match prebuilt loading failed:', e.message);
127
+ }
128
+
129
+ debug(
130
+ 'No exact match prebuilt binary found, falling back to build from source'
131
+ );
132
+ } else {
133
+ debug(
134
+ `Platform ${process.platform} does not support prebuilt binaries, will try existing build or compile from source`
135
+ );
136
+ }
137
+
138
+ try {
139
+ // Try to find existing built binary first (works on all platforms)
140
+ // The 'bindings' module will search standard locations like:
141
+ // - build/Release/rclnodejs.node
142
+ // - build/Debug/rclnodejs.node
143
+ // - compiled/{node_version}/{platform}/{arch}/rclnodejs.node
144
+ // etc.
145
+ nativeModule = bindings('rclnodejs');
146
+ debug('Found and loaded existing built binary');
147
+ return nativeModule;
148
+ } catch {
149
+ debug('No existing built binary found, triggering compilation...');
150
+
151
+ // Trigger actual compilation
152
+ try {
153
+ debug('Running node-gyp rebuild...');
154
+ execSync('npm run rebuild', {
155
+ stdio: 'inherit',
156
+ cwd: path.join(__dirname, '..'),
157
+ timeout: 300000, // 5 minute timeout
158
+ });
159
+
160
+ // Try to load the newly built binary
161
+ nativeModule = bindings('rclnodejs');
162
+ debug('Successfully compiled and loaded from source');
163
+ return nativeModule;
164
+ } catch (compileError) {
165
+ debug('Compilation failed:', compileError.message);
166
+ throw new Error(
167
+ `Failed to build rclnodejs from source: ${compileError.message}`
168
+ );
169
+ }
170
+ }
171
+ }
172
+
173
+ module.exports = loadNativeAddon();
package/lib/node.js CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
 
19
19
  const ActionInterfaces = require('./action/interfaces.js');
20
20
  const Client = require('./client.js');
package/lib/publisher.js CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
  const debug = require('debug')('rclnodejs:publisher');
19
19
  const Entity = require('./entity.js');
20
20
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
 
19
19
  class Serialization {
20
20
  /**
package/lib/service.js CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
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');
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
  const Entity = require('./entity.js');
19
19
  const debug = require('debug')('rclnodejs:subscription');
20
20
 
package/lib/time.js CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
  const Duration = require('./duration.js');
19
19
  const ClockType = require('./clock_type.js');
20
20
  const S_TO_NS = 10n ** 9n;
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
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
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
  const DistroUtils = require('./distro.js');
19
19
 
20
20
  /**
@@ -15,7 +15,7 @@
15
15
  'use strict';
16
16
 
17
17
  const loader = require('./interface_loader.js');
18
- const rclnodejs = require('bindings')('rclnodejs');
18
+ const rclnodejs = require('./native_loader.js');
19
19
  const Service = require('./service.js');
20
20
 
21
21
  const {
package/lib/utils.js ADDED
@@ -0,0 +1,37 @@
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
+
17
+ /**
18
+ * Detect Ubuntu codename from /etc/os-release
19
+ * @returns {string|null} Ubuntu codename (e.g., 'noble', 'jammy') or null if not detectable
20
+ */
21
+ function detectUbuntuCodename() {
22
+ if (process.platform !== 'linux') {
23
+ return null;
24
+ }
25
+
26
+ try {
27
+ const osRelease = fs.readFileSync('/etc/os-release', 'utf8');
28
+ const match = osRelease.match(/^VERSION_CODENAME=(.*)$/m);
29
+ return match ? match[1].trim() : null;
30
+ } catch {
31
+ return null;
32
+ }
33
+ }
34
+
35
+ module.exports = {
36
+ detectUbuntuCodename,
37
+ };
package/lib/validator.js CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('./native_loader.js');
18
18
 
19
19
  /**
20
20
  * An object - Representing a validator in ROS.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rclnodejs",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "ROS2.0 JavaScript client with Node.js",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "generate-messages:dev": "node scripts/generate_messages.js --debug && npx --yes prettier --ignore-path --write generated/**/*.js",
23
23
  "generate-tsd-messages": "node scripts/generate_tsd.js",
24
24
  "clean": "node-gyp clean && npx rimraf ./generated",
25
- "install": "npm run rebuild",
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 <minggang.wang@intel.com>",
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": "^10.0.0",
51
- "@types/node": "^22.13.9",
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,18 +62,18 @@
61
62
  "globals": "^16.0.0",
62
63
  "husky": "^9.1.7",
63
64
  "jsdoc": "^4.0.4",
64
- "lint-staged": "^15.2.10",
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": "^19.0.2",
70
+ "sinon": "^21.0.0",
69
71
  "tree-kill": "^1.2.2",
70
- "tsd": "^0.31.2",
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
79
  "compare-versions": "^6.1.1",
@@ -81,9 +82,9 @@
81
82
  "fs-extra": "^11.2.0",
82
83
  "is-close": "^1.3.3",
83
84
  "json-bigint": "^1.0.0",
85
+ "node-addon-api": "^8.3.1",
84
86
  "terser": "^5.39.0",
85
- "walk": "^2.3.15",
86
- "node-addon-api": "^8.3.1"
87
+ "walk": "^2.3.15"
87
88
  },
88
89
  "husky": {
89
90
  "hooks": {
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const rclnodejs = require('bindings')('rclnodejs');
17
+ const rclnodejs = require('../lib/native_loader.js');
18
18
 
19
19
  let deallocator = {
20
20
  delayFreeStructMember(refObj, type, name) {
@@ -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 <minggang.wang@intel.com>",
7
+ "Minggang Wang <minggangw@gmail.com>",
8
8
  "Kenny Yuan <kaining.yuan@intel.com>"
9
9
  ],
10
10
  "license": "Apache-2.0"
@@ -14,9 +14,9 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const ref = require('@rclnodejs/ref-napi');
17
+ const ref = require('../third_party/ref-napi');
18
18
  const StructType = require('@rclnodejs/ref-struct-di')(ref);
19
- const rclnodejs = require('bindings')('rclnodejs');
19
+ const rclnodejs = require('../lib/native_loader.js');
20
20
 
21
21
  const StringRefStruct = StructType({
22
22
  data: ref.types.CString,
@@ -224,9 +224,9 @@ function extractMemberNames(fields) {
224
224
  }}
225
225
 
226
226
  {{? willUseTypedArray}}
227
- const rclnodejs = require('bindings')('rclnodejs');
227
+ const rclnodejs = require('../../lib/native_loader.js');
228
228
  {{?}}
229
- const ref = require('@rclnodejs/ref-napi');
229
+ const ref = require('../../third_party/ref-napi');
230
230
  const StructType = require('@rclnodejs/ref-struct-di')(ref);
231
231
  const ArrayType = require('@rclnodejs/ref-array-di')(ref);
232
232
  const primitiveTypes = require('../../rosidl_gen/primitive_types.js');