reroute-js 0.42.1 → 0.43.1

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 (194) hide show
  1. package/cli/bin.d.ts +1 -1
  2. package/cli/bin.js +124 -31
  3. package/cli/bin.js.map +8 -8
  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/gen.d.ts.map +1 -1
  13. package/cli/src/commands/index.d.ts +1 -1
  14. package/cli/src/commands/init.d.ts +1 -1
  15. package/cli/src/commands/lib/assets.d.ts +1 -1
  16. package/cli/src/commands/lib/bundler.d.ts +1 -1
  17. package/cli/src/commands/lib/command.d.ts +1 -1
  18. package/cli/src/commands/lib/env.d.ts +1 -1
  19. package/cli/src/commands/lib/index.d.ts +1 -1
  20. package/cli/src/commands/lib/log.d.ts +1 -1
  21. package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
  22. package/cli/src/commands/lib/markdown/index.d.ts +1 -1
  23. package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
  24. package/cli/src/commands/lib/production.d.ts +1 -1
  25. package/cli/src/commands/lib/server.d.ts +1 -1
  26. package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
  27. package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
  28. package/cli/src/commands/lib/streaming/suspense.d.ts.map +1 -1
  29. package/cli/src/commands/lib/tailwind.d.ts +1 -1
  30. package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
  31. package/cli/src/commands/lib/version.d.ts +1 -1
  32. package/cli/src/commands/og.d.ts +1 -1
  33. package/cli/src/commands/start.d.ts +1 -1
  34. package/cli/src/index.d.ts +1 -1
  35. package/core/index.d.ts +1 -1
  36. package/core/index.js +107 -6
  37. package/core/index.js.map +6 -6
  38. package/core/src/bundler/hash.d.ts +1 -1
  39. package/core/src/bundler/index.d.ts +1 -1
  40. package/core/src/config.d.ts +81 -5
  41. package/core/src/config.d.ts.map +1 -1
  42. package/core/src/content/discovery.d.ts +1 -1
  43. package/core/src/content/index.d.ts +1 -1
  44. package/core/src/content/metadata.d.ts +1 -1
  45. package/core/src/index.d.ts +1 -1
  46. package/core/src/llms/extractor.d.ts +1 -1
  47. package/core/src/llms/formatter.d.ts +1 -1
  48. package/core/src/llms/full-generator.d.ts +1 -1
  49. package/core/src/llms/index-generator.d.ts +1 -1
  50. package/core/src/llms/index.d.ts +1 -1
  51. package/core/src/og/discovery.d.ts +1 -1
  52. package/core/src/og/index.d.ts +1 -1
  53. package/core/src/og/meta.d.ts +1 -1
  54. package/core/src/og/render.d.ts +1 -1
  55. package/core/src/og/types.d.ts +1 -1
  56. package/core/src/robots/discovery.d.ts +1 -1
  57. package/core/src/robots/generator.d.ts +1 -1
  58. package/core/src/robots/index.d.ts +1 -1
  59. package/core/src/robots/policies.d.ts +1 -1
  60. package/core/src/rss/discovery.d.ts +1 -1
  61. package/core/src/rss/generator.d.ts +1 -1
  62. package/core/src/rss/index.d.ts +1 -1
  63. package/core/src/sitemap/discovery.d.ts +1 -1
  64. package/core/src/sitemap/generator.d.ts +1 -1
  65. package/core/src/sitemap/index.d.ts +1 -1
  66. package/core/src/ssr/index.d.ts +1 -1
  67. package/core/src/ssr/lib/cache.d.ts +1 -1
  68. package/core/src/ssr/lib/collections.d.ts +1 -1
  69. package/core/src/ssr/lib/compression.d.ts +1 -1
  70. package/core/src/ssr/lib/compute/content.d.ts +1 -1
  71. package/core/src/ssr/lib/compute/index.d.ts +1 -1
  72. package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
  73. package/core/src/ssr/lib/compute/routes.d.ts +1 -1
  74. package/core/src/ssr/lib/data.d.ts +1 -1
  75. package/core/src/ssr/lib/html.d.ts +1 -1
  76. package/core/src/ssr/lib/imports.d.ts +1 -1
  77. package/core/src/ssr/lib/index.d.ts +1 -1
  78. package/core/src/ssr/lib/layouts.d.ts +1 -1
  79. package/core/src/ssr/lib/metadata.d.ts +1 -1
  80. package/core/src/ssr/lib/metadata.d.ts.map +1 -1
  81. package/core/src/ssr/lib/mime.d.ts +1 -1
  82. package/core/src/ssr/lib/modules.d.ts +1 -1
  83. package/core/src/ssr/lib/path.d.ts +1 -1
  84. package/core/src/ssr/lib/preload.d.ts +1 -1
  85. package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
  86. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  87. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  88. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  89. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  90. package/core/src/ssr/lib/seed.d.ts +1 -1
  91. package/core/src/ssr/lib/serialize.d.ts +1 -1
  92. package/core/src/ssr/lib/setup.d.ts +4 -1
  93. package/core/src/ssr/lib/setup.d.ts.map +1 -1
  94. package/core/src/ssr/lib/styles.d.ts +1 -1
  95. package/core/src/ssr/lib/template.d.ts +1 -1
  96. package/core/src/ssr/lib/types.d.ts +3 -1
  97. package/core/src/ssr/lib/types.d.ts.map +1 -1
  98. package/core/src/ssr/render.d.ts +1 -1
  99. package/core/src/ssr/stream.d.ts +1 -1
  100. package/core/src/ssr/stream.d.ts.map +1 -1
  101. package/elysia/index.d.ts +1 -1
  102. package/elysia/index.js +224 -72
  103. package/elysia/index.js.map +11 -11
  104. package/elysia/src/index.d.ts +1 -1
  105. package/elysia/src/libs/assets.d.ts +1 -1
  106. package/elysia/src/libs/cache.d.ts +1 -1
  107. package/elysia/src/libs/caching.d.ts +1 -1
  108. package/elysia/src/libs/http.d.ts +1 -1
  109. package/elysia/src/libs/image.d.ts +1 -1
  110. package/elysia/src/libs/index.d.ts +1 -1
  111. package/elysia/src/libs/llms.d.ts +1 -1
  112. package/elysia/src/libs/response.d.ts +1 -1
  113. package/elysia/src/libs/serving.d.ts +1 -1
  114. package/elysia/src/plugin.d.ts +1 -1
  115. package/elysia/src/plugin.d.ts.map +1 -1
  116. package/elysia/src/routes/artifacts.d.ts +1 -1
  117. package/elysia/src/routes/artifacts.d.ts.map +1 -1
  118. package/elysia/src/routes/content.d.ts +1 -1
  119. package/elysia/src/routes/image.d.ts +1 -1
  120. package/elysia/src/routes/index.d.ts +1 -1
  121. package/elysia/src/routes/internal.d.ts +2 -2
  122. package/elysia/src/routes/internal.d.ts.map +1 -1
  123. package/elysia/src/routes/llms.d.ts +1 -1
  124. package/elysia/src/routes/og.d.ts +1 -1
  125. package/elysia/src/routes/og.d.ts.map +1 -1
  126. package/elysia/src/routes/redirects.d.ts +1 -1
  127. package/elysia/src/routes/robots.d.ts +1 -1
  128. package/elysia/src/routes/rss.d.ts +1 -1
  129. package/elysia/src/routes/search.d.ts +1 -1
  130. package/elysia/src/routes/sitemap.d.ts +1 -1
  131. package/elysia/src/routes/ssr.d.ts +6 -3
  132. package/elysia/src/routes/ssr.d.ts.map +1 -1
  133. package/elysia/src/routes/static.d.ts +1 -1
  134. package/elysia/src/types.d.ts +1 -1
  135. package/package.json +1 -1
  136. package/react/index.d.ts +1 -1
  137. package/react/index.js +75 -20
  138. package/react/index.js.map +6 -6
  139. package/react/src/components/ClientOnly.d.ts +1 -1
  140. package/react/src/components/ContentRoute.d.ts +1 -1
  141. package/react/src/components/Image.d.ts +1 -1
  142. package/react/src/components/LazyRoute.d.ts +1 -1
  143. package/react/src/components/Link.d.ts +3 -3
  144. package/react/src/components/Link.d.ts.map +1 -1
  145. package/react/src/components/Markdown.d.ts +1 -1
  146. package/react/src/components/Outlet.d.ts +1 -1
  147. package/react/src/components/index.d.ts +1 -1
  148. package/react/src/hooks/index.d.ts +1 -1
  149. package/react/src/hooks/useContent.d.ts +1 -1
  150. package/react/src/hooks/useData.d.ts +1 -1
  151. package/react/src/hooks/useData.d.ts.map +1 -1
  152. package/react/src/hooks/useFeed.d.ts +1 -1
  153. package/react/src/hooks/useLayoutData.d.ts +1 -1
  154. package/react/src/hooks/useLayoutData.d.ts.map +1 -1
  155. package/react/src/hooks/useLlms.d.ts +1 -1
  156. package/react/src/hooks/useNavigate.d.ts +1 -1
  157. package/react/src/hooks/useParams.d.ts +1 -1
  158. package/react/src/hooks/useRouter.d.ts +1 -1
  159. package/react/src/hooks/useSearch.d.ts +1 -1
  160. package/react/src/hooks/useSearchParams.d.ts +1 -1
  161. package/react/src/hooks/useToc.d.ts +1 -1
  162. package/react/src/index.d.ts +1 -1
  163. package/react/src/lib/collection.d.ts +1 -1
  164. package/react/src/lib/content.d.ts +1 -1
  165. package/react/src/lib/head.d.ts +1 -1
  166. package/react/src/lib/index.d.ts +1 -1
  167. package/react/src/lib/lazy-route.d.ts +1 -1
  168. package/react/src/lib/route-loader.d.ts +1 -1
  169. package/react/src/providers/ContentProvider.d.ts +1 -1
  170. package/react/src/providers/RerouteProvider.d.ts +1 -1
  171. package/react/src/providers/RouterProvider.d.ts +1 -1
  172. package/react/src/providers/RouterProvider.d.ts.map +1 -1
  173. package/react/src/providers/index.d.ts +1 -1
  174. package/react/src/types/any.d.ts +1 -1
  175. package/react/src/types/index.d.ts +1 -1
  176. package/react/src/types/router.d.ts +1 -1
  177. package/telemetry/react.d.ts +1 -1
  178. package/telemetry/react.js +2 -2
  179. package/telemetry/react.js.map +1 -1
  180. package/telemetry/server.d.ts +1 -1
  181. package/telemetry/server.js +2 -2
  182. package/telemetry/server.js.map +6 -6
  183. package/telemetry/src/react/api.d.ts +1 -1
  184. package/telemetry/src/react/context.d.ts +1 -1
  185. package/telemetry/src/react/index.d.ts +1 -1
  186. package/telemetry/src/react/telemetry.d.ts +1 -1
  187. package/telemetry/src/server/context.d.ts +1 -1
  188. package/telemetry/src/server/headers/extractor.d.ts +1 -1
  189. package/telemetry/src/server/headers/index.d.ts +1 -1
  190. package/telemetry/src/server/headers/presets.d.ts +1 -1
  191. package/telemetry/src/server/index.d.ts +1 -1
  192. package/telemetry/src/server/instrumentation.d.ts +1 -1
  193. package/telemetry/src/server/plugin.d.ts +1 -1
  194. package/telemetry/src/server/sourcemap.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.42.1
