@foldkit/vite-plugin 0.16.0 → 0.16.1-canary.6a5cbafae641

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @foldkit/vite-plugin
2
2
 
3
- Vite plugin for Foldkit: view identity branding for the differ, plus hot module reloading with model preservation.
3
+ Vite plugin for Foldkit: view identity branding for the differ, plus hot module reloading with Model preservation.
4
4
 
5
5
  ## Installation
6
6
 
@@ -38,20 +38,20 @@ Foldkit core modules are never instrumented, and functions that never return vno
38
38
 
39
39
  When you save a file during development, the plugin:
40
40
 
41
- 1. Preserves your application's current state (model)
41
+ 1. Preserves your application's current Model
42
42
  2. Triggers a full page reload
43
- 3. Restores the preserved model after reload
43
+ 3. Restores the preserved Model after reload
44
44
 
45
- This means you can make code changes without losing your application's state - forms stay filled, counters keep their values, game positions are maintained, etc.
45
+ Code changes do not reset the application. Forms stay filled, counters keep their values, and games keep their positions.
46
46
 
47
47
  ## How it works
48
48
 
49
49
  The plugin uses Vite's WebSocket connection to communicate between the dev server and browser:
50
50
 
51
- - **On file change**: The browser sends the current model to the Vite server for preservation
52
- - **On reload**: The browser requests the preserved model from the server and initializes the Foldkit runtime with it
51
+ - **On file change**: The browser sends the current Model to the Vite server for preservation.
52
+ - **On reload**: The browser requests the preserved Model from the server and initializes the Foldkit Runtime with it.
53
53
 
54
- Model is preserved across hot reloads but cleared on manual browser refreshes, giving you control over when to reset your app.
54
+ The Model survives hot reloads but clears on a manual browser refresh, so a refresh still resets the application.
55
55
 
56
56
  ## Server rendering dev host
57
57
 
@@ -67,7 +67,11 @@ Vite retains ownership of configured proxy routes before Foldkit handles applica
67
67
 
68
68
  ## Build id
69
69
 
70
- A server-rendered build carries an id naming the deployment it came from. `renderToString` stamps it on the rendered root and `Runtime.hydrate` compares it before accessing the Flags payload text or adopting DOM, so a page served by an earlier deployment is refused rather than reconciled against a client that no longer means the same thing by it. Startup stops, and the page is contained: the document's body is marked `inert`, and a nondismissable modal shield covers its controls and existing top-layer content without closing author-owned dialogs. Nothing is moved, so no custom element reconnects and no frame reloads. This boundary blocks native page interaction; it is not a script or global-event sandbox. A client already running in an open tab is not rechecked when a deployment lands: the comparison happens when a client boots against a page.
70
+ The build id does not make hydration correct. It makes hydration refuse when it would otherwise be incorrect.
71
+
72
+ Server-rendered HTML carries the deployment id, and the client bundle carries its own copy. `Runtime.hydrate` compares them before reading the Flags payload or adopting DOM. When they differ, startup stops and the document body is marked `inert`, `aria-hidden`, and `data-foldkit-refused`. A nondismissable modal shield covers its controls and existing top-layer content, then takes focus without closing author-owned dialogs.
73
+
74
+ Nothing moves, so no custom element reconnects and no frame reloads. The containment blocks native page interaction; it is not a script or global-event sandbox. A client already running in an open tab is not rechecked when a deployment lands because the comparison happens only when a client boots against a page.
71
75
 
72
76
  The plugin compiles the id into application code as `import.meta.env.FOLDKIT_BUILD_ID`, from its `buildId` option or from the `FOLDKIT_BUILD_ID` environment variable:
73
77
 
