Skip to content

Avoid using deprecated Buffer constructor - #490

Open
mbianchidev wants to merge 9 commits into
actions:mainfrom
mbianchidev:main
Open

mbianchidev wants to merge 9 commits into
actions:mainfrom
mbianchidev:main

Conversation

@mbianchidev

Copy link
Copy Markdown

This pull request addresses the use of deprecated Buffer constructors in several runtime dependencies by applying targeted patches and adding automated tests to ensure compliance. It also introduces patch-package as a dependency and configures it to run automatically after installation.

Dependency modernization and maintenance:

  • Added patch-package as a dependency and configured it to run automatically after install via the postinstall script in package.json. This ensures that necessary patches are always applied to dependencies after installation.

Patching runtime dependencies to avoid deprecated Buffer usage:

  • Added patch files for binary, buffers, tunnel, and unzip-stream packages to replace deprecated new Buffer() and similar patterns with the recommended Buffer.from() and Buffer.alloc() APIs, ensuring compatibility with newer Node.js versions and preventing deprecation warnings or errors.

Testing and validation:

  • Introduced a new test suite (__tests__/dependencies.test.ts) that verifies the patched dependencies (unzip-stream, binary, buffers, and tunnel) do not trigger deprecated Buffer warnings or errors when run with strict deprecation flags, ensuring the effectiveness of the applied patches.

Copilot AI and others added 6 commits September 18, 2026 10:25
Co-authored-by: mbianchidev <37507190+mbianchidev@users.noreply.github.com>
Co-authored-by: mbianchidev <37507190+mbianchidev@users.noreply.github.com>
Co-authored-by: mbianchidev <37507190+mbianchidev@users.noreply.github.com>
Co-authored-by: mbianchidev <37507190+mbianchidev@users.noreply.github.com>
…recated

Avoid deprecated Buffer constructors in runtime dependencies
@mbianchidev
mbianchidev requested a review from a team as a code owner September 18, 2026 16:01
Copilot AI lite review requested due to automatic review settings September 18, 2026 16:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Add the required .licenses/npm entries for patch-package and its production-reachable transitive dependencies.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Updates runtime dependencies to replace deprecated Buffer constructors and validates the patched dependencies under strict deprecation handling.

Changes:

  • Adds patch-package with automatic post-install patching.
  • Patches binary, buffers, tunnel, and unzip-stream.
  • Updates bundled code and adds dependency tests.
  • Requires license cache entries for the new production dependency tree.
File Description
patches/​unzip-stream+0.3.4.patch Replaces deprecated Buffer usage.
patches/​tunnel+0.0.6.patch Replaces deprecated Buffer usage.
patches/​buffers+0.1.1.patch Replaces deprecated Buffer usage.
patches/​binary+0.3.0.patch Replaces deprecated Buffer usage.
package.json Adds patch-package and post-install patching; license cache entries are missing.
package-lock.json Locks the new dependency tree.
dist/​index.js Includes patched bundled code.
__tests__/​dependencies.test.ts Tests dependencies under strict deprecation handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread package.json
Copilot AI and others added 2 commits September 18, 2026 16:23
Co-authored-by: mbianchidev <37507190+mbianchidev@users.noreply.github.com>
…nse-cache

Add patch-package license cache

This branch has not been deployed

No deployments
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.

3 participants