-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
917 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,10 +21,6 @@ | |
"patchedDependencies": { | ||
"[email protected]": "patches/[email protected]", | ||
"@tanstack/[email protected]": "patches/@[email protected]" | ||
}, | ||
"overrides": { | ||
"h3": "npm:@vinxi/[email protected]", | ||
"listhen": "npm:@vinxi/listhen" | ||
} | ||
}, | ||
"dependencies": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { expect, test } from "@playwright/test"; | ||
|
||
import type { AppFixture, Fixture } from "./helpers/create-fixture.js"; | ||
import { createFixture, js } from "./helpers/create-fixture.js"; | ||
import { | ||
PlaywrightFixture, | ||
prettyHtml, | ||
selectHtml, | ||
} from "./helpers/playwright-fixture.js"; | ||
|
||
test.describe("rsc", () => { | ||
let fixture: Fixture; | ||
let appFixture: AppFixture; | ||
|
||
test.beforeAll(async () => { | ||
fixture = await createFixture({ | ||
files: {}, | ||
template: "react-rsc", | ||
}); | ||
|
||
appFixture = await fixture.createServer(); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await appFixture.close(); | ||
}); | ||
|
||
let logs: string[] = []; | ||
|
||
test.beforeEach(({ page }) => { | ||
page.on("console", (msg) => { | ||
logs.push(msg.text()); | ||
}); | ||
}); | ||
|
||
test("spa", async ({ page }) => { | ||
let app = new PlaywrightFixture(appFixture, page); | ||
await app.goto("/", true); | ||
|
||
expect(await app.getHtml("[data-test-id=title]")).toBe( | ||
prettyHtml(`<h1 data-test-id="title">Hello from Vinxi</h1>`), | ||
); | ||
expect(await app.getHtml("[data-test-id=counter]")).toBe( | ||
prettyHtml(`<button data-test-id="counter">Count: 0</button>`), | ||
); | ||
expect(await app.getHtml("[data-test-id=server-count]")).toBe( | ||
prettyHtml(`<span data-test-id="server-count">0</span>`), | ||
); | ||
|
||
await app.clickElement("[data-test-id=counter]"); | ||
|
||
expect(await app.getHtml("[data-test-id=counter]")).toBe( | ||
prettyHtml(`<button data-test-id="counter">Count: 1</button>`), | ||
); | ||
expect(await app.getHtml("[data-test-id=server-count]")).toBe( | ||
prettyHtml(`<span data-test-id="server-count">1</span>`), | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# app | ||
|
||
## null | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [fd06048] | ||
- Updated dependencies [0f14555] | ||
- Updated dependencies [82267c5] | ||
- [email protected] | ||
- @vinxi/plugin-references@0.0.20 | ||
- @vinxi/react@0.0.10 | ||
|
||
## null | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [8058084] | ||
- [email protected] | ||
- @vinxi/plugin-references@0.0.19 | ||
|
||
## null | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [b934e84] | ||
- Updated dependencies [17693dc] | ||
- Updated dependencies [d6305b8] | ||
- Updated dependencies [cb91c48] | ||
- Updated dependencies [085116d] | ||
- Updated dependencies [f1ee5b8] | ||
- [email protected] | ||
- @vinxi/plugin-references@0.0.18 | ||
|
||
## null | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [7803042] | ||
- [email protected] | ||
- @vinxi/plugin-references@0.0.17 | ||
|
||
## null | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [2b17e0d] | ||
- [email protected] | ||
- @vinxi/plugin-references@0.0.16 | ||
|
||
## null | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [552d8ca] | ||
- [email protected] | ||
- @vinxi/plugin-references@0.0.15 | ||
|
||
## null | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [47abc3c] | ||
- @vinxi/plugin-references@0.0.14 | ||
- [email protected] | ||
|
||
## null | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [ec37a2e] | ||
- @vinxi/react@0.0.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { references } from "@vinxi/plugin-references"; | ||
import reactRefresh from "@vitejs/plugin-react"; | ||
import { createApp } from "vinxi"; | ||
|
||
export default createApp({ | ||
server: { | ||
plugins: [references.serverPlugin], | ||
virtual: { | ||
[references.serverPlugin]: references.serverPluginModule({ | ||
routers: ["server", "rsc"], | ||
}), | ||
}, | ||
}, | ||
routers: [ | ||
{ | ||
name: "public", | ||
mode: "static", | ||
dir: "./public", | ||
}, | ||
{ | ||
name: "rsc", | ||
worker: true, | ||
mode: "handler", | ||
base: "/_rsc", | ||
handler: "./app/react-server.tsx", | ||
target: "server", | ||
plugins: () => [references.serverComponents(), reactRefresh()], | ||
}, | ||
{ | ||
name: "client", | ||
mode: "spa", | ||
handler: "./index.ts", | ||
target: "browser", | ||
plugins: () => [ | ||
references.clientRouterPlugin({ | ||
runtime: "@vinxi/react-server-dom/runtime", | ||
}), | ||
reactRefresh(), | ||
references.clientComponents(), | ||
], | ||
base: "/", | ||
}, | ||
{ | ||
name: "server", | ||
worker: true, | ||
mode: "handler", | ||
base: "/_server", | ||
handler: "./app/server-action.tsx", | ||
target: "server", | ||
plugins: () => [ | ||
references.serverRouterPlugin({ | ||
resolve: { | ||
conditions: ["react-server"], | ||
}, | ||
}), | ||
], | ||
}, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"use client"; | ||
|
||
import { useState } from "react"; | ||
|
||
export function Counter({ onChange }) { | ||
const [count, setCount] = useState(0); | ||
return ( | ||
<button | ||
data-test-id="counter" | ||
onClick={() => { | ||
setCount((c) => c + 1); | ||
onChange(); | ||
}} | ||
> | ||
Count: {count} | ||
</button> | ||
); | ||
} |
Oops, something went wrong.