Library for detect WebAssembly post-MVP features in NodeJS & Browser. Small and with zero dependencies.
https://github.com/WebAssembly/design/blob/master/FutureFeatures.md#tracking-issues
Tests on Canary with flags:
Enable some experimental features for Chrome Canary (Mac):
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --js-flags="--experimental-wasm-eh"
- Reference types (--experimental-wasm-reftypes)
- BigInt between js and wasm (--experimental-wasm-bigint)
- Bulk memory operations (--experimental-wasm-bulk-memory)
- Exceptions (--experimental-wasm-eh)
- Multi values (--experimental-wasm-mv)
- Tail recursion calls (--experimental-wasm-return-call)
- Saturated (non-trapping) conversions from float to int (--experimental-wasm-sat-f2i-conversions)
- Sign/zero extensions (--experimental-wasm-se)
- SIMD (--experimental-wasm-simd)
- Threads (--experimental-wasm-threads)
- Type reflection (--experimental-wasm-type-reflection)
yarn add wasm-check
or
npm i wasm-check
import * as check from 'wasm-check';
// or
// const check = require('wasm-check');
console.log(check.support()); // default MVP
console.log(check.support(1)); // same
console.log(check.support(2)); // version 2 (for future)
import * as check from 'wasm-check';
console.log(check.supportStreaming);
import * as check from 'wasm-check';
const features = { ...check.feature };
console.log(features);
Output:
{
bigInt: true,
bulk: true,
exceptions: false,
mutableGlobal: true,
multiValue: true,
saturateConversions: true,
signExtensions: true,
tailCall: false,
threads: false,
simd: false,
references: false,
typeReflection: false,
funcReferences: false
}
import * as check from 'wasm-check';
console.log(check.feature.simd); // has SIMD support?
console.log(check.feature.tailCalls); // has tail call optimization support?
- GC integration feature check
- Interface Types feature check