Skip to content

Conversation

@minggangw
Copy link
Member

@minggangw minggangw commented Feb 27, 2025

This patch removes dependency, array.prototype.flat, needed for nodejs prior to version 11.

Fix: #1048

@minggangw minggangw requested a review from Copilot February 27, 2025 07:52
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.

PR Overview

This PR removes the dependency on the external polyfill for Array.prototype.flat by using the native implementation.

  • Removes the import of the "array.prototype.flat" dependency.
  • Simplifies the code by eliminating the conditional check and always using the native flat() method.

Reviewed Changes

File Description
rosidl_gen/packages.js Removes dependency and fallback for Array.prototype.flat.

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


// Support flat() method for nodejs < 11.
const rosFiles = Array.prototype.flat ? files.flat() : flat(files);
const rosFiles = files.flat();
Copy link

Copilot AI Feb 27, 2025

Choose a reason for hiding this comment

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

By removing the dependency and conditional fallback, the code now assumes that Array.prototype.flat is always available. Please ensure the project's minimum Node.js version is set to 11 or higher to avoid runtime issues.

Copilot uses AI. Check for mistakes.
@minggangw minggangw merged commit 7bd1f55 into RobotWebTools:develop Feb 27, 2025
6 checks passed
minggangw added a commit that referenced this pull request Mar 6, 2025
This patch removes dependency, `array.prototype.flat`, needed for nodejs prior to version 11.

Fix: #1048
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.

Remove depenency array.prototype.flat

1 participant