{"name":"@bjorn3/browser_wasi_shim","version":"0.2.0","author":{"name":"bjorn3"},"license":"MIT OR Apache-2.0","_id":"@bjorn3/browser_wasi_shim@0.2.0","maintainers":[{"name":"bjorn3","email":"bjorn3_gh@protonmail.com"}],"homepage":"https://github.com/bjorn3/browser_wasi_shim#readme","bugs":{"url":"https://github.com/bjorn3/browser_wasi_shim/issues"},"dist":{"shasum":"b52465827711c010e09265bed5b86aa0e1618917","tarball":"http://registry-npm.ywwl.com/@bjorn3/browser_wasi_shim/download/@bjorn3/browser_wasi_shim-0.2.0.tgz","fileCount":12,"integrity":"sha512-kFSqC9hIEivGIWcODhnyhdcbuK9Prj/FJHjb+sa/rcLFlWyFvEtJ/mhM+UG8hZCJkVZtOgSLTRV0OV3J1jjBVA==","signatures":[{"sig":"MEYCIQCgG7ofkMBdoAgYMXksAYMGXB9G1UKJ0T7dwxHL074mDwIhAKBZH3O8cNyS2ABKTGslDd2i/+TZsDDMgwzMbd4qStZO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":59614,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtcBuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrVHhAAkJEorC1H5xoX8muQrNocYo0noKOxoqcdwPQqGmIfm7zVxuAf\r\n52QGJWY1VZIjPhSmfwLfBylgkP8xyjFG2L3CmtrEoUtErePbvUjAlzr1ncq1\r\nVlKNKGjfn1W+45EW+5FIyoJz8ruzd6CPZUSNvpHVM/ZSASt4CkR/IYzUbNQT\r\n4Yybe/7gqb3SVzI4+5CctNqNWBeI2n0IyyiyPWAvoNc9EvPLDPjblH7VH1jT\r\nKuc2w80wuz3WrRbtlUM+enMWGZCrukDpxGcYByUdLUlkMDp/2zO3gu5ds9XA\r\nTRXK9ITthlJcCiVvL69oM6Z7EJvU2zdsORWI49xIJAzakMkgqfLWAOuV2pZF\r\nK3LBCE/etI5kKwW90D02dWUOW40X+rNIHo/QNT7ZPFtme1vhAV4WpjNfm8w/\r\nBD+NqiCWTsRVt9F5xnE8yX2gcqga9zUiM2RmBzS9KrrtoQIBx5uQ+0tVXPvw\r\n/V+cTT5F7M0VhGar71VnoCS825JWwOo/hay+z/whCukRA0xkWlOj9rteVsdy\r\n8mQ6VNp021AdvdhxLezutcTB+DIS4vEQ62FxXUqAkzNyAI3tgCwpyvWdDGRx\r\n2BFgqXxsvHlssWFOMUOY/HgfikfK+u64Epjfa35HxPxwNYF9EgQxESwvhIOV\r\nMcx6WrEgbflyUXFgk6kxIihLkGn7KA3Rs7s=\r\n=Wfna\r\n-----END PGP SIGNATURE-----\r\n","size":12883,"noattachment":false,"key":"/@bjorn3/browser_wasi_shim/-/@bjorn3/browser_wasi_shim-0.2.0.tgz"},"main":"src/index.js","gitHead":"b618d082ab0558c0ed60c679a68e746ead18736e","scripts":{"flow":"flow"},"_npmUser":{"name":"bjorn3","email":"bjorn3_gh@protonmail.com"},"repository":{"url":"git+https://github.com/bjorn3/browser_wasi_shim.git","type":"git"},"_npmVersion":"9.2.0","description":"A pure javascript shim for WASI","directories":{},"_nodeVersion":"18.12.1","_hasShrinkwrap":false,"devDependencies":{"flow-bin":"^0.159.0"},"_npmOperationalInternal":{"tmp":"tmp/browser_wasi_shim_0.2.0_1672855662801_0.30740745896233435","host":"s3://npm-registry-packages"},"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":1672855662938,"_cnpm_publish_time":1672855662938,"dist-tags":{"latest":"0.4.2"}}