{"_id":"@candlecorp/browser_wasi_shim","name":"@candlecorp/browser_wasi_shim","dist-tags":{"latest":"0.2.16"},"versions":{"0.2.16":{"name":"@candlecorp/browser_wasi_shim","version":"0.2.16","license":"MIT OR Apache-2.0","description":"A pure javascript shim for WASI","type":"module","scripts":{"build":"swc src -d dist && tsc --emitDeclarationOnly","watch":"swc src -w -d dist","prepare":"swc src -d dist && tsc --emitDeclarationOnly","check":"tsc --noEmit && prettier src -c && eslint src/","test":"playwright test","test:build":"./scripts/build-tests.sh","test:server":"http-server -p 3000"},"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"},"exports":{".":{"types":"./typings/index.d.ts","import":"./dist/index.js"}},"typings":"./typings/index.d.ts","homepage":"https://github.com/bjorn3/browser_wasi_shim#readme","devDependencies":{"@playwright/test":"^1.38.1","@swc/cli":"^0.1.62","@swc/core":"^1.3.37","@types/node":"^20.8.4","@typescript-eslint/eslint-plugin":"^6.7.4","@typescript-eslint/parser":"^6.7.4","chokidar":"^3.5.3","eslint":"^8.50.0","http-server":"^14.1.1","playwright":"^1.38.1","prettier":"^3.0.3","typescript":"^4.9.5"},"_id":"@candlecorp/browser_wasi_shim@0.2.16","gitHead":"b719a54b94ab4a85114fdbc087b5bcd058f3fef9","_nodeVersion":"20.8.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-aWH+TNqN0RkPbazUPyl3R6FMlTR8BlFqT7z+gYmGJyKI1TGRqpQqRXgPHTphiOumKkPmXNY5di0SE2vJ7taWpQ==","shasum":"cfdb1d2e26617daf93ca3025b4cfb200371290fc","tarball":"https://registry.npmjs.org/@candlecorp/browser_wasi_shim/-/browser_wasi_shim-0.2.16.tgz","fileCount":4267,"unpackedSize":40797698,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGmmgBUvDBSHCuBuJFWllPExUXPTu3k0Hf2RP+XFunkwAiAMhwtIYKpPFexsXMJLmnPj+FXoFhbhYNp3JKhOBvh+XQ=="}]},"_npmUser":{"name":"jsoverson","email":"jsoverson@gmail.com"},"directories":{},"maintainers":[{"name":"jsoverson","email":"jsoverson@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/browser_wasi_shim_0.2.16_1697130493391_0.3681645179785229"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-12T17:08:13.390Z","0.2.16":"2023-10-12T17:08:13.872Z","modified":"2023-10-12T17:08:14.302Z"},"maintainers":[{"name":"jsoverson","email":"jsoverson@gmail.com"}],"description":"A pure javascript shim for WASI","homepage":"https://github.com/bjorn3/browser_wasi_shim#readme","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"},"license":"MIT OR Apache-2.0","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, 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    new OpenFile(new File([])), // stdout\n    new OpenFile(new File([])), // stderr\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 tests\n\nThis project uses playwright to run tests in a browser using WebAssembly built from the Wasmtime project.\n\nTo clone wasmtime and build the test WebAssembly, run:\n\n```\n$ npm test:build\n```\n\nOnce the WebAssembly is built, you can run the tests with:\n\n```\n$ npm test\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\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","readmeFilename":"README.md"}