@jasonshimmy/vite-plugin-cer-app 0.20.1 → 0.20.3
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 +9 -0
- package/README.md +1 -0
- package/commits.txt +1 -1
- package/dist/plugin/dev-server.d.ts.map +1 -1
- package/dist/plugin/dev-server.js +5 -2
- package/dist/plugin/dev-server.js.map +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +7 -4
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/virtual/plugins.d.ts +7 -1
- package/dist/plugin/virtual/plugins.d.ts.map +1 -1
- package/dist/plugin/virtual/plugins.js +12 -2
- package/dist/plugin/virtual/plugins.js.map +1 -1
- package/dist/runtime/app-template.d.ts +1 -1
- package/dist/runtime/app-template.d.ts.map +1 -1
- package/dist/runtime/app-template.js +9 -3
- package/dist/runtime/app-template.js.map +1 -1
- package/dist/runtime/composables/use-page-data.d.ts +7 -5
- package/dist/runtime/composables/use-page-data.d.ts.map +1 -1
- package/dist/runtime/composables/use-page-data.js +7 -5
- package/dist/runtime/composables/use-page-data.js.map +1 -1
- package/dist/types/page.d.ts +2 -1
- package/dist/types/page.d.ts.map +1 -1
- package/docs/content.md +2 -13
- package/docs/data-loading.md +47 -20
- package/e2e/cypress/e2e/error-boundary.cy.ts +20 -0
- package/e2e/kitchen-sink/app/pages/loader-response-error-test.ts +13 -0
- package/package.json +2 -2
- package/src/__tests__/plugin/dev-server.test.ts +96 -2
- package/src/__tests__/plugin/entry-server-template.test.ts +7 -0
- package/src/__tests__/plugin/virtual/plugins.test.ts +45 -0
- package/src/__tests__/runtime/app-template.test.ts +11 -2
- package/src/plugin/dev-server.ts +5 -2
- package/src/plugin/index.ts +7 -4
- package/src/plugin/virtual/plugins.ts +12 -2
- package/src/runtime/app-template.ts +9 -3
- package/src/runtime/composables/use-page-data.ts +7 -5
- package/src/types/page.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
|
+
## [v0.20.3] - 2026-04-11
|
|
5
|
+
|
|
6
|
+
- fix: update content layer documentation and enhance plugin generation logic for SSR compatibility (a5bca33)
|
|
7
|
+
|
|
8
|
+
## [v0.20.2] - 2026-04-11
|
|
9
|
+
|
|
10
|
+
- fix: correct loader error handling and improve data fetching in SSR/SSG modes (d225a99)
|
|
11
|
+
- docs: add Content Layer section to README for Markdown/JSON support (376a990)
|
|
12
|
+
|
|
4
13
|
## [v0.20.1] - 2026-04-11
|
|
5
14
|
|
|
6
15
|
- fix(content): add fallback title and description extraction from Markdown body (9bab321)
|
package/README.md
CHANGED
|
@@ -220,6 +220,7 @@ component('page-about', () => {
|
|
|
220
220
|
| [Layouts](docs/layouts.md) | Layout system and `<slot>` composition |
|
|
221
221
|
| [Components](docs/components.md) | Auto-registered custom elements |
|
|
222
222
|
| [Composables](docs/composables.md) | Auto-imported composables |
|
|
223
|
+
| [Content Layer](docs/content.md) | File-based Markdown/JSON content with `queryContent()` and `useContentSearch()` |
|
|
223
224
|
| [Plugins](docs/plugins.md) | App plugin system and DI |
|
|
224
225
|
| [Middleware](docs/middleware.md) | Route guards and server middleware |
|
|
225
226
|
| [Server API Routes](docs/server-api.md) | HTTP handlers in `server/api/` |
|
package/commits.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
- fix
|
|
1
|
+
- fix: update content layer documentation and enhance plugin generation logic for SSR compatibility (a5bca33)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/plugin/dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAKzC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAA;IAC3B,MAAM,EA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AE,OAAO,oBAAoB,EAAE,oBAAoB,CAAA;KAAE,CAAA;IAC9G,IAAI,EAAE,OAAO,oBAAoB,EAAE,UAAU,GAAG,IAAI,CAAA;IACpD,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,QAAQ,GAAG,uBAAuB,GAAG,WAAW,CAAA;KAAE,GAAG,IAAI,CAAA;CACtH;AA0GD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,iBAAiB,GACxB,IAAI,CA8KN"}
|
|
@@ -186,8 +186,11 @@ export function configureCerDevServer(server, config) {
|
|
|
186
186
|
catch {
|
|
187
187
|
// virtual:cer-server-api not yet ready or empty — continue
|
|
188
188
|
}
|
|
189
|
-
// 3. SSR mode: intercept HTML requests
|
|
190
|
-
|
|
189
|
+
// 3. SSR/SSG mode: intercept HTML requests and server-render them.
|
|
190
|
+
// Both 'ssr' and 'ssg' modes run loaders on the server so usePageData()
|
|
191
|
+
// returns real data during dev — matching production behaviour.
|
|
192
|
+
// 'spa' mode never runs server loaders, so it falls through to the client bundle.
|
|
193
|
+
if (config.mode === 'ssr' || config.mode === 'ssg') {
|
|
191
194
|
const acceptsHtml = (req.headers['accept'] ?? '').includes('text/html') ||
|
|
192
195
|
url === '/' ||
|
|
193
196
|
(!url.includes('.') && !url.startsWith('/api/'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.js","sourceRoot":"","sources":["../../src/plugin/dev-server.ts"],"names":[],"mappings":"AAEA,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,M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E,QAAQ,CAC3C,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":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AA+CxD;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,YAAY,EAAE,IAAI,GAAE,MAAsB,GAAG,iBAAiB,CAqDvG;AAyID;;;GAGG;AACH,wBAAgB,MAAM,CAAC,UAAU,GAAE,YAAiB,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AA+CxD;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,YAAY,EAAE,IAAI,GAAE,MAAsB,GAAG,iBAAiB,CAqDvG;AAyID;;;GAGG;AACH,wBAAgB,MAAM,CAAC,UAAU,GAAE,YAAiB,GAAG,MAAM,EAAE,CA4R9D"}
|
package/dist/plugin/index.js
CHANGED
|
@@ -108,7 +108,7 @@ async function generateVirtualModule(id, config, ssr = false) {
|
|
|
108
108
|
case RESOLVED_IDS.composables:
|
|
109
109
|
return generateComposablesCode(config.composablesDir);
|
|
110
110
|
case RESOLVED_IDS.plugins:
|
|
111
|
-
return generatePluginsCode(config.pluginsDir);
|
|
111
|
+
return generatePluginsCode(config.pluginsDir, ssr);
|
|
112
112
|
case RESOLVED_IDS.middleware:
|
|
113
113
|
return generateMiddlewareCode(config.middlewareDir);
|
|
114
114
|
case RESOLVED_IDS.serverApi:
|
|
@@ -272,9 +272,12 @@ export function cerApp(userConfig = {}) {
|
|
|
272
272
|
if (!allResolved.includes(id))
|
|
273
273
|
return null;
|
|
274
274
|
const ssr = options?.ssr ?? false;
|
|
275
|
-
// For virtual:cer-app-config the SSR and client
|
|
276
|
-
//
|
|
277
|
-
|
|
275
|
+
// For virtual:cer-app-config and virtual:cer-plugins the SSR and client
|
|
276
|
+
// variants differ: app-config includes private defaults in SSR; plugins
|
|
277
|
+
// excludes .client.ts files in SSR. Use separate cache keys for both.
|
|
278
|
+
const cacheKey = (id === RESOLVED_IDS.appConfig || id === RESOLVED_IDS.plugins)
|
|
279
|
+
? `${id}:${ssr ? 'ssr' : 'client'}`
|
|
280
|
+
: id;
|
|
278
281
|
// Return from cache if available
|
|
279
282
|
if (moduleCache.has(cacheKey)) {
|
|
280
283
|
return moduleCache.get(cacheKey);
|
package/dist/plugin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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,CAAC,CAAA;QAC5B,CAAC;QACD,SAAS,CAAC,IAAY,EAAE,EAAU;YAChC,OAAQ,iBAAiB,EAAE,SAAgF;gBACzG,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAA;QAClC,CAAC;QACD,eAAe,CAAC,GAAY;YAC1B,CAAC;YAAC,iBAAiB,EAAE,eAAuE;gBAC1F,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QACrB,CAAC;KACF,CAAA;IAED,OAAO;QACL,YAAY;QACZ,GAAG,UAAU;QACb,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,UAAU,CACR,UAAU,CAAC,OAAO,CACnB;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates the virtual:cer-plugins module code.
|
|
3
3
|
* Scans app/plugins/ and produces an ordered array of plugin imports.
|
|
4
|
+
*
|
|
5
|
+
* @param pluginsDir - Absolute path to app/plugins/
|
|
6
|
+
* @param serverSafeOnly - When true, excludes files ending in `.client.ts`.
|
|
7
|
+
* These are client-only plugins (CSS injections, browser component libraries,
|
|
8
|
+
* etc.) that must not be imported in the SSR server entry. Naming convention:
|
|
9
|
+
* `app/plugins/my-plugin.client.ts` → excluded from the server bundle.
|
|
4
10
|
*/
|
|
5
|
-
export declare function generatePluginsCode(pluginsDir: string): Promise<string>;
|
|
11
|
+
export declare function generatePluginsCode(pluginsDir: string, serverSafeOnly?: boolean): Promise<string>;
|
|
6
12
|
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/plugin/virtual/plugins.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/plugin/virtual/plugins.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CA+BrG"}
|
|
@@ -4,8 +4,14 @@ import { sortPluginFiles } from '../path-utils.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* Generates the virtual:cer-plugins module code.
|
|
6
6
|
* Scans app/plugins/ and produces an ordered array of plugin imports.
|
|
7
|
+
*
|
|
8
|
+
* @param pluginsDir - Absolute path to app/plugins/
|
|
9
|
+
* @param serverSafeOnly - When true, excludes files ending in `.client.ts`.
|
|
10
|
+
* These are client-only plugins (CSS injections, browser component libraries,
|
|
11
|
+
* etc.) that must not be imported in the SSR server entry. Naming convention:
|
|
12
|
+
* `app/plugins/my-plugin.client.ts` → excluded from the server bundle.
|
|
7
13
|
*/
|
|
8
|
-
export async function generatePluginsCode(pluginsDir) {
|
|
14
|
+
export async function generatePluginsCode(pluginsDir, serverSafeOnly = false) {
|
|
9
15
|
if (!existsSync(pluginsDir)) {
|
|
10
16
|
return `// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nexport const plugins = []\nexport default plugins\n`;
|
|
11
17
|
}
|
|
@@ -14,9 +20,13 @@ export async function generatePluginsCode(pluginsDir) {
|
|
|
14
20
|
return `// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nexport const plugins = []\nexport default plugins\n`;
|
|
15
21
|
}
|
|
16
22
|
const sorted = sortPluginFiles(files);
|
|
23
|
+
// In server-safe mode, exclude `.client.ts` plugins — they are browser-only
|
|
24
|
+
// (CSS imports, client component libraries, etc.) and must not be loaded
|
|
25
|
+
// server-side. Rename the file to `*.client.ts` to mark it as client-only.
|
|
26
|
+
const filtered = serverSafeOnly ? sorted.filter(f => !f.endsWith('.client.ts')) : sorted;
|
|
17
27
|
const lines = ['// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app', ''];
|
|
18
28
|
const aliases = [];
|
|
19
|
-
|
|
29
|
+
filtered.forEach((file, i) => {
|
|
20
30
|
const alias = `_p${i}`;
|
|
21
31
|
aliases.push(alias);
|
|
22
32
|
lines.push(`import ${alias} from ${JSON.stringify(file)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../src/plugin/virtual/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../src/plugin/virtual/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,UAAkB,EAAE,cAAc,GAAG,KAAK;IAClF,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,OAAO,4GAA4G,CAAA;IACrH,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IAExD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,4GAA4G,CAAA;IACrH,CAAC;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IACrC,4EAA4E;IAC5E,yEAAyE;IACzE,2EAA2E;IAC3E,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;IACxF,MAAM,KAAK,GAAa,CAAC,uDAAuD,EAAE,EAAE,CAAC,CAAA;IAErF,MAAM,OAAO,GAAa,EAAE,CAAA;IAC5B,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,CAAA;QACtB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnB,KAAK,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;IAEF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,2BAA2B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC5D,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;IACpC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEd,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* automatically receive the latest bootstrap code on plugin update.
|
|
6
6
|
* This file is gitignored and should never be edited directly.
|
|
7
7
|
*/
|
|
8
|
-
export declare const APP_ENTRY_TEMPLATE = "// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app \u2014 do not edit.\n// Regenerated automatically on every dev server start and build.\n\nimport '@jasonshimmy/custom-elements-runtime/css'\nimport 'virtual:cer-jit-css'\nimport routes from 'virtual:cer-routes'\nimport layouts from 'virtual:cer-layouts'\nimport plugins from 'virtual:cer-plugins'\nimport { hasLoading, loadingTag } from 'virtual:cer-loading'\nimport { hasError, errorTag } from 'virtual:cer-error'\nimport { runtimeConfig } from 'virtual:cer-app-config'\nimport {\n component,\n ref,\n provide,\n useOnConnected,\n useOnDisconnected,\n registerBuiltinComponents,\n} from '@jasonshimmy/custom-elements-runtime'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'\nimport { initRuntimeConfig } from '@jasonshimmy/vite-plugin-cer-app/composables'\n\nregisterBuiltinComponents()\nenableJITCSS()\ninitRuntimeConfig(runtimeConfig)\n\nconst router = initRouter({ routes })\n\n// Expose the router globally so useRoute() and navigateTo() can access it\n// from any composable without circular imports.\n;(globalThis).__cerRouter = router\n\n// \u2500\u2500\u2500 Page loader state \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n// Holds the pre-loaded page tag and loader-derived attrs for the current route.\n// Set by _loadPageForPath before every navigation so cer-layout-view can render\n// the page element directly with the correct attributes (enabling useProps()).\nlet _currentPageTag = null\nlet _currentPageAttrs = {}\n// The pathname this tag was loaded for \u2014 used to detect router-internal\n// redirects (e.g. middleware returning '/login') so cer-layout-view falls\n// back to <router-view> when the current route differs from what was pre-loaded.\nlet _currentPagePath = null\n\n// Pre-loads the page module for `path`, calls its loader if present, and\n// stores the results so cer-layout-view can pass them as element attributes.\nasync function _loadPageForPath(path) {\n try {\n const url = new URL(path, 'http://x')\n const query = Object.fromEntries(url.searchParams)\n const matched = router.matchRoute(url.pathname)\n const route = matched?.route\n if (!route?.load) {\n _currentPageTag = null\n _currentPageAttrs = {}\n _currentPagePath = url.pathname\n return\n }\n const mod = await route.load()\n _currentPageTag = mod.default ?? null\n _currentPagePath = url.pathname\n const params = matched.params ?? {}\n let loaderAttrs = { ...params }\n if (typeof mod.loader === 'function') {\n try {\n const data = await mod.loader({ params, query })\n if (data !== undefined && data !== null) {\n // Make loader data available via usePageData() for this navigation.\n ;(globalThis).__CER_DATA__ = data\n // Merge primitive values as element attributes so useProps() works.\n const primitives = Object.fromEntries(\n Object.entries(data).filter(([, v]) => v !== null && v !== undefined && typeof v !== 'object' && typeof v !== 'function')\n )\n loaderAttrs = { ...loaderAttrs, ...primitives }\n }\n } catch (err) {\n // Loader errors are surfaced through currentError so the error boundary\n // (app/error.ts) can display a meaningful message \u2014 consistent with how\n // the server-side handler behaves when a loader throws.\n currentError.value = err instanceof Error ? err.message : String(err)\n }\n }\n _currentPageAttrs = loaderAttrs\n } catch {\n _currentPageTag = null\n _currentPageAttrs = {}\n _currentPagePath = null\n }\n}\n\n// \u2500\u2500\u2500 Navigation state \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst isNavigating = ref(false)\nconst currentError = ref(null)\n\nconst resetError = () => {\n currentError.value = null\n void router.replace(router.getCurrent().path)\n}\n;(globalThis).resetError = resetError\n\nconst _push = router.push.bind(router)\nconst _replace = router.replace.bind(router)\n\nrouter.push = async (path) => {\n isNavigating.value = true\n currentError.value = null\n try {\n // Clear stale loader data from the previous route before loading the new one.\n // If the new route has no loader, __CER_DATA__ stays undefined so usePageData()\n // correctly returns null instead of leaking the previous page's data.\n delete (globalThis).__CER_DATA__\n await _loadPageForPath(path)\n await _push(path)\n } catch (err) {\n currentError.value = err instanceof Error ? err.message : String(err)\n } finally {\n isNavigating.value = false\n }\n}\n\nrouter.replace = async (path) => {\n isNavigating.value = true\n currentError.value = null\n try {\n // Clear stale loader data from the previous route before loading the new one.\n delete (globalThis).__CER_DATA__\n await _loadPageForPath(path)\n await _replace(path)\n } catch (err) {\n currentError.value = err instanceof Error ? err.message : String(err)\n } finally {\n isNavigating.value = false\n }\n}\n\n// \u2500\u2500\u2500 Plugins \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n// Collect plugin-provided values so cer-layout-view can forward them into\n// the component context tree via the real provide() hook (which inject() walks).\n// Declared BEFORE component('cer-layout-view') to avoid a temporal dead zone\n// ReferenceError: customElements.define() upgrades existing DOM elements\n// synchronously, calling the render function immediately.\nconst _pluginProvides = new Map()\n// Expose plugin provides globally so page components can read them synchronously\n// regardless of render order.\n;(globalThis).__cerPluginProvides = _pluginProvides\n\n// \u2500\u2500\u2500 <cer-layout-view> \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n// True until the initial page module has loaded and _replace has been called.\n// While true, cer-layout-view renders a <slot> so the SSR/SSG pre-rendered\n// light-DOM content stays visible and no FOUC occurs during the hydration gap.\n// Declared here (before component()) because customElements.define() upgrades\n// existing DOM elements synchronously, so the render function reads this ref\n// on the very first call \u2014 before _doHydrate has a chance to run.\nconst _cerHydrating = ref(true)\n\ncomponent('cer-layout-view', () => {\n // Forward plugin-provided values into the component context so inject() in\n // any descendant component can resolve them by walking up the DOM tree.\n for (const [key, value] of _pluginProvides) {\n provide(key, value)\n }\n\n const current = ref(router.getCurrent())\n let unsub\n\n useOnConnected(() => {\n // Any router navigation (including the initial _replace in _doHydrate) will\n // arrive here. If we are still in the hydration gap when a navigation fires\n // (e.g. a redirect or user interaction before _doHydrate finishes), drop the\n // slot immediately so the live render takes over.\n unsub = router.subscribe((s) => {\n if (_cerHydrating.value) _cerHydrating.value = false\n current.value = s\n })\n })\n useOnDisconnected(() => { unsub?.(); unsub = undefined })\n\n // While the initial page module is being loaded, keep the SSR/SSG\n // pre-rendered light-DOM content visible by forwarding it through a <slot>.\n // This prevents the intermediate blank state that occurs when the shadow DOM\n // renders layout-default with an empty <router-view> before the page chunk\n // has arrived. In SPA mode (no pre-rendered content) the slot is empty, which\n // is no worse than the current router-view behaviour.\n if (_cerHydrating.value) {\n return { tag: 'slot', props: {}, children: [] }\n }\n\n const matched = router.matchRoute(current.value.path)\n const routeMeta = matched?.route?.meta\n\n if (currentError.value !== null) {\n const routeErrorTag = routeMeta?.errorTag ?? null\n const effectiveErrorTag = routeErrorTag ?? (hasError ? errorTag : null)\n if (effectiveErrorTag) {\n return { tag: effectiveErrorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }\n }\n return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: String(currentError.value) }\n }\n\n if (isNavigating.value && hasLoading && loadingTag) {\n return { tag: loadingTag, props: {}, children: [] }\n }\n\n // Render the page component directly when a pre-loaded tag is available AND\n // the loaded path matches the current route. The path guard detects\n // router-internal redirects (e.g. middleware returning '/login'): when the\n // router redirects to a different path, _currentPagePath won't match\n // current.value.path and we fall back to <router-view> so the correct page\n // is rendered without stale pre-loaded state.\n const _useDirectRender = _currentPageTag && _currentPagePath === current.value.path\n const pageVnode = _useDirectRender\n ? { tag: _currentPageTag, props: { attrs: _currentPageAttrs }, children: [] }\n : { tag: 'router-view', props: {}, children: [] }\n\n // Support nested layout chains: meta.layoutChain = ['default', 'admin']\n // renders <layout-default><layout-admin><page/></layout-admin></layout-default>\n const chain = routeMeta?.layoutChain\n ? routeMeta.layoutChain\n : [routeMeta?.layout ?? 'default']\n\n // Build nested vnodes 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 return vnode\n})\n\nfor (const plugin of plugins) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({\n router,\n provide: (key, value) => { _pluginProvides.set(key, value) },\n config: {},\n })\n }\n}\n\n// \u2500\u2500\u2500 Pre-load initial route + hydration strategy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// Download the current page's route chunk AFTER plugins run so that\n// cer-layout-view's first render (which calls provide()) completes before\n// page components are defined and their renders are scheduled. This ensures\n// inject() in child components can find values stored by provide().\n//\n// meta.hydrate controls WHEN the initial page activates:\n// 'load' \u2014 immediately (default)\n// 'idle' \u2014 deferred until requestIdleCallback (browser idle)\n// 'visible' \u2014 deferred until cer-layout-view enters the viewport\n// 'none' \u2014 never: SSR HTML stays as-is, no JS activation\n\nif (typeof window !== 'undefined') {\n const _initMatch = router.matchRoute(window.location.pathname)\n const _hydrateStrategy = _initMatch?.route?.meta?.hydrate ?? 'load'\n\n if (_hydrateStrategy === 'none') {\n // Static HTML only \u2014 leave SSR output untouched, clean up data immediately.\n delete (globalThis).__CER_DATA__\n } else {\n const _doHydrate = async () => {\n const _initPath = window.location.pathname + window.location.search + window.location.hash\n // Pre-load the page module and run the loader so cer-layout-view renders\n // the page tag directly with loader attrs (enables useProps() on hydration).\n await _loadPageForPath(_initPath)\n // Only activate the initial route if the URL hasn't changed while we were\n // loading the module asynchronously (e.g. a test or plugin navigated away\n // before _doHydrate finished). Calling _replace with a stale path would\n // override any navigation that happened during the async gap.\n const _currentPath = window.location.pathname + window.location.search + window.location.hash\n // Drop the hydration slot cover unconditionally: the page module is loaded\n // and cer-layout-view must switch from the <slot> to live rendering whether\n // or not a redirect changed the path during loading.\n _cerHydrating.value = false\n if (_currentPath === _initPath) {\n // Use the original (unwrapped) replace so isNavigating stays false during\n // the initial paint \u2014 the loading component must not flash over pre-rendered content.\n await _replace(_initPath)\n }\n // Clear SSR loader data after initial navigation so subsequent client-side\n // navigations don't accidentally reuse stale server data.\n delete (globalThis).__CER_DATA__\n }\n\n if (_hydrateStrategy === 'idle') {\n // Defer until the browser has finished higher-priority work.\n if (typeof requestIdleCallback !== 'undefined') {\n requestIdleCallback(() => { void _doHydrate() })\n } else {\n // Safari / older environments fallback.\n setTimeout(() => { void _doHydrate() }, 1)\n }\n } else if (_hydrateStrategy === 'visible') {\n // Defer until cer-layout-view (or body as fallback) enters the viewport.\n const _el = document.querySelector('cer-layout-view') ?? document.body\n const _io = new IntersectionObserver(([entry]) => {\n if (entry.isIntersecting) { _io.disconnect(); void _doHydrate() }\n })\n _io.observe(_el)\n } else {\n // 'load' \u2014 hydrate immediately (default behaviour).\n await _doHydrate()\n }\n }\n}\n\nexport { router }\n";
|
|
8
|
+
export declare const APP_ENTRY_TEMPLATE = "// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app \u2014 do not edit.\n// Regenerated automatically on every dev server start and build.\n\nimport '@jasonshimmy/custom-elements-runtime/css'\nimport 'virtual:cer-jit-css'\nimport routes from 'virtual:cer-routes'\nimport layouts from 'virtual:cer-layouts'\nimport plugins from 'virtual:cer-plugins'\nimport { hasLoading, loadingTag } from 'virtual:cer-loading'\nimport { hasError, errorTag } from 'virtual:cer-error'\nimport { runtimeConfig } from 'virtual:cer-app-config'\nimport {\n component,\n ref,\n provide,\n useOnConnected,\n useOnDisconnected,\n registerBuiltinComponents,\n} from '@jasonshimmy/custom-elements-runtime'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'\nimport { initRuntimeConfig } from '@jasonshimmy/vite-plugin-cer-app/composables'\n\nregisterBuiltinComponents()\nenableJITCSS()\ninitRuntimeConfig(runtimeConfig)\n\nconst router = initRouter({ routes })\n\n// Expose the router globally so useRoute() and navigateTo() can access it\n// from any composable without circular imports.\n;(globalThis).__cerRouter = router\n\n// \u2500\u2500\u2500 Page loader state \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n// Holds the pre-loaded page tag and loader-derived attrs for the current route.\n// Set by _loadPageForPath before every navigation so cer-layout-view can render\n// the page element directly with the correct attributes (enabling useProps()).\nlet _currentPageTag = null\nlet _currentPageAttrs = {}\n// The pathname this tag was loaded for \u2014 used to detect router-internal\n// redirects (e.g. middleware returning '/login') so cer-layout-view falls\n// back to <router-view> when the current route differs from what was pre-loaded.\nlet _currentPagePath = null\n\n// Pre-loads the page module for `path`, calls its loader if present, and\n// stores the results so cer-layout-view can pass them as element attributes.\nasync function _loadPageForPath(path) {\n try {\n const url = new URL(path, 'http://x')\n const query = Object.fromEntries(url.searchParams)\n const matched = router.matchRoute(url.pathname)\n const route = matched?.route\n if (!route?.load) {\n _currentPageTag = null\n _currentPageAttrs = {}\n _currentPagePath = url.pathname\n return\n }\n const mod = await route.load()\n _currentPageTag = mod.default ?? null\n _currentPagePath = url.pathname\n const params = matched.params ?? {}\n let loaderAttrs = { ...params }\n if (typeof mod.loader === 'function') {\n try {\n const data = await mod.loader({ params, query })\n if (data !== undefined && data !== null) {\n // Make loader data available via usePageData() for this navigation.\n ;(globalThis).__CER_DATA__ = data\n // Merge primitive values as element attributes so useProps() works.\n const primitives = Object.fromEntries(\n Object.entries(data).filter(([, v]) => v !== null && v !== undefined && typeof v !== 'object' && typeof v !== 'function')\n )\n loaderAttrs = { ...loaderAttrs, ...primitives }\n }\n } catch (err) {\n // Loader errors are surfaced through currentError so the error boundary\n // (app/error.ts) can display a meaningful message \u2014 consistent with how\n // the server-side handler behaves when a loader throws.\n currentError.value = err instanceof Error ? err.message : String(err)\n }\n }\n _currentPageAttrs = loaderAttrs\n } catch {\n _currentPageTag = null\n _currentPageAttrs = {}\n _currentPagePath = null\n }\n}\n\n// \u2500\u2500\u2500 Navigation state \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst isNavigating = ref(false)\nconst currentError = ref(null)\n\nconst resetError = () => {\n currentError.value = null\n void router.replace(router.getCurrent().path)\n}\n;(globalThis).resetError = resetError\n\nconst _push = router.push.bind(router)\nconst _replace = router.replace.bind(router)\n\nrouter.push = async (path) => {\n isNavigating.value = true\n currentError.value = null\n try {\n // Clear stale loader data from the previous route before loading the new one.\n // If the new route has no loader, __CER_DATA__ stays undefined so usePageData()\n // correctly returns null instead of leaking the previous page's data.\n delete (globalThis).__CER_DATA__\n await _loadPageForPath(path)\n await _push(path)\n } catch (err) {\n currentError.value = err instanceof Error ? err.message : String(err)\n } finally {\n isNavigating.value = false\n }\n}\n\nrouter.replace = async (path) => {\n isNavigating.value = true\n currentError.value = null\n try {\n // Clear stale loader data from the previous route before loading the new one.\n delete (globalThis).__CER_DATA__\n await _loadPageForPath(path)\n await _replace(path)\n } catch (err) {\n currentError.value = err instanceof Error ? err.message : String(err)\n } finally {\n isNavigating.value = false\n }\n}\n\n// \u2500\u2500\u2500 Plugins \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n// Collect plugin-provided values so cer-layout-view can forward them into\n// the component context tree via the real provide() hook (which inject() walks).\n// Declared BEFORE component('cer-layout-view') to avoid a temporal dead zone\n// ReferenceError: customElements.define() upgrades existing DOM elements\n// synchronously, calling the render function immediately.\nconst _pluginProvides = new Map()\n// Expose plugin provides globally so page components can read them synchronously\n// regardless of render order.\n;(globalThis).__cerPluginProvides = _pluginProvides\n\n// \u2500\u2500\u2500 <cer-layout-view> \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n// True until the initial page module has loaded and _replace has been called.\n// While true, cer-layout-view renders a <slot> so the SSR/SSG pre-rendered\n// light-DOM content stays visible and no FOUC occurs during the hydration gap.\n// Declared here (before component()) because customElements.define() upgrades\n// existing DOM elements synchronously, so the render function reads this ref\n// on the very first call \u2014 before _doHydrate has a chance to run.\nconst _cerHydrating = ref(true)\n\ncomponent('cer-layout-view', () => {\n // Forward plugin-provided values into the component context so inject() in\n // any descendant component can resolve them by walking up the DOM tree.\n for (const [key, value] of _pluginProvides) {\n provide(key, value)\n }\n\n const current = ref(router.getCurrent())\n let unsub\n\n useOnConnected(() => {\n // Any router navigation (including the initial _replace in _doHydrate) will\n // arrive here. If we are still in the hydration gap when a navigation fires\n // (e.g. a redirect or user interaction before _doHydrate finishes), drop the\n // slot immediately so the live render takes over.\n unsub = router.subscribe((s) => {\n if (_cerHydrating.value) _cerHydrating.value = false\n current.value = s\n })\n })\n useOnDisconnected(() => { unsub?.(); unsub = undefined })\n\n // While the initial page module is being loaded, keep the SSR/SSG\n // pre-rendered light-DOM content visible by forwarding it through a <slot>.\n // This prevents the intermediate blank state that occurs when the shadow DOM\n // renders layout-default with an empty <router-view> before the page chunk\n // has arrived. In SPA mode (no pre-rendered content) the slot is empty, which\n // is no worse than the current router-view behaviour.\n if (_cerHydrating.value) {\n return { tag: 'slot', props: {}, children: [] }\n }\n\n const matched = router.matchRoute(current.value.path)\n const routeMeta = matched?.route?.meta\n\n if (currentError.value !== null) {\n const routeErrorTag = routeMeta?.errorTag ?? null\n const effectiveErrorTag = routeErrorTag ?? (hasError ? errorTag : null)\n if (effectiveErrorTag) {\n return { tag: effectiveErrorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }\n }\n return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: String(currentError.value) }\n }\n\n if (isNavigating.value && hasLoading && loadingTag) {\n return { tag: loadingTag, props: {}, children: [] }\n }\n\n // Render the page component directly when a pre-loaded tag is available AND\n // the loaded path matches the current route. The path guard detects\n // router-internal redirects (e.g. middleware returning '/login'): when the\n // router redirects to a different path, _currentPagePath won't match\n // current.value.path and we fall back to <router-view> so the correct page\n // is rendered without stale pre-loaded state.\n const _useDirectRender = _currentPageTag && _currentPagePath === current.value.path\n const pageVnode = _useDirectRender\n ? { tag: _currentPageTag, props: { attrs: _currentPageAttrs }, children: [] }\n : { tag: 'router-view', props: {}, children: [] }\n\n // Support nested layout chains: meta.layoutChain = ['default', 'admin']\n // renders <layout-default><layout-admin><page/></layout-admin></layout-default>\n const chain = routeMeta?.layoutChain\n ? routeMeta.layoutChain\n : [routeMeta?.layout ?? 'default']\n\n // Build nested vnodes 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 return vnode\n})\n\nfor (const plugin of plugins) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({\n router,\n provide: (key, value) => { _pluginProvides.set(key, value) },\n config: {},\n })\n }\n}\n\n// \u2500\u2500\u2500 Pre-load initial route + hydration strategy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// Download the current page's route chunk AFTER plugins run so that\n// cer-layout-view's first render (which calls provide()) completes before\n// page components are defined and their renders are scheduled. This ensures\n// inject() in child components can find values stored by provide().\n//\n// meta.hydrate controls WHEN the initial page activates:\n// 'load' \u2014 immediately (default)\n// 'idle' \u2014 deferred until requestIdleCallback (browser idle)\n// 'visible' \u2014 deferred until cer-layout-view enters the viewport\n// 'none' \u2014 never: SSR HTML stays as-is, no JS activation\n\nif (typeof window !== 'undefined') {\n const _initMatch = router.matchRoute(window.location.pathname)\n const _hydrateStrategy = _initMatch?.route?.meta?.hydrate ?? 'load'\n\n if (_hydrateStrategy === 'none') {\n // Static HTML only \u2014 leave SSR output untouched, clean up data immediately.\n delete (globalThis).__CER_DATA__\n } else {\n const _doHydrate = async () => {\n const _initPath = window.location.pathname + window.location.search + window.location.hash\n // Pre-load the page module and run the loader so cer-layout-view renders\n // the page tag directly with loader attrs (enables useProps() on hydration).\n await _loadPageForPath(_initPath)\n // Only activate the initial route if the URL hasn't changed while we were\n // loading the module asynchronously (e.g. a test or plugin navigated away\n // before _doHydrate finished). Calling _replace with a stale path would\n // override any navigation that happened during the async gap.\n const _currentPath = window.location.pathname + window.location.search + window.location.hash\n // Drop the hydration slot cover unconditionally: the page module is loaded\n // and cer-layout-view must switch from the <slot> to live rendering whether\n // or not a redirect changed the path during loading.\n _cerHydrating.value = false\n if (_currentPath === _initPath) {\n // Use the original (unwrapped) replace so isNavigating stays false during\n // the initial paint \u2014 the loading component must not flash over pre-rendered content.\n await _replace(_initPath)\n }\n // Defer the data cleanup by one microtask so that cer-layout-view's reactive\n // re-render \u2014 scheduled via queueMicrotask by the reactive system when the\n // router fires its subscribers during _replace \u2014 can still read __CER_DATA__.\n // Clearing synchronously here would remove the data before the queued render\n // runs, causing usePageData() to return null on the initial page load.\n // Subsequent navigations via router.push / router.replace each delete\n // __CER_DATA__ themselves before calling _loadPageForPath, so this deferred\n // cleanup only matters for the very first hydration render.\n queueMicrotask(() => { delete (globalThis).__CER_DATA__ })\n }\n\n if (_hydrateStrategy === 'idle') {\n // Defer until the browser has finished higher-priority work.\n if (typeof requestIdleCallback !== 'undefined') {\n requestIdleCallback(() => { void _doHydrate() })\n } else {\n // Safari / older environments fallback.\n setTimeout(() => { void _doHydrate() }, 1)\n }\n } else if (_hydrateStrategy === 'visible') {\n // Defer until cer-layout-view (or body as fallback) enters the viewport.\n const _el = document.querySelector('cer-layout-view') ?? document.body\n const _io = new IntersectionObserver(([entry]) => {\n if (entry.isIntersecting) { _io.disconnect(); void _doHydrate() }\n })\n _io.observe(_el)\n } else {\n // 'load' \u2014 hydrate immediately (default behaviour).\n await _doHydrate()\n }\n }\n}\n\nexport { router }\n";
|
|
9
9
|
//# sourceMappingURL=app-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-template.d.ts","sourceRoot":"","sources":["../../src/runtime/app-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"app-template.d.ts","sourceRoot":"","sources":["../../src/runtime/app-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,k6dA4T9B,CAAA"}
|
|
@@ -287,9 +287,15 @@ if (typeof window !== 'undefined') {
|
|
|
287
287
|
// the initial paint — the loading component must not flash over pre-rendered content.
|
|
288
288
|
await _replace(_initPath)
|
|
289
289
|
}
|
|
290
|
-
//
|
|
291
|
-
//
|
|
292
|
-
|
|
290
|
+
// Defer the data cleanup by one microtask so that cer-layout-view's reactive
|
|
291
|
+
// re-render — scheduled via queueMicrotask by the reactive system when the
|
|
292
|
+
// router fires its subscribers during _replace — can still read __CER_DATA__.
|
|
293
|
+
// Clearing synchronously here would remove the data before the queued render
|
|
294
|
+
// runs, causing usePageData() to return null on the initial page load.
|
|
295
|
+
// Subsequent navigations via router.push / router.replace each delete
|
|
296
|
+
// __CER_DATA__ themselves before calling _loadPageForPath, so this deferred
|
|
297
|
+
// cleanup only matters for the very first hydration render.
|
|
298
|
+
queueMicrotask(() => { delete (globalThis).__CER_DATA__ })
|
|
293
299
|
}
|
|
294
300
|
|
|
295
301
|
if (_hydrateStrategy === 'idle') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-template.js","sourceRoot":"","sources":["../../src/runtime/app-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG
|
|
1
|
+
{"version":3,"file":"app-template.js","sourceRoot":"","sources":["../../src/runtime/app-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4TjC,CAAA"}
|
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
* component renders with real data in the initial SSR/SSG HTML.
|
|
11
11
|
*
|
|
12
12
|
* 2. **Client hydration** — the server also serializes the data as
|
|
13
|
-
* `window.__CER_DATA__` in the page `<head>`.
|
|
14
|
-
*
|
|
15
|
-
* component instantiation `usePageData()` returns that value so the client
|
|
13
|
+
* `window.__CER_DATA__` in the page `<head>`. On first component
|
|
14
|
+
* instantiation `usePageData()` returns that value so the client
|
|
16
15
|
* starts with the correct state without an extra network round-trip.
|
|
17
16
|
*
|
|
18
|
-
* The client-side value is cleared
|
|
19
|
-
*
|
|
17
|
+
* The client-side value is cleared via `queueMicrotask` in `_doHydrate`
|
|
18
|
+
* (app-template) after the initial router navigation completes — deferred by
|
|
19
|
+
* one microtask so the queued reactive re-render can still read the data
|
|
20
|
+
* before it is removed. Subsequent navigations via `router.push` / `router.replace`
|
|
21
|
+
* each clear `__CER_DATA__` synchronously before loading the next page's data.
|
|
20
22
|
*
|
|
21
23
|
* @returns The serialized loader result, or `null` if no SSR data is present.
|
|
22
24
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-page-data.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/use-page-data.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"use-page-data.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/use-page-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC,GAAG,IAAI,CAqBnD"}
|
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
* component renders with real data in the initial SSR/SSG HTML.
|
|
11
11
|
*
|
|
12
12
|
* 2. **Client hydration** — the server also serializes the data as
|
|
13
|
-
* `window.__CER_DATA__` in the page `<head>`.
|
|
14
|
-
*
|
|
15
|
-
* component instantiation `usePageData()` returns that value so the client
|
|
13
|
+
* `window.__CER_DATA__` in the page `<head>`. On first component
|
|
14
|
+
* instantiation `usePageData()` returns that value so the client
|
|
16
15
|
* starts with the correct state without an extra network round-trip.
|
|
17
16
|
*
|
|
18
|
-
* The client-side value is cleared
|
|
19
|
-
*
|
|
17
|
+
* The client-side value is cleared via `queueMicrotask` in `_doHydrate`
|
|
18
|
+
* (app-template) after the initial router navigation completes — deferred by
|
|
19
|
+
* one microtask so the queued reactive re-render can still read the data
|
|
20
|
+
* before it is removed. Subsequent navigations via `router.push` / `router.replace`
|
|
21
|
+
* each clear `__CER_DATA__` synchronously before loading the next page's data.
|
|
20
22
|
*
|
|
21
23
|
* @returns The serialized loader result, or `null` if no SSR data is present.
|
|
22
24
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-page-data.js","sourceRoot":"","sources":["../../../src/runtime/composables/use-page-data.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"use-page-data.js","sourceRoot":"","sources":["../../../src/runtime/composables/use-page-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,CAAC,GAAG,UAAqC,CAAA;IAE/C,oEAAoE;IACpE,6EAA6E;IAC7E,sEAAsE;IACtE,MAAM,KAAK,GAAG,CAAC,CAAC,oBAAoB,CAAwC,CAAA;IAC5E,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,EAA0B,CAAA;QACxD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO,OAAO,CAAA;IAC/D,CAAC;IAED,2EAA2E;IAC3E,uEAAuE;IACvE,yEAAyE;IACzE,uEAAuE;IACvE,qEAAqE;IACrE,sEAAsE;IACtE,MAAM,IAAI,GAAG,CAAC,CAAC,cAAc,CAAkB,CAAA;IAC/C,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IACpD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/types/page.d.ts
CHANGED
|
@@ -83,7 +83,8 @@ export interface PageMeta {
|
|
|
83
83
|
export interface PageLoaderContext<P extends Record<string, string> = Record<string, string>> {
|
|
84
84
|
params: P;
|
|
85
85
|
query: Record<string, string>;
|
|
86
|
-
|
|
86
|
+
/** Present during SSR/SSG server render. Absent (`undefined`) during client-side navigation. */
|
|
87
|
+
req?: IncomingMessage;
|
|
87
88
|
}
|
|
88
89
|
/**
|
|
89
90
|
* Server-side data loader for a page. Export as `export const loader` (or `export async function loader`)
|
package/dist/types/page.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/types/page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEhD;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;AAElE,qHAAqH;AACrH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;AAED,6GAA6G;AAC7G,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC,GAAG,eAAe,EAAE,CAAA;IAC5D;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW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M,CAAA;IACf,wFAAwF;IACxF,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,OAAO,CAAC,EAAE,eAAe,CAAA;IACzB,GAAG,CAAC,EAAE,aAAa,CAAA;IACnB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC7B;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAA;CACrC;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAC1F,MAAM,EAAE,CAAC,CAAA;IACT,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,gGAAgG;IAChG,GAAG,CAAC,EAAE,eAAe,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,UAAU,CACpB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzD,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACzB,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA"}
|
package/docs/content.md
CHANGED
|
@@ -17,18 +17,7 @@ CER Content is a file-based content layer built into `vite-plugin-cer-app`. It p
|
|
|
17
17
|
|
|
18
18
|
## Quick start
|
|
19
19
|
|
|
20
|
-
### 1.
|
|
21
|
-
|
|
22
|
-
```ts
|
|
23
|
-
// cer.config.ts
|
|
24
|
-
import { defineConfig } from '@jasonshimmy/vite-plugin-cer-app'
|
|
25
|
-
|
|
26
|
-
export default defineConfig({
|
|
27
|
-
content: {},
|
|
28
|
-
})
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### 2. Add content files
|
|
20
|
+
### 1. Add content files
|
|
32
21
|
|
|
33
22
|
```
|
|
34
23
|
content/
|
|
@@ -39,7 +28,7 @@ content/
|
|
|
39
28
|
getting-started.md
|
|
40
29
|
```
|
|
41
30
|
|
|
42
|
-
###
|
|
31
|
+
### 2. Query content in a page
|
|
43
32
|
|
|
44
33
|
```ts
|
|
45
34
|
// app/pages/blog.ts
|
package/docs/data-loading.md
CHANGED
|
@@ -11,12 +11,12 @@ Each page can export a `loader` function that runs on the server before the page
|
|
|
11
11
|
import type { PageLoader } from '@jasonshimmy/vite-plugin-cer-app/types'
|
|
12
12
|
|
|
13
13
|
component('page-blog-slug', () => {
|
|
14
|
-
const
|
|
14
|
+
const data = usePageData<{ title: string; body: string }>()
|
|
15
15
|
|
|
16
16
|
return html`
|
|
17
17
|
<article>
|
|
18
|
-
<h1>${
|
|
19
|
-
<div>${
|
|
18
|
+
<h1>${data?.title ?? ''}</h1>
|
|
19
|
+
<div>${data?.body ?? ''}</div>
|
|
20
20
|
</article>
|
|
21
21
|
`
|
|
22
22
|
})
|
|
@@ -27,7 +27,7 @@ export const loader: PageLoader = async ({ params }) => {
|
|
|
27
27
|
}
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
The object returned by `loader` is
|
|
30
|
+
The object returned by `loader` is made available via `usePageData()` in the page component. Primitive values (strings, numbers, booleans) are also forwarded as HTML element attributes so `useProps()` can read them.
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
|
@@ -36,13 +36,13 @@ The object returned by `loader` is serialized and passed as props to the page co
|
|
|
36
36
|
```ts
|
|
37
37
|
type PageLoader<
|
|
38
38
|
Params extends Record<string, string> = Record<string, string>,
|
|
39
|
-
Data
|
|
40
|
-
> = (ctx: PageLoaderContext<Params>) => Promise<Data>
|
|
39
|
+
Data = Record<string, unknown>,
|
|
40
|
+
> = (ctx: PageLoaderContext<Params>) => Promise<Data> | Data
|
|
41
41
|
|
|
42
42
|
interface PageLoaderContext<P extends Record<string, string>> {
|
|
43
43
|
params: P // URL path parameters
|
|
44
44
|
query: Record<string, string> // Parsed query string
|
|
45
|
-
req
|
|
45
|
+
req?: IncomingMessage // Raw Node.js request (present during SSR/SSG server render; absent during client-side navigation)
|
|
46
46
|
}
|
|
47
47
|
```
|
|
48
48
|
|
|
@@ -66,7 +66,7 @@ interface PageLoaderContext<P extends Record<string, string>> {
|
|
|
66
66
|
|
|
67
67
|
1. Browser receives the full HTML — content is immediately visible via Declarative Shadow DOM before any JS runs
|
|
68
68
|
2. Client JS boots; `usePageData()` reads `window.__CER_DATA__` and returns the hydrated values
|
|
69
|
-
3. After the initial `router.replace()` in `.cer/app.ts` completes, `.cer/app.ts`
|
|
69
|
+
3. After the initial `router.replace()` in `.cer/app.ts` completes, `.cer/app.ts` clears the loader data from `globalThis` so subsequent client-side navigations trigger a fresh fetch instead of reusing stale server data
|
|
70
70
|
4. Components that received SSR data skip their `useOnConnected` fetch — no duplicate request
|
|
71
71
|
|
|
72
72
|
---
|
|
@@ -106,18 +106,22 @@ export const loader = async ({ params }: { params: { id: string } }) => {
|
|
|
106
106
|
|
|
107
107
|
## Accessing loader data in components
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
Use `usePageData()` to read loader data — it receives everything the loader returned (primitives and complex objects alike) and works in all modes: SSR, SSG, and client-side navigation.
|
|
110
110
|
|
|
111
111
|
```ts
|
|
112
112
|
component('page-user', () => {
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
113
|
+
const ssrData = usePageData<{ user: { id: string; name: string; email: string } }>()
|
|
114
|
+
const user = ref(ssrData?.user ?? { id: '', name: '', email: '' })
|
|
115
|
+
|
|
116
|
+
useOnConnected(async () => {
|
|
117
|
+
if (ssrData) return // already hydrated
|
|
118
|
+
const { data } = await useFetch(`/api/users/${user.value.id}`)
|
|
119
|
+
if (data) user.value = data
|
|
116
120
|
})
|
|
117
121
|
|
|
118
122
|
return html`
|
|
119
|
-
<h1>Hello, ${
|
|
120
|
-
<p>${
|
|
123
|
+
<h1>Hello, ${user.value.name}</h1>
|
|
124
|
+
<p>${user.value.email}</p>
|
|
121
125
|
`
|
|
122
126
|
})
|
|
123
127
|
|
|
@@ -127,6 +131,27 @@ export const loader: PageLoader<{ id: string }> = async ({ params }) => {
|
|
|
127
131
|
}
|
|
128
132
|
```
|
|
129
133
|
|
|
134
|
+
`useProps()` is an alternative for **primitive values only** (strings, numbers, booleans). It reads element HTML attributes rather than the loader payload directly, which means it also picks up attributes passed by parent components in the component tree — but it cannot receive arrays or objects.
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
component('page-profile', () => {
|
|
138
|
+
// Works for primitives only — use usePageData() if you need objects or arrays
|
|
139
|
+
const props = useProps<{ username: string; bio: string }>({ username: '', bio: '' })
|
|
140
|
+
|
|
141
|
+
return html`
|
|
142
|
+
<h1>${props.username}</h1>
|
|
143
|
+
<p>${props.bio}</p>
|
|
144
|
+
`
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
export const loader = async ({ params }: { params: { id: string } }) => {
|
|
148
|
+
const { data: user } = await useFetch(`/api/users/${params.id}`)
|
|
149
|
+
return { username: user?.name, bio: user?.bio } // primitives only
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
> **Rule of thumb:** reach for `usePageData()` first. Only prefer `useProps()` when you specifically need the element attribute binding model — for example, when the same component is also used as a child that receives attributes from a parent.
|
|
154
|
+
|
|
130
155
|
---
|
|
131
156
|
|
|
132
157
|
## SSG and loaders
|
|
@@ -153,6 +178,14 @@ export const loader: PageLoader<{ slug: string }> = async ({ params }) => {
|
|
|
153
178
|
|
|
154
179
|
---
|
|
155
180
|
|
|
181
|
+
## Dev server behavior
|
|
182
|
+
|
|
183
|
+
In `mode: 'ssr'` and `mode: 'ssg'`, the dev server runs the server entry module and calls your `loader` on every HTML request — matching production behaviour. Both `usePageData()` and `useProps()` receive real loader data during development.
|
|
184
|
+
|
|
185
|
+
In `mode: 'spa'`, no loaders run in the dev server. `usePageData()` always returns `null` and `useProps()` returns its defaults. Use `useOnConnected` to fetch data client-side in SPA mode.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
156
189
|
## Error handling in loaders
|
|
157
190
|
|
|
158
191
|
When a `loader` throws, the SSR error boundary intercepts it:
|
|
@@ -173,12 +206,6 @@ export const loader: PageLoader<{ id: string }> = async ({ params }) => {
|
|
|
173
206
|
}
|
|
174
207
|
```
|
|
175
208
|
|
|
176
|
-
You can also throw a standard `Response` — the framework reads its `.status` property:
|
|
177
|
-
|
|
178
|
-
```ts
|
|
179
|
-
throw new Response('Not Found', { status: 404 })
|
|
180
|
-
```
|
|
181
|
-
|
|
182
209
|
Unhandled errors without a `status` property default to HTTP 500.
|
|
183
210
|
|
|
184
211
|
---
|
|
@@ -65,4 +65,24 @@ if (mode === 'ssr') {
|
|
|
65
65
|
cy.get('[data-cy=error-retry]').should('exist')
|
|
66
66
|
})
|
|
67
67
|
})
|
|
68
|
+
|
|
69
|
+
describe('SSR error boundary — loader throws a Response object', () => {
|
|
70
|
+
it('reads the numeric .status from the thrown Response (405)', () => {
|
|
71
|
+
cy.request({ url: '/loader-response-error-test', failOnStatusCode: false }).then((response) => {
|
|
72
|
+
expect(response.status).to.eq(405)
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('renders page-error element in the server response for a thrown Response', () => {
|
|
77
|
+
cy.request({ url: '/loader-response-error-test', failOnStatusCode: false }).then((response) => {
|
|
78
|
+
expect(response.body).to.include('page-error')
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('does not render the normal page heading when a Response is thrown', () => {
|
|
83
|
+
cy.request({ url: '/loader-response-error-test', failOnStatusCode: false }).then((response) => {
|
|
84
|
+
expect(response.body).not.to.include('loader-response-error-heading')
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
})
|
|
68
88
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
component('page-loader-response-error-test', () => {
|
|
2
|
+
return html`
|
|
3
|
+
<div>
|
|
4
|
+
<h1 data-cy="loader-response-error-heading">Response Error Test</h1>
|
|
5
|
+
</div>
|
|
6
|
+
`
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
export async function loader() {
|
|
10
|
+
// Verify that throwing a Response-like object (which has a numeric .status property)
|
|
11
|
+
// causes the framework to use that status code for the HTTP response.
|
|
12
|
+
throw new Response('Method Not Allowed', { status: 405 })
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jasonshimmy/vite-plugin-cer-app",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.3",
|
|
4
4
|
"description": "Nuxt-style meta-framework for @jasonshimmy/custom-elements-runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"eslint": "^10.2.0",
|
|
103
103
|
"happy-dom": "^20.8.9",
|
|
104
104
|
"jiti": "^2.6.1",
|
|
105
|
-
"start-server-and-test": "^3.0.
|
|
105
|
+
"start-server-and-test": "^3.0.2",
|
|
106
106
|
"typescript": "^5.9.3",
|
|
107
107
|
"typescript-eslint": "^8.58.1",
|
|
108
108
|
"vite": "^8.0.8",
|
|
@@ -450,6 +450,43 @@ describe('configureCerDevServer — SSR mode', () => {
|
|
|
450
450
|
expect(ssrHandler).toHaveBeenCalled()
|
|
451
451
|
})
|
|
452
452
|
|
|
453
|
+
it('invokes SSR handler for HTML requests in ssg mode', async () => {
|
|
454
|
+
const ssrHandler = vi.fn(async (req: any, res: any) => res.end('<html>SSG-DEV</html>'))
|
|
455
|
+
const { server, getMiddleware } = makeServer()
|
|
456
|
+
server.ssrLoadModule.mockImplementation(async (path: string) => {
|
|
457
|
+
if (path.includes('server-middleware')) return { serverMiddleware: [] }
|
|
458
|
+
if (path.includes('server-api')) return { apiRoutes: [] }
|
|
459
|
+
return { handler: ssrHandler }
|
|
460
|
+
})
|
|
461
|
+
configureCerDevServer(server as any, makeConfig({ mode: 'ssg' }))
|
|
462
|
+
const res = createRes()
|
|
463
|
+
await getMiddleware()(
|
|
464
|
+
createReq({ url: '/', headers: { accept: 'text/html' } }),
|
|
465
|
+
res,
|
|
466
|
+
vi.fn(),
|
|
467
|
+
)
|
|
468
|
+
expect(ssrHandler).toHaveBeenCalled()
|
|
469
|
+
})
|
|
470
|
+
|
|
471
|
+
it('does not invoke SSR handler in spa mode', async () => {
|
|
472
|
+
const ssrHandler = vi.fn()
|
|
473
|
+
const { server, getMiddleware } = makeServer()
|
|
474
|
+
server.ssrLoadModule.mockImplementation(async (path: string) => {
|
|
475
|
+
if (path.includes('server-middleware')) return { serverMiddleware: [] }
|
|
476
|
+
if (path.includes('server-api')) return { apiRoutes: [] }
|
|
477
|
+
return { handler: ssrHandler }
|
|
478
|
+
})
|
|
479
|
+
configureCerDevServer(server as any, makeConfig({ mode: 'spa' }))
|
|
480
|
+
const next = vi.fn()
|
|
481
|
+
await getMiddleware()(
|
|
482
|
+
createReq({ url: '/', headers: { accept: 'text/html' } }),
|
|
483
|
+
createRes(),
|
|
484
|
+
next,
|
|
485
|
+
)
|
|
486
|
+
expect(ssrHandler).not.toHaveBeenCalled()
|
|
487
|
+
expect(next).toHaveBeenCalled()
|
|
488
|
+
})
|
|
489
|
+
|
|
453
490
|
it('does not invoke SSR handler for non-HTML requests (e.g. assets)', async () => {
|
|
454
491
|
const ssrHandler = vi.fn()
|
|
455
492
|
const { server, getMiddleware } = makeServer()
|
|
@@ -469,6 +506,25 @@ describe('configureCerDevServer — SSR mode', () => {
|
|
|
469
506
|
expect(next).toHaveBeenCalled()
|
|
470
507
|
})
|
|
471
508
|
|
|
509
|
+
it('does not invoke SSR handler for non-HTML requests in ssg mode', async () => {
|
|
510
|
+
const ssrHandler = vi.fn()
|
|
511
|
+
const { server, getMiddleware } = makeServer()
|
|
512
|
+
server.ssrLoadModule.mockImplementation(async (path: string) => {
|
|
513
|
+
if (path.includes('server-middleware')) return { serverMiddleware: [] }
|
|
514
|
+
if (path.includes('server-api')) return { apiRoutes: [] }
|
|
515
|
+
return { handler: ssrHandler }
|
|
516
|
+
})
|
|
517
|
+
configureCerDevServer(server as any, makeConfig({ mode: 'ssg' }))
|
|
518
|
+
const next = vi.fn()
|
|
519
|
+
await getMiddleware()(
|
|
520
|
+
createReq({ url: '/assets/main.js', headers: { accept: 'application/javascript' } }),
|
|
521
|
+
createRes(),
|
|
522
|
+
next,
|
|
523
|
+
)
|
|
524
|
+
expect(ssrHandler).not.toHaveBeenCalled()
|
|
525
|
+
expect(next).toHaveBeenCalled()
|
|
526
|
+
})
|
|
527
|
+
|
|
472
528
|
it('returns 500 and error text when SSR handler throws', async () => {
|
|
473
529
|
const { server, getMiddleware } = makeServer()
|
|
474
530
|
server.ssrLoadModule.mockImplementation(async (path: string) => {
|
|
@@ -531,13 +587,14 @@ describe('configureCerDevServer — SSR mode', () => {
|
|
|
531
587
|
})
|
|
532
588
|
})
|
|
533
589
|
|
|
534
|
-
// ─── Per-route render mode (SSR mode)
|
|
590
|
+
// ─── Per-route render mode (SSR/SSG mode) ────────────────────────────────────
|
|
535
591
|
|
|
536
592
|
describe("configureCerDevServer — per-route render mode in SSR", () => {
|
|
537
593
|
/** Build a server where virtual:cer-routes returns the given routes array. */
|
|
538
594
|
function makeServerWithRoutes(
|
|
539
595
|
pageRoutes: Array<{ path: string; meta?: Record<string, unknown> }>,
|
|
540
596
|
ssrHandler = vi.fn(async (_req: any, res: any) => res.end('<html>SSR</html>')),
|
|
597
|
+
mode: 'ssr' | 'ssg' = 'ssr',
|
|
541
598
|
) {
|
|
542
599
|
const { server, getMiddleware } = makeServer()
|
|
543
600
|
server.ssrLoadModule.mockImplementation(async (path: string) => {
|
|
@@ -546,7 +603,7 @@ describe("configureCerDevServer — per-route render mode in SSR", () => {
|
|
|
546
603
|
if (path.includes('cer-routes')) return { default: pageRoutes }
|
|
547
604
|
return { handler: ssrHandler }
|
|
548
605
|
})
|
|
549
|
-
configureCerDevServer(server as any, makeConfig({ mode
|
|
606
|
+
configureCerDevServer(server as any, makeConfig({ mode }))
|
|
550
607
|
return { middleware: getMiddleware(), ssrHandler }
|
|
551
608
|
}
|
|
552
609
|
|
|
@@ -564,6 +621,22 @@ describe("configureCerDevServer — per-route render mode in SSR", () => {
|
|
|
564
621
|
expect(ssrHandler).not.toHaveBeenCalled()
|
|
565
622
|
})
|
|
566
623
|
|
|
624
|
+
it("calls next() instead of SSR for a route with render: 'spa' in ssg mode", async () => {
|
|
625
|
+
const { middleware, ssrHandler } = makeServerWithRoutes(
|
|
626
|
+
[{ path: '/spa-page', meta: { render: 'spa' } }],
|
|
627
|
+
vi.fn(async (_req: any, res: any) => res.end('<html>SSG</html>')),
|
|
628
|
+
'ssg',
|
|
629
|
+
)
|
|
630
|
+
const next = vi.fn()
|
|
631
|
+
await middleware(
|
|
632
|
+
createReq({ url: '/spa-page', headers: { accept: 'text/html' } }),
|
|
633
|
+
createRes(),
|
|
634
|
+
next,
|
|
635
|
+
)
|
|
636
|
+
expect(next).toHaveBeenCalled()
|
|
637
|
+
expect(ssrHandler).not.toHaveBeenCalled()
|
|
638
|
+
})
|
|
639
|
+
|
|
567
640
|
it("proceeds to SSR for a route with render: 'server'", async () => {
|
|
568
641
|
const { middleware, ssrHandler } = makeServerWithRoutes([
|
|
569
642
|
{ path: '/server-page', meta: { render: 'server' } },
|
|
@@ -620,6 +693,27 @@ describe("configureCerDevServer — per-route render mode in SSR", () => {
|
|
|
620
693
|
)
|
|
621
694
|
expect(routesCalls).toHaveLength(0)
|
|
622
695
|
})
|
|
696
|
+
|
|
697
|
+
it("loads routes module in ssg mode to check per-route render mode", async () => {
|
|
698
|
+
const ssrHandler = vi.fn(async (_req: any, res: any) => res.end('<html>SSG</html>'))
|
|
699
|
+
const { server, getMiddleware } = makeServer()
|
|
700
|
+
server.ssrLoadModule.mockImplementation(async (path: string) => {
|
|
701
|
+
if (path.includes('server-middleware')) return { serverMiddleware: [] }
|
|
702
|
+
if (path.includes('server-api') || path.includes('cer-server-api')) return { apiRoutes: [] }
|
|
703
|
+
if (path.includes('cer-routes')) return { default: [] }
|
|
704
|
+
return { handler: ssrHandler }
|
|
705
|
+
})
|
|
706
|
+
configureCerDevServer(server as any, makeConfig({ mode: 'ssg' }))
|
|
707
|
+
await getMiddleware()(
|
|
708
|
+
createReq({ url: '/about', headers: { accept: 'text/html' } }),
|
|
709
|
+
createRes(),
|
|
710
|
+
vi.fn(),
|
|
711
|
+
)
|
|
712
|
+
const routesCalls = (server.ssrLoadModule as any).mock.calls.filter(
|
|
713
|
+
([p]: [string]) => p.includes('cer-routes'),
|
|
714
|
+
)
|
|
715
|
+
expect(routesCalls.length).toBeGreaterThan(0)
|
|
716
|
+
})
|
|
623
717
|
})
|
|
624
718
|
|
|
625
719
|
// ─── parseBody edge cases ─────────────────────────────────────────────────────
|
|
@@ -173,6 +173,13 @@ describe('entry-server-template (ENTRY_SERVER_TEMPLATE content)', () => {
|
|
|
173
173
|
expect(src).toContain('err.status')
|
|
174
174
|
})
|
|
175
175
|
|
|
176
|
+
it('guards err.status with typeof === "number" so Response-like thrown values work', () => {
|
|
177
|
+
// `new Response("...", { status: 404 })` has a numeric `.status` property.
|
|
178
|
+
// The typeof guard ensures that non-numeric status values (e.g. a string "404")
|
|
179
|
+
// do not pass through — only genuine numbers are accepted.
|
|
180
|
+
expect(src).toContain("typeof err.status === 'number'")
|
|
181
|
+
})
|
|
182
|
+
|
|
176
183
|
it('defaults to status 500 when thrown error has no .status', () => {
|
|
177
184
|
expect(src).toContain(': 500')
|
|
178
185
|
})
|
|
@@ -81,4 +81,49 @@ describe('generatePluginsCode', () => {
|
|
|
81
81
|
expect(code).toContain('export const plugins')
|
|
82
82
|
expect(code).toContain('export default plugins')
|
|
83
83
|
})
|
|
84
|
+
|
|
85
|
+
// ─── .client.ts convention ────────────────────────────────────────────────
|
|
86
|
+
|
|
87
|
+
it('includes .client.ts plugins by default (client-side)', async () => {
|
|
88
|
+
vi.mocked(scanDirectory).mockResolvedValue([
|
|
89
|
+
`${PLUGINS}/auth.ts`,
|
|
90
|
+
`${PLUGINS}/cer-material.client.ts`,
|
|
91
|
+
])
|
|
92
|
+
const code = await generatePluginsCode(PLUGINS)
|
|
93
|
+
expect(code).toContain('cer-material.client.ts')
|
|
94
|
+
expect(code).toContain('auth.ts')
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
it('excludes .client.ts plugins when serverSafeOnly is true', async () => {
|
|
98
|
+
vi.mocked(scanDirectory).mockResolvedValue([
|
|
99
|
+
`${PLUGINS}/auth.ts`,
|
|
100
|
+
`${PLUGINS}/cer-material.client.ts`,
|
|
101
|
+
])
|
|
102
|
+
const code = await generatePluginsCode(PLUGINS, true)
|
|
103
|
+
expect(code).not.toContain('cer-material.client.ts')
|
|
104
|
+
expect(code).toContain('auth.ts')
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it('returns empty plugins array when all plugins are .client.ts and serverSafeOnly is true', async () => {
|
|
108
|
+
vi.mocked(scanDirectory).mockResolvedValue([
|
|
109
|
+
`${PLUGINS}/cer-material.client.ts`,
|
|
110
|
+
])
|
|
111
|
+
const code = await generatePluginsCode(PLUGINS, true)
|
|
112
|
+
expect(code).toContain('export const plugins = []')
|
|
113
|
+
expect(code).not.toContain('cer-material.client.ts')
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
it('preserves non-.client.ts plugins in server-safe mode', async () => {
|
|
117
|
+
vi.mocked(scanDirectory).mockResolvedValue([
|
|
118
|
+
`${PLUGINS}/01.analytics.ts`,
|
|
119
|
+
`${PLUGINS}/02.fonts.client.ts`,
|
|
120
|
+
`${PLUGINS}/03.auth.ts`,
|
|
121
|
+
])
|
|
122
|
+
const code = await generatePluginsCode(PLUGINS, true)
|
|
123
|
+
expect(code).toContain('01.analytics.ts')
|
|
124
|
+
expect(code).toContain('03.auth.ts')
|
|
125
|
+
expect(code).not.toContain('02.fonts.client.ts')
|
|
126
|
+
// Two plugins remain: _p0 and _p1
|
|
127
|
+
expect(code).toContain('export const plugins = [_p0, _p1]')
|
|
128
|
+
})
|
|
84
129
|
})
|
|
@@ -79,12 +79,21 @@ describe('APP_ENTRY_TEMPLATE — meta.hydrate', () => {
|
|
|
79
79
|
expect(APP_ENTRY_TEMPLATE).toContain('__cerRouter')
|
|
80
80
|
})
|
|
81
81
|
|
|
82
|
-
it('_doHydrate
|
|
83
|
-
// delete must
|
|
82
|
+
it('_doHydrate defers __CER_DATA__ deletion via queueMicrotask after navigation', () => {
|
|
83
|
+
// The delete must happen inside a queueMicrotask callback so that
|
|
84
|
+
// cer-layout-view's reactive re-render (queued by the router subscription)
|
|
85
|
+
// runs BEFORE the data is cleared. A synchronous delete would remove the
|
|
86
|
+
// data before the scheduled render can read it, causing usePageData() to
|
|
87
|
+
// always return null on initial SSR/SSG page load.
|
|
84
88
|
const doHydrateStart = APP_ENTRY_TEMPLATE.indexOf('const _doHydrate')
|
|
85
89
|
const doHydrateEnd = APP_ENTRY_TEMPLATE.indexOf('\n }', doHydrateStart)
|
|
86
90
|
const doHydrateBlock = APP_ENTRY_TEMPLATE.slice(doHydrateStart, doHydrateEnd)
|
|
91
|
+
expect(doHydrateBlock).toContain('queueMicrotask')
|
|
87
92
|
expect(doHydrateBlock).toContain('delete (globalThis).__CER_DATA__')
|
|
93
|
+
// The delete must be INSIDE a queueMicrotask callback, not inline
|
|
94
|
+
const microtaskIdx = doHydrateBlock.indexOf('queueMicrotask')
|
|
95
|
+
const deleteIdx = doHydrateBlock.indexOf('delete (globalThis).__CER_DATA__')
|
|
96
|
+
expect(deleteIdx).toBeGreaterThan(microtaskIdx)
|
|
88
97
|
})
|
|
89
98
|
})
|
|
90
99
|
|
package/src/plugin/dev-server.ts
CHANGED
|
@@ -238,8 +238,11 @@ export function configureCerDevServer(
|
|
|
238
238
|
// virtual:cer-server-api not yet ready or empty — continue
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
// 3. SSR mode: intercept HTML requests
|
|
242
|
-
|
|
241
|
+
// 3. SSR/SSG mode: intercept HTML requests and server-render them.
|
|
242
|
+
// Both 'ssr' and 'ssg' modes run loaders on the server so usePageData()
|
|
243
|
+
// returns real data during dev — matching production behaviour.
|
|
244
|
+
// 'spa' mode never runs server loaders, so it falls through to the client bundle.
|
|
245
|
+
if (config.mode === 'ssr' || config.mode === 'ssg') {
|
|
243
246
|
const acceptsHtml =
|
|
244
247
|
(req.headers['accept'] ?? '').includes('text/html') ||
|
|
245
248
|
url === '/' ||
|
package/src/plugin/index.ts
CHANGED
|
@@ -123,7 +123,7 @@ async function generateVirtualModule(
|
|
|
123
123
|
case RESOLVED_IDS.composables:
|
|
124
124
|
return generateComposablesCode(config.composablesDir)
|
|
125
125
|
case RESOLVED_IDS.plugins:
|
|
126
|
-
return generatePluginsCode(config.pluginsDir)
|
|
126
|
+
return generatePluginsCode(config.pluginsDir, ssr)
|
|
127
127
|
case RESOLVED_IDS.middleware:
|
|
128
128
|
return generateMiddlewareCode(config.middlewareDir)
|
|
129
129
|
case RESOLVED_IDS.serverApi:
|
|
@@ -307,9 +307,12 @@ export function cerApp(userConfig: CerAppConfig = {}): Plugin[] {
|
|
|
307
307
|
if (!allResolved.includes(id)) return null
|
|
308
308
|
|
|
309
309
|
const ssr = options?.ssr ?? false
|
|
310
|
-
// For virtual:cer-app-config the SSR and client
|
|
311
|
-
//
|
|
312
|
-
|
|
310
|
+
// For virtual:cer-app-config and virtual:cer-plugins the SSR and client
|
|
311
|
+
// variants differ: app-config includes private defaults in SSR; plugins
|
|
312
|
+
// excludes .client.ts files in SSR. Use separate cache keys for both.
|
|
313
|
+
const cacheKey = (id === RESOLVED_IDS.appConfig || id === RESOLVED_IDS.plugins)
|
|
314
|
+
? `${id}:${ssr ? 'ssr' : 'client'}`
|
|
315
|
+
: id
|
|
313
316
|
|
|
314
317
|
// Return from cache if available
|
|
315
318
|
if (moduleCache.has(cacheKey)) {
|
|
@@ -5,8 +5,14 @@ import { sortPluginFiles } from '../path-utils.js'
|
|
|
5
5
|
/**
|
|
6
6
|
* Generates the virtual:cer-plugins module code.
|
|
7
7
|
* Scans app/plugins/ and produces an ordered array of plugin imports.
|
|
8
|
+
*
|
|
9
|
+
* @param pluginsDir - Absolute path to app/plugins/
|
|
10
|
+
* @param serverSafeOnly - When true, excludes files ending in `.client.ts`.
|
|
11
|
+
* These are client-only plugins (CSS injections, browser component libraries,
|
|
12
|
+
* etc.) that must not be imported in the SSR server entry. Naming convention:
|
|
13
|
+
* `app/plugins/my-plugin.client.ts` → excluded from the server bundle.
|
|
8
14
|
*/
|
|
9
|
-
export async function generatePluginsCode(pluginsDir: string): Promise<string> {
|
|
15
|
+
export async function generatePluginsCode(pluginsDir: string, serverSafeOnly = false): Promise<string> {
|
|
10
16
|
if (!existsSync(pluginsDir)) {
|
|
11
17
|
return `// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nexport const plugins = []\nexport default plugins\n`
|
|
12
18
|
}
|
|
@@ -18,10 +24,14 @@ export async function generatePluginsCode(pluginsDir: string): Promise<string> {
|
|
|
18
24
|
}
|
|
19
25
|
|
|
20
26
|
const sorted = sortPluginFiles(files)
|
|
27
|
+
// In server-safe mode, exclude `.client.ts` plugins — they are browser-only
|
|
28
|
+
// (CSS imports, client component libraries, etc.) and must not be loaded
|
|
29
|
+
// server-side. Rename the file to `*.client.ts` to mark it as client-only.
|
|
30
|
+
const filtered = serverSafeOnly ? sorted.filter(f => !f.endsWith('.client.ts')) : sorted
|
|
21
31
|
const lines: string[] = ['// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app', '']
|
|
22
32
|
|
|
23
33
|
const aliases: string[] = []
|
|
24
|
-
|
|
34
|
+
filtered.forEach((file, i) => {
|
|
25
35
|
const alias = `_p${i}`
|
|
26
36
|
aliases.push(alias)
|
|
27
37
|
lines.push(`import ${alias} from ${JSON.stringify(file)}`)
|
|
@@ -287,9 +287,15 @@ if (typeof window !== 'undefined') {
|
|
|
287
287
|
// the initial paint — the loading component must not flash over pre-rendered content.
|
|
288
288
|
await _replace(_initPath)
|
|
289
289
|
}
|
|
290
|
-
//
|
|
291
|
-
//
|
|
292
|
-
|
|
290
|
+
// Defer the data cleanup by one microtask so that cer-layout-view's reactive
|
|
291
|
+
// re-render — scheduled via queueMicrotask by the reactive system when the
|
|
292
|
+
// router fires its subscribers during _replace — can still read __CER_DATA__.
|
|
293
|
+
// Clearing synchronously here would remove the data before the queued render
|
|
294
|
+
// runs, causing usePageData() to return null on the initial page load.
|
|
295
|
+
// Subsequent navigations via router.push / router.replace each delete
|
|
296
|
+
// __CER_DATA__ themselves before calling _loadPageForPath, so this deferred
|
|
297
|
+
// cleanup only matters for the very first hydration render.
|
|
298
|
+
queueMicrotask(() => { delete (globalThis).__CER_DATA__ })
|
|
293
299
|
}
|
|
294
300
|
|
|
295
301
|
if (_hydrateStrategy === 'idle') {
|
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
* component renders with real data in the initial SSR/SSG HTML.
|
|
11
11
|
*
|
|
12
12
|
* 2. **Client hydration** — the server also serializes the data as
|
|
13
|
-
* `window.__CER_DATA__` in the page `<head>`.
|
|
14
|
-
*
|
|
15
|
-
* component instantiation `usePageData()` returns that value so the client
|
|
13
|
+
* `window.__CER_DATA__` in the page `<head>`. On first component
|
|
14
|
+
* instantiation `usePageData()` returns that value so the client
|
|
16
15
|
* starts with the correct state without an extra network round-trip.
|
|
17
16
|
*
|
|
18
|
-
* The client-side value is cleared
|
|
19
|
-
*
|
|
17
|
+
* The client-side value is cleared via `queueMicrotask` in `_doHydrate`
|
|
18
|
+
* (app-template) after the initial router navigation completes — deferred by
|
|
19
|
+
* one microtask so the queued reactive re-render can still read the data
|
|
20
|
+
* before it is removed. Subsequent navigations via `router.push` / `router.replace`
|
|
21
|
+
* each clear `__CER_DATA__` synchronously before loading the next page's data.
|
|
20
22
|
*
|
|
21
23
|
* @returns The serialized loader result, or `null` if no SSR data is present.
|
|
22
24
|
*
|
package/src/types/page.ts
CHANGED
|
@@ -88,7 +88,8 @@ export interface PageMeta {
|
|
|
88
88
|
export interface PageLoaderContext<P extends Record<string, string> = Record<string, string>> {
|
|
89
89
|
params: P
|
|
90
90
|
query: Record<string, string>
|
|
91
|
-
|
|
91
|
+
/** Present during SSR/SSG server render. Absent (`undefined`) during client-side navigation. */
|
|
92
|
+
req?: IncomingMessage
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
/**
|