{"name":"@bjorn3/browser_wasi_shim","version":"0.1.0","author":{"name":"bjorn3"},"license":"MIT OR Apache-2.0","_id":"@bjorn3/browser_wasi_shim@0.1.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":"c65ceb98e40e988a6e4527883f857f87adf28af5","tarball":"http://registry-npm.ywwl.com/@bjorn3/browser_wasi_shim/download/@bjorn3/browser_wasi_shim-0.1.0.tgz","fileCount":11,"integrity":"sha512-Y40ya5ONBFZQNg6DJAbB5AC/76k+auU03se3h9bnLsUDzn4OQfjXw8mbUcWiz0uX7HgObC2S/486Oa0d+fjSqA==","signatures":[{"sig":"MEQCIB5In8lV+uEeqpfzcWqI/IRAcE33s/2jiWGCd94lnOnxAiAz/1chULhAMS+kNKjR6QGLlAphc6cNATowDeR1FQk/tg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":59346,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi9VLqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpt5g/+KM1xHBJmyHIPWneNbJW0x1i9t/rIYxVI2Z51YBWtpCrjjjdw\r\nYifi3fpCLpP7SpY/92B7Jd0a18Or2KPwFbHN58Vvzv8m4JUoCpXQkmXR67BD\r\nlRZBvIF9ywXBmPy19Ia+yWbAezAoK7i1e8lc3RTZ8ZasocE1e10Ss9CMMCnE\r\nlWWWn+jOI7mQ+LeLLwbJ4k21YVICDrSAZ7B2JksEXmaJa9RtsTYVrRurx5Oe\r\nJrgTvvI225D6PpDrOrc/Jlt9cn7CMd/qq/hsuy5zEujqN3KbDZzFRug63nhp\r\n+ztFcrWJEVvfq5y3qzxSJdM9Dszw/BZsKPPv0FHUpxAuCrumYgccahqi1sL6\r\nef/okysfNMTI9BwD3eZPkpgGeTZ6uhTQduRxOOa0azDzX4LrYfGE2ICa386y\r\nPh4DcXL84xmI9TX59bk3wYOgMDS5xhHvzdHvx/EmVT51ke9v0XV+FztWV9Yt\r\nMUqhOf5XnOMJe5XgpQHj1f6EuH7VKBO7UiP9ju+cdTnkJgPoVR8FprneTB7/\r\nj/H+k2zqVYyqoIGL3kezGPDRPerS8QZoC8jgEw0NB7nxzBGADEaak9FchsWE\r\njJXFZVRl/ENMhPL/AC9e8rW8o5oeGXnzQWLj1vMgThoZ+M2Uqkep7joqKXHh\r\nrRZLTt4OVN3fyYN2ZDRGLqlUtNRkq9aGc4E=\r\n=byj3\r\n-----END PGP SIGNATURE-----\r\n","size":12741,"noattachment":false,"key":"/@bjorn3/browser_wasi_shim/-/@bjorn3/browser_wasi_shim-0.1.0.tgz"},"gitHead":"9d8980514e790876208dcd018c125eef9ffb35ca","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":"8.17.0","description":"A pure javascript shim for WASI","directories":{},"_nodeVersion":"12.22.12","_hasShrinkwrap":false,"devDependencies":{"flow-bin":"^0.159.0"},"_npmOperationalInternal":{"tmp":"tmp/browser_wasi_shim_0.1.0_1660244714094_0.015445229395774973","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":1660244714328,"_cnpm_publish_time":1660244714328,"dist-tags":{"latest":"0.4.2"}}