4478598f15
## Summary - Add `effect-fc-next`, a React 19 integration targeting Effect v4 beta. - Introduce component lifecycles, scoped resources, queries, mutations, forms, lenses, views, and refreshable components. - Add `@effect-view/vite-plugin` for Vite Fast Refresh support. - Add an Effect v4 example application covering the new APIs. - Expand test coverage for both the existing and next-generation packages. - Replace the starter Docusaurus content with complete Effect View documentation while preserving the Effect v3 docs as a versioned snapshot. - Update the landing page, navigation, package scripts, and build output. - Extend CI with linting, tests, package builds, Docker builds, and container publishing. ## Validation - `bun lint:tsc` - `bun lint:biome` - `bun test` - `bun run build` - `bun pack` - Docker image build --------- Co-authored-by: Julien Valverdé <julien.valverde@mailo.com> Reviewed-on: Thilawyn/effect-fc#56
42 lines
1.5 KiB
Markdown
42 lines
1.5 KiB
Markdown
# `@effect-view/vite-plugin`
|
|
|
|
Experimental Vite Fast Refresh support for Effect View components.
|
|
|
|
```ts
|
|
import { effectViewPlugin } from "@effect-view/vite-plugin"
|
|
import react from "@vitejs/plugin-react"
|
|
import { defineConfig } from "vite"
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
effectViewPlugin(),
|
|
react(),
|
|
],
|
|
})
|
|
```
|
|
|
|
The plugin recognizes `Component.make` and `Component.makeUntraced`
|
|
definitions imported from `effect-fc-next`. The legacy `effect-fc` package is
|
|
not supported. `effect-fc-next` owns the bundler-neutral refresh cell protocol;
|
|
this package is the Vite adapter that retains those cells in HMR data. The
|
|
plugin assigns stable development IDs and self-accepts successfully
|
|
instrumented modules.
|
|
|
|
The adapter-facing protocol is exported from `effect-fc-next/Refreshable`.
|
|
|
|
Renaming or removing an instrumented View invalidates the module upward instead
|
|
of leaving a stale mounted descriptor.
|
|
|
|
React state is retained when the ordered hook signature is unchanged. Adding,
|
|
removing, or changing a hook call resets the Effect View implementation. Add
|
|
`// @refresh reset` to a module to reset its Views on every update.
|
|
|
|
## Current limitations
|
|
|
|
- Definitions must be top-level variable, class, or default-export
|
|
declarations.
|
|
- Hook signature analysis is conservative and based on `useX` call syntax.
|
|
- Changing a descriptor's trait pipeline during a refresh is not guaranteed to
|
|
preserve state.
|
|
- Source maps for the injected transform are not generated yet.
|