fondu 0.9.0 → 0.9.1
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/README.md +5 -5
- package/dist/server/prerender.js +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,13 +26,13 @@ It asks where the app runs (Bun, Cloudflare Workers or Node; or `--target bun|cl
|
|
|
26
26
|
code checks (oxfmt, oxlint, lefthook, commitlint; or `--checks`), and writes a small app: a route, its page, the
|
|
27
27
|
error page, Tailwind CSS, editor snippets and an `AGENTS.md` for coding agents. `--yes` asks nothing more.
|
|
28
28
|
|
|
29
|
-
[demo.fondu.dev](https://demo.fondu.dev) ([apps/demo](https://github.com/fondujs/fondu/tree/main/apps/demo)) shows
|
|
30
|
-
Cloudflare Workers with D1 and Better Auth.
|
|
29
|
+
[demo.fondu.dev](https://demo.fondu.dev) ([apps/demo](https://github.com/fondujs/fondu/tree/main/apps/demo)) shows Fondu's and Inertia's features, one page each,
|
|
30
|
+
on Cloudflare Workers with D1 and Better Auth.
|
|
31
31
|
|
|
32
32
|
## Docs
|
|
33
33
|
|
|
34
|
-
**[fondu.dev](https://fondu.dev/docs)**: routes, pages and props, layouts, forms and validation, type safety,
|
|
35
|
-
server-side rendering, static pages, MDX pages, deploying, and the API. Every page is also Markdown for coding agents
|
|
34
|
+
**[fondu.dev](https://fondu.dev/docs)**: routes, pages and props, layouts, forms and validation, errors, type safety,
|
|
35
|
+
server-side rendering, static pages, MDX pages, internationalization, deploying, and the API. Every page is also Markdown for coding agents
|
|
36
36
|
([llms.txt](https://fondu.dev/llms.txt)).
|
|
37
37
|
|
|
38
38
|
## Contributing
|
|
@@ -40,7 +40,7 @@ server-side rendering, static pages, MDX pages, deploying, and the API. Every pa
|
|
|
40
40
|
```
|
|
41
41
|
packages/fondu the package
|
|
42
42
|
packages/create-fondu `bun create fondu`
|
|
43
|
-
apps/demo
|
|
43
|
+
apps/demo Fondu's and Inertia's features, one page each — Workers, D1, Better Auth, coss ui
|
|
44
44
|
apps/site fondu.dev: the docs, MDX and static pages on Workers
|
|
45
45
|
```
|
|
46
46
|
|
package/dist/server/prerender.js
CHANGED
|
@@ -2,6 +2,8 @@ import { fillPattern, PAGE_DATA, pathOfPageData, staticFiles } from '../paths.js
|
|
|
2
2
|
import { isInertia } from './http.js';
|
|
3
3
|
/** Node / Bun: reads a file of the client build (`docs/intro.html`), or null; set by the built server's entry */
|
|
4
4
|
const STATIC_FILES = Symbol.for('fondu.staticFiles');
|
|
5
|
+
/** a page's file: no hidden one (`.vite/manifest.json`), nothing above the client build (`..`), no empty segment */
|
|
6
|
+
const isPageFile = (file) => file.split('/').every((s) => s !== '' && !s.startsWith('.'));
|
|
5
7
|
/** The paths to prerender, and what stops a route from being prerendered (the build fails on those) */
|
|
6
8
|
export async function prerenderPaths(routes) {
|
|
7
9
|
const paths = new Set();
|
|
@@ -55,6 +57,8 @@ export function prerenderRoutes(app, routes, version) {
|
|
|
55
57
|
catch {
|
|
56
58
|
return next(); // not a path a file could have
|
|
57
59
|
}
|
|
60
|
+
if (!isPageFile(file))
|
|
61
|
+
return next();
|
|
58
62
|
const body = await read(file);
|
|
59
63
|
if (!body)
|
|
60
64
|
return next();
|
|
@@ -76,7 +80,8 @@ export function prerenderRoutes(app, routes, version) {
|
|
|
76
80
|
});
|
|
77
81
|
app.get(`${PAGE_DATA}/*`, (c) => {
|
|
78
82
|
const path = pathOfPageData(c.req.path);
|
|
79
|
-
|
|
83
|
+
// a page object's own URL is not a page: no page object of a page object (and so on)
|
|
84
|
+
if (!path || path.startsWith(`${PAGE_DATA}/`))
|
|
80
85
|
return c.notFound();
|
|
81
86
|
const url = new URL(c.req.url);
|
|
82
87
|
url.pathname = path;
|