Skip to content

Conversation

@minggangw
Copy link
Member

@minggangw minggangw commented Oct 11, 2025

This PR integrates the ref-napi package directly into the rclnodejs native module as a third-party dependency, eliminating the need for separate npm package installation.

  • Vendors the ref-napi package into third_party/ref-napi/ directory
  • Adds native C++ bindings integration into the main addon module
  • Updates all module references to use the vendored version instead of external package

Fix: #1284

Copilot AI review requested due to automatic review settings October 11, 2025 06:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates the ref-napi package directly into the rclnodejs native module as a third-party dependency, eliminating the need for separate npm package installation.

  • Vendors the ref-napi package into third_party/ref-napi/ directory
  • Adds native C++ bindings integration into the main addon module
  • Updates all module references to use the vendored version instead of external package

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
third_party/ref-napi/src/ref_napi_bindings.h Header file defining the InitRefNapi function for integration
third_party/ref-napi/src/ref_napi_bindings.cpp Complete C++ implementation of ref-napi functionality adapted for rclnodejs
third_party/ref-napi/lib/ref.js JavaScript wrapper and API implementation for ref-napi
third_party/ref-napi/index.js Entry point module that re-exports the main ref implementation
src/addon.cpp Integration of ref-napi into main addon exports
rosidl_gen/templates/message.dot Updated require path to use vendored ref-napi
rosidl_gen/primitive_types.js Updated require path to use vendored ref-napi
binding.gyp Added ref-napi source files and include paths to build configuration
Comments suppressed due to low confidence (3)

third_party/ref-napi/src/ref_napi_bindings.cpp:1

  • Grammar error in error message. Should be 'writeInt32: no digits were found in input String'.
// Copyright (c) 2020 The ref-napi Authors.

third_party/ref-napi/src/ref_napi_bindings.cpp:1

  • Grammar error in error message. Should be 'writeInt64: no digits were found in input String'.
// Copyright (c) 2020 The ref-napi Authors.

third_party/ref-napi/src/ref_napi_bindings.cpp:1

  • Grammar error in error message. Should be 'writeUInt64: no digits were found in input String'.
// Copyright (c) 2020 The ref-napi Authors.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

char* ptr = AddressForArgs(args);

if (ptr == nullptr) {
throw TypeError::New(env, "readInt64: Cannot read from nullptr pointer");
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error message says 'readInt64' but this is in the ReadInt32 function. Should be 'readInt32: Cannot read from nullptr pointer'.

Suggested change
throw TypeError::New(env, "readInt64: Cannot read from nullptr pointer");
throw TypeError::New(env, "readInt32: Cannot read from nullptr pointer");

Copilot uses AI. Check for mistakes.
char* ptr = AddressForArgs(args);

if (ptr == nullptr) {
throw Error::New(env, "readObject: Cannot write to nullptr pointer");
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error message says 'readObject' but this is in the WriteObject function. Should be 'writeObject: Cannot write to nullptr pointer'.

Suggested change
throw Error::New(env, "readObject: Cannot write to nullptr pointer");
throw Error::New(env, "writeObject: Cannot write to nullptr pointer");

Copilot uses AI. Check for mistakes.
binding.gyp Outdated
],
'include_dirs': [
'.',
'./third_party/ref-napi/src',
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation. This line should align with the other include_dirs entries using 8 spaces instead of 2.

Copilot uses AI. Check for mistakes.
@minggangw minggangw requested a review from Copilot October 11, 2025 06:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

third_party/ref-napi/src/ref_napi_bindings.cpp:1

  • Error message has grammatical error - should be 'no digits were found' instead of 'no digits we found'.
// Copyright (c) 2020 The ref-napi Authors.

third_party/ref-napi/src/ref_napi_bindings.cpp:1

  • Error message has grammatical error - should be 'no digits were found' instead of 'no digits we found'.
// Copyright (c) 2020 The ref-napi Authors.

third_party/ref-napi/src/ref_napi_bindings.cpp:1

  • Error message has grammatical error - should be 'no digits were found' instead of 'no digits we found'.
// Copyright (c) 2020 The ref-napi Authors.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@minggangw minggangw requested a review from Copilot October 11, 2025 06:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

third_party/ref-napi/src/ref_napi_bindings.cpp:1

  • Error message has grammatical error. Should be 'writeInt32: no digits were found in input String'.
// Copyright (c) 2020 The ref-napi Authors.

third_party/ref-napi/src/ref_napi_bindings.cpp:1

  • Error message has grammatical error. Should be 'writeInt64: no digits were found in input String'.
// Copyright (c) 2020 The ref-napi Authors.

third_party/ref-napi/src/ref_napi_bindings.cpp:1

  • Error message has grammatical error. Should be 'writeUInt64: no digits were found in input String'.
// Copyright (c) 2020 The ref-napi Authors.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@coveralls
Copy link

coveralls commented Oct 11, 2025

Coverage Status

coverage: 84.306% (-0.03%) from 84.337%
when pulling 6145f38 on minggangw:fix-1284
into 8762f13 on RobotWebTools:develop.

@minggangw minggangw merged commit d4d2d7c into RobotWebTools:develop Oct 11, 2025
18 checks passed
@minggangw minggangw mentioned this pull request Oct 13, 2025
minggangw added a commit that referenced this pull request Oct 13, 2025
This PR integrates the `ref-napi` package directly into the rclnodejs native module as a third-party dependency, eliminating the need for separate npm package installation.

- Vendors the ref-napi package into `third_party/ref-napi/` directory
- Adds native C++ bindings integration into the main addon module
- Updates all module references to use the vendored version instead of external package

Fix: #1284
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate rclnodejs/ref-napi into rclnodejs

2 participants