reroute-js 0.42.0 → 0.43.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 (186) hide show
  1. package/cli/bin.d.ts +1 -1
  2. package/cli/bin.js +183 -25
  3. package/cli/bin.js.map +6 -6
  4. package/cli/index.d.ts +1 -1
  5. package/cli/index.js +4 -4
  6. package/cli/index.js.map +1 -1
  7. package/cli/src/cli.d.ts +1 -1
  8. package/cli/src/commands/analyze.d.ts +1 -1
  9. package/cli/src/commands/build.d.ts +1 -1
  10. package/cli/src/commands/dev.d.ts +1 -1
  11. package/cli/src/commands/gen.d.ts +1 -1
  12. package/cli/src/commands/index.d.ts +1 -1
  13. package/cli/src/commands/init.d.ts +1 -1
  14. package/cli/src/commands/lib/assets.d.ts +1 -1
  15. package/cli/src/commands/lib/bundler.d.ts +1 -1
  16. package/cli/src/commands/lib/command.d.ts +1 -1
  17. package/cli/src/commands/lib/env.d.ts +1 -1
  18. package/cli/src/commands/lib/index.d.ts +1 -1
  19. package/cli/src/commands/lib/log.d.ts +1 -1
  20. package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
  21. package/cli/src/commands/lib/markdown/index.d.ts +1 -1
  22. package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
  23. package/cli/src/commands/lib/production.d.ts +1 -1
  24. package/cli/src/commands/lib/server.d.ts +1 -1
  25. package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
  26. package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
  27. package/cli/src/commands/lib/tailwind.d.ts +1 -1
  28. package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
  29. package/cli/src/commands/lib/version.d.ts +1 -1
  30. package/cli/src/commands/og.d.ts +1 -1
  31. package/cli/src/commands/start.d.ts +1 -1
  32. package/cli/src/index.d.ts +1 -1
  33. package/core/index.d.ts +1 -1
  34. package/core/index.js +179 -21
  35. package/core/index.js.map +6 -6
  36. package/core/src/bundler/hash.d.ts +1 -1
  37. package/core/src/bundler/index.d.ts +1 -1
  38. package/core/src/config.d.ts +81 -5
  39. package/core/src/config.d.ts.map +1 -1
  40. package/core/src/content/discovery.d.ts +1 -1
  41. package/core/src/content/index.d.ts +1 -1
  42. package/core/src/content/metadata.d.ts +1 -1
  43. package/core/src/index.d.ts +1 -1
  44. package/core/src/llms/extractor.d.ts +1 -1
  45. package/core/src/llms/formatter.d.ts +1 -1
  46. package/core/src/llms/full-generator.d.ts +1 -1
  47. package/core/src/llms/index-generator.d.ts +1 -1
  48. package/core/src/llms/index.d.ts +1 -1
  49. package/core/src/og/discovery.d.ts +1 -1
  50. package/core/src/og/index.d.ts +1 -1
  51. package/core/src/og/meta.d.ts +1 -1
  52. package/core/src/og/render.d.ts +1 -1
  53. package/core/src/og/types.d.ts +1 -1
  54. package/core/src/robots/discovery.d.ts +1 -1
  55. package/core/src/robots/generator.d.ts +1 -1
  56. package/core/src/robots/index.d.ts +1 -1
  57. package/core/src/robots/policies.d.ts +1 -1
  58. package/core/src/rss/discovery.d.ts +1 -1
  59. package/core/src/rss/generator.d.ts +1 -1
  60. package/core/src/rss/index.d.ts +1 -1
  61. package/core/src/sitemap/discovery.d.ts +1 -1
  62. package/core/src/sitemap/generator.d.ts +1 -1
  63. package/core/src/sitemap/index.d.ts +1 -1
  64. package/core/src/ssr/index.d.ts +1 -1
  65. package/core/src/ssr/lib/cache.d.ts +1 -1
  66. package/core/src/ssr/lib/collections.d.ts +1 -1
  67. package/core/src/ssr/lib/compression.d.ts +1 -1
  68. package/core/src/ssr/lib/compute/content.d.ts +1 -1
  69. package/core/src/ssr/lib/compute/index.d.ts +1 -1
  70. package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
  71. package/core/src/ssr/lib/compute/routes.d.ts +1 -1
  72. package/core/src/ssr/lib/data.d.ts +1 -1
  73. package/core/src/ssr/lib/html.d.ts +1 -1
  74. package/core/src/ssr/lib/imports.d.ts +1 -1
  75. package/core/src/ssr/lib/index.d.ts +1 -1
  76. package/core/src/ssr/lib/layouts.d.ts +1 -1
  77. package/core/src/ssr/lib/metadata.d.ts +1 -1
  78. package/core/src/ssr/lib/metadata.d.ts.map +1 -1
  79. package/core/src/ssr/lib/mime.d.ts +1 -1
  80. package/core/src/ssr/lib/modules.d.ts +1 -1
  81. package/core/src/ssr/lib/path.d.ts +1 -1
  82. package/core/src/ssr/lib/preload.d.ts +1 -1
  83. package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
  84. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  85. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  86. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  87. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  88. package/core/src/ssr/lib/seed.d.ts +1 -1
  89. package/core/src/ssr/lib/serialize.d.ts +1 -1
  90. package/core/src/ssr/lib/setup.d.ts +4 -1
  91. package/core/src/ssr/lib/setup.d.ts.map +1 -1
  92. package/core/src/ssr/lib/styles.d.ts +1 -1
  93. package/core/src/ssr/lib/template.d.ts +1 -1
  94. package/core/src/ssr/lib/types.d.ts +3 -1
  95. package/core/src/ssr/lib/types.d.ts.map +1 -1
  96. package/core/src/ssr/render.d.ts +1 -1
  97. package/core/src/ssr/stream.d.ts +1 -1
  98. package/core/src/ssr/stream.d.ts.map +1 -1
  99. package/elysia/index.d.ts +1 -1
  100. package/elysia/index.js +235 -58
  101. package/elysia/index.js.map +8 -8
  102. package/elysia/src/index.d.ts +1 -1
  103. package/elysia/src/libs/assets.d.ts +1 -1
  104. package/elysia/src/libs/cache.d.ts +1 -1
  105. package/elysia/src/libs/caching.d.ts +1 -1
  106. package/elysia/src/libs/http.d.ts +1 -1
  107. package/elysia/src/libs/image.d.ts +1 -1
  108. package/elysia/src/libs/index.d.ts +1 -1
  109. package/elysia/src/libs/llms.d.ts +1 -1
  110. package/elysia/src/libs/response.d.ts +1 -1
  111. package/elysia/src/libs/serving.d.ts +1 -1
  112. package/elysia/src/plugin.d.ts +1 -1
  113. package/elysia/src/plugin.d.ts.map +1 -1
  114. package/elysia/src/routes/artifacts.d.ts +1 -1
  115. package/elysia/src/routes/content.d.ts +1 -1
  116. package/elysia/src/routes/image.d.ts +1 -1
  117. package/elysia/src/routes/index.d.ts +1 -1
  118. package/elysia/src/routes/internal.d.ts +1 -1
  119. package/elysia/src/routes/llms.d.ts +1 -1
  120. package/elysia/src/routes/og.d.ts +1 -1
  121. package/elysia/src/routes/redirects.d.ts +1 -1
  122. package/elysia/src/routes/robots.d.ts +1 -1
  123. package/elysia/src/routes/rss.d.ts +1 -1
  124. package/elysia/src/routes/search.d.ts +1 -1
  125. package/elysia/src/routes/sitemap.d.ts +1 -1
  126. package/elysia/src/routes/ssr.d.ts +6 -3
  127. package/elysia/src/routes/ssr.d.ts.map +1 -1
  128. package/elysia/src/routes/static.d.ts +1 -1
  129. package/elysia/src/types.d.ts +1 -1
  130. package/package.json +1 -1
  131. package/react/index.d.ts +1 -1
  132. package/react/index.js +17 -5
  133. package/react/index.js.map +3 -3
  134. package/react/src/components/ClientOnly.d.ts +1 -1
  135. package/react/src/components/ContentRoute.d.ts +1 -1
  136. package/react/src/components/Image.d.ts +1 -1
  137. package/react/src/components/LazyRoute.d.ts +1 -1
  138. package/react/src/components/Link.d.ts +1 -1
  139. package/react/src/components/Markdown.d.ts +1 -1
  140. package/react/src/components/Outlet.d.ts +1 -1
  141. package/react/src/components/index.d.ts +1 -1
  142. package/react/src/hooks/index.d.ts +1 -1
  143. package/react/src/hooks/useContent.d.ts +1 -1
  144. package/react/src/hooks/useData.d.ts +1 -1
  145. package/react/src/hooks/useFeed.d.ts +1 -1
  146. package/react/src/hooks/useLayoutData.d.ts +1 -1
  147. package/react/src/hooks/useLlms.d.ts +1 -1
  148. package/react/src/hooks/useNavigate.d.ts +1 -1
  149. package/react/src/hooks/useParams.d.ts +1 -1
  150. package/react/src/hooks/useRouter.d.ts +1 -1
  151. package/react/src/hooks/useSearch.d.ts +1 -1
  152. package/react/src/hooks/useSearchParams.d.ts +1 -1
  153. package/react/src/hooks/useToc.d.ts +1 -1
  154. package/react/src/index.d.ts +1 -1
  155. package/react/src/lib/collection.d.ts +1 -1
  156. package/react/src/lib/content.d.ts +1 -1
  157. package/react/src/lib/head.d.ts +1 -1
  158. package/react/src/lib/index.d.ts +1 -1
  159. package/react/src/lib/lazy-route.d.ts +1 -1
  160. package/react/src/lib/route-loader.d.ts +1 -1
  161. package/react/src/providers/ContentProvider.d.ts +1 -1
  162. package/react/src/providers/RerouteProvider.d.ts +1 -1
  163. package/react/src/providers/RouterProvider.d.ts +1 -1
  164. package/react/src/providers/RouterProvider.d.ts.map +1 -1
  165. package/react/src/providers/index.d.ts +1 -1
  166. package/react/src/types/any.d.ts +1 -1
  167. package/react/src/types/index.d.ts +1 -1
  168. package/react/src/types/router.d.ts +1 -1
  169. package/telemetry/react.d.ts +1 -1
  170. package/telemetry/react.js +2 -2
  171. package/telemetry/react.js.map +1 -1
  172. package/telemetry/server.d.ts +1 -1
  173. package/telemetry/server.js +2 -2
  174. package/telemetry/server.js.map +6 -6
  175. package/telemetry/src/react/api.d.ts +1 -1
  176. package/telemetry/src/react/context.d.ts +1 -1
  177. package/telemetry/src/react/index.d.ts +1 -1
  178. package/telemetry/src/react/telemetry.d.ts +1 -1
  179. package/telemetry/src/server/context.d.ts +1 -1
  180. package/telemetry/src/server/headers/extractor.d.ts +1 -1
  181. package/telemetry/src/server/headers/index.d.ts +1 -1
  182. package/telemetry/src/server/headers/presets.d.ts +1 -1
  183. package/telemetry/src/server/index.d.ts +1 -1
  184. package/telemetry/src/server/instrumentation.d.ts +1 -1
  185. package/telemetry/src/server/plugin.d.ts +1 -1
  186. package/telemetry/src/server/sourcemap.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.42.0
