{"_id":"@authtastic/vite-plugin-wasm-pack","_rev":"2-92984a53a094d3e5382e2d142faefaac","name":"@authtastic/vite-plugin-wasm-pack","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@authtastic/vite-plugin-wasm-pack","version":"0.1.0","keywords":["wasm-pack","wasm-bindgen","vite-plugin","webassembly","wasm","rust","vite","cargo"],"author":{"name":"nshen","email":"nshen121@gmail.com"},"license":"MIT","_id":"@authtastic/vite-plugin-wasm-pack@0.1.0","maintainers":[{"name":"shnoorg","email":"shnoorg@proton.me"}],"homepage":"https://github.com/nshen/vite-plugin-wasm-pack#readme","bugs":{"url":"https://github.com/nshen/vite-plugin-wasm-pack/issues"},"dist":{"shasum":"60ef207beda8a385c570de11c9129c002b432151","tarball":"https://registry.npmjs.org/@authtastic/vite-plugin-wasm-pack/-/vite-plugin-wasm-pack-0.1.0.tgz","fileCount":3,"integrity":"sha512-dqHhG1ibS7dg5AAfPictkjb144QwIbAlWdBiAvbi4xkunzdiVEmBKXXu93mtxFEEkhLIhQCLjHHXk0j17IRVOw==","signatures":[{"sig":"MEYCIQDk8wvGwRoaCRrmfcc4wLgnjy7k+Qg0wF8xy8sxfJFDRgIhAPxsXC9Zwpc6O8ijoy9oHpmacUW9u/AnnXlktHZXDKd0","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6129},"main":"dist/index.js","types":"dist/index.d.ts","module":"esm/index.js","gitHead":"a0501925643775829914099738208fed7c476df1","scripts":{"dev":"tsc -w","build":"tsc && tsc -p tsconfig.esm.json"},"_npmUser":{"name":"shnoorg","email":"shnoorg@proton.me"},"repository":{"url":"git+https://github.com/nshen/vite-plugin-wasm-pack.git","type":"git"},"_npmVersion":"10.8.2","description":"Vite plugin for rust using wasm-pack 🦀","directories":{},"_nodeVersion":"20.17.0","dependencies":{"chalk":"^4.1.2","fs-extra":"^10.0.0","narrowing":"^1.4.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"2.6.14","prettier":"^2.4.1","typescript":"^4.4.4","@types/node":"^12.0.0","@types/fs-extra":"^9.0.13","@tsconfig/node12":"^1.0.9"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-wasm-pack_0.1.0_1725404836411_0.8118372884631413","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"@authtastic/vite-plugin-wasm-pack","version":"0.1.1","keywords":["wasm-pack","wasm-bindgen","vite-plugin","webassembly","wasm","rust","vite","cargo"],"author":{"name":"nshen","email":"nshen121@gmail.com"},"license":"MIT","_id":"@authtastic/vite-plugin-wasm-pack@0.1.1","maintainers":[{"name":"shnoorg","email":"shnoorg@proton.me"}],"homepage":"https://github.com/nshen/vite-plugin-wasm-pack#readme","bugs":{"url":"https://github.com/nshen/vite-plugin-wasm-pack/issues"},"dist":{"shasum":"2dc7c2a539dc1b49b82a1bbdc7b032d1b431ae0e","tarball":"https://registry.npmjs.org/@authtastic/vite-plugin-wasm-pack/-/vite-plugin-wasm-pack-0.1.1.tgz","fileCount":5,"integrity":"sha512-70HLaqWL02VOa7QPJp36cuVDOQQBaES/HHRtShWRL73QP60woqNnmuqMeJb/MsP7C8Wnf5ahvexQT7kQ+St4bQ==","signatures":[{"sig":"MEYCIQDSDKPgnSgHHhQZ4Oiear9IDKj/2hoTE/ue/kurB9m49wIhAL0OlpmjTSajq2CsWD7l5EaAMqlZjO9L1wTKjOYPTt09","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14671},"main":"dist/index.js","types":"dist/index.d.ts","module":"esm/index.js","gitHead":"519710b9991a99ddb524316e0d294dcb702be9c4","scripts":{"dev":"tsc -w","build":"tsc && tsc -p tsconfig.esm.json"},"_npmUser":{"name":"shnoorg","email":"shnoorg@proton.me"},"repository":{"url":"git+https://github.com/nshen/vite-plugin-wasm-pack.git","type":"git"},"_npmVersion":"10.8.2","description":"Vite plugin for rust using wasm-pack 🦀","directories":{},"_nodeVersion":"20.17.0","dependencies":{"chalk":"^4.1.2","fs-extra":"^10.0.0","narrowing":"^1.4.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"2.6.14","prettier":"^2.4.1","typescript":"^4.4.4","@types/node":"^12.0.0","@types/fs-extra":"^9.0.13","@tsconfig/node12":"^1.0.9"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-wasm-pack_0.1.1_1725405038533_0.8237345098631386","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"@authtastic/vite-plugin-wasm-pack","version":"0.1.2","description":"Vite plugin for rust using wasm-pack 🦀","main":"dist/index.js","module":"esm/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc && tsc -p tsconfig.esm.json","dev":"tsc -w"},"author":{"name":"nshen","email":"nshen121@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/shnoorg/vite-plugin-wasm-pack.git"},"bugs":{"url":"https://github.com/shnoorg/vite-plugin-wasm-pack/issues"},"devDependencies":{"@tsconfig/node12":"^1.0.9","@types/fs-extra":"^9.0.13","@types/node":"^12.0.0","prettier":"^2.4.1","typescript":"^4.4.4","vite":"2.6.14"},"dependencies":{"chalk":"^4.1.2","fs-extra":"^10.0.0","narrowing":"^1.4.0"},"_id":"@authtastic/vite-plugin-wasm-pack@0.1.2","gitHead":"e1b6377b00ed5f2f3851e12d5391c51674f04375","homepage":"https://github.com/shnoorg/vite-plugin-wasm-pack#readme","_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-9MawyMn/LQSCNL+YYyLpoa4rpsJOijjxtLgEKs2uG5VBHrqGg2jFa/SmpAG5eluj8h/hf7cAoFTEK+oEmvVqGg==","shasum":"3f88a249b30b871df33201f6491a88335a9e0f3c","tarball":"https://registry.npmjs.org/@authtastic/vite-plugin-wasm-pack/-/vite-plugin-wasm-pack-0.1.2.tgz","fileCount":5,"unpackedSize":14688,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAYpUE1EpXv+XVAD1Utq1ArC4hOcb9SmWJvhg330/xAsAiAs46pfCHOZhE5Fb+p7xfOn9CosLMSUCwo23l1g5a+oCA=="}]},"_npmUser":{"name":"shnoorg","email":"shnoorg@proton.me"},"directories":{},"maintainers":[{"name":"shnoorg","email":"shnoorg@proton.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-wasm-pack_0.1.2_1725409412516_0.14316445608294281"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-03T23:07:16.328Z","modified":"2024-09-04T00:23:32.884Z","0.1.0":"2024-09-03T23:07:16.549Z","0.1.1":"2024-09-03T23:10:38.677Z","0.1.2":"2024-09-04T00:23:32.669Z"},"bugs":{"url":"https://github.com/shnoorg/vite-plugin-wasm-pack/issues"},"author":{"name":"nshen","email":"nshen121@gmail.com"},"license":"MIT","homepage":"https://github.com/shnoorg/vite-plugin-wasm-pack#readme","repository":{"type":"git","url":"git+https://github.com/shnoorg/vite-plugin-wasm-pack.git"},"description":"Vite plugin for rust using wasm-pack 🦀","maintainers":[{"name":"shnoorg","email":"shnoorg@proton.me"}],"readme":"<p align=\"center\">\n  <img width=\"404\" src=\"./banner.png\" alt=\"vite + wasm pic\"/>\n</p>\n\n<h1 align=\"center\">\n  \n🦀 Vite plugin for rust [wasm-pack](https://github.com/rustwasm/wasm-pack), it's simple.\n  \n</h1>\n\n<h4 align=\"center\">\n  \n[![npm](https://img.shields.io/npm/v/vite-plugin-wasm-pack.svg)](https://www.npmjs.com/package/vite-plugin-wasm-pack)\n[![npm](https://img.shields.io/npm/dt/vite-plugin-wasm-pack)](https://www.npmjs.com/package/vite-plugin-wasm-pack)\n[![npm](https://img.shields.io/github/license/nshen/vite-plugin-wasm-pack)](https://www.npmjs.com/package/vite-plugin-wasm-pack)\n  \n</h4>\n\n## Fork\n\nThis package is a fork of https://www.npmjs.com/package/vite-plugin-wasm-pack, which adds support for handling packages with custom `--out-name`s.\n\n## Quick start\n\nMake sure [wasm-pack](https://github.com/rustwasm/wasm-pack) installed correctly.\n\nClone this repo or download the [zip file](https://github.com/nshen/vite-plugin-wasm-pack/archive/refs/heads/main.zip), extract the example folder.\n\n```\nexample\n  |\n  |-- my-crate       # rust project folder, there is a Cargo.toml in it\n  |-- src            # front end source code\n  |   |-- index.ts   # entry point\n  |-- index.html     # html entry\n  |-- vite.config.ts # vite config file\n  |__ package.json   # npm config file\n```\n\nInstall npm develop dependencies, **in example folder** run:\n\n```bash\nyarn install\n# or\n# npm install\n```\n\nAfter that you can build `rust project` to `WebAassembly` by using `wasm-pack`.\n\n```bash\nwasm-pack build ./my-crate --target web\n```\n\nNow the `my-crate` module is ready, start vite dev server.\n\n```bash\nyarn dev\nor\n#npm run dev\n```\n\nDone, if below is showing.\n\n```bash\n  vite v2.6.5 dev server running at:\n\n  > Local: http://localhost:3000/\n\n  ready in 169ms.\n```\n\n---\n\n## Install manually\n\n```bash\nyarn add vite vite-plugin-wasm-pack -D\n# or\n# npm i vite vite-plugin-wasm-pack vite -D\n```\n\n## Usage\n\nAdd this plugin to `vite.config.ts`\n\n```js\nimport { defineConfig } from 'vite';\nimport wasmPack from 'vite-plugin-wasm-pack';\n\nexport default defineConfig({\n  // pass your local crate path to the plugin\n  plugins: [wasmPack('./my-crate')]\n});\n```\n\nAdd script to `package.json`\n\n```json\n\"scripts\": {\n  \"dev\": \"vite\",\n  \"build\": \"vite build\"\n}\n```\n\n⚠ **Don't forget to build your [wasm-pack](https://github.com/rustwasm/wasm-pack) crate first!**\n\n```bash\nwasm-pack build ./my-crate --target web\n```\n\nTips: you can add a `wasm` script to `package.json` like this:\n\n```json\n\"scripts\": {\n    \"wasm\": \"wasm-pack build ./my-crate --target web\",\n    \"dev\": \"yarn wasm && vite\",\n    \"build\": \"vite build\"\n}\n```\n\nThen, run:\n\n```bash\nyarn dev\n```\n\nThis will start dev server, and install `my-crate` that you built earlier.\n\n## Use wasm-pack package installed via npm\n\nIf you want use a package from npm that built with wasm-pack, like this one [test-npm-crate](https://www.npmjs.com/package/test-npm-crate)\n\nyou have to pass the package name to the second param of our plugin.\n\n`wasmPack(['./my-local-crate'],['test-npm-crate'])`\n\nfull example is in [./npm-crate-example](./npm-crate-example) folder.\n\nnotice, we only support package build with `--target web` for now , if a package you use is built without `--target web`, you should rebuild it. \n\nlike this example  [[Photon-vite]](http://github.nshen.net/photon-vite/) [[source]](https://github.com/nshen/photon-vite)\n\n## Cache Problem\n\nI'm not sure if anybody have met the problem that after modified your package, your package don't update.\n\nThat's becasue vite pre bundling your package, you can follow [vite guide](\nhttps://vitejs.dev/guide/dep-pre-bundling.html) to solve the problem.\n\nIf you met the problem , or any problems. feel free to [create an issue](https://github.com/nshen/vite-plugin-wasm-pack/issues), let me see if I can do something to help you, thanks.\n\n## Examples\n\n- Quick starter is in [./example](./example) folder.\n- Game of life [[demo]](http://github.nshen.net/vite-wasm-game-of-life/dist/) [[source]](https://github.com/nshen/vite-wasm-game-of-life)\n- Photon-vite [[demo]](http://github.nshen.net/photon-vite/) [[source]](https://github.com/nshen/photon-vite)\n\n\n## License\n\nMIT, see [the license file](./LICENSE)\n","readmeFilename":"README.md"}