create-fluixi 0.1.0-alpha.8 → 1.0.0-alpha.99

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.
Files changed (44) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +19 -5
  3. package/dist/index.js +887 -140
  4. package/package.json +19 -2
  5. package/template-spa/README.md +16 -0
  6. package/template-spa/_gitignore +1 -0
  7. package/template-spa/fluixi.config.ts +18 -0
  8. package/template-spa/index.html +3 -3
  9. package/template-spa/package.json +15 -7
  10. package/template-spa/src/app.tsx +30 -7
  11. package/template-spa/src/entry-client.tsx +8 -0
  12. package/template-spa/src/entry-server.ts +22 -0
  13. package/template-spa/src/routes/about.tsx +8 -0
  14. package/template-spa/src/routes/index.tsx +24 -0
  15. package/template-spa/tsconfig.json +2 -2
  16. package/template-spa-html/README.md +19 -0
  17. package/template-spa-html/_gitignore +1 -0
  18. package/template-spa-html/fluixi.config.ts +18 -0
  19. package/template-spa-html/index.html +3 -3
  20. package/template-spa-html/package.json +15 -6
  21. package/template-spa-html/src/app.ts +28 -7
  22. package/template-spa-html/src/entry-client.ts +8 -0
  23. package/template-spa-html/src/entry-server.ts +22 -0
  24. package/template-spa-html/src/routes/about.ts +10 -0
  25. package/template-spa-html/src/routes/index.ts +24 -0
  26. package/template-spa-html/tsconfig.json +2 -2
  27. package/template-ssr/_gitignore +1 -0
  28. package/template-ssr/fluixi.config.ts +6 -2
  29. package/template-ssr/package.json +9 -4
  30. package/template-ssr/src/app.tsx +5 -5
  31. package/template-ssr/src/entry-client.tsx +2 -2
  32. package/template-ssr/src/entry-server.ts +7 -2
  33. package/template-ssr/src/routes/index.tsx +2 -3
  34. package/template-ssr-html/_gitignore +1 -0
  35. package/template-ssr-html/fluixi.config.ts +6 -2
  36. package/template-ssr-html/package.json +10 -4
  37. package/template-ssr-html/src/app.ts +4 -4
  38. package/template-ssr-html/src/entry-client.ts +2 -2
  39. package/template-ssr-html/src/entry-server.ts +7 -2
  40. package/template-ssr-html/src/routes/index.ts +2 -3
  41. package/template-spa/src/main.tsx +0 -5
  42. package/template-spa/vite.config.ts +0 -6
  43. package/template-spa-html/src/main.ts +0 -5
  44. package/template-spa-html/vite.config.ts +0 -6
@@ -10,15 +10,21 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@fluixi/cli": "alpha",
13
- "@fluixi/start": "alpha",
14
13
  "@fluixi/core": "alpha",
15
- "@fluixi/server": "alpha",
14
+ "@fluixi/di": "alpha",
15
+ "@fluixi/dom": "alpha",
16
+ "@fluixi/head": "alpha",
17
+ "@fluixi/jsx": "alpha",
16
18
  "@fluixi/reactive": "alpha",
17
- "@fluixi/dom": "alpha"
19
+ "@fluixi/router": "alpha",
20
+ "@fluixi/server": "alpha",
21
+ "@fluixi/start": "alpha",
22
+ "@fluixi/storage": "alpha"
18
23
  },
19
24
  "devDependencies": {
20
25
  "@fluixi/ts-plugin": "alpha",
21
26
  "@types/node": "^20.0.0",
22
- "vite": "^5.0.0"
27
+ "typescript": "^7.0.2",
28
+ "vite": "^8.3.2"
23
29
  }
24
30
  }
@@ -1,16 +1,16 @@
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';
5
5
 
6
6
  // Shell layout around the routed page. File-routes (src/routes/*) are lazy, so the
