bun icon indicating copy to clipboard operation
bun copied to clipboard

fix(napi): Make napi_wrap work on regular objects

Open 190n opened this issue 1 year ago โ€ข 1 comments

What does this PR do?

Currently, napi_wrap only works on instances of Node-API classes. This PR will make it work on any JavaScript object.

Fixes #15383, which is occurring in @napi-rs/canvas and eventually in more projects because of napi-rs/napi-rs#2348

TODO: use field in NapiPrototype/NapiClass where possible

How did you verify your code works?

Added tests. This still needs more tests to check that the NapiRef is handled properly.

190n avatar Dec 06 '24 19:12 190n