Finalize the Effect View rename and refresh docs, examples, and tooling #59

Merged
Thilawyn merged 12 commits from next into master 2026-07-27 04:11:42 +02:00
7 changed files with 20 additions and 13 deletions
Showing only changes of commit 8ef8a34d62 - Show all commits
+7
View File
@@ -40,6 +40,13 @@ jobs:
access: public
token: ${{ secrets.NPM_TOKEN }}
registry: https://registry.npmjs.org
- name: Publish effect-fc
uses: JS-DevTools/npm-publish@v4
with:
package: packages/effect-fc
access: public
token: ${{ secrets.NPM_TOKEN }}
registry: https://registry.npmjs.org
- name: Clean before Docker build
run: |
+3 -3
View File
@@ -44,16 +44,16 @@ Effect View components:
npm install --save-dev @effect-view/vite-plugin
```
Add `effectViewPlugin()` before the React plugin in your Vite configuration:
Add `effectView()` before the React plugin in your Vite configuration:
```ts title="vite.config.ts"
import { effectViewPlugin } from "@effect-view/vite-plugin"
import { effectView } from "@effect-view/vite-plugin"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [
effectViewPlugin(),
effectView(),
react(),
],
})
+2 -2
View File
@@ -1,6 +1,6 @@
import { tanstackRouter } from "@tanstack/router-plugin/vite"
import react from "@vitejs/plugin-react"
import { effectViewPlugin } from "@effect-view/vite-plugin"
import { effectView } from "@effect-view/vite-plugin"
import path from "node:path"
import { defineConfig } from "vite"
@@ -8,7 +8,7 @@ import { defineConfig } from "vite"
// https://vite.dev/config/
export default defineConfig({
plugins: [
effectViewPlugin(),
effectView(),
tanstackRouter({
target: "react",
autoCodeSplitting: true,
+2 -2
View File
@@ -3,13 +3,13 @@
Experimental Vite Fast Refresh support for Effect View components.
```ts
import { effectViewPlugin } from "@effect-view/vite-plugin"
import { effectView } from "@effect-view/vite-plugin"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [
effectViewPlugin(),
effectView(),
react(),
],
})
+1 -1
View File
@@ -342,7 +342,7 @@ const scriptKind = (id: string): ts.ScriptKind => id.endsWith(".tsx")
*
* Place this plugin before `@vitejs/plugin-react`.
*/
export function effectViewPlugin(
export function effectView(
options: EffectViewRefreshOptions = {},
): Plugin {
const include = options.include ?? defaultInclude
+4 -4
View File
@@ -1,7 +1,7 @@
import path from "node:path"
import type { Plugin } from "vite"
import { describe, expect, it } from "vitest"
import { effectViewPlugin } from "./index.js"
import { effectView } from "./index.js"
type TransformHook = Extract<
@@ -31,9 +31,9 @@ const runTransform = async (
const transform = (
code: string,
id = path.join(process.cwd(), "src/View.tsx"),
): Promise<string | undefined> => runTransform(effectViewPlugin(), code, id)
): Promise<string | undefined> => runTransform(effectView(), code, id)
describe("effectViewPlugin", () => {
describe("effectView", () => {
it("wraps a const Effect View descriptor", async () => {
const result = await transform(`
import { Component } from "effect-view"
@@ -109,7 +109,7 @@ export function View() {
})
it("keeps instrumenting a module when all Effect Views are removed", async () => {
const plugin = effectViewPlugin() as Plugin
const plugin = effectView() as Plugin
const id = path.join(process.cwd(), "src/Removed.tsx")
await runTransform(plugin, `
+1 -1
View File
@@ -133,7 +133,7 @@ Ship a Vite plugin, `@effect-view/vite-plugin`, placed before `react()`:
```ts
plugins: [
effectViewPlugin(),
effectView(),
react(),
]
```