@jasonshimmy/vite-plugin-cer-app 0.21.0 → 0.21.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/CHANGELOG.md +5 -0
- package/README.md +2 -0
- package/commits.txt +2 -1
- package/dist/plugin/build-ssg.d.ts.map +1 -1
- package/dist/plugin/build-ssg.js +28 -4
- package/dist/plugin/build-ssg.js.map +1 -1
- package/dist/plugin/dev-server.d.ts.map +1 -1
- package/dist/plugin/dev-server.js +32 -13
- package/dist/plugin/dev-server.js.map +1 -1
- package/dist/plugin/virtual/routes.d.ts.map +1 -1
- package/dist/plugin/virtual/routes.js +5 -1
- package/dist/plugin/virtual/routes.js.map +1 -1
- package/dist/runtime/entry-server-template.d.ts +1 -1
- package/dist/runtime/entry-server-template.d.ts.map +1 -1
- package/dist/runtime/entry-server-template.js +5 -4
- package/dist/runtime/entry-server-template.js.map +1 -1
- package/docs/configuration.md +1 -1
- package/docs/content.md +6 -0
- package/docs/rendering-modes.md +2 -0
- package/docs/routing.md +29 -4
- package/package.json +1 -1
- package/src/__tests__/plugin/build-ssg.test.ts +112 -1
- package/src/__tests__/plugin/dev-server.test.ts +74 -5
- package/src/__tests__/plugin/entry-server-template.test.ts +4 -4
- package/src/__tests__/plugin/virtual/routes.test.ts +5 -1
- package/src/plugin/build-ssg.ts +37 -5
- package/src/plugin/dev-server.ts +41 -15
- package/src/plugin/virtual/routes.ts +5 -1
- package/src/runtime/entry-server-template.ts +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
|
+
## [v0.21.1] - 2026-04-13
|
|
5
|
+
|
|
6
|
+
- fix: broken test (19540bd)
|
|
7
|
+
- fix: ensure catch all only throws errors if one is actually encountered, enhance content-driven routing and catch-all page handling in documentation (a1ea900)
|
|
8
|
+
|
|
4
9
|
## [v0.21.0] - 2026-04-12
|
|
5
10
|
|
|
6
11
|
- feat: add support for numeric ordering prefixes in content paths and update related tests (ffb0bc8)
|
package/README.md
CHANGED
|
@@ -228,6 +228,8 @@ content/
|
|
|
228
228
|
|
|
229
229
|
Date-prefixed filenames still work the same way after the numeric prefix is removed.
|
|
230
230
|
|
|
231
|
+
For content-driven routing, use `app/pages/[...all].ts` to resolve valid nested URLs at runtime. Unlike `app/pages/404.ts`, a catch-all page is not treated as a 404 automatically. Existing content routes stay HTTP 200, and in SSG with `ssg.routes: 'auto'` a catch-all page that uses `queryContent()` can auto-generate concrete output paths from the content store.
|
|
232
|
+
|
|
231
233
|
See [docs/content.md](docs/content.md) for the full content-layer API and examples.
|
|
232
234
|
|
|
233
235
|
---
|
package/commits.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
-
|
|
1
|
+
- fix: broken test (19540bd)
|
|
2
|
+
- fix: ensure catch all only throws errors if one is actually encountered, enhance content-driven routing and catch-all page handling in documentation (a1ea900)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-ssg.d.ts","sourceRoot":"","sources":["../../src/plugin/build-ssg.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"build-ssg.d.ts","sourceRoot":"","sources":["../../src/plugin/build-ssg.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAqOxD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAYf;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,EACzB,cAAc,GAAE,UAAe,GAC9B,OAAO,CAAC,IAAI,CAAC,CAmEf"}
|
package/dist/plugin/build-ssg.js
CHANGED
|
@@ -5,6 +5,7 @@ import { createServer } from 'vite';
|
|
|
5
5
|
import { buildSSR } from './build-ssr.js';
|
|
6
6
|
import { buildRouteEntry } from './path-utils.js';
|
|
7
7
|
import fg from 'fast-glob';
|
|
8
|
+
const CONTENT_STORE_KEY = '__CER_CONTENT_STORE__';
|
|
8
9
|
/**
|
|
9
10
|
* Collects all static paths to generate.
|
|
10
11
|
* For 'auto' mode: scans app/pages/ and collects only static (non-dynamic) routes
|
|
@@ -52,8 +53,9 @@ async function collectSsgPaths(config, viteUserConfig) {
|
|
|
52
53
|
for (const file of files) {
|
|
53
54
|
// Skip routes that declare render: 'server' or render: 'spa' — they are
|
|
54
55
|
// either always-SSR or client-only and must not be pre-rendered.
|
|
56
|
+
let src = '';
|
|
55
57
|
try {
|
|
56
|
-
|
|
58
|
+
src = await readFile(file, 'utf-8');
|
|
57
59
|
const renderMatch = src.match(/render\s*:\s*['"]([^'"]+)['"]/);
|
|
58
60
|
const renderMode = renderMatch ? renderMatch[1] : null;
|
|
59
61
|
if (renderMode === 'server' || renderMode === 'spa')
|
|
@@ -61,14 +63,15 @@ async function collectSsgPaths(config, viteUserConfig) {
|
|
|
61
63
|
}
|
|
62
64
|
catch { /* ignore read errors */ }
|
|
63
65
|
const entry = buildRouteEntry(file, config.pagesDir);
|
|
66
|
+
const usesQueryContent = /\bqueryContent\s*\(/.test(src);
|
|
64
67
|
if (!entry.isDynamic && !entry.isCatchAll) {
|
|
65
68
|
staticFiles.push(file);
|
|
66
69
|
if (entry.routePath !== '/') {
|
|
67
70
|
paths.push(entry.routePath);
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
|
-
else if (entry.isDynamic
|
|
71
|
-
dynamicFiles.push({ file, entry });
|
|
73
|
+
else if (entry.isDynamic) {
|
|
74
|
+
dynamicFiles.push({ file, entry, usesQueryContent });
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
if (dynamicFiles.length > 0) {
|
|
@@ -81,7 +84,7 @@ async function collectSsgPaths(config, viteUserConfig) {
|
|
|
81
84
|
logLevel: 'silent',
|
|
82
85
|
});
|
|
83
86
|
try {
|
|
84
|
-
for (const { file, entry } of dynamicFiles) {
|
|
87
|
+
for (const { file, entry, usesQueryContent } of dynamicFiles) {
|
|
85
88
|
try {
|
|
86
89
|
const pageMod = await viteServer.ssrLoadModule(file);
|
|
87
90
|
const pageMeta = pageMod.meta ?? pageMod.pageMeta;
|
|
@@ -92,10 +95,17 @@ async function collectSsgPaths(config, viteUserConfig) {
|
|
|
92
95
|
for (const ctx of pathsResult) {
|
|
93
96
|
let resolvedPath = entry.routePath;
|
|
94
97
|
for (const [key, value] of Object.entries(ctx.params)) {
|
|
98
|
+
resolvedPath = resolvedPath.replace(`:${key}*`, String(value));
|
|
95
99
|
resolvedPath = resolvedPath.replace(`:${key}`, String(value));
|
|
96
100
|
}
|
|
97
101
|
paths.push(resolvedPath);
|
|
98
102
|
}
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (entry.isCatchAll && usesQueryContent) {
|
|
106
|
+
const contentStore = globalThis[CONTENT_STORE_KEY];
|
|
107
|
+
const catchAllPaths = _collectCatchAllContentPaths(entry.routePath, contentStore ?? []);
|
|
108
|
+
paths.push(...catchAllPaths);
|
|
99
109
|
}
|
|
100
110
|
}
|
|
101
111
|
catch {
|
|
@@ -130,6 +140,20 @@ async function collectSsgPaths(config, viteUserConfig) {
|
|
|
130
140
|
}
|
|
131
141
|
return [...new Set(paths)]; // deduplicate
|
|
132
142
|
}
|
|
143
|
+
function _collectCatchAllContentPaths(routePath, store) {
|
|
144
|
+
if (store.length === 0)
|
|
145
|
+
return [];
|
|
146
|
+
const prefix = routePath
|
|
147
|
+
.replace(/:[^/]+\*$/, '')
|
|
148
|
+
.replace(/\/+$/, '') || '/';
|
|
149
|
+
return store
|
|
150
|
+
.map((item) => item._path)
|
|
151
|
+
.filter((contentPath) => {
|
|
152
|
+
if (prefix === '/')
|
|
153
|
+
return true;
|
|
154
|
+
return contentPath === prefix || contentPath.startsWith(prefix + '/');
|
|
155
|
+
});
|
|
156
|
+
}
|
|
133
157
|
// Cache the server module across renderPath calls (loaded once per SSG run)
|
|
134
158
|
let _serverMod = null;
|
|
135
159
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-ssg.js","sourceRoot":"","sources":["../../src/plugin/build-ssg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAmB,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"build-ssg.js","sourceRoot":"","sources":["../../src/plugin/build-ssg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAmB,MAAM,MAAM,CAAA;AAGpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,MAAM,WAAW,CAAA;AAQ1B,MAAM,iBAAiB,GAAG,uBAAuB,CAAA;AAGjD;;;;;GAKG;AACH;;;GAGG;AACH,SAAS,kBAAkB,CACzB,KAAe,EACf,IAA+B;IAE/B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,WAAW;QAAE,OAAO,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E,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,QAAQ,GAAG,uBAAuB,GAAG,WAAW,CAAA;KAAE,GAAG,IAAI,CAAA;CACtH;AAwID;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,iBAAiB,GACxB,IAAI,CA2MN"}
|
|
@@ -95,6 +95,28 @@ function _matchDevRoute(pattern, urlPath) {
|
|
|
95
95
|
'$';
|
|
96
96
|
return new RegExp(regexStr).test(norm(urlPath));
|
|
97
97
|
}
|
|
98
|
+
function _isHtmlRequest(url, acceptHeader) {
|
|
99
|
+
const accept = Array.isArray(acceptHeader) ? acceptHeader.join(',') : (acceptHeader ?? '');
|
|
100
|
+
if (url.startsWith('/api/') || url.startsWith('/@'))
|
|
101
|
+
return false;
|
|
102
|
+
return (accept.includes('text/html') ||
|
|
103
|
+
url === '/' ||
|
|
104
|
+
url === '/index.html' ||
|
|
105
|
+
!url.includes('.'));
|
|
106
|
+
}
|
|
107
|
+
async function _serveSpaShell(server, config, url, res) {
|
|
108
|
+
const userHtml = resolve(config.root, 'index.html');
|
|
109
|
+
const cerHtml = join(getGeneratedDir(config.root), 'index.html');
|
|
110
|
+
const shellPath = existsSync(userHtml) ? userHtml : cerHtml;
|
|
111
|
+
if (!existsSync(shellPath))
|
|
112
|
+
return false;
|
|
113
|
+
const rawHtml = readFileSync(shellPath, 'utf-8');
|
|
114
|
+
const transformed = await server.transformIndexHtml(url, rawHtml);
|
|
115
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
116
|
+
res.statusCode = 200;
|
|
117
|
+
res.end(transformed);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
98
120
|
/**
|
|
99
121
|
* Configures the Vite dev server with:
|
|
100
122
|
* 1. API route handlers from server/api/
|
|
@@ -105,6 +127,7 @@ export function configureCerDevServer(server, config) {
|
|
|
105
127
|
server.middlewares.use(async (req, res, next) => {
|
|
106
128
|
const url = req.url ?? '/';
|
|
107
129
|
const method = req.method?.toUpperCase() ?? 'GET';
|
|
130
|
+
const acceptsHtml = _isHtmlRequest(url, req.headers['accept']);
|
|
108
131
|
// 1. Server middleware from server/middleware/ runs first (CORS, auth, logging, etc.)
|
|
109
132
|
try {
|
|
110
133
|
const smMod = await server.ssrLoadModule('virtual:cer-server-middleware');
|
|
@@ -188,14 +211,18 @@ export function configureCerDevServer(server, config) {
|
|
|
188
211
|
catch {
|
|
189
212
|
// virtual:cer-server-api not yet ready or empty — continue
|
|
190
213
|
}
|
|
191
|
-
// 3.
|
|
214
|
+
// 3. SPA mode: answer client-routed HTML navigations with the shell directly
|
|
215
|
+
// so Vite's history fallback never emits an intermediate 404 for valid app routes.
|
|
216
|
+
if (config.mode === 'spa' && (method === 'GET' || method === 'HEAD') && acceptsHtml) {
|
|
217
|
+
if (await _serveSpaShell(server, config, url, res)) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// 4. SSR/SSG mode: intercept HTML requests and server-render them.
|
|
192
222
|
// Both 'ssr' and 'ssg' modes run loaders on the server so usePageData()
|
|
193
223
|
// returns real data during dev — matching production behaviour.
|
|
194
224
|
// 'spa' mode never runs server loaders, so it falls through to the client bundle.
|
|
195
225
|
if (config.mode === 'ssr' || config.mode === 'ssg') {
|
|
196
|
-
const acceptsHtml = (req.headers['accept'] ?? '').includes('text/html') ||
|
|
197
|
-
url === '/' ||
|
|
198
|
-
(!url.includes('.') && !url.startsWith('/api/') && !url.startsWith('/@'));
|
|
199
226
|
if (acceptsHtml) {
|
|
200
227
|
// Check per-route render mode — skip SSR for 'spa' routes.
|
|
201
228
|
const urlPathOnly = url.split('?')[0];
|
|
@@ -208,15 +235,7 @@ export function configureCerDevServer(server, config) {
|
|
|
208
235
|
// In SSR/SSG dev mode, a route with render:'spa' should be served as
|
|
209
236
|
// the SPA shell (no server rendering). Serve .cer/index.html so the
|
|
210
237
|
// client bundle boots and handles the route client-side.
|
|
211
|
-
|
|
212
|
-
const _cerHtml = join(getGeneratedDir(config.root), 'index.html');
|
|
213
|
-
const _spaSrcPath = existsSync(_userHtml) ? _userHtml : _cerHtml;
|
|
214
|
-
if (existsSync(_spaSrcPath)) {
|
|
215
|
-
const rawHtml = readFileSync(_spaSrcPath, 'utf-8');
|
|
216
|
-
const transformed = await server.transformIndexHtml(url, rawHtml);
|
|
217
|
-
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
218
|
-
res.statusCode = 200;
|
|
219
|
-
res.end(transformed);
|
|
238
|
+
if (await _serveSpaShell(server, config, url, res)) {
|
|
220
239
|
return;
|
|
221
240
|
}
|
|
222
241
|
next();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.js","sourceRoot":"","sources":["../../src/plugin/dev-server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAwBpD;;GAEG;AACH,SAAS,QAAQ,CAAC,GAAoB;IACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;QACrD,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QACnD,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACzB,CAAC,CA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,CAAA;wBAED,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,0BAA0B,CAAC,CAAA;wBACzD,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;wBACjB,OAAM;oBACR,CAAC;gBACH,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,CAAC,gBAAgB,CAAC,GAAY,CAAC,CAAA;oBACrC,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAA;oBACjD,GAAG,CAAC,UAAU,GAAG,GAAG,CAAA;oBACpB,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;oBAC3C,GAAG,CAAC,GAAG,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;oBACpC,OAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,EAAE,CAAA;IACR,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/plugin/virtual/routes.ts"],"names":[],"mappings":"AAmPA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,QAAQ,GAAG,uBAAuB,GAAG,WAAW,CAAA;CAC3D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/plugin/virtual/routes.ts"],"names":[],"mappings":"AAmPA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,QAAQ,GAAG,uBAAuB,GAAG,WAAW,CAAA;CAC3D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAqPzG"}
|
|
@@ -347,6 +347,7 @@ export async function generateRoutesCode(pagesDir, i18n) {
|
|
|
347
347
|
const filePath = JSON.stringify(entry.filePath);
|
|
348
348
|
const tagName = JSON.stringify(entry.tagName);
|
|
349
349
|
const routePath = JSON.stringify(entry.routePath);
|
|
350
|
+
const isNotFoundPage = basename(entry.filePath) === '404.ts';
|
|
350
351
|
// The load() function dynamically imports the page module which:
|
|
351
352
|
// 1. Runs component() as a side effect, registering the custom element
|
|
352
353
|
// 2. Returns the tag name string as `default` so the router knows what to render
|
|
@@ -386,6 +387,9 @@ export async function generateRoutesCode(pagesDir, i18n) {
|
|
|
386
387
|
if (title !== null) {
|
|
387
388
|
metaFields.push(`title: ${JSON.stringify(title)}`);
|
|
388
389
|
}
|
|
390
|
+
if (isNotFoundPage) {
|
|
391
|
+
metaFields.push(`_cerNotFound: true`);
|
|
392
|
+
}
|
|
389
393
|
// P2-2: Per-route error tag stored in meta for SSR error boundary resolution.
|
|
390
394
|
if (routeErrorTag !== null) {
|
|
391
395
|
metaFields.push(`errorTag: ${JSON.stringify(routeErrorTag)}`);
|
|
@@ -441,7 +445,7 @@ export async function generateRoutesCode(pagesDir, i18n) {
|
|
|
441
445
|
// The null default tag causes _prepareRequest to return status 404.
|
|
442
446
|
const allRouteItems = routeItems.flat();
|
|
443
447
|
if (!hasCatchAll) {
|
|
444
|
-
allRouteItems.push(` {\n path: '/:all*',\n load: () => Promise.resolve({ default: null, loader: null }),\n }`);
|
|
448
|
+
allRouteItems.push(` {\n path: '/:all*',\n load: () => Promise.resolve({ default: null, loader: null }),\n meta: { _cerNotFound: true },\n }`);
|
|
445
449
|
}
|
|
446
450
|
lines.push('const routes = [');
|
|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AE,CAAC,CAAA;IAEd,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
* - useHead() support via beginHeadCollection / endHeadCollection
|
|
12
12
|
* - DSD polyfill injected at end of <body> after client-template merge
|
|
13
13
|
*/
|
|
14
|
-
export declare const ENTRY_SERVER_TEMPLATE = "// Server-side entry \u2014 AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nimport { readFileSync, existsSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { AsyncLocalStorage } from 'node:async_hooks'\nimport routes from 'virtual:cer-routes'\nimport layouts from 'virtual:cer-layouts'\nimport plugins from 'virtual:cer-plugins'\nimport apiRoutes from 'virtual:cer-server-api'\nimport serverMiddleware from 'virtual:cer-server-middleware'\nimport { runtimeConfig, _runtimePrivateDefaults, _authSessionKey, _hooks } from 'virtual:cer-app-config'\nimport { registerBuiltinComponents } from '@jasonshimmy/custom-elements-runtime'\nimport { registerEntityMap, renderToStreamWithJITCSSDSD, DSD_POLYFILL_SCRIPT } from '@jasonshimmy/custom-elements-runtime/ssr'\nimport entitiesJson from '@jasonshimmy/custom-elements-runtime/entities.json'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { beginHeadCollection, endHeadCollection, serializeHeadTags, initRuntimeConfig, resolvePrivateConfig, useSession } from '@jasonshimmy/vite-plugin-cer-app/composables'\nimport { errorTag } from 'virtual:cer-error'\nimport { createIsrHandler } from '@jasonshimmy/vite-plugin-cer-app/isr'\n\nregisterBuiltinComponents()\n\n// Resolve private config from environment variables at server startup.\n// Each key declared in runtimeConfig.private is looked up in process.env,\n// first as-is, then as ALL_CAPS. The declared default is used as fallback.\ninitRuntimeConfig({ ...runtimeConfig, private: resolvePrivateConfig(_runtimePrivateDefaults ?? {}) })\n\n// Pre-load the full HTML entity map so named entities like — decode\n// correctly during SSR. Without this the bundled runtime falls back to a\n// minimal set (<, >, & \u2026) and re-escapes everything else.\nregisterEntityMap(entitiesJson)\n\n// Run plugins once at server startup so their provide() values are available\n// to useInject() during every SSR/SSG render pass. Stored on globalThis so all\n// dynamically-imported page chunks share the same reference.\nconst _pluginProvides = new Map()\n;(globalThis).__cerPluginProvides = _pluginProvides\nconst _pluginsReady = (async () => {\n const _bootstrapRouter = initRouter({ routes })\n for (const plugin of plugins) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({\n router: _bootstrapRouter,\n provide: (key, value) => _pluginProvides.set(key, value),\n config: {},\n })\n }\n }\n})()\n\n// Async-local storage for request-scoped SSR loader data.\n// Using AsyncLocalStorage ensures concurrent SSR renders (e.g. SSG with\n// concurrency > 1) never see each other's data \u2014 each request's async chain\n// carries its own store value, so usePageData() is always race-condition-free.\nconst _cerDataStore = new AsyncLocalStorage()\n// Expose the store so the usePageData() composable can read it server-side.\n;(globalThis).__CER_DATA_STORE__ = _cerDataStore\n\n// Async-local storage for request-scoped req/res access.\n// Allows isomorphic composables (e.g. useCookie) to read/write HTTP headers\n// without prop-drilling the request context through the component tree.\nconst _cerReqStore = new AsyncLocalStorage()\n;(globalThis).__CER_REQ_STORE__ = _cerReqStore\n\n// Async-local storage for the authenticated user resolved before each render.\n// useAuth() reads this store server-side to return the current user synchronously.\nconst _cerAuthStore = new AsyncLocalStorage()\n;(globalThis).__CER_AUTH_STORE__ = _cerAuthStore\n\n// Async-local storage for per-request useFetch() data.\n// useFetch() writes fetched results here; the handler serialises the map into\n// window.__CER_FETCH_DATA__ for client-side hydration.\nconst _cerFetchStore = new AsyncLocalStorage()\n;(globalThis).__CER_FETCH_STORE__ = _cerFetchStore\n\n// Async-local storage for the current route info (path, params, query, meta).\n// useRoute() reads this on the server so layouts and components can access\n// route metadata without prop-drilling.\nconst _cerRouteStore = new AsyncLocalStorage()\n;(globalThis).__CER_ROUTE_STORE__ = _cerRouteStore\n\n// Async-local storage for per-request useState() reactive state.\n// Each request gets a fresh Map so concurrent SSR/SSG renders never share\n// reactive state set by different pages or loaders.\nconst _cerStateStore = new AsyncLocalStorage()\n;(globalThis).__CER_STATE_STORE__ = _cerStateStore\n\n// Runs fn inside the per-request AsyncLocalStorage context so that isomorphic\n// composables (useCookie, useSession, etc.) can access req/res without prop-drilling.\n// Call this for every API handler invocation \u2014 not just SSR renders.\nexport function runWithRequestContext(req, res, fn) {\n return _cerReqStore.run({ req, res }, fn)\n}\n\n// Runs the server/middleware/ chain for a request.\n// Returns false if a middleware short-circuited the response; true to continue.\n// Exported so Netlify / Vercel / Cloudflare bridges can also call it for API routes.\n// P1-2: Middleware may throw { status: 401 } (or any numeric .status) to produce\n// a non-500 response \u2014 the status is extracted and forwarded to res.statusCode.\nexport async function runServerMiddleware(req, res) {\n for (const { handler: mw } of (serverMiddleware ?? [])) {\n if (typeof mw !== 'function') continue\n let calledNext = false\n try {\n await new Promise((resolve, reject) => {\n Promise.resolve(mw(req, res, (err) => {\n if (err) reject(err)\n else { calledNext = true; resolve() }\n })).catch(reject)\n })\n } catch (err) {\n if (_hooks?.onError) {\n try { await _hooks.onError(err, { type: 'middleware', path: new URL(req.url ?? '/', 'http://x').pathname, req }) } catch { /* hooks must not crash the handler */ }\n }\n if (!res.writableEnded) {\n const statusCode = (typeof err === 'object' && err !== null && 'status' in err && typeof err.status === 'number')\n ? (isNaN(err.status) ? 500 : err.status)\n : 500\n res.statusCode = statusCode\n res.end('Internal Server Error')\n }\n return false\n }\n if (res.writableEnded || !calledNext) return false\n }\n return true\n}\n\n// Load the Vite-built client index.html (dist/client/index.html) so every SSR\n// response includes the client-side scripts needed for hydration and routing.\n// The server bundle lives at dist/server/server.js, so ../client resolves correctly.\n//\n// Cloudflare Workers (and other runtimes without node:fs) can inject the\n// template before this module loads by setting globalThis.__CER_CLIENT_TEMPLATE__.\n// The Cloudflare adapter inlines dist/client/index.html as a string constant in\n// _worker.js and sets the global before dynamically importing the server bundle.\nlet _clientTemplate = (globalThis).__CER_CLIENT_TEMPLATE__ ?? null\nif (!_clientTemplate) {\n try {\n const _clientTemplatePath = join(dirname(fileURLToPath(import.meta.url)), '../client/index.html')\n _clientTemplate = existsSync(_clientTemplatePath)\n ? readFileSync(_clientTemplatePath, 'utf-8')\n : null\n } catch {\n // node:fs not available in this runtime \u2014 Cloudflare adapter must set\n // globalThis.__CER_CLIENT_TEMPLATE__ before importing this bundle.\n }\n}\n\n// Merge the SSR rendered body with the Vite client shell so the final page\n// contains both pre-rendered DSD content and the client bundle scripts.\nfunction _mergeWithClientTemplate(ssrHtml, clientTemplate) {\n const headTag = '<head>', headCloseTag = '</head>'\n const bodyTag = '<body>', bodyCloseTag = '</body>'\n const headStart = ssrHtml.indexOf(headTag)\n const headEnd = ssrHtml.indexOf(headCloseTag)\n const bodyStart = ssrHtml.indexOf(bodyTag)\n const bodyEnd = ssrHtml.lastIndexOf(bodyCloseTag)\n const ssrHead = headStart >= 0 && headEnd > headStart\n ? ssrHtml.slice(headStart + headTag.length, headEnd).trim() : ''\n const ssrBody = bodyStart >= 0 && bodyEnd > bodyStart\n ? ssrHtml.slice(bodyStart + bodyTag.length, bodyEnd).trim() : ssrHtml\n // Hoist only top-level <style id=...> elements (cer-ssr-jit, cer-ssr-global)\n // from the SSR body into the document <head>. Plain <style> blocks without\n // an id attribute belong to shadow DOM templates and must stay in place \u2014\n // hoisting them to <head> breaks shadow DOM style encapsulation (document\n // styles do not pierce shadow roots), which is the root cause of FOUC.\n const headParts = ssrHead ? [ssrHead] : []\n let ssrBodyContent = ssrBody\n let pos = 0\n while (pos < ssrBodyContent.length) {\n const styleOpen = ssrBodyContent.indexOf('<style id=', pos)\n if (styleOpen < 0) break\n const styleClose = ssrBodyContent.indexOf('</style>', styleOpen)\n if (styleClose < 0) break\n headParts.push(ssrBodyContent.slice(styleOpen, styleClose + 8))\n ssrBodyContent = ssrBodyContent.slice(0, styleOpen) + ssrBodyContent.slice(styleClose + 8)\n pos = styleOpen\n }\n ssrBodyContent = ssrBodyContent.trim()\n // Inject the pre-rendered layout+page as light DOM of the app mount element\n // so it is visible before JS boots, then the client router takes over.\n let merged = clientTemplate\n if (merged.includes('<cer-layout-view></cer-layout-view>')) {\n merged = merged.replace('<cer-layout-view></cer-layout-view>',\n '<cer-layout-view>' + ssrBodyContent + '</cer-layout-view>')\n } else if (merged.includes('<div id=\"app\"></div>')) {\n merged = merged.replace('<div id=\"app\"></div>',\n '<div id=\"app\">' + ssrBodyContent + '</div>')\n }\n const headAdditions = headParts.filter(Boolean).join('\\n')\n if (headAdditions) {\n // If SSR provides a <title>, replace the client template's <title> so the\n // SSR title wins (client template title is the fallback default).\n if (headAdditions.includes('<title>')) {\n merged = merged.replace(/<title>[^<]*<\\/title>/, '')\n }\n merged = merged.replace('</head>', headAdditions + '\\n</head>')\n }\n return merged\n}\n\n// Per-request async setup: initialize a fresh router, resolve the matched\n// route and layout, pre-load the page module, and call the data loader.\n// Loader data is returned so the handler can scope it to _cerDataStore.run()\n// during rendering. (AsyncLocalStorage.enterWith() inside an awaited child\n// function does not propagate back to the parent continuation, so run() is\n// the only reliable approach.)\nconst _prepareRequest = async (req) => {\n await _pluginsReady\n const router = initRouter({ routes, initialUrl: req.url ?? '/' })\n const current = router.getCurrent()\n const { route, params } = router.matchRoute(current.path)\n\n // Store the current route info so useRoute() can read it synchronously\n // from any layout or component during this render pass.\n _cerRouteStore.enterWith({\n path: current.path,\n params,\n query: current.query ?? {},\n meta: route?.meta ?? null,\n })\n\n // Pre-load the page module so we can embed the component tag directly.\n // This avoids the async router-view (which injects content via script tags\n // and breaks Declarative Shadow DOM on initial parse).\n let pageVnode = { tag: 'div', props: {}, children: [] }\n let head\n // Loader data to pass to usePageData() during rendering. Declared here\n // (outside try/catch) so it's visible in all return paths.\n let loaderData = null\n if (route?.load) {\n try {\n const mod = await route.load()\n const pageTag = mod.default\n // P2-2: Route-level error tag (from co-located .error.ts or _error.ts).\n // Preferred over the global errorTag when rendering loader errors for this route.\n const routeErrorTag = mod.errorTag ?? null\n\n // P1-1: Synthetic 404 catch-all \u2014 no page component registered.\n if (!pageTag) {\n const notFoundErrorTag = routeErrorTag ?? errorTag\n const notFoundVnode = notFoundErrorTag\n ? { tag: notFoundErrorTag, props: { attrs: { error: 'Not Found', status: '404' } }, children: [] }\n : { tag: 'div', props: {}, children: [] }\n return { vnode: notFoundVnode, router, head: undefined, status: 404 }\n }\n\n // Run the loader before creating the page vnode so we can pass its\n // primitive return values as HTML attributes. useProps() in the page\n // component reads element attributes, so merging loader data here makes\n // both useProps() and usePageData() work in SSR / SSG.\n let loaderAttrs = {}\n if (typeof mod.loader === 'function') {\n const query = current.query ?? {}\n const data = await mod.loader({ params, query, req })\n if (data !== undefined && data !== null) {\n // Store loader data so the handler can pass it to _cerDataStore.run()\n // below. Using enterWith() here doesn't work because it only modifies\n // the async context *inside* this awaited function, not the outer\n // handler's continuation where renderToStreamWithJITCSSDSD runs.\n loaderData = data\n head = `<script>window.__CER_DATA__ = ${JSON.stringify(data)}</script>`\n // Expose primitive loader values as element attributes so useProps()\n // can read them. Complex objects are only accessible via usePageData().\n loaderAttrs = Object.fromEntries(\n Object.entries(data).filter(([, v]) => v !== null && v !== undefined && typeof v !== 'object' && typeof v !== 'function')\n )\n }\n }\n\n pageVnode = { tag: pageTag, props: { attrs: { ...params, ...loaderAttrs } }, children: [] }\n } catch (err) {\n // Loader threw \u2014 render the error page server-side if app/error.ts exists.\n const status = (err && typeof err === 'object' && 'status' in err && typeof err.status === 'number')\n ? err.status : 500\n const message = (err instanceof Error) ? err.message : String(err)\n if (_hooks?.onError) {\n try { await _hooks.onError(err, { type: 'loader', path: new URL(req.url ?? '/', 'http://x').pathname, req }) } catch { /* hooks must not crash the handler */ }\n }\n // P2-2: Prefer the route-level errorTag over the global one.\n // routeErrorTag is not in scope here; use route?.meta?.errorTag from the matched route.\n const effectiveErrorTag = route?.meta?.errorTag ?? errorTag\n if (!effectiveErrorTag) {\n console.error('[cer-app] Loader error (no app/error.ts defined):', err)\n }\n const errVnode = effectiveErrorTag\n ? { tag: effectiveErrorTag, props: { attrs: { error: message, status: String(status) } }, children: [] }\n : { tag: 'div', props: {}, children: [] }\n return { vnode: errVnode, router, head: undefined, status }\n }\n }\n\n // Resolve layout chain: nested layouts (meta.layoutChain) or single layout.\n const chain = route?.meta?.layoutChain\n ? route.meta.layoutChain\n : [route?.meta?.layout ?? 'default']\n\n // Wrap pageVnode in the layout chain from innermost to outermost.\n let vnode = pageVnode\n for (let i = chain.length - 1; i >= 0; i--) {\n const tag = layouts[chain[i]]\n if (tag) vnode = { tag, props: {}, children: [vnode] }\n }\n\n // If the request matched a catch-all route (user-defined 404.ts or [...all].ts),\n // return HTTP 404 so browsers and crawlers treat it as a not-found response.\n const isCatchAll = route?.path === '/:all*'\n return { vnode, router, head, status: isCatchAll ? 404 : null, loaderData }\n}\n\nexport const handler = async (req, res) => {\n const _requestPath = new URL(req.url ?? '/', 'http://x').pathname\n const _requestStart = Date.now()\n if (_hooks?.onRequest) {\n try { await _hooks.onRequest({ path: _requestPath, method: req.method ?? 'GET', req }) } catch { /* hooks must not crash the handler */ }\n }\n await _cerStateStore.run(new Map(), async () => {\n await _cerReqStore.run({ req, res }, async () => {\n await _cerDataStore.run(null, async () => {\n // Fresh per-request fetch map \u2014 populated by useFetch() calls inside loaders.\n const _fetchMap = new Map()\n await _cerFetchStore.run(_fetchMap, async () => {\n // Pre-resolve the authenticated user so useAuth() works synchronously during rendering.\n let _authUser = null\n if (_authSessionKey) {\n try { _authUser = await useSession({ name: _authSessionKey }).get() } catch { /* no session secret */ }\n }\n await _cerAuthStore.run(_authUser, async () => {\n const { vnode, router, head, status, loaderData } = await _prepareRequest(req)\n if (status != null) res.statusCode = status\n\n let _headCollectionOpen = false\n // Wrap the entire render pass in _cerDataStore.run(loaderData) so that\n // usePageData() inside component renderFn calls sees the correct store\n // value. AsyncLocalStorage.enterWith() inside _prepareRequest does NOT\n // propagate back to this outer async continuation \u2014 it only affects the\n // async chain inside _prepareRequest itself. Using run() here is the only\n // reliable way to scope the data store to the synchronous render pass.\n await _cerDataStore.run(loaderData ?? null, async () => {\n try {\n // Begin collecting useHead() calls made during the synchronous render pass.\n // IMPORTANT: the stream's start() function runs synchronously on construction,\n // so ALL useHead() calls happen before the stream object is returned. We must\n // call endHeadCollection() immediately \u2014 before any await \u2014 to avoid a race\n // window where a concurrent request (e.g. SSG concurrency > 1) resets the\n // shared globalThis collector while this handler is suspended at an await.\n _headCollectionOpen = true\n beginHeadCollection()\n\n // dsdPolyfill: false \u2014 we inject the polyfill manually after merging so it\n // lands at the end of <body>, not inside <cer-layout-view> light DOM where\n // scripts may not execute.\n // The first chunk from the stream is the full synchronous render. Subsequent\n // chunks are async component swap scripts streamed as they resolve.\n const stream = renderToStreamWithJITCSSDSD(vnode, { dsdPolyfill: false, router })\n\n // Collect head tags synchronously \u2014 all useHead() calls have already fired\n // inside the stream constructor's start() before it returned.\n const headTags = serializeHeadTags(endHeadCollection())\n _headCollectionOpen = false\n\n const reader = stream.getReader()\n\n // Read the first (synchronous) chunk \u2014 rejects if the sync render failed.\n const { value: firstChunk = '' } = await reader.read()\n\n // Serialise useFetch() results collected during loader execution.\n const _fetchObj = Object.fromEntries(_fetchMap)\n const _fetchScript = Object.keys(_fetchObj).length > 0\n ? `<script>window.__CER_FETCH_DATA__ = ${JSON.stringify(_fetchObj)}</script>`\n : ''\n\n // Serialise the auth user for client-side hydration via useAuth().\n const _authScript = _authUser\n ? `<script>window.__CER_AUTH_USER__ = ${JSON.stringify(_authUser)}</script>`\n : ''\n\n // Serialise useState() values for client-side hydration.\n // The state Map is populated by loader calls (in _prepareRequest) and by component\n // render functions (during renderToStreamWithJITCSSDSD above). Both run before this\n // point. Injected as window.__CER_STATE_INIT__ so the client useState() can\n // pre-populate its singleton Map on first use \u2014 no flash to default values.\n const _stateMap = _cerStateStore.getStore()\n let _stateScript = ''\n if (_stateMap && _stateMap.size > 0) {\n const _stateObj = {}\n for (const [k, v] of _stateMap) { _stateObj[k] = v.value }\n _stateScript = `<script>window.__CER_STATE_INIT__ = ${JSON.stringify(_stateObj)}</script>`\n }\n\n // Merge loader data script + useHead() tags + fetch/auth/state hydration scripts.\n const headContent = [head, headTags, _fetchScript, _authScript, _stateScript].filter(Boolean).join('\\n')\n\n // Wrap the rendered body in a full HTML document and inject the head additions\n // (loader data script, useHead() tags, JIT styles). No polyfill in body yet.\n const ssrHtml = `<!DOCTYPE html><html><head>${headContent}</head><body>${firstChunk}</body></html>`\n\n // In dev mode the module-level _clientTemplate is null (only the\n // production dist/client/index.html path is searched at init time).\n // The dev server sets (globalThis).__CER_CLIENT_TEMPLATE__ per-request\n // after running server.transformIndexHtml so the Vite client scripts\n // (/@vite/client, HMR) are included in every SSR response.\n const _resolvedClientTemplate = (globalThis).__CER_CLIENT_TEMPLATE__ ?? _clientTemplate\n const merged = _resolvedClientTemplate\n ? _mergeWithClientTemplate(ssrHtml, _resolvedClientTemplate)\n : ssrHtml\n\n // Split at </body> so async swap scripts and the DSD polyfill can be streamed\n // in before the document is closed.\n const bodyCloseIdx = merged.lastIndexOf('</body>')\n const beforeBodyClose = bodyCloseIdx >= 0 ? merged.slice(0, bodyCloseIdx) : merged\n const fromBodyClose = bodyCloseIdx >= 0 ? merged.slice(bodyCloseIdx) : ''\n\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.setHeader('Transfer-Encoding', 'chunked')\n res.write(beforeBodyClose)\n\n // Stream async component swap scripts through as-is.\n while (true) {\n const { value, done } = await reader.read()\n if (done) break\n res.write(value)\n }\n\n // Inject DSD polyfill immediately before </body>, then close the document.\n res.end(DSD_POLYFILL_SCRIPT + fromBodyClose)\n if (_hooks?.onResponse) {\n try { void _hooks.onResponse({ path: _requestPath, method: req.method ?? 'GET', statusCode: res.statusCode, duration: Date.now() - _requestStart, req }) } catch { /* ignore */ }\n }\n } catch (_renderErr) {\n if (_hooks?.onError) {\n try { await _hooks.onError(_renderErr, { type: 'render', path: _requestPath, req }) } catch { /* hooks must not crash the handler */ }\n }\n // Ensure the head collector is never left open on error.\n if (_headCollectionOpen) { try { endHeadCollection() } catch { /* ignore */ } }\n // If headers have not been flushed yet we can still send a proper 500 page.\n // If writing has already started we can only close the connection cleanly.\n if (!res.headersSent) {\n res.statusCode = 500\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.end('<!DOCTYPE html><html><head></head><body><h1>500 Internal Server Error</h1><p>An unexpected error occurred while rendering this page.</p></body></html>')\n } else {\n res.end()\n }\n if (_hooks?.onResponse) {\n try { void _hooks.onResponse({ path: _requestPath, method: req.method ?? 'GET', statusCode: res.statusCode, duration: Date.now() - _requestStart, req }) } catch { /* ignore */ }\n }\n }\n }) // _cerDataStore.run(loaderData)\n }) // _cerAuthStore.run\n }) // _cerFetchStore.run\n }) // _cerDataStore.run\n }) // _cerReqStore.run\n }) // _cerStateStore.run\n}\n\n// ISR-wrapped handler for production integrations (Express, Hono, Fastify).\n// Routes with meta.ssg.revalidate are served stale-while-revalidate.\nexport const isrHandler = createIsrHandler(routes, handler)\n\nexport { apiRoutes, plugins, layouts, routes, serverMiddleware }\nexport default handler\n";
|
|
14
|
+
export declare const ENTRY_SERVER_TEMPLATE = "// Server-side entry \u2014 AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nimport { readFileSync, existsSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { AsyncLocalStorage } from 'node:async_hooks'\nimport routes from 'virtual:cer-routes'\nimport layouts from 'virtual:cer-layouts'\nimport plugins from 'virtual:cer-plugins'\nimport apiRoutes from 'virtual:cer-server-api'\nimport serverMiddleware from 'virtual:cer-server-middleware'\nimport { runtimeConfig, _runtimePrivateDefaults, _authSessionKey, _hooks } from 'virtual:cer-app-config'\nimport { registerBuiltinComponents } from '@jasonshimmy/custom-elements-runtime'\nimport { registerEntityMap, renderToStreamWithJITCSSDSD, DSD_POLYFILL_SCRIPT } from '@jasonshimmy/custom-elements-runtime/ssr'\nimport entitiesJson from '@jasonshimmy/custom-elements-runtime/entities.json'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { beginHeadCollection, endHeadCollection, serializeHeadTags, initRuntimeConfig, resolvePrivateConfig, useSession } from '@jasonshimmy/vite-plugin-cer-app/composables'\nimport { errorTag } from 'virtual:cer-error'\nimport { createIsrHandler } from '@jasonshimmy/vite-plugin-cer-app/isr'\n\nregisterBuiltinComponents()\n\n// Resolve private config from environment variables at server startup.\n// Each key declared in runtimeConfig.private is looked up in process.env,\n// first as-is, then as ALL_CAPS. The declared default is used as fallback.\ninitRuntimeConfig({ ...runtimeConfig, private: resolvePrivateConfig(_runtimePrivateDefaults ?? {}) })\n\n// Pre-load the full HTML entity map so named entities like — decode\n// correctly during SSR. Without this the bundled runtime falls back to a\n// minimal set (<, >, & \u2026) and re-escapes everything else.\nregisterEntityMap(entitiesJson)\n\n// Run plugins once at server startup so their provide() values are available\n// to useInject() during every SSR/SSG render pass. Stored on globalThis so all\n// dynamically-imported page chunks share the same reference.\nconst _pluginProvides = new Map()\n;(globalThis).__cerPluginProvides = _pluginProvides\nconst _pluginsReady = (async () => {\n const _bootstrapRouter = initRouter({ routes })\n for (const plugin of plugins) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({\n router: _bootstrapRouter,\n provide: (key, value) => _pluginProvides.set(key, value),\n config: {},\n })\n }\n }\n})()\n\n// Async-local storage for request-scoped SSR loader data.\n// Using AsyncLocalStorage ensures concurrent SSR renders (e.g. SSG with\n// concurrency > 1) never see each other's data \u2014 each request's async chain\n// carries its own store value, so usePageData() is always race-condition-free.\nconst _cerDataStore = new AsyncLocalStorage()\n// Expose the store so the usePageData() composable can read it server-side.\n;(globalThis).__CER_DATA_STORE__ = _cerDataStore\n\n// Async-local storage for request-scoped req/res access.\n// Allows isomorphic composables (e.g. useCookie) to read/write HTTP headers\n// without prop-drilling the request context through the component tree.\nconst _cerReqStore = new AsyncLocalStorage()\n;(globalThis).__CER_REQ_STORE__ = _cerReqStore\n\n// Async-local storage for the authenticated user resolved before each render.\n// useAuth() reads this store server-side to return the current user synchronously.\nconst _cerAuthStore = new AsyncLocalStorage()\n;(globalThis).__CER_AUTH_STORE__ = _cerAuthStore\n\n// Async-local storage for per-request useFetch() data.\n// useFetch() writes fetched results here; the handler serialises the map into\n// window.__CER_FETCH_DATA__ for client-side hydration.\nconst _cerFetchStore = new AsyncLocalStorage()\n;(globalThis).__CER_FETCH_STORE__ = _cerFetchStore\n\n// Async-local storage for the current route info (path, params, query, meta).\n// useRoute() reads this on the server so layouts and components can access\n// route metadata without prop-drilling.\nconst _cerRouteStore = new AsyncLocalStorage()\n;(globalThis).__CER_ROUTE_STORE__ = _cerRouteStore\n\n// Async-local storage for per-request useState() reactive state.\n// Each request gets a fresh Map so concurrent SSR/SSG renders never share\n// reactive state set by different pages or loaders.\nconst _cerStateStore = new AsyncLocalStorage()\n;(globalThis).__CER_STATE_STORE__ = _cerStateStore\n\n// Runs fn inside the per-request AsyncLocalStorage context so that isomorphic\n// composables (useCookie, useSession, etc.) can access req/res without prop-drilling.\n// Call this for every API handler invocation \u2014 not just SSR renders.\nexport function runWithRequestContext(req, res, fn) {\n return _cerReqStore.run({ req, res }, fn)\n}\n\n// Runs the server/middleware/ chain for a request.\n// Returns false if a middleware short-circuited the response; true to continue.\n// Exported so Netlify / Vercel / Cloudflare bridges can also call it for API routes.\n// P1-2: Middleware may throw { status: 401 } (or any numeric .status) to produce\n// a non-500 response \u2014 the status is extracted and forwarded to res.statusCode.\nexport async function runServerMiddleware(req, res) {\n for (const { handler: mw } of (serverMiddleware ?? [])) {\n if (typeof mw !== 'function') continue\n let calledNext = false\n try {\n await new Promise((resolve, reject) => {\n Promise.resolve(mw(req, res, (err) => {\n if (err) reject(err)\n else { calledNext = true; resolve() }\n })).catch(reject)\n })\n } catch (err) {\n if (_hooks?.onError) {\n try { await _hooks.onError(err, { type: 'middleware', path: new URL(req.url ?? '/', 'http://x').pathname, req }) } catch { /* hooks must not crash the handler */ }\n }\n if (!res.writableEnded) {\n const statusCode = (typeof err === 'object' && err !== null && 'status' in err && typeof err.status === 'number')\n ? (isNaN(err.status) ? 500 : err.status)\n : 500\n res.statusCode = statusCode\n res.end('Internal Server Error')\n }\n return false\n }\n if (res.writableEnded || !calledNext) return false\n }\n return true\n}\n\n// Load the Vite-built client index.html (dist/client/index.html) so every SSR\n// response includes the client-side scripts needed for hydration and routing.\n// The server bundle lives at dist/server/server.js, so ../client resolves correctly.\n//\n// Cloudflare Workers (and other runtimes without node:fs) can inject the\n// template before this module loads by setting globalThis.__CER_CLIENT_TEMPLATE__.\n// The Cloudflare adapter inlines dist/client/index.html as a string constant in\n// _worker.js and sets the global before dynamically importing the server bundle.\nlet _clientTemplate = (globalThis).__CER_CLIENT_TEMPLATE__ ?? null\nif (!_clientTemplate) {\n try {\n const _clientTemplatePath = join(dirname(fileURLToPath(import.meta.url)), '../client/index.html')\n _clientTemplate = existsSync(_clientTemplatePath)\n ? readFileSync(_clientTemplatePath, 'utf-8')\n : null\n } catch {\n // node:fs not available in this runtime \u2014 Cloudflare adapter must set\n // globalThis.__CER_CLIENT_TEMPLATE__ before importing this bundle.\n }\n}\n\n// Merge the SSR rendered body with the Vite client shell so the final page\n// contains both pre-rendered DSD content and the client bundle scripts.\nfunction _mergeWithClientTemplate(ssrHtml, clientTemplate) {\n const headTag = '<head>', headCloseTag = '</head>'\n const bodyTag = '<body>', bodyCloseTag = '</body>'\n const headStart = ssrHtml.indexOf(headTag)\n const headEnd = ssrHtml.indexOf(headCloseTag)\n const bodyStart = ssrHtml.indexOf(bodyTag)\n const bodyEnd = ssrHtml.lastIndexOf(bodyCloseTag)\n const ssrHead = headStart >= 0 && headEnd > headStart\n ? ssrHtml.slice(headStart + headTag.length, headEnd).trim() : ''\n const ssrBody = bodyStart >= 0 && bodyEnd > bodyStart\n ? ssrHtml.slice(bodyStart + bodyTag.length, bodyEnd).trim() : ssrHtml\n // Hoist only top-level <style id=...> elements (cer-ssr-jit, cer-ssr-global)\n // from the SSR body into the document <head>. Plain <style> blocks without\n // an id attribute belong to shadow DOM templates and must stay in place \u2014\n // hoisting them to <head> breaks shadow DOM style encapsulation (document\n // styles do not pierce shadow roots), which is the root cause of FOUC.\n const headParts = ssrHead ? [ssrHead] : []\n let ssrBodyContent = ssrBody\n let pos = 0\n while (pos < ssrBodyContent.length) {\n const styleOpen = ssrBodyContent.indexOf('<style id=', pos)\n if (styleOpen < 0) break\n const styleClose = ssrBodyContent.indexOf('</style>', styleOpen)\n if (styleClose < 0) break\n headParts.push(ssrBodyContent.slice(styleOpen, styleClose + 8))\n ssrBodyContent = ssrBodyContent.slice(0, styleOpen) + ssrBodyContent.slice(styleClose + 8)\n pos = styleOpen\n }\n ssrBodyContent = ssrBodyContent.trim()\n // Inject the pre-rendered layout+page as light DOM of the app mount element\n // so it is visible before JS boots, then the client router takes over.\n let merged = clientTemplate\n if (merged.includes('<cer-layout-view></cer-layout-view>')) {\n merged = merged.replace('<cer-layout-view></cer-layout-view>',\n '<cer-layout-view>' + ssrBodyContent + '</cer-layout-view>')\n } else if (merged.includes('<div id=\"app\"></div>')) {\n merged = merged.replace('<div id=\"app\"></div>',\n '<div id=\"app\">' + ssrBodyContent + '</div>')\n }\n const headAdditions = headParts.filter(Boolean).join('\\n')\n if (headAdditions) {\n // If SSR provides a <title>, replace the client template's <title> so the\n // SSR title wins (client template title is the fallback default).\n if (headAdditions.includes('<title>')) {\n merged = merged.replace(/<title>[^<]*<\\/title>/, '')\n }\n merged = merged.replace('</head>', headAdditions + '\\n</head>')\n }\n return merged\n}\n\n// Per-request async setup: initialize a fresh router, resolve the matched\n// route and layout, pre-load the page module, and call the data loader.\n// Loader data is returned so the handler can scope it to _cerDataStore.run()\n// during rendering. (AsyncLocalStorage.enterWith() inside an awaited child\n// function does not propagate back to the parent continuation, so run() is\n// the only reliable approach.)\nconst _prepareRequest = async (req) => {\n await _pluginsReady\n const router = initRouter({ routes, initialUrl: req.url ?? '/' })\n const current = router.getCurrent()\n const { route, params } = router.matchRoute(current.path)\n\n // Store the current route info so useRoute() can read it synchronously\n // from any layout or component during this render pass.\n _cerRouteStore.enterWith({\n path: current.path,\n params,\n query: current.query ?? {},\n meta: route?.meta ?? null,\n })\n\n // Pre-load the page module so we can embed the component tag directly.\n // This avoids the async router-view (which injects content via script tags\n // and breaks Declarative Shadow DOM on initial parse).\n let pageVnode = { tag: 'div', props: {}, children: [] }\n let head\n // Loader data to pass to usePageData() during rendering. Declared here\n // (outside try/catch) so it's visible in all return paths.\n let loaderData = null\n if (route?.load) {\n try {\n const mod = await route.load()\n const pageTag = mod.default\n // P2-2: Route-level error tag (from co-located .error.ts or _error.ts).\n // Preferred over the global errorTag when rendering loader errors for this route.\n const routeErrorTag = mod.errorTag ?? null\n\n // P1-1: Synthetic 404 catch-all \u2014 no page component registered.\n if (!pageTag) {\n const notFoundErrorTag = routeErrorTag ?? errorTag\n const notFoundVnode = notFoundErrorTag\n ? { tag: notFoundErrorTag, props: { attrs: { error: 'Not Found', status: '404' } }, children: [] }\n : { tag: 'div', props: {}, children: [] }\n return { vnode: notFoundVnode, router, head: undefined, status: 404 }\n }\n\n // Run the loader before creating the page vnode so we can pass its\n // primitive return values as HTML attributes. useProps() in the page\n // component reads element attributes, so merging loader data here makes\n // both useProps() and usePageData() work in SSR / SSG.\n let loaderAttrs = {}\n if (typeof mod.loader === 'function') {\n const query = current.query ?? {}\n const data = await mod.loader({ params, query, req })\n if (data !== undefined && data !== null) {\n // Store loader data so the handler can pass it to _cerDataStore.run()\n // below. Using enterWith() here doesn't work because it only modifies\n // the async context *inside* this awaited function, not the outer\n // handler's continuation where renderToStreamWithJITCSSDSD runs.\n loaderData = data\n head = `<script>window.__CER_DATA__ = ${JSON.stringify(data)}</script>`\n // Expose primitive loader values as element attributes so useProps()\n // can read them. Complex objects are only accessible via usePageData().\n loaderAttrs = Object.fromEntries(\n Object.entries(data).filter(([, v]) => v !== null && v !== undefined && typeof v !== 'object' && typeof v !== 'function')\n )\n }\n }\n\n pageVnode = { tag: pageTag, props: { attrs: { ...params, ...loaderAttrs } }, children: [] }\n } catch (err) {\n // Loader threw \u2014 render the error page server-side if app/error.ts exists.\n const status = (err && typeof err === 'object' && 'status' in err && typeof err.status === 'number')\n ? err.status : 500\n const message = (err instanceof Error) ? err.message : String(err)\n if (_hooks?.onError) {\n try { await _hooks.onError(err, { type: 'loader', path: new URL(req.url ?? '/', 'http://x').pathname, req }) } catch { /* hooks must not crash the handler */ }\n }\n // P2-2: Prefer the route-level errorTag over the global one.\n // routeErrorTag is not in scope here; use route?.meta?.errorTag from the matched route.\n const effectiveErrorTag = route?.meta?.errorTag ?? errorTag\n if (!effectiveErrorTag) {\n console.error('[cer-app] Loader error (no app/error.ts defined):', err)\n }\n const errVnode = effectiveErrorTag\n ? { tag: effectiveErrorTag, props: { attrs: { error: message, status: String(status) } }, children: [] }\n : { tag: 'div', props: {}, children: [] }\n return { vnode: errVnode, router, head: undefined, status }\n }\n }\n\n // Resolve layout chain: nested layouts (meta.layoutChain) or single layout.\n const chain = route?.meta?.layoutChain\n ? route.meta.layoutChain\n : [route?.meta?.layout ?? 'default']\n\n // Wrap pageVnode in the layout chain from innermost to outermost.\n let vnode = pageVnode\n for (let i = chain.length - 1; i >= 0; i--) {\n const tag = layouts[chain[i]]\n if (tag) vnode = { tag, props: {}, children: [vnode] }\n }\n\n // Only framework-owned not-found routes should force a 404 status. A user\n // catch-all page ([...all].ts) may successfully resolve real content paths\n // and should stay 200 unless its loader explicitly throws a 404.\n const isNotFoundRoute = route?.meta?._cerNotFound === true\n return { vnode, router, head, status: isNotFoundRoute ? 404 : null, loaderData }\n}\n\nexport const handler = async (req, res) => {\n const _requestPath = new URL(req.url ?? '/', 'http://x').pathname\n const _requestStart = Date.now()\n if (_hooks?.onRequest) {\n try { await _hooks.onRequest({ path: _requestPath, method: req.method ?? 'GET', req }) } catch { /* hooks must not crash the handler */ }\n }\n await _cerStateStore.run(new Map(), async () => {\n await _cerReqStore.run({ req, res }, async () => {\n await _cerDataStore.run(null, async () => {\n // Fresh per-request fetch map \u2014 populated by useFetch() calls inside loaders.\n const _fetchMap = new Map()\n await _cerFetchStore.run(_fetchMap, async () => {\n // Pre-resolve the authenticated user so useAuth() works synchronously during rendering.\n let _authUser = null\n if (_authSessionKey) {\n try { _authUser = await useSession({ name: _authSessionKey }).get() } catch { /* no session secret */ }\n }\n await _cerAuthStore.run(_authUser, async () => {\n const { vnode, router, head, status, loaderData } = await _prepareRequest(req)\n if (status != null) res.statusCode = status\n\n let _headCollectionOpen = false\n // Wrap the entire render pass in _cerDataStore.run(loaderData) so that\n // usePageData() inside component renderFn calls sees the correct store\n // value. AsyncLocalStorage.enterWith() inside _prepareRequest does NOT\n // propagate back to this outer async continuation \u2014 it only affects the\n // async chain inside _prepareRequest itself. Using run() here is the only\n // reliable way to scope the data store to the synchronous render pass.\n await _cerDataStore.run(loaderData ?? null, async () => {\n try {\n // Begin collecting useHead() calls made during the synchronous render pass.\n // IMPORTANT: the stream's start() function runs synchronously on construction,\n // so ALL useHead() calls happen before the stream object is returned. We must\n // call endHeadCollection() immediately \u2014 before any await \u2014 to avoid a race\n // window where a concurrent request (e.g. SSG concurrency > 1) resets the\n // shared globalThis collector while this handler is suspended at an await.\n _headCollectionOpen = true\n beginHeadCollection()\n\n // dsdPolyfill: false \u2014 we inject the polyfill manually after merging so it\n // lands at the end of <body>, not inside <cer-layout-view> light DOM where\n // scripts may not execute.\n // The first chunk from the stream is the full synchronous render. Subsequent\n // chunks are async component swap scripts streamed as they resolve.\n const stream = renderToStreamWithJITCSSDSD(vnode, { dsdPolyfill: false, router })\n\n // Collect head tags synchronously \u2014 all useHead() calls have already fired\n // inside the stream constructor's start() before it returned.\n const headTags = serializeHeadTags(endHeadCollection())\n _headCollectionOpen = false\n\n const reader = stream.getReader()\n\n // Read the first (synchronous) chunk \u2014 rejects if the sync render failed.\n const { value: firstChunk = '' } = await reader.read()\n\n // Serialise useFetch() results collected during loader execution.\n const _fetchObj = Object.fromEntries(_fetchMap)\n const _fetchScript = Object.keys(_fetchObj).length > 0\n ? `<script>window.__CER_FETCH_DATA__ = ${JSON.stringify(_fetchObj)}</script>`\n : ''\n\n // Serialise the auth user for client-side hydration via useAuth().\n const _authScript = _authUser\n ? `<script>window.__CER_AUTH_USER__ = ${JSON.stringify(_authUser)}</script>`\n : ''\n\n // Serialise useState() values for client-side hydration.\n // The state Map is populated by loader calls (in _prepareRequest) and by component\n // render functions (during renderToStreamWithJITCSSDSD above). Both run before this\n // point. Injected as window.__CER_STATE_INIT__ so the client useState() can\n // pre-populate its singleton Map on first use \u2014 no flash to default values.\n const _stateMap = _cerStateStore.getStore()\n let _stateScript = ''\n if (_stateMap && _stateMap.size > 0) {\n const _stateObj = {}\n for (const [k, v] of _stateMap) { _stateObj[k] = v.value }\n _stateScript = `<script>window.__CER_STATE_INIT__ = ${JSON.stringify(_stateObj)}</script>`\n }\n\n // Merge loader data script + useHead() tags + fetch/auth/state hydration scripts.\n const headContent = [head, headTags, _fetchScript, _authScript, _stateScript].filter(Boolean).join('\\n')\n\n // Wrap the rendered body in a full HTML document and inject the head additions\n // (loader data script, useHead() tags, JIT styles). No polyfill in body yet.\n const ssrHtml = `<!DOCTYPE html><html><head>${headContent}</head><body>${firstChunk}</body></html>`\n\n // In dev mode the module-level _clientTemplate is null (only the\n // production dist/client/index.html path is searched at init time).\n // The dev server sets (globalThis).__CER_CLIENT_TEMPLATE__ per-request\n // after running server.transformIndexHtml so the Vite client scripts\n // (/@vite/client, HMR) are included in every SSR response.\n const _resolvedClientTemplate = (globalThis).__CER_CLIENT_TEMPLATE__ ?? _clientTemplate\n const merged = _resolvedClientTemplate\n ? _mergeWithClientTemplate(ssrHtml, _resolvedClientTemplate)\n : ssrHtml\n\n // Split at </body> so async swap scripts and the DSD polyfill can be streamed\n // in before the document is closed.\n const bodyCloseIdx = merged.lastIndexOf('</body>')\n const beforeBodyClose = bodyCloseIdx >= 0 ? merged.slice(0, bodyCloseIdx) : merged\n const fromBodyClose = bodyCloseIdx >= 0 ? merged.slice(bodyCloseIdx) : ''\n\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.setHeader('Transfer-Encoding', 'chunked')\n res.write(beforeBodyClose)\n\n // Stream async component swap scripts through as-is.\n while (true) {\n const { value, done } = await reader.read()\n if (done) break\n res.write(value)\n }\n\n // Inject DSD polyfill immediately before </body>, then close the document.\n res.end(DSD_POLYFILL_SCRIPT + fromBodyClose)\n if (_hooks?.onResponse) {\n try { void _hooks.onResponse({ path: _requestPath, method: req.method ?? 'GET', statusCode: res.statusCode, duration: Date.now() - _requestStart, req }) } catch { /* ignore */ }\n }\n } catch (_renderErr) {\n if (_hooks?.onError) {\n try { await _hooks.onError(_renderErr, { type: 'render', path: _requestPath, req }) } catch { /* hooks must not crash the handler */ }\n }\n // Ensure the head collector is never left open on error.\n if (_headCollectionOpen) { try { endHeadCollection() } catch { /* ignore */ } }\n // If headers have not been flushed yet we can still send a proper 500 page.\n // If writing has already started we can only close the connection cleanly.\n if (!res.headersSent) {\n res.statusCode = 500\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.end('<!DOCTYPE html><html><head></head><body><h1>500 Internal Server Error</h1><p>An unexpected error occurred while rendering this page.</p></body></html>')\n } else {\n res.end()\n }\n if (_hooks?.onResponse) {\n try { void _hooks.onResponse({ path: _requestPath, method: req.method ?? 'GET', statusCode: res.statusCode, duration: Date.now() - _requestStart, req }) } catch { /* ignore */ }\n }\n }\n }) // _cerDataStore.run(loaderData)\n }) // _cerAuthStore.run\n }) // _cerFetchStore.run\n }) // _cerDataStore.run\n }) // _cerReqStore.run\n }) // _cerStateStore.run\n}\n\n// ISR-wrapped handler for production integrations (Express, Hono, Fastify).\n// Routes with meta.ssg.revalidate are served stale-while-revalidate.\nexport const isrHandler = createIsrHandler(routes, handler)\n\nexport { apiRoutes, plugins, layouts, routes, serverMiddleware }\nexport default handler\n";
|
|
15
15
|
//# sourceMappingURL=entry-server-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-server-template.d.ts","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"entry-server-template.d.ts","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,w4uBA+cjC,CAAA"}
|
|
@@ -315,10 +315,11 @@ const _prepareRequest = async (req) => {
|
|
|
315
315
|
if (tag) vnode = { tag, props: {}, children: [vnode] }
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
|
|
321
|
-
|
|
318
|
+
// Only framework-owned not-found routes should force a 404 status. A user
|
|
319
|
+
// catch-all page ([...all].ts) may successfully resolve real content paths
|
|
320
|
+
// and should stay 200 unless its loader explicitly throws a 404.
|
|
321
|
+
const isNotFoundRoute = route?.meta?._cerNotFound === true
|
|
322
|
+
return { vnode, router, head, status: isNotFoundRoute ? 404 : null, loaderData }
|
|
322
323
|
}
|
|
323
324
|
|
|
324
325
|
export const handler = async (req, res) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-server-template.js","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG
|
|
1
|
+
{"version":3,"file":"entry-server-template.js","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+cpC,CAAA"}
|
package/docs/configuration.md
CHANGED
|
@@ -95,7 +95,7 @@ ssg: {
|
|
|
95
95
|
|
|
96
96
|
Which paths to generate at build time.
|
|
97
97
|
|
|
98
|
-
- `'auto'` — Scans `app/pages/` and generates all static routes. For dynamic routes, calls `meta.ssg.paths()` to enumerate paths.
|
|
98
|
+
- `'auto'` — Scans `app/pages/` and generates all static routes. For dynamic routes, calls `meta.ssg.paths()` to enumerate paths. Content-backed catch-all pages that use `queryContent()` can also auto-enumerate concrete paths from the content store.
|
|
99
99
|
- `string[]` — Explicit list of paths, e.g. `['/about', '/blog/hello-world']`.
|
|
100
100
|
|
|
101
101
|
### `ssg.concurrency`
|
package/docs/content.md
CHANGED
|
@@ -423,6 +423,12 @@ function normalizeContentPath(all: string | undefined) {
|
|
|
423
423
|
|
|
424
424
|
This pattern works well for documentation sites, blogs, and other apps where the route structure mirrors the `content/` directory. `queryContent('/docs/getting-started').first()` returns the full `ContentItem`, including `body`, `excerpt`, and `toc`.
|
|
425
425
|
|
|
426
|
+
Important behavior notes:
|
|
427
|
+
|
|
428
|
+
- A content-backed `[...all].ts` route is not treated as a framework 404 by default. If `queryContent()` finds a matching document, SSR/SSG responses stay HTTP 200.
|
|
429
|
+
- If no document is found and you want a real HTTP 404, throw a not-found error from the loader instead of only rendering a `404` heading in the template.
|
|
430
|
+
- In SSG with `ssg.routes: 'auto'`, catch-all pages that use `queryContent()` can auto-generate concrete output paths from the content store. You only need `meta.ssg.paths` when the URLs come from some other source.
|
|
431
|
+
|
|
426
432
|
---
|
|
427
433
|
|
|
428
434
|
## `useContentSearch()`
|
package/docs/rendering-modes.md
CHANGED
|
@@ -226,6 +226,8 @@ export const meta = {
|
|
|
226
226
|
|
|
227
227
|
Dynamic routes without `ssg.paths` are skipped during SSG. If `ssg.fallback: true`, they fall back to SSR at runtime. Otherwise they return 404.
|
|
228
228
|
|
|
229
|
+
Catch-all pages (`[...all].ts`) follow the same rule, with one extra convenience for the built-in content layer: if the catch-all page resolves URLs with `queryContent()` and `ssg.routes` is `'auto'`, the SSG build can auto-enumerate concrete paths from the in-memory content store. For non-content catch-all pages, continue to provide `meta.ssg.paths` explicitly.
|
|
230
|
+
|
|
229
231
|
### SSG manifest
|
|
230
232
|
|
|
231
233
|
```json
|
package/docs/routing.md
CHANGED
|
@@ -61,9 +61,14 @@ The `:slug` param is populated by the router and passed as a prop to the compone
|
|
|
61
61
|
|
|
62
62
|
## Catch-all routes and 404 pages
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
`404.ts` and `[...all].ts` both map to the same route pattern (`/:all*`), but they are not the same thing semantically:
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
- `404.ts` is the conventional not-found route. It should render your 404 UI, and the framework treats it as a real HTTP 404 route.
|
|
67
|
+
- `[...all].ts` is a general catch-all route. It can be used for not-found pages, but it is also the right choice for content-driven routing where valid URLs are resolved at runtime.
|
|
68
|
+
|
|
69
|
+
Use `404.ts` when the route is truly your global not-found page. Use `[...all].ts` when the route needs application logic to decide whether the current URL is valid.
|
|
70
|
+
|
|
71
|
+
**Option A — `404.ts` (recommended for true not-found pages)**
|
|
67
72
|
|
|
68
73
|
```ts
|
|
69
74
|
// app/pages/404.ts
|
|
@@ -77,7 +82,7 @@ component('page-404', () => {
|
|
|
77
82
|
})
|
|
78
83
|
```
|
|
79
84
|
|
|
80
|
-
The framework special-cases `404.ts` and automatically registers it as the catch-all route (`/:all*`).
|
|
85
|
+
The framework special-cases `404.ts` and automatically registers it as the catch-all route (`/:all*`). In SSR/SSG, it is treated as a real not-found route and returns HTTP 404.
|
|
81
86
|
|
|
82
87
|
**Option B — `[...name].ts` explicit catch-all**
|
|
83
88
|
|
|
@@ -88,7 +93,9 @@ component('page-all', () => {
|
|
|
88
93
|
})
|
|
89
94
|
```
|
|
90
95
|
|
|
91
|
-
|
|
96
|
+
This still produces the same route pattern (`/:all*`), but unlike `404.ts` it is not assumed to be a 404 by default. If the page successfully resolves data for the current URL, the response stays HTTP 200. If the page decides the URL is missing, throw or return a 404 from your loader explicitly.
|
|
97
|
+
|
|
98
|
+
This is the pattern to use for content-driven sites, documentation trees, storefront catalogs, and other apps where one catch-all page resolves many valid nested URLs.
|
|
92
99
|
|
|
93
100
|
**Synthetic 404 fallback (automatic)**
|
|
94
101
|
|
|
@@ -101,6 +108,8 @@ The synthetic route:
|
|
|
101
108
|
|
|
102
109
|
Add a real `404.ts` to customize the experience; the synthetic fallback is removed automatically once one exists.
|
|
103
110
|
|
|
111
|
+
Note that `app/error.ts` is a global error boundary, not a route page. You can also define per-route error boundaries with `foo.error.ts` or directory-level `_error.ts`. See [data-loading.md](./data-loading.md#error-boundary--apperrorts) for the global error page and the route-level error-boundary section later in this guide for per-route overrides.
|
|
112
|
+
|
|
104
113
|
---
|
|
105
114
|
|
|
106
115
|
## Route groups
|
|
@@ -250,6 +259,22 @@ export const meta = {
|
|
|
250
259
|
}
|
|
251
260
|
```
|
|
252
261
|
|
|
262
|
+
Catch-all pages can use `meta.ssg.paths` too:
|
|
263
|
+
|
|
264
|
+
```ts
|
|
265
|
+
// app/pages/[...all].ts
|
|
266
|
+
export const meta = {
|
|
267
|
+
ssg: {
|
|
268
|
+
paths: async () => [
|
|
269
|
+
{ params: { all: 'docs/getting-started' } },
|
|
270
|
+
{ params: { all: 'docs/routing' } },
|
|
271
|
+
],
|
|
272
|
+
},
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
For content-backed catch-all pages that resolve URLs with `queryContent()`, SSG can also auto-discover concrete paths from the content store when `ssg.routes` is set to `'auto'`.
|
|
277
|
+
|
|
253
278
|
### `meta.ssg.revalidate`
|
|
254
279
|
|
|
255
280
|
**Type:** `number` (seconds)
|
package/package.json
CHANGED
|
@@ -227,15 +227,22 @@ describe('buildSSG — path collection', () => {
|
|
|
227
227
|
expect(manifest.paths.length + manifest.errors.length).toBe(3)
|
|
228
228
|
})
|
|
229
229
|
|
|
230
|
-
it('skips catch-all pages when auto-discovering paths', async () => {
|
|
230
|
+
it('skips catch-all pages without explicit paths or content queries when auto-discovering paths', async () => {
|
|
231
231
|
vi.mocked(existsSync).mockReturnValue(true)
|
|
232
232
|
vi.mocked(fg).mockResolvedValue(['/project/app/pages/[...all].ts'])
|
|
233
|
+
vi.mocked(readFile).mockResolvedValue('')
|
|
233
234
|
vi.mocked(buildRouteEntry).mockReturnValueOnce({
|
|
234
235
|
routePath: '/:all*',
|
|
235
236
|
isDynamic: true,
|
|
236
237
|
isCatchAll: true,
|
|
237
238
|
} as ReturnType<typeof buildRouteEntry>)
|
|
238
239
|
|
|
240
|
+
const closeFn = vi.fn().mockResolvedValue(undefined)
|
|
241
|
+
vi.mocked(createServer).mockResolvedValue({
|
|
242
|
+
ssrLoadModule: vi.fn().mockResolvedValue({}),
|
|
243
|
+
close: closeFn,
|
|
244
|
+
} as unknown as Awaited<ReturnType<typeof createServer>>)
|
|
245
|
+
|
|
239
246
|
await buildSSG(makeConfig())
|
|
240
247
|
|
|
241
248
|
// Only '/' (always added) should be attempted
|
|
@@ -246,6 +253,110 @@ describe('buildSSG — path collection', () => {
|
|
|
246
253
|
expect(manifest.paths.length + manifest.errors.length).toBe(1)
|
|
247
254
|
})
|
|
248
255
|
|
|
256
|
+
it('auto-expands content-backed catch-all pages from the content store', async () => {
|
|
257
|
+
vi.mocked(existsSync).mockReturnValue(true)
|
|
258
|
+
vi.mocked(fg).mockResolvedValue(['/project/app/pages/[...all].ts'])
|
|
259
|
+
vi.mocked(readFile).mockResolvedValue('export const loader = async () => queryContent().find()')
|
|
260
|
+
vi.mocked(buildRouteEntry).mockReturnValueOnce({
|
|
261
|
+
routePath: '/:all*',
|
|
262
|
+
isDynamic: true,
|
|
263
|
+
isCatchAll: true,
|
|
264
|
+
} as ReturnType<typeof buildRouteEntry>)
|
|
265
|
+
|
|
266
|
+
;(globalThis as Record<string, unknown>).__CER_CONTENT_STORE__ = [
|
|
267
|
+
{ _path: '/music/effects/pro-co/rat' },
|
|
268
|
+
{ _path: '/music/effects/boss/ds-1' },
|
|
269
|
+
]
|
|
270
|
+
|
|
271
|
+
const closeFn = vi.fn().mockResolvedValue(undefined)
|
|
272
|
+
vi.mocked(createServer).mockResolvedValue({
|
|
273
|
+
ssrLoadModule: vi.fn().mockResolvedValue({}),
|
|
274
|
+
close: closeFn,
|
|
275
|
+
} as unknown as Awaited<ReturnType<typeof createServer>>)
|
|
276
|
+
|
|
277
|
+
await buildSSG(makeConfig({ ssg: { concurrency: 1 } } as Partial<ResolvedCerConfig>))
|
|
278
|
+
|
|
279
|
+
const manifestCall = vi.mocked(writeFile).mock.calls.find(([p]) =>
|
|
280
|
+
String(p).includes('ssg-manifest.json'),
|
|
281
|
+
)
|
|
282
|
+
const manifest = JSON.parse(String(manifestCall![1]))
|
|
283
|
+
expect(manifest.paths.length + manifest.errors.length).toBe(3)
|
|
284
|
+
|
|
285
|
+
delete (globalThis as Record<string, unknown>).__CER_CONTENT_STORE__
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
it('filters auto-expanded content paths by nested catch-all prefix', async () => {
|
|
289
|
+
vi.mocked(existsSync).mockReturnValue(true)
|
|
290
|
+
vi.mocked(fg).mockResolvedValue(['/project/app/pages/docs/[...all].ts'])
|
|
291
|
+
vi.mocked(readFile).mockResolvedValue('queryContent()')
|
|
292
|
+
vi.mocked(buildRouteEntry).mockReturnValueOnce({
|
|
293
|
+
routePath: '/docs/:all*',
|
|
294
|
+
isDynamic: true,
|
|
295
|
+
isCatchAll: true,
|
|
296
|
+
} as ReturnType<typeof buildRouteEntry>)
|
|
297
|
+
|
|
298
|
+
;(globalThis as Record<string, unknown>).__CER_CONTENT_STORE__ = [
|
|
299
|
+
{ _path: '/docs/getting-started' },
|
|
300
|
+
{ _path: '/docs/api/config' },
|
|
301
|
+
{ _path: '/blog/hello' },
|
|
302
|
+
]
|
|
303
|
+
|
|
304
|
+
const closeFn = vi.fn().mockResolvedValue(undefined)
|
|
305
|
+
vi.mocked(createServer).mockResolvedValue({
|
|
306
|
+
ssrLoadModule: vi.fn().mockResolvedValue({}),
|
|
307
|
+
close: closeFn,
|
|
308
|
+
} as unknown as Awaited<ReturnType<typeof createServer>>)
|
|
309
|
+
|
|
310
|
+
await buildSSG(makeConfig({ ssg: { concurrency: 1 } } as Partial<ResolvedCerConfig>))
|
|
311
|
+
|
|
312
|
+
const manifestCall = vi.mocked(writeFile).mock.calls.find(([p]) =>
|
|
313
|
+
String(p).includes('ssg-manifest.json'),
|
|
314
|
+
)
|
|
315
|
+
const manifest = JSON.parse(String(manifestCall![1]))
|
|
316
|
+
expect(manifest.paths.length + manifest.errors.length).toBe(3)
|
|
317
|
+
|
|
318
|
+
delete (globalThis as Record<string, unknown>).__CER_CONTENT_STORE__
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
it('expands catch-all ssg.paths into concrete URL paths', async () => {
|
|
322
|
+
vi.mocked(existsSync).mockReturnValue(true)
|
|
323
|
+
vi.mocked(fg).mockResolvedValue(['/project/app/pages/[...all].ts'])
|
|
324
|
+
vi.mocked(readFile).mockResolvedValue('')
|
|
325
|
+
vi.mocked(buildRouteEntry).mockReturnValueOnce({
|
|
326
|
+
routePath: '/:all*',
|
|
327
|
+
isDynamic: true,
|
|
328
|
+
isCatchAll: true,
|
|
329
|
+
} as ReturnType<typeof buildRouteEntry>)
|
|
330
|
+
|
|
331
|
+
const closeFn = vi.fn().mockResolvedValue(undefined)
|
|
332
|
+
vi.mocked(createServer).mockResolvedValue({
|
|
333
|
+
ssrLoadModule: vi.fn().mockResolvedValue({
|
|
334
|
+
meta: {
|
|
335
|
+
ssg: {
|
|
336
|
+
paths: async () => [
|
|
337
|
+
{ params: { all: 'music/effects/pro-co/rat' } },
|
|
338
|
+
{ params: { all: 'music/effects/boss/ds-1' } },
|
|
339
|
+
],
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
}),
|
|
343
|
+
close: closeFn,
|
|
344
|
+
} as unknown as Awaited<ReturnType<typeof createServer>>)
|
|
345
|
+
|
|
346
|
+
await buildSSG(makeConfig({ ssg: { concurrency: 1 } } as Partial<ResolvedCerConfig>))
|
|
347
|
+
|
|
348
|
+
const manifestCall = vi.mocked(writeFile).mock.calls.find(([p]) =>
|
|
349
|
+
String(p).includes('ssg-manifest.json'),
|
|
350
|
+
)
|
|
351
|
+
const manifest = JSON.parse(String(manifestCall![1]))
|
|
352
|
+
expect(manifest.paths.length + manifest.errors.length).toBe(3)
|
|
353
|
+
expect(manifest.errors.map((entry: { path: string }) => entry.path)).toEqual([
|
|
354
|
+
'/',
|
|
355
|
+
'/music/effects/pro-co/rat',
|
|
356
|
+
'/music/effects/boss/ds-1',
|
|
357
|
+
])
|
|
358
|
+
})
|
|
359
|
+
|
|
249
360
|
it('deduplicates collected paths', async () => {
|
|
250
361
|
vi.mocked(existsSync).mockReturnValue(true)
|
|
251
362
|
vi.mocked(fg).mockResolvedValue([
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { vi, describe, it, expect, beforeEach } from 'vitest'
|
|
2
2
|
import { EventEmitter } from 'node:events'
|
|
3
|
+
vi.mock('node:fs', () => ({
|
|
4
|
+
existsSync: vi.fn().mockReturnValue(false),
|
|
5
|
+
readFileSync: vi.fn().mockReturnValue('<html>shell</html>'),
|
|
6
|
+
}))
|
|
7
|
+
|
|
8
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
3
9
|
import { configureCerDevServer } from '../../plugin/dev-server.js'
|
|
4
10
|
import type { ResolvedCerConfig } from '../../plugin/dev-server.js'
|
|
5
11
|
|
|
@@ -60,6 +66,7 @@ type MockServer = {
|
|
|
60
66
|
middlewares: { use: ReturnType<typeof vi.fn> }
|
|
61
67
|
ssrLoadModule: ReturnType<typeof vi.fn>
|
|
62
68
|
ssrFixStacktrace: ReturnType<typeof vi.fn>
|
|
69
|
+
transformIndexHtml: ReturnType<typeof vi.fn>
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
function makeServer(): { server: MockServer; getMiddleware: () => Function } {
|
|
@@ -71,10 +78,16 @@ function makeServer(): { server: MockServer; getMiddleware: () => Function } {
|
|
|
71
78
|
return { apiRoutes: [] }
|
|
72
79
|
}),
|
|
73
80
|
ssrFixStacktrace: vi.fn(),
|
|
81
|
+
transformIndexHtml: vi.fn(async (_url: string, html: string) => html),
|
|
74
82
|
}
|
|
75
83
|
return { server, getMiddleware: () => registered[0] }
|
|
76
84
|
}
|
|
77
85
|
|
|
86
|
+
beforeEach(() => {
|
|
87
|
+
vi.mocked(existsSync).mockReturnValue(false)
|
|
88
|
+
vi.mocked(readFileSync).mockReturnValue('<html>shell</html>' as never)
|
|
89
|
+
})
|
|
90
|
+
|
|
78
91
|
// ─── Registration ─────────────────────────────────────────────────────────────
|
|
79
92
|
|
|
80
93
|
describe('configureCerDevServer — registration', () => {
|
|
@@ -89,11 +102,11 @@ describe('configureCerDevServer — registration', () => {
|
|
|
89
102
|
// ─── Non-API pass-through ─────────────────────────────────────────────────────
|
|
90
103
|
|
|
91
104
|
describe('configureCerDevServer — non-API pass-through', () => {
|
|
92
|
-
it('calls next() for a
|
|
105
|
+
it('calls next() for a non-HTML request with no matching routes', async () => {
|
|
93
106
|
const { server, getMiddleware } = makeServer()
|
|
94
107
|
configureCerDevServer(server as any, makeConfig())
|
|
95
108
|
const next = vi.fn()
|
|
96
|
-
await getMiddleware()(createReq({ url: '/
|
|
109
|
+
await getMiddleware()(createReq({ url: '/assets/main.js', headers: { accept: 'application/javascript' } }), createRes(), next)
|
|
97
110
|
expect(next).toHaveBeenCalled()
|
|
98
111
|
})
|
|
99
112
|
|
|
@@ -107,6 +120,54 @@ describe('configureCerDevServer — non-API pass-through', () => {
|
|
|
107
120
|
})
|
|
108
121
|
})
|
|
109
122
|
|
|
123
|
+
// ─── SPA shell handling ──────────────────────────────────────────────────────
|
|
124
|
+
|
|
125
|
+
describe('configureCerDevServer — SPA shell handling', () => {
|
|
126
|
+
it('serves the transformed SPA shell for direct HTML navigations in spa mode', async () => {
|
|
127
|
+
const { server, getMiddleware } = makeServer()
|
|
128
|
+
server.transformIndexHtml.mockResolvedValue('<html>spa shell</html>')
|
|
129
|
+
vi.mocked(existsSync).mockReturnValue(true)
|
|
130
|
+
vi.mocked(readFileSync).mockReturnValue('<html>source shell</html>' as never)
|
|
131
|
+
const res = createRes()
|
|
132
|
+
|
|
133
|
+
configureCerDevServer(
|
|
134
|
+
server as any,
|
|
135
|
+
makeConfig({ mode: 'spa' }),
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
const next = vi.fn()
|
|
139
|
+
await getMiddleware()(
|
|
140
|
+
createReq({ url: '/music/effects/pro-co/rat', headers: { accept: 'text/html' } }),
|
|
141
|
+
res,
|
|
142
|
+
next,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
expect(server.transformIndexHtml).toHaveBeenCalled()
|
|
146
|
+
expect(res.statusCode).toBe(200)
|
|
147
|
+
expect(res.setHeader).toHaveBeenCalledWith('Content-Type', 'text/html; charset=utf-8')
|
|
148
|
+
expect(res.end).toHaveBeenCalledWith('<html>spa shell</html>')
|
|
149
|
+
expect(next).not.toHaveBeenCalled()
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
it('does not serve the SPA shell for API requests in spa mode', async () => {
|
|
153
|
+
const { server, getMiddleware } = makeServer()
|
|
154
|
+
configureCerDevServer(
|
|
155
|
+
server as any,
|
|
156
|
+
makeConfig({ mode: 'spa' }),
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
const next = vi.fn()
|
|
160
|
+
await getMiddleware()(
|
|
161
|
+
createReq({ url: '/api/missing', headers: { accept: 'text/html' } }),
|
|
162
|
+
createRes(),
|
|
163
|
+
next,
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
expect(server.transformIndexHtml).not.toHaveBeenCalled()
|
|
167
|
+
expect(next).toHaveBeenCalled()
|
|
168
|
+
})
|
|
169
|
+
})
|
|
170
|
+
|
|
110
171
|
// ─── API route matching ───────────────────────────────────────────────────────
|
|
111
172
|
|
|
112
173
|
describe('configureCerDevServer — API route matching', () => {
|
|
@@ -476,15 +537,23 @@ describe('configureCerDevServer — SSR mode', () => {
|
|
|
476
537
|
if (path.includes('server-api')) return { apiRoutes: [] }
|
|
477
538
|
return { handler: ssrHandler }
|
|
478
539
|
})
|
|
479
|
-
|
|
540
|
+
server.transformIndexHtml.mockResolvedValue('<html>spa shell</html>')
|
|
541
|
+
vi.mocked(existsSync).mockReturnValue(true)
|
|
542
|
+
vi.mocked(readFileSync).mockReturnValue('<html>source shell</html>' as never)
|
|
543
|
+
configureCerDevServer(
|
|
544
|
+
server as any,
|
|
545
|
+
makeConfig({ mode: 'spa' }),
|
|
546
|
+
)
|
|
480
547
|
const next = vi.fn()
|
|
548
|
+
const res = createRes()
|
|
481
549
|
await getMiddleware()(
|
|
482
550
|
createReq({ url: '/', headers: { accept: 'text/html' } }),
|
|
483
|
-
|
|
551
|
+
res,
|
|
484
552
|
next,
|
|
485
553
|
)
|
|
486
554
|
expect(ssrHandler).not.toHaveBeenCalled()
|
|
487
|
-
expect(
|
|
555
|
+
expect(res.end).toHaveBeenCalledWith('<html>spa shell</html>')
|
|
556
|
+
expect(next).not.toHaveBeenCalled()
|
|
488
557
|
})
|
|
489
558
|
|
|
490
559
|
it('does not invoke SSR handler for non-HTML requests (e.g. assets)', async () => {
|
|
@@ -206,12 +206,12 @@ describe('entry-server-template (ENTRY_SERVER_TEMPLATE content)', () => {
|
|
|
206
206
|
expect(src).toContain('res.statusCode = status')
|
|
207
207
|
})
|
|
208
208
|
|
|
209
|
-
it('returns status: null on the happy path
|
|
210
|
-
expect(src).toContain('
|
|
209
|
+
it('returns status: null on the happy path when the route is not marked as not-found', () => {
|
|
210
|
+
expect(src).toContain('isNotFoundRoute ? 404 : null')
|
|
211
211
|
})
|
|
212
212
|
|
|
213
|
-
it('sets status 404 when the matched route is
|
|
214
|
-
expect(src).toContain(
|
|
213
|
+
it('sets status 404 only when the matched route is marked as framework not-found', () => {
|
|
214
|
+
expect(src).toContain('route?.meta?._cerNotFound === true')
|
|
215
215
|
})
|
|
216
216
|
|
|
217
217
|
// ─── Render error handling (P0-1) ────────────────────────────────────────────
|
|
@@ -216,7 +216,8 @@ describe('generateRoutesCode — meta.layout', () => {
|
|
|
216
216
|
`component('page-about', () => html\`<h1>About</h1>\`)` as never,
|
|
217
217
|
)
|
|
218
218
|
const code = await generateRoutesCode(PAGES)
|
|
219
|
-
expect(code).
|
|
219
|
+
expect(code).toContain('path: "/about"')
|
|
220
|
+
expect(code).not.toContain('path: "/about",\n load: () => import("/project/app/pages/about.ts").then(mod => ({ default: "page-about", loader: mod.loader ?? null })),\n meta:')
|
|
220
221
|
})
|
|
221
222
|
|
|
222
223
|
it('emits meta.layout alongside beforeEnter when both layout and middleware are present', async () => {
|
|
@@ -245,6 +246,7 @@ describe('generateRoutesCode — 404.ts convention', () => {
|
|
|
245
246
|
const code = await generateRoutesCode(PAGES)
|
|
246
247
|
expect(code).toContain('path: \"/:all*\"')
|
|
247
248
|
expect(code).toContain('"page-404"')
|
|
249
|
+
expect(code).toContain('_cerNotFound: true')
|
|
248
250
|
})
|
|
249
251
|
|
|
250
252
|
it('sorts 404.ts catch-all after all other routes', async () => {
|
|
@@ -712,6 +714,7 @@ describe('generateRoutesCode — synthetic 404 catch-all (P1-1)', () => {
|
|
|
712
714
|
expect(code).toContain("path: '/:all*'")
|
|
713
715
|
// Synthetic route returns default: null
|
|
714
716
|
expect(code).toContain('default: null')
|
|
717
|
+
expect(code).toContain('meta: { _cerNotFound: true }')
|
|
715
718
|
})
|
|
716
719
|
|
|
717
720
|
it('does NOT add a synthetic catch-all when a user 404.ts already exists', async () => {
|
|
@@ -728,6 +731,7 @@ describe('generateRoutesCode — synthetic 404 catch-all (P1-1)', () => {
|
|
|
728
731
|
// Real catch-all uses double quotes
|
|
729
732
|
expect(code).toContain('"/:all*"')
|
|
730
733
|
expect(code).not.toContain('default: null')
|
|
734
|
+
expect(code).not.toContain('_cerNotFound: true')
|
|
731
735
|
})
|
|
732
736
|
|
|
733
737
|
it('does not add a synthetic catch-all for an empty pages directory (no routes)', async () => {
|
package/src/plugin/build-ssg.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { existsSync } from 'node:fs'
|
|
|
3
3
|
import { join } from 'pathe'
|
|
4
4
|
import { createServer, type UserConfig } from 'vite'
|
|
5
5
|
import type { ResolvedCerConfig } from './dev-server.js'
|
|
6
|
+
import type { ContentItem } from '../types/content.js'
|
|
6
7
|
import { buildSSR } from './build-ssr.js'
|
|
7
8
|
import { buildRouteEntry } from './path-utils.js'
|
|
8
9
|
import fg from 'fast-glob'
|
|
@@ -13,6 +14,8 @@ interface SsgManifest {
|
|
|
13
14
|
errors: Array<{ path: string; error: string }>
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
const CONTENT_STORE_KEY = '__CER_CONTENT_STORE__'
|
|
18
|
+
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
* Collects all static paths to generate.
|
|
@@ -66,27 +69,33 @@ async function collectSsgPaths(
|
|
|
66
69
|
})
|
|
67
70
|
|
|
68
71
|
const staticFiles: string[] = []
|
|
69
|
-
const dynamicFiles: Array<{
|
|
72
|
+
const dynamicFiles: Array<{
|
|
73
|
+
file: string
|
|
74
|
+
entry: ReturnType<typeof buildRouteEntry>
|
|
75
|
+
usesQueryContent: boolean
|
|
76
|
+
}> = []
|
|
70
77
|
|
|
71
78
|
for (const file of files) {
|
|
72
79
|
// Skip routes that declare render: 'server' or render: 'spa' — they are
|
|
73
80
|
// either always-SSR or client-only and must not be pre-rendered.
|
|
81
|
+
let src = ''
|
|
74
82
|
try {
|
|
75
|
-
|
|
83
|
+
src = await readFile(file, 'utf-8')
|
|
76
84
|
const renderMatch = src.match(/render\s*:\s*['"]([^'"]+)['"]/)
|
|
77
85
|
const renderMode = renderMatch ? renderMatch[1] : null
|
|
78
86
|
if (renderMode === 'server' || renderMode === 'spa') continue
|
|
79
87
|
} catch { /* ignore read errors */ }
|
|
80
88
|
|
|
81
89
|
const entry = buildRouteEntry(file, config.pagesDir)
|
|
90
|
+
const usesQueryContent = /\bqueryContent\s*\(/.test(src)
|
|
82
91
|
|
|
83
92
|
if (!entry.isDynamic && !entry.isCatchAll) {
|
|
84
93
|
staticFiles.push(file)
|
|
85
94
|
if (entry.routePath !== '/') {
|
|
86
95
|
paths.push(entry.routePath)
|
|
87
96
|
}
|
|
88
|
-
} else if (entry.isDynamic
|
|
89
|
-
dynamicFiles.push({ file, entry })
|
|
97
|
+
} else if (entry.isDynamic) {
|
|
98
|
+
dynamicFiles.push({ file, entry, usesQueryContent })
|
|
90
99
|
}
|
|
91
100
|
}
|
|
92
101
|
|
|
@@ -101,7 +110,7 @@ async function collectSsgPaths(
|
|
|
101
110
|
})
|
|
102
111
|
|
|
103
112
|
try {
|
|
104
|
-
for (const { file, entry } of dynamicFiles) {
|
|
113
|
+
for (const { file, entry, usesQueryContent } of dynamicFiles) {
|
|
105
114
|
try {
|
|
106
115
|
const pageMod = await viteServer.ssrLoadModule(file)
|
|
107
116
|
const pageMeta = pageMod.meta ?? pageMod.pageMeta
|
|
@@ -112,10 +121,18 @@ async function collectSsgPaths(
|
|
|
112
121
|
for (const ctx of pathsResult) {
|
|
113
122
|
let resolvedPath = entry.routePath
|
|
114
123
|
for (const [key, value] of Object.entries(ctx.params as Record<string, unknown>)) {
|
|
124
|
+
resolvedPath = resolvedPath.replace(`:${key}*`, String(value))
|
|
115
125
|
resolvedPath = resolvedPath.replace(`:${key}`, String(value))
|
|
116
126
|
}
|
|
117
127
|
paths.push(resolvedPath)
|
|
118
128
|
}
|
|
129
|
+
continue
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (entry.isCatchAll && usesQueryContent) {
|
|
133
|
+
const contentStore = (globalThis as Record<string, unknown>)[CONTENT_STORE_KEY] as ContentItem[] | undefined
|
|
134
|
+
const catchAllPaths = _collectCatchAllContentPaths(entry.routePath, contentStore ?? [])
|
|
135
|
+
paths.push(...catchAllPaths)
|
|
119
136
|
}
|
|
120
137
|
} catch {
|
|
121
138
|
console.warn(`[cer-app] Could not enumerate paths for ${file}`)
|
|
@@ -150,6 +167,21 @@ async function collectSsgPaths(
|
|
|
150
167
|
return [...new Set(paths)] // deduplicate
|
|
151
168
|
}
|
|
152
169
|
|
|
170
|
+
function _collectCatchAllContentPaths(routePath: string, store: ContentItem[]): string[] {
|
|
171
|
+
if (store.length === 0) return []
|
|
172
|
+
|
|
173
|
+
const prefix = routePath
|
|
174
|
+
.replace(/:[^/]+\*$/, '')
|
|
175
|
+
.replace(/\/+$/, '') || '/'
|
|
176
|
+
|
|
177
|
+
return store
|
|
178
|
+
.map((item) => item._path)
|
|
179
|
+
.filter((contentPath) => {
|
|
180
|
+
if (prefix === '/') return true
|
|
181
|
+
return contentPath === prefix || contentPath.startsWith(prefix + '/')
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
|
|
153
185
|
// Cache the server module across renderPath calls (loaded once per SSG run)
|
|
154
186
|
let _serverMod: Record<string, unknown> | null = null
|
|
155
187
|
|
package/src/plugin/dev-server.ts
CHANGED
|
@@ -131,6 +131,36 @@ function _matchDevRoute(pattern: string, urlPath: string): boolean {
|
|
|
131
131
|
return new RegExp(regexStr).test(norm(urlPath))
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
function _isHtmlRequest(url: string, acceptHeader: string | string[] | undefined): boolean {
|
|
135
|
+
const accept = Array.isArray(acceptHeader) ? acceptHeader.join(',') : (acceptHeader ?? '')
|
|
136
|
+
if (url.startsWith('/api/') || url.startsWith('/@')) return false
|
|
137
|
+
return (
|
|
138
|
+
accept.includes('text/html') ||
|
|
139
|
+
url === '/' ||
|
|
140
|
+
url === '/index.html' ||
|
|
141
|
+
!url.includes('.')
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async function _serveSpaShell(
|
|
146
|
+
server: ViteDevServer,
|
|
147
|
+
config: ResolvedCerConfig,
|
|
148
|
+
url: string,
|
|
149
|
+
res: ServerResponse,
|
|
150
|
+
): Promise<boolean> {
|
|
151
|
+
const userHtml = resolve(config.root, 'index.html')
|
|
152
|
+
const cerHtml = join(getGeneratedDir(config.root), 'index.html')
|
|
153
|
+
const shellPath = existsSync(userHtml) ? userHtml : cerHtml
|
|
154
|
+
if (!existsSync(shellPath)) return false
|
|
155
|
+
|
|
156
|
+
const rawHtml = readFileSync(shellPath, 'utf-8')
|
|
157
|
+
const transformed = await server.transformIndexHtml(url, rawHtml)
|
|
158
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8')
|
|
159
|
+
res.statusCode = 200
|
|
160
|
+
res.end(transformed)
|
|
161
|
+
return true
|
|
162
|
+
}
|
|
163
|
+
|
|
134
164
|
/**
|
|
135
165
|
* Configures the Vite dev server with:
|
|
136
166
|
* 1. API route handlers from server/api/
|
|
@@ -144,6 +174,7 @@ export function configureCerDevServer(
|
|
|
144
174
|
server.middlewares.use(async (req: IncomingMessage, res: ServerResponse, next: () => void) => {
|
|
145
175
|
const url = req.url ?? '/'
|
|
146
176
|
const method = req.method?.toUpperCase() ?? 'GET'
|
|
177
|
+
const acceptsHtml = _isHtmlRequest(url, req.headers['accept'])
|
|
147
178
|
|
|
148
179
|
// 1. Server middleware from server/middleware/ runs first (CORS, auth, logging, etc.)
|
|
149
180
|
try {
|
|
@@ -240,16 +271,19 @@ export function configureCerDevServer(
|
|
|
240
271
|
// virtual:cer-server-api not yet ready or empty — continue
|
|
241
272
|
}
|
|
242
273
|
|
|
243
|
-
// 3.
|
|
274
|
+
// 3. SPA mode: answer client-routed HTML navigations with the shell directly
|
|
275
|
+
// so Vite's history fallback never emits an intermediate 404 for valid app routes.
|
|
276
|
+
if (config.mode === 'spa' && (method === 'GET' || method === 'HEAD') && acceptsHtml) {
|
|
277
|
+
if (await _serveSpaShell(server, config, url, res)) {
|
|
278
|
+
return
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// 4. SSR/SSG mode: intercept HTML requests and server-render them.
|
|
244
283
|
// Both 'ssr' and 'ssg' modes run loaders on the server so usePageData()
|
|
245
284
|
// returns real data during dev — matching production behaviour.
|
|
246
285
|
// 'spa' mode never runs server loaders, so it falls through to the client bundle.
|
|
247
286
|
if (config.mode === 'ssr' || config.mode === 'ssg') {
|
|
248
|
-
const acceptsHtml =
|
|
249
|
-
(req.headers['accept'] ?? '').includes('text/html') ||
|
|
250
|
-
url === '/' ||
|
|
251
|
-
(!url.includes('.') && !url.startsWith('/api/') && !url.startsWith('/@'))
|
|
252
|
-
|
|
253
287
|
if (acceptsHtml) {
|
|
254
288
|
// Check per-route render mode — skip SSR for 'spa' routes.
|
|
255
289
|
const urlPathOnly = url.split('?')[0]
|
|
@@ -262,15 +296,7 @@ export function configureCerDevServer(
|
|
|
262
296
|
// In SSR/SSG dev mode, a route with render:'spa' should be served as
|
|
263
297
|
// the SPA shell (no server rendering). Serve .cer/index.html so the
|
|
264
298
|
// client bundle boots and handles the route client-side.
|
|
265
|
-
|
|
266
|
-
const _cerHtml = join(getGeneratedDir(config.root), 'index.html')
|
|
267
|
-
const _spaSrcPath = existsSync(_userHtml) ? _userHtml : _cerHtml
|
|
268
|
-
if (existsSync(_spaSrcPath)) {
|
|
269
|
-
const rawHtml = readFileSync(_spaSrcPath, 'utf-8')
|
|
270
|
-
const transformed = await server.transformIndexHtml(url, rawHtml)
|
|
271
|
-
res.setHeader('Content-Type', 'text/html; charset=utf-8')
|
|
272
|
-
res.statusCode = 200
|
|
273
|
-
res.end(transformed)
|
|
299
|
+
if (await _serveSpaShell(server, config, url, res)) {
|
|
274
300
|
return
|
|
275
301
|
}
|
|
276
302
|
next()
|
|
@@ -397,6 +397,7 @@ export async function generateRoutesCode(pagesDir: string, i18n?: I18nRouteConfi
|
|
|
397
397
|
const filePath = JSON.stringify(entry.filePath)
|
|
398
398
|
const tagName = JSON.stringify(entry.tagName)
|
|
399
399
|
const routePath = JSON.stringify(entry.routePath)
|
|
400
|
+
const isNotFoundPage = basename(entry.filePath) === '404.ts'
|
|
400
401
|
|
|
401
402
|
// The load() function dynamically imports the page module which:
|
|
402
403
|
// 1. Runs component() as a side effect, registering the custom element
|
|
@@ -436,6 +437,9 @@ export async function generateRoutesCode(pagesDir: string, i18n?: I18nRouteConfi
|
|
|
436
437
|
if (title !== null) {
|
|
437
438
|
metaFields.push(`title: ${JSON.stringify(title)}`)
|
|
438
439
|
}
|
|
440
|
+
if (isNotFoundPage) {
|
|
441
|
+
metaFields.push(`_cerNotFound: true`)
|
|
442
|
+
}
|
|
439
443
|
// P2-2: Per-route error tag stored in meta for SSR error boundary resolution.
|
|
440
444
|
if (routeErrorTag !== null) {
|
|
441
445
|
metaFields.push(`errorTag: ${JSON.stringify(routeErrorTag)}`)
|
|
@@ -496,7 +500,7 @@ export async function generateRoutesCode(pagesDir: string, i18n?: I18nRouteConfi
|
|
|
496
500
|
// The null default tag causes _prepareRequest to return status 404.
|
|
497
501
|
const allRouteItems = routeItems.flat()
|
|
498
502
|
if (!hasCatchAll) {
|
|
499
|
-
allRouteItems.push(` {\n path: '/:all*',\n load: () => Promise.resolve({ default: null, loader: null }),\n }`)
|
|
503
|
+
allRouteItems.push(` {\n path: '/:all*',\n load: () => Promise.resolve({ default: null, loader: null }),\n meta: { _cerNotFound: true },\n }`)
|
|
500
504
|
}
|
|
501
505
|
|
|
502
506
|
lines.push('const routes = [')
|
|
@@ -315,10 +315,11 @@ const _prepareRequest = async (req) => {
|
|
|
315
315
|
if (tag) vnode = { tag, props: {}, children: [vnode] }
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
|
|
321
|
-
|
|
318
|
+
// Only framework-owned not-found routes should force a 404 status. A user
|
|
319
|
+
// catch-all page ([...all].ts) may successfully resolve real content paths
|
|
320
|
+
// and should stay 200 unless its loader explicitly throws a 404.
|
|
321
|
+
const isNotFoundRoute = route?.meta?._cerNotFound === true
|
|
322
|
+
return { vnode, router, head, status: isNotFoundRoute ? 404 : null, loaderData }
|
|
322
323
|
}
|
|
323
324
|
|
|
324
325
|
export const handler = async (req, res) => {
|