{"name":"wasm-feature-detect","version":"1.5.0","keywords":[],"author":{"name":"Surma","email":"surma@surma.link"},"license":"Apache-2.0","_id":"wasm-feature-detect@1.5.0","homepage":"https://github.com/GoogleChromeLabs/wasm-feature-detect#readme","bugs":{"url":"https://github.com/GoogleChromeLabs/wasm-feature-detect/issues"},"dist":{"shasum":"cbb49d119d2872a0274623161178c542154d87ba","tarball":"http://registry-npm.ywwl.com/wasm-feature-detect/download/wasm-feature-detect-1.5.0.tgz","fileCount":8,"integrity":"sha512-Wxw7de5ouYoFJsWXJdexwy8WU+8/LGUp4bFWS/1FlVzBUin0Yjko75772MFJdwf91N+MBZKINoOgsxw0UWKlRQ==","signatures":[{"sig":"MEUCIEH0ktC6WC66YOpwtK/Mhpx8HxUnxb4ZTdM1hkt2ik9wAiEAhtKepv/EZTlexksAyXnD+pYJaGz6NABKqw7u1TUv5Is=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28597,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj3PtZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqU5w/+IgRbHZ7J5K8YuurbTauSt2E2YcVFYh75qGPcQEshhCYtEJzO\r\nwSu/Xcm6FhwEHwoefpgB6vAkclMaD5MKM3pDFhrB+4ExFmjE5qsDYlOb/f7n\r\ne/isy3WfzceQyqGyfx9lmhyCtg2V5s8/rNkrTbmxD6te9kbqZrvD0K6OGA46\r\notYup/USekgphO7WH8qhV6NYLxUC0iPQAQUiHmklxBtoRm1hDe2HPv2CfxE5\r\n3AWAoyQ5WxXkuiYzbUw1wa/hIv+0OfX8bw7w1a2bWR3AFatkVUWIVO7M2LU5\r\negY2+kwRuJ5YeIPJJAjKfTqVfo50CcW+FyZq1iZzz1y2SmfN3nB2VOlAWlTJ\r\n3oOYzKT/7v+eJ2omRSgW6mfmO0UrnzT1/nKk8v8LHYmMyCfAImsn5wO9++jU\r\nyazchBNrOt4Hx1kE0WrSEWSB013PmxBeHhKa5G4X65HlPctJf7NgGDQkPTSw\r\nlUr7/2Ir8yzMU05intX+GczH+cZD/LZ3jnjFEn5lAVd43sjPDjgaB5Te0smc\r\nb2MJVFZP45Ri1JC9l0+MTTSIGy8Oei332ljK3Bnv2lD6xQMssY2mqjNmkqG3\r\nfjkZf3hZKBjbswbrkQAX/L+EOw2lBQbNNyjlpuikPU7MdE5DcjX5+bxVOe5y\r\nxMfog1g3yUSPVg8PCerZsjRjunpd0SQt1bc=\r\n=Cj+i\r\n-----END PGP SIGNATURE-----\r\n","size":7590,"noattachment":false,"key":"/wasm-feature-detect/-/wasm-feature-detect-1.5.0.tgz"},"main":"dist/cjs/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/esm/index.js","gitHead":"70484e4a460e0dc33fc261c2744f231aa5e88d30","scripts":{"fmt":"prettier --no-error-on-unmatched-pattern --write ./{,src,test,rollup-plugins}/*.{mjs,cjs,js,md}","test":"npm run fmt_test && npm run build && node --no-warnings test/index.cjs","build":"npm run build:library && npm run build:readme && npm run build:dts && npm run fmt","fmt_test":"prettier --check --no-error-on-unmatched-pattern --write ./{,src,test,rollup-plugins}/*.{mjs,cjs,js,md}","build:dts":"node --experimental-modules ./render-dts.mjs","build:readme":"node --experimental-modules ./render-readme.mjs","build:library":"rollup -c","build:website":"npm run build && node genwebsite.cjs","prepublishOnly":"npm run build"},"_npmUser":{"name":"surma","email":"surma@surma.link"},"repository":{"url":"git+https://github.com/GoogleChromeLabs/wasm-feature-detect.git","type":"git"},"_npmVersion":"9.2.0","description":"A small library to detect which features of WebAssembly are supported in your current browser.","directories":{},"_nodeVersion":"19.3.0","_hasShrinkwrap":false,"devDependencies":{"ejs":"^3.1.7","wabt":"^1.0.32","rollup":"^3.12.1","binaryen":"^111.0.0","prettier":"^2.8.3","markdown-it":"^12.3.2","highlight.js":"^11.7.0","magic-string":"^0.25.4","@rollup/plugin-terser":"^0.4.0","@rollup/plugin-commonjs":"^24.0.1"},"_npmOperationalInternal":{"tmp":"tmp/wasm-feature-detect_1.5.0_1675426648834_0.7594762233610515","host":"s3://npm-registry-packages"},"readme":"# WebAssembly Feature Detection\n\nA small library to detect which features of WebAssembly are supported.\n\n- ✅ Runs in browsers, Node and Deno\n- ✅ Tree-shakable (only bundle the detectors you use)\n- ✅ Provided as an ES6, CommonJS and UMD module.\n- ✅ CSP compatible\n- ✅ All detectors add up to only ~970B gzipped\n\n## Installation\n\n```\nnpm install -g wasm-feature-detect\n```\n\n## Usage\n\n```html\n<script type=\"module\">\n\timport { simd } from \"wasm-feature-detect\";\n\n\tif (await simd()) {\n\t\t/* SIMD support */\n\t} else {\n\t\t/* No SIMD support */\n\t}\n</script>\n```\n\n### Hotlinking from Unpkg\n\n```html\n<script type=\"module\">\n\timport { simd } from \"https://unpkg.com/wasm-feature-detect?module\";\n\t// ...\n</script>\n```\n\nIf required, there’s also a UMD version\n\n```html\n<script src=\"https://unpkg.com/wasm-feature-detect/dist/umd/index.js\"></script>\n<script>\n\tif (await wasmFeatureDetect.simd()) {\n\t  // ...\n\t}\n</script>\n```\n\n## Detectors\n\nAll detectors return a `Promise<bool>`.\n\n| Function                    | Proposal                                                                                                     |\n| --------------------------- | ------------------------------------------------------------------------------------------------------------ |\n| `bigInt()`                  | [BigInt integration](https://github.com/WebAssembly/JS-BigInt-integration)                                   |\n| `bulkMemory()`              | [Bulk memory operations](https://github.com/webassembly/bulk-memory-operations)                              |\n| `exceptions()`              | [Legacy Exception Handling](https://github.com/WebAssembly/exception-handling)                               |\n| `exceptionsFinal()`         | [Exception Handling with exnref](https://github.com/WebAssembly/exception-handling)                          |\n| `extendedConst()`           | [Extented Const Expressesions](https://github.com/WebAssembly/extended-const)                                |\n| `gc()`                      | [Garbage Collection](https://github.com/WebAssembly/gc)                                                      |\n| `jsStringBuiltins()`        | [JS String Builtins Proposal for WebAssembly](https://github.com/WebAssembly/js-string-builtins)             |\n| `jspi()`                    | [JavaScript Promise Integration](https://github.com/WebAssembly/js-promise-integration)                      |\n| `memory64()`                | [Memory64](https://github.com/WebAssembly/memory64)                                                          |\n| `multiMemory()`             | [Multiple Memories](https://github.com/WebAssembly/multi-memory)                                             |\n| `multiValue()`              | [Multi-value](https://github.com/WebAssembly/multi-value)                                                    |\n| `mutableGlobals()`          | [Importable/Exportable mutable globals]()                                                                    |\n| `referenceTypes()`          | [Reference Types](https://github.com/WebAssembly/reference-types)                                            |\n| `relaxedSimd()`             | [Relaxed SIMD](https://github.com/webassembly/relaxed-simd)                                                  |\n| `saturatedFloatToInt()`     | [Non-trapping float-to-int conversions](https://github.com/WebAssembly/nontrapping-float-to-int-conversions) |\n| `signExtensions()`          | [Sign-extension operators](https://github.com/WebAssembly/sign-extension-ops)                                |\n| `simd()`                    | [Fixed-Width SIMD](https://github.com/webassembly/simd)                                                      |\n| `streamingCompilation()`    | [Streaming Compilation](https://webassembly.github.io/spec/web-api/index.html#streaming-modules)             |\n| `tailCall()`                | [Tail call](https://github.com/webassembly/tail-call)                                                        |\n| `threads()`                 | [Threads](https://github.com/webassembly/threads)                                                            |\n| `typeReflection()`          | [Type Reflection](https://github.com/WebAssembly/js-types)                                                   |\n| `typedFunctionReferences()` | [Typed function references](https://github.com/WebAssembly/function-references)                              |\n\n## Why are all the tests async?\n\nThe _technical_ reason is that some tests might have to be augmented to be asynchronous in the future. For example, Firefox is planning to [make a change][ff coop] that would require a `postMessage` call to detect SABs, which are required for threads.\n\nThe _other_ reason is that you _should_ be using `WebAssembly.compile`, `WebAssembly.instantiate`, or their streaming versions `WebAssembly.compileStreaming` and `WebAssembly.instantiateStreaming`, which are all asynchronous. You should already be prepared for asynchronous code when using WebAssembly!\n\n## Contributing\n\nIf you want to contribute a new feature test, all you need to do is create a new folder in `src/detectors` and it will be automatically picked up. The folder may contain a `module.wat` file, which will be compiled using [`wabt.js`](https://github.com/AssemblyScript/wabt.js).\n\n```wat\n;; Name: <Name of the feature for the README>\n;; Proposal: <Link to the proposal’s explainer/repo>\n;; Features: <Space-separated list of WasmFeatures from wabt.js>\n\n(module\n  ;; More WAT code here\n)\n```\n\nThe folder can also contain an optional `index.js` file, whose default export must be an async function. This function can do additional testing in JavaScript and must return a boolean. See the “threads” detector as an example.\nIt must contain at least one of `module.wat` or `index.js`.\n\n[ff coop]: https://groups.google.com/forum/#!msg/mozilla.dev.platform/IHkBZlHETpA/dwsMNchWEQAJ\n[wat2wasm]: https://github.com/webassembly/wabt\n\n---\n\nLicense Apache-2.0\n","publish_time":1675426648986,"maintainers":[{"name":"rreverser","email":"me@rreverser.com"},{"name":"tomayac","email":"steiner.thomas@gmail.com"},{"name":"surma","email":"surma@surma.link"}],"_cnpm_publish_time":1675426648986,"dist-tags":{"latest":"1.9.0"}}