Skip to content

Commit 7388180

Browse files
authored
feat(napi): upgrade NAPI-RS to 3.0.0-beta.1 (#525)
1 parent cadcce2 commit 7388180

7 files changed

+37
-98
lines changed

Cargo.lock

Lines changed: 20 additions & 83 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

napi/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ doctest = false
2222
[dependencies]
2323
oxc_resolver = { workspace = true }
2424

25-
napi = { version = "3.0.0-alpha", default-features = false, features = ["napi3", "serde-json"] }
26-
napi-derive = { version = "3.0.0-alpha" }
25+
napi = { version = "3.0.0-beta.1", default-features = false, features = ["napi3", "serde-json"] }
26+
napi-derive = { version = "3.0.0-beta.1" }
2727
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["std", "fmt"] } # Omit the `regex` feature
2828

2929
[target.'cfg(not(any(target_os = "linux", target_os = "freebsd", target_arch = "arm", target_family = "wasm")))'.dependencies]
@@ -36,7 +36,7 @@ mimalloc-safe = { version = "0.1.51", optional = true, features = ["skip_collect
3636
mimalloc-safe = { version = "0.1.51", optional = true, features = ["skip_collect_on_exit", "local_dynamic_tls", "no_opt_arch"] }
3737

3838
[build-dependencies]
39-
napi-build = "2.1.6"
39+
napi-build = "2.2.0"
4040

4141
[features]
4242
default = []

napi/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function requireNative() {
6868
try {
6969
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
7070
} catch (err) {
71-
loadErrors.push(err);
71+
loadErrors.push(err)
7272
}
7373
} else if (process.platform === 'android') {
7474
if (process.arch === 'arm64') {
@@ -382,6 +382,7 @@ if (!nativeBinding) {
382382
throw new Error(`Failed to load native binding`)
383383
}
384384

385+
module.exports = nativeBinding
385386
module.exports.ResolverFactory = nativeBinding.ResolverFactory
386387
module.exports.EnforceExtension = nativeBinding.EnforceExtension
387388
module.exports.sync = nativeBinding.sync

napi/resolver.wasi-browser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
2-
instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync,
2+
createOnMessage as __wasmCreateOnMessageForFsProxy,
33
getDefaultContext as __emnapiGetDefaultContext,
4+
instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync,
45
WASI as __WASI,
5-
createOnMessage as __wasmCreateOnMessageForFsProxy,
66
} from '@napi-rs/wasm-runtime'
77
import { memfs } from '@napi-rs/wasm-runtime/fs'
88
import __wasmUrl from './resolver.wasm32-wasi.wasm?url'
@@ -60,6 +60,7 @@ const {
6060
}
6161
},
6262
})
63+
export default __napiModule.exports
6364
export const ResolverFactory = __napiModule.exports.ResolverFactory
6465
export const EnforceExtension = __napiModule.exports.EnforceExtension
6566
export const sync = __napiModule.exports.sync

napi/resolver.wasi.cjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ const { WASI: __nodeWASI } = require('node:wasi')
99
const { Worker } = require('node:worker_threads')
1010

1111
const {
12-
instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync,
13-
getDefaultContext: __emnapiGetDefaultContext,
1412
createOnMessage: __wasmCreateOnMessageForFsProxy,
13+
getDefaultContext: __emnapiGetDefaultContext,
14+
instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync,
1515
} = require('@napi-rs/wasm-runtime')
1616

1717
const __rootDir = __nodePath.parse(process.cwd()).root
@@ -84,7 +84,7 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
8484
}
8585
},
8686
})
87-
87+
module.exports = __napiModule.exports
8888
module.exports.ResolverFactory = __napiModule.exports.ResolverFactory
8989
module.exports.EnforceExtension = __napiModule.exports.EnforceExtension
9090
module.exports.sync = __napiModule.exports.sync

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"postbuild:debug": "node napi/patch.mjs"
2828
},
2929
"devDependencies": {
30-
"@napi-rs/cli": "3.0.0-alpha.78",
30+
"@napi-rs/cli": "3.0.0-alpha.79",
3131
"@napi-rs/wasm-runtime": "^0.2.7",
3232
"@types/node": "^22.13.9",
3333
"emnapi": "^1.3.1",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)