@anvil-di/anvil-codegen-wasm 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +6 -6
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2026
|
|
189
|
+
Copyright 2026 Mike Sulak
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# `@
|
|
1
|
+
# `@anvil-di/anvil-codegen-wasm`
|
|
2
2
|
|
|
3
|
-
WASM build of the [`@
|
|
3
|
+
WASM 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).
|
|
4
4
|
|
|
5
5
|
## Why
|
|
6
6
|
|
|
7
|
-
The native [`@
|
|
7
|
+
The 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:
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
import { compile } from "@
|
|
10
|
+
import { compile } from "@anvil-di/anvil-codegen-wasm";
|
|
11
11
|
|
|
12
12
|
const result = compile({
|
|
13
13
|
entryPath: "/abs/src/app-component.ts",
|
|
@@ -54,7 +54,7 @@ The blob includes the entire pipeline: `oxc_parser`, `oxc_codegen`, `anvil-core`
|
|
|
54
54
|
|
|
55
55
|
## Path conventions
|
|
56
56
|
|
|
57
|
-
The 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 `@
|
|
57
|
+
The 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.)
|
|
58
58
|
|
|
59
59
|
## Output equivalence
|
|
60
60
|
|
|
@@ -70,4 +70,4 @@ Both the WASM and native paths emit **byte-identical output** for the same input
|
|
|
70
70
|
| Install footprint | one of five platform packages (~4MB) | single ~1.4MB .wasm |
|
|
71
71
|
| Reach | linux/macos/windows on x64+arm64 | anywhere V8/wasmtime runs |
|
|
72
72
|
|
|
73
|
-
Both paths are first-class. `@
|
|
73
|
+
Both paths are first-class. `@anvil-di/anvil-unplugin` defaults to native (faster) and accepts `mode: "wasm"` as an in-process opt-in.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvil-di/anvil-codegen-wasm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
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).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|