{"name":"@bjorn3/browser_wasi_shim","version":"0.2.5","author":{"name":"bjorn3"},"license":"MIT OR Apache-2.0","_id":"@bjorn3/browser_wasi_shim@0.2.5","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":"59deb04105c2f89bd19ec77643b53c602ea8bf23","tarball":"http://registry-npm.ywwl.com/@bjorn3/browser_wasi_shim/download/@bjorn3/browser_wasi_shim-0.2.5.tgz","fileCount":21,"integrity":"sha512-cgQS5vyp4UpCRVTjt0rGsoxT44WsxDUjYFCLtAy5W6xZ/FRd+SuMXJ7mINmAx7HdQf6PoG8mYZsyuDyyu7rP3A==","signatures":[{"sig":"MEUCIG/wJvmyrQQn4cX4w3m/BT+tb65uyV5eXgld9m/XXDY/AiEAmCRCdy7KbCemeiYchm4ZG6cVh6c3oZ3Jgk9OhYlxd9w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":83364,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkBH66ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmok4A/9GiFMmhf5lirveTs3zhrXJCV01TrR3qcq7n2bYZeo5dkj+FPs\r\nlBGBCeXIxo2a+xG8HSEjcNi4+geK7VzFM1yjoY7v3VmpuSEwDk+Z3J8TcGVL\r\nfk3fFw9a1Jj9rHIhrNtwVHek9CSGbeHA1S4tbdJMBnmU8IWdfP4EjVuRx3wd\r\nk4yze1Vj63uVUQvB3IdiqgxZF65Yr3+GOdVmVSHNuQG92xY2Eo5rq2A4iM7P\r\neToRoiz7k2EFiew8+JVeWvg8Nj8tKYWHSTOMNq3pLC8YsZosXL3lfR7ftu/B\r\ni8xq3ykFH/ej3JB0+Hvr8K4WrK0RT+23Lkj1Nvo8T+ZkIkf69lZ1KlWhTFk6\r\n/XwW+y+TfUv0QngENgqHLlT3kytxFjMwMivfjdPoMrbj7PVwo8BFWR7EPDDD\r\ns8T2LVnj85cx7vFSb4TipDw3y1TvR/bG80gDKCAfAAQWn/BtIkiYE0Oyr4xJ\r\nQub4GIQzKfc9iT7rSDP42T0j1C0k7R2jA9U+/V2IK5SYhWHAtsne4VX8rgBn\r\n54+sz5zpSb4V7u+RHOUj3oTYQFXef2FM6OpBiGyEVC7Ww/l0Q8H5/4c010WQ\r\nlEJ/XsMK7JbqefnT40u7a89ZW9XB7gcoo79lyzZo3UxC4FKsXyYEYbcNBOJP\r\n5yDe9ld3sh6tZjt7jOuCJhSlyufUVXzUeT0=\r\n=W1Fo\r\n-----END PGP SIGNATURE-----\r\n","size":24492,"noattachment":false,"key":"/@bjorn3/browser_wasi_shim/-/@bjorn3/browser_wasi_shim-0.2.5.tgz"},"type":"module","exports":{".":{"import":"./dist/index.js"}},"gitHead":"926e665f6e55e1a6714cccde002d7e2a6b6f69e8","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.5_1678016186132_0.12982302873494023","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":1678016186287,"_cnpm_publish_time":1678016186287,"dist-tags":{"latest":"0.4.2"}}