@jasonshimmy/vite-plugin-cer-app 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/commits.txt +1 -1
  3. package/cypress.config.ts +16 -0
  4. package/dist/cli/create/index.js +1 -1
  5. package/dist/cli/create/index.js.map +1 -1
  6. package/dist/plugin/build-ssg.d.ts +7 -0
  7. package/dist/plugin/build-ssg.d.ts.map +1 -1
  8. package/dist/plugin/build-ssg.js +2 -1
  9. package/dist/plugin/build-ssg.js.map +1 -1
  10. package/dist/plugin/build-ssr.d.ts.map +1 -1
  11. package/dist/plugin/build-ssr.js +26 -6
  12. package/dist/plugin/build-ssr.js.map +1 -1
  13. package/dist/runtime/composables/index.d.ts +1 -1
  14. package/dist/runtime/composables/index.d.ts.map +1 -1
  15. package/dist/runtime/composables/index.js +1 -1
  16. package/dist/runtime/composables/index.js.map +1 -1
  17. package/dist/runtime/composables/use-head.d.ts.map +1 -1
  18. package/dist/runtime/composables/use-head.js +12 -8
  19. package/dist/runtime/composables/use-head.js.map +1 -1
  20. package/dist/runtime/entry-server-template.d.ts +1 -1
  21. package/dist/runtime/entry-server-template.d.ts.map +1 -1
  22. package/dist/runtime/entry-server-template.js +14 -4
  23. package/dist/runtime/entry-server-template.js.map +1 -1
  24. package/docs/cli.md +2 -0
  25. package/docs/components.md +57 -0
  26. package/docs/composables.md +9 -2
  27. package/docs/data-loading.md +45 -1
  28. package/docs/getting-started.md +71 -6
  29. package/docs/head-management.md +6 -0
  30. package/docs/plugins.md +25 -0
  31. package/docs/routing.md +48 -6
  32. package/e2e/cypress/e2e/api.cy.ts +81 -0
  33. package/e2e/cypress/e2e/data.cy.ts +111 -0
  34. package/e2e/cypress/e2e/fouc.cy.ts +65 -0
  35. package/e2e/cypress/e2e/head.cy.ts +89 -0
  36. package/e2e/cypress/e2e/interactive.cy.ts +122 -0
  37. package/e2e/cypress/e2e/routes.cy.ts +128 -0
  38. package/e2e/cypress/support/commands.ts +60 -0
  39. package/e2e/cypress/support/e2e.ts +10 -0
  40. package/{src/runtime/app-template.ts → e2e/kitchen-sink/app/app.ts} +43 -49
  41. package/e2e/kitchen-sink/app/components/ks-badge.ts +8 -0
  42. package/e2e/kitchen-sink/app/composables/useKsCounter.ts +9 -0
  43. package/e2e/kitchen-sink/app/error.ts +13 -0
  44. package/e2e/kitchen-sink/app/layouts/default.ts +21 -0
  45. package/e2e/kitchen-sink/app/layouts/minimal.ts +7 -0
  46. package/e2e/kitchen-sink/app/loading.ts +9 -0
  47. package/e2e/kitchen-sink/app/middleware/auth.ts +13 -0
  48. package/e2e/kitchen-sink/app/pages/(auth)/login.ts +13 -0
  49. package/e2e/kitchen-sink/app/pages/(auth)/protected.ts +20 -0
  50. package/e2e/kitchen-sink/app/pages/404.ts +9 -0
  51. package/e2e/kitchen-sink/app/pages/about.ts +17 -0
  52. package/e2e/kitchen-sink/app/pages/blog/[slug].ts +54 -0
  53. package/e2e/kitchen-sink/app/pages/blog/index.ts +46 -0
  54. package/e2e/kitchen-sink/app/pages/counter.ts +17 -0
  55. package/e2e/kitchen-sink/app/pages/head.ts +20 -0
  56. package/e2e/kitchen-sink/app/pages/index.ts +27 -0
  57. package/e2e/kitchen-sink/app/pages/items/[id].ts +20 -0
  58. package/e2e/kitchen-sink/app/plugins/01.setup.ts +7 -0
  59. package/e2e/kitchen-sink/cer-auto-imports.d.ts +50 -0
  60. package/e2e/kitchen-sink/cer-env.d.ts +36 -0
  61. package/e2e/kitchen-sink/cer-tsconfig.json +30 -0
  62. package/e2e/kitchen-sink/cer.config.ts +6 -0
  63. package/e2e/kitchen-sink/index.html +12 -0
  64. package/e2e/kitchen-sink/server/api/health.ts +3 -0
  65. package/e2e/kitchen-sink/server/api/posts/[slug].ts +11 -0
  66. package/e2e/kitchen-sink/server/api/posts/index.ts +5 -0
  67. package/e2e/kitchen-sink/server/data/posts.ts +21 -0
  68. package/e2e/scripts/clean.mjs +8 -0
  69. package/package.json +19 -2
  70. package/src/__tests__/plugin/build-ssg-render.test.ts +110 -0
  71. package/src/__tests__/plugin/build-ssg.test.ts +47 -1
  72. package/src/__tests__/plugin/build-ssr.test.ts +93 -1
  73. package/src/__tests__/plugin/dev-server.test.ts +493 -0
  74. package/src/__tests__/plugin/scanner.test.ts +15 -1
  75. package/src/__tests__/plugin/transforms/auto-import.test.ts +63 -0
  76. package/src/cli/create/index.ts +1 -1
  77. package/src/cli/create/templates/spa/app/app.ts.tpl +23 -3
  78. package/src/cli/create/templates/ssg/app/app.ts.tpl +27 -3
  79. package/src/cli/create/templates/ssg/app/pages/index.ts.tpl +0 -9
  80. package/src/cli/create/templates/ssr/app/app.ts.tpl +27 -3
  81. package/src/plugin/build-ssg.ts +2 -1
  82. package/src/plugin/build-ssr.ts +26 -6
  83. package/src/runtime/composables/index.ts +1 -1
  84. package/src/runtime/composables/use-head.ts +12 -8
  85. package/src/runtime/entry-server-template.ts +14 -4
  86. package/vitest.config.ts +5 -1
  87. package/VITE_PLUGIN_FRAMEWORK_PLAN.md +0 -594
  88. package/dist/runtime/app-template.d.ts +0 -10
  89. package/dist/runtime/app-template.d.ts.map +0 -1
  90. package/dist/runtime/app-template.js +0 -149
  91. package/dist/runtime/app-template.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Changelog
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
+ ## [v0.1.4] - 2026-03-20
5
+
6
+ - fix: fixed many issues across the plugin fix: added e2e tests to ensure functionality works across build types fix:improve documentation (fb24d84)
7
+
8
+ ## [v0.1.3] - 2026-03-19
9
+
10
+ - fix: FOUC in ssr and ssg (e4fb53d)
11
+
4
12
  ## [v0.1.2] - 2026-03-19
