@ic-reactor/vite-plugin 0.14.0 → 4.0.0-beta.1
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/README.md +173 -130
- package/dist/index.cjs +782 -218
- package/dist/index.d.cts +99 -29
- package/dist/index.d.ts +99 -29
- package/dist/index.js +783 -221
- package/package.json +6 -8
- package/src/dev-environment.ts +268 -0
- package/src/env.ts +54 -20
- package/src/generate.ts +594 -0
- package/src/index.ts +665 -396
- package/llms.txt +0 -55
package/llms.txt
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# @ic-reactor/vite-plugin — AI Quick Guide
|
|
2
|
-
|
|
3
|
-
Vite integration for automatic IC Reactor generation from `.did` files.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pnpm add -D @ic-reactor/vite-plugin
|
|
9
|
-
pnpm add @ic-reactor/react @tanstack/react-query @icp-sdk/core
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Minimal Setup
|
|
13
|
-
|
|
14
|
-
```ts
|
|
15
|
-
import { icReactor } from "@ic-reactor/vite-plugin"
|
|
16
|
-
|
|
17
|
-
icReactor({
|
|
18
|
-
canisters: [{ name: "backend", didFile: "./backend/backend.did" }],
|
|
19
|
-
})
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Behavior
|
|
23
|
-
|
|
24
|
-
- Runs codegen on startup and `.did` changes
|
|
25
|
-
- Regenerates declarations + `index.generated.ts`
|
|
26
|
-
- Preserves user-facing `index.ts` wrapper after initial creation
|
|
27
|
-
- Relative paths (`didFile`, `outDir`) resolve against Vite's `config.root`
|
|
28
|
-
- A failed canister fails `vite build`; in `vite dev` it goes to the terminal
|
|
29
|
-
and the browser error overlay instead
|
|
30
|
-
|
|
31
|
-
## Key Options
|
|
32
|
-
|
|
33
|
-
- Plugin level: `canisters`, `outDir`, `clientManagerPath`, `target`,
|
|
34
|
-
`injectEnvironment`, `failOnError`
|
|
35
|
-
- Per canister (inside `canisters[]`): `name`, `didFile`, `outDir`,
|
|
36
|
-
`clientManagerPath`, `target`, `mode`, `canisterId`
|
|
37
|
-
- `injectEnvironment` for local `ic_env` cookie + `/api` proxy behavior. The
|
|
38
|
-
consumer side is a positive allowlist: `ClientManager` trusts the cookie — its
|
|
39
|
-
root key, its Internet Identity provider, and the canister IDs a reactor
|
|
40
|
-
resolves by name — only for loopback, `localhost`, and dev-container hosts.
|
|
41
|
-
Serving a dev build over a tunnel or custom domain needs
|
|
42
|
-
`allowEnvConfig: true` (formerly `allowEnvRootKey`); without it a generated
|
|
43
|
-
reactor that carries no `canisterId` throws instead of reading one from the
|
|
44
|
-
cookie — see `packages/core/llms.txt`
|
|
45
|
-
- `failOnError` overrides the default (`true` for build, `false` for dev)
|
|
46
|
-
|
|
47
|
-
## Best Practices
|
|
48
|
-
|
|
49
|
-
- Keep custom code in stable wrapper/factory modules
|
|
50
|
-
- Do not hand-edit generated `index.generated.ts`
|
|
51
|
-
|
|
52
|
-
## Full References
|
|
53
|
-
|
|
54
|
-
- Full AI guide: https://ic-reactor.b3pay.net/llms-full.txt
|
|
55
|
-
- Vite plugin docs: https://ic-reactor.b3pay.net/v3/packages/vite-plugin
|