Skip to content

Conversation

akapug
Copy link
Owner

@akapug akapug commented Aug 24, 2025

This PR completes the basic Node API compatibility sweep across Elide’s GraalVM runtime, focusing on non-overlapping work with upstream PRs elide-dev#1617elide-dev#1619 and aligning behavior with Node docs.

Highlights

  • stream/promises: Implemented finished() and pipeline() with robust event handling and cleanup; resolves immediately on already-ended streams; rejects on errored
  • stream/consumers: text() accepts ReadableStream one-chunk inputs in addition to Buffer/Uint8Array/ArrayBuffer/string
  • http/https/http2: server-like facades expose listen/close/address/on (listen invokes callback); shapes align with Node
  • net: add address() for server/socket facades; isIP/isIPv4/isIPv6 via InetAddress
  • module: builtinModules/isBuiltin present; createRequire loads builtins or falls back to global require
  • url: helpers implemented (domainToASCII/Unicode, fileURLToPath, pathToFileURL, urlToHttpOptions)
  • dns + dns/promises: minimal resolve4/resolve6/reverse, default result order, getServers stub (aligned to upstream 1617 semantics)
  • tls: minimal surface with getCiphers using JDK SSL (fallback list provided)
  • querystring: implemented parse/stringify/escape/unescape/encode/decode
  • Handler fallthrough: treat non-boolean returns as handled to avoid unexpected 404 fallthrough

Notes

  • Verified compile on Windows (with native toolchain present or skipped when configured); changes are conservative and shape-accurate using ProxyObject/Executable
  • Avoided duplicating upstream 1617–1619 Netty wiring and utilized fallthrough semantics consistent with upstream

Follow-ups (post-merge)

  • Optional: Expand stream/consumers to support AsyncIterables and multi-chunk ReadableStream consumption
  • Optional: Enhance module.createRequire to use Elide loader when public API permits

Thanks!


Pull Request opened by Augment Code with guidance from the PR author

akapug added 30 commits August 23, 2025 20:21
…ix Windows file URI; make conventions/remote optional

- NodeURL: domainToASCII/Unicode; fileURLToPath/pathToFileURL roundtrip; urlToHttpOptions mapping (protocol, host, hostname, port, path)

- NodeUrlHelpersTest: focused helper tests

- PublishingConventions: use File.toURI for stage maven repo to avoid Windows file authority issues

- settings.gradle.kts: gate includeBuild and remote apply via elide.includeConventions/elide.applyRemote flags (-P/-D)
…ts; seed compatibility matrix

- NodeTimers module: delegates setTimeout/setInterval/clear* to global JsTimers; implements setImmediate/clearImmediate via setTimeout(0)

- timers/promises: setTimeout/setImmediate with AbortSignal support for setTimeout

- Tests: NodeTimersTest (shape), NodeTimersPromisesTest (shape)

- COMPATIBILITY_MATRIX.md: initial matrix linking PRs 1617-1619 and new timers work
…ormance keys

- Add stubbed Agent/ClientRequest/Server/ServerResponse/IncomingMessage/OutgoingMessage

- Provide METHODS and STATUS_CODES maps; createServer/request/get placeholders

- Keep behavior delegated to server intrinsics and follow-up PRs
…8, vm, worker_threads

- punycode: toASCII/toUnicode via java.net.IDN; encode/decode TODO

- repl: start placeholder

- trace_events: createTracing/getEnabledCategories placeholders

- v8: empty facade

- vm: createContext/runIn* placeholders

- worker_threads: isMainThread true; Worker placeholder
…eholders)

- tls: createServer/connect/createSecureContext/getCiphers placeholders; default min/max version

- tty: isatty placeholder returns false
…/executionAsyncId/triggerAsyncId

feat(node:punycode): add facade with toASCII/toUnicode (IDN); encode/decode TODO; add conformance test