5
13
 
6
14
  - fix(build): fix SSR and SSG build modes (23d5363)
package/commits.txt CHANGED
@@ -1 +1 @@
1
- - fix(build): fix SSR and SSG build modes (23d5363)
1
+ - fix: fixed many issues across the plugin fix: added e2e tests to ensure functionality works across build types fix:improve documentation (fb24d84)
@@ -0,0 +1,16 @@
1
+ import { defineConfig } from 'cypress'
2
+
3
+ export default defineConfig({
4
+ e2e: {
5
+ specPattern: 'e2e/cypress/e2e/**/*.cy.ts',
6
+ supportFile: 'e2e/cypress/support/e2e.ts',
7
+ screenshotsFolder: 'e2e/cypress/screenshots',
8
+ videosFolder: 'e2e/cypress/videos',
9
+ // Pierce shadow DOM globally so all cy.get() calls work across shadow roots
10
+ includeShadowDom: true,
11
+ viewportWidth: 1280,
12
+ viewportHeight: 720,
13
+ // Give the server time to start
14
+ pageLoadTimeout: 15000,
15
+ },
16
+ })
@@ -169,7 +169,7 @@ async function generateInlineTemplate(targetDir, projectName, mode) {
169
169
  // cer.config.ts
170
170
  await writeFile(join(targetDir, 'cer.config.ts'), `import { defineConfig } from '@jasonshimmy/vite-plugin-cer-app'\n\nexport default defineConfig({\n mode: '${mode}',\n autoImports: { components: true, composables: true, directives: true, runtime: true },\n})\n`, 'utf-8');
171
171
  // app/app.ts
172
- await writeFile(join(targetDir, 'app/app.ts'), `import '@jasonshimmy/custom-elements-runtime/css'\nimport 'virtual:cer-components'\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 { component, ref, useOnConnected, useOnDisconnected, registerBuiltinComponents } from '@jasonshimmy/custom-elements-runtime'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'\nimport { createDOMJITCSS } from '@jasonshimmy/custom-elements-runtime/dom-jit-css'\n\nregisterBuiltinComponents()\nenableJITCSS()\n\nconst router = initRouter({ routes })\n\nconst isNavigating = ref(false)\nconst currentError = ref(null)\n;(globalThis as any).resetError = () => { currentError.value = null; router.replace(router.getCurrent().path) }\nconst _push = router.push.bind(router)\nconst _replace = router.replace.bind(router)\nrouter.push = async (path) => { isNavigating.value = true; currentError.value = null; try { await _push(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false } }\nrouter.replace = async (path) => { isNavigating.value = true; currentError.value = null; try { await _replace(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false } }\n\ncomponent('cer-layout-view', () => {\n const current = ref(router.getCurrent())\n let unsub: (() => void) | undefined\n useOnConnected(() => { unsub = router.subscribe((s: typeof current.value) => { current.value = s }) })\n useOnDisconnected(() => { unsub?.(); unsub = undefined })\n if (currentError.value !== null) {\n if (hasError && errorTag) return { tag: errorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }\n return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: [String(currentError.value)] }\n }\n if (isNavigating.value && hasLoading && loadingTag) return { tag: loadingTag, props: {}, children: [] }\n const matched = router.matchRoute(current.value.path)\n const layoutName = (matched?.route as any)?.meta?.layout ?? 'default'\n const layoutTag = (layouts as Record<string, string>)[layoutName]\n const routerView = { tag: 'router-view', props: {}, children: [] }\n return layoutTag ? { tag: layoutTag, props: {}, children: [routerView] } : routerView\n})\n\nfor (const plugin of plugins ?? []) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({ router, provide: (key, value) => { (globalThis as any)[key] = value }, config: {} })\n }\n}\n\nif (typeof window !== 'undefined') {\n await router.replace(window.location.pathname + window.location.search + window.location.hash)\n createDOMJITCSS().mount()\n}\n\nexport { router }\n`, 'utf-8');
172
+ await writeFile(join(targetDir, 'app/app.ts'), `import '@jasonshimmy/custom-elements-runtime/css'\nimport 'virtual:cer-components'\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 { component, ref, provide, useOnConnected, useOnDisconnected, registerBuiltinComponents } from '@jasonshimmy/custom-elements-runtime'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'\nimport { createDOMJITCSS } from '@jasonshimmy/custom-elements-runtime/dom-jit-css'\n\nregisterBuiltinComponents()\nenableJITCSS()\n\nconst router = initRouter({ routes })\n\nconst isNavigating = ref(false)\nconst currentError = ref(null)\n;(globalThis as any).resetError = () => { currentError.value = null; router.replace(router.getCurrent().path) }\nconst _push = router.push.bind(router)\nconst _replace = router.replace.bind(router)\nrouter.push = async (path) => { isNavigating.value = true; currentError.value = null; try { await _push(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false } }\nrouter.replace = async (path) => { isNavigating.value = true; currentError.value = null; try { await _replace(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false } }\n\nconst _pluginProvides = new Map()\n;(globalThis as any).__cerPluginProvides = _pluginProvides\n\ncomponent('cer-layout-view', () => {\n for (const [key, value] of _pluginProvides) { provide(key, value) }\n const current = ref(router.getCurrent())\n let unsub: (() => void) | undefined\n useOnConnected(() => { unsub = router.subscribe((s: typeof current.value) => { current.value = s }) })\n useOnDisconnected(() => { unsub?.(); unsub = undefined })\n if (currentError.value !== null) {\n if (hasError && errorTag) return { tag: errorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }\n return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: [String(currentError.value)] }\n }\n if (isNavigating.value && hasLoading && loadingTag) return { tag: loadingTag, props: {}, children: [] }\n const matched = router.matchRoute(current.value.path)\n const layoutName = (matched?.route as any)?.meta?.layout ?? 'default'\n const layoutTag = (layouts as Record<string, string>)[layoutName]\n const routerView = { tag: 'router-view', props: {}, children: [] }\n return layoutTag ? { tag: layoutTag, props: {}, children: [routerView] } : routerView\n})\n\nfor (const plugin of plugins ?? []) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({ router, provide: (key: string, value: unknown) => { _pluginProvides.set(key, value) }, config: {} })\n }\n}\n\nif (typeof window !== 'undefined') {\n const _initMatch = router.matchRoute(window.location.pathname)\n if (_initMatch?.route?.load) {\n try { await _initMatch.route.load() } catch { /* non-fatal */ }\n }\n}\n\nif (typeof window !== 'undefined') {\n await _replace(window.location.pathname + window.location.search + window.location.hash)\n delete (globalThis as any).__CER_DATA__\n createDOMJITCSS().mount()\n}\n\nexport { router }\n`, 'utf-8');
173
173
  // app/pages/index.ts
174
174
  await writeFile(join(targetDir, 'app/pages/index.ts'), `component('page-index', () => {\n return html\`\n <div>\n <h1>Welcome to ${projectName}</h1>\n <p>Edit <code>app/pages/index.ts</code> to get started.</p>\n </div>\n \`\n})\n`, 'utf-8');
175
175
  // app/layouts/default.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/create/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAIrC;;GAEG;AACH,SAAS,MAAM,CAAC,QAAgB,EAAE,YAAqB;IACrD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,EA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CAAA;IAED,aAAa;IACb,MAAM,SAAS,CACb,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAC7B,mKAAmK,WAAW,qJAAqJ,EACnU,OAAO,CACR,CAAA;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,GAAG,CAAC,CAAA;IACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
@@ -1,5 +1,12 @@
1
1
  import { type UserConfig } from 'vite';
2
2
  import type { ResolvedCerConfig } from './dev-server.js';
3
+ /**
4
+ * Writes the rendered HTML to the output directory.
5
+ * path '/' -> dist/index.html
6
+ * path '/about' -> dist/about/index.html
7
+ * @internal exported for unit testing
8
+ */
9
+ export declare function writeRenderedPath(path: string, html: string, distDir: string): Promise<void>;
3
10
  /**
4
11
  * Full SSG build pipeline:
5
12
  * 1. Run the SSR dual-build (client + server bundles)
@@ -1 +1 @@
1
- {"version":3,"file":"build-ssg.d.ts","sourceRoot":"","sources":["../../src/plugin/build-ssg.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAmKxD;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,EACzB,cAAc,GAAE,UAAe,GAC9B,OAAO,CAAC,IAAI,CAAC,CAmEf"}
1
+ {"version":3,"file":"build-ssg.d.ts","sourceRoot":"","sources":["../../src/plugin/build-ssg.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AA4IxD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAYf;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,EACzB,cAAc,GAAE,UAAe,GAC9B,OAAO,CAAC,IAAI,CAAC,CAmEf"}
@@ -118,8 +118,9 @@ async function renderPath(path, serverBundlePath) {
118
118
  * Writes the rendered HTML to the output directory.
119
119
  * path '/' -> dist/index.html
120
120
  * path '/about' -> dist/about/index.html
121
+ * @internal exported for unit testing
121
122
  */
122
- async function writeRenderedPath(path, html, distDir) {
123
+ export async function writeRenderedPath(path, html, distDir) {
123
124
  let outputPath;
124
125
  if (path === '/') {
125
126
  outputPath = join(distDir, 'index.html');
@@ -1 +1 @@
1
- {"version":3,"file":"build-ssg.js","sourceRoot":"","sources":["../../src/plugin/build-ssg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC5B,OAAO,EAAE,YAAY,EAA0B,MAAM,MAAM,CAAA;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,MAAM,WAAW,CAAA;AAS1B;;;;;GAKG;AACH,KAAK,UAAU,eAAe,CAC5B,MAAyB,EACzB,cAA0B;IAE1B,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;IAE5B,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnE,OAAO,SAAS,CAAC,MAAM,CAAA;IACzB,CAAC;IAED,sBAAsB;IACt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;IAEzE,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;IAC5C,OAAO,CAAC,GAAG,CAAC,eAAe,cAAc,CAAC,MAAM,WAAW,CAAC,CAAA;IAC5D,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,MAAM,mBAAmB,YAAY,eAAe,CAAC,CAAA;IAChF,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,eAAe,YAAY,EAAE,CAAC,CAAA;AAC5C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"build-ssr.d.ts","sourceRoot":"","sources":["../../src/plugin/build-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAG7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AA+LxD;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,EACzB,cAAc,GAAE,UAAe,GAC9B,OAAO,CAAC,IAAI,CAAC,CAiEf"}
1
+ {"version":3,"file":"build-ssr.d.ts","sourceRoot":"","sources":["../../src/plugin/build-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAG7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAmNxD;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,EACzB,cAAc,GAAE,UAAe,GAC9B,OAAO,CAAC,IAAI,CAAC,CAiEf"}
@@ -39,6 +39,7 @@ import { registerBuiltinComponents } from '@jasonshimmy/custom-elements-runtime'
39
39
  import { registerEntityMap, renderToStringWithJITCSSDSD, DSD_POLYFILL_SCRIPT } from '@jasonshimmy/custom-elements-runtime/ssr'
40
40
  import entitiesJson from '@jasonshimmy/custom-elements-runtime/entities.json'
41
41
  import { initRouter } from '@jasonshimmy/custom-elements-runtime/router'
42
+ import { beginHeadCollection, endHeadCollection, serializeHeadTags } from '@jasonshimmy/vite-plugin-cer-app/composables'
42
43
 
43
44
  registerBuiltinComponents()
44
45
 
@@ -68,13 +69,16 @@ function _mergeWithClientTemplate(ssrHtml, clientTemplate) {
68
69
  ? ssrHtml.slice(headStart + headTag.length, headEnd).trim() : ''
69
70
  const ssrBody = bodyStart >= 0 && bodyEnd > bodyStart
70
71
  ? ssrHtml.slice(bodyStart + bodyTag.length, bodyEnd).trim() : ssrHtml
71
- // Hoist <style> elements from the SSR body into the document <head> so
72
- // JIT CSS rules are applied before the layout paints.
72
+ // Hoist only top-level <style id=...> elements (cer-ssr-jit, cer-ssr-global)
73
+ // from the SSR body into the document <head>. Plain <style> blocks without
74
+ // an id attribute belong to shadow DOM templates and must stay in place —
75
+ // hoisting them to <head> breaks shadow DOM style encapsulation (document
76
+ // styles do not pierce shadow roots), which is the root cause of FOUC.
73
77
  const headParts = ssrHead ? [ssrHead] : []
74
78
  let ssrBodyContent = ssrBody
75
79
  let pos = 0
76
80
  while (pos < ssrBodyContent.length) {
77
- const styleOpen = ssrBodyContent.indexOf('<style', pos)
81
+ const styleOpen = ssrBodyContent.indexOf('<style id=', pos)
78
82
  if (styleOpen < 0) break
79
83
  const styleClose = ssrBodyContent.indexOf('</style>', styleOpen)
80
84
  if (styleClose < 0) break
@@ -94,7 +98,14 @@ function _mergeWithClientTemplate(ssrHtml, clientTemplate) {
94
98
  '<div id="app">' + ssrBodyContent + '</div>')
95
99
  }
96
100
  const headAdditions = headParts.filter(Boolean).join('\\n')
97
- if (headAdditions) merged = merged.replace('</head>', headAdditions + '\\n</head>')
101
+ if (headAdditions) {
102
+ // If SSR provides a <title>, replace the client template's <title> so the
103
+ // SSR title wins (client template title is the fallback default).
104
+ if (headAdditions.includes('<title>')) {
105
+ merged = merged.replace(/<title>[^<]*<\\/title>/, '')
106
+ }
107
+ merged = merged.replace('</head>', headAdditions + '\\n</head>')
108
+ }
98
109
  return merged
99
110
  }
100
111
 
@@ -156,6 +167,9 @@ export const handler = async (req, res) => {
156
167
  ;(globalThis).__CER_DATA__ = loaderData
157
168
  }
158
169
 
170
+ // Begin collecting useHead() calls made during the synchronous render pass.
171
+ beginHeadCollection()
172
+
159
173
  // dsdPolyfill: false — we inject the polyfill manually after merging so it
160
174
  // lands at the end of <body>, not inside <cer-layout-view> light DOM where
161
175
  // scripts may not execute.
@@ -164,13 +178,19 @@ export const handler = async (req, res) => {
164
178
  router,
165
179
  })
166
180
 
181
+ // Collect and serialize any useHead() calls from the rendered components.
182
+ const headTags = serializeHeadTags(endHeadCollection())
183
+
167
184
  // Clear immediately after the synchronous render so the value never leaks
168
185
  // to the next request on this same server process.
169
186
  delete (globalThis).__CER_DATA__
170
187
 
188
+ // Merge loader data script + useHead() tags into the document head.
189
+ const headContent = [head, headTags].filter(Boolean).join('\\n')
190
+
171
191
  // Wrap the rendered body in a full HTML document and inject the head additions
172
192
  // (loader data script, useHead() tags, JIT styles). No polyfill in body yet.
173
- const ssrHtml = \`<!DOCTYPE html><html><head>\${head ?? ''}</head><body>\${htmlWithStyles}</body></html>\`
193
+ const ssrHtml = \`<!DOCTYPE html><html><head>\${headContent}</head><body>\${htmlWithStyles}</body></html>\`
174
194
 
175
195
  let finalHtml = _clientTemplate
176
196
  ? _mergeWithClientTemplate(ssrHtml, _clientTemplate)
@@ -252,7 +272,7 @@ export async function buildSSR(config, viteUserConfig = {}) {
252
272
  },
253
273
  },
254
274
  ssr: {
255
- noExternal: ['@jasonshimmy/custom-elements-runtime'],
275
+ noExternal: ['@jasonshimmy/custom-elements-runtime', '@jasonshimmy/vite-plugin-cer-app'],
256
276
  },
257
277
  });
258
278
  console.log('[cer-app] SSR build complete.');
@@ -1 +1 @@
1
- {"version":3,"file":"build-ssr.js","sourceRoot":"","sources":["../../src/plugin/build-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAmB,MAAM,MAAM,CAAA;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G,EAAE;YACH,UAAU,EAAE,CAAC,sCAAsC,EAAE,kCAAkC,CAAC;SACzF;KACF,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;IAC5C,OAAO,CAAC,GAAG,CAAC,aAAa,YAAY,EAAE,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,aAAa,YAAY,EAAE,CAAC,CAAA;AAC1C,CAAC"}
@@ -1,4 +1,4 @@
1
- export { useHead } from './use-head.js';
1
+ export { useHead, beginHeadCollection, endHeadCollection, serializeHeadTags } from './use-head.js';
2
2
  export type { HeadInput } from './use-head.js';
3
3
  export { usePageData } from './use-page-data.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClG,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA"}
@@ -1,3 +1,3 @@
1
- export { useHead } from './use-head.js';
1
+ export { useHead, beginHeadCollection, endHeadCollection, serializeHeadTags } from './use-head.js';
2
2
  export { usePageData } from './use-page-data.js';
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAElG,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-head.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/use-head.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACpC,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACpC,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACtC;AAKD;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,SAAS,EAAE,CAI/C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CAuE5D;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAoE9C"}
1
+ {"version":3,"file":"use-head.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/use-head.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACpC,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACpC,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACtC;AAQD;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,SAAS,EAAE,CAI/C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CAuE5D;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAqE9C"}
@@ -1,19 +1,22 @@
1
- // SSR: global collector, reset per-request
2
- let _ssrCollector = null;
1
+ // SSR: store collector on globalThis so all module instances (server entry +
2
+ // dynamically-imported page chunks) share the same reference. A module-level
3
+ // variable would create separate instances per chunk, breaking the singleton.
4
+ const _g = globalThis;
5
+ const _KEY = '__CER_HEAD_COLLECTOR__';
3
6
  /**
4
7
  * Begin collecting head tags for an SSR render pass.
5
8
  * Call this before invoking the render function.
6
9
  */
7
10
  export function beginHeadCollection() {
8
- _ssrCollector = [];
11
+ _g[_KEY] = [];
9
12
  }
10
13
  /**
11
14
  * End collecting head tags and return the collected inputs.
12
15
  * Resets the collector to null.
13
16
  */
14
17
  export function endHeadCollection() {
15
- const collected = _ssrCollector ?? [];
16
- _ssrCollector = null;
18
+ const collected = _g[_KEY] ?? [];
19
+ _g[_KEY] = null;
17
20
  return collected;
18
21
  }
19
22
  /**
@@ -95,9 +98,10 @@ export function serializeHeadTags(heads) {
95
98
  * - On the client: imperatively updates document.title and meta/link tags
96
99
  */
97
100
  export function useHead(input) {
98
- if (_ssrCollector !== null) {
99
- // SSR mode
100
- _ssrCollector.push(input);
101
+ const collector = _g[_KEY];
102
+ if (collector != null) {
103
+ // SSR mode: push to the shared globalThis collector
104
+ collector.push(input);
101
105
  }
102
106
  else if (typeof document !== 'undefined') {
103
107
  // Client-side
@@ -1 +1 @@
1
- {"version":3,"file":"use-head.js","sourceRoot":"","sources":["../../../src/runtime/composables/use-head.ts"],"names":[],"mappings":"AAQA,2CAA2C;AAC3C,IAAI,aAAa,GAAuB,IAAI,CAAA;AAE5C;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,aAAa,GAAG,EAAE,CAAA;AACpB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,SAAS,GAAG,aAAa,IAAI,EAAE,CAAA;IACrC,aAAa,GAAG,IAAI,CAAA;IACpB,OAAO,SAAS,CAAA;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAkB;IAClD,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,+BAA+B;IAC/B,IAAI,KAAyB,CAAA;IAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QACpB,CAAC;IACH,CAAC;IACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,UAAU,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IACnD,CAAC;IAED,wDAAwD;IACxD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkC,CAAA;IACzD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;gBAC7B,MAAM,GAAG,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T,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,WAAW,CAAC,KAA6B;IAChD,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;SACzB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;SAC3D,IAAI,CAAC,GAAG,CAAC,CAAA;AACd,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * wires up the routing, and exports a handler compatible with
6
6
  * Express/Fastify/Node http.
7
7
  */
8
- export declare const ENTRY_SERVER_TEMPLATE = "// Server-side entry \u2014 AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nimport { readFileSync, existsSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { AsyncLocalStorage } from 'node:async_hooks'\nimport 'virtual:cer-components'\nimport routes from 'virtual:cer-routes'\nimport layouts from 'virtual:cer-layouts'\nimport plugins from 'virtual:cer-plugins'\nimport apiRoutes from 'virtual:cer-server-api'\nimport { registerBuiltinComponents } from '@jasonshimmy/custom-elements-runtime'\nimport { registerEntityMap, DSD_POLYFILL_SCRIPT } from '@jasonshimmy/custom-elements-runtime/ssr'\nimport entitiesJson from '@jasonshimmy/custom-elements-runtime/entities.json'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { createSSRHandler } from '@jasonshimmy/custom-elements-runtime/ssr-middleware'\n\nregisterBuiltinComponents()\n\n// Pre-load the full HTML entity map so named entities like &mdash; decode\n// correctly during SSR. Without this the bundled runtime falls back to a\n// minimal set (&lt;, &gt;, &amp; \u2026) and re-escapes everything else.\nregisterEntityMap(entitiesJson)\n\n// Async-local storage for request-scoped SSR loader data.\n// Using AsyncLocalStorage ensures concurrent SSR renders (e.g. SSG with\n// concurrency > 1) never see each other's data \u2014 each request's async chain\n// carries its own store value, so usePageData() is always race-condition-free.\nconst _cerDataStore = new AsyncLocalStorage()\n// Expose the store so the usePageData() composable can read it server-side.\n;(globalThis).__CER_DATA_STORE__ = _cerDataStore\n\n// Load the Vite-built client index.html (dist/client/index.html) so every SSR\n// response includes the client-side scripts needed for hydration and routing.\n// The server bundle lives at dist/server/server.js, so ../client resolves correctly.\nconst _clientTemplatePath = join(dirname(fileURLToPath(import.meta.url)), '../client/index.html')\nconst _clientTemplate = existsSync(_clientTemplatePath)\n ? readFileSync(_clientTemplatePath, 'utf-8')\n : null\n\n// Merge the SSR handler's full HTML document with the Vite client shell so the\n// final page contains both pre-rendered DSD content and the client bundle scripts.\nfunction _mergeWithClientTemplate(ssrHtml, clientTemplate) {\n const headTag = '<head>', headCloseTag = '</head>'\n const bodyTag = '<body>', bodyCloseTag = '</body>'\n const headStart = ssrHtml.indexOf(headTag)\n const headEnd = ssrHtml.indexOf(headCloseTag)\n const bodyStart = ssrHtml.indexOf(bodyTag)\n const bodyEnd = ssrHtml.lastIndexOf(bodyCloseTag)\n const ssrHead = headStart >= 0 && headEnd > headStart\n ? ssrHtml.slice(headStart + headTag.length, headEnd).trim() : ''\n const ssrBody = bodyStart >= 0 && bodyEnd > bodyStart\n ? ssrHtml.slice(bodyStart + bodyTag.length, bodyEnd).trim() : ssrHtml\n // Hoist <style> elements from the SSR body into the document <head> so\n // JIT CSS rules are applied before the layout paints.\n const headParts = ssrHead ? [ssrHead] : []\n let ssrBodyContent = ssrBody\n let pos = 0\n while (pos < ssrBodyContent.length) {\n const styleOpen = ssrBodyContent.indexOf('<style', pos)\n if (styleOpen < 0) break\n const styleClose = ssrBodyContent.indexOf('</style>', styleOpen)\n if (styleClose < 0) break\n headParts.push(ssrBodyContent.slice(styleOpen, styleClose + 8))\n ssrBodyContent = ssrBodyContent.slice(0, styleOpen) + ssrBodyContent.slice(styleClose + 8)\n pos = styleOpen\n }\n ssrBodyContent = ssrBodyContent.trim()\n // Inject the pre-rendered layout+page as light DOM of the app mount element\n // so it is visible before JS boots, then the client router takes over.\n let merged = clientTemplate\n if (merged.includes('<cer-layout-view></cer-layout-view>')) {\n merged = merged.replace('<cer-layout-view></cer-layout-view>',\n '<cer-layout-view>' + ssrBodyContent + '</cer-layout-view>')\n } else if (merged.includes('<div id=\"app\"></div>')) {\n merged = merged.replace('<div id=\"app\"></div>',\n '<div id=\"app\">' + ssrBodyContent + '</div>')\n }\n const headAdditions = headParts.filter(Boolean).join('\\n')\n if (headAdditions) merged = merged.replace('</head>', headAdditions + '\\n</head>')\n return merged\n}\n\n/**\n * Per-request VNode factory \u2014 initializes a fresh router at the request URL,\n * resolves the active layout from the matched route's meta, pre-loads the\n * matched page component (bypassing the async router-view so DSD renders\n * synchronously), calls the route's data loader (if any), and injects the\n * serialized result into the document head as window.__CER_DATA__ for\n * client-side hydration.\n *\n * createStreamingSSRHandler threads the router through each component's SSR\n * context so concurrent renders never share state.\n */\nconst vnodeFactory = async (req) => {\n const router = initRouter({ routes, initialUrl: req.url ?? '/' })\n const current = router.getCurrent()\n const { route, params } = router.matchRoute(current.path)\n const layoutName = route?.meta?.layout ?? 'default'\n const layoutTag = layouts[layoutName]\n\n // Pre-load the page module so we can embed the component tag directly.\n // This avoids the async router-view (which injects content via script tags\n // and breaks Declarative Shadow DOM on initial parse).\n let pageVnode = { tag: 'div', props: {}, children: [] }\n let head\n if (route?.load) {\n try {\n const mod = await route.load()\n const pageTag = mod.default\n if (pageTag) {\n pageVnode = { tag: pageTag, props: { attrs: { ...params } }, children: [] }\n }\n if (typeof mod.loader === 'function') {\n const query = current.query ?? {}\n const data = await mod.loader({ params, query, req })\n if (data !== undefined && data !== null) {\n // Make data available to usePageData() during the SSR render pass.\n // enterWith() scopes the value to the current async context so\n // concurrent renders (SSG concurrency > 1) never share data.\n _cerDataStore.enterWith(data)\n head = `<script>window.__CER_DATA__ = ${JSON.stringify(data)}</script>`\n }\n }\n } catch {\n // Non-fatal: loader errors fall back to an empty page; client will refetch.\n }\n }\n\n const vnode = layoutTag\n ? { tag: layoutTag, props: {}, children: [pageVnode] }\n : pageVnode\n\n return { vnode, router, head }\n}\n\n// Capture the raw SSR handler and wrap it to merge the response with the\n// Vite client template before sending \u2014 this injects the JS/CSS asset bundles\n// so the browser can hydrate and enable client-side routing.\nconst _rawHandler = createSSRHandler(vnodeFactory, {\n render: { dsd: true, dsdPolyfill: false },\n})\n\n/**\n * The main request handler.\n * Compatible with Express, Fastify, and Node's raw http.createServer.\n *\n * Each request is run inside a fresh _cerDataStore.run() context so that\n * concurrent renders (e.g. SSG with concurrency > 1) get isolated stores.\n * vnodeFactory calls _cerDataStore.enterWith(loaderData) from within this\n * context, making the data visible to usePageData() during SSR rendering\n * without any global-state races.\n */\nexport const handler = async (req, res) => {\n if (!_clientTemplate) {\n // No client template \u2014 run handler normally, then inject DSD polyfill.\n let _html = ''\n await _cerDataStore.run(null, async () => {\n await _rawHandler(req, { setHeader: () => {}, end: (body) => { _html = body } })\n })\n // Inject DSD polyfill at end of <body>, outside any custom element light DOM.\n const _final = _html.includes('</body>')\n ? _html.replace('</body>', DSD_POLYFILL_SCRIPT + '</body>')\n : _html + DSD_POLYFILL_SCRIPT\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n return res.end(_final)\n }\n let _capturedHtml = ''\n // Wrap _rawHandler in an isolated async-local-storage context so that\n // vnodeFactory's enterWith() call is scoped to this request only.\n await _cerDataStore.run(null, async () => {\n // Omit write() to force the non-streaming collect-then-end code path.\n await _rawHandler(req, { setHeader: () => {}, end: (body) => { _capturedHtml = body } })\n })\n let _merged = _mergeWithClientTemplate(_capturedHtml, _clientTemplate)\n // Inject DSD polyfill at end of <body>, outside <cer-layout-view> light DOM.\n _merged = _merged.includes('</body>')\n ? _merged.replace('</body>', DSD_POLYFILL_SCRIPT + '</body>')\n : _merged + DSD_POLYFILL_SCRIPT\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.end(_merged)\n}\n\nexport { apiRoutes, plugins, layouts, routes }\nexport default handler\n";
8
+ export declare const ENTRY_SERVER_TEMPLATE = "// Server-side entry \u2014 AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nimport { readFileSync, existsSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { AsyncLocalStorage } from 'node:async_hooks'\nimport 'virtual:cer-components'\nimport routes from 'virtual:cer-routes'\nimport layouts from 'virtual:cer-layouts'\nimport plugins from 'virtual:cer-plugins'\nimport apiRoutes from 'virtual:cer-server-api'\nimport { registerBuiltinComponents } from '@jasonshimmy/custom-elements-runtime'\nimport { registerEntityMap, DSD_POLYFILL_SCRIPT } from '@jasonshimmy/custom-elements-runtime/ssr'\nimport entitiesJson from '@jasonshimmy/custom-elements-runtime/entities.json'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { createSSRHandler } from '@jasonshimmy/custom-elements-runtime/ssr-middleware'\n\nregisterBuiltinComponents()\n\n// Pre-load the full HTML entity map so named entities like &mdash; decode\n// correctly during SSR. Without this the bundled runtime falls back to a\n// minimal set (&lt;, &gt;, &amp; \u2026) and re-escapes everything else.\nregisterEntityMap(entitiesJson)\n\n// Async-local storage for request-scoped SSR loader data.\n// Using AsyncLocalStorage ensures concurrent SSR renders (e.g. SSG with\n// concurrency > 1) never see each other's data \u2014 each request's async chain\n// carries its own store value, so usePageData() is always race-condition-free.\nconst _cerDataStore = new AsyncLocalStorage()\n// Expose the store so the usePageData() composable can read it server-side.\n;(globalThis).__CER_DATA_STORE__ = _cerDataStore\n\n// Load the Vite-built client index.html (dist/client/index.html) so every SSR\n// response includes the client-side scripts needed for hydration and routing.\n// The server bundle lives at dist/server/server.js, so ../client resolves correctly.\nconst _clientTemplatePath = join(dirname(fileURLToPath(import.meta.url)), '../client/index.html')\nconst _clientTemplate = existsSync(_clientTemplatePath)\n ? readFileSync(_clientTemplatePath, 'utf-8')\n : null\n\n// Merge the SSR handler's full HTML document with the Vite client shell so the\n// final page contains both pre-rendered DSD content and the client bundle scripts.\nfunction _mergeWithClientTemplate(ssrHtml, clientTemplate) {\n const headTag = '<head>', headCloseTag = '</head>'\n const bodyTag = '<body>', bodyCloseTag = '</body>'\n const headStart = ssrHtml.indexOf(headTag)\n const headEnd = ssrHtml.indexOf(headCloseTag)\n const bodyStart = ssrHtml.indexOf(bodyTag)\n const bodyEnd = ssrHtml.lastIndexOf(bodyCloseTag)\n const ssrHead = headStart >= 0 && headEnd > headStart\n ? ssrHtml.slice(headStart + headTag.length, headEnd).trim() : ''\n const ssrBody = bodyStart >= 0 && bodyEnd > bodyStart\n ? ssrHtml.slice(bodyStart + bodyTag.length, bodyEnd).trim() : ssrHtml\n // Hoist only top-level <style id=...> elements (cer-ssr-jit, cer-ssr-global)\n // from the SSR body into the document <head>. Plain <style> blocks without\n // an id attribute belong to shadow DOM templates and must stay in place \u2014\n // hoisting them to <head> breaks shadow DOM style encapsulation (document\n // styles do not pierce shadow roots), which is the root cause of FOUC.\n const headParts = ssrHead ? [ssrHead] : []\n let ssrBodyContent = ssrBody\n let pos = 0\n while (pos < ssrBodyContent.length) {\n const styleOpen = ssrBodyContent.indexOf('<style id=', pos)\n if (styleOpen < 0) break\n const styleClose = ssrBodyContent.indexOf('</style>', styleOpen)\n if (styleClose < 0) break\n headParts.push(ssrBodyContent.slice(styleOpen, styleClose + 8))\n ssrBodyContent = ssrBodyContent.slice(0, styleOpen) + ssrBodyContent.slice(styleClose + 8)\n pos = styleOpen\n }\n ssrBodyContent = ssrBodyContent.trim()\n // Inject the pre-rendered layout+page as light DOM of the app mount element\n // so it is visible before JS boots, then the client router takes over.\n let merged = clientTemplate\n if (merged.includes('<cer-layout-view></cer-layout-view>')) {\n merged = merged.replace('<cer-layout-view></cer-layout-view>',\n '<cer-layout-view>' + ssrBodyContent + '</cer-layout-view>')\n } else if (merged.includes('<div id=\"app\"></div>')) {\n merged = merged.replace('<div id=\"app\"></div>',\n '<div id=\"app\">' + ssrBodyContent + '</div>')\n }\n const headAdditions = headParts.filter(Boolean).join('\\n')\n if (headAdditions) {\n // If SSR provides a <title>, replace the client template's <title> so the\n // SSR title wins (client template title is the fallback default).\n if (headAdditions.includes('<title>')) {\n merged = merged.replace(/<title>[^<]*<\\/title>/, '')\n }\n merged = merged.replace('</head>', headAdditions + '\\n</head>')\n }\n return merged\n}\n\n/**\n * Per-request VNode factory \u2014 initializes a fresh router at the request URL,\n * resolves the active layout from the matched route's meta, pre-loads the\n * matched page component (bypassing the async router-view so DSD renders\n * synchronously), calls the route's data loader (if any), and injects the\n * serialized result into the document head as window.__CER_DATA__ for\n * client-side hydration.\n *\n * createStreamingSSRHandler threads the router through each component's SSR\n * context so concurrent renders never share state.\n */\nconst vnodeFactory = async (req) => {\n const router = initRouter({ routes, initialUrl: req.url ?? '/' })\n const current = router.getCurrent()\n const { route, params } = router.matchRoute(current.path)\n const layoutName = route?.meta?.layout ?? 'default'\n const layoutTag = layouts[layoutName]\n\n // Pre-load the page module so we can embed the component tag directly.\n // This avoids the async router-view (which injects content via script tags\n // and breaks Declarative Shadow DOM on initial parse).\n let pageVnode = { tag: 'div', props: {}, children: [] }\n let head\n if (route?.load) {\n try {\n const mod = await route.load()\n const pageTag = mod.default\n if (pageTag) {\n pageVnode = { tag: pageTag, props: { attrs: { ...params } }, children: [] }\n }\n if (typeof mod.loader === 'function') {\n const query = current.query ?? {}\n const data = await mod.loader({ params, query, req })\n if (data !== undefined && data !== null) {\n // Make data available to usePageData() during the SSR render pass.\n // enterWith() scopes the value to the current async context so\n // concurrent renders (SSG concurrency > 1) never share data.\n _cerDataStore.enterWith(data)\n head = `<script>window.__CER_DATA__ = ${JSON.stringify(data)}</script>`\n }\n }\n } catch {\n // Non-fatal: loader errors fall back to an empty page; client will refetch.\n }\n }\n\n const vnode = layoutTag\n ? { tag: layoutTag, props: {}, children: [pageVnode] }\n : pageVnode\n\n return { vnode, router, head }\n}\n\n// Capture the raw SSR handler and wrap it to merge the response with the\n// Vite client template before sending \u2014 this injects the JS/CSS asset bundles\n// so the browser can hydrate and enable client-side routing.\nconst _rawHandler = createSSRHandler(vnodeFactory, {\n render: { dsd: true, dsdPolyfill: false },\n})\n\n/**\n * The main request handler.\n * Compatible with Express, Fastify, and Node's raw http.createServer.\n *\n * Each request is run inside a fresh _cerDataStore.run() context so that\n * concurrent renders (e.g. SSG with concurrency > 1) get isolated stores.\n * vnodeFactory calls _cerDataStore.enterWith(loaderData) from within this\n * context, making the data visible to usePageData() during SSR rendering\n * without any global-state races.\n */\nexport const handler = async (req, res) => {\n if (!_clientTemplate) {\n // No client template \u2014 run handler normally, then inject DSD polyfill.\n let _html = ''\n await _cerDataStore.run(null, async () => {\n await _rawHandler(req, { setHeader: () => {}, end: (body) => { _html = body } })\n })\n // Inject DSD polyfill at end of <body>, outside any custom element light DOM.\n const _final = _html.includes('</body>')\n ? _html.replace('</body>', DSD_POLYFILL_SCRIPT + '</body>')\n : _html + DSD_POLYFILL_SCRIPT\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n return res.end(_final)\n }\n let _capturedHtml = ''\n // Wrap _rawHandler in an isolated async-local-storage context so that\n // vnodeFactory's enterWith() call is scoped to this request only.\n await _cerDataStore.run(null, async () => {\n // Omit write() to force the non-streaming collect-then-end code path.\n await _rawHandler(req, { setHeader: () => {}, end: (body) => { _capturedHtml = body } })\n })\n let _merged = _mergeWithClientTemplate(_capturedHtml, _clientTemplate)\n // Inject DSD polyfill at end of <body>, outside <cer-layout-view> light DOM.\n _merged = _merged.includes('</body>')\n ? _merged.replace('</body>', DSD_POLYFILL_SCRIPT + '</body>')\n : _merged + DSD_POLYFILL_SCRIPT\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.end(_merged)\n}\n\nexport { apiRoutes, plugins, layouts, routes }\nexport default handler\n";
9
9
  //# sourceMappingURL=entry-server-template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry-server-template.d.ts","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,0oRAwLjC,CAAA"}
1
+ {"version":3,"file":"entry-server-template.d.ts","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,2qSAkMjC,CAAA"}
@@ -57,13 +57,16 @@ function _mergeWithClientTemplate(ssrHtml, clientTemplate) {
57
57
  ? ssrHtml.slice(headStart + headTag.length, headEnd).trim() : ''
58
58
  const ssrBody = bodyStart >= 0 && bodyEnd > bodyStart
59
59
  ? ssrHtml.slice(bodyStart + bodyTag.length, bodyEnd).trim() : ssrHtml
60
- // Hoist <style> elements from the SSR body into the document <head> so
61
- // JIT CSS rules are applied before the layout paints.
60
+ // Hoist only top-level <style id=...> elements (cer-ssr-jit, cer-ssr-global)
61
+ // from the SSR body into the document <head>. Plain <style> blocks without
62
+ // an id attribute belong to shadow DOM templates and must stay in place —
63
+ // hoisting them to <head> breaks shadow DOM style encapsulation (document
64
+ // styles do not pierce shadow roots), which is the root cause of FOUC.
62
65
  const headParts = ssrHead ? [ssrHead] : []
63
66
  let ssrBodyContent = ssrBody
64
67
  let pos = 0
65
68
  while (pos < ssrBodyContent.length) {
66
- const styleOpen = ssrBodyContent.indexOf('<style', pos)
69
+ const styleOpen = ssrBodyContent.indexOf('<style id=', pos)
67
70
  if (styleOpen < 0) break
68
71
  const styleClose = ssrBodyContent.indexOf('</style>', styleOpen)
69
72
  if (styleClose < 0) break
@@ -83,7 +86,14 @@ function _mergeWithClientTemplate(ssrHtml, clientTemplate) {
83
86
  '<div id="app">' + ssrBodyContent + '</div>')
84
87
  }
85
88
  const headAdditions = headParts.filter(Boolean).join('\\n')
86
- if (headAdditions) merged = merged.replace('</head>', headAdditions + '\\n</head>')
89
+ if (headAdditions) {
90
+ // If SSR provides a <title>, replace the client template's <title> so the
91
+ // SSR title wins (client template title is the fallback default).
92
+ if (headAdditions.includes('<title>')) {
93
+ merged = merged.replace(/<title>[^<]*<\\/title>/, '')
94
+ }
95
+ merged = merged.replace('</head>', headAdditions + '\\n</head>')
96
+ }
87
97
  return merged
88
98
  }
89
99
 
@@ -1 +1 @@
1
- {"version":3,"file":"entry-server-template.js","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwLpC,CAAA"}
1
+ {"version":3,"file":"entry-server-template.js","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkMpC,CAAA"}
package/docs/cli.md CHANGED
@@ -172,8 +172,10 @@ create-cer-app my-blog --mode ssg --dir ./sites/blog
172
172
  ```
173
173
  my-app/
174
174
  app/
175
+ app.ts ← framework bootstrap (router, plugins, layout shell)
175
176
  pages/index.ts
176
177
  layouts/default.ts
178
+ index.html
177
179
  cer.config.ts
178
180
  package.json
179
181
  ```
@@ -107,6 +107,63 @@ import { component, html, ref } from '@jasonshimmy/custom-elements-runtime'
107
107
 
108
108
  ---
109
109
 
110
+ ## Accessing slot content with `useSlots()`
111
+
112
+ Use `useSlots()` inside a component's render function to read the content passed to named or default slots:
113
+
114
+ ```ts
115
+ // app/components/ui-badge.ts
116
+ component('ui-badge', () => {
117
+ const slots = useSlots()
118
+
119
+ return html`
120
+ <span class="badge">
121
+ ${slots.default ?? 'badge'}
122
+ </span>
123
+ `
124
+ })
125
+ ```
126
+
127
+ Usage in a page:
128
+
129
+ ```ts
130
+ // app/pages/index.ts
131
+ component('page-index', () => {
132
+ return html`
133
+ <ui-badge>v1.0.0</ui-badge>
134
+ <ui-badge>beta</ui-badge>
135
+ `
136
+ })
137
+ ```
138
+
139
+ `slots.default` contains the light-DOM children passed to the component. Named slots are accessed by their slot name:
140
+
141
+ ```ts
142
+ // app/components/app-card.ts
143
+ component('app-card', () => {
144
+ const slots = useSlots()
145
+
146
+ return html`
147
+ <div class="card">
148
+ <header>${slots.header}</header>
149
+ <main>${slots.default}</main>
150
+ <footer>${slots.footer}</footer>
151
+ </div>
152
+ `
153
+ })
154
+ ```
155
+
156
+ ```html
157
+ <!-- usage -->
158
+ <app-card>
159
+ <span slot="header">Title</span>
160
+ Body content goes here
161
+ <span slot="footer">Footer</span>
162
+ </app-card>
163
+ ```
164
+
165
+ ---
166
+
110
167
  ## HMR
111
168
 
112
169
  When a file is added to or removed from `app/components/`, the `virtual:cer-components` module is invalidated and the browser performs a full reload to re-register the updated element list.
@@ -28,10 +28,11 @@ export function useTheme() {
28
28
 
29
29
  ## Using a composable in a page
30
30
 
31
+ When `autoImports.composables` is `true` (the default), composables are **automatically imported** in page, layout, and component files — you don't need to write the import statement at all:
32
+
31
33
  ```ts
32
34
  // app/pages/index.ts
33
- import { useTheme } from 'virtual:cer-composables'
34
-
35
+ // No import needed useTheme is auto-imported from virtual:cer-composables
35
36
  component('page-index', () => {
36
37
  const { isDark, toggle } = useTheme()
37
38
 
@@ -43,6 +44,12 @@ component('page-index', () => {
43
44
  })
44
45
  ```
45
46
 
47
+ If you need to import explicitly (e.g. in a file outside `app/pages/`, `app/layouts/`, or `app/components/`), import from `virtual:cer-composables`:
48
+
49
+ ```ts
50
+ import { useTheme } from 'virtual:cer-composables'
51
+ ```
52
+
46
53
  ---
47
54
 
48
55
  ## Virtual module