create-fluixi 0.1.0-alpha.11 → 0.1.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +813 -308
- package/package.json +17 -2
- package/template-spa/package.json +1 -0
- package/template-spa/src/app.tsx +3 -4
- package/template-spa-html/package.json +1 -0
- package/template-spa-html/src/app.ts +4 -4
- package/template-ssr/package.json +1 -0
- package/template-ssr/src/app.tsx +3 -3
- package/template-ssr/src/entry-server.ts +5 -0
- package/template-ssr/src/routes/index.tsx +1 -2
- package/template-ssr-html/package.json +1 -0
- package/template-ssr-html/src/app.ts +2 -2
- package/template-ssr-html/src/entry-server.ts +5 -0
- package/template-ssr-html/src/routes/index.ts +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-fluixi",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Ibrahima Touré",
|
|
6
6
|
"description": "Scaffold a new Fluixi app — `npm create fluixi <dir>`.",
|
|
@@ -26,7 +26,22 @@
|
|
|
26
26
|
"url": "https://github.com/fluixi/core.git",
|
|
27
27
|
"directory": "packages/create"
|
|
28
28
|
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"esbuild": "^0.24.0",
|
|
31
|
+
"vitest": "^1.6.1",
|
|
32
|
+
"@fluixi/cli": "0.1.0-alpha.83"
|
|
33
|
+
},
|
|
34
|
+
"nx": {
|
|
35
|
+
"targets": {
|
|
36
|
+
"test": {
|
|
37
|
+
"dependsOn": [
|
|
38
|
+
"build"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
29
43
|
"scripts": {
|
|
30
|
-
"build": "tsc -p tsconfig.lib.json"
|
|
44
|
+
"build": "tsc -p tsconfig.lib.json && esbuild src/index.ts --bundle --platform=node --format=esm --target=node18 --outfile=dist/index.js",
|
|
45
|
+
"test": "vitest run"
|
|
31
46
|
}
|
|
32
47
|
}
|
package/template-spa/src/app.tsx
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { createSignal } from '@fluixi/core';
|
|
2
1
|
|
|
3
2
|
export function App() {
|
|
4
|
-
const
|
|
3
|
+
const count = $signal(0);
|
|
5
4
|
return (
|
|
6
5
|
<div class="app">
|
|
7
6
|
<h1>Fluixi</h1>
|
|
8
|
-
<button onClick={() =>
|
|
7
|
+
<button onClick={() => count.set(count() - 1)}>-</button>
|
|
9
8
|
<span>{count()}</span>
|
|
10
|
-
<button onClick={() =>
|
|
9
|
+
<button onClick={() => count.set(count() + 1)}>+</button>
|
|
11
10
|
</div>
|
|
12
11
|
);
|
|
13
12
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { html } from '@fluixi/core';
|
|
2
2
|
|
|
3
3
|
export function App() {
|
|
4
|
-
const
|
|
4
|
+
const count = $signal(0);
|
|
5
5
|
return html`
|
|
6
6
|
<div class="app">
|
|
7
7
|
<h1>Fluixi</h1>
|
|
8
|
-
<button @click=${() =>
|
|
8
|
+
<button @click=${() => count.set(count() - 1)}>-</button>
|
|
9
9
|
<span>${count()}</span>
|
|
10
|
-
<button @click=${() =>
|
|
10
|
+
<button @click=${() => count.set(count() + 1)}>+</button>
|
|
11
11
|
</div>
|
|
12
12
|
`;
|
|
13
13
|
}
|
package/template-ssr/src/app.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Router, Outlet, createMemoryHistory } from '@fluixi/start/router';
|
|
1
|
+
import { Router, Outlet, Link, createMemoryHistory } from '@fluixi/start/router';
|
|
2
2
|
import { Suspense } from '@fluixi/core';
|
|
3
3
|
import { routes } from '@fluixi/core/routes';
|
|
4
4
|
|
|
@@ -8,9 +8,9 @@ function RootLayout() {
|
|
|
8
8
|
return (
|
|
9
9
|
<div class="app">
|
|
10
10
|
<nav>
|
|
11
|
-
<
|
|
11
|
+
<Link href="/">home</Link>
|
|
12
12
|
{' · '}
|
|
13
|
-
<
|
|
13
|
+
<Link href="/about">about</Link>
|
|
14
14
|
</nav>
|
|
15
15
|
<main>
|
|
16
16
|
<Suspense fallback={<p>loading…</p>}>
|
|
@@ -15,3 +15,8 @@ export function renderStream(url: string): ReadableStream<Uint8Array> {
|
|
|
15
15
|
// this app's `"use server"` modules populate. @fluixi/start routes RPC calls here.
|
|
16
16
|
import '@fluixi/start/server-fns'; // registers every "use server" module (incl. lazy routes)
|
|
17
17
|
export { isServerFnRequest, handleServerFn } from '@fluixi/start/server-fn';
|
|
18
|
+
|
|
19
|
+
// File-based API routes under src/api. The dev server dispatches to them itself; a built
|
|
20
|
+
// server finds them through this, and without it every /api request would fall through
|
|
21
|
+
// to the page renderer. Harmless when there are no routes.
|
|
22
|
+
export { isApiRequest, handleApiRequest } from '@fluixi/start/api-routes';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createResource } from '@fluixi/reactive/signal';
|
|
2
1
|
import { seo } from '@fluixi/start/head';
|
|
3
2
|
|
|
4
3
|
const tick = <T,>(v: T, ms = 30) => new Promise<T>((r) => setTimeout(() => r(v), ms));
|
|
@@ -6,7 +5,7 @@ const tick = <T,>(v: T, ms = 30) => new Promise<T>((r) => setTimeout(() => r(v),
|
|
|
6
5
|
// A data-gated route, like a real page: the resource is awaited during SSR so the
|
|
7
6
|
// content (not the spinner) is server-rendered, then hydrated.
|
|
8
7
|
export default function Home() {
|
|
9
|
-
const
|
|
8
|
+
const data = $resource(() => tick('Hello from Fluixi Start 👋'));
|
|
10
9
|
|
|
11
10
|
// Per-route document head: rendered into <head> on the server (great for crawlers/links)
|
|
12
11
|
// and kept reactive on the client. The head engine is always on; seo() is optional, call it
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Router, Outlet, createMemoryHistory } from '@fluixi/start/router';
|
|
1
|
+
import { Router, Outlet, createMemoryHistory, Link } from '@fluixi/start/router';
|
|
2
2
|
import { Suspense } from '@fluixi/core';
|
|
3
3
|
import { html } from '@fluixi/start';
|
|
4
4
|
import { routes } from '@fluixi/core/routes';
|
|
@@ -10,7 +10,7 @@ function RootLayout() {
|
|
|
10
10
|
return html`
|
|
11
11
|
<div class="app">
|
|
12
12
|
<nav>
|
|
13
|
-
|
|
13
|
+
<${Link} href="/">home<//> · <${Link} href="/about">about<//>
|
|
14
14
|
</nav>
|
|
15
15
|
<main>
|
|
16
16
|
<${Suspense} fallback=${html`<p>loading…</p>`}>
|
|
@@ -15,3 +15,8 @@ export function renderStream(url: string): ReadableStream<Uint8Array> {
|
|
|
15
15
|
// this app's `"use server"` modules populate. @fluixi/start routes RPC calls here.
|
|
16
16
|
import '@fluixi/start/server-fns'; // registers every "use server" module (incl. lazy routes)
|
|
17
17
|
export { isServerFnRequest, handleServerFn } from '@fluixi/start/server-fn';
|
|
18
|
+
|
|
19
|
+
// File-based API routes under src/api. The dev server dispatches to them itself; a built
|
|
20
|
+
// server finds them through this, and without it every /api request would fall through
|
|
21
|
+
// to the page renderer. Harmless when there are no routes.
|
|
22
|
+
export { isApiRequest, handleApiRequest } from '@fluixi/start/api-routes';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createResource } from '@fluixi/reactive/signal';
|
|
2
1
|
import { seo } from '@fluixi/start/head';
|
|
3
2
|
import { html } from '@fluixi/start';
|
|
4
3
|
|
|
@@ -7,7 +6,7 @@ const tick = <T,>(v: T, ms = 30) => new Promise<T>((r) => setTimeout(() => r(v),
|
|
|
7
6
|
// A data-gated route, like a real page: the resource is awaited during SSR so the
|
|
8
7
|
// content (not the spinner) is server-rendered, then hydrated.
|
|
9
8
|
export default function Home() {
|
|
10
|
-
const
|
|
9
|
+
const data = $resource(() => tick('Hello from Fluixi Start 👋'));
|
|
11
10
|
|
|
12
11
|
// Per-route document head: rendered into <head> on the server (great for crawlers/links)
|
|
13
12
|
// and kept reactive on the client. seo() is optional; call it where you want metadata.
|