feat(native): upgrade NAPI-RS to 3.0.0 beta (#12652)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
	- Added a default export for the native binding in the frontend native module, allowing easier imports.

- **Refactor**
	- Streamlined and updated Rust-to-JavaScript type conversions and lifetime handling for improved safety and consistency.
	- Improved object and array construction in Rust modules for more idiomatic usage.
	- Simplified boolean and null value handling in JavaScript interop layers.

- **Chores**
	- Upgraded several dependencies and development tools to newer versions across backend, frontend, and common packages.
	- Updated build scripts for the frontend native package to simplify commands.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Brooooooklyn
2025-05-29 16:09:31 +00:00
parent 2a7f0162cf
commit e1ce42a6fc
12 changed files with 320 additions and 409 deletions

View File

@@ -68,7 +68,7 @@ function requireNative() {
try {
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
} catch (err) {
loadErrors.push(err);
loadErrors.push(err)
}
} else if (process.platform === 'android') {
if (process.arch === 'arm64') {
@@ -374,6 +374,7 @@ if (!nativeBinding) {
throw new Error(`Failed to load native binding`)
}
module.exports = nativeBinding
module.exports.Application = nativeBinding.Application
module.exports.ApplicationListChangedSubscriber = nativeBinding.ApplicationListChangedSubscriber
module.exports.ApplicationStateChangedSubscriber = nativeBinding.ApplicationStateChangedSubscriber

View File

@@ -25,7 +25,7 @@
]
},
"devDependencies": {
"@napi-rs/cli": "3.0.0-alpha.78",
"@napi-rs/cli": "3.0.0-alpha.81",
"@napi-rs/whisper": "^0.0.4",
"@types/node": "^22.0.0",
"ava": "^6.2.0",
@@ -38,8 +38,8 @@
},
"scripts": {
"artifacts": "napi artifacts",
"build": "napi build -p affine_native --platform --release --no-dts-cache",
"build:debug": "napi build -p affine_native --platform --no-dts-cache",
"build": "napi build -p affine_native --platform --release",
"build:debug": "napi build -p affine_native --platform",
"universal": "napi universal",
"test": "ava",
"version": "napi version"