mirror of
https://github.com/hanzoai/unrs-resolver.git
synced 2026-09-24 17:03:52 +00:00
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | Type | Update | |---|---|---|---|---|---|---|---| | [@napi-rs/cli](https://napi.rs/) ([source](https://redirect.github.com/napi-rs/napi-rs)) | [`3.5.1` → `3.6.1`](https://renovatebot.com/diffs/npm/@napi-rs%2fcli/3.5.1/3.6.1) |  |  |  |  | devDependencies | minor | | [napi](https://redirect.github.com/napi-rs/napi-rs) | `3.8.3` → `3.8.4` |  |  |  |  | dependencies | patch | | [napi-derive](https://redirect.github.com/napi-rs/napi-rs) | `3.5.2` → `3.5.3` |  |  |  |  | dependencies | patch | --- ### Release Notes <details> <summary>napi-rs/napi-rs (@​napi-rs/cli)</summary> ### [`v3.6.1`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/[email protected]...@napi-rs/[email protected]) [Compare Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/[email protected]...@napi-rs/[email protected]) ### [`v3.6.0`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/[email protected]...@napi-rs/[email protected]) [Compare Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/[email protected]...@napi-rs/[email protected]) </details> --- ### Configuration 📅 **Schedule**: (in timezone Asia/Shanghai) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc-resolver). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My45NC4xIiwidXBkYXRlZEluVmVyIjoiNDMuMTEwLjIiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Boshen <[email protected]> Co-authored-by: Hanzo Dev <[email protected]>
71 lines
1.8 KiB
JavaScript
71 lines
1.8 KiB
JavaScript
import {
|
|
createOnMessage as __wasmCreateOnMessageForFsProxy,
|
|
getDefaultContext as __emnapiGetDefaultContext,
|
|
instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync,
|
|
WASI as __WASI,
|
|
} from '@napi-rs/wasm-runtime'
|
|
import { memfs } from '@napi-rs/wasm-runtime/fs'
|
|
|
|
|
|
export const { fs: __fs, vol: __volume } = memfs()
|
|
|
|
const __wasi = new __WASI({
|
|
version: 'preview1',
|
|
fs: __fs,
|
|
preopens: {
|
|
'/': '/',
|
|
},
|
|
})
|
|
|
|
const __wasmUrl = new URL('./resolver.wasm32-wasi.wasm', import.meta.url).href
|
|
const __emnapiContext = __emnapiGetDefaultContext()
|
|
|
|
|
|
const __sharedMemory = new WebAssembly.Memory({
|
|
initial: 4000,
|
|
maximum: 65536,
|
|
shared: true,
|
|
})
|
|
|
|
const __wasmFile = await fetch(__wasmUrl).then((res) => res.arrayBuffer())
|
|
|
|
const {
|
|
instance: __napiInstance,
|
|
module: __wasiModule,
|
|
napiModule: __napiModule,
|
|
} = __emnapiInstantiateNapiModuleSync(__wasmFile, {
|
|
context: __emnapiContext,
|
|
asyncWorkPoolSize: 4,
|
|
wasi: __wasi,
|
|
onCreateWorker() {
|
|
const worker = new Worker(new URL('./wasi-worker-browser.mjs', import.meta.url), {
|
|
type: 'module',
|
|
})
|
|
worker.addEventListener('message', __wasmCreateOnMessageForFsProxy(__fs))
|
|
|
|
|
|
return worker
|
|
},
|
|
overwriteImports(importObject) {
|
|
importObject.env = {
|
|
...importObject.env,
|
|
...importObject.napi,
|
|
...importObject.emnapi,
|
|
memory: __sharedMemory,
|
|
}
|
|
return importObject
|
|
},
|
|
beforeInit({ instance }) {
|
|
for (const name of Object.keys(instance.exports)) {
|
|
if (name.startsWith('__napi_register__')) {
|
|
instance.exports[name]()
|
|
}
|
|
}
|
|
},
|
|
})
|
|
export default __napiModule.exports
|
|
export const ResolverFactory = __napiModule.exports.ResolverFactory
|
|
export const EnforceExtension = __napiModule.exports.EnforceExtension
|
|
export const ModuleType = __napiModule.exports.ModuleType
|
|
export const sync = __napiModule.exports.sync
|