feat(node:repl,trace_events,v8,vm,worker_threads,tls,tty): minimal facades added earlier are hooked into reflection
feat(node:punycode): add minimal facade and conformance test
Introduce node:punycode with toASCII/toUnicode via java.net.IDN
Stub encode/decode; to be implemented later
Add NodePunycodeTest for requiredMembers and a basic smoke case
feat(node:repl): add minimal facade with start placeholder
Register node:repl facade; no behavior yet
feat(node:trace_events): add minimal facade and API surface
Implement createTracing/getEnabledCategories placeholders
Register TraceEventsAPI
feat(node:v8): add minimal v8 facade
Provide empty facade; register V8API
feat(node:vm): add minimal vm facade
Add createContext/runIn* placeholders; register VMAPI
feat(node:worker_threads): add minimal facade
Expose isMainThread=true; Worker placeholder
Register WorkerThreadsAPI
feat(node:tls): add minimal tls facade
createServer/connect/createSecureContext/getCiphers placeholders
Expose DEFAULT_MIN_VERSION/DEFAULT_MAX_VERSION constants
Register TLSAPI
feat(node:tty): add minimal tty facade (isatty)
isatty returns false; register TtyAPI
feat(node:async_hooks): add minimal facade and API surface
createHook/executionAsyncId/triggerAsyncId placeholders
Register AsyncHooksAPI
chore(node:url,timers/promises): fix instantiation and promise usage
NodeURL: instantiate URL with ProxyInstantiable.newInstance
timers/promises: use GuestExecution.workStealing().promise with resolve/reject
… constants

Implement NodeConstants facade with constants.os and constants.fs
Register in NodeJsFeature and module loader
… constants

- Implement NodeConstants facade with constants.os and constants.fs
- Register in NodeJsFeature and module loader

chore(node:url,timers/promises): fix instantiation and promise usage

- NodeURL: instantiate URL via ProxyInstantiable.newInstance
- timers/promises: use GuestExecution.workStealing().promise with resolve/reject

feat(node:*): add minimal facades and API interfaces

- async_hooks, punycode, repl, trace_events, v8, vm, worker_threads, tls, tty
- Add missing API interfaces (AsyncHooksAPI, PunycodeAPI, ReplAPI, TraceEventsAPI, WorkerThreadsAPI, TtyAPI)
- Register in NodeJsFeature where applicable

feat(node:wasi): add minimal wasi module with WASI constructor placeholder
…dd basic shape tests using NodeModuleConformanceTest requiredMembers to lock module keys
…s, tty, vm, v8, tls, worker_threads, async_hooks
- vm: createContext/isContext/runIn* using current JS context evaluation and simple sandbox object
- tls.getCiphers: return common cipher list; expose defaults
- punycode.encode/decode: approximate via IDN toASCII/toUnicode (domain-like strings)
…ment useful baseline behaviors; tests for behavior added (not run here)
… worker message delivery; expand secure context fields; add behavior tests
…handling in url; get cipher suites from JSSE when available; add behavior tests
…t object; refined vm context binding comments; JSSE cipher suites; UNC path fixes; RFC3492 punycode; tests
…,perf_hooks,process): implement baseline behaviors; add behavior tests
…lementation; add stubs for register/syncBuiltinESMExports/findSourceMap/SourceMap
…e:stream/consumers): implement basic text/buffer/arrayBuffer/json/blob consumers
…ty native builds and natives dependency on tests/build/check
akapug added 15 commits August 24, 2025 01:30
…s=true or ELIDE_SKIP_NATIVES=true; unblock local test runs
… text() and wire conversions via TextDecoder/Encoder
…e, default result order, getServers stub); align handler fallthrough semantics
…+ global require fallback); compile verified
…dableStream; tests; note future loader hook for createRequire
…e uses executeGuest lambda; punycode test implements injectable; stream/consumers behavior test uses polyglotContext.javascript
…pl, vm, perf_hooks, worker_threads, trace_events)
…ises, trace_events enabled categories) off DSL
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.

1 participant