2.1.2 • Published 2 years ago
wasm-check v2.1.2
Library for detect WebAssembly post-MVP features in NodeJS & Browser. Small and with zero dependencies.
About post-MVP WebAssembly features
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"
Support feature detections
- 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)
Install
yarn add wasm-check
or
npm i wasm-check
Usage
Check supported WebAssembly version
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
Check supporting streaming compilation
import * as check from 'wasm-check';
console.log(check.supportStreaming);
Get all post-MVP WebAssembly features
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
}
Or check concrete feature
import * as check from 'wasm-check';
console.log(check.feature.simd); // has SIMD support?
console.log(check.feature.tailCalls); // has tail call optimization support?
TODO
- GC integration feature check
2.1.2
2 years ago
2.1.1
2 years ago
2.1.0
2 years ago
2.0.4
2 years ago
2.0.3
3 years ago
2.0.2
3 years ago
2.0.1
3 years ago
2.0.0
4 years ago
1.5.7
4 years ago
1.5.6
4 years ago
1.5.5
4 years ago
1.5.4
4 years ago
1.5.3
4 years ago
1.5.2
4 years ago
1.5.1
4 years ago
1.5.0
4 years ago
1.4.4
4 years ago
1.4.3
4 years ago
1.4.2
4 years ago
1.4.1
4 years ago
1.4.0
4 years ago
1.3.5
5 years ago
1.3.4
5 years ago
1.3.3
5 years ago
1.3.2
5 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.2
5 years ago
1.2.1
5 years ago
1.2.0
5 years ago
1.1.0
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago
0.2.5
5 years ago
0.2.4
5 years ago
0.2.3
5 years ago
0.2.2
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.1.4
5 years ago
0.1.3
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago