{"name":"@bjorn3/browser_wasi_shim","version":"0.2.6","author":{"name":"bjorn3"},"license":"MIT OR Apache-2.0","_id":"@bjorn3/browser_wasi_shim@0.2.6","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":"e576e6c94bdb89fe858ce29222a89b25338ce95c","tarball":"http://registry-npm.ywwl.com/@bjorn3/browser_wasi_shim/download/@bjorn3/browser_wasi_shim-0.2.6.tgz","fileCount":21,"integrity":"sha512-0EFdTLZWUOMaWi7649zwbZbPp0CRWYyBtWsMuaw6kSQJLfLWxb2zu73k2MAsGx/z/oLDoWkhpXDfd9ffLxgIUg==","signatures":[{"sig":"MEUCIDZs1JOytJ4DFtfCDNccxBb8XJqPZv1K5XsOsh3KC/NuAiEAs23BOjgAs99aT7zNoRlsk3NEbzslba7EDAvMp8HK+ck=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":83388,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkBPr1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrr8w/+MXdobXZzp7ucaYm0z9hIXGrdv6q2xVCQGAWDr7piCgza43g3\r\nAHWCM2vk1W3kxX91JcPxyWUVLhBYAM2aRoDX2gJG88Fa2QxMqfMyu5C1S9DC\r\nb/pnek1v+/VUzLD/VbkLIF2BS0LhR+zwFgW9S5YJSXeFP4/6696n0peEmCzJ\r\nFcktaggWP/ArhVUwPPWZB0hpDb05C64l0QSenNjWzrcV0VcTRr9taHAMxO4A\r\nRGmfHDfZ56MhOTeTfa67TMS9cyuxuZyc6R1w7tOr4laXfJBq9WvONzch7/kd\r\npH/BQVa70tUiQ660SebRZh3REZwYVO/icwygM6mlPyLCLpJVzxHCp4Q5JZ4v\r\noi3dnX5hLVcBmjzrME2SwWV2P7Cimm0CRrtQY3VGYimQ2by3RRZwzSfdo7sy\r\nKjCI7//F1hGSLS8yDHS56bqG8h1CxT9D/7GBOdEgxN4lAj8zO8Ksh8zCk3Bv\r\n6jqwiKyKi9tNxwD/Yh0pqgkaHV9xzsWpg2newHP1KVksLUIWfIWmNaZ/G3Je\r\n2aHn+Agtyd749f+MKFMT8/qhgO4RYgoMr0REX88orBhJ/cgA3GuLTim213v/\r\n0ke3TgwFOgZGtHhd+mJsv2q3BiS1910QGr9hwcOIgo5rzxnwyen4ftHoq37A\r\ncJLZPenEgVq6sC4AmERfX8G/CEABUlmAkfk=\r\n=CRXA\r\n-----END PGP SIGNATURE-----\r\n","size":24489,"noattachment":false,"key":"/@bjorn3/browser_wasi_shim/-/@bjorn3/browser_wasi_shim-0.2.6.tgz"},"type":"module","exports":{".":{"import":"./dist/index.js"}},"gitHead":"aea920591d15b2b5f7b5608bd2cbb795b0a50a39","scripts":{"build":"swc src -d dist && tsc --emitDeclarationOnly","check":"tsc --noEmit","prepare":"swc src -d dist && tsc --emitDeclarationOnly"},"typings":"./typings/index.d.ts","_npmUser":{"name":"bjorn3","email":"bjorn3_gh@protonmail.com"},"repository":{"url":"git+https://github.com/bjorn3/browser_wasi_shim.git","type":"git"},"_npmVersion":"8.19.3","description":"A pure javascript shim for WASI","directories":{},"_nodeVersion":"16.19.1","_hasShrinkwrap":false,"devDependencies":{"@swc/cli":"^0.1.62","@swc/core":"^1.3.37","typescript":"^4.9.5"},"_npmOperationalInternal":{"tmp":"tmp/browser_wasi_shim_0.2.6_1678047989703_0.43084012326493193","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":1678047989901,"_cnpm_publish_time":1678047989901,"dist-tags":{"latest":"0.4.2"}}