{"id":15065676,"url":"https://github.com/mys1024/vite-plugin-wat","last_synced_at":"2026-01-02T19:09:04.379Z","repository":{"id":60515825,"uuid":"543629282","full_name":"mys1024/vite-plugin-wat","owner":"mys1024","description":"A Vite plugin for WebAssembly Text Format.","archived":false,"fork":false,"pushed_at":"2022-10-15T08:32:30.000Z","size":88,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T20:33:25.607Z","etag":null,"topics":["plugin","vite","vitejs","wasm","wat","webassembly"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/vite-plugin-wat","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mys1024.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-30T14:02:54.000Z","updated_at":"2023-11-10T03:26:37.000Z","dependencies_parsed_at":"2023-01-20T02:30:11.097Z","dependency_job_id":null,"html_url":"https://github.com/mys1024/vite-plugin-wat","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mys1024%2Fvite-plugin-wat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mys1024%2Fvite-plugin-wat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mys1024%2Fvite-plugin-wat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mys1024%2Fvite-plugin-wat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mys1024","download_url":"https://codeload.github.com/mys1024/vite-plugin-wat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806114,"owners_count":20350783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["plugin","vite","vitejs","wasm","wat","webassembly"],"created_at":"2024-09-25T00:44:51.060Z","updated_at":"2026-01-02T19:09:04.346Z","avatar_url":"https://github.com/mys1024.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vite-plugin-wat\n\nA [Vite](https://vitejs.dev/) plugin for [WebAssembly Text Format](https://webassembly.github.io/spec/core/text/index.html).\n\n## Install\n\n```shell\nnpm install -D vite-plugin-wat\n```\n\n## Usage\n\n`vite.config.js`:\n\n```javascript\nimport { defineConfig } from 'vite'\nimport Wat from 'vite-plugin-wat'\n\nexport default defineConfig({\n  plugins: [Wat()]\n})\n```\n\n`src/add.wat`:\n\n```wat\n(module\n  (func $add (param $p0 i32) (param $p1 i32) (result i32)\n    local.get $p0\n    local.get $p1\n    i32.add\n  )\n  (export \"add\" (func $add))\n)\n```\n\n`src/index.js`:\n\n```javascript\nimport initAddModule from './add.wat?init'\n\nconst { add } = (await initAddModule({})).exports\nconsole.log(add(1, 2)) // 3\n```\n\n**NOTE**: See [this](https://vitejs.dev/guide/features.html#webassembly) for more information about `?init`.\n\n## TypeScript Support\n\nCreate `src/shims.d.ts` with the following content:\n\n```typescript\n/// \u003creference types=\"vite/client\" /\u003e\n\ndeclare module '*.wat?init' {\n  export { default } from '*.wasm?init'\n}\n```\n\nUse type casting when importing from WASM module:\n\n```typescript\nimport initAddModule from './add.wat?init'\n\ninterface AddModuleExports {\n  add(a: number, b: number): number\n}\n\nconst { add } = (await initAddModule({}))\n  .exports as unknown as AddModuleExports\nconsole.log(add(1, 2)) // 3\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmys1024%2Fvite-plugin-wat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmys1024%2Fvite-plugin-wat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmys1024%2Fvite-plugin-wat/lists"}