@@ -88,7 +92,13 @@ Server.renderToString(config, {
88
92
  Runtime.hydrate(application, { buildId: import.meta.env.FOLDKIT_BUILD_ID })
89
93
  ```
90
94
 
91
- Nothing is derived from the project. Use a value the deployment already has, such as a commit, a release tag, or a container digest. Three rules govern it: the id is published in the HTML every visitor receives, so it must never contain a secret; it must identify one deployment, so two deployments can never share one; and the same value must reach the client build and the server build, which run as separate commands. A hydratable render given no id fails with `MissingBuildId`. Only a build takes the id from the deployment. The dev server compiles a fixed one because one live source session supplies both transforms and has no deployment identity to derive.
95
+ Use a public value the deployment already has, such as a commit, release tag, or container digest. Three things have to be true:
96
+
97
+ - The id appears in the HTML every visitor receives, so it must never contain a secret.
98
+ - Two deployments must never share an id.
99
+ - The same value must reach the client and server builds, which run as separate commands.
100
+
101
+ A hydratable render given no id fails with `MissingBuildId`. Only a build takes the id from the deployment. The dev server compiles a fixed one because one live source session supplies both transforms and has no deployment identity to derive.
92
102
 
93
103
  The standalone `foldkitSsr({ serverEntry, buildId })` export compiles the same define for its server entry. When it runs in development without an explicit value, it uses the fixed development id too. The aggregate `foldkit({ buildId, ssr })` plugin passes its top-level value through automatically.
94
104
 
@@ -96,7 +106,7 @@ The standalone `foldkitSsr({ serverEntry, buildId })` export compiles the same d
96
106
 
97
107
  When `@foldkit/devtools` is installed as a development dependency, the plugin mounts its overlay automatically during development and leaves it out of production builds. No application import or `devTools.overlay` field is needed.
98
108
 
99
- To include the overlay in production, list `@foldkit/devtools` in regular `dependencies` and set `devTools.show` to `'Always'`. Dependency placement controls whether Vite includes the overlay, and `show` controls whether the Foldkit runtime mounts it.
109
+ To include the overlay in production, list `@foldkit/devtools` in regular `dependencies` and set `devTools.show` to `'Always'`. Dependency placement controls whether Vite includes the overlay, and `show` controls whether the Foldkit Runtime mounts it.
100
110
 
101
111
  ## DevTools MCP relay
102
112
 
@@ -106,7 +116,7 @@ Pass `devToolsMcpPort` to enable the relay that exposes your running Foldkit app
106
116
  plugins: [foldkit({ devToolsMcpPort: 9988 })]
107
117
  ```
108
118
 
109
- When set, the plugin opens a separate WebSocket server on the given port. The MCP server connects to it and forwards typed `Request` and `Response` frames between AI agents and your runtime. Without `devToolsMcpPort` (the default), the relay is not started and the plugin behaves exactly as before.
119
+ When set, the plugin opens a separate WebSocket server on the given port. The MCP server connects to it and forwards typed `Request` and `Response` frames between AI agents and your Runtime. Without `devToolsMcpPort` (the default), the relay is not started and the plugin behaves exactly as before.
110
120
 
111
121
  See the [DevTools MCP documentation](https://foldkit.dev/ai/mcp) for setup, the available tools, and how dispatch validation works.
112
122
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EACV,MAAM,EAIP,MAAM,MAAM,CAAA;AAKb,OAAO,EAAE,KAAK,iBAAiB,EAAc,MAAM,UAAU,CAAA;AAG7D,OAAO,EAAE,KAAK,eAAe,EAAE,kBAAkB,EAAE,MAAM,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A;AAklBF;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,GAAI,UAAS,oBAAyB,KAAG,KAAK,CAAC,MAAM,CA+ExE,CAAA"}
package/dist/index.js CHANGED
@@ -52,6 +52,7 @@ const FORCE_INCLUDED_EFFECT_NAMESPACES = [
52
52
  'effect/Runtime',
53
53
  'effect/Scheduler',
54
54
  'effect/Schema',
55
+ 'effect/SchemaAST',
55
56
  'effect/SchemaIssue',
56
57
  'effect/SchemaTransformation',
57
58
  'effect/Scope',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foldkit/vite-plugin",
3
- "version": "0.16.0",
3
+ "version": "0.16.1-canary.6a5cbafae641",
4
4
  "description": "Vite plugin for Foldkit hot module reloading with state preservation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "peerDependencies": {
19
19
  "effect": "4.0.0-rc.109",
20
- "foldkit": ">=0.148.0",
20
+ "foldkit": "0.148.2-canary.6a5cbafae641",
21
21
  "vite": "^7.0.0 || ^8.0.0"
22
22
  },
23
23
  "dependencies": {
@@ -34,7 +34,7 @@
34
34
  "vite": "^8.0.16",
35
35
  "vite7": "npm:vite@^7.0.0",
36
36
  "vitest": "^4.1.9",
37
- "foldkit": "0.148.0"
37
+ "foldkit": "0.148.2-canary.6a5cbafae641"
38
38
  },
39
39
  "keywords": [
40
40
  "vite",