@jasonshimmy/vite-plugin-cer-app 0.4.6 → 0.5.0

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 (81) hide show
  1. package/.github/copilot-instructions.md +4 -2
  2. package/CHANGELOG.md +4 -0
  3. package/IMPLEMENTATION_PLAN.md +52 -10
  4. package/commits.txt +1 -1
  5. package/dist/cli/commands/preview-isr.d.ts +51 -0
  6. package/dist/cli/commands/preview-isr.d.ts.map +1 -0
  7. package/dist/cli/commands/preview-isr.js +104 -0
  8. package/dist/cli/commands/preview-isr.js.map +1 -0
  9. package/dist/cli/commands/preview.d.ts.map +1 -1
  10. package/dist/cli/commands/preview.js +65 -1
  11. package/dist/cli/commands/preview.js.map +1 -1
  12. package/dist/plugin/dev-server.d.ts +3 -0
  13. package/dist/plugin/dev-server.d.ts.map +1 -1
  14. package/dist/plugin/dev-server.js.map +1 -1
  15. package/dist/plugin/dts-generator.d.ts.map +1 -1
  16. package/dist/plugin/dts-generator.js +8 -1
  17. package/dist/plugin/dts-generator.js.map +1 -1
  18. package/dist/plugin/index.d.ts.map +1 -1
  19. package/dist/plugin/index.js +9 -1
  20. package/dist/plugin/index.js.map +1 -1
  21. package/dist/plugin/transforms/auto-import.js +2 -2
  22. package/dist/plugin/transforms/auto-import.js.map +1 -1
  23. package/dist/plugin/virtual/routes.d.ts.map +1 -1
  24. package/dist/plugin/virtual/routes.js +95 -8
  25. package/dist/plugin/virtual/routes.js.map +1 -1
  26. package/dist/runtime/app-template.d.ts +1 -1
  27. package/dist/runtime/app-template.d.ts.map +1 -1
  28. package/dist/runtime/app-template.js +16 -4
  29. package/dist/runtime/app-template.js.map +1 -1
  30. package/dist/runtime/composables/index.d.ts +1 -0
  31. package/dist/runtime/composables/index.d.ts.map +1 -1
  32. package/dist/runtime/composables/index.js +1 -0
  33. package/dist/runtime/composables/index.js.map +1 -1
  34. package/dist/runtime/composables/use-runtime-config.d.ts +32 -0
  35. package/dist/runtime/composables/use-runtime-config.d.ts.map +1 -0
  36. package/dist/runtime/composables/use-runtime-config.js +41 -0
  37. package/dist/runtime/composables/use-runtime-config.js.map +1 -0
  38. package/dist/runtime/entry-server-template.d.ts +1 -1
  39. package/dist/runtime/entry-server-template.d.ts.map +1 -1
  40. package/dist/runtime/entry-server-template.js +14 -6
  41. package/dist/runtime/entry-server-template.js.map +1 -1
  42. package/dist/types/config.d.ts +24 -0
  43. package/dist/types/config.d.ts.map +1 -1
  44. package/dist/types/config.js.map +1 -1
  45. package/dist/types/index.d.ts +1 -1
  46. package/dist/types/index.d.ts.map +1 -1
  47. package/dist/types/page.d.ts +17 -0
  48. package/dist/types/page.d.ts.map +1 -1
  49. package/docs/composables.md +36 -0
  50. package/docs/configuration.md +52 -0
  51. package/docs/layouts.md +82 -0
  52. package/docs/rendering-modes.md +52 -11
  53. package/docs/routing.md +66 -0
  54. package/e2e/cypress/e2e/isr-nested-runtime.cy.ts +100 -0
  55. package/e2e/kitchen-sink/app/layouts/admin.ts +13 -0
  56. package/e2e/kitchen-sink/app/pages/admin/_layout.ts +1 -0
  57. package/e2e/kitchen-sink/app/pages/admin/dashboard.ts +11 -0
  58. package/e2e/kitchen-sink/app/pages/blog/[slug].ts +1 -0
  59. package/e2e/kitchen-sink/app/pages/isr-test.ts +17 -0
  60. package/e2e/kitchen-sink/cer.config.ts +5 -0
  61. package/package.json +1 -1
  62. package/src/__tests__/cli/preview-isr.test.ts +246 -0
  63. package/src/__tests__/plugin/dts-generator.test.ts +20 -0
  64. package/src/__tests__/plugin/resolve-config.test.ts +15 -0
  65. package/src/__tests__/plugin/transforms/auto-import.test.ts +16 -0
  66. package/src/__tests__/plugin/virtual/routes.test.ts +195 -0
  67. package/src/__tests__/runtime/use-runtime-config.test.ts +59 -0
  68. package/src/cli/commands/preview-isr.ts +139 -0
  69. package/src/cli/commands/preview.ts +71 -2
  70. package/src/plugin/dev-server.ts +1 -0
  71. package/src/plugin/dts-generator.ts +8 -1
  72. package/src/plugin/index.ts +11 -1
  73. package/src/plugin/transforms/auto-import.ts +2 -2
  74. package/src/plugin/virtual/routes.ts +106 -9
  75. package/src/runtime/app-template.ts +16 -4
  76. package/src/runtime/composables/index.ts +1 -0
  77. package/src/runtime/composables/use-runtime-config.ts +40 -0
  78. package/src/runtime/entry-server-template.ts +14 -6
  79. package/src/types/config.ts +26 -0
  80. package/src/types/index.ts +1 -1
  81. package/src/types/page.ts +17 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAIlD,OAAO,EAAE,SAAS,EAAE,MAAM,kDAAkD,CAAA;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAClG,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,4B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,CAAC;QACH,CAAC;KACF,CAAA;IAED,yDAAyD;IACzD,wEAAwE;IACxE,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;IAChD,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,GAAG,cAAc,CAAC,MAAM,CAAA;IACxD,MAAM,UAAU,GAAG,SAAS,CAAC;QAC3B,OAAO;QACP,GAAG,UAAU;QACb,GAAG,EAAE;YACH,GAAG,EAAE,IAAI;YACT,GAAG,EAAE,UAAU;SAChB;KACF,CAAC,CAAA;IAEF,OAAO,CAAC,YAAY,EAAE,GAAG,UAAU,CAAC,CAAA;AACtC,CAAC"}