2
+ * reroute-js v0.43.1
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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MAAM,CAAA;KAAE,CAAC;IACzB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF;;;GAGG;AACH,KAAK,cAAc,CAAC,QAAQ,GAAG,OAAO,IAAI;IACzC,mDAAmD;IACnD,IAAI,CAAC,EAAE,QAAQ,CAAC;CAChB,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;IAC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E,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,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.42.1
2
+ * reroute-js v0.43.1
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.1
2
+ * reroute-js v0.43.1
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,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+ * reroute-js v0.43.1
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.1
2
+ * reroute-js v0.43.1
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")
@@ -1978,7 +1983,12 @@ async function extractMatchedRouteMetadata(pathname, clientDir, m, isWatchMode,
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;
@@ -5073,7 +5085,8 @@ async function renderSSRDocumentStream(options) {
5073
5085
  browserTelemetryConfig,
5074
5086
  traceContext,
5075
5087
  parentSpan: options.parentSpan,
5076
- timeout: options.timeout
5088
+ timeout: options.timeout,
5089
+ ssrExport: setup2.metadataResult.ssrExport
5077
5090
  });
5078
5091
  if (debug)
5079
5092
  console.log(`[renderStream] ${pathname} - returning stream: ${(performance.now() - t0).toFixed(2)}ms`);
