@jasonshimmy/vite-plugin-cer-app 0.20.2 → 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 CHANGED
@@ -1,6 +1,10 @@
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
+
4
8
  ## [v0.20.2] - 2026-04-11
5
9
 
6
10
  - fix: correct loader error handling and improve data fetching in SSR/SSG modes (d225a99)
package/commits.txt CHANGED
@@ -1,2 +1 @@
1
- - fix: correct loader error handling and improve data fetching in SSR/SSG modes (d225a99)
2
- - docs: add Content Layer section to README for Markdown/JSON support (376a990)
1
+ - fix: update content layer documentation and enhance plugin generation logic for SSR compatibility (a5bca33)
@@ -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,CAyR9D"}
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"}
@@ -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 variants differ (private
276
- // defaults are only included in the SSR bundle), so use separate cache keys.
277
- const cacheKey = id === RESOLVED_IDS.appConfig ? `${id}:${ssr ? 'ssr' : 'client'}` : id;
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);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAIlD,OAAO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C1B,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;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA2B7E"}
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
- sorted.forEach((file, i) => {
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;AAEl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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,24cAsT9B,CAAA"}
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
- // Clear SSR loader data after initial navigation so subsequent client-side
291
- // navigations don't accidentally reuse stale server data.
292
- delete (globalThis).__CER_DATA__
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsTjC,CAAA"}
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>`. The client entry captures
14
- * this into `globalThis.__CER_DATA__` before the app boots. On first
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 after the first read so subsequent
19
- * client-side navigations don't accidentally reuse stale SSR data.
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC,GAAG,IAAI,CAqBnD"}
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>`. The client entry captures
14
- * this into `globalThis.__CER_DATA__` before the app boots. On first
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 after the first read so subsequent
19
- * client-side navigations don't accidentally reuse stale SSR data.
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;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"}
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/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. Enable the content layer
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
- ### 3. Query content in a page
31
+ ### 2. Query content in a page
43
32
 
44
33
  ```ts
45
34
  // app/pages/blog.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jasonshimmy/vite-plugin-cer-app",
3
- "version": "0.20.2",
3
+ "version": "0.20.3",
4
4
  "description": "Nuxt-style meta-framework for @jasonshimmy/custom-elements-runtime",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -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 clears __CER_DATA__ after navigation', () => {
83
- // delete must appear inside _doHydrate, i.e. after _replace and before the closing }
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
 
@@ -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 variants differ (private
311
- // defaults are only included in the SSR bundle), so use separate cache keys.
312
- const cacheKey = id === RESOLVED_IDS.appConfig ? `${id}:${ssr ? 'ssr' : 'client'}` : id
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
- sorted.forEach((file, i) => {
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
- // Clear SSR loader data after initial navigation so subsequent client-side
291
- // navigations don't accidentally reuse stale server data.
292
- delete (globalThis).__CER_DATA__
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>`. The client entry captures
14
- * this into `globalThis.__CER_DATA__` before the app boots. On first
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 after the first read so subsequent
19
- * client-side navigations don't accidentally reuse stale SSR data.
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
  *