@pithyjs/ssr 0.0.0-stage → 0.1.2-beta.11

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 (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -2
  3. package/bin/pithy-ssg.mjs +23 -0
  4. package/dist/browser.d.ts +38 -0
  5. package/dist/browser.d.ts.map +1 -0
  6. package/dist/browser.js +40 -0
  7. package/dist/browser.js.map +1 -0
  8. package/dist/build/cli-args.d.ts +104 -0
  9. package/dist/build/cli-args.d.ts.map +1 -0
  10. package/dist/build/cli-args.js +88 -0
  11. package/dist/build/cli-args.js.map +1 -0
  12. package/dist/build/cli-exit.d.ts +95 -0
  13. package/dist/build/cli-exit.d.ts.map +1 -0
  14. package/dist/build/cli-exit.js +237 -0
  15. package/dist/build/cli-exit.js.map +1 -0
  16. package/dist/build/cli.d.ts +11 -0
  17. package/dist/build/cli.d.ts.map +1 -0
  18. package/dist/build/cli.js +93 -0
  19. package/dist/build/cli.js.map +1 -0
  20. package/dist/build/collect-css.d.ts +168 -0
  21. package/dist/build/collect-css.d.ts.map +1 -0
  22. package/dist/build/collect-css.js +479 -0
  23. package/dist/build/collect-css.js.map +1 -0
  24. package/dist/build/css-live-props.d.ts +89 -0
  25. package/dist/build/css-live-props.d.ts.map +1 -0
  26. package/dist/build/css-live-props.js +704 -0
  27. package/dist/build/css-live-props.js.map +1 -0
  28. package/dist/build/css-purge.d.ts +153 -0
  29. package/dist/build/css-purge.d.ts.map +1 -0
  30. package/dist/build/css-purge.js +463 -0
  31. package/dist/build/css-purge.js.map +1 -0
  32. package/dist/build/index.d.ts +24 -0
  33. package/dist/build/index.d.ts.map +1 -0
  34. package/dist/build/index.js +31 -0
  35. package/dist/build/index.js.map +1 -0
  36. package/dist/build/not-found.d.ts +94 -0
  37. package/dist/build/not-found.d.ts.map +1 -0
  38. package/dist/build/not-found.js +99 -0
  39. package/dist/build/not-found.js.map +1 -0
  40. package/dist/build/relative-links.d.ts +31 -0
  41. package/dist/build/relative-links.d.ts.map +1 -0
  42. package/dist/build/relative-links.js +79 -0
  43. package/dist/build/relative-links.js.map +1 -0
  44. package/dist/build/shell-head.d.ts +68 -0
  45. package/dist/build/shell-head.d.ts.map +1 -0
  46. package/dist/build/shell-head.js +236 -0
  47. package/dist/build/shell-head.js.map +1 -0
  48. package/dist/build/sprite-ssg.d.ts +61 -0
  49. package/dist/build/sprite-ssg.d.ts.map +1 -0
  50. package/dist/build/sprite-ssg.js +114 -0
  51. package/dist/build/sprite-ssg.js.map +1 -0
  52. package/dist/build/ssg.d.ts +117 -0
  53. package/dist/build/ssg.d.ts.map +1 -0
  54. package/dist/build/ssg.js +404 -0
  55. package/dist/build/ssg.js.map +1 -0
  56. package/dist/build/vite-ssg.d.ts +396 -0
  57. package/dist/build/vite-ssg.d.ts.map +1 -0
  58. package/dist/build/vite-ssg.js +1130 -0
  59. package/dist/build/vite-ssg.js.map +1 -0
  60. package/dist/client/bootstrap.d.ts +51 -0
  61. package/dist/client/bootstrap.d.ts.map +1 -0
  62. package/dist/client/bootstrap.js +121 -0
  63. package/dist/client/bootstrap.js.map +1 -0
  64. package/dist/client/hydrate.d.ts +60 -0
  65. package/dist/client/hydrate.d.ts.map +1 -0
  66. package/dist/client/hydrate.js +168 -0
  67. package/dist/client/hydrate.js.map +1 -0
  68. package/dist/client/index.d.ts +21 -0
  69. package/dist/client/index.d.ts.map +1 -0
  70. package/dist/client/index.js +16 -0
  71. package/dist/client/index.js.map +1 -0
  72. package/dist/index.d.ts +32 -0
  73. package/dist/index.d.ts.map +1 -0
  74. package/dist/index.js +31 -0
  75. package/dist/index.js.map +1 -0
  76. package/dist/server/app.d.ts +166 -0
  77. package/dist/server/app.d.ts.map +1 -0
  78. package/dist/server/app.js +200 -0
  79. package/dist/server/app.js.map +1 -0
  80. package/dist/server/context.d.ts +238 -0
  81. package/dist/server/context.d.ts.map +1 -0
  82. package/dist/server/context.js +371 -0
  83. package/dist/server/context.js.map +1 -0
  84. package/dist/server/environment.d.ts +88 -0
  85. package/dist/server/environment.d.ts.map +1 -0
  86. package/dist/server/environment.js +261 -0
  87. package/dist/server/environment.js.map +1 -0
  88. package/dist/server/html-shell.d.ts +41 -0
  89. package/dist/server/html-shell.d.ts.map +1 -0
  90. package/dist/server/html-shell.js +208 -0
  91. package/dist/server/html-shell.js.map +1 -0
  92. package/dist/server/index.d.ts +26 -0
  93. package/dist/server/index.d.ts.map +1 -0
  94. package/dist/server/index.js +37 -0
  95. package/dist/server/index.js.map +1 -0
  96. package/dist/server/layout-taint.d.ts +62 -0
  97. package/dist/server/layout-taint.d.ts.map +1 -0
  98. package/dist/server/layout-taint.js +313 -0
  99. package/dist/server/layout-taint.js.map +1 -0
  100. package/dist/server/loaders.d.ts +194 -0
  101. package/dist/server/loaders.d.ts.map +1 -0
  102. package/dist/server/loaders.js +479 -0
  103. package/dist/server/loaders.js.map +1 -0
  104. package/dist/server/render-route.d.ts +102 -0
  105. package/dist/server/render-route.d.ts.map +1 -0
  106. package/dist/server/render-route.js +182 -0
  107. package/dist/server/render-route.js.map +1 -0
  108. package/dist/server/render.d.ts +80 -0
  109. package/dist/server/render.d.ts.map +1 -0
  110. package/dist/server/render.js +256 -0
  111. package/dist/server/render.js.map +1 -0
  112. package/dist/server/router-adapter.d.ts +134 -0
  113. package/dist/server/router-adapter.d.ts.map +1 -0
  114. package/dist/server/router-adapter.js +225 -0
  115. package/dist/server/router-adapter.js.map +1 -0
  116. package/dist/server/serialization.d.ts +54 -0
  117. package/dist/server/serialization.d.ts.map +1 -0
  118. package/dist/server/serialization.js +287 -0
  119. package/dist/server/serialization.js.map +1 -0
  120. package/dist/server/ssr-worker.d.ts +18 -0
  121. package/dist/server/ssr-worker.d.ts.map +1 -0
  122. package/dist/server/ssr-worker.js +118 -0
  123. package/dist/server/ssr-worker.js.map +1 -0
  124. package/dist/server/utils.d.ts +11 -0
  125. package/dist/server/utils.d.ts.map +1 -0
  126. package/dist/server/utils.js +14 -0
  127. package/dist/server/utils.js.map +1 -0
  128. package/dist/server/worker-pool.d.ts +153 -0
  129. package/dist/server/worker-pool.d.ts.map +1 -0
  130. package/dist/server/worker-pool.js +451 -0
  131. package/dist/server/worker-pool.js.map +1 -0
  132. package/dist/server/worker-protocol.d.ts +61 -0
  133. package/dist/server/worker-protocol.d.ts.map +1 -0
  134. package/dist/server/worker-protocol.js +9 -0
  135. package/dist/server/worker-protocol.js.map +1 -0
  136. package/dist/shared/css-purge.d.ts +71 -0
  137. package/dist/shared/css-purge.d.ts.map +1 -0
  138. package/dist/shared/css-purge.js +177 -0
  139. package/dist/shared/css-purge.js.map +1 -0
  140. package/dist/shared/entry-path.d.ts +41 -0
  141. package/dist/shared/entry-path.d.ts.map +1 -0
  142. package/dist/shared/entry-path.js +87 -0
  143. package/dist/shared/entry-path.js.map +1 -0
  144. package/dist/shared/head.d.ts +87 -0
  145. package/dist/shared/head.d.ts.map +1 -0
  146. package/dist/shared/head.js +412 -0
  147. package/dist/shared/head.js.map +1 -0
  148. package/dist/shared/shell-helpers.d.ts +69 -0
  149. package/dist/shared/shell-helpers.d.ts.map +1 -0
  150. package/dist/shared/shell-helpers.js +160 -0
  151. package/dist/shared/shell-helpers.js.map +1 -0
  152. package/dist/shared/types.d.ts +332 -0
  153. package/dist/shared/types.d.ts.map +1 -0
  154. package/dist/shared/types.js +27 -0
  155. package/dist/shared/types.js.map +1 -0
  156. package/package.json +84 -3
@@ -0,0 +1,168 @@
1
+ /**
2
+ * @pithyjs/ssr/client - Hydration implementation
3
+ *
4
+ * Extracted from index.ts to break the circular dependency
5
+ * between bootstrap.ts ↔ index.ts.
6
+ */
7
+ import { STATE_VAR_NAME, HYDRATED_FLAG, SSR_VERSION, } from '../shared/types.js';
8
+ /** Max age for state before it's considered stale (1 hour) */
9
+ const STALE_THRESHOLD_MS = 60 * 60 * 1000;
10
+ /** @codexApi {"parent":"pithy.ssr.client","name":"hydrate","stability":"stable","signature":"(App: Component, options: HydrateOptions) => void"} */
11
+ /**
12
+ * Hydrate SSR'd HTML with interactivity
13
+ *
14
+ * Uses a replay approach: re-runs the App component and replaces the SSR
15
+ * content with the hydrated component tree, attaching event listeners and
16
+ * signal reactivity.
17
+ *
18
+ * @param App - The root component to hydrate with
19
+ * @param options - Hydration options including target element
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { hydrate, readState } from '@pithyjs/ssr/client';
24
+ * import App from './App';
25
+ *
26
+ * hydrate(App, {
27
+ * target: document.getElementById('app')!,
28
+ * state: readState(),
29
+ * onHydrated: () => console.log('Hydrated!'),
30
+ * onError: (err) => console.error('Hydration failed:', err),
31
+ * });
32
+ * ```
33
+ */
34
+ export function hydrate(App, options) {
35
+ const { target, onHydrated, onError } = options;
36
+ // Resolve state: explicit > window > empty
37
+ const state = options.state ?? readState();
38
+ // ── Guard: already hydrated ──────────────────────────────────────────
39
+ if (Reflect.get(window, HYDRATED_FLAG) === true) {
40
+ console.warn('[PithyJS SSR] App already hydrated — skipping.');
41
+ return;
42
+ }
43
+ // ── Warnings ─────────────────────────────────────────────────────────
44
+ if (state) {
45
+ // Version mismatch
46
+ if (state.version !== SSR_VERSION) {
47
+ console.warn(`[PithyJS SSR] State version mismatch: state="${state.version}", client="${SSR_VERSION}". ` +
48
+ 'Hydration may produce unexpected results.');
49
+ }
50
+ // Stale state
51
+ if (state.timestamp && Date.now() - state.timestamp > STALE_THRESHOLD_MS) {
52
+ console.warn('[PithyJS SSR] Serialized state is stale (older than 1 hour). ' +
53
+ 'Consider refreshing the page.');
54
+ }
55
+ }
56
+ // ── Make resolved state available globally for App and helpers ───────
57
+ if (state) {
58
+ Reflect.set(window, STATE_VAR_NAME, state);
59
+ }
60
+ // ── Save SSR content for rollback on error ───────────────────────────
61
+ const ssrSnapshot = target.innerHTML;
62
+ // ── Set hydrating flag ───────────────────────────────────────────────
63
+ globalThis.__PITHY_HYDRATING__ = true;
64
+ let hydrationSucceeded = false;
65
+ try {
66
+ // 1. Run the App component (replay approach)
67
+ const componentResult = App();
68
+ // 2. Clear existing SSR content and mount hydrated tree
69
+ target.innerHTML = '';
70
+ target.appendChild(componentResult.el);
71
+ hydrationSucceeded = true;
72
+ }
73
+ catch (err) {
74
+ // Clean up the hydrating flag BEFORE fallback attempt
75
+ // Fallback is a fresh client render, not a hydration
76
+ delete globalThis.__PITHY_HYDRATING__;
77
+ // Restore SSR content first (safety net)
78
+ target.innerHTML = ssrSnapshot;
79
+ // Normalize error
80
+ const error = err instanceof Error ? err : new Error(String(err));
81
+ if (onError) {
82
+ // onError is wrapped in try/catch so a throwing callback
83
+ // doesn't prevent the fallback remount from running.
84
+ try {
85
+ onError(error);
86
+ }
87
+ catch {
88
+ // Swallow — the caller's error handler itself threw.
89
+ // We still proceed with the fallback remount below.
90
+ }
91
+ // Attempt full client remount as recovery
92
+ try {
93
+ const fallbackResult = App();
94
+ target.innerHTML = '';
95
+ target.appendChild(fallbackResult.el);
96
+ hydrationSucceeded = true;
97
+ }
98
+ catch {
99
+ // Both hydration and fallback failed — restore SSR content
100
+ // so the user at least sees the server-rendered page
101
+ target.innerHTML = ssrSnapshot;
102
+ }
103
+ }
104
+ else {
105
+ // No error handler — re-throw (caller's responsibility)
106
+ throw error;
107
+ }
108
+ }
109
+ finally {
110
+ // Always clean up the hydrating flag.
111
+ // In the error path this is a harmless no-op (already deleted above).
112
+ delete globalThis.__PITHY_HYDRATING__;
113
+ }
114
+ // ── Post-hydration work ────────────────────────────────────────────
115
+ // Isolated from the hydration try/catch so a throwing onHydrated or
116
+ // dispatchEvent won't trigger SSR rollback. At this point the DOM is
117
+ // already live and interactive.
118
+ if (hydrationSucceeded) {
119
+ Reflect.set(window, HYDRATED_FLAG, true);
120
+ window.dispatchEvent(new CustomEvent('pithy:hydrated'));
121
+ if (onHydrated) {
122
+ onHydrated();
123
+ }
124
+ }
125
+ }
126
+ /**
127
+ * Read serialized state from window
128
+ *
129
+ * @returns Serialized state or undefined if not present
130
+ *
131
+ * @example
132
+ * ```ts
133
+ * const state = readState();
134
+ * if (state) {
135
+ * console.log('SSR state found:', state.url);
136
+ * }
137
+ * ```
138
+ */
139
+ export function readState() {
140
+ if (typeof window === 'undefined') {
141
+ return undefined;
142
+ }
143
+ return Reflect.get(window, STATE_VAR_NAME);
144
+ }
145
+ /**
146
+ * Check if the app is running in SSR hydration mode
147
+ *
148
+ * @returns True if state exists and app is hydrating
149
+ */
150
+ export function isHydrating() {
151
+ if (typeof window === 'undefined') {
152
+ return false;
153
+ }
154
+ return (Reflect.get(window, STATE_VAR_NAME) !== undefined &&
155
+ Reflect.get(window, HYDRATED_FLAG) !== true);
156
+ }
157
+ /**
158
+ * Check if hydration has completed
159
+ *
160
+ * @returns True if hydration is complete
161
+ */
162
+ export function isHydrated() {
163
+ if (typeof window === 'undefined') {
164
+ return false;
165
+ }
166
+ return Reflect.get(window, HYDRATED_FLAG) === true;
167
+ }
168
+ //# sourceMappingURL=hydrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydrate.js","sourceRoot":"","sources":["../../src/client/hydrate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,cAAc,EACd,aAAa,EACb,WAAW,GAGZ,MAAM,oBAAoB,CAAC;AAE5B,8DAA8D;AAC9D,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE1C,oJAAoJ;AACpJ;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,OAAO,CAAC,GAAc,EAAE,OAAuB;IAC7D,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAEhD,2CAA2C;IAC3C,MAAM,KAAK,GAAgC,OAAO,CAAC,KAAK,IAAI,SAAS,EAAE,CAAC;IAExE,wEAAwE;IACxE,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC,gDAAg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OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,CAAgC,CAAC;AAC5E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW;IACzB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,KAAK,SAAS;QACjD,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,IAAI,CAC5C,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU;IACxB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,IAAI,CAAC;AACrD,CAAC","sourcesContent":["/**\n * @pithyjs/ssr/client - Hydration implementation\n *\n * Extracted from index.ts to break the circular dependency\n * between bootstrap.ts ↔ index.ts.\n */\n\nimport type { Component } from '@pithyjs/core';\nimport {\n STATE_VAR_NAME,\n HYDRATED_FLAG,\n SSR_VERSION,\n type HydrateOptions,\n type SerializedState,\n} from '../shared/types.js';\n\n/** Max age for state before it's considered stale (1 hour) */\nconst STALE_THRESHOLD_MS = 60 * 60 * 1000;\n\n/** @codexApi {\"parent\":\"pithy.ssr.client\",\"name\":\"hydrate\",\"stability\":\"stable\",\"signature\":\"(App: Component, options: HydrateOptions) => void\"} */\n/**\n * Hydrate SSR'd HTML with interactivity\n *\n * Uses a replay approach: re-runs the App component and replaces the SSR\n * content with the hydrated component tree, attaching event listeners and\n * signal reactivity.\n *\n * @param App - The root component to hydrate with\n * @param options - Hydration options including target element\n *\n * @example\n * ```ts\n * import { hydrate, readState } from '@pithyjs/ssr/client';\n * import App from './App';\n *\n * hydrate(App, {\n * target: document.getElementById('app')!,\n * state: readState(),\n * onHydrated: () => console.log('Hydrated!'),\n * onError: (err) => console.error('Hydration failed:', err),\n * });\n * ```\n */\nexport function hydrate(App: Component, options: HydrateOptions): void {\n const { target, onHydrated, onError } = options;\n\n // Resolve state: explicit > window > empty\n const state: SerializedState | undefined = options.state ?? readState();\n\n // ── Guard: already hydrated ──────────────────────────────────────────\n if (Reflect.get(window, HYDRATED_FLAG) === true) {\n console.warn('[PithyJS SSR] App already hydrated — skipping.');\n return;\n }\n\n // ── Warnings ─────────────────────────────────────────────────────────\n if (state) {\n // Version mismatch\n if (state.version !== SSR_VERSION) {\n console.warn(\n `[PithyJS SSR] State version mismatch: state=\"${state.version}\", client=\"${SSR_VERSION}\". ` +\n 'Hydration may produce unexpected results.'\n );\n }\n\n // Stale state\n if (state.timestamp && Date.now() - state.timestamp > STALE_THRESHOLD_MS) {\n console.warn(\n '[PithyJS SSR] Serialized state is stale (older than 1 hour). ' +\n 'Consider refreshing the page.'\n );\n }\n }\n\n // ── Make resolved state available globally for App and helpers ───────\n if (state) {\n Reflect.set(window, STATE_VAR_NAME, state);\n }\n\n // ── Save SSR content for rollback on error ───────────────────────────\n const ssrSnapshot = target.innerHTML;\n\n // ── Set hydrating flag ───────────────────────────────────────────────\n (globalThis as Record<string, unknown>).__PITHY_HYDRATING__ = true;\n\n let hydrationSucceeded = false;\n\n try {\n // 1. Run the App component (replay approach)\n const componentResult = App();\n\n // 2. Clear existing SSR content and mount hydrated tree\n target.innerHTML = '';\n target.appendChild(componentResult.el);\n\n hydrationSucceeded = true;\n } catch (err: unknown) {\n // Clean up the hydrating flag BEFORE fallback attempt\n // Fallback is a fresh client render, not a hydration\n delete (globalThis as Record<string, unknown>).__PITHY_HYDRATING__;\n\n // Restore SSR content first (safety net)\n target.innerHTML = ssrSnapshot;\n\n // Normalize error\n const error = err instanceof Error ? err : new Error(String(err));\n\n if (onError) {\n // onError is wrapped in try/catch so a throwing callback\n // doesn't prevent the fallback remount from running.\n try {\n onError(error);\n } catch {\n // Swallow — the caller's error handler itself threw.\n // We still proceed with the fallback remount below.\n }\n\n // Attempt full client remount as recovery\n try {\n const fallbackResult = App();\n target.innerHTML = '';\n target.appendChild(fallbackResult.el);\n\n hydrationSucceeded = true;\n } catch {\n // Both hydration and fallback failed — restore SSR content\n // so the user at least sees the server-rendered page\n target.innerHTML = ssrSnapshot;\n }\n } else {\n // No error handler — re-throw (caller's responsibility)\n throw error;\n }\n } finally {\n // Always clean up the hydrating flag.\n // In the error path this is a harmless no-op (already deleted above).\n delete (globalThis as Record<string, unknown>).__PITHY_HYDRATING__;\n }\n\n // ── Post-hydration work ────────────────────────────────────────────\n // Isolated from the hydration try/catch so a throwing onHydrated or\n // dispatchEvent won't trigger SSR rollback. At this point the DOM is\n // already live and interactive.\n if (hydrationSucceeded) {\n Reflect.set(window, HYDRATED_FLAG, true);\n window.dispatchEvent(new CustomEvent('pithy:hydrated'));\n if (onHydrated) {\n onHydrated();\n }\n }\n}\n\n/**\n * Read serialized state from window\n *\n * @returns Serialized state or undefined if not present\n *\n * @example\n * ```ts\n * const state = readState();\n * if (state) {\n * console.log('SSR state found:', state.url);\n * }\n * ```\n */\nexport function readState(): SerializedState | undefined {\n if (typeof window === 'undefined') {\n return undefined;\n }\n return Reflect.get(window, STATE_VAR_NAME) as SerializedState | undefined;\n}\n\n/**\n * Check if the app is running in SSR hydration mode\n *\n * @returns True if state exists and app is hydrating\n */\nexport function isHydrating(): boolean {\n if (typeof window === 'undefined') {\n return false;\n }\n return (\n Reflect.get(window, STATE_VAR_NAME) !== undefined &&\n Reflect.get(window, HYDRATED_FLAG) !== true\n );\n}\n\n/**\n * Check if hydration has completed\n *\n * @returns True if hydration is complete\n */\nexport function isHydrated(): boolean {\n if (typeof window === 'undefined') {\n return false;\n }\n return Reflect.get(window, HYDRATED_FLAG) === true;\n}\n"]}
@@ -0,0 +1,21 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.ssr.client",
4
+ "title": "SSR Client Hydration",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ /**
9
+ * @pithyjs/ssr/client - Client-side hydration exports
10
+ *
11
+ * Import from '@pithyjs/ssr/client' for client-side code.
12
+ * This module is designed to be small for minimal bundle impact.
13
+ */
14
+ export type { HydrateOptions, SerializedState } from '../shared/types.js';
15
+ export type { PithyConfig } from '@pithyjs/shared';
16
+ export type { BootstrapOptions } from './bootstrap.js';
17
+ export { defineConfig } from '@pithyjs/shared';
18
+ export { STATE_VAR_NAME, HYDRATED_FLAG, SSR_VERSION } from '../shared/types.js';
19
+ export { bootstrap } from './bootstrap.js';
20
+ export { hydrate, readState, isHydrating, isHydrated } from './hydrate.js';
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;GAKG;AAGH,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1E,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGhF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,16 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.ssr.client",
4
+ "title": "SSR Client Hydration",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ // Config helper
9
+ export { defineConfig } from '@pithyjs/shared';
10
+ // Constants
11
+ export { STATE_VAR_NAME, HYDRATED_FLAG, SSR_VERSION } from '../shared/types.js';
12
+ // Bootstrap (imports from ./hydrate.js, not from this file — no circular dep)
13
+ export { bootstrap } from './bootstrap.js';
14
+ // Client API (hydration functions live in hydrate.ts)
15
+ export { hydrate, readState, isHydrating, isHydrated } from './hydrate.js';
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAcF,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,YAAY;AACZ,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEhF,8EAA8E;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,sDAAsD;AACtD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.ssr.client\",\n \"title\": \"SSR Client Hydration\",\n \"category\": \"runtime\"\n}\n*/\n\n/**\n * @pithyjs/ssr/client - Client-side hydration exports\n *\n * Import from '@pithyjs/ssr/client' for client-side code.\n * This module is designed to be small for minimal bundle impact.\n */\n\n// Types\nexport type { HydrateOptions, SerializedState } from '../shared/types.js';\nexport type { PithyConfig } from '@pithyjs/shared';\nexport type { BootstrapOptions } from './bootstrap.js';\n\n// Config helper\nexport { defineConfig } from '@pithyjs/shared';\n\n// Constants\nexport { STATE_VAR_NAME, HYDRATED_FLAG, SSR_VERSION } from '../shared/types.js';\n\n// Bootstrap (imports from ./hydrate.js, not from this file — no circular dep)\nexport { bootstrap } from './bootstrap.js';\n\n// Client API (hydration functions live in hydrate.ts)\nexport { hydrate, readState, isHydrating, isHydrated } from './hydrate.js';\n"]}
@@ -0,0 +1,32 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.ssr",
4
+ "title": "Server-Side Rendering",
5
+ "category": "feature"
6
+ }
7
+ */
8
+ /**
9
+ * @pithyjs/ssr - Server-Side Rendering for PithyJS
10
+ *
11
+ * Main entry point exporting types and shared utilities.
12
+ *
13
+ * For server-side code, import from '@pithyjs/ssr/server':
14
+ * ```ts
15
+ * import { renderToString, htmlShell } from '@pithyjs/ssr/server';
16
+ * ```
17
+ *
18
+ * For client-side code, import from '@pithyjs/ssr/client':
19
+ * ```ts
20
+ * import { hydrate, readState } from '@pithyjs/ssr/client';
21
+ * ```
22
+ */
23
+ export type { CrossOrigin, FetchPriority, ReferrerPolicy, LinkTarget, HeadConfig, HeadState, MetaTag, LinkTag, ScriptTag, BaseTag, SSRContext, SSREnvironment, RenderResult, RenderTiming, SerializedState, HydrateOptions, ShellOptions, PreloadHint, SSGResult, } from './shared/types.js';
24
+ export { SSR_VERSION, STATE_VAR_NAME, HYDRATED_FLAG, DEFAULT_APP_ID, } from './shared/types.js';
25
+ export { head, renderHead, renderHtmlAttrs } from './shared/head.js';
26
+ /**
27
+ * Create empty head state
28
+ *
29
+ * @returns Empty head state object
30
+ */
31
+ export declare function createEmptyHeadState(): import('./shared/types.js').HeadState;
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;;;;;;;;;;GAcG;AAMH,YAAY,EAEV,WAAW,EACX,aAAa,EACb,cAAc,EACd,UAAU,EAGV,UAAU,EACV,SAAS,EACT,OAAO,EACP,OAAO,EACP,SAAS,EACT,OAAO,EAGP,UAAU,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EAGZ,eAAe,EACf,cAAc,EAGd,YAAY,EACZ,WAAW,EAGX,SAAS,GACV,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,WAAW,EACX,cAAc,EACd,aAAa,EACb,cAAc,GACf,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAErE;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,mBAAmB,EAAE,SAAS,CAS5E"}
package/dist/index.js ADDED
@@ -0,0 +1,31 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.ssr",
4
+ "title": "Server-Side Rendering",
5
+ "category": "feature"
6
+ }
7
+ */
8
+ // =============================================================================
9
+ // Constants
10
+ // =============================================================================
11
+ export { SSR_VERSION, STATE_VAR_NAME, HYDRATED_FLAG, DEFAULT_APP_ID, } from './shared/types.js';
12
+ // =============================================================================
13
+ // Shared Head API (works on both server and client)
14
+ // =============================================================================
15
+ export { head, renderHead, renderHtmlAttrs } from './shared/head.js';
16
+ /**
17
+ * Create empty head state
18
+ *
19
+ * @returns Empty head state object
20
+ */
21
+ export function createEmptyHeadState() {
22
+ return {
23
+ title: '',
24
+ meta: [],
25
+ link: [],
26
+ script: [],
27
+ htmlAttrs: {},
28
+ bodyAttrs: {},
29
+ };
30
+ }
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAuDF,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,OAAO,EACL,WAAW,EACX,cAAc,EACd,aAAa,EACb,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,gFAAgF;AAChF,oDAAoD;AACpD,gFAAgF;AAEhF,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAErE;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,EAAE;QACV,SAAS,EAAE,EAAE;QACb,SAAS,EAAE,EAAE;KACd,CAAC;AACJ,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.ssr\",\n \"title\": \"Server-Side Rendering\",\n \"category\": \"feature\"\n}\n*/\n\n/**\n * @pithyjs/ssr - Server-Side Rendering for PithyJS\n *\n * Main entry point exporting types and shared utilities.\n *\n * For server-side code, import from '@pithyjs/ssr/server':\n * ```ts\n * import { renderToString, htmlShell } from '@pithyjs/ssr/server';\n * ```\n *\n * For client-side code, import from '@pithyjs/ssr/client':\n * ```ts\n * import { hydrate, readState } from '@pithyjs/ssr/client';\n * ```\n */\n\n// =============================================================================\n// Types - All types are available from main entry\n// =============================================================================\n\nexport type {\n // Utility types\n CrossOrigin,\n FetchPriority,\n ReferrerPolicy,\n LinkTarget,\n\n // Head/SEO types\n HeadConfig,\n HeadState,\n MetaTag,\n LinkTag,\n ScriptTag,\n BaseTag,\n\n // SSR types\n SSRContext,\n SSREnvironment,\n RenderResult,\n RenderTiming,\n\n // Hydration types\n SerializedState,\n HydrateOptions,\n\n // Shell types\n ShellOptions,\n PreloadHint,\n\n // SSG types\n SSGResult,\n} from './shared/types.js';\n\n// =============================================================================\n// Constants\n// =============================================================================\n\nexport {\n SSR_VERSION,\n STATE_VAR_NAME,\n HYDRATED_FLAG,\n DEFAULT_APP_ID,\n} from './shared/types.js';\n\n// =============================================================================\n// Shared Head API (works on both server and client)\n// =============================================================================\n\nexport { head, renderHead, renderHtmlAttrs } from './shared/head.js';\n\n/**\n * Create empty head state\n *\n * @returns Empty head state object\n */\nexport function createEmptyHeadState(): import('./shared/types.js').HeadState {\n return {\n title: '',\n meta: [],\n link: [],\n script: [],\n htmlAttrs: {},\n bodyAttrs: {},\n };\n}\n"]}
@@ -0,0 +1,166 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.ssr.server.app",
4
+ "title": "PithyApp SSR Application",
5
+ "category": "runtime"
6
+ }
7
+ */
8
+ /**
9
+ * @pithyjs/ssr - PithyApp
10
+ *
11
+ * Web Standard `Request → Response` boundary that wraps the SSR pipeline
12
+ * (`renderRoute()` + `htmlShell()`) into a single embeddable SSR engine.
13
+ *
14
+ * This is the public API layer that framework adapters (Node.js, serverless)
15
+ * and `@pithyjs/server` (V0.2) will consume.
16
+ *
17
+ * ## Usage
18
+ *
19
+ * ```typescript
20
+ * import { createApp } from '@pithyjs/ssr/server';
21
+ *
22
+ * const app = createApp({
23
+ * routes,
24
+ * App,
25
+ * entryClient: '/entry-client.js',
26
+ * });
27
+ *
28
+ * // Add middleware
29
+ * app.use(async (request, next) => {
30
+ * const start = Date.now();
31
+ * const response = await next();
32
+ * console.log(`${request.url} took ${Date.now() - start}ms`);
33
+ * return response;
34
+ * });
35
+ *
36
+ * // Handle a request
37
+ * const response = await app.render(new Request('http://localhost/'));
38
+ * ```
39
+ */
40
+ import type { Component } from '@pithyjs/core';
41
+ import type { RouteNode } from '@pithyjs/router';
42
+ import type { HeadState, PreloadHint } from '../shared/types.js';
43
+ import { type SSRWorkerPoolOptions } from './worker-pool.js';
44
+ /**
45
+ * Options for creating a PithyApp instance
46
+ */
47
+ export interface PithyAppOptions {
48
+ /** Route tree from the router manifest */
49
+ routes: RouteNode[];
50
+ /** The root component to render */
51
+ App: Component;
52
+ /** Client entry script path (included in HTML via <script type="module">) */
53
+ entryClient: string;
54
+ /** Stylesheet URLs to include in the HTML */
55
+ styles?: string[];
56
+ /** Resource preload hints */
57
+ preloads?: PreloadHint[];
58
+ /** Default head state merged with per-route head() calls */
59
+ defaultHead?: Partial<HeadState>;
60
+ /** App container element ID (default: 'app') */
61
+ appId?: string;
62
+ /** Enable worker pool for concurrent rendering (true for defaults, or SSRWorkerPoolOptions) */
63
+ workerPool?: boolean | SSRWorkerPoolOptions;
64
+ /** Loader execution timeout in milliseconds (default: 30000) */
65
+ loaderTimeout?: number;
66
+ /** Whether to continue rendering after a loader error (default: false) */
67
+ continueOnError?: boolean;
68
+ /** Path to the App component module (required when workerPool is enabled) */
69
+ componentPath?: string;
70
+ /** Path to the route manifest module (recommended when workerPool is enabled for full pipeline rendering) */
71
+ routeManifestPath?: string;
72
+ }
73
+ /**
74
+ * Koa-style onion middleware for request/response interception
75
+ */
76
+ export type PithyMiddleware = (request: Request, next: () => Promise<Response>) => Promise<Response>;
77
+ /** @codexApi {"parent":"pithy.ssr.server.app","name":"PithyApp","stability":"experimental","signature":"class PithyApp"} */
78
+ /**
79
+ * Web Standard SSR application.
80
+ *
81
+ * Wraps the full SSR pipeline (`renderRoute()` + `htmlShell()`) behind a
82
+ * `Request → Response` interface with middleware support.
83
+ */
84
+ export declare class PithyApp {
85
+ private readonly options;
86
+ private readonly middlewares;
87
+ private readonly pool;
88
+ private isShutdown;
89
+ constructor(options: PithyAppOptions);
90
+ /** @codexApi {"parent":"pithy.ssr.server.app","name":"use","stability":"experimental","signature":"(middleware: PithyMiddleware) => this"} */
91
+ /**
92
+ * Add a middleware to the chain.
93
+ *
94
+ * Middlewares execute in registration order (first added = outermost).
95
+ * Each middleware receives the request and a `next()` function to call
96
+ * the next middleware or the core render.
97
+ *
98
+ * @returns this (for chaining)
99
+ */
100
+ use(middleware: PithyMiddleware): this;
101
+ /** @codexApi {"parent":"pithy.ssr.server.app","name":"render","stability":"experimental","signature":"(request: Request) => Promise<Response>"} */
102
+ /**
103
+ * Render a request to a Response.
104
+ *
105
+ * Executes the middleware chain, then the core render pipeline.
106
+ * Returns a 500 Response for unhandled runtime errors.
107
+ * Throws if called after shutdown() (programming error).
108
+ *
109
+ * @param request - Web Standard Request
110
+ * @returns Web Standard Response with rendered HTML
111
+ */
112
+ render(request: Request): Promise<Response>;
113
+ /**
114
+ * Core render pipeline: URL → renderRoute/pool → redirect or htmlShell → Response
115
+ */
116
+ private coreRender;
117
+ /** @codexApi {"parent":"pithy.ssr.server.app","name":"warmup","stability":"experimental","signature":"() => Promise<void>"} */
118
+ /**
119
+ * Warm up the application.
120
+ *
121
+ * Currently a no-op (the worker pool initializes in the constructor).
122
+ * Reserved for future use (e.g., pre-compiling routes, warming caches).
123
+ */
124
+ warmup(): Promise<void>;
125
+ /** @codexApi {"parent":"pithy.ssr.server.app","name":"shutdown","stability":"experimental","signature":"() => Promise<void>"} */
126
+ /**
127
+ * Shut down the application and release resources.
128
+ *
129
+ * Safe to call multiple times.
130
+ */
131
+ shutdown(): Promise<void>;
132
+ /** @codexApi {"parent":"pithy.ssr.server.app","name":"getStats","stability":"experimental","signature":"() => WorkerPoolStats | undefined"} */
133
+ /**
134
+ * Get worker pool statistics.
135
+ *
136
+ * @returns Pool stats if worker pool is enabled, undefined otherwise
137
+ */
138
+ getStats(): {
139
+ totalWorkers: number;
140
+ availableWorkers: number;
141
+ pendingRequests: number;
142
+ queuedRequests: number;
143
+ } | undefined;
144
+ }
145
+ /** @codexApi {"parent":"pithy.ssr.server.app","name":"createApp","stability":"experimental","signature":"(options: PithyAppOptions) => PithyApp"} */
146
+ /**
147
+ * Create a new PithyApp instance.
148
+ *
149
+ * @param options - Application configuration
150
+ * @returns A new PithyApp instance
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * const app = createApp({
155
+ * routes,
156
+ * App,
157
+ * entryClient: '/entry-client.js',
158
+ * styles: ['/styles.css'],
159
+ * defaultHead: { title: 'My App' },
160
+ * });
161
+ *
162
+ * const response = await app.render(new Request('http://localhost/'));
163
+ * ```
164
+ */
165
+ export declare function createApp(options: PithyAppOptions): PithyApp;
166
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/server/app.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjE,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAM5E;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,MAAM,EAA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