@@ -5181,12 +5194,100 @@ function buildStreamingScripts(ctx) {
5181
5194
  const feedsScript = createFeedsScript();
5182
5195
  const llmsScript = createLlmsScript();
5183
5196
  let allScripts = dataScript + feedsScript + llmsScript + collectionScripts + ctx.preloadHydrationScript;
5197
+ const metaUpdateScript = generateMetaUpdateScript(ctx, ssrDataSnapshot);
5198
+ if (metaUpdateScript) {
5199
+ allScripts += metaUpdateScript;
5200
+ }
5184
5201
  allScripts += `<script type="module" src="${ctx.bundleUrl}"></script>`;
5185
5202
  if (ctx.isWatchMode) {
5186
5203
  allScripts += `<script type="module" src="/__reroute_watch.js"></script>`;
5187
5204
  }
5188
5205
  return allScripts;
5189
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
+ }
5190
5291
  var init_stream = __esm(() => {
5191
5292
  init_server2();
5192
5293
  init_config();
@@ -5710,7 +5811,7 @@ function registerArtifactsRoutes(app, cwd, fileCache, options) {
5710
5811
  const filePath = join(cwd, ".reroute", "collections", fileName);
5711
5812
  const acceptEncoding = headers2["accept-encoding"] ?? "";
5712
5813
  try {
5713
- const cacheControl = isWatchMode ? "no-cache, no-store, must-revalidate" : "public, max-age=31536000, immutable";
5814
+ const cacheControl = isWatchMode ? "no-cache, no-store, must-revalidate" : "public, max-age=60, must-revalidate";
5714
5815
  return await serveFile(filePath, acceptEncoding, fileCache, {
5715
5816
  cacheControl
5716
5817
  });
@@ -5946,7 +6047,6 @@ function registerImageRoutes(app, options) {
5946
6047
  }
5947
6048
 
5948
6049
  // packages/elysia/src/routes/internal.ts
5949
- init_core();
5950
6050
  import { NotFoundError as NotFoundError4 } from "elysia";
5951
6051
 
5952
6052
  // packages/elysia/src/libs/http.ts
@@ -6091,26 +6191,51 @@ function registerInternalRoutes(app, opts) {
6091
6191
  return jsonError("key not found", 404);
6092
6192
  }
6093
6193
  async function handleFullDataRequest(pathname) {
6094
- let data = dataCache?.get(pathname);
6194
+ const { computeSSRData: computeSSRData2 } = await Promise.resolve().then(() => (init_core(), exports_core));
6195
+ const cacheKey = `${pathname}:streaming`;
6196
+ let data = dataCache?.get(cacheKey);
6095
6197
  const cacheHit = data !== undefined;
6096
6198
  if (data === undefined) {
6097
6199
  const sp = extractSearchParams(pathname);
6098
6200
  try {
6099
- data = await computeSSRDataForPath({
6100
- pathname,
6101
- clientDir,
6102
- cwd,
6103
- isWatchMode,
6104
- searchParams: sp
6105
- });
6201
+ const result = await computeSSRData2(pathname, clientDir, cwd, isWatchMode, { streaming: true, maxAge }, sp);
6202
+ data = convertPromisesToLazyMarkers(result.data, pathname);
6106
6203
  } catch (error) {
6107
6204
  console.error("[__reroute_data] Error computing data:", error);
6108
6205
  data = null;
6109
6206
  }
6110
- dataCache?.set(pathname, data);
6207
+ dataCache?.set(cacheKey, data);
6111
6208
  }
6112
6209
  return { data, cacheHit };
6113
6210
  }
6211
+ function convertPromisesToLazyMarkers(data, pathname) {
6212
+ if (data instanceof Promise) {
6213
+ return {
6214
+ __lazy__: true,
6215
+ __fetch__: `/__reroute_data?path=${encodeURIComponent(pathname)}`
6216
+ };
6217
+ }
6218
+ if (typeof data === "object" && data !== null && !Array.isArray(data)) {
6219
+ const result = {};
6220
+ let hasPromises = false;
6221
+ for (const [key, value] of Object.entries(data)) {
6222
+ if (value instanceof Promise) {
6223
+ hasPromises = true;
6224
+ result[key] = {
6225
+ __lazy__: true,
6226
+ __fetch__: `/__reroute_data?path=${encodeURIComponent(pathname)}&key=${encodeURIComponent(key)}`
6227
+ };
6228
+ } else {
6229
+ result[key] = value;
6230
+ }
6231
+ }
6232
+ if (hasPromises) {
6233
+ result.__flatten__ = true;
6234
+ }
6235
+ return result;
6236
+ }
6237
+ return data;
6238
+ }
6114
6239
  app.get("/__reroute_data", async ({ query, headers: headers2 }) => {
6115
6240
  const p = String(query.path || query.p || "/");
6116
6241
  const dataKey = String(query.key || "");
@@ -6908,7 +7033,7 @@ function registerOGRoutes(app, options) {
6908
7033
  const width = ogConfig.width ?? 1200;
6909
7034
  const height = ogConfig.height ?? 630;
6910
7035
  const maxAge = ogConfig.maxAge ?? 3600;
6911
- const generatingImages = new Set;
7036
+ const generatingImages = new Map;
6912
7037
  function normalizeOgPathname(urlPathname) {
6913
7038
  let pathname = urlPathname.replace(/^\/__reroute_og/, "").replace(/\.png$/, "");
6914
7039
  if (pathname === "/index" || pathname === "index") {
@@ -7008,26 +7133,34 @@ function registerOGRoutes(app, options) {
7008
7133
  const cachedResponse = checkOgCache(pathname, set);
7009
7134
  if (cachedResponse)
7010
7135
  return cachedResponse;
7011
- if (generatingImages.has(pathname)) {
7012
- set.status = 404;
7013
- set.headers["Retry-After"] = "2";
7014
- return new Response("Image generation in progress", {
7015
- status: 404,
7016
- headers: { "Content-Type": "text/plain" }
7017
- });
7018
- }
7019
- generatingImages.add(pathname);
7020
- generateOgImage(pathname, clientDir, cwd, isWatchMode, ogConfig, width, height).then(() => {
7136
+ const existingGeneration = generatingImages.get(pathname);
7137
+ if (existingGeneration) {
7138
+ await existingGeneration;
7139
+ const cachedAfterWait = checkOgCache(pathname, set);
7140
+ if (cachedAfterWait)
7141
+ return cachedAfterWait;
7142
+ }
7143
+ const generationPromise = generateOgImage(pathname, clientDir, cwd, isWatchMode, ogConfig, width, height);
7144
+ generatingImages.set(pathname, generationPromise);
7145
+ try {
7146
+ await generationPromise;
7021
7147
  console.log(`[reroute/og] Generated image for: ${pathname}`);
7022
- }).catch((error) => {
7148
+ } catch (error) {
7023
7149
  console.error(`[reroute/og] Failed to generate image for ${pathname}:`, error);
7024
- }).finally(() => {
7150
+ set.status = 500;
7151
+ return new Response("Failed to generate image", {
7152
+ status: 500,
7153
+ headers: { "Content-Type": "text/plain" }
7154
+ });
7155
+ } finally {
7025
7156
  generatingImages.delete(pathname);
7026
- });
7027
- set.status = 404;
7028
- set.headers["Retry-After"] = "2";
7029
- return new Response("Image not yet available, please retry", {
7030
- status: 404,
7157
+ }
7158
+ const generatedResponse = checkOgCache(pathname, set);
7159
+ if (generatedResponse)
7160
+ return generatedResponse;
7161
+ set.status = 500;
7162
+ return new Response("Image generation completed but not cached", {
7163
+ status: 500,
7031
7164
  headers: { "Content-Type": "text/plain" }
7032
7165
  });
7033
7166
  } catch (error) {
@@ -7681,12 +7814,21 @@ function registerSSRRoutes(app, options) {
7681
7814
  head = "",
7682
7815
  lang = "en",
7683
7816
  appId = "root",
7684
- maxAge = 3600,
7685
- directive = "public",
7817
+ serverCacheEnabled = true,
7818
+ serverMaxAge = 3600,
7819
+ browserCacheEnabled = true,
7820
+ browserMaxAge = 300,
7821
+ browserDirective = "public",
7686
7822
  compression: compression2 = true,
7687
7823
  streamingEnabled = false
7688
7824
  } = options;
7689
- const SSR_HTML_TTL_MS = maxAge === 0 ? 0 : maxAge * 1000 || 5 * 60 * 1000;
7825
+ const addCacheControl = (headers2, cacheControl) => {
7826
+ if (cacheControl) {
7827
+ headers2["Cache-Control"] = cacheControl;
7828
+ }
7829
+ return headers2;
7830
+ };
7831
+ const SSR_HTML_TTL_MS = serverCacheEnabled && serverMaxAge > 0 ? serverMaxAge * 1000 : 0;
7690
7832
  const htmlCache = new LRUCache(200);
7691
7833
  const makeKey = (pathname, acceptEncoding) => `${pathname}::${acceptEncoding || "identity"}`;
7692
7834
  let staticRoutes = [];
@@ -7785,7 +7927,7 @@ function registerSSRRoutes(app, options) {
7785
7927
  } catch {}
7786
7928
  set.headers.link = set.headers.link ? `${set.headers.link}, ${linkValue}` : linkValue;
7787
7929
  } catch {}
7788
- const cacheControlHeader = isWatchMode ? "no-cache, no-store, must-revalidate" : `${directive}, max-age=${maxAge}`;
7930
+ const cacheControlHeader = isWatchMode ? "no-cache, no-store, must-revalidate" : browserCacheEnabled ? `${browserDirective}, max-age=${browserMaxAge}` : undefined;
7789
7931
  let response;
7790
7932
  if (streamingEnabled) {
7791
7933
  if (debug)
@@ -7809,7 +7951,7 @@ function registerSSRRoutes(app, options) {
7809
7951
  head,
7810
7952
  lang,
7811
7953
  appId,
7812
- maxAge,
7954
+ maxAge: serverMaxAge,
7813
7955
  searchParams,
7814
7956
  ogConfig: options.ogConfig,
7815
7957
  ogMetaConfig: options.ogMetaConfig,
@@ -7868,9 +8010,9 @@ function registerSSRRoutes(app, options) {
7868
8010
  const ck = makeKey(pathname, acceptEncoding);
7869
8011
  const cacheHeaders = {
7870
8012
  "Content-Type": "text/html; charset=utf-8",
7871
- "Cache-Control": cacheControlHeader,
7872
8013
  ...extraHeaders
7873
8014
  };
8015
+ addCacheControl(cacheHeaders, cacheControlHeader);
7874
8016
  if (set.headers.link) {
7875
8017
  cacheHeaders.Link = set.headers.link;
7876
8018
  }
@@ -7884,10 +8026,10 @@ function registerSSRRoutes(app, options) {
7884
8026
  }
7885
8027
  const resHeaders = {
7886
8028
  "Content-Type": "text/html; charset=utf-8",
7887
- "Cache-Control": cacheControlHeader,
7888
8029
  "Reroute-Cache": "MISS",
7889
8030
  ...extraHeaders
7890
8031
  };
8032
+ addCacheControl(resHeaders, cacheControlHeader);
7891
8033
  if (set.headers.link) {
7892
8034
  resHeaders.Link = set.headers.link;
7893
8035
  }
@@ -7921,9 +8063,9 @@ function registerSSRRoutes(app, options) {
7921
8063
  }
7922
8064
  const ck = makeKey(pathname, "identity");
7923
8065
  const cacheHeaders = {
7924
- "Content-Type": "text/html; charset=utf-8",
7925
- "Cache-Control": cacheControlHeader
8066
+ "Content-Type": "text/html; charset=utf-8"
7926
8067
  };
8068
+ addCacheControl(cacheHeaders, cacheControlHeader);
7927
8069
  if (set.headers.link) {
7928
8070
  cacheHeaders.Link = set.headers.link;
7929
8071
  }
@@ -7940,13 +8082,14 @@ function registerSSRRoutes(app, options) {
7940
8082
  }));
7941
8083
  set.status = status;
7942
8084
  const tBeforeResponse = debug ? performance.now() : 0;
8085
+ const resHeaders = {
8086
+ "Content-Type": "text/html; charset=utf-8",
8087
+ "Reroute-Cache": "MISS"
8088
+ };
8089
+ addCacheControl(resHeaders, cacheControlHeader);
7943
8090
  const res = new Response(cachingStream, {
7944
8091
  status,
7945
- headers: {
7946
- "Content-Type": "text/html; charset=utf-8",
7947
- "Cache-Control": cacheControlHeader,
7948
- "Reroute-Cache": "MISS"
7949
- }
8092
+ headers: resHeaders
7950
8093
  });
7951
8094
  if (debug)
7952
8095
  console.log(`[SSR] ${pathname} - Response created (cached stream): ${(performance.now() - t0).toFixed(2)}ms (creation: ${(performance.now() - tBeforeResponse).toFixed(2)}ms)`);
@@ -7957,13 +8100,14 @@ function registerSSRRoutes(app, options) {
7957
8100
  if (debug)
7958
8101
  console.log(`[SSR] ${pathname} - creating direct stream response: ${(performance.now() - t0).toFixed(2)}ms`);
7959
8102
  set.status = status;
8103
+ const streamHeaders = {
8104
+ "Content-Type": "text/html; charset=utf-8",
8105
+ "Reroute-Cache": "MISS"
8106
+ };
8107
+ addCacheControl(streamHeaders, cacheControlHeader);
7960
8108
  response = new Response(stream2, {
7961
8109
  status,
7962
- headers: {
7963
- "Content-Type": "text/html; charset=utf-8",
7964
- "Cache-Control": cacheControlHeader,
7965
- "Reroute-Cache": "MISS"
7966
- }
8110
+ headers: streamHeaders
7967
8111
  });
7968
8112
  if (debug)
7969
8113
  console.log(`[SSR] ${pathname} - Response created (direct stream): ${(performance.now() - t0).toFixed(2)}ms`);
@@ -7988,7 +8132,7 @@ function registerSSRRoutes(app, options) {
7988
8132
  head,
7989
8133
  lang,
7990
8134
  appId,
7991
- maxAge,
8135
+ maxAge: serverMaxAge,
7992
8136
  searchParams,
7993
8137
  ogConfig: options.ogConfig,
7994
8138
  ogMetaConfig: options.ogMetaConfig,
@@ -8040,10 +8184,10 @@ function registerSSRRoutes(app, options) {
8040
8184
  }) : { body: html2, extraHeaders: {} };
8041
8185
  const resHeaders = {
8042
8186
  "Content-Type": "text/html; charset=utf-8",
8043
- "Cache-Control": cacheControlHeader,
8044
8187
  "Reroute-Cache": "MISS",
8045
8188
  ...extraHeaders
8046
8189
  };
8190
+ addCacheControl(resHeaders, cacheControlHeader);
8047
8191
  if (set.headers.link) {
8048
8192
  resHeaders.Link = set.headers.link;
8049
8193
  }
@@ -8223,10 +8367,15 @@ var reroute = () => async (app) => {
8223
8367
  ".env"
8224
8368
  ];
8225
8369
  const staticHeaders = staticConfig.headers;
8226
- const maxAge = globalConfig.app?.maxAge ?? 3600;
8227
- const directive = globalConfig.app?.directive ?? "public";
8228
- const staticMaxAge = staticConfig.maxAge ?? maxAge;
8229
- const staticDirective = staticConfig.directive ?? directive;
8370
+ const server2 = globalConfig.server;
8371
+ const serverCacheEnabled = server2?.cache ?? true;
8372
+ const serverMaxAge = server2?.maxAge ?? 3600;
8373
+ const browser = globalConfig.browser;
8374
+ const browserCacheEnabled = browser?.cache ?? true;
8375
+ const browserMaxAge = browser?.maxAge ?? 300;
8376
+ const browserDirective = browser?.directive ?? "public";
8377
+ const staticMaxAge = staticConfig.maxAge ?? serverMaxAge;
8378
+ const staticDirective = staticConfig.directive ?? browserDirective;
8230
8379
  const compression2 = globalConfig.app?.compression ?? true;
8231
8380
  const debug = globalConfig.app?.debug ?? false;
8232
8381
  const imageConfig = globalConfig.image ?? {};
@@ -8294,7 +8443,7 @@ var reroute = () => async (app) => {
8294
8443
  const clientDir = existsSync3(`${cwd}/.reroute/assets`) ? `${cwd}/.reroute` : `${cwd}/src/client`;
8295
8444
  const shouldIgnore = !ignorePatterns.length ? () => false : (file) => ignorePatterns.find((pattern) => typeof pattern === "string" ? file.includes(pattern) : pattern.test(file));
8296
8445
  const isWatchMode = Array.isArray(process.execArgv) && process.execArgv.includes("--watch") || Array.isArray(process.argv) && process.argv.includes("--watch");
8297
- const dataCacheControl = `${directive}, max-age=${maxAge}`;
8446
+ const dataCacheControl = browserCacheEnabled ? `${browserDirective}, max-age=${browserMaxAge}` : undefined;
8298
8447
  if (isWatchMode) {
8299
8448
  console.log(`[reroute] Live reload enabled`);
8300
8449
  registerLiveReloadRoutes(app, liveReloadState);
@@ -8346,8 +8495,8 @@ var reroute = () => async (app) => {
8346
8495
  if (globalConfig.redirects && globalConfig.redirects.length > 0) {
8347
8496
  registerRedirectRoutes(app, globalConfig.redirects);
8348
8497
  }
8349
- registerContentRoutes(app, cwd, collectionCache, directive, maxAge, isWatchMode);
8350
- registerSearchRoute(app, cwd, directive, maxAge, {
8498
+ registerContentRoutes(app, cwd, collectionCache, browserDirective, browserMaxAge, isWatchMode);
8499
+ registerSearchRoute(app, cwd, browserDirective, browserMaxAge, {
8351
8500
  defaultPageSize: globalConfig.search?.defaultPageSize,
8352
8501
  maxPageSize: globalConfig.search?.maxPageSize
8353
8502
  });
@@ -8357,11 +8506,11 @@ var reroute = () => async (app) => {
8357
8506
  dataCacheControl,
8358
8507
  dataCache,
8359
8508
  isWatchMode,
8360
- maxAge
8509
+ maxAge: serverMaxAge
8361
8510
  });
8362
8511
  registerArtifactsRoutes(app, cwd, fileCache, {
8363
8512
  bundleMaxAge,
8364
- directive,
8513
+ directive: browserDirective,
8365
8514
  isWatchMode
8366
8515
  });
8367
8516
  const imageCacheDir = `${cwd}/.reroute/image-cache`;
@@ -8394,7 +8543,7 @@ var reroute = () => async (app) => {
8394
8543
  try {
8395
8544
  registerRobotsRoute(app, {
8396
8545
  cwd,
8397
- maxAge: robotsConfig.maxAge ?? maxAge,
8546
+ maxAge: robotsConfig.maxAge ?? browserMaxAge,
8398
8547
  isWatchMode,
8399
8548
  robotsCache,
8400
8549
  robotsConfig,
@@ -8413,7 +8562,7 @@ var reroute = () => async (app) => {
8413
8562
  cwd,
8414
8563
  collections: collections2,
8415
8564
  baseUrl: sitemapBaseUrl,
8416
- maxAge,
8565
+ maxAge: browserMaxAge,
8417
8566
  isWatchMode,
8418
8567
  sitemapCache,
8419
8568
  sitemapConfig
@@ -8430,7 +8579,7 @@ var reroute = () => async (app) => {
8430
8579
  clientDir,
8431
8580
  collections: collections2,
8432
8581
  baseUrl: rssBaseUrl,
8433
- maxAge,
8582
+ maxAge: browserMaxAge,
8434
8583
  isWatchMode,
8435
8584
  rssCache,
8436
8585
  rssConfig
@@ -8448,8 +8597,8 @@ var reroute = () => async (app) => {
8448
8597
  cwd,
8449
8598
  isWatchMode,
8450
8599
  getBundleUrl,
8451
- maxAge,
8452
- directive,
8600
+ maxAge: serverMaxAge,
8601
+ directive: browserDirective,
8453
8602
  llmsConfig,
8454
8603
  collections: collections2,
8455
8604
  dataCache
@@ -8497,8 +8646,11 @@ var reroute = () => async (app) => {
8497
8646
  head: ssrHead,
8498
8647
  lang: ssrLang,
8499
8648
  appId: ssrAppId,
8500
- maxAge,
8501
- directive,
8649
+ serverCacheEnabled,
8650
+ serverMaxAge,
8651
+ browserCacheEnabled,
8652
+ browserMaxAge,
8653
+ browserDirective,
8502
8654
  compression: compression2,
8503
8655
  streamingEnabled,
8504
8656
  streamingTimeout: globalConfig.streaming?.timeout,
@@ -8527,4 +8679,4 @@ export {
8527
8679
  reroute
8528
8680
  };
8529
8681
 
8530
- //# debugId=34902B8E9F66D1AE64756E2164756E21
8682
+ //# debugId=629776525C8E47AE64756E2164756E21