7
- // <Outlet/> sits under <Suspense> — async SSR resolves their content server-side.
7
+ // <Outlet/> sits under <Suspense>: async SSR resolves their content server-side.
8
8
  // Components are interpolated as `<${Comp}/>` so TypeScript sees them referenced.
9
9
  function RootLayout() {
10
10
  return html`
11
11
  <div class="app">
12
12
  <nav>
13
- <a href="/">home</a> · <a href="/about">about</a>
13
+ <${Link} href="/">home<//> · <${Link} href="/about">about<//>
14
14
  </nav>
15
15
  <main>
16
16
  <${Suspense} fallback=${html`<p>loading…</p>`}>
@@ -21,7 +21,7 @@ function RootLayout() {
21
21
  `;
22
22
  }
23
23
 
24
- // Exported so entry-client can hand it to startClient — it preloads the current route's
24
+ // Exported so entry-client can hand it to startClient, it preloads the current route's
25
25
  // lazy chunk before hydrating, so the server-rendered DOM is adopted in place (flash-free).
26
26
  export const appRoutes = [{ path: '/', component: RootLayout, children: routes as any }];
27
27
 
@@ -1,10 +1,10 @@
1
- // Client entry — hydrates the server-rendered markup. The app HTML is injected into
1
+ // Client entry: hydrates the server-rendered markup. The app HTML is injected into
2
2
  // `#root` (the @fluixi/start mountId), so hydrate that container.
3
3
  import { startClient } from '@fluixi/core/client';
4
4
  import App, { appRoutes } from './app.js';
5
5
 
6
6
  // Passing the route tree lets startClient preload the matched route's lazy chunk before
7
- // hydrating — the lazy file-route then resolves synchronously and adopts the server DOM in
7
+ // hydrating: the lazy file-route then resolves synchronously and adopts the server DOM in
8
8
  // place (no first-paint flash, no duplicate). It also enables auto-hydration of the
9
9
  // server-rendered root.
10
10
  startClient(App, { root: '#root', routes: appRoutes });
@@ -1,4 +1,4 @@
1
- // SSR entry — @fluixi/start's dev/build/start load this. It calls `renderStream`
1
+ // SSR entry: @fluixi/start's dev/build/start load this. It calls `renderStream`
2
2
  // (streaming: head flushed first, body streamed) when present, else `render` (string).
3
3
  import App from './app.js';
4
4
  import { renderRequestAsync, renderToBodyStream } from '@fluixi/server';
@@ -11,7 +11,12 @@ export function renderStream(url: string): ReadableStream<Uint8Array> {
11
11
  return renderToBodyStream(App, { url });
12
12
  }
13
13
 
14
- // Server-function RPC dispatch — re-exported so the dispatcher shares the registry that
14
+ // Server-function RPC dispatch: re-exported so the dispatcher shares the registry that
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,9 +6,9 @@ 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 [data] = createResource(() => tick('Hello from Fluixi Start 👋'));
9
+ const data = $resource(() => tick('Hello from Fluixi Start 👋'));
11
10
 
12
- // Per-route document head — rendered into <head> on the server (great for crawlers/links)
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.
14
13
  seo({
15
14
  title: 'Fluixi Start',
@@ -1,5 +0,0 @@
1
- import { render } from '@fluixi/core';
2
- import { App } from './app';
3
-
4
- const root = document.getElementById('app');
5
- if (root) render(() => <App />, root);
@@ -1,6 +0,0 @@
1
- import { defineConfig } from 'vite';
2
- import { fluixi } from '@fluixi/vite-plugin';
3
-
4
- export default defineConfig({
5
- plugins: [fluixi()],
6
- });
@@ -1,5 +0,0 @@
1
- import { render, html } from '@fluixi/core';
2
- import { App } from './app';
3
-
4
- const root = document.getElementById('app');
5
- if (root) render(() => html`<${App} />`, root);
@@ -1,6 +0,0 @@
1
- import { defineConfig } from 'vite';
2
- import { fluixi } from '@fluixi/vite-plugin';
3
-
4
- export default defineConfig({
5
- plugins: [fluixi()],
6
- });