Finalize the Effect View rename and refresh docs, examples, and tooling #59
@@ -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: |
|
||||
|
||||
@@ -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(),
|
||||
],
|
||||
})
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(),
|
||||
],
|
||||
})
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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, `
|
||||
|
||||
@@ -133,7 +133,7 @@ Ship a Vite plugin, `@effect-view/vite-plugin`, placed before `react()`:
|
||||
|
||||
```ts
|
||||
plugins: [
|
||||
effectViewPlugin(),
|
||||
effectView(),
|
||||
react(),
|
||||
]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user