{"name":"@bjorn3/browser_wasi_shim","version":"0.4.2","license":"MIT OR Apache-2.0","description":"A pure javascript shim for WASI","type":"module","scripts":{"build":"swc src -d dist -s true && tsc --emitDeclarationOnly","prepare":"swc src -d dist && tsc --emitDeclarationOnly","test:node":"./test/run-testsuite.sh node","test:browser":"playwright-core install && ./test/run-testsuite.sh browser","test":"npm run test:node && npm run test:browser","check":"tsc --noEmit && prettier src -c && eslint src/"},"repository":{"type":"git","url":"git+https://github.com/bjorn3/browser_wasi_shim.git"},"author":{"name":"bjorn3"},"bugs":{"url":"https://github.com/bjorn3/browser_wasi_shim/issues"},"main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./typings/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"typings":"./typings/index.d.ts","homepage":"https://github.com/bjorn3/browser_wasi_shim#readme","devDependencies":{"@swc/cli":"^0.1.62","@swc/core":"^1.3.37","@typescript-eslint/eslint-plugin":"^6.7.4","@typescript-eslint/parser":"^6.7.4","eslint":"^8.50.0","playwright":"^1.40.1","prettier":"^3.0.3","typescript":"^4.9.5"},"gitHead":"4a55f2a519d0ddfa7e4609c42e0c9769c37c9ae8","_id":"@bjorn3/browser_wasi_shim@0.4.2","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-/iHkCVUG3VbcbmEHn5iIUpIrh7a7WPiwZ3sHy4HZKZzBdSadwdddYDZAII2zBvQYV0Lfi8naZngPCN7WPHI/hA==","shasum":"7419f414ec01521653f1863b737d1f03e3e94725","tarball":"http://registry-npm.ywwl.com/@bjorn3/browser_wasi_shim/download/@bjorn3/browser_wasi_shim-0.4.2.tgz","fileCount":26,"unpackedSize":114555,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDbqdViLApENZHfuloR/j4zpra1EYdVF+mK6EB4YHc/CQIhAPZ7VDo/72gN8cxiUpmNa8Eh7lkO0GE5cpd1qk9VZMJm"}],"size":31373,"noattachment":false,"key":"/@bjorn3/browser_wasi_shim/-/@bjorn3/browser_wasi_shim-0.4.2.tgz"},"_npmUser":{"name":"bjorn3","email":"bjorn3_gh@protonmail.com","actor":{"name":"bjorn3","email":"bjorn3_gh@protonmail.com","type":"user"}},"directories":{},"maintainers":[{"name":"bjorn3","email":"bjorn3_gh@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/browser_wasi_shim_0.4.2_1750602943779_0.16979832884776758"},"_hasShrinkwrap":false,"readme":"# A pure javascript shim for WASI\n\nImplementation status: A subset of wasi_snapshot_preview1 is implemented. The rest either throws an exception, returns an error or is incorrectly implemented.\n\n## Usage\n\n```\nnpm install @bjorn3/browser_wasi_shim --save\n```\n\n```javascript\nimport { WASI, File, OpenFile, ConsoleStdout, PreopenDirectory } from \"@bjorn3/browser_wasi_shim\";\n\nlet args = [\"bin\", \"arg1\", \"arg2\"];\nlet env = [\"FOO=bar\"];\nlet fds = [\n    new OpenFile(new File([])), // stdin\n    ConsoleStdout.lineBuffered(msg => console.log(`[WASI stdout] ${msg}`)),\n    ConsoleStdout.lineBuffered(msg => console.warn(`[WASI stderr] ${msg}`)),\n    new PreopenDirectory(\".\", [\n        [\"example.c\", new File(new TextEncoder(\"utf-8\").encode(`#include \"a\"`))],\n        [\"hello.rs\", new File(new TextEncoder(\"utf-8\").encode(`fn main() { println!(\"Hello World!\"); }`))],\n    ]),\n];\nlet wasi = new WASI(args, env, fds);\n\nlet wasm = await WebAssembly.compileStreaming(fetch(\"bin.wasm\"));\nlet inst = await WebAssembly.instantiate(wasm, {\n    \"wasi_snapshot_preview1\": wasi.wasiImport,\n});\nwasi.start(inst);\n```\n\n## Building\n\n```\n$ npm install\n$ npm run build\n```\n\n## Running the demo\n\nThe demo requires the wasm rustc artifacts and the xterm js package. To get them run:\n\n```\n$ git submodule update --init\n$ cd examples && npm install\n```\n\nRun the demo with a static web server from the root of this project:\n\n```\n$ npx http-server\n```\n\nAnd visit [http://127.0.0.1:8080/examples/rustc.html]() in your browser.\n\nA more complete demo by [@LyonSyonII](https://github.com/LyonSyonII) which runs\nmiri inside the browser can be found at <https://garriga.dev/rubri/>. (source\nat <https://github.com/LyonSyonII/rubri>)\n\n## Testing\n\n```\n$ python3 -m pip install -r ./test/wasi-testsuite/test-runner/requirements.txt\n$ npm test\n```\n\n## License\n\nLicensed under either of\n\n  * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or\n    http://www.apache.org/licenses/LICENSE-2.0)\n  * MIT license ([LICENSE-MIT](LICENSE-MIT) or\n    http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you shall be dual licensed as above, without any\nadditional terms or conditions.\n","publish_time":1750602943981,"_cnpm_publish_time":1750602943981,"dist-tags":{"latest":"0.4.2"}}