2
+ * reroute-js v0.43.0
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -98,6 +98,8 @@ type MetadataResult = {
98
98
  perPageHead: string;
99
99
  pageLang?: string;
100
100
  statusOverride?: number;
101
+ /** SSR export for dynamic head generation at stream end */
102
+ ssrExport?: SSR;
101
103
  };
102
104
  /**
103
105
  * Cache entry structure
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/ssr/lib/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,KAAK,GAAG,GAAG,GAAG,CAAC;AAEf;;GAEG;AACH,KAAK,eAAe,GAAG;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,KAAK,UAAU,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE;QACR,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACb,EAAE,CAAC;CACJ,CAAC;AAEF;;GAEG;AACH,KAAK,WAAW,GAAG;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,KAAK,cAAc,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;GAEG;AACH,KAAK,iB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ChB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,KAAK,GAAG,CAAC,QAAQ,GAAG,OAAO,IAAI;IAC9B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE7D;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,MAAM,CAAC,CAAC;IAE3E;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,YAAY,EACX,GAAG,EACH,eAAe,EACf,UAAU,EACV,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,aAAa,EACb,SAAS,EACT,UAAU,EACV,UAAU,EACV,cAAc,EACd,GAAG,GACH,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/ssr/lib/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,KAAK,GAAG,GAAG,GAAG,CAAC;AAEf;;GAEG;AACH,KAAK,eAAe,GAAG;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,KAAK,UAAU,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE;QACR,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM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Aa,EACb,SAAS,EACT,UAAU,EACV,UAAU,EACV,cAAc,EACd,GAAG,GACH,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.42.0
2
+ * reroute-js v0.43.0
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.42.0
2
+ * reroute-js v0.43.0
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/ssr/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAOxD,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAiB5E,KAAK,mBAAmB,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,YAAY,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,YAA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,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACzB,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,iBAAe,uBAAuB,CACrC,OAAO,EAAE,mBAAmB,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CA2K7B;AAkYD,OAAO,EAAE,uBAAuB,EAAE,CAAC;AACnC,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC"}
package/elysia/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.42.0
2
+ * reroute-js v0.43.0
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
package/elysia/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.42.0
2
+ * reroute-js v0.43.0
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1908,7 +1908,12 @@ ${ogMetaTags}`;
1908
1908
  if (routeResult.lang)
1909
1909
  pageLang = routeResult.lang;
1910
1910
  statusOverride = routeResult.statusOverride;
1911
- return { perPageHead, pageLang, statusOverride };
1911
+ return {
1912
+ perPageHead,
1913
+ pageLang,
1914
+ statusOverride,
1915
+ ssrExport: routeResult.ssrExport
1916
+ };
1912
1917
  }
1913
1918
  async function processLayoutForMetadata(layout, clientDir, isWatchMode, addHead, setLang, ogConfig) {
1914
1919
  if (typeof layout?.path !== "string")
@@ -1919,7 +1924,7 @@ async function processLayoutForMetadata(layout, clientDir, isWatchMode, addHead,
1919
1924
  if (meta)
1920
1925
  addHead(buildHeadFromMeta(meta, ogConfig));
1921
1926
  if (ssr) {
1922
- const ssrHead = extractSSRHead(ssr);
1927
+ const ssrHead = extractSSRHead(ssr, undefined, ogConfig);
1923
1928
  if (ssrHead)
1924
1929
  addHead(`
1925
1930
  ${ssrHead}`);
@@ -1949,7 +1954,7 @@ function extractContentMetadata(pathname, addHead, setLang, ogConfig) {
1949
1954
  const meta = exp?.meta;
1950
1955
  const ssr = exp?.ssr;
1951
1956
  addHead(buildHeadFromMeta(meta, ogConfig));
1952
- const ssrHead = extractSSRHead(ssr);
1957
+ const ssrHead = extractSSRHead(ssr, undefined, ogConfig);
1953
1958
  if (ssrHead)
1954
1959
  addHead(`
1955
1960
  ${ssrHead}`);
@@ -1974,11 +1979,16 @@ async function extractMatchedRouteMetadata(pathname, clientDir, m, isWatchMode,
1974
1979
  head += buildHeadFromMeta(meta, ogConfig);
1975
1980
  if (ssr) {
1976
1981
  const routeData = ssrData && typeof ssrData === "object" ? ssrData[pathname] : undefined;
1977
- const ssrHead = extractSSRHead(ssr, routeData);
1982
+ const ssrHead = extractSSRHead(ssr, routeData, ogConfig, head);
1978
1983
  if (ssrHead)
1979
1984
  head += `
1980
1985
  ${ssrHead}`;
1981
- return { head, lang: extractSSRLang(ssr), statusOverride };
1986
+ return {
1987
+ head,
1988
+ lang: extractSSRLang(ssr),
1989
+ statusOverride,
1990
+ ssrExport: ssr
1991
+ };
1982
1992
  }
1983
1993
  return { head, statusOverride };
1984
1994
  } catch {}
@@ -1989,6 +1999,7 @@ async function extractRouteMetadata(pathname, clientDir, cwd, isWatchMode, curre
1989
1999
  let head = "";
1990
2000
  let lang;
1991
2001
  let statusOverride = currentStatusOverride;
2002
+ let ssrExport;
1992
2003
  try {
1993
2004
  const m = await loadRoutesModule(cwd, isWatchMode);
1994
2005
  if (!m) {
@@ -2005,13 +2016,14 @@ async function extractRouteMetadata(pathname, clientDir, cwd, isWatchMode, curre
2005
2016
  head = result.head;
2006
2017
  lang = result.lang;
2007
2018
  statusOverride = result.statusOverride;
2019
+ ssrExport = result.ssrExport;
2008
2020
  } else {
2009
2021
  head += await extractNotFoundMetadata(pathname, clientDir, m, isWatchMode, (l) => {
2010
2022
  lang = l;
2011
2023
  }, ogConfig);
2012
2024
  }
2013
2025
  } catch {}
2014
- return { head, lang, statusOverride };
2026
+ return { head, lang, statusOverride, ssrExport };
2015
2027
  }
2016
2028
  function findBestNotFoundRoute(list, pathname) {
2017
2029
  let chosen;
@@ -2040,7 +2052,7 @@ async function extractNotFoundMetadata(pathname, clientDir, routesModule, isWatc
2040
2052
  const { meta, ssr } = await loadModuleMetaAndSSR(chosen, abs, isWatchMode);
2041
2053
  if (meta)
2042
2054
  head += buildHeadFromMeta(meta, ogConfig);
2043
- const ssrHead = extractSSRHead(ssr);
2055
+ const ssrHead = extractSSRHead(ssr, undefined, ogConfig);
2044
2056
  if (ssrHead)
2045
2057
  head += `
2046
2058
  ${ssrHead}`;
@@ -2051,29 +2063,86 @@ ${ssrHead}`;
2051
2063
  } catch {}
2052
2064
  return head;
2053
2065
  }
2054
- function extractSSRHead(ssr, data) {
2066
+ function parseTitleFromHead(head) {
2067
+ const match = head.match(/<title[^>]*>(.*?)<\/title>/is);
2068
+ if (match?.[1])
2069
+ return unescapeHtml(match[1].trim());
2070
+ return;
2071
+ }
2072
+ function parseDescriptionFromHead(head) {
2073
+ let match = head.match(/<meta\s+name=["']description["']\s+content=["'](.+?)["']\s*\/?>/i);
2074
+ if (match?.[1])
2075
+ return unescapeHtml(match[1].trim());
2076
+ match = head.match(/<meta\s+content=["'](.+?)["']\s+name=["']description["']\s*\/?>/i);
2077
+ if (match?.[1])
2078
+ return unescapeHtml(match[1].trim());
2079
+ return;
2080
+ }
2081
+ function unescapeHtml(input) {
2082
+ return input.replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
2083
+ }
2084
+ function hasMetaTag(head, property) {
2085
+ const propRegex = new RegExp(`<meta\\s+(?:property|name)=["']${property}["']`, "i");
2086
+ const contentFirstRegex = new RegExp(`<meta\\s+content=["'][^"']*["']\\s+(?:property|name)=["']${property}["']`, "i");
2087
+ return propRegex.test(head) || contentFirstRegex.test(head);
2088
+ }
2089
+ function generateMissingOGTags(head, ogConfig) {
2090
+ const title = parseTitleFromHead(head);
2091
+ const description = parseDescriptionFromHead(head);
2092
+ const additionalTags = [];
2093
+ if (title && !hasMetaTag(head, "og:title")) {
2094
+ additionalTags.push(`<meta property="og:title" content="${escapeHtml2(title)}" />`);
2095
+ }
2096
+ const finalDescription = description || ogConfig?.siteDescription;
2097
+ if (finalDescription && !hasMetaTag(head, "og:description")) {
2098
+ additionalTags.push(`<meta property="og:description" content="${escapeHtml2(finalDescription)}" />`);
2099
+ }
2100
+ if (title && !hasMetaTag(head, "twitter:title")) {
2101
+ additionalTags.push(`<meta name="twitter:title" content="${escapeHtml2(title)}" />`);
2102
+ }
2103
+ if (finalDescription && !hasMetaTag(head, "twitter:description")) {
2104
+ additionalTags.push(`<meta name="twitter:description" content="${escapeHtml2(finalDescription)}" />`);
2105
+ }
2106
+ if (!hasMetaTag(head, "og:type")) {
2107
+ const ogType = ogConfig?.defaultType || "website";
2108
+ additionalTags.push(`<meta property="og:type" content="${escapeHtml2(ogType)}" />`);
2109
+ }
2110
+ if (!hasMetaTag(head, "twitter:card")) {
2111
+ const twitterCard = ogConfig?.twitterCard || "summary_large_image";
2112
+ additionalTags.push(`<meta name="twitter:card" content="${twitterCard}" />`);
2113
+ }
2114
+ return additionalTags.length > 0 ? `
2115
+ ${additionalTags.join(`
2116
+ `)}` : "";
2117
+ }
2118
+ function extractSSRHead(ssr, data, ogConfig, existingHead) {
2055
2119
  if (!ssr)
2056
2120
  return "";
2121
+ let headContent = "";
2057
2122
  if (typeof ssr.head === "function") {
2058
2123
  try {
2059
2124
  const result = ssr.head({ data });
2060
2125
  if (typeof result === "string")
2061
- return result;
2062
- if (Array.isArray(result))
2063
- return String(result.join(`
2126
+ headContent = result;
2127
+ else if (Array.isArray(result))
2128
+ headContent = String(result.join(`
2064
2129
  `));
2065
- return "";
2066
2130
  } catch (err) {
2067
2131
  console.error("[extractSSRHead] Error calling head function:", err);
2068
2132
  return "";
2069
2133
  }
2070
- }
2071
- if (typeof ssr.head === "string")
2072
- return ssr.head;
2073
- if (Array.isArray(ssr.head))
2074
- return String(ssr.head.join(`
2134
+ } else if (typeof ssr.head === "string") {
2135
+ headContent = ssr.head;
2136
+ } else if (Array.isArray(ssr.head)) {
2137
+ headContent = String(ssr.head.join(`
2075
2138
  `));
2076
- return "";
2139
+ }
2140
+ if (!headContent)
2141
+ return "";
2142
+ const combinedHead = existingHead ? `${existingHead}
2143
+ ${headContent}` : headContent;
2144
+ const additionalOGTags = generateMissingOGTags(combinedHead, ogConfig);
2145
+ return headContent + additionalOGTags;
2077
2146
  }
2078
2147
  function extractSSRLang(ssr) {
2079
2148
  if (!ssr)
@@ -5016,7 +5085,8 @@ async function renderSSRDocumentStream(options) {
5016
5085
  browserTelemetryConfig,
5017
5086
  traceContext,
5018
5087
  parentSpan: options.parentSpan,
5019
- timeout: options.timeout
5088
+ timeout: options.timeout,
5089
+ ssrExport: setup2.metadataResult.ssrExport
5020
5090
  });
5021
5091
  if (debug)
5022
5092
  console.log(`[renderStream] ${pathname} - returning stream: ${(performance.now() - t0).toFixed(2)}ms`);
@@ -5124,12 +5194,100 @@ function buildStreamingScripts(ctx) {
5124
5194
  const feedsScript = createFeedsScript();
5125
5195
  const llmsScript = createLlmsScript();
5126
5196
  let allScripts = dataScript + feedsScript + llmsScript + collectionScripts + ctx.preloadHydrationScript;
5197
+ const metaUpdateScript = generateMetaUpdateScript(ctx, ssrDataSnapshot);
5198
+ if (metaUpdateScript) {
5199
+ allScripts += metaUpdateScript;
5200
+ }
5127
5201
  allScripts += `<script type="module" src="${ctx.bundleUrl}"></script>`;
5128
5202
  if (ctx.isWatchMode) {
5129
5203
  allScripts += `<script type="module" src="/__reroute_watch.js"></script>`;
5130
5204
  }
5131
5205
  return allScripts;
5132
5206
  }
5207
+ function generateMetaUpdateScript(ctx, ssrDataSnapshot) {
5208
+ if (typeof ctx.ssrExport?.head !== "function") {
5209
+ return "";
5210
+ }
5211
+ const routeData = ssrDataSnapshot[ctx.pathname];
5212
+ if (!routeData) {
5213
+ return "";
5214
+ }
5215
+ let headResult;
5216
+ try {
5217
+ headResult = ctx.ssrExport.head({ data: routeData });
5218
+ } catch (err) {
5219
+ console.error("[reroute] Error calling ssr.head() at stream end:", err);
5220
+ return "";
5221
+ }
5222
+ if (!headResult) {
5223
+ return "";
5224
+ }
5225
+ const headHtml = Array.isArray(headResult) ? headResult.join(`
5226
+ `) : headResult;
5227
+ if (!headHtml) {
5228
+ return "";
5229
+ }
5230
+ const metaUpdates = parseHeadForMetaUpdates(headHtml);
5231
+ if (Object.keys(metaUpdates).length === 0) {
5232
+ return "";
5233
+ }
5234
+ const updatesJson = JSON.stringify(metaUpdates);
5235
+ return `<script>(function(){var u=${updatesJson};if(u.title){document.title=u.title}Object.keys(u).forEach(function(k){if(k==='title')return;var s=k.split(':');var isOg=s[0]==='og'||s[0]==='twitter';var el=isOg?document.querySelector('meta[property="'+k+'"]')||document.querySelector('meta[name="'+k+'"]'):document.querySelector('meta[name="'+k+'"]');if(el){el.setAttribute('content',u[k])}else{var m=document.createElement('meta');m.setAttribute(isOg?'property':'name',k);m.setAttribute('content',u[k]);document.head.appendChild(m)}})})()</script>`;
5236
+ }
5237
+ function parseHeadForMetaUpdates(headHtml) {
5238
+ const updates = {};
5239
+ const titleMatch = headHtml.match(/<title[^>]*>(.*?)<\/title>/is);
5240
+ if (titleMatch?.[1]) {
5241
+ updates.title = unescapeHtmlEntities(titleMatch[1].trim());
5242
+ }
5243
+ let descMatch = headHtml.match(/<meta\s+name=["']description["']\s+content=["'](.+?)["']/i);
5244
+ if (!descMatch) {
5245
+ descMatch = headHtml.match(/<meta\s+content=["'](.+?)["']\s+name=["']description["']/i);
5246
+ }
5247
+ if (descMatch?.[1]) {
5248
+ updates.description = unescapeHtmlEntities(descMatch[1].trim());
5249
+ }
5250
+ let ogTitleMatch = headHtml.match(/<meta\s+property=["']og:title["']\s+content=["'](.+?)["']/i);
5251
+ if (!ogTitleMatch) {
5252
+ ogTitleMatch = headHtml.match(/<meta\s+content=["'](.+?)["']\s+property=["']og:title["']/i);
5253
+ }
5254
+ if (ogTitleMatch?.[1]) {
5255
+ updates["og:title"] = unescapeHtmlEntities(ogTitleMatch[1].trim());
5256
+ } else if (updates.title) {
5257
+ updates["og:title"] = updates.title;
5258
+ }
5259
+ let ogDescMatch = headHtml.match(/<meta\s+property=["']og:description["']\s+content=["'](.+?)["']/i);
5260
+ if (!ogDescMatch) {
5261
+ ogDescMatch = headHtml.match(/<meta\s+content=["'](.+?)["']\s+property=["']og:description["']/i);
5262
+ }
5263
+ if (ogDescMatch?.[1]) {
5264
+ updates["og:description"] = unescapeHtmlEntities(ogDescMatch[1].trim());
5265
+ } else if (updates.description) {
5266
+ updates["og:description"] = updates.description;
5267
+ }
5268
+ let twitterTitleMatch = headHtml.match(/<meta\s+name=["']twitter:title["']\s+content=["'](.+?)["']/i);
5269
+ if (!twitterTitleMatch) {
5270
+ twitterTitleMatch = headHtml.match(/<meta\s+content=["'](.+?)["']\s+name=["']twitter:title["']/i);
5271
+ }
5272
+ if (twitterTitleMatch?.[1]) {
5273
+ updates["twitter:title"] = unescapeHtmlEntities(twitterTitleMatch[1].trim());
5274
+ } else if (updates.title) {
5275
+ updates["twitter:title"] = updates.title;
5276
+ }
5277
+ let twitterDescMatch = headHtml.match(/<meta\s+name=["']twitter:description["']\s+content=["'](.+?)["']/i);
5278
+ if (!twitterDescMatch) {
5279
+ twitterDescMatch = headHtml.match(/<meta\s+content=["'](.+?)["']\s+name=["']twitter:description["']/i);
5280
+ }
5281
+ if (twitterDescMatch?.[1]) {
5282
+ updates["twitter:description"] = unescapeHtmlEntities(twitterDescMatch[1].trim());
5283
+ } else if (updates.description) {
5284
+ updates["twitter:description"] = updates.description;
5285
+ }
5286
+ return updates;
5287
+ }
5288
+ function unescapeHtmlEntities(str) {
5289
+ return str.replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
5290
+ }
5133
5291
  var init_stream = __esm(() => {
5134
5292
  init_server2();
5135
5293
  init_config();
@@ -7624,12 +7782,21 @@ function registerSSRRoutes(app, options) {
7624
7782
  head = "",
7625
7783
  lang = "en",
7626
7784
  appId = "root",
7627
- maxAge = 3600,
7628
- directive = "public",
7785
+ serverCacheEnabled = true,
7786
+ serverMaxAge = 3600,
7787
+ browserCacheEnabled = true,
7788
+ browserMaxAge = 300,
7789
+ browserDirective = "public",
7629
7790
  compression: compression2 = true,
7630
7791
  streamingEnabled = false
7631
7792
  } = options;
7632
- const SSR_HTML_TTL_MS = maxAge === 0 ? 0 : maxAge * 1000 || 5 * 60 * 1000;
7793
+ const addCacheControl = (headers2, cacheControl) => {
7794
+ if (cacheControl) {
7795
+ headers2["Cache-Control"] = cacheControl;
7796
+ }
7797
+ return headers2;
7798
+ };
7799
+ const SSR_HTML_TTL_MS = serverCacheEnabled && serverMaxAge > 0 ? serverMaxAge * 1000 : 0;
7633
7800
  const htmlCache = new LRUCache(200);
7634
7801
  const makeKey = (pathname, acceptEncoding) => `${pathname}::${acceptEncoding || "identity"}`;
7635
7802
  let staticRoutes = [];
@@ -7728,7 +7895,7 @@ function registerSSRRoutes(app, options) {
7728
7895
  } catch {}
7729
7896
  set.headers.link = set.headers.link ? `${set.headers.link}, ${linkValue}` : linkValue;
7730
7897
  } catch {}
7731
- const cacheControlHeader = isWatchMode ? "no-cache, no-store, must-revalidate" : `${directive}, max-age=${maxAge}`;
7898
+ const cacheControlHeader = isWatchMode ? "no-cache, no-store, must-revalidate" : browserCacheEnabled ? `${browserDirective}, max-age=${browserMaxAge}` : undefined;
7732
7899
  let response;
7733
7900
  if (streamingEnabled) {
7734
7901
  if (debug)
@@ -7752,7 +7919,7 @@ function registerSSRRoutes(app, options) {
7752
7919
  head,
7753
7920
  lang,
7754
7921
  appId,
7755
- maxAge,
7922
+ maxAge: serverMaxAge,
7756
7923
  searchParams,
7757
7924
  ogConfig: options.ogConfig,
7758
7925
  ogMetaConfig: options.ogMetaConfig,
@@ -7811,9 +7978,9 @@ function registerSSRRoutes(app, options) {
7811
7978
  const ck = makeKey(pathname, acceptEncoding);
7812
7979
  const cacheHeaders = {
7813
7980
  "Content-Type": "text/html; charset=utf-8",
7814
- "Cache-Control": cacheControlHeader,
7815
7981
  ...extraHeaders
7816
7982
  };
7983
+ addCacheControl(cacheHeaders, cacheControlHeader);
7817
7984
  if (set.headers.link) {
7818
7985
  cacheHeaders.Link = set.headers.link;
7819
7986
  }
@@ -7827,10 +7994,10 @@ function registerSSRRoutes(app, options) {
7827
7994
  }
7828
7995
  const resHeaders = {
7829
7996
  "Content-Type": "text/html; charset=utf-8",
7830
- "Cache-Control": cacheControlHeader,
7831
7997
  "Reroute-Cache": "MISS",
7832
7998
  ...extraHeaders
7833
7999
  };
8000
+ addCacheControl(resHeaders, cacheControlHeader);
7834
8001
  if (set.headers.link) {
7835
8002
  resHeaders.Link = set.headers.link;
7836
8003
  }
@@ -7864,9 +8031,9 @@ function registerSSRRoutes(app, options) {
7864
8031
  }
7865
8032
  const ck = makeKey(pathname, "identity");
7866
8033
  const cacheHeaders = {
7867
- "Content-Type": "text/html; charset=utf-8",
7868
- "Cache-Control": cacheControlHeader
8034
+ "Content-Type": "text/html; charset=utf-8"
7869
8035
  };
8036
+ addCacheControl(cacheHeaders, cacheControlHeader);
7870
8037
  if (set.headers.link) {
7871
8038
  cacheHeaders.Link = set.headers.link;
7872
8039
  }
@@ -7883,13 +8050,14 @@ function registerSSRRoutes(app, options) {
7883
8050
  }));
7884
8051
  set.status = status;
7885
8052
  const tBeforeResponse = debug ? performance.now() : 0;
8053
+ const resHeaders = {
8054
+ "Content-Type": "text/html; charset=utf-8",
8055
+ "Reroute-Cache": "MISS"
8056
+ };
8057
+ addCacheControl(resHeaders, cacheControlHeader);
7886
8058
  const res = new Response(cachingStream, {
7887
8059
  status,
7888
- headers: {
7889
- "Content-Type": "text/html; charset=utf-8",
7890
- "Cache-Control": cacheControlHeader,
7891
- "Reroute-Cache": "MISS"
7892
- }
8060
+ headers: resHeaders
7893
8061
  });
7894
8062
  if (debug)
7895
8063
  console.log(`[SSR] ${pathname} - Response created (cached stream): ${(performance.now() - t0).toFixed(2)}ms (creation: ${(performance.now() - tBeforeResponse).toFixed(2)}ms)`);
@@ -7900,13 +8068,14 @@ function registerSSRRoutes(app, options) {
7900
8068
  if (debug)
7901
8069
  console.log(`[SSR] ${pathname} - creating direct stream response: ${(performance.now() - t0).toFixed(2)}ms`);
7902
8070
  set.status = status;
8071
+ const streamHeaders = {
8072
+ "Content-Type": "text/html; charset=utf-8",
8073
+ "Reroute-Cache": "MISS"
8074
+ };
8075
+ addCacheControl(streamHeaders, cacheControlHeader);
7903
8076
  response = new Response(stream2, {
7904
8077
  status,
7905
- headers: {
7906
- "Content-Type": "text/html; charset=utf-8",
7907
- "Cache-Control": cacheControlHeader,
7908
- "Reroute-Cache": "MISS"
7909
- }
8078
+ headers: streamHeaders
7910
8079
  });
7911
8080
  if (debug)
7912
8081
  console.log(`[SSR] ${pathname} - Response created (direct stream): ${(performance.now() - t0).toFixed(2)}ms`);
@@ -7931,7 +8100,7 @@ function registerSSRRoutes(app, options) {
7931
8100
  head,
7932
8101
  lang,
7933
8102
  appId,
7934
- maxAge,
8103
+ maxAge: serverMaxAge,
7935
8104
  searchParams,
7936
8105
  ogConfig: options.ogConfig,
7937
8106
  ogMetaConfig: options.ogMetaConfig,
@@ -7983,10 +8152,10 @@ function registerSSRRoutes(app, options) {
7983
8152
  }) : { body: html2, extraHeaders: {} };
7984
8153
  const resHeaders = {
7985
8154
  "Content-Type": "text/html; charset=utf-8",
7986
- "Cache-Control": cacheControlHeader,
7987
8155
  "Reroute-Cache": "MISS",
7988
8156
  ...extraHeaders
7989
8157
  };
8158
+ addCacheControl(resHeaders, cacheControlHeader);
7990
8159
  if (set.headers.link) {
7991
8160
  resHeaders.Link = set.headers.link;
7992
8161
  }
@@ -8166,10 +8335,15 @@ var reroute = () => async (app) => {
8166
8335
  ".env"
8167
8336
  ];
8168
8337
  const staticHeaders = staticConfig.headers;
8169
- const maxAge = globalConfig.app?.maxAge ?? 3600;
8170
- const directive = globalConfig.app?.directive ?? "public";
8171
- const staticMaxAge = staticConfig.maxAge ?? maxAge;
8172
- const staticDirective = staticConfig.directive ?? directive;
8338
+ const server2 = globalConfig.server;
8339
+ const serverCacheEnabled = server2?.cache ?? true;
8340
+ const serverMaxAge = server2?.maxAge ?? 3600;
8341
+ const browser = globalConfig.browser;
8342
+ const browserCacheEnabled = browser?.cache ?? true;
8343
+ const browserMaxAge = browser?.maxAge ?? 300;
8344
+ const browserDirective = browser?.directive ?? "public";
8345
+ const staticMaxAge = staticConfig.maxAge ?? serverMaxAge;
8346
+ const staticDirective = staticConfig.directive ?? browserDirective;
8173
8347
  const compression2 = globalConfig.app?.compression ?? true;
8174
8348
  const debug = globalConfig.app?.debug ?? false;
8175
8349
  const imageConfig = globalConfig.image ?? {};
@@ -8237,7 +8411,7 @@ var reroute = () => async (app) => {
8237
8411
  const clientDir = existsSync3(`${cwd}/.reroute/assets`) ? `${cwd}/.reroute` : `${cwd}/src/client`;
8238
8412
  const shouldIgnore = !ignorePatterns.length ? () => false : (file) => ignorePatterns.find((pattern) => typeof pattern === "string" ? file.includes(pattern) : pattern.test(file));
8239
8413
  const isWatchMode = Array.isArray(process.execArgv) && process.execArgv.includes("--watch") || Array.isArray(process.argv) && process.argv.includes("--watch");
8240
- const dataCacheControl = `${directive}, max-age=${maxAge}`;
8414
+ const dataCacheControl = browserCacheEnabled ? `${browserDirective}, max-age=${browserMaxAge}` : undefined;
8241
8415
  if (isWatchMode) {
8242
8416
  console.log(`[reroute] Live reload enabled`);
8243
8417
  registerLiveReloadRoutes(app, liveReloadState);
@@ -8289,8 +8463,8 @@ var reroute = () => async (app) => {
8289
8463
  if (globalConfig.redirects && globalConfig.redirects.length > 0) {
8290
8464
  registerRedirectRoutes(app, globalConfig.redirects);
8291
8465
  }
8292
- registerContentRoutes(app, cwd, collectionCache, directive, maxAge, isWatchMode);
8293
- registerSearchRoute(app, cwd, directive, maxAge, {
8466
+ registerContentRoutes(app, cwd, collectionCache, browserDirective, browserMaxAge, isWatchMode);
8467
+ registerSearchRoute(app, cwd, browserDirective, browserMaxAge, {
8294
8468
  defaultPageSize: globalConfig.search?.defaultPageSize,
8295
8469
  maxPageSize: globalConfig.search?.maxPageSize
8296
8470
  });
@@ -8300,11 +8474,11 @@ var reroute = () => async (app) => {
8300
8474
  dataCacheControl,
8301
8475
  dataCache,
8302
8476
  isWatchMode,
8303
- maxAge
8477
+ maxAge: serverMaxAge
8304
8478
  });
8305
8479
  registerArtifactsRoutes(app, cwd, fileCache, {
8306
8480
  bundleMaxAge,
8307
- directive,
8481
+ directive: browserDirective,
8308
8482
  isWatchMode
8309
8483
  });
8310
8484
  const imageCacheDir = `${cwd}/.reroute/image-cache`;
@@ -8337,7 +8511,7 @@ var reroute = () => async (app) => {
8337
8511
  try {
8338
8512
  registerRobotsRoute(app, {
8339
8513
  cwd,
8340
- maxAge: robotsConfig.maxAge ?? maxAge,
8514
+ maxAge: robotsConfig.maxAge ?? browserMaxAge,
8341
8515
  isWatchMode,
8342
8516
  robotsCache,
8343
8517
  robotsConfig,
@@ -8356,7 +8530,7 @@ var reroute = () => async (app) => {
8356
8530
  cwd,
8357
8531
  collections: collections2,
8358
8532
  baseUrl: sitemapBaseUrl,
8359
- maxAge,
8533
+ maxAge: browserMaxAge,
8360
8534
  isWatchMode,
8361
8535
  sitemapCache,
8362
8536
  sitemapConfig
@@ -8373,7 +8547,7 @@ var reroute = () => async (app) => {
8373
8547
  clientDir,
8374
8548
  collections: collections2,
8375
8549
  baseUrl: rssBaseUrl,
8376
- maxAge,
8550
+ maxAge: browserMaxAge,
8377
8551
  isWatchMode,
8378
8552
  rssCache,
8379
8553
  rssConfig
@@ -8391,8 +8565,8 @@ var reroute = () => async (app) => {
8391
8565
  cwd,
8392
8566
  isWatchMode,
8393
8567
  getBundleUrl,
8394
- maxAge,
8395
- directive,
8568
+ maxAge: serverMaxAge,
8569
+ directive: browserDirective,
8396
8570
  llmsConfig,
8397
8571
  collections: collections2,
8398
8572
  dataCache
@@ -8440,8 +8614,11 @@ var reroute = () => async (app) => {
8440
8614
  head: ssrHead,
8441
8615
  lang: ssrLang,
8442
8616
  appId: ssrAppId,
8443
- maxAge,
8444
- directive,
8617
+ serverCacheEnabled,
8618
+ serverMaxAge,
8619
+ browserCacheEnabled,
8620
+ browserMaxAge,
8621
+ browserDirective,
8445
8622
  compression: compression2,
8446
8623
  streamingEnabled,
8447
8624
  streamingTimeout: globalConfig.streaming?.timeout,
@@ -8470,4 +8647,4 @@ export {
8470
8647
  reroute
8471
8648
  };
8472
8649
 
8473
- //# debugId=8F66BA5867641AA764756E2164756E21
8650
+ //# debugId=C6F09D6C67BEE32064756E2164756E21