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 (standardized)
- BigInt between js and wasm (standardized)
- Bulk memory operations (standardized)
- Memory 64-bit (--experimental-wasm-memory64)
- Exceptions (--experimental-wasm-eh)
- Multi values (standardized)
- Tail recursion calls (--experimental-wasm-return-call)
- Saturated (non-trapping) conversions from float to int (standardized)
- Sign extensions (standardized)
- SIMD (standardized)
- Threads (standardized)
- 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()); // WebAssembly 1.0 (MVP)
console.log(check.support(1)); // ^^^
console.log(check.support(2)); // WebAssembly 2.0
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,
memory64: 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