Skip to content

Commit

Permalink
docs(changeset): changed style to routes and removed compile ne…
Browse files Browse the repository at this point in the history
…sted, flat options API
  • Loading branch information
nksaraf committed Sep 22, 2023
1 parent 4c6d15b commit 0f14555
Show file tree
Hide file tree
Showing 38 changed files with 1,304 additions and 897 deletions.
8 changes: 8 additions & 0 deletions .changeset/real-points-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@vinxi/plugin-references": patch
"@vinxi/solid-start": patch
"@vinxi/router": patch
"vinxi": patch
---

changed `style` to `routes` and removed `compile` nested, flat options API
42 changes: 18 additions & 24 deletions examples/react/rsc/spa/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,21 @@ export default createApp({
mode: "handler",
base: "/_rsc",
handler: "./app/react-server.tsx",
compile: {
target: "server",
plugins: () => [references.serverComponents(), reactRefresh()],
},
target: "server",
plugins: () => [references.serverComponents(), reactRefresh()],
},
{
name: "client",
mode: "spa",
handler: "./index.ts",
compile: {
target: "browser",
plugins: () => [
references.clientRouterPlugin({
runtime: "@vinxi/react-server-dom/runtime",
}),
reactRefresh(),
references.clientComponents(),
],
},
target: "browser",
plugins: () => [
references.clientRouterPlugin({
runtime: "@vinxi/react-server-dom/runtime",
}),
reactRefresh(),
references.clientComponents(),
],
base: "/",
},
{
Expand All @@ -50,16 +46,14 @@ export default createApp({
mode: "handler",
base: "/_server",
handler: "./app/server-action.tsx",
compile: {
target: "server",
plugins: () => [
references.serverRouterPlugin({
resolve: {
conditions: ["react-server"],
},
}),
],
},
target: "server",
plugins: () => [
references.serverRouterPlugin({
resolve: {
conditions: ["react-server"],
},
}),
],
},
],
});
24 changes: 11 additions & 13 deletions examples/react/spa/mdx/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function wouterFileRouter(config) {
return (router, app) =>
new WouterFileSystemRouter(
{
dir: resolve.absolute(config.dir, router, app),
dir: resolve.absolute(config.dir, router.root),
extensions: config.extensions ?? ["js", "jsx", "ts", "tsx", "mdx"],
},
router,
Expand All @@ -64,18 +64,16 @@ export default createApp({
name: "client",
mode: "spa",
handler: "./index.html",
style: wouterFileRouter({ dir: "./app/pages" }),
compile: {
target: "browser",
plugins: () => [
mdx.withImports({
react: "React",
})({
providerImportSource: "@mdx-js/react",
}),
reactRefresh({}),
],
},
routes: wouterFileRouter({ dir: "./app/pages" }),
target: "browser",
plugins: () => [
mdx.withImports({
react: "React",
})({
providerImportSource: "@mdx-js/react",
}),
reactRefresh({}),
],
},
],
});
12 changes: 5 additions & 7 deletions examples/react/spa/tanstack-router-app/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ class TanstackFileSystemRouter extends BaseFileSystemRouter {

/**
*
* @param {import("vinxi/file-system-router").FileSystemRouterConfig} config
* @param {Partial<import("vinxi/file-system-router").FileSystemRouterConfig>} config
*/
function tanstackFileRouter(config) {
return (router, app) =>
new TanstackFileSystemRouter(
{
dir: resolve.absolute(config.dir, router, app),
dir: resolve.absolute(config.dir, router.root),
extensions: config.extensions ?? ["ts", "tsx", "jsx", "js"],
},
router,
Expand All @@ -87,13 +87,11 @@ export default createApp({
name: "client",
mode: "spa",
handler: "./index.html",
style: tanstackFileRouter({
routes: tanstackFileRouter({
dir: "./app/routes",
}),
compile: {
target: "browser",
plugins: () => [reactRefresh()],
},
target: "browser",
plugins: () => [reactRefresh()],
},
],
});
14 changes: 5 additions & 9 deletions examples/react/spa/tanstack-router/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,19 @@ export default createApp({
name: "client",
mode: "spa",
handler: "./index.html",
style: tanstackFileRouter({
routes: tanstackFileRouter({
dir: "./app/pages",
}),
compile: {
target: "browser",
plugins: () => [references.clientRouterPlugin(), reactRefresh()],
},
target: "browser",
plugins: () => [references.clientRouterPlugin(), reactRefresh()],
},
{
name: "server",
mode: "handler",
base: "/_server",
handler: "./app/entry-server.tsx",
compile: {
target: "server",
plugins: () => [references.serverRouterPlugin()],
},
target: "server",
plugins: () => [references.serverRouterPlugin()],
},
],
});
2 changes: 1 addition & 1 deletion examples/react/spa/tanstack-router/lib/file-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function tanstackFileRouter(config) {
return (router, app) =>
new TanstackFileRouter(
{
dir: resolve.absolute(config.dir, router, app),
dir: resolve.absolute(config.dir, router.root),
extensions: config.extensions ?? ["js", "jsx", "ts", "tsx"],
},
router,
Expand Down
10 changes: 4 additions & 6 deletions examples/react/spa/wouter/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function wouterFileRouter(config) {
return (router, app) =>
new WouterFileSystemRouter(
{
dir: resolve.absolute(config.dir, router, app),
dir: resolve.absolute(config.dir, router.root),
extensions: config.extensions ?? ["js", "jsx", "ts", "tsx"],
},
router,
Expand All @@ -63,13 +63,11 @@ export default createApp({
name: "client",
mode: "spa",
handler: "./index.html",
style: wouterFileRouter({
routes: wouterFileRouter({
dir: "./app/pages",
}),
compile: {
target: "browser",
plugins: () => [reactRefresh()],
},
target: "browser",
plugins: () => [reactRefresh()],
},
],
});
11 changes: 4 additions & 7 deletions examples/react/ssr/basic/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@ export default createApp({
name: "client",
mode: "build",
handler: "./app/client.tsx",
compile: {
target: "browser",
plugins: () => [reactRefresh()],
},
target: "browser",
plugins: () => [reactRefresh()],
base: "/_build",
},
{
name: "ssr",
mode: "handler",
middleware: "./app/middleware.tsx",
handler: "./app/server.tsx",
compile: {
target: "server",
},
target: "server",
plugins: () => [reactRefresh()],
},
],
});
6 changes: 0 additions & 6 deletions examples/react/ssr/basic/app/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ export default eventHandler(async (event) => {
);
});

// @ts-ignore
stream._read = () => {};
// @ts-ignore
stream.on = (event, listener) => {
events[event] = listener;
};
event.node.res.setHeader("Content-Type", "text/html");
return stream;
});
18 changes: 7 additions & 11 deletions examples/react/ssr/tanstack-router-app/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function tanstackFileRouter(config) {
return (router, app) =>
new TanstackFileRouter(
{
dir: resolve.absolute(config.dir, router, app),
dir: resolve.absolute(config.dir, router.root),
extensions: config.extensions ?? ["ts", "tsx", "jsx", "js"],
},
router,
Expand All @@ -91,21 +91,17 @@ export default createApp({
name: "client",
mode: "build",
handler: "./app/client.tsx",
style: tanstackFileRouter({ dir: "./app/routes" }),
compile: {
target: "browser",
plugins: () => [reactRefresh()],
},
routes: tanstackFileRouter({ dir: "./app/routes" }),
target: "browser",
plugins: () => [reactRefresh()],
},
{
name: "ssr",
mode: "handler",
handler: "./app/server.tsx",
style: tanstackFileRouter({ dir: "./app/routes" }),
compile: {
target: "server",
plugins: () => [reactRefresh()],
},
routes: tanstackFileRouter({ dir: "./app/routes" }),
target: "server",
plugins: () => [reactRefresh()],
},
],
});
26 changes: 11 additions & 15 deletions examples/solid/ssr/solid-router/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function solidStartFileRouter(config) {
return (router, app) =>
new SolidStartFileSystemRouter(
{
dir: resolve.absolute(config.dir, router, app),
dir: resolve.absolute(config.dir, router.root),
extensions: config.extensions ?? ["js", "jsx", "ts", "tsx"],
},
router,
Expand All @@ -72,30 +72,26 @@ export default createApp({
name: "client",
mode: "build",
handler: "./app/client.tsx",
style: solidStartFileRouter({
routes: solidStartFileRouter({
dir: "./app/pages",
}),
compile: {
target: "browser",
plugins: () => [
solid({
ssr: true,
}),
],
},
target: "browser",
plugins: () => [
solid({
ssr: true,
}),
],
base: "/_build",
},
{
name: "ssr",
mode: "handler",
handler: "./app/server.tsx",
style: solidStartFileRouter({
routes: solidStartFileRouter({
dir: "./app/pages",
}),
compile: {
target: "server",
plugins: () => [solid({ ssr: true })],
},
target: "server",
plugins: () => [solid({ ssr: true })],
},
],
});
Loading

0 comments on commit 0f14555

Please sign in to comment.