@@ -2,8 +2,8 @@ import MagicString from 'magic-string';
2
2
  import { normalize } from 'pathe';
3
3
  const RUNTIME_IMPORTS = `import { component, html, css, ref, computed, watch, watchEffect, useProps, useEmit, useOnConnected, useOnDisconnected, useOnAttributeChanged, useOnError, useStyle, useDesignTokens, useGlobalStyle, useExpose, useSlots, provide, inject, createComposable, nextTick, defineModel, getCurrentComponentContext, isReactiveState, unsafeHTML, decodeEntities, useTeleport } from '@jasonshimmy/custom-elements-runtime';`;
4
4
  const DIRECTIVE_IMPORTS = `import { when, each, match, anchorBlock } from '@jasonshimmy/custom-elements-runtime/directives';`;
5
- const FRAMEWORK_IMPORTS = `import { useHead, usePageData, useInject } from '@jasonshimmy/vite-plugin-cer-app/composables';`;
6
- const FRAMEWORK_IDENTIFIERS = ['useHead', 'usePageData', 'useInject'];
5
+ const FRAMEWORK_IMPORTS = `import { useHead, usePageData, useInject, useRuntimeConfig } from '@jasonshimmy/vite-plugin-cer-app/composables';`;
6
+ const FRAMEWORK_IDENTIFIERS = ['useHead', 'usePageData', 'useInject', 'useRuntimeConfig'];
7
7
  const RUNTIME_IDENTIFIERS = [
8
8
  'component',
9
9
  'html',
@@ -1 +1 @@
1
- {"version":3,"file":"auto-import.js","sourceRoot":"","sources":["../../../src/plugin/transforms/auto-import.ts"],"names":[],"mappings":"AAAA,O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,IAAI,CAAC,oCAAoC,CAAA;AAC1E,CAAC;AAED;;;GAGG;AACH,SAAS,uBAAuB,CAAC,IAAY;IAC3C,IAAI,IAAI,CAAC,QAAQ,CAAC,qDAAqD,CAAC;QACpE,IAAI,CAAC,QAAQ,CAAC,qDAAqD,CAAC,EAAE,CAAC;QACzE,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;QACvC,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACzC,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,uBAAuB,CAAC,IAAY;IAC3C,sDAAsD;IACtD,IAAI,IAAI,CAAC,QAAQ,CAAC,wDAAwD,CAAC;QACvE,IAAI,CAAC,QAAQ,CAAC,wDAAwD,CAAC,EAAE,CAAC;QAC5E,OAAO,KAAK,CAAA;IACd,CAAC;IAED,0DAA0D;IAC1D,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;QACvC,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACzC,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/plugin/virtual/routes.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA0G1E"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/plugin/virtual/routes.ts"],"names":[],"mappings":"AA4GA;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoI1E"}
@@ -1,5 +1,5 @@
1
1
  import { existsSync } from 'node:fs';
2
- import { basename } from 'node:path';
2
+ import { basename, join, relative } from 'node:path';
3
3
  import { readFile } from 'node:fs/promises';
4
4
  import { scanDirectory } from '../scanner.js';
5
5
  import { buildRouteEntry, sortRoutes } from '../path-utils.js';
@@ -34,6 +34,73 @@ function extractLayout(source) {
34
34
  const match = source.match(/layout\s*:\s*['"]([^'"]+)['"]/);
35
35
  return match ? match[1] : null;
36
36
  }
37
+ /**
38
+ * Extracts the `ssg.revalidate` number from a page file's source.
39
+ * Returns null when not declared.
40
+ *
41
+ * Matches patterns like:
42
+ * revalidate: 60
43
+ * revalidate: 3600
44
+ */
45
+ function extractRevalidate(source) {
46
+ const match = source.match(/revalidate\s*:\s*(\d+)/);
47
+ return match ? parseInt(match[1], 10) : null;
48
+ }
49
+ /**
50
+ * Extracts the `transition` value from a page file's source.
51
+ * Returns the transition name string, true (boolean), or null if absent.
52
+ *
53
+ * Matches patterns like:
54
+ * transition: 'fade'
55
+ * transition: true
56
+ */
57
+ function extractTransition(source) {
58
+ const strMatch = source.match(/transition\s*:\s*['"]([^'"]+)['"]/);
59
+ if (strMatch)
60
+ return strMatch[1];
61
+ const boolMatch = source.match(/transition\s*:\s*(true|false)/);
62
+ if (boolMatch)
63
+ return boolMatch[1] === 'true';
64
+ return null;
65
+ }
66
+ /**
67
+ * Resolves the layout chain for a page by walking its ancestor directories
68
+ * inside pagesDir looking for `_layout.ts` files. Each `_layout.ts` must
69
+ * export a default string naming a layout in `app/layouts/`.
70
+ *
71
+ * Returns null when no nested layouts are found (single-layout path is used).
72
+ *
73
+ * Example:
74
+ * app/pages/admin/_layout.ts → export default 'minimal'
75
+ * app/pages/admin/users.ts → meta.layout: 'default' (or omitted)
76
+ * → layoutChain = ['default', 'minimal']
77
+ */
78
+ async function resolveLayoutChain(filePath, pagesDir, outerLayout) {
79
+ const rel = relative(pagesDir, filePath);
80
+ const parts = rel.split('/').slice(0, -1); // directory segments only
81
+ if (parts.length === 0)
82
+ return null;
83
+ const extras = [];
84
+ let currentDir = pagesDir;
85
+ for (const part of parts) {
86
+ currentDir = join(currentDir, part);
87
+ const layoutFile = join(currentDir, '_layout.ts');
88
+ if (existsSync(layoutFile)) {
89
+ try {
90
+ const src = await readFile(layoutFile, 'utf-8');
91
+ const match = src.match(/export\s+default\s+['"]([^'"]+)['"]/);
92
+ if (match)
93
+ extras.push(match[1]);
94
+ }
95
+ catch (err) {
96
+ console.warn(`[cer-app] Could not read layout file "${layoutFile}":`, err);
97
+ }
98
+ }
99
+ }
100
+ if (extras.length === 0)
101
+ return null;
102
+ return [outerLayout ?? 'default', ...extras];
103
+ }
37
104
  /**
38
105
  * Generates the virtual:cer-routes module code.
39
106
  *
@@ -52,7 +119,9 @@ export async function generateRoutesCode(pagesDir) {
52
119
  if (!existsSync(pagesDir)) {
53
120
  return `// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nconst routes = []\nexport default routes\n`;
54
121
  }
55
- const files = await scanDirectory('**/*.ts', pagesDir);
122
+ const allFiles = await scanDirectory('**/*.ts', pagesDir);
123
+ // Exclude _layout.ts files — they are directory-level layout config, not pages.
124
+ const files = allFiles.filter((f) => basename(f) !== '_layout.ts');
56
125
  if (files.length === 0) {
57
126
  return `// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nconst routes = []\nexport default routes\n`;
58
127
  }
@@ -75,21 +144,29 @@ export async function generateRoutesCode(pagesDir) {
75
144
  return true;
76
145
  });
77
146
  const sorted = sortRoutes(entries);
78
- // Read each file's source once to extract static metadata (middleware + layout)
79
- // without eagerly importing the module.
147
+ // Read each file's source once to extract static metadata without eagerly
148
+ // importing the module, then resolve any nested layout chains.
80
149
  const metaPerEntry = await Promise.all(sorted.map(async (entry) => {
81
150
  try {
82
151
  const src = await readFile(entry.filePath, 'utf-8');
83
- return { middleware: extractMiddleware(src), layout: extractLayout(src) };
152
+ const layout = extractLayout(src);
153
+ const layoutChain = await resolveLayoutChain(entry.filePath, pagesDir, layout);
154
+ return {
155
+ middleware: extractMiddleware(src),
156
+ layout,
157
+ layoutChain,
158
+ revalidate: extractRevalidate(src),
159
+ transition: extractTransition(src),
160
+ };
84
161
  }
85
162
  catch {
86
- return { middleware: [], layout: null };
163
+ return { middleware: [], layout: null, layoutChain: null, revalidate: null, transition: null };
87
164
  }
88
165
  }));
89
166
  const lines = ['// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app', ''];
90
167
  // Build routes array with lazy load() functions for code splitting.
91
168
  const routeItems = sorted.map((entry, i) => {
92
- const { middleware: mw, layout } = metaPerEntry[i];
169
+ const { middleware: mw, layout, layoutChain, revalidate, transition } = metaPerEntry[i];
93
170
  const filePath = JSON.stringify(entry.filePath);
94
171
  const tagName = JSON.stringify(entry.tagName);
95
172
  const routePath = JSON.stringify(entry.routePath);
@@ -100,8 +177,18 @@ export async function generateRoutesCode(pagesDir) {
100
177
  const loadFn = `() => import(${filePath}).then(mod => ({ default: ${tagName}, loader: mod.loader ?? null }))`;
101
178
  // Build meta object — only emit fields that are set
102
179
  const metaFields = [];
103
- if (layout !== null)
180
+ if (layoutChain !== null) {
181
+ metaFields.push(`layoutChain: ${JSON.stringify(layoutChain)}`);
182
+ }
183
+ else if (layout !== null) {
104
184
  metaFields.push(`layout: ${JSON.stringify(layout)}`);
185
+ }
186
+ if (revalidate !== null) {
187
+ metaFields.push(`ssg: { revalidate: ${revalidate} }`);
188
+ }
189
+ if (transition !== null) {
190
+ metaFields.push(`transition: ${JSON.stringify(transition)}`);
191
+ }
105
192
  const metaStr = metaFields.length > 0 ? ` meta: { ${metaFields.join(', ')} },\n` : '';
106
193
  if (mw.length === 0) {
107
194
  return (` {\n` +
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/plugin/virtual/routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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wEAAwE;QACxE,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QACpC,OAAO,CACL,OAAO;YACP,aAAa,SAAS,KAAK;YAC3B,aAAa,MAAM,KAAK;YACxB,OAAO;YACP,0CAA0C;YAC1C,uEAAuE;YACvE,4BAA4B,SAAS,OAAO;YAC5C,4CAA4C;YAC5C,uDAAuD;YACvD,qFAAqF;YACrF,yDAAyD;YACzD,8CAA8C;YAC9C,WAAW;YACX,qBAAqB;YACrB,UAAU;YACV,KAAK,CACN,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;IAC9B,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAClC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACf,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA;IACnC,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 '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 {\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'\n\nregisterBuiltinComponents()\nenableJITCSS()\n\nconst router = initRouter({ routes })\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 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 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\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 unsub = router.subscribe((s) => { current.value = s })\n })\n useOnDisconnected(() => { unsub?.(); unsub = undefined })\n\n if (currentError.value !== null) {\n if (hasError && errorTag) {\n return { tag: errorTag, 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 const matched = router.matchRoute(current.value.path)\n const routeMeta = matched?.route?.meta\n const layoutName = routeMeta?.layout ?? 'default'\n const layoutTag = layouts[layoutName]\n const routerView = { tag: 'router-view', props: {}, children: [] }\n\n if (layoutTag) return { tag: layoutTag, props: {}, children: [routerView] }\n return routerView\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 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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\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\n// \u2500\u2500\u2500 Initial navigation \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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\nif (typeof window !== 'undefined') {\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(window.location.pathname + window.location.search + window.location.hash)\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\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 '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 { 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// \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 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 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\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 unsub = router.subscribe((s) => { current.value = s })\n })\n useOnDisconnected(() => { unsub?.(); unsub = undefined })\n\n if (currentError.value !== null) {\n if (hasError && errorTag) {\n return { tag: errorTag, 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 const matched = router.matchRoute(current.value.path)\n const routeMeta = matched?.route?.meta\n const routerView = { tag: 'router-view', props: {}, children: [] }\n\n // Support nested layout chains: meta.layoutChain = ['default', 'admin']\n // renders <layout-default><layout-admin><router-view/></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 = routerView\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 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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\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\n// \u2500\u2500\u2500 Initial navigation \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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\nif (typeof window !== 'undefined') {\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(window.location.pathname + window.location.search + window.location.hash)\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\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,+oNAsJ9B,CAAA"}
1
+ {"version":3,"file":"app-template.d.ts","sourceRoot":"","sources":["../../src/runtime/app-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,qoOAkK9B,CAAA"}
@@ -16,6 +16,7 @@ import layouts from 'virtual:cer-layouts'
16
16
  import plugins from 'virtual:cer-plugins'
17
17
  import { hasLoading, loadingTag } from 'virtual:cer-loading'
18
18
  import { hasError, errorTag } from 'virtual:cer-error'
19
+ import { runtimeConfig } from 'virtual:cer-app-config'
19
20
  import {
20
21
  component,
21
22
  ref,
@@ -26,9 +27,11 @@ import {
26
27
  } from '@jasonshimmy/custom-elements-runtime'
27
28
  import { initRouter } from '@jasonshimmy/custom-elements-runtime/router'
28
29
  import { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'
30
+ import { initRuntimeConfig } from '@jasonshimmy/vite-plugin-cer-app/composables'
29
31
 
30
32
  registerBuiltinComponents()
31
33
  enableJITCSS()
34
+ initRuntimeConfig(runtimeConfig)
32
35
 
33
36
  const router = initRouter({ routes })
34
37
 
@@ -112,12 +115,21 @@ component('cer-layout-view', () => {
112
115
 
113
116
  const matched = router.matchRoute(current.value.path)
114
117
  const routeMeta = matched?.route?.meta
115
- const layoutName = routeMeta?.layout ?? 'default'
116
- const layoutTag = layouts[layoutName]
117
118
  const routerView = { tag: 'router-view', props: {}, children: [] }
118
119
 
119
- if (layoutTag) return { tag: layoutTag, props: {}, children: [routerView] }
120
- return routerView
120
+ // Support nested layout chains: meta.layoutChain = ['default', 'admin']
121
+ // renders <layout-default><layout-admin><router-view/></layout-admin></layout-default>
122
+ const chain = routeMeta?.layoutChain
123
+ ? routeMeta.layoutChain
124
+ : [routeMeta?.layout ?? 'default']
125
+
126
+ // Build nested vnodes from innermost to outermost.
127
+ let vnode = routerView
128
+ for (let i = chain.length - 1; i >= 0; i--) {
129
+ const tag = layouts[chain[i]]
130
+ if (tag) vnode = { tag, props: {}, children: [vnode] }
131
+ }
132
+ return vnode
121
133
  })
122
134
 
123
135
  for (const plugin of plugins) {
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsJjC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkKjC,CAAA"}
@@ -2,4 +2,5 @@ export { useHead, beginHeadCollection, endHeadCollection, serializeHeadTags } fr
2
2
  export type { HeadInput } from './use-head.js';
3
3
  export { usePageData } from './use-page-data.js';
4
4
  export { useInject } from './use-inject.js';
5
+ export { useRuntimeConfig, initRuntimeConfig } from './use-runtime-config.js';
5
6
  //# 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,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;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,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;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export { useHead, beginHeadCollection, endHeadCollection, serializeHeadTags } from './use-head.js';
2
2
  export { usePageData } from './use-page-data.js';
3
3
  export { useInject } from './use-inject.js';
4
+ export { useRuntimeConfig, initRuntimeConfig } from './use-runtime-config.js';
4
5
  //# 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,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAElG,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,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;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Returns the public runtime configuration set in `cer.config.ts` under
3
+ * `runtimeConfig.public`. Available on both server and client.
4
+ *
5
+ * Values are baked in at build time from `virtual:cer-app-config`, so only
6
+ * static/env-var values should be placed here. For truly dynamic config,
7
+ * use a loader or API route.
8
+ *
9
+ * @example
10
+ * // cer.config.ts
11
+ * export default defineConfig({
12
+ * runtimeConfig: {
13
+ * public: { apiBase: process.env.VITE_API_BASE ?? '/api' },
14
+ * },
15
+ * })
16
+ *
17
+ * // app/pages/index.ts
18
+ * const config = useRuntimeConfig()
19
+ * fetch(config.public.apiBase + '/posts')
20
+ */
21
+ export declare function useRuntimeConfig(): {
22
+ public: Record<string, unknown>;
23
+ };
24
+ /**
25
+ * Called once during app bootstrap to store the resolved runtimeConfig on
26
+ * globalThis so useRuntimeConfig() can access it synchronously in any context
27
+ * (component render, composable, server handler).
28
+ */
29
+ export declare function initRuntimeConfig(config: {
30
+ public: Record<string, unknown>;
31
+ }): void;
32
+ //# sourceMappingURL=use-runtime-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-runtime-config.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/use-runtime-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,IAAI;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAStE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,IAAI,CAGnF"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Returns the public runtime configuration set in `cer.config.ts` under
3
+ * `runtimeConfig.public`. Available on both server and client.
4
+ *
5
+ * Values are baked in at build time from `virtual:cer-app-config`, so only
6
+ * static/env-var values should be placed here. For truly dynamic config,
7
+ * use a loader or API route.
8
+ *
9
+ * @example
10
+ * // cer.config.ts
11
+ * export default defineConfig({
12
+ * runtimeConfig: {
13
+ * public: { apiBase: process.env.VITE_API_BASE ?? '/api' },
14
+ * },
15
+ * })
16
+ *
17
+ * // app/pages/index.ts
18
+ * const config = useRuntimeConfig()
19
+ * fetch(config.public.apiBase + '/posts')
20
+ */
21
+ export function useRuntimeConfig() {
22
+ // Dynamic import resolved at runtime — avoids a static circular dependency
23
+ // between the composable and the virtual module.
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ const mod = globalThis.__cerRuntimeConfig;
26
+ if (mod)
27
+ return mod;
28
+ // Fallback: empty config (e.g. in test environments without the virtual module).
29
+ return { public: {} };
30
+ }
31
+ /**
32
+ * Called once during app bootstrap to store the resolved runtimeConfig on
33
+ * globalThis so useRuntimeConfig() can access it synchronously in any context
34
+ * (component render, composable, server handler).
35
+ */
36
+ export function initRuntimeConfig(config) {
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ ;
39
+ globalThis.__cerRuntimeConfig = config;
40
+ }
41
+ //# sourceMappingURL=use-runtime-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-runtime-config.js","sourceRoot":"","sources":["../../../src/runtime/composables/use-runtime-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,gBAAgB;IAC9B,2EAA2E;IAC3E,iDAAiD;IACjD,8DAA8D;IAC9D,MAAM,GAAG,GAAI,UAAkB,CAAC,kBAAkB,CAAA;IAClD,IAAI,GAAG;QAAE,OAAO,GAA0C,CAAA;IAE1D,iFAAiF;IACjF,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;AACvB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAA2C;IAC3E,8DAA8D;IAC9D,CAAC;IAAC,UAAkB,CAAC,kBAAkB,GAAG,MAAM,CAAA;AAClD,CAAC"}
@@ -11,5 +11,5 @@
11
11
  * - useHead() support via beginHeadCollection / endHeadCollection
12
12
  * - DSD polyfill injected at end of <body> after client-template merge
13
13
  */
14
- export declare const ENTRY_SERVER_TEMPLATE = "// Server-side entry \u2014 AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nimport { readFileSync, existsSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { AsyncLocalStorage } from 'node:async_hooks'\nimport '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, renderToStringWithJITCSSDSD, DSD_POLYFILL_SCRIPT } from '@jasonshimmy/custom-elements-runtime/ssr'\nimport entitiesJson from '@jasonshimmy/custom-elements-runtime/entities.json'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { beginHeadCollection, endHeadCollection, serializeHeadTags } from '@jasonshimmy/vite-plugin-cer-app/composables'\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// Run plugins once at server startup so their provide() values are available\n// to useInject() during every SSR/SSG render pass. Stored on globalThis so all\n// dynamically-imported page chunks share the same reference.\nconst _pluginProvides = new Map()\n;(globalThis).__cerPluginProvides = _pluginProvides\nconst _pluginsReady = (async () => {\n const _bootstrapRouter = initRouter({ routes })\n for (const plugin of plugins) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({\n router: _bootstrapRouter,\n provide: (key, value) => _pluginProvides.set(key, value),\n config: {},\n })\n }\n }\n})()\n\n// Async-local storage for request-scoped SSR loader data.\n// Using AsyncLocalStorage ensures concurrent SSR renders (e.g. SSG with\n// concurrency > 1) never see each other's data \u2014 each request's async chain\n// carries its own store value, so usePageData() is always race-condition-free.\nconst _cerDataStore = new AsyncLocalStorage()\n// Expose the store so the usePageData() composable can read it server-side.\n;(globalThis).__CER_DATA_STORE__ = _cerDataStore\n\n// 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 rendered body with the Vite client shell so the final page\n// contains both pre-rendered DSD content and the client bundle scripts.\nfunction _mergeWithClientTemplate(ssrHtml, clientTemplate) {\n const headTag = '<head>', headCloseTag = '</head>'\n const bodyTag = '<body>', bodyCloseTag = '</body>'\n const headStart = ssrHtml.indexOf(headTag)\n const headEnd = ssrHtml.indexOf(headCloseTag)\n const bodyStart = ssrHtml.indexOf(bodyTag)\n const bodyEnd = ssrHtml.lastIndexOf(bodyCloseTag)\n const ssrHead = headStart >= 0 && headEnd > headStart\n ? ssrHtml.slice(headStart + headTag.length, headEnd).trim() : ''\n const ssrBody = bodyStart >= 0 && bodyEnd > bodyStart\n ? ssrHtml.slice(bodyStart + bodyTag.length, bodyEnd).trim() : ssrHtml\n // Hoist only top-level <style id=...> elements (cer-ssr-jit, cer-ssr-global)\n // from the SSR body into the document <head>. Plain <style> blocks without\n // an id attribute belong to shadow DOM templates and must stay in place \u2014\n // hoisting them to <head> breaks shadow DOM style encapsulation (document\n // styles do not pierce shadow roots), which is the root cause of FOUC.\n const headParts = ssrHead ? [ssrHead] : []\n let ssrBodyContent = ssrBody\n let pos = 0\n while (pos < ssrBodyContent.length) {\n const styleOpen = ssrBodyContent.indexOf('<style id=', pos)\n if (styleOpen < 0) break\n const styleClose = ssrBodyContent.indexOf('</style>', styleOpen)\n if (styleClose < 0) break\n headParts.push(ssrBodyContent.slice(styleOpen, styleClose + 8))\n ssrBodyContent = ssrBodyContent.slice(0, styleOpen) + ssrBodyContent.slice(styleClose + 8)\n pos = styleOpen\n }\n ssrBodyContent = ssrBodyContent.trim()\n // Inject the pre-rendered layout+page as light DOM of the app mount element\n // so it is visible before JS boots, then the client router takes over.\n let merged = clientTemplate\n if (merged.includes('<cer-layout-view></cer-layout-view>')) {\n merged = merged.replace('<cer-layout-view></cer-layout-view>',\n '<cer-layout-view>' + ssrBodyContent + '</cer-layout-view>')\n } else if (merged.includes('<div id=\"app\"></div>')) {\n merged = merged.replace('<div id=\"app\"></div>',\n '<div id=\"app\">' + ssrBodyContent + '</div>')\n }\n const headAdditions = headParts.filter(Boolean).join('\\n')\n if (headAdditions) {\n // If SSR provides a <title>, replace the client template's <title> so the\n // SSR title wins (client template title is the fallback default).\n if (headAdditions.includes('<title>')) {\n merged = merged.replace(/<title>[^<]*<\\/title>/, '')\n }\n merged = merged.replace('</head>', headAdditions + '\\n</head>')\n }\n return merged\n}\n\n// Per-request async setup: initialize a fresh router, resolve the matched\n// route and layout, pre-load the page module, and call the data loader.\n// Loader data is scoped to the current AsyncLocalStorage context via enterWith()\n// so concurrent renders never share state.\nconst _prepareRequest = async (req) => {\n await _pluginsReady\n const router = initRouter({ routes, initialUrl: req.url ?? '/' })\n const current = router.getCurrent()\n const { route, params } = router.matchRoute(current.path)\n 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 // 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\nexport const handler = async (req, res) => {\n await _cerDataStore.run(null, async () => {\n const { vnode, router, head } = await _prepareRequest(req)\n\n // Begin collecting useHead() calls made during the synchronous render pass.\n beginHeadCollection()\n\n // dsdPolyfill: false \u2014 we inject the polyfill manually after merging so it\n // lands at the end of <body>, not inside <cer-layout-view> light DOM where\n // scripts may not execute.\n const { htmlWithStyles } = renderToStringWithJITCSSDSD(vnode, {\n dsdPolyfill: false,\n router,\n })\n\n // Collect and serialize any useHead() calls from the rendered components.\n const headTags = serializeHeadTags(endHeadCollection())\n\n // Merge loader data script + useHead() tags into the document head.\n const headContent = [head, headTags].filter(Boolean).join('\\n')\n\n // Wrap the rendered body in a full HTML document and inject the head additions\n // (loader data script, useHead() tags, JIT styles). No polyfill in body yet.\n const ssrHtml = `<!DOCTYPE html><html><head>${headContent}</head><body>${htmlWithStyles}</body></html>`\n\n let finalHtml = _clientTemplate\n ? _mergeWithClientTemplate(ssrHtml, _clientTemplate)\n : ssrHtml\n\n // Inject DSD polyfill at end of <body>, outside <cer-layout-view>, so the\n // browser runs it after parsing the declarative shadow roots.\n finalHtml = finalHtml.includes('</body>')\n ? finalHtml.replace('</body>', DSD_POLYFILL_SCRIPT + '</body>')\n : finalHtml + DSD_POLYFILL_SCRIPT\n\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.end(finalHtml)\n })\n}\n\nexport { apiRoutes, plugins, layouts, routes }\nexport default handler\n";
14
+ export declare const ENTRY_SERVER_TEMPLATE = "// Server-side entry \u2014 AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nimport { readFileSync, existsSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { AsyncLocalStorage } from 'node:async_hooks'\nimport '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 { runtimeConfig } from 'virtual:cer-app-config'\nimport { registerBuiltinComponents } from '@jasonshimmy/custom-elements-runtime'\nimport { registerEntityMap, renderToStringWithJITCSSDSD, DSD_POLYFILL_SCRIPT } from '@jasonshimmy/custom-elements-runtime/ssr'\nimport entitiesJson from '@jasonshimmy/custom-elements-runtime/entities.json'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { beginHeadCollection, endHeadCollection, serializeHeadTags, initRuntimeConfig } from '@jasonshimmy/vite-plugin-cer-app/composables'\n\nregisterBuiltinComponents()\ninitRuntimeConfig(runtimeConfig)\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// Run plugins once at server startup so their provide() values are available\n// to useInject() during every SSR/SSG render pass. Stored on globalThis so all\n// dynamically-imported page chunks share the same reference.\nconst _pluginProvides = new Map()\n;(globalThis).__cerPluginProvides = _pluginProvides\nconst _pluginsReady = (async () => {\n const _bootstrapRouter = initRouter({ routes })\n for (const plugin of plugins) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({\n router: _bootstrapRouter,\n provide: (key, value) => _pluginProvides.set(key, value),\n config: {},\n })\n }\n }\n})()\n\n// Async-local storage for request-scoped SSR loader data.\n// Using AsyncLocalStorage ensures concurrent SSR renders (e.g. SSG with\n// concurrency > 1) never see each other's data \u2014 each request's async chain\n// carries its own store value, so usePageData() is always race-condition-free.\nconst _cerDataStore = new AsyncLocalStorage()\n// Expose the store so the usePageData() composable can read it server-side.\n;(globalThis).__CER_DATA_STORE__ = _cerDataStore\n\n// 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 rendered body with the Vite client shell so the final page\n// contains both pre-rendered DSD content and the client bundle scripts.\nfunction _mergeWithClientTemplate(ssrHtml, clientTemplate) {\n const headTag = '<head>', headCloseTag = '</head>'\n const bodyTag = '<body>', bodyCloseTag = '</body>'\n const headStart = ssrHtml.indexOf(headTag)\n const headEnd = ssrHtml.indexOf(headCloseTag)\n const bodyStart = ssrHtml.indexOf(bodyTag)\n const bodyEnd = ssrHtml.lastIndexOf(bodyCloseTag)\n const ssrHead = headStart >= 0 && headEnd > headStart\n ? ssrHtml.slice(headStart + headTag.length, headEnd).trim() : ''\n const ssrBody = bodyStart >= 0 && bodyEnd > bodyStart\n ? ssrHtml.slice(bodyStart + bodyTag.length, bodyEnd).trim() : ssrHtml\n // Hoist only top-level <style id=...> elements (cer-ssr-jit, cer-ssr-global)\n // from the SSR body into the document <head>. Plain <style> blocks without\n // an id attribute belong to shadow DOM templates and must stay in place \u2014\n // hoisting them to <head> breaks shadow DOM style encapsulation (document\n // styles do not pierce shadow roots), which is the root cause of FOUC.\n const headParts = ssrHead ? [ssrHead] : []\n let ssrBodyContent = ssrBody\n let pos = 0\n while (pos < ssrBodyContent.length) {\n const styleOpen = ssrBodyContent.indexOf('<style id=', pos)\n if (styleOpen < 0) break\n const styleClose = ssrBodyContent.indexOf('</style>', styleOpen)\n if (styleClose < 0) break\n headParts.push(ssrBodyContent.slice(styleOpen, styleClose + 8))\n ssrBodyContent = ssrBodyContent.slice(0, styleOpen) + ssrBodyContent.slice(styleClose + 8)\n pos = styleOpen\n }\n ssrBodyContent = ssrBodyContent.trim()\n // Inject the pre-rendered layout+page as light DOM of the app mount element\n // so it is visible before JS boots, then the client router takes over.\n let merged = clientTemplate\n if (merged.includes('<cer-layout-view></cer-layout-view>')) {\n merged = merged.replace('<cer-layout-view></cer-layout-view>',\n '<cer-layout-view>' + ssrBodyContent + '</cer-layout-view>')\n } else if (merged.includes('<div id=\"app\"></div>')) {\n merged = merged.replace('<div id=\"app\"></div>',\n '<div id=\"app\">' + ssrBodyContent + '</div>')\n }\n const headAdditions = headParts.filter(Boolean).join('\\n')\n if (headAdditions) {\n // If SSR provides a <title>, replace the client template's <title> so the\n // SSR title wins (client template title is the fallback default).\n if (headAdditions.includes('<title>')) {\n merged = merged.replace(/<title>[^<]*<\\/title>/, '')\n }\n merged = merged.replace('</head>', headAdditions + '\\n</head>')\n }\n return merged\n}\n\n// Per-request async setup: initialize a fresh router, resolve the matched\n// route and layout, pre-load the page module, and call the data loader.\n// Loader data is scoped to the current AsyncLocalStorage context via enterWith()\n// so concurrent renders never share state.\nconst _prepareRequest = async (req) => {\n await _pluginsReady\n const router = initRouter({ routes, initialUrl: req.url ?? '/' })\n const current = router.getCurrent()\n const { route, params } = router.matchRoute(current.path)\n\n // 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 // 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 // Resolve layout chain: nested layouts (meta.layoutChain) or single layout.\n const chain = route?.meta?.layoutChain\n ? route.meta.layoutChain\n : [route?.meta?.layout ?? 'default']\n\n // Wrap pageVnode in the layout chain from innermost to outermost.\n let vnode = pageVnode\n for (let i = chain.length - 1; i >= 0; i--) {\n const tag = layouts[chain[i]]\n if (tag) vnode = { tag, props: {}, children: [vnode] }\n }\n\n return { vnode, router, head }\n}\n\nexport const handler = async (req, res) => {\n await _cerDataStore.run(null, async () => {\n const { vnode, router, head } = await _prepareRequest(req)\n\n // Begin collecting useHead() calls made during the synchronous render pass.\n beginHeadCollection()\n\n // dsdPolyfill: false \u2014 we inject the polyfill manually after merging so it\n // lands at the end of <body>, not inside <cer-layout-view> light DOM where\n // scripts may not execute.\n const { htmlWithStyles } = renderToStringWithJITCSSDSD(vnode, {\n dsdPolyfill: false,\n router,\n })\n\n // Collect and serialize any useHead() calls from the rendered components.\n const headTags = serializeHeadTags(endHeadCollection())\n\n // Merge loader data script + useHead() tags into the document head.\n const headContent = [head, headTags].filter(Boolean).join('\\n')\n\n // Wrap the rendered body in a full HTML document and inject the head additions\n // (loader data script, useHead() tags, JIT styles). No polyfill in body yet.\n const ssrHtml = `<!DOCTYPE html><html><head>${headContent}</head><body>${htmlWithStyles}</body></html>`\n\n let finalHtml = _clientTemplate\n ? _mergeWithClientTemplate(ssrHtml, _clientTemplate)\n : ssrHtml\n\n // Inject DSD polyfill at end of <body>, outside <cer-layout-view>, so the\n // browser runs it after parsing the declarative shadow roots.\n finalHtml = finalHtml.includes('</body>')\n ? finalHtml.replace('</body>', DSD_POLYFILL_SCRIPT + '</body>')\n : finalHtml + DSD_POLYFILL_SCRIPT\n\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.end(finalHtml)\n })\n}\n\nexport { apiRoutes, plugins, layouts, routes }\nexport default handler\n";
15
15
  //# sourceMappingURL=entry-server-template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry-server-template.d.ts","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,giSAsMjC,CAAA"}
1
+ {"version":3,"file":"entry-server-template.d.ts","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,63SA8MjC,CAAA"}
@@ -21,13 +21,15 @@ import routes from 'virtual:cer-routes'
21
21
  import layouts from 'virtual:cer-layouts'
22
22
  import plugins from 'virtual:cer-plugins'
23
23
  import apiRoutes from 'virtual:cer-server-api'
24
+ import { runtimeConfig } from 'virtual:cer-app-config'
24
25
  import { registerBuiltinComponents } from '@jasonshimmy/custom-elements-runtime'
25
26
  import { registerEntityMap, renderToStringWithJITCSSDSD, DSD_POLYFILL_SCRIPT } from '@jasonshimmy/custom-elements-runtime/ssr'
26
27
  import entitiesJson from '@jasonshimmy/custom-elements-runtime/entities.json'
27
28
  import { initRouter } from '@jasonshimmy/custom-elements-runtime/router'
28
- import { beginHeadCollection, endHeadCollection, serializeHeadTags } from '@jasonshimmy/vite-plugin-cer-app/composables'
29
+ import { beginHeadCollection, endHeadCollection, serializeHeadTags, initRuntimeConfig } from '@jasonshimmy/vite-plugin-cer-app/composables'
29
30
 
30
31
  registerBuiltinComponents()
32
+ initRuntimeConfig(runtimeConfig)
31
33
 
32
34
  // Pre-load the full HTML entity map so named entities like &mdash; decode
33
35
  // correctly during SSR. Without this the bundled runtime falls back to a
@@ -130,8 +132,6 @@ const _prepareRequest = async (req) => {
130
132
  const router = initRouter({ routes, initialUrl: req.url ?? '/' })
131
133
  const current = router.getCurrent()
132
134
  const { route, params } = router.matchRoute(current.path)
133
- const layoutName = route?.meta?.layout ?? 'default'
134
- const layoutTag = layouts[layoutName]
135
135
 
136
136
  // Pre-load the page module so we can embed the component tag directly.
137
137
  // This avoids the async router-view (which injects content via script tags
@@ -160,9 +160,17 @@ const _prepareRequest = async (req) => {
160
160
  }
161
161
  }
162
162
 
163
- const vnode = layoutTag
164
- ? { tag: layoutTag, props: {}, children: [pageVnode] }
165
- : pageVnode
163
+ // Resolve layout chain: nested layouts (meta.layoutChain) or single layout.
164
+ const chain = route?.meta?.layoutChain
165
+ ? route.meta.layoutChain
166
+ : [route?.meta?.layout ?? 'default']
167
+
168
+ // Wrap pageVnode in the layout chain from innermost to outermost.
169
+ let vnode = pageVnode
170
+ for (let i = chain.length - 1; i >= 0; i--) {
171
+ const tag = layouts[chain[i]]
172
+ if (tag) vnode = { tag, props: {}, children: [vnode] }
173
+ }
166
174
 
167
175
  return { vnode, router, head }
168
176
  }
@@ -1 +1 @@
1
- {"version":3,"file":"entry-server-template.js","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsMpC,CAAA"}
1
+ {"version":3,"file":"entry-server-template.js","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8MpC,CAAA"}