-
Notifications
You must be signed in to change notification settings - Fork 39
feat: implement node util
#1527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
feat(node): implement `util.promisify` feat(node): implement `util.callbackify` feat(node): mount `TextEncoder` and `TextDecoder` test(node): add initial tests for `util` module chore: update `graalvm` api pins chore: apply patch for `JSPromiseObject` use to `truffle-api` Signed-off-by: Sam Gammon <sam@elide.dev>
feat(node): implement debug logger facade + behavior feat(cli): implement `--js:debug` flag support for js debug logging test(cli): activation of `--js:debug` logging chore: update serialized logging config chore: update `graalvm` module pins Signed-off-by: Sam Gammon <sam@elide.dev>
feat(node): add `DeprecatedCallable` which warns on first use feat(node): implement `util.deprecate` method test(node): simple tests for `util.deprecate` Signed-off-by: Sam Gammon <sam@elide.dev>
feat(node): implement `transferableAbortController` feat(node): implement `transferableAbortSignal` test(node): simple tests for transferable abort signal/controller methods chore: update `graalvm` module pins Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
feat(node): implement `util.MIMEType` class feat(node): implement `util.MIMEParams` class test(node): tests for MIME type parsing Signed-off-by: Sam Gammon <sam@elide.dev>
ce3cf53 to
fc11a17
Compare
Signed-off-by: Sam Gammon <sam@elide.dev>
feat(node): implement `util.getSystemErrorName` feat(node): implement `util.getSystemErrorMap` test(node): tests for system error methods in `util` Signed-off-by: Sam Gammon <sam@elide.dev>
feat(node): most type checks on `util.types` test(node): tests for `util.types` Signed-off-by: Sam Gammon <sam@elide.dev>
feat(node): add `InspectOptions` and impl feat(node): add `util.inspect` for primitives feat(node): add `util.inspect` for host-side complex types (pt 1) feat(node): add `util.inspect` for guest-side complex types (pt 1) test(node): tests for `util.inspect` Signed-off-by: Sam Gammon <sam@elide.dev>
feat(node): implement primitive `util.format` support chore(node): move object inspection to dedicated file test(node): primitive `util.format` tests Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
There was a problem hiding this 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 adds a first-pass implementation of Node’s util module on GraalVM, including the full host-side NodeUtil API, support for formatting and inspection (util.format, inspect, formatWithOptions), type-checking helpers (util.types), debug logging, deprecation wrappers, and MIME type utilities, alongside a comprehensive suite of Kotlin tests.
- Introduces
NodeUtilwith callbackify/promisify, debuglog/deprecate, inspect/format, error name lookup, abort controllers, MIME types, and typechecks - Implements host-side formatting via
StringFormatterand inspection viaObjectInspectorwith fullInspectOptionssupport - Adds exhaustive tests in
NodeUtilTest.ktand necessary test harness improvements (executeESM)
Reviewed Changes
Copilot reviewed 32 out of 34 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/graalvm/src/main/kotlin/elide/runtime/node/util/NodeUtil.kt | Core util module implementation (callbackify, inspect, etc.) |
| packages/graalvm/src/main/kotlin/elide/runtime/node/util/NodeTypechecks.kt | util.types.* methods implemented |
| packages/graalvm/src/main/kotlin/elide/runtime/node/util/StringFormatter.kt | Implements %-based formatting logic |
| packages/graalvm/src/test/kotlin/elide/runtime/node/NodeUtilTest.kt | Comprehensive test suite covering all util APIs |
packages/graalvm/src/main/kotlin/elide/runtime/node/util/NodeTypechecks.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Relates-to: elide-dev/runtime#383 Signed-off-by: Sam Gammon <sam@elide.dev>
Summary
First pass at implementing Node's
utilmodule.util#1203callbackifypromisifyisArraydebuglogdeprecatetransferableAbort{Controller,Signal}TextEncoder/TextDecoderconstructorsMIMETypeMIMEParamsgetSystemErrorNamegetSystemErrorMapinheritsformat%s%i,%d,%f%j,%o,%O)formatWithOptionscolorsmaxArrayItemsmaxStringLengthEnforcement ofnote: ishdepthinspectList,Set,Map[ ... ],{ ... }(lists and sets)typesisAnyArrayBufferisArrayBufferViewisArgumentsObjectisArrayBufferisAsyncFunctionisBigInt64ArrayisBigIntObjectisBigUint64ArrayisBooleanObjectisDateisFloat16ArrayisFloat32ArrayisFloat64ArrayisGeneratorFunctionisInt8ArrayisInt16ArrayisInt32ArrayisMapisNumberObjectisPromiseisRegExpisSetisSharedArrayBufferisStringObjectisSymbolObjectisTypedArrayisUint8ArrayisUint8ClampedArrayisUint16ArrayisUint32ArrayisWeakMapisWeakSet