Conversation
zig-napi ArkVM benchmark
|
There was a problem hiding this comment.
Pull request overview
Adds a native wrap/unwrap utility that lets Zig code attach typed payloads to JS objects via napi_wrap, with type-tagged headers, optional napi_adjust_external_memory integration, and methods exposed on Env and Object.
Changes:
- New
src/napi/wrapper/native_wrap.zigimplementingwrap/unwrap/unwrapConst/dropWrapped/matcheswith a magic-tagged header and finalizer. - Expose wrap APIs on
Object(PascalCase + camelCase variants) andEnv, and re-export the module asnapi.NativeWrap. - Add Zig test bindings and an AVA spec covering create/get/mutate/drop, wrong-type errors, unwrap of non-wrapped object, and finalizer deinit counting.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/napi/wrapper/native_wrap.zig | Core implementation of tagged native wrap/unwrap with finalizer and memory adjustment. |
| src/napi/value/object.zig | Adds wrap/unwrap/dropWrapped/matchesWrapped methods (and PascalCase aliases) on Object. |
| src/napi/env.zig | Adds env-level wrap/unwrap helpers with an objectRaw shim for any value exposing raw. |
| src/napi.zig | Re-exports native_wrap as napi.NativeWrap. |
| node-test/napi/src/values.zig | Test payload types and bindings exercising wrap, unwrap, mutate, drop, and deinit count. |
| node-test/napi/src/lib.zig | Exports the new bindings. |
| node-test/napi/tests/values.spec.js | AVA test verifying wrap roundtrip, type mismatch errors, and finalizer counting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.