{"_id":"@napi-rs/wasm-runtime@1.2.7","bugs":{"url":"https://github.com/napi-rs/napi-rs/issues"},"dist":{"shasum":"8af2f08d9c9ef4fbbee90060dc6b5c1ca19e4739","tarball":"http://registry-npm.ywwl.com/@napi-rs/wasm-runtime/download/@napi-rs/wasm-runtime-1.2.7.tgz","fileCount":9,"integrity":"sha512-zJccwplOAbgfZju95IUHazLnx9RAPtPN2YGJXI6UbrgeaR9QfPjGrQL6ERkSAtnVCA4Q+83ApGyaX5zdpCaKkQ==","signatures":[{"sig":"MEUCIQD1n9YI3XmVZUJsb+jiiAgZJIMrhroz0/OtYYKrZvuFxAIgTdHfe+jgI8WOwB3goZpe/T2VB6xj2Y5N6p6211Fkb6Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCc56jXTfnojDWywJL5UQxSwCfl52YHbW7FBvTR0V8vVwIhAIqLJUf0us4rQubobBNFFn+tpBk02WV7BRfh+RXzqj5F"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@napi-rs%2fwasm-runtime@1.2.7","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":782067,"size":160034,"noattachment":false,"key":"/@napi-rs/wasm-runtime/-/@napi-rs/wasm-runtime-1.2.7.tgz"},"name":"@napi-rs/wasm-runtime","type":"module","author":{"url":"https://github.com/Brooooooklyn","name":"LongYinan"},"engines":{"node":"^20.19.0 || ^22.13.0 || >=23.5.0"},"exports":{".":{"import":"./runtime.js","require":"./runtime.cjs"},"./fs":{"import":"./dist/fs.js"}},"funding":{"url":"https://github.com/sponsors/Brooooooklyn","type":"github"},"gitHead":"a9362f80ff9bc65f011e7a487c27ab5a104ea194","license":"MIT","scripts":{"test":"yarn run build && node --test","build":"rolldown -c","prepack":"yarn run build"},"version":"1.2.7","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"c47c19cd-f258-4286-9041-9000dd20acb2"}},"homepage":"https://napi.rs/","repository":{"url":"git+https://github.com/napi-rs/napi-rs.git","type":"git","directory":"wasm-runtime"},"_npmVersion":"12.2.1","description":"Runtime and polyfill for wasm targets","directories":{},"maintainers":[{"name":"broooooklyn","email":"lynweklm@gmail.com"},{"name":"forehalo","email":"forehalo@gmail.com"}],"_nodeVersion":"24.22.1","dependencies":{"@tybys/wasm-util":"^0.10.3"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"wabt":"^1.0.39","memfs":"^4.64.0","tslib":"^2.8.1","buffer":"^6.0.3","events":"^3.3.0","process":"^0.11.10","rolldown":"^1.2.1","@emnapi/core":"2.0.0-beta.3","@emnapi/runtime":"2.0.0-beta.3","path-browserify":"^1.0.1","readable-stream":"^4.7.0","node-inspect-extracted":"^3.3.2"},"peerDependencies":{"@emnapi/core":"^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3","@emnapi/runtime":"^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wasm-runtime_1.2.7_1793678998548_0.35256188167026203"},"readme":"# @napi-rs/wasm-runtime\n\nRuntime helpers and browser polyfills for napi-rs WebAssembly addons.\n\n## emnapi compatibility\n\nUse matching versions of `@emnapi/core` and `@emnapi/runtime`:\n\n- v1: `^1.7.1`. Core includes async work and threadsafe functions and ignores the\n  plugins option. Loading this package does not resolve the v2-only\n  `@emnapi/core/plugins` export.\n- v2: the peer range is exactly `2.0.0-beta.2` or `2.0.0-beta.3`, and this\n  package bundles the async-work and TSFN plugins from `2.0.0-beta.3`. They\n  depend on private core context fields, which are the same in both betas\n  (`2.0.0-beta.3` changed only the TSFN release order). `2.0.0-beta.1` renamed\n  the context field `napiModule` to `addonModule`; the bundled plugins accept\n  both names, so bindings that pin a 2.0.0 alpha keep loading. A later\n  prerelease that changes the context again needs a new release of this\n  package.\n\nThe v2 peer range stays narrow on purpose. With an open range, npm can hoist a\nbinding's 2.0.0 alpha core next to this package, and then v1 bindings that\nload through the ESM entry, or through tools that skip the CommonJS copy\nlookup below, get a v2 core. With the narrow range, npm installs a v1 core for\nthis package when a binding pins another v2 prerelease. The binding's own\nemnapi copy still runs it, as described below.\n\nThe CommonJS entry keeps emnapi copies apart when this package's peers resolve\nto a different copy than a binding's own `@emnapi/core` and `@emnapi/runtime`\n(two bindings pinning different emnapi versions, say):\n\n- `instantiateNapiModule(Sync)` runs the core of the copy whose runtime created\n  `options.context`. It finds that runtime in `require.cache` and resolves the\n  core from the module that required it (the binding's loader).\n- `getDefaultContext`, `createContext`, `MessageHandler`, and instantiation\n  without a context use the copy of the calling package when it declares both\n  emnapi packages as dependencies: the CommonJS module that is still loading\n  and required this package, or, in a worker thread, the worker's entry file.\n- When the selected core is v2, the bundled plugins are replaced by that core's\n  own `@emnapi/core/plugins`.\n- Anything else uses this package's peers. A context of the other emnapi\n  generation from no known copy throws a `TypeError` that says so.\n\nThe ESM entry is resolved by bundlers and cannot do this. It uses the bundled\nplugins with the `addonModule` alias.\n\nFor raw `instantiateNapiModule` / `instantiateNapiModuleSync` calls loading a\nsingle-threaded napi-rs addon, pass\n`plugins: [emnapiAsyncWorkPlugin, emnapiTSFNPlugin]` from this package. Generated\nnapi-rs loaders already supply these plugins.\n\n## Updating the bundled plugins\n\nUpdate the exact v2 development dependencies together with the workspace\nresolutions. `build` checks that the resolved core version is the exact\ndevelopment version and one of the v2 versions in the peer range, and\n`prepack` rebuilds the bundles so a package cannot silently reuse output from\nan earlier build. Before a release, compare the new plugin context with the\noldest supported alpha (`2.0.0-alpha.3` is the oldest still pinned by published\nbindings), and keep the CI matrix covering it. Keep earlier v2 versions in the\npeer range while published bindings pin them (rolldown 1.2.16 pins\n`2.0.0-beta.2`); removing one makes npm install a v1 core for this package\nnext to those bindings.\n\n`yarn workspace @napi-rs/wasm-runtime test` exercises actual WebAssembly\ninitialization, async work, TSFN calls from a worker, worker load failures, and\ncleanup through both module formats. CI also installs the packed tarball with\nreal v1 and v2 peers outside the workspace to avoid root resolution overrides.\n","publish_time":1793678998667,"_cnpm_publish_time":1793678998667,"dist-tags":{"latest":"1.2.7"}}