feat: implement inline util functions to completely replace node:util imports#1200
Merged
feat: implement inline util functions to completely replace node:util imports#1200
Conversation
…til imports Co-authored-by: streamich <9773803+streamich@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Simplify
feat: implement inline inspect and format functions to replace node:util imports
Sep 24, 2025
node:utils import
streamich
requested changes
Sep 24, 2025
src/vendor/node/util.ts
Outdated
| @@ -1 +1,64 @@ | |||
| export { inspect, format, inherits, promisify } from 'node:util'; | |||
| export { inherits, promisify } from 'node:util'; | |||
Owner
There was a problem hiding this comment.
- Inline
inheritsandpromisifyimplementations, too. - Run
yarn prettierwhen done.
…util dependencies Co-authored-by: streamich <9773803+streamich@users.noreply.github.com>
Contributor
Author
|
Done! I've inlined all
The module is now completely self-contained with ~100 lines of minimal implementations instead of importing from Node.js built-ins. All tests pass including stream inheritance and Promise API functionality. Commit: 4e628bf |
Copilot
AI
changed the title
feat: implement inline inspect and format functions to replace node:util imports
feat: implement inline util functions to completely replace node:util imports
Sep 24, 2025
Contributor
|
🎉 This PR is included in version 4.46.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR completely eliminates the
node:utilimport insrc/vendor/node/util.tsby replacing all imported functions with minimal inline implementations.Changes Made
node:utildependency - no more external imports from Node.js built-insinspectfunction (~15 lines) that handles:null,undefined, strings, numbers, booleans[1, 2, 3]→[ 1, 2, 3 ]{a: 1}→{ a: 1 }formatfunction (~25 lines) that supports:%sfor strings%dfor numbers%jfor JSON serialization%%for%inheritsfunction (~20 lines) that:Object.create()super_property for Node.js compatibilityFsReadStreamandFsWriteStreamclassespromisifyfunction (~15 lines) that:Usage Compatibility
The implementations are fully compatible with existing usage patterns throughout the codebase:
Benefits
The implementation successfully removes all Node.js built-in utility dependencies while maintaining full backward compatibility across error handling, stream inheritance, and Promise API functionality.
Fixes #1199.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.