bun
bun copied to clipboard
fix(napi): Make napi_wrap work on regular objects
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.
Updated 3:51 PM PT - Dec 16th, 2024
:x: @190n, your commit ce549216eef7d28fa8b764141ba3bb800fc02b98 has 8 failures in #8050:
test/regression/issue/09041.test.ts- 1 failing on ๐ 13 x64test/cli/install/registry/bun-install-registry.test.ts- timeout on ๐ง 20.04 aarch64test/cli/install/registry/bun-install-registry.test.ts- timeout on ๐ง 3.20 x64-baselinetest/v8/v8.test.ts- 22 failing on ๐ง 3.20 aarch64test/v8/v8.test.ts- 22 failing on ๐ง 3.20 x64test/v8/v8.test.ts- 22 failing on ๐ง 3.20 x64-baselinetest/bundler/esbuild/extra.test.ts- 1 failing on ๐ง 24.04 aarch64test/js/node/fs/fs.test.ts- timeout on ๐ช 2019 x64test/js/bun/http/serve.test.ts- 2 failing on ๐ 14 x64test/js/bun/http/serve.test.ts- 1 failing on ๐ 13 x64test/integration/next-pages/test/next-build.test.ts- 1 failing on ๐ 14 x64test/cli/run/require-cache.test.ts- 1 failing on ๐ 14 x64test/cli/run/require-cache.test.ts- 1 failing on ๐ 13 x64
๐งช ย try this PR locally:
bunx bun-pr 15622