@anvil-di/anvil-unplugin 0.0.4 → 0.0.6
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 +11 -11
- package/package.json +3 -3
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,6 +1,6 @@
|
|
|
1
|
-
# `@
|
|
1
|
+
# `@anvil-di/anvil-unplugin`
|
|
2
2
|
|
|
3
|
-
Run [`@
|
|
3
|
+
Run [`@anvil-di/anvil`](https://github.com/msulak13/tsdi) codegen as part of your bundler's normal pipeline. Built on [`unplugin`](https://github.com/unjs/unplugin) so a single adapter works across Vite, Rollup, Webpack, Rspack, and esbuild.
|
|
4
4
|
|
|
5
5
|
## Why
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ That gets stale fast in dev — every edit to a `@Module` requires re-running `a
|
|
|
15
15
|
|
|
16
16
|
```ts
|
|
17
17
|
// vite.config.ts
|
|
18
|
-
import anvil from "@
|
|
18
|
+
import anvil from "@anvil-di/anvil-unplugin/vite";
|
|
19
19
|
|
|
20
20
|
export default defineConfig({
|
|
21
21
|
plugins: [anvil()],
|
|
@@ -27,11 +27,11 @@ Codegen runs on `buildStart` and on every relevant file change in dev (debounced
|
|
|
27
27
|
## Per-bundler imports
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
import anvil from "@
|
|
31
|
-
import anvil from "@
|
|
32
|
-
import anvil from "@
|
|
33
|
-
import anvil from "@
|
|
34
|
-
import anvil from "@
|
|
30
|
+
import anvil from "@anvil-di/anvil-unplugin/vite"; // Vite plugin
|
|
31
|
+
import anvil from "@anvil-di/anvil-unplugin/rollup"; // Rollup plugin
|
|
32
|
+
import anvil from "@anvil-di/anvil-unplugin/webpack"; // Webpack plugin
|
|
33
|
+
import anvil from "@anvil-di/anvil-unplugin/rspack"; // Rspack plugin
|
|
34
|
+
import anvil from "@anvil-di/anvil-unplugin/esbuild"; // esbuild plugin
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## Options
|
|
@@ -47,7 +47,7 @@ anvil({
|
|
|
47
47
|
tsconfig: "./tsconfig.json",
|
|
48
48
|
|
|
49
49
|
// Path to the `anvil` binary. Defaults to the native binary resolved
|
|
50
|
-
// via @
|
|
50
|
+
// via @anvil-di/anvil-cli's optionalDependencies.
|
|
51
51
|
cli: "/path/to/anvil",
|
|
52
52
|
|
|
53
53
|
// Debounce window for re-running codegen after a file edit (ms).
|
|
@@ -56,7 +56,7 @@ anvil({
|
|
|
56
56
|
|
|
57
57
|
// Which codegen backend to use:
|
|
58
58
|
// - "native" (default): spawn the anvil Rust binary
|
|
59
|
-
// - "wasm": run in-process via @
|
|
59
|
+
// - "wasm": run in-process via @anvil-di/anvil-codegen-wasm (no spawn overhead)
|
|
60
60
|
mode: "native",
|
|
61
61
|
});
|
|
62
62
|
```
|
|
@@ -72,7 +72,7 @@ The bundler's normal TypeScript pipeline then picks up the freshly generated `*.
|
|
|
72
72
|
|
|
73
73
|
## How the binary gets there
|
|
74
74
|
|
|
75
|
-
`@
|
|
75
|
+
`@anvil-di/anvil-unplugin` depends on [`@anvil-di/anvil-cli`](../anvil-cli/README.md), which is the npm launcher for anvil's native Rust binary. `@anvil-di/anvil-cli` declares one `optionalDependencies` entry per supported platform (`@anvil-di/anvil-cli-linux-x64`, `@anvil-di/anvil-cli-darwin-arm64`, etc.); npm installs **only** the matching one based on `os`/`cpu` filters. At runtime the unplugin calls `resolveBinaryPath()` from `@anvil-di/anvil-cli` to find the binary — no PATH manipulation or `cargo install` required.
|
|
76
76
|
|
|
77
77
|
The same `cli` option still works if you want to point at a custom build (a `cargo build --release`'d binary outside `node_modules`, for example).
|
|
78
78
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvil-di/anvil-unplugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Run anvil codegen as part of your bundler's normal pipeline. One plugin, every bundler (Vite, Rollup, Webpack, Rspack, esbuild) via unplugin.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"unplugin": "^1.16.0",
|
|
42
|
-
"@anvil-di/anvil-
|
|
43
|
-
"@anvil-di/anvil-
|
|
42
|
+
"@anvil-di/anvil-cli": "0.0.6",
|
|
43
|
+
"@anvil-di/anvil-codegen-wasm": "0.0.4"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^22.10.0",
|