Registry / webassembly-feature

webassembly-feature

JSON →
library1.3.0jsnpmunverified

This package, `webassembly-feature` (version 1.3.0), provides synchronous utilities to detect support for various WebAssembly features in the current JavaScript environment. Last updated over six years ago, it is considered abandoned. Its API exposes an object with methods like `supports['multi-value']()` that return boolean values directly. For new projects or those requiring up-to-date feature detection, the `wasm-feature-detect` package (maintained by GoogleChromeLabs) is the recommended alternative, as it offers a more comprehensive and asynchronous API reflecting modern WebAssembly standards and browser capabilities. This package's synchronous nature contrasts with the predominantly asynchronous WebAssembly APIs and feature detection patterns prevalent today.

npm install webassembly-feature
INSTALL
IMPORT
SIG · WEBASSEMBLY-FEATUR
W
webassembly-feature
javascriptv1.3.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

supports
const supports = require("webassembly-feature");
import { supports } from 'webassembly-feature';
This package is CommonJS-only and exports a default object containing feature detection functions. ESM `import` statements are not directly supported.
JS-BigInt-integration
const supports = require("webassembly-feature"); const hasBigIntIntegration = supports["JS-BigInt-integration"]();
import { JSBigIntIntegration } from 'webassembly-feature';
Feature detection functions are properties of the default-exported object and must be accessed via bracket or dot notation from the required module. Named imports will fail.

Demonstrates how to use `require()` to import the package and synchronously check for several WebAssembly features.

const supports = require("webassembly-feature"); console.log('WebAssembly "JS-BigInt-integration" supported:', supports["JS-BigInt-integration"]()); console.log('WebAssembly "multi-value" supported:', supports["multi-value"]()); console.log('WebAssembly "mutable-global" supported:', supports["mutable-global"]()); console.log('WebAssembly "simd" supported:', supports["simd"]()); // Note: Results depend on the JavaScript runtime and browser environment where this code is executed.
Debug
Known issues
breakingThis package is abandoned. It has not been updated in over six years (last published 2018-09-18) and may contain outdated feature checks or fail to detect newer WebAssembly proposals.
fix
Migrate to `wasm-feature-detect` (e.g., `npm install wasm-feature-detect`) which is actively maintained and provides an asynchronous API reflecting modern WebAssembly standards. Note that `wasm-feature-detect` uses an `async/await` pattern.
affects: >=1.0.0
gotchaThe API is entirely synchronous, returning boolean values directly. Modern WebAssembly feature detection (e.g., in `wasm-feature-detect`) typically uses asynchronous functions that return Promises.
fix
If migrating to a modern alternative like `wasm-feature-detect`, adapt your code to handle Promises, e.g., `if (await simd()) { /* ... */ }`.
affects: >=1.0.0
gotchaThis package is CommonJS-only. Attempting to use ESM `import` syntax directly will result in errors in environments that do not automatically transpile or handle CJS imports within ESM.
fix
For Node.js projects, use `const supports = require("webassembly-feature");`. For browser environments, ensure proper bundling or stick to `script` tags loading the UMD build if available, or ideally, migrate to `wasm-feature-detect` which supports ESM.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: (0 , _webassemblyFeature.default) is not a function
Attempting to use `import supports from 'webassembly-feature';` in an ESM context, which is incorrect for this CJS-only package, or transpilers creating incorrect default imports.
fix
Use the CommonJS `require` syntax: `const supports = require('webassembly-feature');`.
TypeError: supports is not a function
Incorrectly calling the imported `supports` object itself as a function, e.g., `supports()` instead of `supports['feature-name']()`.
fix
Access specific feature detection functions as properties of the `supports` object, e.g., `supports['multi-value']()`.
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
webassembly-feature — npm install webassembly-feature · libregistry