{"_id":"@anvil-di/anvil-codegen-wasm","_rev":"3-156b60f3cfec8935cd99b31a29c81054","name":"@anvil-di/anvil-codegen-wasm","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.2":{"name":"@anvil-di/anvil-codegen-wasm","version":"0.0.2","license":"Apache-2.0","_id":"@anvil-di/anvil-codegen-wasm@0.0.2","maintainers":[{"name":"msulak13","email":"mike@mikesulak.com"}],"dist":{"shasum":"8858da765081eb15f35d3ffbc81318dd2e210b9f","tarball":"https://registry.npmjs.org/@anvil-di/anvil-codegen-wasm/-/anvil-codegen-wasm-0.0.2.tgz","fileCount":9,"integrity":"sha512-/VDCbda2l+Y+D9lYarM8f25lVsaRY+s1RLUiDA5E4DoUOM0ZtjG1/jNENQFpwQdt/EpJaw5GnVU2xl8KAHTC9Q==","signatures":[{"sig":"MEUCIQCCv67nPxx860mUzHBPjEsz5KmeRDsTtt9Mw2v4rs4XKgIgavyGAEeO24L/TbZH/wWpiCk+x0jSkeVQrmZj9qRASvU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":35585},"main":"./lib/index.js","type":"module","_from":"file:anvil-di-anvil-codegen-wasm-0.0.2.tgz","types":"./lib/index.d.ts","module":"./lib/index.js","exports":{".":{"types":"./lib/index.d.ts","import":"./lib/index.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","build:wasm":"wasm-pack build ../../crates/anvil-codegen-wasm --target nodejs --release --out-dir ../../packages/anvil-codegen-wasm/dist --out-name anvil_codegen_wasm && tsc -p tsconfig.json"},"_npmUser":{"name":"msulak13","email":"mike@mikesulak.com"},"_resolved":"/private/var/folders/qf/pst69k617_n5170_c6j0_l0r0000gn/T/44d6fa751334612bbc83b41aee6d6919/anvil-di-anvil-codegen-wasm-0.0.2.tgz","_integrity":"sha512-/VDCbda2l+Y+D9lYarM8f25lVsaRY+s1RLUiDA5E4DoUOM0ZtjG1/jNENQFpwQdt/EpJaw5GnVU2xl8KAHTC9Q==","_npmVersion":"11.6.2","description":"WASM build of the anvil codegen pipeline. Same parser + graph + emitter as the native CLI, in-process for any host that runs WebAssembly (Node, browsers, Workers, Bun).","directories":{},"_nodeVersion":"25.2.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.8","typescript":"^5.7.2","@types/node":"^22.10.0"},"_npmOperationalInternal":{"tmp":"tmp/anvil-codegen-wasm_0.0.2_1779037460810_0.571011880263244","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@anvil-di/anvil-codegen-wasm","version":"0.0.3","license":"Apache-2.0","_id":"@anvil-di/anvil-codegen-wasm@0.0.3","maintainers":[{"name":"msulak13","email":"mike@mikesulak.com"}],"homepage":"https://github.com/msulak13/anvil#readme","bugs":{"url":"https://github.com/msulak13/anvil/issues"},"dist":{"shasum":"4a3de8433be6f107e59aa05a8aa442ac4fc5070d","tarball":"https://registry.npmjs.org/@anvil-di/anvil-codegen-wasm/-/anvil-codegen-wasm-0.0.3.tgz","fileCount":9,"integrity":"sha512-YiC/VrIYEHH4iIYwo/4qdRWYlicNKGTZiJX/3LSSxsYLAtVhZGe/y064J3vAM82gX1OawKZiX0+QKrf2AJPUmQ==","signatures":[{"sig":"MEUCIQCgyMyn/ycDBS5aNu+Hy+BC6wl89g96nTQ2oXNFDHejYQIgTdsM3RT9ecXzajb+uKkEsNLMJR7fC7swwiXak1OHOgQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@anvil-di%2fanvil-codegen-wasm@0.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":35682},"main":"./lib/index.js","type":"module","_from":"file:anvil-di-anvil-codegen-wasm-0.0.3.tgz","types":"./lib/index.d.ts","module":"./lib/index.js","exports":{".":{"types":"./lib/index.d.ts","import":"./lib/index.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","build:wasm":"wasm-pack build ../../crates/anvil-codegen-wasm --target nodejs --release --out-dir ../../packages/anvil-codegen-wasm/dist --out-name anvil_codegen_wasm && tsc -p tsconfig.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:da83924c-21c1-4ccb-8f30-06ee6309e76f"}},"_resolved":"/home/runner/work/anvil/anvil/packages/anvil-codegen-wasm/anvil-di-anvil-codegen-wasm-0.0.3.tgz","_integrity":"sha512-YiC/VrIYEHH4iIYwo/4qdRWYlicNKGTZiJX/3LSSxsYLAtVhZGe/y064J3vAM82gX1OawKZiX0+QKrf2AJPUmQ==","repository":{"url":"git+https://github.com/msulak13/anvil.git","type":"git"},"_npmVersion":"11.14.1","description":"WASM build of the anvil codegen pipeline. Same parser + graph + emitter as the native CLI, in-process for any host that runs WebAssembly (Node, browsers, Workers, Bun).","directories":{},"_nodeVersion":"24.15.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.8","typescript":"^5.7.2","@types/node":"^22.10.0"},"_npmOperationalInternal":{"tmp":"tmp/anvil-codegen-wasm_0.0.3_1779067516007_0.1952663965935142","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@anvil-di/anvil-codegen-wasm","version":"0.0.4","description":"WASM build of the anvil codegen pipeline. Same parser + graph + emitter as the native CLI, in-process for any host that runs WebAssembly (Node, browsers, Workers, Bun).","license":"Apache-2.0","type":"module","main":"./lib/index.js","module":"./lib/index.js","types":"./lib/index.d.ts","exports":{".":{"types":"./lib/index.d.ts","import":"./lib/index.js"}},"devDependencies":{"@types/node":"^22.10.0","typescript":"^5.7.2","vitest":"^2.1.8"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/msulak13/anvil.git"},"scripts":{"build:wasm":"wasm-pack build ../../crates/anvil-codegen-wasm --target nodejs --release --out-dir ../../packages/anvil-codegen-wasm/dist --out-name anvil_codegen_wasm && tsc -p tsconfig.json","build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","test":"vitest run"},"_id":"@anvil-di/anvil-codegen-wasm@0.0.4","bugs":{"url":"https://github.com/msulak13/anvil/issues"},"homepage":"https://github.com/msulak13/anvil#readme","_integrity":"sha512-242mSFtJ/UPy6/7uFugLnqeGvjXdp++0OlIQnOao0X+TXyAYv9yjtqy2WBmQzxqUkQ5+CtSUZ28jF1TDir0Wqw==","_resolved":"/home/runner/work/anvil/anvil/packages/anvil-codegen-wasm/anvil-di-anvil-codegen-wasm-0.0.4.tgz","_from":"file:anvil-di-anvil-codegen-wasm-0.0.4.tgz","_nodeVersion":"24.18.0","_npmVersion":"12.0.1","dist":{"integrity":"sha512-242mSFtJ/UPy6/7uFugLnqeGvjXdp++0OlIQnOao0X+TXyAYv9yjtqy2WBmQzxqUkQ5+CtSUZ28jF1TDir0Wqw==","shasum":"4aa2db2a1ee37b9d1ebe9da7c0d35b82ad182ff9","tarball":"https://registry.npmjs.org/@anvil-di/anvil-codegen-wasm/-/anvil-codegen-wasm-0.0.4.tgz","fileCount":9,"unpackedSize":35680,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@anvil-di%2fanvil-codegen-wasm@0.0.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFQ6D4cgdJLRWv/t95KSqkNroJx6RuHEk7TQx0tuI44kAiEA01B83MbldOjK6Oq22+bcGWA+A1pOAGa9Ee8H0/4jGKE="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:da83924c-21c1-4ccb-8f30-06ee6309e76f"}},"directories":{},"maintainers":[{"name":"msulak13","email":"mike@mikesulak.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/anvil-codegen-wasm_0.0.4_1784953732909_0.5028461322708002"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-17T17:04:20.730Z","modified":"2026-07-25T04:28:53.406Z","0.0.2":"2026-05-17T17:04:20.985Z","0.0.3":"2026-05-18T01:25:16.146Z","0.0.4":"2026-07-25T04:28:53.087Z"},"bugs":{"url":"https://github.com/msulak13/anvil/issues"},"license":"Apache-2.0","homepage":"https://github.com/msulak13/anvil#readme","repository":{"type":"git","url":"git+https://github.com/msulak13/anvil.git"},"description":"WASM build of the anvil codegen pipeline. Same parser + graph + emitter as the native CLI, in-process for any host that runs WebAssembly (Node, browsers, Workers, Bun).","maintainers":[{"name":"msulak13","email":"mike@mikesulak.com"}],"readme":"# `@anvil-di/anvil-codegen-wasm`\n\nWASM build of the [`@anvil-di/anvil`](https://github.com/msulak13/tsdi) codegen pipeline. Same parser, graph builder, validator, and emitter as the native CLI — exactly the Rust source, compiled with `wasm-pack` — running in-process for any host that runs WebAssembly (Node, browsers, Workers, Bun, Deno, StackBlitz).\n\n## Why\n\nThe native [`@anvil-di/anvil-cli`](../anvil-cli/README.md) is fast, but every invocation still pays a process-spawn cost (~10ms). Inside a bundler's hot path, that's the difference between \"imperceptible\" and \"every save has a noticeable hitch\". `@anvil-di/anvil-codegen-wasm` is a direct function call:\n\n```ts\nimport { compile } from \"@anvil-di/anvil-codegen-wasm\";\n\nconst result = compile({\n  entryPath: \"/abs/src/app-component.ts\",\n  files: { \"/abs/src/app-component.ts\": \"...\", \"/abs/src/heater.ts\": \"...\" },\n  version: \"0.0.1\",\n});\n```\n\nNo spawn, no IPC, no file write — `result.emittedFiles` is the dagger output as in-memory strings, ready to feed straight into Vite's transform pipeline or write to disk if you prefer.\n\n## API\n\n```ts\ninterface CompileInput {\n  entryPath: string;                  // absolute path to the @Component\n  files: Record<string, string>;      // every reachable file, abs path → source\n  aliases?: PathAlias[];              // tsconfig `paths` aliases\n  version: string;                    // baked into the dagger banner comment\n}\n\ninterface PathAlias {\n  pattern: string;   // \"@/*\"\n  target: string;    // \"src/*\"\n  baseDir: string;   // absolute dir the relative target resolves against\n}\n\ninterface CompileOutput {\n  emittedFiles: { path: string; contents: string }[];\n  diagnostics: Diagnostic[];          // structured; route to bundler error UI\n}\n```\n\nDiagnostics are **non-fatal** — the function returns normally even when validation fails. Hosts decide how to render them (Vite overlay, Rollup `this.warn`, Webpack stats output, plain `console.error`, etc.).\n\n## How it gets built\n\nThe Rust source lives in `crates/anvil-codegen-wasm/`. `wasm-pack build --target nodejs` produces:\n\n- `dist/anvil_codegen_wasm_bg.wasm` — the WASM blob (~1.4MB unoptimized; gzips to ~400KB)\n- `dist/anvil_codegen_wasm.js` — the wasm-bindgen JS glue\n- `lib/index.js` — typed ESM wrapper (this package)\n\nThe blob includes the entire pipeline: `oxc_parser`, `oxc_codegen`, `anvil-core` (graph + validation), `anvil-parser` (decorator extraction), and `anvil-codegen` (TS emission). The only piece that's *different* from the native CLI is the resolver — the WASM build uses a small custom in-memory resolver instead of `oxc_resolver`'s full filesystem-backed implementation. Tsconfig `paths` aliases work; the rest of `oxc_resolver`'s feature set (browser fields, conditional exports, workspace overrides) is the bundler's job.\n\n## Path conventions\n\nThe wasm32 Rust target uses Unix-style path semantics — backslashes are part of filenames, not separators. The WASM compile boundary normalizes Windows-style paths (`C:\\Users\\foo`) to forward-slash form (`C:/Users/foo`) automatically; the emitted file paths come back in the same form. Hosts running on Windows can convert back to backslashes for `fs.writeFileSync` calls. (The `@anvil-di/anvil-unplugin` does this transparently.)\n\n## Output equivalence\n\nBoth the WASM and native paths emit **byte-identical output** for the same input — same parser, same graph builder, same emitter, same `oxc_codegen` canonicalization. The golden-fixture suite under `tests/fixtures/` validates the native path; the WASM path is unit-tested for the same shapes (parser → graph → emit) in this package's `src/index.test.ts`.\n\n## Tradeoffs vs the native binary\n\n| Property | Native | WASM |\n|---|---|---|\n| Cold start | ~10ms (process spawn) | ~80-150ms (wasm compile + instantiate) |\n| Steady-state codegen | 1× | ~1.5-2× slower (oxc parsing is the bottleneck) |\n| Bundler hot path | spawn + IPC per build | direct function call |\n| Install footprint | one of five platform packages (~4MB) | single ~1.4MB .wasm |\n| Reach | linux/macos/windows on x64+arm64 | anywhere V8/wasmtime runs |\n\nBoth paths are first-class. `@anvil-di/anvil-unplugin` defaults to native (faster) and accepts `mode: \"wasm\"` as an in-process opt-in.\n","readmeFilename":"README.md"}