reroute-js 0.32.0 → 0.34.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 (183) hide show
  1. package/cli/bin.d.ts +1 -1
  2. package/cli/bin.js +25 -8
  3. package/cli/bin.js.map +7 -7
  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 +21 -4
  35. package/core/index.js.map +7 -7
  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 +4 -1
  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 +2 -2
  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 +3 -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 +1 -1
  95. package/core/src/ssr/render.d.ts +3 -1
  96. package/core/src/ssr/render.d.ts.map +1 -1
  97. package/core/src/ssr/stream.d.ts +3 -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 +30 -5
  101. package/elysia/index.js.map +9 -9
  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 +3 -1
  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 +44 -8
  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 +23 -9
  144. package/react/src/hooks/useContent.d.ts.map +1 -1
  145. package/react/src/hooks/useData.d.ts +1 -1
  146. package/react/src/hooks/useFeed.d.ts +1 -1
  147. package/react/src/hooks/useLayoutData.d.ts +1 -1
  148. package/react/src/hooks/useLlms.d.ts +1 -1
  149. package/react/src/hooks/useNavigate.d.ts +1 -1
  150. package/react/src/hooks/useParams.d.ts +1 -1
  151. package/react/src/hooks/useRouter.d.ts +1 -1
  152. package/react/src/hooks/useSearch.d.ts +1 -1
  153. package/react/src/hooks/useSearchParams.d.ts +1 -1
  154. package/react/src/hooks/useToc.d.ts +1 -1
  155. package/react/src/index.d.ts +1 -1
  156. package/react/src/lib/collection.d.ts +1 -1
  157. package/react/src/lib/content.d.ts +1 -1
  158. package/react/src/lib/head.d.ts +1 -1
  159. package/react/src/lib/index.d.ts +1 -1
  160. package/react/src/lib/lazy-route.d.ts +1 -1
  161. package/react/src/lib/route-loader.d.ts +1 -1
  162. package/react/src/providers/ContentProvider.d.ts +1 -1
  163. package/react/src/providers/RerouteProvider.d.ts +1 -1
  164. package/react/src/providers/RouterProvider.d.ts +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 +7 -7
  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/index.d.ts +1 -1
  181. package/telemetry/src/server/instrumentation.d.ts +1 -1
  182. package/telemetry/src/server/plugin.d.ts +1 -1
  183. package/telemetry/src/server/sourcemap.d.ts +1 -1
@@ -4,7 +4,7 @@
4
4
  "sourcesContent": [
5
5
  "import { AsyncLocalStorage } from 'node:async_hooks';\n\n/**\n * Context attributes storage using AsyncLocalStorage for request-scoped context\n * This ensures concurrent requests don't mix context data\n */\nconst contextStorage = new AsyncLocalStorage<Record<string, string>>();\n\n/**\n * Set context attributes that will be automatically attached to all telemetry\n *\n * All attributes are prefixed with 'context.' when attached to spans/logs.\n *\n * **Privacy-first:** You control what data to track. No assumptions about PII.\n *\n * @example\n * ```typescript\n * // In your auth middleware\n * setContext({\n * 'user_id': user.id,\n * 'plan': user.subscription,\n * 'region': user.region,\n * });\n *\n * // Later, when an error happens, telemetry will include:\n * // context.user_id, context.plan, context.region\n * ```\n *\n * @param attributes - Key-value pairs to attach to telemetry (values must be strings)\n */\nexport function setContext(attributes: Record<string, string>): void {\n\tconst current = contextStorage.getStore() || {};\n\tconst updated = { ...current, ...attributes };\n\n\t// Store the updated attributes in the current async context\n\t// Note: This only works within an async context (e.g., inside a request handler)\n\t// For server-wide context (rare), use a global Map with request IDs instead\n\ttry {\n\t\t// If we're already in an async context, merge\n\t\tif (contextStorage.getStore()) {\n\t\t\t// AsyncLocalStorage doesn't have a way to update in place\n\t\t\t// So we need to be called from within the context that was created\n\t\t\t// This is typically fine since it's called from request handlers\n\t\t}\n\t} catch {\n\t\t// Not in async context - will be set when request starts\n\t}\n\n\t// Store globally as fallback for non-async contexts\n\tglobalContextAttributes = updated;\n}\n\n/**\n * Clear all context attributes\n *\n * Call this when a user logs out or when you want to reset context\n *\n * @example\n * ```typescript\n * app.post('/logout', async () => {\n * clearContext();\n * // ... logout logic\n * });\n * ```\n */\nexport function clearContext(): void {\n\tglobalContextAttributes = {};\n}\n\n/**\n * Get current context attributes\n * Returns attributes from async context if available, otherwise from global fallback\n *\n * @internal\n */\nexport function getContextAttr(): Record<string, string> {\n\treturn contextStorage.getStore() || globalContextAttributes || {};\n}\n\n// Global fallback for non-async contexts\nlet globalContextAttributes: Record<string, string> = {};\n\n/**\n * Get context attributes formatted for OpenTelemetry spans/logs\n * Prefixes all keys with 'context.'\n *\n * @internal\n */\nexport function getContextAttributesForTelemetry(): Record<string, string> {\n\tconst attrs = getContextAttr();\n\tconst prefixed: Record<string, string> = {};\n\n\tfor (const [key, value] of Object.entries(attrs)) {\n\t\tprefixed[`context.${key}`] = value;\n\t}\n\n\treturn prefixed;\n}\n",
6
6
  "/**\n * Telemetry utilities for instrumenting operations\n *\n * This module provides helpers to create spans for custom instrumentation:\n * - API endpoints\n * - Database queries\n * - External service calls\n * - Business logic operations\n */\n\nimport { context, type Span, SpanStatusCode, trace } from '@opentelemetry/api';\n\n// Check if OpenTelemetry is available (lazy loaded to avoid requiring it)\nlet otelAvailable: boolean | undefined;\n\nfunction isOtelAvailable(): boolean {\n\tif (otelAvailable !== undefined) return otelAvailable;\n\n\ttry {\n\t\t// Check if @opentelemetry/api is available\n\t\trequire('@opentelemetry/api');\n\t\totelAvailable = true;\n\t\treturn true;\n\t} catch {\n\t\totelAvailable = false;\n\t\treturn false;\n\t}\n}\n\n/**\n * No-op span implementation when OpenTelemetry is not available\n * Implements the Span interface but all methods do nothing\n */\nclass NoopSpan implements Span {\n\tspanContext() {\n\t\treturn {\n\t\t\ttraceId: '',\n\t\t\tspanId: '',\n\t\t\ttraceFlags: 0,\n\t\t};\n\t}\n\tsetAttribute() {\n\t\treturn this;\n\t}\n\tsetAttributes() {\n\t\treturn this;\n\t}\n\taddEvent() {\n\t\treturn this;\n\t}\n\taddLink() {\n\t\treturn this;\n\t}\n\taddLinks() {\n\t\treturn this;\n\t}\n\tsetStatus() {\n\t\treturn this;\n\t}\n\tupdateName() {\n\t\treturn this;\n\t}\n\tend() {}\n\tisRecording() {\n\t\treturn false;\n\t}\n\trecordException() {}\n}\n\n// Singleton instance\nconst noopSpan = new NoopSpan();\n\n/**\n * Execute a function within a named span for distributed tracing\n *\n * @example\n * ```ts\n * const result = await withSpan('database.query', async (span) => {\n * span.setAttribute('query', 'SELECT * FROM users');\n * return await db.query('SELECT * FROM users');\n * });\n * ```\n */\nexport async function withSpan<T>(\n\tname: string,\n\tfn: (span: Span) => Promise<T>,\n\tattributes?: Record<string, string | number | boolean>,\n): Promise<T> {\n\tif (!isOtelAvailable()) {\n\t\treturn fn(noopSpan);\n\t}\n\n\tconst tracer = trace.getTracer('reroute');\n\treturn tracer.startActiveSpan(name, { attributes }, async (span) => {\n\t\ttry {\n\t\t\tconst result = await fn(span);\n\t\t\tspan.end();\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tspan.recordException(error as Error);\n\t\t\tspan.setStatus({\n\t\t\t\tcode: SpanStatusCode.ERROR,\n\t\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t\tspan.end();\n\t\t\tthrow error;\n\t\t}\n\t});\n}\n\n/**\n * Execute a synchronous function within a named span\n */\nexport function withSpanSync<T>(\n\tname: string,\n\tfn: (span: Span) => T,\n\tattributes?: Record<string, string | number | boolean>,\n): T {\n\tif (!isOtelAvailable()) {\n\t\treturn fn(noopSpan);\n\t}\n\n\tconst tracer = trace.getTracer('reroute');\n\treturn tracer.startActiveSpan(name, { attributes }, (span) => {\n\t\ttry {\n\t\t\tconst result = fn(span);\n\t\t\tspan.end();\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tspan.recordException(error as Error);\n\t\t\tspan.setStatus({\n\t\t\t\tcode: SpanStatusCode.ERROR,\n\t\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t\tspan.end();\n\t\t\tthrow error;\n\t\t}\n\t});\n}\n\n/**\n * Add attributes to the current active span (if available)\n */\nexport function setSpanAttributes(\n\tattributes: Record<string, string | number | boolean>,\n) {\n\tif (!isOtelAvailable()) return;\n\n\tconst span = trace.getActiveSpan();\n\tif (span) {\n\t\tspan.setAttributes(attributes);\n\t}\n}\n\n/**\n * Record an event in the current active span\n */\nexport function addSpanEvent(\n\tname: string,\n\tattributes?: Record<string, string | number | boolean>,\n) {\n\tif (!isOtelAvailable()) return;\n\n\tconst span = trace.getActiveSpan();\n\tif (span) {\n\t\tspan.addEvent(name, attributes);\n\t}\n}\n\n/**\n * Execute a function within the context of a parent span\n * This ensures child spans created inside the function are properly nested\n *\n * @example\n * ```ts\n * const parentSpan = store.telemetrySpan;\n * await withParentSpan(parentSpan, async () => {\n * // Any spans created here will be children of parentSpan\n * await withSpan('child.operation', async () => {...});\n * });\n * ```\n */\nexport async function withParentSpan<T>(\n\tparentSpan: Span | undefined | null,\n\tfn: () => Promise<T>,\n): Promise<T> {\n\tif (!(isOtelAvailable() && parentSpan)) {\n\t\treturn fn();\n\t}\n\n\t// Set the parent span as active in the context\n\tconst ctx = trace.setSpan(context.active(), parentSpan);\n\treturn context.with(ctx, fn);\n}\n\n/**\n * Execute a synchronous function within the context of a parent span\n */\nexport function withParentSpanSync<T>(\n\tparentSpan: Span | undefined | null,\n\tfn: () => T,\n): T {\n\tif (!(isOtelAvailable() && parentSpan)) {\n\t\treturn fn();\n\t}\n\n\tconst ctx = trace.setSpan(context.active(), parentSpan);\n\treturn context.with(ctx, fn);\n}\n\n/**\n * Extract W3C Trace Context from incoming HTTP request headers\n * Returns the extracted context or undefined if not available\n *\n * @example\n * ```ts\n * const traceContext = extractTraceContext(request.headers);\n * ```\n */\nexport function extractTraceContext(\n\theaders: Headers | Record<string, string | undefined>,\n): ReturnType<typeof context.active> | undefined {\n\tif (!isOtelAvailable()) return undefined;\n\n\ttry {\n\t\tconst { propagation } = require('@opentelemetry/api');\n\n\t\t// Create a carrier object that matches the W3C Trace Context format\n\t\tconst carrier: Record<string, string | undefined> = {};\n\n\t\tif (headers instanceof Headers) {\n\t\t\tcarrier.traceparent = headers.get('traceparent') || undefined;\n\t\t\tcarrier.tracestate = headers.get('tracestate') || undefined;\n\t\t} else {\n\t\t\tcarrier.traceparent = headers.traceparent;\n\t\t\tcarrier.tracestate = headers.tracestate;\n\t\t}\n\n\t\t// If no traceparent header, return undefined\n\t\tif (!carrier.traceparent) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Extract context from carrier\n\t\treturn propagation.extract(context.active(), carrier);\n\t} catch (error) {\n\t\tconsole.error('[telemetry] Failed to extract trace context:', error);\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Get the trace context from a span for injection into browser\n * Returns an object with traceparent and tracestate (if available)\n *\n * @example\n * ```ts\n * const span = store.telemetrySpan;\n * const traceContext = getTraceContextForInjection(span);\n * // Inject into HTML: <script>window.__TRACE_CONTEXT__ = {...traceContext};</script>\n * ```\n */\nexport function getTraceContextForInjection(\n\tspan: Span | undefined | null,\n): { traceparent?: string; tracestate?: string } | undefined {\n\tif (!(isOtelAvailable() && span)) return undefined;\n\n\ttry {\n\t\tconst { propagation } = require('@opentelemetry/api');\n\t\tconst carrier: Record<string, string | undefined> = {};\n\n\t\t// Set the span as active and inject context\n\t\tconst ctx = trace.setSpan(context.active(), span);\n\t\tpropagation.inject(ctx, carrier);\n\n\t\treturn {\n\t\t\ttraceparent: carrier.traceparent,\n\t\t\ttracestate: carrier.tracestate,\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\n\t\t\t'[telemetry] Failed to get trace context for injection:',\n\t\t\terror,\n\t\t);\n\t\treturn undefined;\n\t}\n}\n",
7
- "import { pathToFileURL } from 'node:url';\nimport type { ComponentType } from 'react';\n\n// biome-ignore lint/suspicious/noExplicitAny: The user document\ntype Doc = any;\ninterface StreamingOptions {\n\tenabled?: boolean;\n\tdefaultSkeleton?: ComponentType | string;\n\tdefaultLayoutSkeleton?: ComponentType | string;\n}\n\n/**\n * Sitemap configuration options\n */\ninterface SitemapOptions {\n\t/** Enable sitemap generation (default: false) */\n\tenabled?: boolean;\n\n\t/** Base URL for sitemap generation (e.g., 'https://example.com') - required when enabled */\n\tbaseUrl?: string;\n\n\t/**\n\t * Maximum URLs per sitemap file before pagination (default: 50000)\n\t * When exceeded, creates multiple sitemap files with a sitemap index\n\t * Set lower for testing (e.g., 10) to verify pagination works\n\t */\n\tmaxUrlsPerPage?: number;\n\n\t/**\n\t * Completely exclude specific routes from the sitemap\n\t * Routes listed here will not appear in the sitemap at all\n\t * @example ['/admin', '/api']\n\t */\n\texcludeRoutes?: string[];\n\n\t/**\n\t * Exclude specific routes from SSR data array discovery\n\t * Routes listed here will still appear in the sitemap as single entries,\n\t * but won't generate multiple URLs from arrays found in their SSR data\n\t * @example ['/download', '/pricing'] - these routes appear once, not per array item\n\t */\n\texcludeDiscovery?: string[];\n\n\t/**\n\t * Extract urls from ssr.data result (full control over data shape)\n\t * If provided, this takes precedence over automatic array discovery\n\t * @param data - Full ssr.data result\n\t * @param routePattern - The route pattern (e.g., '/changelog')\n\t * @returns Array of items to process, or null/undefined to skip this route\n\t */\n\textractUrls?: (data: Doc, routePattern: string) => Doc[] | null | undefined;\n\n\t/**\n\t * Extract URL segment from ssr.data items\n\t * @param item - Data item from ssr.data result\n\t * @param routePattern - The route pattern (e.g., '/changelog')\n\t * @returns URL segment to append to routePattern (e.g., '0.1.0' -> '/changelog/0.1.0')\n\t */\n\textractUrl?: (item: Doc, routePattern: string) => string | null | undefined;\n\n\t/**\n\t * Extract lastmod date from ssr.data items\n\t * @param item - Data item from ssr.data result\n\t * @returns ISO date string or undefined\n\t */\n\textractLastmod?: (item: Doc) => string | undefined;\n\n\t/** Default changefreq for URLs */\n\tchangefreq?:\n\t\t| 'always'\n\t\t| 'hourly'\n\t\t| 'daily'\n\t\t| 'weekly'\n\t\t| 'monthly'\n\t\t| 'yearly'\n\t\t| 'never';\n\n\t/** Default priority for URLs */\n\tpriority?: number;\n}\n\n/**\n * RSS feed configuration options\n */\ninterface RSSOptions {\n\t/** Enable RSS feed generation (default: false) */\n\tenabled?: boolean;\n\n\t/** Base URL for RSS feeds (e.g., 'https://example.com') - required when enabled */\n\tbaseUrl?: string;\n\n\t/** Feed title (e.g., 'My Blog') */\n\ttitle?: string;\n\n\t/** Feed description */\n\tdescription?: string;\n\n\t/** Maximum number of items per feed (default: 50) */\n\tlimit?: number;\n\n\t/** Feed format: 'rss' or 'atom' (default: 'rss') */\n\tformat?: 'rss' | 'atom';\n\n\t/**\n\t * Completely exclude specific routes from the RSS feed\n\t * Routes listed here will not appear in the feed at all\n\t * @example ['/admin', '/api']\n\t */\n\texcludeRoutes?: string[];\n\n\t/**\n\t * Exclude specific routes from SSR data array discovery\n\t * Routes listed here won't generate multiple feed items from arrays in their SSR data,\n\t * but may still generate a single feed item if appropriate\n\t * @example ['/download', '/pricing'] - won't generate items per array entry\n\t */\n\texcludeDiscovery?: string[];\n\n\t/**\n\t * Extract items from ssr.data result (full control over data shape)\n\t * If provided, this takes precedence over automatic array discovery\n\t * @param data - Full ssr.data result\n\t * @param routePattern - The route pattern (e.g., '/changelog')\n\t * @returns Array of items to process, or null/undefined to skip this route\n\t */\n\textractUrls?: (data: Doc, routePattern: string) => Doc[] | null | undefined;\n\n\t/**\n\t * Extract URL segment from ssr.data items (same as sitemap)\n\t */\n\textractUrl?: (item: Doc, routePattern: string) => string | null | undefined;\n\n\t/**\n\t * Extract publication date from items\n\t */\n\textractPubDate?: (item: Doc) => string | undefined;\n\n\t/**\n\t * Extract author from items\n\t */\n\textractAuthor?: (item: Doc) => string | undefined;\n\n\t/**\n\t * Extract content/body from items\n\t */\n\textractContent?: (item: Doc) => string | undefined;\n\n\t/**\n\t * Extract description/summary from items\n\t * Falls back to item.description or item.excerpt if not provided\n\t */\n\textractDescription?: (item: Doc) => string | undefined;\n}\n\n/**\n * Markdown configuration options\n */\ninterface MarkdownOptions {\n\t/**\n\t * Custom components to use when rendering markdown\n\t * Path to a module that exports a components object compatible with Streamdown\n\t * @example './src/client/lib/markdown-components'\n\t */\n\tcomponents?: string;\n\n\t/** Enable GitHub Flavored Markdown (default: true if remark-gfm is installed) */\n\tenableGfm?: boolean;\n\n\t/** Shiki theme for syntax highlighting (default: 'github-dark') */\n\ttheme?: string;\n}\n\n/**\n * Search index configuration options\n */\ninterface SearchOptions {\n\t/** Enable search index generation (default: false) */\n\tenabled?: boolean;\n\n\t/**\n\t * Collections to include in search index\n\t * @default [] - all collections will be indexed\n\t * @example ['blog', 'docs']\n\t */\n\tcollections?: string[];\n\n\t/**\n\t * Include full content text in search (increases index size significantly)\n\t * @default false - only index headings and metadata\n\t */\n\tincludeContent?: boolean;\n\n\t/**\n\t * Maximum content length to index per item (characters)\n\t * @default 5000 - prevents huge content from bloating index\n\t */\n\tcontentLimit?: number;\n\n\t/**\n\t * Fields to index from frontmatter metadata\n\t * @default ['title', 'description', 'excerpt', 'tags']\n\t */\n\tmetaFields?: string[];\n\n\t/**\n\t * Minimum heading level to index (1-6)\n\t * @default 1 - index all headings\n\t */\n\tminHeadingLevel?: number;\n\n\t/**\n\t * Maximum heading level to index (1-6)\n\t * @default 6 - index all headings\n\t */\n\tmaxHeadingLevel?: number;\n\n\t/**\n\t * Default page size for paginated results\n\t * @default 20\n\t */\n\tdefaultPageSize?: number;\n\n\t/**\n\t * Maximum allowed page size (prevents excessive results)\n\t * @default 100\n\t */\n\tmaxPageSize?: number;\n}\n\ninterface OGImageFont {\n\t/** Font family name (e.g., 'Inter') */\n\tname: string;\n\t/** Path to font file (TTF, OTF, or WOFF) relative to project root */\n\tpath: string;\n\t/** Font weight (e.g., 400, 700, 900) */\n\tweight?: number;\n\t/** Font style (default: 'normal') */\n\tstyle?:\n\t\t| 'normal'\n\t\t| 'italic'\n\t\t| 'bold'\n\t\t| 'bold-italic'\n\t\t| 'medium'\n\t\t| 'medium-italic'\n\t\t| 'semibold'\n\t\t| 'semibold-italic'\n\t\t| 'light'\n\t\t| 'light-italic'\n\t\t| 'thin'\n\t\t| 'thin-italic'\n\t\t| 'black'\n\t\t| 'black-italic'\n\t\t| 'extra-bold'\n\t\t| 'extra-bold-italic'\n\t\t| 'extra-light'\n\t\t| 'extra-light-italic'\n\t\t| 'extra-medium'\n\t\t| 'extra-medium-italic'\n\t\t| 'extra-semibold'\n\t\t| 'extra-semibold-italic'\n\t\t| 'extra-light'\n\t\t| 'extra-light-italic'\n\t\t| 'extra-medium'\n\t\t| 'extra-medium-italic'\n\t\t| 'extra-semibold'\n\t\t| 'extra-semibold-italic';\n\tdata?: ArrayBuffer | undefined;\n}\n\n/**\n * OG Image generation configuration options\n */\ninterface OGImageOptions {\n\t/** Enable OG image generation (default: false) */\n\tenabled?: boolean;\n\n\t/** Base URL for absolute OG image URLs (e.g., 'https://example.com') - required when enabled */\n\tbaseUrl?: string;\n\n\t/** Path to default template component or 'default' for built-in template */\n\tdefaultTemplate?: string;\n\n\t/** Image width in pixels (default: 1200) */\n\twidth?: number;\n\n\t/** Image height in pixels (default: 630) */\n\theight?: number;\n\n\t/** Cache duration in seconds (default: 3600 = 1 hour) */\n\tmaxAge?: number;\n\n\t/** Default avatar/logo URL (can be external or local path) */\n\tavatar?: string;\n\n\t/** Site name to display */\n\tsiteName?: string;\n\n\t/** Custom fonts to load for OG images */\n\tfonts?: OGImageFont[];\n}\n\n/**\n * LLMs content configuration options\n */\ninterface LLMsOptions {\n\t/** Enable LLM content features (default: false) */\n\tenabled?: boolean;\n\n\t/** Base URL for absolute URLs in llms.txt index (e.g., 'https://example.com') */\n\tbaseUrl?: string;\n\n\t/** Enable .txt extension for routes (default: true when enabled) */\n\tenableTextExtension?: boolean;\n\n\t/** Enable .md extension for routes (default: true when enabled) */\n\tenableMarkdownExtension?: boolean;\n\n\t/** Enable Accept header content negotiation (default: true when enabled) */\n\tenableContentNegotiation?: boolean;\n\n\t/** Enable /llms.txt index generation (default: true when enabled) */\n\tenableIndex?: boolean;\n\n\t/** Enable /llms-full.txt generation (default: true when enabled) */\n\tenableFullContent?: boolean;\n\n\t/** Cache duration in seconds for LLM content (default: 86400 = 24 hours, or falls back to options.maxAge) */\n\tmaxAge?: number;\n\n\t/** Cache duration in seconds for llms-full.txt specifically (default: 604800 = 7 days, or falls back to llms.maxAge) */\n\tmaxAgeFull?: number;\n\n\t/** Maximum items in full content bundle (default: 10000) */\n\tmaxItems?: number;\n\n\t/** Maximum file size for full content in bytes (default: 50MB) */\n\tmaxSize?: number;\n\n\t/**\n\t * Exclude specific routes from LLM features\n\t * Supports strings (exact match or substring), RegExp, or custom functions\n\t * @example ['/admin', '/api', /^\\/private/, (path) => path.includes('draft')]\n\t */\n\texcludeRoutes?: (string | RegExp | ((pathname: string) => boolean))[];\n\n\t/**\n\t * Exclude collections from LLM features\n\t * @example ['drafts', 'private']\n\t */\n\texcludeCollections?: string[];\n\n\t/** Site name for index header */\n\tsiteName?: string;\n\n\t/** Site description for index header (brief context for LLMs) */\n\tsiteDescription?: string;\n\n\t/**\n\t * Per-collection customization for titles and descriptions\n\t * @example\n\t * ```ts\n\t * collections: {\n\t * blog: {\n\t * title: 'My Awesome Blog',\n\t * description: 'Insights and tutorials about web development'\n\t * },\n\t * docs: {\n\t * title: 'Documentation',\n\t * description: 'Complete API reference and guides'\n\t * }\n\t * }\n\t * ```\n\t */\n\tcollections?: Record<\n\t\tstring,\n\t\t{\n\t\t\t/** Custom title for this collection's LLMS index */\n\t\t\ttitle?: string;\n\t\t\t/** Custom description for this collection's LLMS index */\n\t\t\tdescription?: string;\n\t\t}\n\t>;\n}\n\n/**\n * Robots policy for specific user-agents\n */\ninterface RobotsPolicy {\n\t/** User-Agent (e.g., '*', 'Googlebot', 'GPTBot') */\n\tuserAgent: string;\n\n\t/** Paths to explicitly allow */\n\tallow?: string[];\n\n\t/** Paths to disallow */\n\tdisallow?: string[];\n\n\t/** Crawl delay for this user-agent (seconds) */\n\tcrawlDelay?: number;\n}\n\n/**\n * Robots.txt generation configuration options\n */\ninterface RobotsOptions {\n\t/** Enable robots.txt generation (default: false) */\n\tenabled?: boolean;\n\n\t/** Base URL for sitemap reference (e.g., 'https://example.com') - required when enabled */\n\tbaseUrl?: string;\n\n\t/** Cache duration in seconds (default: 86400 = 24 hours) */\n\tmaxAge?: number;\n\n\t/** Custom policies per user-agent (default: permissive) */\n\tpolicies?: RobotsPolicy[];\n\n\t/** Auto-reference sitemap.xml if sitemap is enabled (default: true) */\n\treferenceSitemap?: boolean;\n\n\t/** Auto-disallow routes excluded from sitemap (default: true) */\n\tsitemapExclusion?: boolean;\n\n\t/** Auto-disallow old redirect source paths (default: true) */\n\tredirectExclusion?: boolean;\n\n\t/** Additional raw text appended to robots.txt */\n\tcustomRules?: string;\n\n\t/** Global crawl delay in seconds (optional) */\n\tcrawlDelay?: number;\n}\n\n/**\n * Telemetry proxy configuration for forwarding browser telemetry\n */\ninterface TelemetryProxyOptions {\n\t/**\n\t * Enable browser telemetry proxy (default: true when proxy config exists)\n\t * Creates endpoints to forward browser traces/metrics/logs to OTLP backend\n\t * This avoids CORS issues and ad blockers\n\t */\n\tenabled?: boolean;\n\n\t/**\n\t * Base path for proxy endpoints (default: '/__reroute_telemetry')\n\t * Creates:\n\t * - {pathname}/v1/traces\n\t * - {pathname}/v1/metrics\n\t * - {pathname}/v1/logs\n\t * - {pathname}/health\n\t */\n\tpathname?: string;\n\n\t/**\n\t * Enable verbose logging for proxy requests\n\t * @default false\n\t */\n\tverbose?: boolean;\n\n\t/**\n\t * Custom handler for proxy requests (advanced)\n\t * If provided, replaces default OTLP forwarding logic\n\t *\n\t * @example\n\t * ```ts\n\t * handler: async ({ body, endpoint, headers }) => {\n\t * // Custom logic: filter, transform, or route to different backends\n\t * await fetch(`https://custom-backend${endpoint}`, {\n\t * method: 'POST',\n\t * headers,\n\t * body: JSON.stringify(body),\n\t * });\n\t * return { status: 200 };\n\t * }\n\t * ```\n\t */\n\thandler?: (params: {\n\t\tbody: unknown;\n\t\tendpoint: string;\n\t\theaders: Record<string, string>;\n\t\totlpEndpoint: string;\n\t}) => Promise<{ status: number }>;\n}\n\n/**\n * Browser telemetry configuration options\n */\ninterface BrowserTelemetryOptions {\n\t/**\n\t * Enable browser telemetry\n\t * @default true\n\t */\n\tenabled?: boolean;\n\n\t/**\n\t * Service name for browser telemetry\n\t * @default 'reroute-app-browser'\n\t */\n\tserviceName?: string;\n\n\t/**\n\t * Service version\n\t * @default '1.0.0'\n\t */\n\tserviceVersion?: string;\n\n\t/**\n\t * OTLP endpoint URL (use relative URL for same-origin proxy)\n\t * @default '/__reroute_telemetry'\n\t */\n\totlpEndpoint?: string;\n\n\t/**\n\t * API key for authentication (optional)\n\t */\n\tapiKey?: string;\n\n\t/**\n\t * Deployment environment (e.g., 'production', 'staging', 'development')\n\t * @default 'development'\n\t */\n\tenvironment?: string;\n\n\t/**\n\t * Enable console.error capture\n\t * @default true\n\t */\n\tenableConsoleCapture?: boolean;\n\n\t/**\n\t * Ignore specific routes/URLs from breadcrumbs and network tracking\n\t *\n\t * Note: Functions are NOT supported for browser telemetry (closures cannot be serialized)\n\t * Use strings or regex patterns instead\n\t *\n\t * @example\n\t * ```ts\n\t * ignoreRoutes: [\n\t * '/bundles/', // String prefix match\n\t * /\\.(js|css|png)$/, // Regex pattern\n\t * /^\\/assets\\//, // Regex for path prefix\n\t * ]\n\t * ```\n\t */\n\tignoreRoutes?: Array<string | RegExp>;\n}\n\n/**\n * Telemetry configuration options for OpenTelemetry integration\n */\ninterface TelemetryOptions {\n\t/**\n\t * Enable server telemetry collection (default: false)\n\t * Must be explicitly enabled to start collecting traces, metrics, and logs\n\t */\n\tenabled?: boolean;\n\n\t/**\n\t * Browser telemetry configuration\n\t * Configure browser-side telemetry separately from server\n\t */\n\tbrowser?: BrowserTelemetryOptions;\n\n\t/**\n\t * Service name for server telemetry\n\t * @default 'reroute-app'\n\t */\n\tserviceName?: string;\n\n\t/**\n\t * Service version\n\t * @default process.env.npm_package_version || '1.0.0'\n\t */\n\tserviceVersion?: string;\n\n\t/**\n\t * OTLP endpoint URL\n\t * @default process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318'\n\t */\n\totlpEndpoint?: string;\n\n\t/**\n\t * API key for authentication (optional, only needed for SigNoz Cloud)\n\t */\n\tapiKey?: string;\n\n\t/**\n\t * Deployment environment (e.g., 'production', 'staging', 'development')\n\t * Used as a deployment.environment attribute on all telemetry\n\t * @default process.env.NODE_ENV || 'development'\n\t */\n\tenvironment?: string;\n\n\t/**\n\t * Metric export interval in milliseconds\n\t * @default 5000\n\t */\n\tmetricsInterval?: number;\n\n\t/**\n\t * Browser telemetry proxy configuration\n\t * When configured, creates endpoints to forward browser telemetry to OTLP backend\n\t * This avoids CORS issues and ad blockers\n\t */\n\tproxy?: TelemetryProxyOptions;\n\n\t/**\n\t * Ignore specific routes from telemetry collection\n\t * Supports flexible pattern matching:\n\t * - String: Matches if pathname contains the string (e.g., '/assets' matches '/assets/logo.png')\n\t * - RegExp: Tests pathname against regex (e.g., /\\.(js|css)$/ matches file extensions)\n\t * - Function: Custom logic with pathname and method (server-side only)\n\t *\n\t * Note: For browser telemetry, only strings and regex are supported (functions use closures that cannot be serialized)\n\t *\n\t * @example\n\t * ```ts\n\t * ignoreRoutes: [\n\t * '/health', // String match\n\t * /\\.(js|css|png|jpg|svg|ico|woff2?)$/, // Regex for static assets\n\t * (pathname) => pathname.startsWith('/assets/'), // Function (server-side only)\n\t * (pathname, method) => method === 'OPTIONS', // Access to HTTP method (server-side only)\n\t * ]\n\t * ```\n\t */\n\tignoreRoutes?: (\n\t\t| string\n\t\t| RegExp\n\t\t| ((pathname: string, method: string) => boolean)\n\t)[];\n\n\t/**\n\t * Enable distributed tracing (default: true)\n\t * Captures request flows across services with OpenTelemetry traces\n\t */\n\tenableTraces?: boolean;\n\n\t/**\n\t * Enable metrics collection (default: true)\n\t * Captures counters, gauges, and histograms for request volume, duration, etc.\n\t */\n\tenableMetrics?: boolean;\n\n\t/**\n\t * Enable structured logging (default: true)\n\t * Captures log events with structured attributes for better querying\n\t */\n\tenableLogs?: boolean;\n\n\t/**\n\t * Enable system metrics collection (default: true)\n\t * Captures CPU usage, memory consumption, and process metrics\n\t */\n\tenableSystemMetrics?: boolean;\n\n\t/**\n\t * Enable console.error and console.warn capture (default: true)\n\t * Automatically creates telemetry spans for console.error/warn calls\n\t * Useful for catching errors that are logged but not thrown\n\t */\n\tenableConsoleCapture?: boolean;\n\n\t/**\n\t * Sample rate for regular requests (default: 1.0)\n\t * Controls what percentage of requests to track (0.0 = 0%, 1.0 = 100%)\n\t *\n\t * Use sampling to reduce telemetry volume and costs on high-traffic applications:\n\t * - 1.0 = Track every request (100%)\n\t * - 0.5 = Track half of requests (50%)\n\t * - 0.1 = Track 10% of requests\n\t * - 0.01 = Track 1% of requests\n\t *\n\t * Sampling uses random selection, so a 10% sample of 100,000 requests\n\t * still provides ~10,000 data points for statistical analysis\n\t *\n\t * @example sampleRate: 0.1 // Track 10% of requests\n\t */\n\tsampleRate?: number;\n\n\t/**\n\t * Sample rate for error requests (default: 1.0)\n\t * Controls what percentage of errors to track (0.0 = 0%, 1.0 = 100%)\n\t *\n\t * Typically set higher than sampleRate since errors are more important to track.\n\t * Common pattern: low sample rate for normal requests, 100% for errors\n\t *\n\t * @example\n\t * ```ts\n\t * sampleRate: 0.1, // Track 10% of normal requests\n\t * errorSampleRate: 1.0, // Track 100% of errors\n\t * ```\n\t */\n\terrorSampleRate?: number;\n\n\t/**\n\t * HTTP headers to capture as span/log attributes\n\t * Headers are captured with 'http.request.header.' prefix\n\t *\n\t * @example\n\t * ```ts\n\t * captureHeaders: ['user-agent', 'referer', 'x-custom-header']\n\t * // Creates attributes like:\n\t * // - http.request.header.user-agent\n\t * // - http.request.header.referer\n\t * ```\n\t */\n\tcaptureHeaders?: string[];\n\n\t/**\n\t * Custom attributes to add to all spans and logs\n\t * Useful for tagging telemetry with environment, region, version, etc.\n\t *\n\t * @example\n\t * ```ts\n\t * customAttributes: {\n\t * environment: 'production',\n\t * region: 'us-east-1',\n\t * version: '1.2.3',\n\t * }\n\t * ```\n\t */\n\tcustomAttributes?: Record<string, string | number | boolean>;\n\n\t/**\n\t * Source map configuration for production error tracking\n\t * When enabled, error stack traces are mapped to original source files\n\t * instead of compiled/minified code\n\t *\n\t * @example\n\t * ```ts\n\t * sourcemaps: {\n\t * enabled: true, // Enable sourcemap resolution\n\t * }\n\t * ```\n\t */\n\tsourcemaps?: {\n\t\t/**\n\t\t * Enable sourcemap resolution\n\t\t * @default true in production, false in development\n\t\t */\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * Redirect handler function that can dynamically determine destination\n * @param url - The original URL object\n * @returns The destination path/url or null to skip redirect\n */\ntype RedirectHandler = (url: URL) => string | null | Promise<string | null>;\n\n/**\n * Individual redirect rule\n */\ninterface RedirectRule {\n\t/** Source path (string or regex pattern) */\n\tsource: string | RegExp;\n\t/** Destination path or handler function */\n\tdestination: string | RedirectHandler;\n\t/** HTTP status code (301 = permanent, 302 = temporary, 307 = preserve method, 308 = permanent preserve method) */\n\tstatus?: 301 | 302 | 307 | 308;\n\t/** Whether source is a regex pattern (auto-detected if source is RegExp) */\n\tregex?: boolean;\n}\n\ninterface ConfigOptions {\n\t// App component - must be string path in config (not ReactElement)\n\tapp?: string;\n\n\t// SSR options\n\thead?: string;\n\tlang?: string;\n\tappId?: string;\n\n\t// Static serving options\n\tassets?: string;\n\tprefix?: string;\n\tignorePatterns?: (string | RegExp)[];\n\tstaticHeaders?: Record<string, string>;\n\tmaxAge?: number;\n\tdirective?: string;\n\tindexHTML?: boolean;\n\n\t// Build options\n\tminify?: boolean;\n\n\t// Compression (applies to both sync and streaming SSR)\n\tcompression?: boolean;\n\n\t// Debug mode - enables detailed performance logging\n\tdebug?: boolean;\n\n\t// Image optimization options\n\timageMaxAge?: number;\n\timageAllowedDomains?: string[];\n\timageMaxWidth?: number;\n\timageMaxHeight?: number;\n\n\t// Bundle caching options\n\tbundleMaxAge?: number;\n}\n\ninterface RerouteConfig {\n\toptions?: ConfigOptions;\n\tstreaming?: StreamingOptions;\n\tredirects?: RedirectRule[];\n\tsitemap?: SitemapOptions;\n\trss?: RSSOptions;\n\tmarkdown?: MarkdownOptions;\n\tsearch?: SearchOptions;\n\togImage?: OGImageOptions;\n\tllms?: LLMsOptions;\n\trobots?: RobotsOptions;\n\ttelemetry?: TelemetryOptions;\n}\n\nfunction defineConfig(config: RerouteConfig): RerouteConfig {\n\treturn config;\n}\n\nasync function loadConfig(cwd: string): Promise<RerouteConfig> {\n\t// Check for bundled config first (compiled binary support)\n\tconst bundledConfig = (globalThis as Record<string, unknown>)\n\t\t.__REROUTE_CONFIG__ as RerouteConfig | undefined;\n\tif (bundledConfig) {\n\t\treturn bundledConfig;\n\t}\n\n\t// Fallback to filesystem read (dev mode)\n\tconst configPath = `${cwd}/reroute.config.ts`;\n\tconst configFile = Bun.file(configPath);\n\n\tif (!(await configFile.exists())) {\n\t\treturn {};\n\t}\n\n\ttry {\n\t\tconst mod = await import(\n\t\t\t`${pathToFileURL(configPath).href}?t=${Date.now()}`\n\t\t);\n\t\treturn (mod.default || mod) as RerouteConfig;\n\t} catch (error) {\n\t\tconsole.warn('[reroute] Failed to load reroute.config.ts:', error);\n\t\treturn {};\n\t}\n}\n\nexport {\n\tdefineConfig,\n\tloadConfig,\n\ttype BrowserTelemetryOptions,\n\ttype ConfigOptions,\n\ttype LLMsOptions,\n\ttype MarkdownOptions,\n\ttype OGImageOptions,\n\ttype OGImageFont,\n\ttype RedirectRule,\n\ttype RerouteConfig,\n\ttype RobotsOptions,\n\ttype RobotsPolicy,\n\ttype RSSOptions,\n\ttype SearchOptions,\n\ttype SitemapOptions,\n\ttype StreamingOptions,\n\ttype TelemetryOptions,\n\ttype TelemetryProxyOptions,\n};\n",
7
+ "import { pathToFileURL } from 'node:url';\nimport type { ComponentType } from 'react';\n\n// biome-ignore lint/suspicious/noExplicitAny: The user document\ntype Doc = any;\ninterface StreamingOptions {\n\tenabled?: boolean;\n\tdefaultSkeleton?: ComponentType | string;\n\tdefaultLayoutSkeleton?: ComponentType | string;\n}\n\n/**\n * Sitemap configuration options\n */\ninterface SitemapOptions {\n\t/** Enable sitemap generation (default: false) */\n\tenabled?: boolean;\n\n\t/** Base URL for sitemap generation (e.g., 'https://example.com') - required when enabled */\n\tbaseUrl?: string;\n\n\t/**\n\t * Maximum URLs per sitemap file before pagination (default: 50000)\n\t * When exceeded, creates multiple sitemap files with a sitemap index\n\t * Set lower for testing (e.g., 10) to verify pagination works\n\t */\n\tmaxUrlsPerPage?: number;\n\n\t/**\n\t * Completely exclude specific routes from the sitemap\n\t * Routes listed here will not appear in the sitemap at all\n\t * @example ['/admin', '/api']\n\t */\n\texcludeRoutes?: string[];\n\n\t/**\n\t * Exclude specific routes from SSR data array discovery\n\t * Routes listed here will still appear in the sitemap as single entries,\n\t * but won't generate multiple URLs from arrays found in their SSR data\n\t * @example ['/download', '/pricing'] - these routes appear once, not per array item\n\t */\n\texcludeDiscovery?: string[];\n\n\t/**\n\t * Extract urls from ssr.data result (full control over data shape)\n\t * If provided, this takes precedence over automatic array discovery\n\t * @param data - Full ssr.data result\n\t * @param routePattern - The route pattern (e.g., '/changelog')\n\t * @returns Array of items to process, or null/undefined to skip this route\n\t */\n\textractUrls?: (data: Doc, routePattern: string) => Doc[] | null | undefined;\n\n\t/**\n\t * Extract URL segment from ssr.data items\n\t * @param item - Data item from ssr.data result\n\t * @param routePattern - The route pattern (e.g., '/changelog')\n\t * @returns URL segment to append to routePattern (e.g., '0.1.0' -> '/changelog/0.1.0')\n\t */\n\textractUrl?: (item: Doc, routePattern: string) => string | null | undefined;\n\n\t/**\n\t * Extract lastmod date from ssr.data items\n\t * @param item - Data item from ssr.data result\n\t * @returns ISO date string or undefined\n\t */\n\textractLastmod?: (item: Doc) => string | undefined;\n\n\t/** Default changefreq for URLs */\n\tchangefreq?:\n\t\t| 'always'\n\t\t| 'hourly'\n\t\t| 'daily'\n\t\t| 'weekly'\n\t\t| 'monthly'\n\t\t| 'yearly'\n\t\t| 'never';\n\n\t/** Default priority for URLs */\n\tpriority?: number;\n}\n\n/**\n * RSS feed configuration options\n */\ninterface RSSOptions {\n\t/** Enable RSS feed generation (default: false) */\n\tenabled?: boolean;\n\n\t/** Base URL for RSS feeds (e.g., 'https://example.com') - required when enabled */\n\tbaseUrl?: string;\n\n\t/** Feed title (e.g., 'My Blog') */\n\ttitle?: string;\n\n\t/** Feed description */\n\tdescription?: string;\n\n\t/** Maximum number of items per feed (default: 50) */\n\tlimit?: number;\n\n\t/** Feed format: 'rss' or 'atom' (default: 'rss') */\n\tformat?: 'rss' | 'atom';\n\n\t/**\n\t * Completely exclude specific routes from the RSS feed\n\t * Routes listed here will not appear in the feed at all\n\t * @example ['/admin', '/api']\n\t */\n\texcludeRoutes?: string[];\n\n\t/**\n\t * Exclude specific routes from SSR data array discovery\n\t * Routes listed here won't generate multiple feed items from arrays in their SSR data,\n\t * but may still generate a single feed item if appropriate\n\t * @example ['/download', '/pricing'] - won't generate items per array entry\n\t */\n\texcludeDiscovery?: string[];\n\n\t/**\n\t * Extract items from ssr.data result (full control over data shape)\n\t * If provided, this takes precedence over automatic array discovery\n\t * @param data - Full ssr.data result\n\t * @param routePattern - The route pattern (e.g., '/changelog')\n\t * @returns Array of items to process, or null/undefined to skip this route\n\t */\n\textractUrls?: (data: Doc, routePattern: string) => Doc[] | null | undefined;\n\n\t/**\n\t * Extract URL segment from ssr.data items (same as sitemap)\n\t */\n\textractUrl?: (item: Doc, routePattern: string) => string | null | undefined;\n\n\t/**\n\t * Extract publication date from items\n\t */\n\textractPubDate?: (item: Doc) => string | undefined;\n\n\t/**\n\t * Extract author from items\n\t */\n\textractAuthor?: (item: Doc) => string | undefined;\n\n\t/**\n\t * Extract content/body from items\n\t */\n\textractContent?: (item: Doc) => string | undefined;\n\n\t/**\n\t * Extract description/summary from items\n\t * Falls back to item.description or item.excerpt if not provided\n\t */\n\textractDescription?: (item: Doc) => string | undefined;\n}\n\n/**\n * Markdown configuration options\n */\ninterface MarkdownOptions {\n\t/**\n\t * Custom components to use when rendering markdown\n\t * Path to a module that exports a components object compatible with Streamdown\n\t * @example './src/client/lib/markdown-components'\n\t */\n\tcomponents?: string;\n\n\t/** Enable GitHub Flavored Markdown (default: true if remark-gfm is installed) */\n\tenableGfm?: boolean;\n\n\t/** Shiki theme for syntax highlighting (default: 'github-dark') */\n\ttheme?: string;\n}\n\n/**\n * Search index configuration options\n */\ninterface SearchOptions {\n\t/** Enable search index generation (default: false) */\n\tenabled?: boolean;\n\n\t/**\n\t * Collections to include in search index\n\t * @default [] - all collections will be indexed\n\t * @example ['blog', 'docs']\n\t */\n\tcollections?: string[];\n\n\t/**\n\t * Include full content text in search (increases index size significantly)\n\t * @default false - only index headings and metadata\n\t */\n\tincludeContent?: boolean;\n\n\t/**\n\t * Maximum content length to index per item (characters)\n\t * @default 5000 - prevents huge content from bloating index\n\t */\n\tcontentLimit?: number;\n\n\t/**\n\t * Fields to index from frontmatter metadata\n\t * @default ['title', 'description', 'excerpt', 'tags']\n\t */\n\tmetaFields?: string[];\n\n\t/**\n\t * Minimum heading level to index (1-6)\n\t * @default 1 - index all headings\n\t */\n\tminHeadingLevel?: number;\n\n\t/**\n\t * Maximum heading level to index (1-6)\n\t * @default 6 - index all headings\n\t */\n\tmaxHeadingLevel?: number;\n\n\t/**\n\t * Default page size for paginated results\n\t * @default 20\n\t */\n\tdefaultPageSize?: number;\n\n\t/**\n\t * Maximum allowed page size (prevents excessive results)\n\t * @default 100\n\t */\n\tmaxPageSize?: number;\n}\n\ninterface OGImageFont {\n\t/** Font family name (e.g., 'Inter') */\n\tname: string;\n\t/** Path to font file (TTF, OTF, or WOFF) relative to project root */\n\tpath: string;\n\t/** Font weight (e.g., 400, 700, 900) */\n\tweight?: number;\n\t/** Font style (default: 'normal') */\n\tstyle?:\n\t\t| 'normal'\n\t\t| 'italic'\n\t\t| 'bold'\n\t\t| 'bold-italic'\n\t\t| 'medium'\n\t\t| 'medium-italic'\n\t\t| 'semibold'\n\t\t| 'semibold-italic'\n\t\t| 'light'\n\t\t| 'light-italic'\n\t\t| 'thin'\n\t\t| 'thin-italic'\n\t\t| 'black'\n\t\t| 'black-italic'\n\t\t| 'extra-bold'\n\t\t| 'extra-bold-italic'\n\t\t| 'extra-light'\n\t\t| 'extra-light-italic'\n\t\t| 'extra-medium'\n\t\t| 'extra-medium-italic'\n\t\t| 'extra-semibold'\n\t\t| 'extra-semibold-italic'\n\t\t| 'extra-light'\n\t\t| 'extra-light-italic'\n\t\t| 'extra-medium'\n\t\t| 'extra-medium-italic'\n\t\t| 'extra-semibold'\n\t\t| 'extra-semibold-italic';\n\tdata?: ArrayBuffer | undefined;\n}\n\n/**\n * OG Image generation configuration options\n */\ninterface OGImageOptions {\n\t/** Enable OG image generation (default: false) */\n\tenabled?: boolean;\n\n\t/** Base URL for absolute OG image URLs (e.g., 'https://example.com') - required when enabled */\n\tbaseUrl?: string;\n\n\t/** Path to default template component or 'default' for built-in template */\n\tdefaultTemplate?: string;\n\n\t/** Image width in pixels (default: 1200) */\n\twidth?: number;\n\n\t/** Image height in pixels (default: 630) */\n\theight?: number;\n\n\t/** Cache duration in seconds (default: 3600 = 1 hour) */\n\tmaxAge?: number;\n\n\t/** Default avatar/logo URL (can be external or local path) */\n\tavatar?: string;\n\n\t/** Site name to display */\n\tsiteName?: string;\n\n\t/** Custom fonts to load for OG images */\n\tfonts?: OGImageFont[];\n}\n\n/**\n * LLMs content configuration options\n */\ninterface LLMsOptions {\n\t/** Enable LLM content features (default: false) */\n\tenabled?: boolean;\n\n\t/** Base URL for absolute URLs in llms.txt index (e.g., 'https://example.com') */\n\tbaseUrl?: string;\n\n\t/** Enable .txt extension for routes (default: true when enabled) */\n\tenableTextExtension?: boolean;\n\n\t/** Enable .md extension for routes (default: true when enabled) */\n\tenableMarkdownExtension?: boolean;\n\n\t/** Enable Accept header content negotiation (default: true when enabled) */\n\tenableContentNegotiation?: boolean;\n\n\t/** Enable /llms.txt index generation (default: true when enabled) */\n\tenableIndex?: boolean;\n\n\t/** Enable /llms-full.txt generation (default: true when enabled) */\n\tenableFullContent?: boolean;\n\n\t/** Cache duration in seconds for LLM content (default: 86400 = 24 hours, or falls back to options.maxAge) */\n\tmaxAge?: number;\n\n\t/** Cache duration in seconds for llms-full.txt specifically (default: 604800 = 7 days, or falls back to llms.maxAge) */\n\tmaxAgeFull?: number;\n\n\t/** Maximum items in full content bundle (default: 10000) */\n\tmaxItems?: number;\n\n\t/** Maximum file size for full content in bytes (default: 50MB) */\n\tmaxSize?: number;\n\n\t/**\n\t * Exclude specific routes from LLM features\n\t * Supports strings (exact match or substring), RegExp, or custom functions\n\t * @example ['/admin', '/api', /^\\/private/, (path) => path.includes('draft')]\n\t */\n\texcludeRoutes?: (string | RegExp | ((pathname: string) => boolean))[];\n\n\t/**\n\t * Exclude collections from LLM features\n\t * @example ['drafts', 'private']\n\t */\n\texcludeCollections?: string[];\n\n\t/** Site name for index header */\n\tsiteName?: string;\n\n\t/** Site description for index header (brief context for LLMs) */\n\tsiteDescription?: string;\n\n\t/**\n\t * Per-collection customization for titles and descriptions\n\t * @example\n\t * ```ts\n\t * collections: {\n\t * blog: {\n\t * title: 'My Awesome Blog',\n\t * description: 'Insights and tutorials about web development'\n\t * },\n\t * docs: {\n\t * title: 'Documentation',\n\t * description: 'Complete API reference and guides'\n\t * }\n\t * }\n\t * ```\n\t */\n\tcollections?: Record<\n\t\tstring,\n\t\t{\n\t\t\t/** Custom title for this collection's LLMS index */\n\t\t\ttitle?: string;\n\t\t\t/** Custom description for this collection's LLMS index */\n\t\t\tdescription?: string;\n\t\t}\n\t>;\n}\n\n/**\n * Robots policy for specific user-agents\n */\ninterface RobotsPolicy {\n\t/** User-Agent (e.g., '*', 'Googlebot', 'GPTBot') */\n\tuserAgent: string;\n\n\t/** Paths to explicitly allow */\n\tallow?: string[];\n\n\t/** Paths to disallow */\n\tdisallow?: string[];\n\n\t/** Crawl delay for this user-agent (seconds) */\n\tcrawlDelay?: number;\n}\n\n/**\n * Robots.txt generation configuration options\n */\ninterface RobotsOptions {\n\t/** Enable robots.txt generation (default: false) */\n\tenabled?: boolean;\n\n\t/** Base URL for sitemap reference (e.g., 'https://example.com') - required when enabled */\n\tbaseUrl?: string;\n\n\t/** Cache duration in seconds (default: 86400 = 24 hours) */\n\tmaxAge?: number;\n\n\t/** Custom policies per user-agent (default: permissive) */\n\tpolicies?: RobotsPolicy[];\n\n\t/** Auto-reference sitemap.xml if sitemap is enabled (default: true) */\n\treferenceSitemap?: boolean;\n\n\t/** Auto-disallow routes excluded from sitemap (default: true) */\n\tsitemapExclusion?: boolean;\n\n\t/** Auto-disallow old redirect source paths (default: true) */\n\tredirectExclusion?: boolean;\n\n\t/** Additional raw text appended to robots.txt */\n\tcustomRules?: string;\n\n\t/** Global crawl delay in seconds (optional) */\n\tcrawlDelay?: number;\n}\n\n/**\n * Telemetry proxy configuration for forwarding browser telemetry\n */\ninterface TelemetryProxyOptions {\n\t/**\n\t * Enable browser telemetry proxy (default: true when proxy config exists)\n\t * Creates endpoints to forward browser traces/metrics/logs to OTLP backend\n\t * This avoids CORS issues and ad blockers\n\t */\n\tenabled?: boolean;\n\n\t/**\n\t * Base path for proxy endpoints (default: '/__reroute_telemetry')\n\t * Creates:\n\t * - {pathname}/v1/traces\n\t * - {pathname}/v1/metrics\n\t * - {pathname}/v1/logs\n\t * - {pathname}/health\n\t */\n\tpathname?: string;\n\n\t/**\n\t * Enable verbose logging for proxy requests\n\t * @default false\n\t */\n\tverbose?: boolean;\n\n\t/**\n\t * Custom handler for proxy requests (advanced)\n\t * If provided, replaces default OTLP forwarding logic\n\t *\n\t * @example\n\t * ```ts\n\t * handler: async ({ body, endpoint, headers }) => {\n\t * // Custom logic: filter, transform, or route to different backends\n\t * await fetch(`https://custom-backend${endpoint}`, {\n\t * method: 'POST',\n\t * headers,\n\t * body: JSON.stringify(body),\n\t * });\n\t * return { status: 200 };\n\t * }\n\t * ```\n\t */\n\thandler?: (params: {\n\t\tbody: unknown;\n\t\tendpoint: string;\n\t\theaders: Record<string, string>;\n\t\totlpEndpoint: string;\n\t}) => Promise<{ status: number }>;\n}\n\n/**\n * Browser telemetry configuration options\n */\ninterface BrowserTelemetryOptions {\n\t/**\n\t * Enable browser telemetry\n\t * @default true\n\t */\n\tenabled?: boolean;\n\n\t/**\n\t * Service name for browser telemetry\n\t * @default 'reroute-app-browser'\n\t */\n\tserviceName?: string;\n\n\t/**\n\t * Service version\n\t * @default '1.0.0'\n\t */\n\tserviceVersion?: string;\n\n\t/**\n\t * OTLP endpoint URL (use relative URL for same-origin proxy)\n\t * @default '/__reroute_telemetry'\n\t */\n\totlpEndpoint?: string;\n\n\t/**\n\t * API key for authentication (optional)\n\t */\n\tapiKey?: string;\n\n\t/**\n\t * Deployment environment (e.g., 'production', 'staging', 'development')\n\t * @default 'development'\n\t */\n\tenvironment?: string;\n\n\t/**\n\t * Enable console.error capture\n\t * @default true\n\t */\n\tenableConsoleCapture?: boolean;\n\n\t/**\n\t * Ignore specific routes/URLs from breadcrumbs and network tracking\n\t *\n\t * Note: Functions are NOT supported for browser telemetry (closures cannot be serialized)\n\t * Use strings or regex patterns instead\n\t *\n\t * @example\n\t * ```ts\n\t * ignoreRoutes: [\n\t * '/bundles/', // String prefix match\n\t * /\\.(js|css|png)$/, // Regex pattern\n\t * /^\\/assets\\//, // Regex for path prefix\n\t * ]\n\t * ```\n\t */\n\tignoreRoutes?: Array<string | RegExp>;\n}\n\n/**\n * Telemetry configuration options for OpenTelemetry integration\n */\ninterface TelemetryOptions {\n\t/**\n\t * Enable server telemetry collection (default: false)\n\t * Must be explicitly enabled to start collecting traces, metrics, and logs\n\t */\n\tenabled?: boolean;\n\n\t/**\n\t * Browser telemetry configuration\n\t * Configure browser-side telemetry separately from server\n\t */\n\tbrowser?: BrowserTelemetryOptions;\n\n\t/**\n\t * Service name for server telemetry\n\t * @default 'reroute-app'\n\t */\n\tserviceName?: string;\n\n\t/**\n\t * Service version\n\t * @default process.env.npm_package_version || '1.0.0'\n\t */\n\tserviceVersion?: string;\n\n\t/**\n\t * OTLP endpoint URL\n\t * @default process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318'\n\t */\n\totlpEndpoint?: string;\n\n\t/**\n\t * API key for authentication (optional, only needed for SigNoz Cloud)\n\t */\n\tapiKey?: string;\n\n\t/**\n\t * Deployment environment (e.g., 'production', 'staging', 'development')\n\t * Used as a deployment.environment attribute on all telemetry\n\t * @default process.env.NODE_ENV || 'development'\n\t */\n\tenvironment?: string;\n\n\t/**\n\t * Metric export interval in milliseconds\n\t * @default 5000\n\t */\n\tmetricsInterval?: number;\n\n\t/**\n\t * Browser telemetry proxy configuration\n\t * When configured, creates endpoints to forward browser telemetry to OTLP backend\n\t * This avoids CORS issues and ad blockers\n\t */\n\tproxy?: TelemetryProxyOptions;\n\n\t/**\n\t * Ignore specific routes from telemetry collection\n\t * Supports flexible pattern matching:\n\t * - String: Matches if pathname contains the string (e.g., '/assets' matches '/assets/logo.png')\n\t * - RegExp: Tests pathname against regex (e.g., /\\.(js|css)$/ matches file extensions)\n\t * - Function: Custom logic with pathname and method (server-side only)\n\t *\n\t * Note: For browser telemetry, only strings and regex are supported (functions use closures that cannot be serialized)\n\t *\n\t * @example\n\t * ```ts\n\t * ignoreRoutes: [\n\t * '/health', // String match\n\t * /\\.(js|css|png|jpg|svg|ico|woff2?)$/, // Regex for static assets\n\t * (pathname) => pathname.startsWith('/assets/'), // Function (server-side only)\n\t * (pathname, method) => method === 'OPTIONS', // Access to HTTP method (server-side only)\n\t * ]\n\t * ```\n\t */\n\tignoreRoutes?: (\n\t\t| string\n\t\t| RegExp\n\t\t| ((pathname: string, method: string) => boolean)\n\t)[];\n\n\t/**\n\t * Enable distributed tracing (default: true)\n\t * Captures request flows across services with OpenTelemetry traces\n\t */\n\tenableTraces?: boolean;\n\n\t/**\n\t * Enable metrics collection (default: true)\n\t * Captures counters, gauges, and histograms for request volume, duration, etc.\n\t */\n\tenableMetrics?: boolean;\n\n\t/**\n\t * Enable structured logging (default: true)\n\t * Captures log events with structured attributes for better querying\n\t */\n\tenableLogs?: boolean;\n\n\t/**\n\t * Enable system metrics collection (default: true)\n\t * Captures CPU usage, memory consumption, and process metrics\n\t */\n\tenableSystemMetrics?: boolean;\n\n\t/**\n\t * Enable console.error and console.warn capture (default: true)\n\t * Automatically creates telemetry spans for console.error/warn calls\n\t * Useful for catching errors that are logged but not thrown\n\t */\n\tenableConsoleCapture?: boolean;\n\n\t/**\n\t * Sample rate for regular requests (default: 1.0)\n\t * Controls what percentage of requests to track (0.0 = 0%, 1.0 = 100%)\n\t *\n\t * Use sampling to reduce telemetry volume and costs on high-traffic applications:\n\t * - 1.0 = Track every request (100%)\n\t * - 0.5 = Track half of requests (50%)\n\t * - 0.1 = Track 10% of requests\n\t * - 0.01 = Track 1% of requests\n\t *\n\t * Sampling uses random selection, so a 10% sample of 100,000 requests\n\t * still provides ~10,000 data points for statistical analysis\n\t *\n\t * @example sampleRate: 0.1 // Track 10% of requests\n\t */\n\tsampleRate?: number;\n\n\t/**\n\t * Sample rate for error requests (default: 1.0)\n\t * Controls what percentage of errors to track (0.0 = 0%, 1.0 = 100%)\n\t *\n\t * Typically set higher than sampleRate since errors are more important to track.\n\t * Common pattern: low sample rate for normal requests, 100% for errors\n\t *\n\t * @example\n\t * ```ts\n\t * sampleRate: 0.1, // Track 10% of normal requests\n\t * errorSampleRate: 1.0, // Track 100% of errors\n\t * ```\n\t */\n\terrorSampleRate?: number;\n\n\t/**\n\t * HTTP headers to capture as span/log attributes\n\t * Headers are captured with 'http.request.header.' prefix\n\t *\n\t * @example\n\t * ```ts\n\t * captureHeaders: ['user-agent', 'referer', 'x-custom-header']\n\t * // Creates attributes like:\n\t * // - http.request.header.user-agent\n\t * // - http.request.header.referer\n\t * ```\n\t */\n\tcaptureHeaders?: string[];\n\n\t/**\n\t * Custom attributes to add to all spans and logs\n\t * Useful for tagging telemetry with environment, region, version, etc.\n\t *\n\t * @example\n\t * ```ts\n\t * customAttributes: {\n\t * environment: 'production',\n\t * region: 'us-east-1',\n\t * version: '1.2.3',\n\t * }\n\t * ```\n\t */\n\tcustomAttributes?: Record<string, string | number | boolean>;\n\n\t/**\n\t * Source map configuration for production error tracking\n\t * When enabled, error stack traces are mapped to original source files\n\t * instead of compiled/minified code\n\t *\n\t * @example\n\t * ```ts\n\t * sourcemaps: {\n\t * enabled: true, // Enable sourcemap resolution\n\t * }\n\t * ```\n\t */\n\tsourcemaps?: {\n\t\t/**\n\t\t * Enable sourcemap resolution\n\t\t * @default true in production, false in development\n\t\t */\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * Redirect handler function that can dynamically determine destination\n * @param url - The original URL object\n * @returns The destination path/url or null to skip redirect\n */\ntype RedirectHandler = (url: URL) => string | null | Promise<string | null>;\n\n/**\n * Individual redirect rule\n */\ninterface RedirectRule {\n\t/** Source path (string or regex pattern) */\n\tsource: string | RegExp;\n\t/** Destination path or handler function */\n\tdestination: string | RedirectHandler;\n\t/** HTTP status code (301 = permanent, 302 = temporary, 307 = preserve method, 308 = permanent preserve method) */\n\tstatus?: 301 | 302 | 307 | 308;\n\t/** Whether source is a regex pattern (auto-detected if source is RegExp) */\n\tregex?: boolean;\n}\n\ninterface ConfigOptions {\n\t// App component - must be string path in config (not ReactElement)\n\tapp?: string;\n\n\t// Base URL for the application (e.g., 'https://example.com')\n\t// Used for canonical URLs, social meta tags, and other absolute URLs\n\tbaseUrl?: string;\n\n\t// SSR options\n\thead?: string;\n\tlang?: string;\n\tappId?: string;\n\n\t// SEO options\n\t/** Enable automatic canonical URL generation (default: true when baseUrl is set) */\n\tautoCanonical?: boolean;\n\n\t// Static serving options\n\tassets?: string;\n\tprefix?: string;\n\tignorePatterns?: (string | RegExp)[];\n\tstaticHeaders?: Record<string, string>;\n\tmaxAge?: number;\n\tdirective?: string;\n\tindexHTML?: boolean;\n\n\t// Build options\n\tminify?: boolean;\n\n\t// Compression (applies to both sync and streaming SSR)\n\tcompression?: boolean;\n\n\t// Debug mode - enables detailed performance logging\n\tdebug?: boolean;\n\n\t// Image optimization options\n\timageMaxAge?: number;\n\timageAllowedDomains?: string[];\n\timageMaxWidth?: number;\n\timageMaxHeight?: number;\n\n\t// Bundle caching options\n\tbundleMaxAge?: number;\n}\n\ninterface RerouteConfig {\n\toptions?: ConfigOptions;\n\tstreaming?: StreamingOptions;\n\tredirects?: RedirectRule[];\n\tsitemap?: SitemapOptions;\n\trss?: RSSOptions;\n\tmarkdown?: MarkdownOptions;\n\tsearch?: SearchOptions;\n\togImage?: OGImageOptions;\n\tllms?: LLMsOptions;\n\trobots?: RobotsOptions;\n\ttelemetry?: TelemetryOptions;\n}\n\nfunction defineConfig(config: RerouteConfig): RerouteConfig {\n\treturn config;\n}\n\nasync function loadConfig(cwd: string): Promise<RerouteConfig> {\n\t// Check for bundled config first (compiled binary support)\n\tconst bundledConfig = (globalThis as Record<string, unknown>)\n\t\t.__REROUTE_CONFIG__ as RerouteConfig | undefined;\n\tif (bundledConfig) {\n\t\treturn bundledConfig;\n\t}\n\n\t// Fallback to filesystem read (dev mode)\n\tconst configPath = `${cwd}/reroute.config.ts`;\n\tconst configFile = Bun.file(configPath);\n\n\tif (!(await configFile.exists())) {\n\t\treturn {};\n\t}\n\n\ttry {\n\t\tconst mod = await import(\n\t\t\t`${pathToFileURL(configPath).href}?t=${Date.now()}`\n\t\t);\n\t\treturn (mod.default || mod) as RerouteConfig;\n\t} catch (error) {\n\t\tconsole.warn('[reroute] Failed to load reroute.config.ts:', error);\n\t\treturn {};\n\t}\n}\n\nexport {\n\tdefineConfig,\n\tloadConfig,\n\ttype BrowserTelemetryOptions,\n\ttype ConfigOptions,\n\ttype LLMsOptions,\n\ttype MarkdownOptions,\n\ttype OGImageOptions,\n\ttype OGImageFont,\n\ttype RedirectRule,\n\ttype RerouteConfig,\n\ttype RobotsOptions,\n\ttype RobotsPolicy,\n\ttype RSSOptions,\n\ttype SearchOptions,\n\ttype SitemapOptions,\n\ttype StreamingOptions,\n\ttype TelemetryOptions,\n\ttype TelemetryProxyOptions,\n};\n",
8
8
  "export * from './discovery';\nexport * from './metadata';\n",
9
9
  "import type { CacheEntry } from './types';\n\n/**\n * Simple in-memory cache for SSR data.\n * Thread-safe for single-process usage.\n */\nclass SSRDataCache {\n\tprivate cache: Map<string, CacheEntry<unknown>> = new Map();\n\tprivate static cleanupInterval: NodeJS.Timeout | null = null;\n\n\tconstructor() {\n\t\t// Run cleanup every 60 seconds to remove expired entries\n\t\tif (!SSRDataCache.cleanupInterval) {\n\t\t\tSSRDataCache.cleanupInterval = setInterval(() => {\n\t\t\t\tthis.cleanup();\n\t\t\t}, 60_000);\n\t\t}\n\t}\n\n\t/**\n\t * Get cached data if available and not expired\n\t */\n\tget<T>(key: string): T | undefined {\n\t\tconst entry = this.cache.get(key);\n\t\tif (!entry) return undefined;\n\n\t\tconst age = Date.now() - entry.timestamp;\n\t\tif (age > entry.maxAge) {\n\t\t\tthis.cache.delete(key);\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn entry.data as T;\n\t}\n\n\t/**\n\t * Set data in cache with maxAge (in milliseconds)\n\t */\n\tset<T>(key: string, data: T, maxAge: number): void {\n\t\tif (maxAge <= 0) return;\n\n\t\tthis.cache.set(key, {\n\t\t\tdata,\n\t\t\ttimestamp: Date.now(),\n\t\t\tmaxAge,\n\t\t});\n\t}\n\n\t/**\n\t * Check if key exists and is not expired\n\t */\n\thas(key: string): boolean {\n\t\treturn this.get(key) !== undefined;\n\t}\n\n\t/**\n\t * Clear all cached data\n\t */\n\tclear(): void {\n\t\tthis.cache.clear();\n\t}\n\n\t/**\n\t * Remove expired entries\n\t */\n\tprivate cleanup(): void {\n\t\tconst now = Date.now();\n\t\tfor (const [key, entry] of this.cache.entries()) {\n\t\t\tif (now - entry.timestamp > entry.maxAge) {\n\t\t\t\tthis.cache.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Get cache stats (useful for debugging)\n\t */\n\tstats(): { size: number; keys: string[] } {\n\t\treturn {\n\t\t\tsize: this.cache.size,\n\t\t\tkeys: Array.from(this.cache.keys()),\n\t\t};\n\t}\n\n\t/**\n\t * Cleanup interval on shutdown\n\t */\n\tdestroy(): void {\n\t\tif (SSRDataCache.cleanupInterval) {\n\t\t\tclearInterval(SSRDataCache.cleanupInterval);\n\t\t\tSSRDataCache.cleanupInterval = null;\n\t\t}\n\t\tthis.clear();\n\t}\n}\n\n/**\n * Simple LRU Cache implementation.\n * Used for caching responses and data across requests.\n */\nexport class LRUCache<K, V> {\n\tprivate cache: Map<K, V> = new Map();\n\tprivate maxSize: number;\n\n\tconstructor(maxSize = 100) {\n\t\tthis.maxSize = maxSize;\n\t}\n\n\tget(key: K): V | undefined {\n\t\tconst value = this.cache.get(key);\n\t\tif (value !== undefined) {\n\t\t\t// Move to end (most recently used)\n\t\t\tthis.cache.delete(key);\n\t\t\tthis.cache.set(key, value);\n\t\t}\n\t\treturn value;\n\t}\n\n\tset(key: K, value: V): void {\n\t\tthis.cache.delete(key);\n\n\t\tif (this.cache.size >= this.maxSize) {\n\t\t\tconst firstKey = this.cache.keys().next().value;\n\t\t\tthis.cache.delete(firstKey as K);\n\t\t}\n\n\t\tthis.cache.set(key, value);\n\t}\n\n\thas(key: K): boolean {\n\t\treturn this.cache.has(key);\n\t}\n\n\tclear(): void {\n\t\tthis.cache.clear();\n\t}\n}\n\n// Global singleton instances using globalThis for hot reload survival\nconst getGlobalCache = (): SSRDataCache => {\n\tconst g = globalThis as typeof globalThis & {\n\t\t__REROUTE_SSR_CACHE__?: SSRDataCache;\n\t};\n\n\tif (!g.__REROUTE_SSR_CACHE__) {\n\t\tg.__REROUTE_SSR_CACHE__ = new SSRDataCache();\n\t}\n\n\treturn g.__REROUTE_SSR_CACHE__;\n};\n\nconst getGlobalStatusCache = (): SSRDataCache => {\n\tconst g = globalThis as typeof globalThis & {\n\t\t__REROUTE_STATUS_CACHE__?: SSRDataCache;\n\t};\n\n\tif (!g.__REROUTE_STATUS_CACHE__) {\n\t\tg.__REROUTE_STATUS_CACHE__ = new SSRDataCache();\n\t}\n\n\treturn g.__REROUTE_STATUS_CACHE__;\n};\n\nconst ssrCache = getGlobalCache();\nconst statusCache = getGlobalStatusCache();\n\nexport { ssrCache, statusCache, SSRDataCache };\n",
10
10
  "import { dynamicImport } from './imports';\nimport { join } from './path';\nimport type { Doc } from './types';\n\n/**\n * Load content collections for SSR rendering\n */\nexport async function loadCollections(\n\tcwd: string,\n\tisWatchMode: boolean,\n): Promise<Record<string, unknown[]>> {\n\ttry {\n\t\tconst p = join(cwd, '.reroute', 'content.ts');\n\t\tconst mod = await dynamicImport(p, isWatchMode);\n\t\treturn (mod?.byCollection || {}) as Record<string, unknown[]>;\n\t} catch {\n\t\treturn {};\n\t}\n}\n\n/**\n * Set global collections for SSR\n */\nexport function setGlobalCollections(\n\tbyCollectionForSSR: Record<string, unknown[]>,\n): void {\n\ttry {\n\t\t(globalThis as Doc).__REROUTE_COLLECTIONS__ = byCollectionForSSR;\n\t} catch {\n\t\t// Ignore errors in restricted environments\n\t}\n}\n",
@@ -16,12 +16,12 @@
16
16
  "import { importContentModuleForPath } from './modules';\nimport type { Doc } from './types';\n\n/**\n * Seed SSR module store for a content path.\n * Makes the content module available for server-side rendering.\n */\nexport async function seedSSRModuleForPath(\n\tpathname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n): Promise<void> {\n\ttry {\n\t\tconst pathOnly = pathname.split('?')[0].split('#')[0];\n\t\tconst parts = pathOnly.split('/').filter(Boolean);\n\n\t\tif (parts.length < 2) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst collection = parts[0];\n\t\tconst name = parts[1];\n\t\tconst key = `${collection}:${name}`;\n\n\t\tconst mod = await importContentModuleForPath(\n\t\t\tpathname,\n\t\t\tclientDir,\n\t\t\tcwd,\n\t\t\tisWatchMode,\n\t\t);\n\n\t\tif (!mod) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Store full module for hooks like useToc\n\t\t(globalThis as Doc).__REROUTE_SSR_MODULES__ =\n\t\t\t(globalThis as Doc).__REROUTE_SSR_MODULES__ || {};\n\t\t(globalThis as Doc).__REROUTE_SSR_MODULES__[key] = mod;\n\n\t\t// Capture exports for head injection\n\t\ttry {\n\t\t\t(globalThis as Doc).__REROUTE_SSR_EXPORTS__ =\n\t\t\t\t(globalThis as Doc).__REROUTE_SSR_EXPORTS__ || {};\n\t\t\t(globalThis as Doc).__REROUTE_SSR_EXPORTS__[key] = {\n\t\t\t\tmeta: (mod as Doc).meta || {},\n\t\t\t\tssr: (mod as Doc).ssr || {},\n\t\t\t\ttoc: (mod as Doc).toc || [],\n\t\t\t};\n\t\t} catch {\n\t\t\t// Ignore export capture errors\n\t\t}\n\t} catch {\n\t\t// Ignore seeding errors\n\t}\n}\n",
17
17
  "import { dynamicImport } from './imports';\nimport { getMatchingLayouts } from './layouts';\nimport { join } from './path';\nimport { seedSSRModuleForPath } from './seed';\nimport type { ComputeParams, Doc } from './types';\n\n/**\n * Match a route pattern against a pathname\n * Used in compiled binary mode when matchRoute isn't available\n */\nfunction matchPattern(\n\tpattern: string,\n\tpathname: string,\n): Record<string, string> | null {\n\tconst patternParts = pattern.split('/').filter(Boolean);\n\tconst pathnameParts = pathname.split('/').filter(Boolean);\n\n\tif (patternParts.length !== pathnameParts.length) {\n\t\treturn null;\n\t}\n\n\tconst params: Record<string, string> = {};\n\n\tfor (let i = 0; i < patternParts.length; i++) {\n\t\tconst patternPart = patternParts[i];\n\t\tconst pathnamePart = pathnameParts[i];\n\n\t\tif (patternPart.startsWith(':')) {\n\t\t\tparams[patternPart.slice(1)] = pathnamePart;\n\t\t} else if (patternPart !== pathnamePart) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\treturn params;\n}\n\n/**\n * Compute SSR data for client-side navigation.\n * Returns lazy markers for promises to support progressive loading.\n */\nfunction loadContentData(\n\tpathname: string,\n\tsearchParams?: URLSearchParams,\n): { key: string; data: unknown } | null {\n\ttry {\n\t\tconst parts = pathname.split('/').filter(Boolean);\n\t\tif (parts.length < 2) return null;\n\n\t\tconst key = `${parts[0]}:${parts[1]}`;\n\t\tconst g = globalThis as Doc;\n\t\tconst exp = g.__REROUTE_SSR_EXPORTS__?.[key];\n\t\tconst dataFn = (exp as Doc)?.ssr?.data as\n\t\t\t| ((ctx: Doc) => unknown | Promise<unknown>)\n\t\t\t| undefined;\n\n\t\tif (typeof dataFn === 'function') {\n\t\t\tconst rawResult = dataFn({\n\t\t\t\tpathname,\n\t\t\t\tparams: { name: parts[1] },\n\t\t\t\tsearchParams,\n\t\t\t});\n\n\t\t\tconst result = processDataResult(rawResult, pathname, pathname);\n\t\t\treturn { key: pathname, data: result };\n\t\t}\n\t} catch {\n\t\t// Content data unavailable\n\t}\n\n\treturn null;\n}\n\nfunction loadMatchedRouteData(\n\tpathname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n\tsearchParams?: URLSearchParams,\n): Promise<{ key: string; data: unknown } | null> {\n\treturn loadRouteDataInternal(\n\t\tpathname,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tsearchParams,\n\t);\n}\n\nasync function loadRouteDataInternal(\n\tpathname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n\tsearchParams?: URLSearchParams,\n): Promise<{ key: string; data: unknown } | null> {\n\ttry {\n\t\t// Check for bundled routes first (compiled binary support)\n\t\tlet routes = (globalThis as Record<string, unknown>).__REROUTE_ROUTES__ as\n\t\t\t| Doc[]\n\t\t\t| undefined;\n\t\tlet matchRouteFn: ((pathname: string) => Doc | null) | undefined;\n\n\t\t// Fallback to dynamic import (dev mode)\n\t\tif (!routes) {\n\t\t\tconst routesPath = join(cwd, '.reroute', 'routes.ts');\n\t\t\tconst m = await dynamicImport(routesPath, isWatchMode);\n\t\t\troutes = m?.routes as Doc[] | undefined;\n\t\t\tmatchRouteFn = (m as Doc)?.matchRoute as\n\t\t\t\t| ((pathname: string) => Doc | null)\n\t\t\t\t| undefined;\n\t\t} else {\n\t\t\t// In bundled mode, we need to match manually\n\t\t\tmatchRouteFn = (pathname: string) => {\n\t\t\t\tfor (const route of routes || []) {\n\t\t\t\t\tconst pattern = String(route?.pattern || '');\n\t\t\t\t\tconst match = matchPattern(pattern, pathname);\n\t\t\t\t\tif (match) {\n\t\t\t\t\t\treturn { route, params: match };\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t};\n\t\t}\n\n\t\tconst pathnameOnly = pathname.split('?')[0];\n\t\tconst match =\n\t\t\ttypeof matchRouteFn === 'function' ? matchRouteFn(pathnameOnly) : null;\n\n\t\tconst r = (match as Doc | null)?.route;\n\t\tconst paramsValue = ((match as Doc | null)?.params || {}) as Record<\n\t\t\tstring,\n\t\t\tstring\n\t\t>;\n\n\t\tif (r && typeof (r as Doc).path === 'string') {\n\t\t\t// Try to use bundled ssr export first (compiled binary)\n\t\t\tlet ssrExport = (r as Doc)?.ssr as Doc | undefined;\n\n\t\t\t// Fallback to dynamic import if not bundled (dev mode)\n\t\t\tif (!ssrExport) {\n\t\t\t\t// In dev mode, routes might be from .reroute/routes.ts which imports from streaming wrappers\n\t\t\t\t// The streaming wrapper re-exports ssr, so we should try loading from there first\n\t\t\t\tconst routePath = String((r as Doc).path);\n\t\t\t\tlet abs = join(cwd, '.reroute', 'streaming', routePath);\n\n\t\t\t\tlet mod = await dynamicImport(abs, isWatchMode).catch(() => null);\n\n\t\t\t\t// If streaming wrapper doesn't exist or fails, load from source\n\t\t\t\tif (!mod) {\n\t\t\t\t\tabs = join(clientDir, 'routes', routePath);\n\t\t\t\t\tmod = await dynamicImport(abs, isWatchMode);\n\t\t\t\t}\n\n\t\t\t\tssrExport = (mod as Doc)?.ssr as Doc | undefined;\n\t\t\t}\n\n\t\t\tconst dataFn = ssrExport?.data as\n\t\t\t\t| ((ctx: Doc) => unknown | Promise<unknown>)\n\t\t\t\t| undefined;\n\n\t\t\tif (typeof dataFn === 'function') {\n\t\t\t\tconst rawResult = dataFn({\n\t\t\t\t\tpathname,\n\t\t\t\t\tparams: paramsValue,\n\t\t\t\t\tsearchParams,\n\t\t\t\t});\n\n\t\t\t\tconst data = processDataResult(rawResult, pathname, pathname);\n\t\t\t\treturn { key: pathname, data };\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Route data unavailable\n\t}\n\n\treturn null;\n}\n\nfunction determineReturnStructure(allData: Record<string, unknown>): unknown {\n\tconst dataKeys = Object.keys(allData);\n\n\tif (dataKeys.length > 1) {\n\t\treturn { __reroute_multiple__: true, ...allData };\n\t}\n\n\tif (dataKeys.length === 1) {\n\t\tconst singleKey = dataKeys[0];\n\t\t// Keep layout key structure for proper client-side handling\n\t\tif (singleKey.startsWith('__layout:')) {\n\t\t\treturn allData;\n\t\t}\n\t\treturn allData[singleKey];\n\t}\n\n\treturn null;\n}\n\nexport async function computeSSRDataForPath(\n\tparams: ComputeParams,\n): Promise<unknown> {\n\tconst { pathname, clientDir, cwd, isWatchMode, searchParams } = params;\n\n\t// Seed content modules for potential content pages\n\ttry {\n\t\tawait seedSSRModuleForPath(pathname, clientDir, cwd, isWatchMode);\n\t} catch {\n\t\t// Continue without seeding\n\t}\n\n\t// 1) Layout data\n\tconst allData = await loadLayoutData(\n\t\tpathname,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tsearchParams,\n\t);\n\n\t// 2) Content-level data\n\tconst contentResult = loadContentData(pathname, searchParams);\n\tif (contentResult) {\n\t\t// For content pages, return directly if it's the only data\n\t\tif (Object.keys(allData).length === 0) {\n\t\t\treturn contentResult.data;\n\t\t}\n\t\tallData[contentResult.key] = contentResult.data;\n\t}\n\n\t// 3) Route-level data\n\tconst routeResult = await loadMatchedRouteData(\n\t\tpathname,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tsearchParams,\n\t);\n\tif (routeResult) {\n\t\tallData[routeResult.key] = routeResult.data;\n\t}\n\n\treturn determineReturnStructure(allData);\n}\n\nfunction processLayoutDataResult(\n\trawResult: unknown,\n\tpathname: string,\n\tlayoutKey: string,\n): unknown {\n\tif (rawResult instanceof Promise) {\n\t\treturn createLazyMarker(pathname, layoutKey);\n\t}\n\n\tif (\n\t\ttypeof rawResult === 'object' &&\n\t\trawResult !== null &&\n\t\t!Array.isArray(rawResult)\n\t) {\n\t\tconst entries = Object.entries(rawResult as Record<string, unknown>);\n\t\tconst hasPromises = entries.some(([_, v]) => v instanceof Promise);\n\n\t\tif (hasPromises) {\n\t\t\tconst flattened: Record<string, unknown> = { __flatten__: true };\n\t\t\tfor (const [k, value] of entries) {\n\t\t\t\tif (value instanceof Promise) {\n\t\t\t\t\tflattened[k] = createLazyMarker(pathname, k);\n\t\t\t\t} else {\n\t\t\t\t\tflattened[k] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn flattened;\n\t\t}\n\t}\n\n\treturn rawResult;\n}\n\nasync function processLayout(\n\tlayout: Doc,\n\tpathname: string,\n\tclientDir: string,\n\tisWatchMode: boolean,\n\tsearchParams?: URLSearchParams,\n): Promise<{ key: string; data: unknown } | null> {\n\tif (typeof layout?.path !== 'string') return null;\n\n\ttry {\n\t\t// Try to use bundled ssr export first (compiled binary)\n\t\tlet ssrExport = (layout as Doc)?.ssr as Doc | undefined;\n\n\t\t// Fallback to dynamic import if not bundled (dev mode)\n\t\tif (!ssrExport) {\n\t\t\tconst abs = join(clientDir, 'routes', String(layout.path));\n\t\t\tconst mod = await dynamicImport(abs, isWatchMode);\n\t\t\tssrExport = (mod as Doc)?.ssr as Doc | undefined;\n\t\t}\n\n\t\tconst dataFn = ssrExport?.data as\n\t\t\t| ((ctx: Doc) => unknown | Promise<unknown>)\n\t\t\t| undefined;\n\n\t\tif (typeof dataFn !== 'function') return null;\n\n\t\tconst pattern = String(layout.pattern || '/');\n\t\tconst layoutKey = `__layout:${pattern}`;\n\t\tconst rawResult = dataFn({\n\t\t\tpathname,\n\t\t\tparams: {},\n\t\t\tsearchParams,\n\t\t});\n\n\t\tconst processedData = processLayoutDataResult(\n\t\t\trawResult,\n\t\t\tpathname,\n\t\t\tlayoutKey,\n\t\t);\n\t\treturn { key: layoutKey, data: processedData };\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nasync function loadLayoutData(\n\tpathname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n\tsearchParams?: URLSearchParams,\n): Promise<Record<string, unknown>> {\n\tconst allData: Record<string, unknown> = {};\n\n\ttry {\n\t\t// Check for bundled layouts first (compiled binary support)\n\t\tlet layouts = (globalThis as Record<string, unknown>).__REROUTE_LAYOUTS__ as\n\t\t\t| Doc[]\n\t\t\t| undefined;\n\n\t\t// Fallback to dynamic import (dev mode)\n\t\tif (!layouts) {\n\t\t\tconst routesPath = join(cwd, '.reroute', 'routes.ts');\n\t\t\tconst m = await dynamicImport(routesPath, isWatchMode);\n\t\t\tlayouts = m?.layouts as Doc[] | undefined;\n\t\t}\n\n\t\tconst matchingLayouts = getMatchingLayouts(pathname, layouts);\n\n\t\tfor (const layout of matchingLayouts) {\n\t\t\tconst result = await processLayout(\n\t\t\t\tlayout,\n\t\t\t\tpathname,\n\t\t\t\tclientDir,\n\t\t\t\tisWatchMode,\n\t\t\t\tsearchParams,\n\t\t\t);\n\n\t\t\tif (result) {\n\t\t\t\tallData[result.key] = result.data;\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Routes unavailable\n\t}\n\n\treturn allData;\n}\n\nfunction processDataResult(\n\trawResult: unknown,\n\tpathname: string,\n\tkey: string,\n): unknown {\n\treturn processLayoutDataResult(rawResult, pathname, key);\n}\n\nfunction createLazyMarker(pathname: string, key: string): unknown {\n\treturn {\n\t\t__lazy__: true,\n\t\t__fetch__: `/__reroute_data?path=${encodeURIComponent(pathname)}&key=${encodeURIComponent(key)}`,\n\t};\n}\n",
18
18
  "import type { OGImageOptions } from '../config';\nimport { findOGImageForPath } from './discovery';\n\n/**\n * Generate OG image meta tags for SSR\n */\nexport async function generateOGImageMetaTags(\n\tpathname: string,\n\tclientDir: string,\n\togConfig: OGImageOptions | undefined,\n): Promise<string> {\n\tif (!ogConfig?.enabled) {\n\t\treturn '';\n\t}\n\n\tconst width = ogConfig.width || 1200;\n\tconst height = ogConfig.height || 630;\n\n\t// Check if there's an OG image component for this route\n\tconst ogPath = await findOGImageForPath(pathname, clientDir);\n\tconst hasOGImage = ogPath !== null || ogConfig.defaultTemplate;\n\n\tif (!hasOGImage) {\n\t\treturn '';\n\t}\n\n\t// Generate OG image URL (relative path)\n\t// For root (/), use /index.png; for /blog, use /blog/index.png\n\tlet ogImagePath: string;\n\tif (pathname === '/' || pathname === '') {\n\t\togImagePath = '/__reroute_og/index.png';\n\t} else if (pathname.endsWith('/')) {\n\t\togImagePath = `/__reroute_og${pathname}index.png`;\n\t} else {\n\t\togImagePath = `/__reroute_og${pathname}.png`;\n\t}\n\n\t// Convert to absolute URL if baseUrl is provided\n\tconst baseUrl = ogConfig.baseUrl;\n\tif (baseUrl) {\n\t\t// Remove trailing slash from baseUrl if present\n\t\tconst cleanBaseUrl = baseUrl.replace(/\\/$/, '');\n\t\togImagePath = `${cleanBaseUrl}${ogImagePath}`;\n\t} else {\n\t\tconsole.warn(\n\t\t\t'[reroute] OG images require a baseUrl for proper social media sharing. Add baseUrl to ogImage config.',\n\t\t);\n\t}\n\n\t// Generate meta tags\n\treturn `<meta property=\"og:image\" content=\"${ogImagePath}\" />\n<meta property=\"og:image:width\" content=\"${width}\" />\n<meta property=\"og:image:height\" content=\"${height}\" />\n<meta name=\"twitter:card\" content=\"summary_large_image\" />\n<meta name=\"twitter:image\" content=\"${ogImagePath}\" />`;\n}\n",
19
- "import type { OGImageOptions } from '../../config';\nimport { buildHeadFromMeta } from '../../content/metadata';\nimport { generateOGImageMetaTags } from '../../og/meta';\nimport { dynamicImport } from './imports';\nimport { getMatchingLayouts } from './layouts';\nimport { join } from './path';\nimport type { Doc, MetadataResult } from './types';\n\n/**\n * Extract per-page head and metadata from layouts, routes, and content modules\n */\nexport async function extractPageMetadata(\n\tpathname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n\tcurrentStatusOverride?: number,\n\togConfig?: OGImageOptions,\n): Promise<MetadataResult> {\n\tlet perPageHead = '';\n\tlet pageLang: string | undefined;\n\tlet statusOverride = currentStatusOverride;\n\n\t// 1. Extract layout metadata hierarchically\n\tawait extractLayoutMetadata(\n\t\tpathname,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\t(head) => {\n\t\t\tperPageHead += head;\n\t\t},\n\t\t(lang) => {\n\t\t\tif (!pageLang) pageLang = lang;\n\t\t},\n\t);\n\n\t// 2. OG Image meta tags (auto-generated, should be overridable by custom tags)\n\ttry {\n\t\tconst ogMetaTags = await generateOGImageMetaTags(\n\t\t\tpathname,\n\t\t\tclientDir,\n\t\t\togConfig,\n\t\t);\n\t\tif (ogMetaTags) {\n\t\t\tperPageHead += `\\n${ogMetaTags}`;\n\t\t}\n\t} catch (error) {\n\t\tconsole.warn('[reroute] Failed to generate OG image meta tags:', error);\n\t}\n\n\t// 3. Content page metadata (can override auto-generated tags)\n\textractContentMetadata(\n\t\tpathname,\n\t\t(head) => {\n\t\t\tperPageHead += head;\n\t\t},\n\t\t(lang) => {\n\t\t\tpageLang = lang;\n\t\t},\n\t);\n\n\t// 4. Route-level metadata (most specific, can override everything)\n\tconst routeResult = await extractRouteMetadata(\n\t\tpathname,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tstatusOverride,\n\t);\n\tperPageHead += routeResult.head;\n\tif (routeResult.lang) pageLang = routeResult.lang;\n\tstatusOverride = routeResult.statusOverride;\n\n\treturn { perPageHead, pageLang, statusOverride };\n}\n\nasync function processLayoutForMetadata(\n\tlayout: Doc,\n\tclientDir: string,\n\tisWatchMode: boolean,\n\taddHead: (head: string) => void,\n\tsetLang: (lang: string) => void,\n): Promise<void> {\n\tif (typeof layout?.path !== 'string') return;\n\n\ttry {\n\t\tconst abs = join(clientDir, 'routes', String(layout.path));\n\t\tconst mod = await dynamicImport(abs, isWatchMode);\n\n\t\tconst meta = (mod as Doc)?.meta;\n\t\tconst ssr = (mod as Doc)?.ssr;\n\n\t\tif (meta) addHead(buildHeadFromMeta(meta));\n\n\t\tif (ssr) {\n\t\t\tconst ssrHead = extractSSRHead(ssr);\n\t\t\tif (ssrHead) addHead(`\\n${ssrHead}`);\n\n\t\t\tconst lang = extractSSRLang(ssr);\n\t\t\tif (lang) setLang(lang);\n\t\t}\n\t} catch {\n\t\t// Continue to next layout\n\t}\n}\n\nasync function extractLayoutMetadata(\n\tpathname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n\taddHead: (head: string) => void,\n\tsetLang: (lang: string) => void,\n): Promise<void> {\n\ttry {\n\t\tconst routesPath = join(cwd, '.reroute', 'routes.ts');\n\t\tconst m = await dynamicImport(routesPath, isWatchMode);\n\t\tconst matchingLayouts = getMatchingLayouts(pathname, m?.layouts);\n\n\t\tfor (const layout of matchingLayouts) {\n\t\t\tawait processLayoutForMetadata(\n\t\t\t\tlayout,\n\t\t\t\tclientDir,\n\t\t\t\tisWatchMode,\n\t\t\t\taddHead,\n\t\t\t\tsetLang,\n\t\t\t);\n\t\t}\n\t} catch {\n\t\t// Routes module unavailable\n\t}\n}\n\nfunction extractContentMetadata(\n\tpathname: string,\n\taddHead: (head: string) => void,\n\tsetLang: (lang: string) => void,\n): void {\n\ttry {\n\t\tconst parts = pathname.split('/').filter(Boolean);\n\t\tif (parts.length < 2) return;\n\n\t\tconst key = `${parts[0]}:${parts[1]}`;\n\t\tconst g = globalThis as Doc;\n\t\tconst exp = g.__REROUTE_SSR_EXPORTS__?.[key] as\n\t\t\t| { meta?: unknown; ssr?: unknown }\n\t\t\t| undefined;\n\n\t\tconst meta = (exp as Doc)?.meta;\n\t\tconst ssr = (exp as Doc)?.ssr;\n\n\t\taddHead(buildHeadFromMeta(meta));\n\n\t\tconst ssrHead = extractSSRHead(ssr);\n\t\tif (ssrHead) addHead(`\\n${ssrHead}`);\n\n\t\tconst lang = extractSSRLang(ssr);\n\t\tif (lang) setLang(lang);\n\t} catch {\n\t\t// Content metadata unavailable\n\t}\n}\n\nasync function extractMatchedRouteMetadata(\n\tpathname: string,\n\tclientDir: string,\n\tm: Doc,\n\tisWatchMode: boolean,\n\tstatusOverride: number | undefined,\n): Promise<{ head: string; lang?: string; statusOverride?: number }> {\n\tconst pathnameOnly = pathname.split('?')[0];\n\tconst match =\n\t\ttypeof m.matchRoute === 'function' ? m.matchRoute(pathnameOnly) : null;\n\tconst r = match?.route as Doc | undefined;\n\n\tif (!r) {\n\t\treturn { head: '', statusOverride: statusOverride || 404 };\n\t}\n\n\tif (r && typeof r.path === 'string') {\n\t\ttry {\n\t\t\tconst abs = join(clientDir, 'routes', String(r.path));\n\t\t\tconst mod = await dynamicImport(abs, isWatchMode);\n\n\t\t\tconst meta = (mod as Doc)?.meta;\n\t\t\tconst ssr = (mod as Doc)?.ssr;\n\n\t\t\tlet head = '';\n\t\t\tif (meta) head += buildHeadFromMeta(meta);\n\n\t\t\tif (ssr) {\n\t\t\t\tconst ssrHead = extractSSRHead(ssr);\n\t\t\t\tif (ssrHead) head += `\\n${ssrHead}`;\n\t\t\t\treturn { head, lang: extractSSRLang(ssr), statusOverride };\n\t\t\t}\n\n\t\t\treturn { head, statusOverride };\n\t\t} catch {\n\t\t\t// Route module unavailable\n\t\t}\n\t}\n\n\treturn { head: '', statusOverride };\n}\n\nasync function extractRouteMetadata(\n\tpathname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n\tcurrentStatusOverride?: number,\n): Promise<{ head: string; lang?: string; statusOverride?: number }> {\n\tlet head = '';\n\tlet lang: string | undefined;\n\tlet statusOverride = currentStatusOverride;\n\n\ttry {\n\t\tconst routesPath = join(cwd, '.reroute', 'routes.ts');\n\t\tconst m = await dynamicImport(routesPath, isWatchMode);\n\n\t\tconst pathnameOnly = pathname.split('?')[0];\n\t\tconst match =\n\t\t\ttypeof m.matchRoute === 'function' ? m.matchRoute(pathnameOnly) : null;\n\t\tconst r = match?.route as Doc | undefined;\n\n\t\tif (!r) {\n\t\t\tstatusOverride = statusOverride || 404;\n\t\t}\n\n\t\tif (r && typeof r.path === 'string') {\n\t\t\tconst result = await extractMatchedRouteMetadata(\n\t\t\t\tpathname,\n\t\t\t\tclientDir,\n\t\t\t\tm,\n\t\t\t\tisWatchMode,\n\t\t\t\tstatusOverride,\n\t\t\t);\n\n\t\t\thead = result.head;\n\t\t\tlang = result.lang;\n\t\t\tstatusOverride = result.statusOverride;\n\t\t} else {\n\t\t\t// Try notFound route metadata only when no route matched\n\t\t\thead += await extractNotFoundMetadata(\n\t\t\t\tpathname,\n\t\t\t\tclientDir,\n\t\t\t\tm,\n\t\t\t\tisWatchMode,\n\t\t\t\t(l) => {\n\t\t\t\t\tlang = l;\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t} catch {\n\t\t// Routes module unavailable\n\t}\n\n\treturn { head, lang, statusOverride };\n}\n\nfunction findBestNotFoundRoute(list: Doc[], pathname: string): Doc | undefined {\n\tlet chosen: Doc | undefined;\n\tlet bestLen = -1;\n\n\tfor (const nf of list) {\n\t\tconst pat = String((nf as Doc)?.pattern || '/');\n\t\tif (!pathname.startsWith(pat)) continue;\n\n\t\tconst len = pat.split('/').filter(Boolean).length;\n\t\tif (len >= bestLen) {\n\t\t\tbestLen = len;\n\t\t\tchosen = nf;\n\t\t}\n\t}\n\n\treturn chosen;\n}\n\nasync function extractNotFoundMetadata(\n\tpathname: string,\n\tclientDir: string,\n\troutesModule: Doc,\n\tisWatchMode: boolean,\n\tsetLang: (lang: string) => void,\n): Promise<string> {\n\tlet head = '';\n\n\ttry {\n\t\tconst list = routesModule?.notFoundRoutes as Doc[] | undefined;\n\t\tif (!Array.isArray(list)) return head;\n\n\t\tconst chosen = findBestNotFoundRoute(list, pathname);\n\n\t\tif (chosen && typeof (chosen as Doc).path === 'string') {\n\t\t\tconst abs = join(clientDir, 'routes', String((chosen as Doc).path));\n\t\t\tconst mod = await dynamicImport(abs, isWatchMode);\n\n\t\t\tconst meta = (mod as Doc)?.meta;\n\t\t\tconst ssr = (mod as Doc)?.ssr;\n\n\t\t\tif (meta) head += buildHeadFromMeta(meta);\n\n\t\t\tconst ssrHead = extractSSRHead(ssr);\n\t\t\tif (ssrHead) head += `\\n${ssrHead}`;\n\n\t\t\tconst lang = extractSSRLang(ssr);\n\t\t\tif (lang) setLang(lang);\n\t\t}\n\t} catch {\n\t\t// NotFound metadata unavailable\n\t}\n\n\treturn head;\n}\n\nfunction extractSSRHead(ssr: Doc): string {\n\tif (!ssr) return '';\n\n\tif (typeof ssr.head === 'string') return ssr.head;\n\tif (Array.isArray(ssr.head)) return String(ssr.head.join('\\n'));\n\n\treturn '';\n}\n\nfunction extractSSRLang(ssr: Doc): string | undefined {\n\tif (!ssr) return undefined;\n\n\tif (typeof ssr.lang === 'string' && ssr.lang.trim()) {\n\t\treturn ssr.lang.trim();\n\t}\n\n\treturn undefined;\n}\n",
19
+ "import type { OGImageOptions } from '../../config';\nimport { buildHeadFromMeta } from '../../content/metadata';\nimport { generateOGImageMetaTags } from '../../og/meta';\nimport { dynamicImport } from './imports';\nimport { getMatchingLayouts } from './layouts';\nimport { join } from './path';\nimport type { Doc, MetadataResult } from './types';\n\n/**\n * Generate canonical URL meta tag\n */\nfunction generateCanonicalUrl(baseUrl: string, pathname: string): string {\n\t// Remove trailing slash from baseUrl if present\n\tconst cleanBaseUrl = baseUrl.replace(/\\/$/, '');\n\t// Remove query parameters from pathname for canonical URL\n\tconst cleanPathname = pathname.split('?')[0];\n\t// Canonical URLs should not have trailing slashes (except for root)\n\tconst normalizedPath =\n\t\tcleanPathname === '/' ? '/' : cleanPathname.replace(/\\/$/, '');\n\tconst canonicalUrl = `${cleanBaseUrl}${normalizedPath}`;\n\treturn `<link rel=\"canonical\" href=\"${canonicalUrl}\" />`;\n}\n\n/**\n * Extract per-page head and metadata from layouts, routes, and content modules\n */\nexport async function extractPageMetadata(\n\tpathname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n\tcurrentStatusOverride?: number,\n\togConfig?: OGImageOptions,\n\tbaseUrl?: string,\n\tautoCanonical?: boolean,\n): Promise<MetadataResult> {\n\tlet perPageHead = '';\n\tlet pageLang: string | undefined;\n\tlet statusOverride = currentStatusOverride;\n\n\t// 1. Extract layout metadata hierarchically\n\tawait extractLayoutMetadata(\n\t\tpathname,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\t(head) => {\n\t\t\tperPageHead += head;\n\t\t},\n\t\t(lang) => {\n\t\t\tif (!pageLang) pageLang = lang;\n\t\t},\n\t);\n\n\t// 2. Canonical URL (auto-generated, should be overridable by custom tags)\n\t// Default to true if baseUrl is set, unless explicitly disabled\n\tconst shouldGenerateCanonical =\n\t\tautoCanonical !== false && baseUrl !== undefined;\n\tif (shouldGenerateCanonical) {\n\t\tconst canonicalTag = generateCanonicalUrl(baseUrl, pathname);\n\t\tperPageHead += `\\n${canonicalTag}`;\n\t}\n\n\t// 3. OG Image meta tags (auto-generated, should be overridable by custom tags)\n\ttry {\n\t\tconst ogMetaTags = await generateOGImageMetaTags(\n\t\t\tpathname,\n\t\t\tclientDir,\n\t\t\togConfig,\n\t\t);\n\t\tif (ogMetaTags) {\n\t\t\tperPageHead += `\\n${ogMetaTags}`;\n\t\t}\n\t} catch (error) {\n\t\tconsole.warn('[reroute] Failed to generate OG image meta tags:', error);\n\t}\n\n\t// 4. Content page metadata (can override auto-generated tags)\n\textractContentMetadata(\n\t\tpathname,\n\t\t(head) => {\n\t\t\tperPageHead += head;\n\t\t},\n\t\t(lang) => {\n\t\t\tpageLang = lang;\n\t\t},\n\t);\n\n\t// 5. Route-level metadata (most specific, can override everything)\n\tconst routeResult = await extractRouteMetadata(\n\t\tpathname,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tstatusOverride,\n\t);\n\tperPageHead += routeResult.head;\n\tif (routeResult.lang) pageLang = routeResult.lang;\n\tstatusOverride = routeResult.statusOverride;\n\n\treturn { perPageHead, pageLang, statusOverride };\n}\n\nasync function processLayoutForMetadata(\n\tlayout: Doc,\n\tclientDir: string,\n\tisWatchMode: boolean,\n\taddHead: (head: string) => void,\n\tsetLang: (lang: string) => void,\n): Promise<void> {\n\tif (typeof layout?.path !== 'string') return;\n\n\ttry {\n\t\tconst abs = join(clientDir, 'routes', String(layout.path));\n\t\tconst mod = await dynamicImport(abs, isWatchMode);\n\n\t\tconst meta = (mod as Doc)?.meta;\n\t\tconst ssr = (mod as Doc)?.ssr;\n\n\t\tif (meta) addHead(buildHeadFromMeta(meta));\n\n\t\tif (ssr) {\n\t\t\tconst ssrHead = extractSSRHead(ssr);\n\t\t\tif (ssrHead) addHead(`\\n${ssrHead}`);\n\n\t\t\tconst lang = extractSSRLang(ssr);\n\t\t\tif (lang) setLang(lang);\n\t\t}\n\t} catch {\n\t\t// Continue to next layout\n\t}\n}\n\nasync function extractLayoutMetadata(\n\tpathname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n\taddHead: (head: string) => void,\n\tsetLang: (lang: string) => void,\n): Promise<void> {\n\ttry {\n\t\tconst routesPath = join(cwd, '.reroute', 'routes.ts');\n\t\tconst m = await dynamicImport(routesPath, isWatchMode);\n\t\tconst matchingLayouts = getMatchingLayouts(pathname, m?.layouts);\n\n\t\tfor (const layout of matchingLayouts) {\n\t\t\tawait processLayoutForMetadata(\n\t\t\t\tlayout,\n\t\t\t\tclientDir,\n\t\t\t\tisWatchMode,\n\t\t\t\taddHead,\n\t\t\t\tsetLang,\n\t\t\t);\n\t\t}\n\t} catch {\n\t\t// Routes module unavailable\n\t}\n}\n\nfunction extractContentMetadata(\n\tpathname: string,\n\taddHead: (head: string) => void,\n\tsetLang: (lang: string) => void,\n): void {\n\ttry {\n\t\tconst parts = pathname.split('/').filter(Boolean);\n\t\tif (parts.length < 2) return;\n\n\t\tconst key = `${parts[0]}:${parts[1]}`;\n\t\tconst g = globalThis as Doc;\n\t\tconst exp = g.__REROUTE_SSR_EXPORTS__?.[key] as\n\t\t\t| { meta?: unknown; ssr?: unknown }\n\t\t\t| undefined;\n\n\t\tconst meta = (exp as Doc)?.meta;\n\t\tconst ssr = (exp as Doc)?.ssr;\n\n\t\taddHead(buildHeadFromMeta(meta));\n\n\t\tconst ssrHead = extractSSRHead(ssr);\n\t\tif (ssrHead) addHead(`\\n${ssrHead}`);\n\n\t\tconst lang = extractSSRLang(ssr);\n\t\tif (lang) setLang(lang);\n\t} catch {\n\t\t// Content metadata unavailable\n\t}\n}\n\nasync function extractMatchedRouteMetadata(\n\tpathname: string,\n\tclientDir: string,\n\tm: Doc,\n\tisWatchMode: boolean,\n\tstatusOverride: number | undefined,\n): Promise<{ head: string; lang?: string; statusOverride?: number }> {\n\tconst pathnameOnly = pathname.split('?')[0];\n\tconst match =\n\t\ttypeof m.matchRoute === 'function' ? m.matchRoute(pathnameOnly) : null;\n\tconst r = match?.route as Doc | undefined;\n\n\tif (!r) {\n\t\treturn { head: '', statusOverride: statusOverride || 404 };\n\t}\n\n\tif (r && typeof r.path === 'string') {\n\t\ttry {\n\t\t\tconst abs = join(clientDir, 'routes', String(r.path));\n\t\t\tconst mod = await dynamicImport(abs, isWatchMode);\n\n\t\t\tconst meta = (mod as Doc)?.meta;\n\t\t\tconst ssr = (mod as Doc)?.ssr;\n\n\t\t\tlet head = '';\n\t\t\tif (meta) head += buildHeadFromMeta(meta);\n\n\t\t\tif (ssr) {\n\t\t\t\tconst ssrHead = extractSSRHead(ssr);\n\t\t\t\tif (ssrHead) head += `\\n${ssrHead}`;\n\t\t\t\treturn { head, lang: extractSSRLang(ssr), statusOverride };\n\t\t\t}\n\n\t\t\treturn { head, statusOverride };\n\t\t} catch {\n\t\t\t// Route module unavailable\n\t\t}\n\t}\n\n\treturn { head: '', statusOverride };\n}\n\nasync function extractRouteMetadata(\n\tpathname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n\tcurrentStatusOverride?: number,\n): Promise<{ head: string; lang?: string; statusOverride?: number }> {\n\tlet head = '';\n\tlet lang: string | undefined;\n\tlet statusOverride = currentStatusOverride;\n\n\ttry {\n\t\tconst routesPath = join(cwd, '.reroute', 'routes.ts');\n\t\tconst m = await dynamicImport(routesPath, isWatchMode);\n\n\t\tconst pathnameOnly = pathname.split('?')[0];\n\t\tconst match =\n\t\t\ttypeof m.matchRoute === 'function' ? m.matchRoute(pathnameOnly) : null;\n\t\tconst r = match?.route as Doc | undefined;\n\n\t\tif (!r) {\n\t\t\tstatusOverride = statusOverride || 404;\n\t\t}\n\n\t\tif (r && typeof r.path === 'string') {\n\t\t\tconst result = await extractMatchedRouteMetadata(\n\t\t\t\tpathname,\n\t\t\t\tclientDir,\n\t\t\t\tm,\n\t\t\t\tisWatchMode,\n\t\t\t\tstatusOverride,\n\t\t\t);\n\n\t\t\thead = result.head;\n\t\t\tlang = result.lang;\n\t\t\tstatusOverride = result.statusOverride;\n\t\t} else {\n\t\t\t// Try notFound route metadata only when no route matched\n\t\t\thead += await extractNotFoundMetadata(\n\t\t\t\tpathname,\n\t\t\t\tclientDir,\n\t\t\t\tm,\n\t\t\t\tisWatchMode,\n\t\t\t\t(l) => {\n\t\t\t\t\tlang = l;\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t} catch {\n\t\t// Routes module unavailable\n\t}\n\n\treturn { head, lang, statusOverride };\n}\n\nfunction findBestNotFoundRoute(list: Doc[], pathname: string): Doc | undefined {\n\tlet chosen: Doc | undefined;\n\tlet bestLen = -1;\n\n\tfor (const nf of list) {\n\t\tconst pat = String((nf as Doc)?.pattern || '/');\n\t\tif (!pathname.startsWith(pat)) continue;\n\n\t\tconst len = pat.split('/').filter(Boolean).length;\n\t\tif (len >= bestLen) {\n\t\t\tbestLen = len;\n\t\t\tchosen = nf;\n\t\t}\n\t}\n\n\treturn chosen;\n}\n\nasync function extractNotFoundMetadata(\n\tpathname: string,\n\tclientDir: string,\n\troutesModule: Doc,\n\tisWatchMode: boolean,\n\tsetLang: (lang: string) => void,\n): Promise<string> {\n\tlet head = '';\n\n\ttry {\n\t\tconst list = routesModule?.notFoundRoutes as Doc[] | undefined;\n\t\tif (!Array.isArray(list)) return head;\n\n\t\tconst chosen = findBestNotFoundRoute(list, pathname);\n\n\t\tif (chosen && typeof (chosen as Doc).path === 'string') {\n\t\t\tconst abs = join(clientDir, 'routes', String((chosen as Doc).path));\n\t\t\tconst mod = await dynamicImport(abs, isWatchMode);\n\n\t\t\tconst meta = (mod as Doc)?.meta;\n\t\t\tconst ssr = (mod as Doc)?.ssr;\n\n\t\t\tif (meta) head += buildHeadFromMeta(meta);\n\n\t\t\tconst ssrHead = extractSSRHead(ssr);\n\t\t\tif (ssrHead) head += `\\n${ssrHead}`;\n\n\t\t\tconst lang = extractSSRLang(ssr);\n\t\t\tif (lang) setLang(lang);\n\t\t}\n\t} catch {\n\t\t// NotFound metadata unavailable\n\t}\n\n\treturn head;\n}\n\nfunction extractSSRHead(ssr: Doc): string {\n\tif (!ssr) return '';\n\n\tif (typeof ssr.head === 'string') return ssr.head;\n\tif (Array.isArray(ssr.head)) return String(ssr.head.join('\\n'));\n\n\treturn '';\n}\n\nfunction extractSSRLang(ssr: Doc): string | undefined {\n\tif (!ssr) return undefined;\n\n\tif (typeof ssr.lang === 'string' && ssr.lang.trim()) {\n\t\treturn ssr.lang.trim();\n\t}\n\n\treturn undefined;\n}\n",
20
20
  "import { readdir, stat } from 'node:fs/promises';\nimport { dynamicImport } from './imports';\nimport { join } from './path';\nimport type { Doc, PreloadResult } from './types';\n\n/**\n * Handle content module preloading for content pages\n */\nexport async function preloadContentModule(\n\tpathname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n): Promise<PreloadResult> {\n\tlet extraHead = '';\n\tlet hydrationScript = '';\n\tlet statusOverride: number | undefined;\n\n\ttry {\n\t\tconst pathOnly = pathname.split('?')[0].split('#')[0];\n\t\tconst parts = pathOnly.split('/').filter(Boolean);\n\n\t\tif (parts.length < 2) {\n\t\t\treturn { extraHead, hydrationScript };\n\t\t}\n\n\t\tconst collection = parts[0];\n\t\tconst name = parts[1];\n\n\t\t// Check if this is a content collection\n\t\tif (!(await isContentCollection(clientDir, collection))) {\n\t\t\treturn { extraHead, hydrationScript };\n\t\t}\n\n\t\t// Try to find module path\n\t\tconst modulePath = await findContentModulePath(\n\t\t\tcollection,\n\t\t\tname,\n\t\t\tclientDir,\n\t\t\tcwd,\n\t\t\tisWatchMode,\n\t\t);\n\n\t\tif (!modulePath) {\n\t\t\tstatusOverride = 404;\n\t\t\treturn { extraHead, hydrationScript, statusOverride };\n\t\t}\n\n\t\tconst key = `${collection}:${name}`;\n\t\textraHead += `\\n<link rel=\"modulepreload\" href=\"${modulePath}\" />`;\n\n\t\t// Store the module path and key for the inline loader\n\t\t// The actual loading happens via a blocking mechanism in the data script\n\t\thydrationScript += `<script>\n// Mark that this content module needs to be preloaded\n(globalThis.__REROUTE_CONTENT_PRELOAD__ ||= []).push({src:'${modulePath}',key:'${key}'});\n</script>`;\n\t} catch {\n\t\t// Return empty result on error\n\t}\n\n\treturn { extraHead, hydrationScript, statusOverride };\n}\n\nasync function isContentCollection(\n\tclientDir: string,\n\tcollection: string,\n): Promise<boolean> {\n\ttry {\n\t\tconst maybeDir = join(clientDir, 'routes', collection, 'content');\n\t\tconst s = await stat(maybeDir);\n\t\treturn typeof s?.isDirectory === 'function' ? s.isDirectory() : true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function findLatestCandidate(\n\tchunkDir: string,\n\tcandidates: string[],\n): Promise<string> {\n\tlet latest = candidates[0];\n\tlet latestM = 0;\n\n\tfor (const candidateName of candidates) {\n\t\ttry {\n\t\t\tconst s = await stat(join(chunkDir, candidateName));\n\t\t\tif (s.mtimeMs >= latestM) {\n\t\t\t\tlatestM = s.mtimeMs;\n\t\t\t\tlatest = candidateName;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Skip inaccessible files\n\t\t}\n\t}\n\n\treturn latest;\n}\n\nasync function findContentModulePath(\n\tcollection: string,\n\tname: string,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n): Promise<string | null> {\n\t// 1. Try registry mapping\n\ttry {\n\t\tconst registryPath = join(cwd, '.reroute', 'content.ts');\n\t\tconst reg = await dynamicImport(registryPath, isWatchMode);\n\t\tconst get = reg?.getContentEntry as\n\t\t\t| ((c: string, n: string) => { module?: string } | undefined)\n\t\t\t| undefined;\n\t\tconst entry = typeof get === 'function' ? get(collection, name) : undefined;\n\t\tconst moduleUrl = (entry as Doc)?.module as string | undefined;\n\n\t\tif (moduleUrl?.endsWith('.js')) {\n\t\t\treturn moduleUrl;\n\t\t}\n\t} catch {\n\t\t// Registry unavailable\n\t}\n\n\t// 2. Try newest chunk\n\ttry {\n\t\tconst chunkDir = join(cwd, '.reroute', 'chunks', collection);\n\t\tconst files = await readdir(chunkDir);\n\t\tconst candidates = files.filter(\n\t\t\t(n) => n.startsWith(`${name}.`) && n.endsWith('.js'),\n\t\t);\n\n\t\tif (candidates.length) {\n\t\t\tconst latest = await findLatestCandidate(chunkDir, candidates);\n\t\t\treturn `/${join('.reroute', 'chunks', collection, latest).replace(/\\\\+/g, '/')}`;\n\t\t}\n\t} catch {\n\t\t// Chunk directory unavailable\n\t}\n\n\t// 3. Try source files\n\ttry {\n\t\tconst tsx = join(clientDir, 'routes', collection, 'content', `${name}.tsx`);\n\t\tconst ts = join(clientDir, 'routes', collection, 'content', `${name}.ts`);\n\n\t\tif (await Bun.file(tsx).exists()) {\n\t\t\treturn `/${join('routes', collection, 'content', `${name}.tsx`).replace(/\\\\+/g, '/')}`;\n\t\t}\n\t\tif (await Bun.file(ts).exists()) {\n\t\t\treturn `/${join('routes', collection, 'content', `${name}.ts`).replace(/\\\\+/g, '/')}`;\n\t\t}\n\t} catch {\n\t\t// Source files unavailable\n\t}\n\n\treturn null;\n}\n\n/**\n * Reset SSR access tracking for a new request\n */\nexport function resetSSRAccessTracking(): void {\n\ttry {\n\t\t(globalThis as Doc).__REROUTE_SSR_ACCESSED__ = {};\n\t} catch {\n\t\t// Ignore errors in restricted environments\n\t}\n}\n\n/**\n * Create bundle preload link\n */\nexport function createBundlePreload(bundleUrl: string): string {\n\ttry {\n\t\tif (typeof bundleUrl === 'string' && bundleUrl.endsWith('.js')) {\n\t\t\treturn `\\n<link rel=\"modulepreload\" href=\"${bundleUrl}\" />`;\n\t\t}\n\t} catch {\n\t\t// Return empty on error\n\t}\n\treturn '';\n}\n",
21
21
  "export { createCollectionScript, processCollections } from './collections';\nexport { createDataScript, duplicateQueryParamData } from './data';\nexport { escapeJsonForScript } from './escape';\nexport { createFeedsScript, createLlmsScript } from './feeds';\n",
22
- "import type { Span } from '@opentelemetry/api';\nimport { withParentSpan, withSpan } from 'reroute-js/telemetry/server';\nimport type { OGImageOptions } from '../../config';\nimport { loadCollections, setGlobalCollections } from './collections';\nimport { computeSSRData, setGlobalSSRData } from './compute';\nimport { extractPageMetadata } from './metadata';\nimport {\n\tcreateBundlePreload,\n\tpreloadContentModule,\n\tresetSSRAccessTracking,\n} from './preload';\nimport {\n\tcreateCollectionScript,\n\tcreateDataScript,\n\tcreateFeedsScript,\n\tcreateLlmsScript,\n\tprocessCollections,\n} from './scripts';\nimport { seedSSRModuleForPath } from './seed';\nimport { inlineTailwindCSS } from './styles';\nimport type { ComputeResult } from './types';\n\n/**\n * Common SSR options shared between render and stream modes\n */\ntype SSRSetupOptions = {\n\tpathname: string;\n\tclientDir: string;\n\tcwd: string;\n\tisWatchMode: boolean;\n\tbundleUrl: string;\n\tcachedCollections?: Record<string, unknown[]>;\n\tcachedTailwindCSS?: string;\n\tdebug?: boolean;\n\tmaxAge?: number;\n\tsearchParams?: URLSearchParams;\n\togConfig?: OGImageOptions;\n\tparentSpan?: Span | null;\n};\n\n/**\n * Result of SSR setup phase\n */\ntype SSRSetupResult = {\n\tssrData: Record<string, unknown>;\n\tssrError?: string;\n\tstatusContainer: { value: number | undefined };\n\tbyCollectionForSSR: Record<string, unknown[]>;\n\tbundlePreload: string;\n\tpreloadExtraHead: string;\n\tpreloadHydrationScript: string;\n\tpreloadStatusOverride?: number;\n\tinlineStyleTag: string;\n\tmetadataResult: {\n\t\tperPageHead: string;\n\t\tpageLang?: string;\n\t\tstatusOverride?: number;\n\t};\n\tpending?: Promise<void>;\n};\n\n/**\n * Perform common SSR setup steps shared between render and stream modes.\n * This includes seeding modules, computing data, loading collections, and preloading.\n */\nasync function performSSRSetup(\n\toptions: SSRSetupOptions,\n\tstreaming = false,\n): Promise<SSRSetupResult> {\n\tconst { pathname } = options;\n\n\t// Add a global timeout for SSR setup to prevent indefinite hangs\n\t// In streaming mode, we want setup to complete quickly so we can start sending HTML\n\tconst setupTimeout = streaming ? 10000 : 30000; // 10s for streaming, 30s otherwise\n\tconst timeoutPromise = new Promise<never>((_, reject) => {\n\t\tsetTimeout(() => {\n\t\t\treject(\n\t\t\t\tnew Error(\n\t\t\t\t\t`[reroute] SSR setup timeout after ${setupTimeout}ms for ${pathname}`,\n\t\t\t\t),\n\t\t\t);\n\t\t}, setupTimeout);\n\t});\n\n\ttry {\n\t\treturn await Promise.race([\n\t\t\twithParentSpan(options.parentSpan, () =>\n\t\t\t\tperformSSRSetupInternal(options, streaming),\n\t\t\t),\n\t\t\ttimeoutPromise,\n\t\t]);\n\t} catch (error) {\n\t\tconsole.error('[reroute] SSR setup error:', error);\n\t\t// Return minimal setup result to allow page to render with fallback\n\t\treturn {\n\t\t\tssrData: {},\n\t\t\tssrError: error instanceof Error ? error.message : String(error),\n\t\t\tstatusContainer: { value: 500 },\n\t\t\tbyCollectionForSSR: {},\n\t\t\tbundlePreload: '',\n\t\t\tpreloadExtraHead: '',\n\t\t\tpreloadHydrationScript: '',\n\t\t\tinlineStyleTag: '',\n\t\t\tmetadataResult: { perPageHead: '' },\n\t\t};\n\t}\n}\n\n/**\n * Internal SSR setup implementation (wrapped with timeout above)\n */\nasync function performSSRSetupInternal(\n\toptions: SSRSetupOptions,\n\tstreaming: boolean,\n): Promise<SSRSetupResult> {\n\tconst debug = options.debug ?? false;\n\tconst t0 = debug ? performance.now() : 0;\n\tconst {\n\t\tpathname,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tbundleUrl,\n\t\tmaxAge = 0,\n\t\tsearchParams,\n\t\togConfig,\n\t} = options;\n\n\t// Note: We don't reset SSR globals here because multiple requests may run concurrently.\n\t// Instead, we use pathname-scoped serialization to ensure each response only includes\n\t// its own data (see createContentHtmlScript and createSSRExportsScript).\n\n\t// 1. Seed content modules for SSR rendering\n\tawait withSpan('ssr.seed', async (span) => {\n\t\tspan.setAttribute('pathname', pathname);\n\t\tspan.setAttribute('streaming', streaming);\n\t\tawait seedSSRModuleForPath(pathname, clientDir, cwd, isWatchMode);\n\t\tif (debug)\n\t\t\tconsole.log(\n\t\t\t\t`[Setup] ${pathname} - seedModule: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t);\n\t});\n\n\t// 2. Reset SSR access tracking and create bundle preload\n\tresetSSRAccessTracking();\n\tconst bundlePreload = createBundlePreload(bundleUrl);\n\n\t// 3. Preload content module\n\tconst preloadResult = await withSpan('ssr.preload', async (span) => {\n\t\tspan.setAttribute('pathname', pathname);\n\t\tconst result = await preloadContentModule(\n\t\t\tpathname,\n\t\t\tclientDir,\n\t\t\tcwd,\n\t\t\tisWatchMode,\n\t\t);\n\t\tspan.setAttribute('has_module', !!result.modulePath);\n\t\tif (debug)\n\t\t\tconsole.log(\n\t\t\t\t`[Setup] ${pathname} - preloadContent: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t);\n\t\treturn result;\n\t});\n\n\t// 4. Compute SSR data\n\tconst computeResult: ComputeResult = await withSpan(\n\t\t'ssr.compute.data',\n\t\tasync (span) => {\n\t\t\tspan.setAttribute('pathname', pathname);\n\t\t\tspan.setAttribute('streaming', streaming);\n\t\t\tconst result = await computeSSRData(\n\t\t\t\tpathname,\n\t\t\t\tclientDir,\n\t\t\t\tcwd,\n\t\t\t\tisWatchMode,\n\t\t\t\t{ streaming, maxAge },\n\t\t\t\tsearchParams,\n\t\t\t);\n\t\t\tspan.setAttribute('has_error', !!result.error);\n\t\t\tspan.setAttribute('has_data', Object.keys(result.data).length > 0);\n\t\t\tif (debug)\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[Setup] ${pathname} - computeSSRData: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t\t);\n\t\t\treturn result;\n\t\t},\n\t);\n\n\tsetGlobalSSRData(computeResult.data);\n\n\t// 5. Load content collections (use cached if available)\n\tconst usingCachedCollections = !!options.cachedCollections;\n\tconst byCollectionForSSR = await withSpan(\n\t\t'ssr.load.collections',\n\t\tasync (span) => {\n\t\t\tspan.setAttribute('pathname', pathname);\n\t\t\tspan.setAttribute('cached', usingCachedCollections);\n\t\t\tconst collections = options.cachedCollections\n\t\t\t\t? options.cachedCollections\n\t\t\t\t: await loadCollections(cwd, isWatchMode);\n\t\t\tspan.setAttribute('collection_count', Object.keys(collections).length);\n\t\t\tif (debug)\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[Setup] ${pathname} - loadCollections (cached: ${usingCachedCollections}): ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t\t);\n\t\t\treturn collections;\n\t\t},\n\t);\n\tsetGlobalCollections(byCollectionForSSR);\n\n\t// 6. Inline Tailwind CSS (use cached if available)\n\tconst usingCachedCSS = !!options.cachedTailwindCSS;\n\tconst inlineStyleTag = await withSpan('ssr.inline.css', async (span) => {\n\t\tconst css = options.cachedTailwindCSS\n\t\t\t? options.cachedTailwindCSS\n\t\t\t: await inlineTailwindCSS(clientDir, !streaming, isWatchMode);\n\t\tspan.setAttributes({\n\t\t\t'reroute.cached': usingCachedCSS,\n\t\t\t'reroute.css.size': css.length,\n\t\t});\n\t\tif (debug)\n\t\t\tconsole.log(\n\t\t\t\t`[Setup] ${pathname} - inlineTailwindCSS (cached: ${usingCachedCSS}): ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t);\n\t\treturn css;\n\t});\n\n\t// 7. Determine initial status override\n\tlet statusOverride = preloadResult.statusOverride;\n\tif (computeResult.statusContainer.value) {\n\t\tstatusOverride = computeResult.statusContainer.value;\n\t}\n\n\t// 8. Extract page metadata\n\tconst metadataResult = await withSpan(\n\t\t'ssr.extract.metadata',\n\t\tasync (span) => {\n\t\t\tconst result = await extractPageMetadata(\n\t\t\t\tpathname,\n\t\t\t\tclientDir,\n\t\t\t\tcwd,\n\t\t\t\tisWatchMode,\n\t\t\t\tstatusOverride,\n\t\t\t\togConfig,\n\t\t\t);\n\t\t\tspan.setAttributes({\n\t\t\t\t'reroute.pathname': pathname,\n\t\t\t\t'reroute.metadata.exists': !!result.perPageHead,\n\t\t\t});\n\t\t\tif (debug)\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[Setup] ${pathname} - extractMetadata: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t\t);\n\t\t\treturn result;\n\t\t},\n\t);\n\n\treturn {\n\t\tssrData: computeResult.data,\n\t\tssrError: computeResult.error,\n\t\tstatusContainer: computeResult.statusContainer,\n\t\tbyCollectionForSSR,\n\t\tbundlePreload,\n\t\tpreloadExtraHead: preloadResult.extraHead,\n\t\tpreloadHydrationScript: preloadResult.hydrationScript,\n\t\tpreloadStatusOverride: preloadResult.statusOverride,\n\t\tinlineStyleTag,\n\t\tmetadataResult,\n\t\tpending: computeResult.pending,\n\t};\n}\n\n/**\n * Generate hydration scripts for collections that were accessed during SSR.\n */\nfunction generateCollectionScripts(\n\tbyCollectionForSSR: Record<string, unknown[]>,\n): string {\n\ttry {\n\t\tconst g = globalThis as unknown as { __REROUTE_SSR_ACCESSED__?: unknown };\n\t\tconst acc = g.__REROUTE_SSR_ACCESSED__;\n\n\t\tif (acc) {\n\t\t\tconst { subset, partial } = processCollections(acc, byCollectionForSSR);\n\t\t\tif (Object.keys(subset).length > 0) {\n\t\t\t\treturn createCollectionScript(subset, partial);\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Ignore errors\n\t}\n\treturn '';\n}\n\n/**\n * Generate all hydration scripts for SSR\n */\nfunction generateHydrationScripts(\n\tssrData: Record<string, unknown>,\n\tisWatchMode: boolean,\n\tssrError?: string,\n\tcollectionScripts = '',\n\tpreloadScript = '',\n\tbundleUrl = '',\n\tpathname = '',\n\tbrowserTelemetryConfig?: Record<string, unknown>,\n\ttraceContext?: { traceparent?: string; tracestate?: string },\n): string {\n\tlet scripts = preloadScript;\n\n\t// Add collection scripts\n\tscripts += collectionScripts;\n\n\t// Add SSR data script (pathname is used to scope content HTML and exports to current request)\n\tscripts += createDataScript(\n\t\tssrData,\n\t\tisWatchMode ? ssrError : undefined,\n\t\tpathname,\n\t\tbrowserTelemetryConfig,\n\t\ttraceContext,\n\t);\n\n\t// Add feeds and llms scripts\n\tscripts += createFeedsScript();\n\tscripts += createLlmsScript();\n\n\t// Add bundle script\n\tif (bundleUrl) {\n\t\tscripts += `<script type=\"module\" src=\"${bundleUrl}\"></script>`;\n\t}\n\n\t// Add dev watcher in watch mode\n\tif (isWatchMode) {\n\t\tscripts += `<script type=\"module\" src=\"/__reroute_watch.js\"></script>`;\n\t}\n\n\treturn scripts;\n}\n\nexport type { SSRSetupOptions, SSRSetupResult };\nexport { performSSRSetup, generateCollectionScripts, generateHydrationScripts };\n",
22
+ "import type { Span } from '@opentelemetry/api';\nimport { withParentSpan, withSpan } from 'reroute-js/telemetry/server';\nimport type { OGImageOptions } from '../../config';\nimport { loadCollections, setGlobalCollections } from './collections';\nimport { computeSSRData, setGlobalSSRData } from './compute';\nimport { extractPageMetadata } from './metadata';\nimport {\n\tcreateBundlePreload,\n\tpreloadContentModule,\n\tresetSSRAccessTracking,\n} from './preload';\nimport {\n\tcreateCollectionScript,\n\tcreateDataScript,\n\tcreateFeedsScript,\n\tcreateLlmsScript,\n\tprocessCollections,\n} from './scripts';\nimport { seedSSRModuleForPath } from './seed';\nimport { inlineTailwindCSS } from './styles';\nimport type { ComputeResult } from './types';\n\n/**\n * Common SSR options shared between render and stream modes\n */\ntype SSRSetupOptions = {\n\tpathname: string;\n\tclientDir: string;\n\tcwd: string;\n\tisWatchMode: boolean;\n\tbundleUrl: string;\n\tcachedCollections?: Record<string, unknown[]>;\n\tcachedTailwindCSS?: string;\n\tdebug?: boolean;\n\tmaxAge?: number;\n\tsearchParams?: URLSearchParams;\n\togConfig?: OGImageOptions;\n\tbaseUrl?: string;\n\tautoCanonical?: boolean;\n\tparentSpan?: Span | null;\n};\n\n/**\n * Result of SSR setup phase\n */\ntype SSRSetupResult = {\n\tssrData: Record<string, unknown>;\n\tssrError?: string;\n\tstatusContainer: { value: number | undefined };\n\tbyCollectionForSSR: Record<string, unknown[]>;\n\tbundlePreload: string;\n\tpreloadExtraHead: string;\n\tpreloadHydrationScript: string;\n\tpreloadStatusOverride?: number;\n\tinlineStyleTag: string;\n\tmetadataResult: {\n\t\tperPageHead: string;\n\t\tpageLang?: string;\n\t\tstatusOverride?: number;\n\t};\n\tpending?: Promise<void>;\n};\n\n/**\n * Perform common SSR setup steps shared between render and stream modes.\n * This includes seeding modules, computing data, loading collections, and preloading.\n */\nasync function performSSRSetup(\n\toptions: SSRSetupOptions,\n\tstreaming = false,\n): Promise<SSRSetupResult> {\n\tconst { pathname } = options;\n\n\t// Add a global timeout for SSR setup to prevent indefinite hangs\n\t// In streaming mode, we want setup to complete quickly so we can start sending HTML\n\tconst setupTimeout = streaming ? 10000 : 30000; // 10s for streaming, 30s otherwise\n\tconst timeoutPromise = new Promise<never>((_, reject) => {\n\t\tsetTimeout(() => {\n\t\t\treject(\n\t\t\t\tnew Error(\n\t\t\t\t\t`[reroute] SSR setup timeout after ${setupTimeout}ms for ${pathname}`,\n\t\t\t\t),\n\t\t\t);\n\t\t}, setupTimeout);\n\t});\n\n\ttry {\n\t\treturn await Promise.race([\n\t\t\twithParentSpan(options.parentSpan, () =>\n\t\t\t\tperformSSRSetupInternal(options, streaming),\n\t\t\t),\n\t\t\ttimeoutPromise,\n\t\t]);\n\t} catch (error) {\n\t\tconsole.error('[reroute] SSR setup error:', error);\n\t\t// Return minimal setup result to allow page to render with fallback\n\t\treturn {\n\t\t\tssrData: {},\n\t\t\tssrError: error instanceof Error ? error.message : String(error),\n\t\t\tstatusContainer: { value: 500 },\n\t\t\tbyCollectionForSSR: {},\n\t\t\tbundlePreload: '',\n\t\t\tpreloadExtraHead: '',\n\t\t\tpreloadHydrationScript: '',\n\t\t\tinlineStyleTag: '',\n\t\t\tmetadataResult: { perPageHead: '' },\n\t\t};\n\t}\n}\n\n/**\n * Internal SSR setup implementation (wrapped with timeout above)\n */\nasync function performSSRSetupInternal(\n\toptions: SSRSetupOptions,\n\tstreaming: boolean,\n): Promise<SSRSetupResult> {\n\tconst debug = options.debug ?? false;\n\tconst t0 = debug ? performance.now() : 0;\n\tconst {\n\t\tpathname,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tbundleUrl,\n\t\tmaxAge = 0,\n\t\tsearchParams,\n\t\togConfig,\n\t} = options;\n\n\t// Note: We don't reset SSR globals here because multiple requests may run concurrently.\n\t// Instead, we use pathname-scoped serialization to ensure each response only includes\n\t// its own data (see createContentHtmlScript and createSSRExportsScript).\n\n\t// 1. Seed content modules for SSR rendering\n\tawait withSpan('ssr.seed', async (span) => {\n\t\tspan.setAttribute('pathname', pathname);\n\t\tspan.setAttribute('streaming', streaming);\n\t\tawait seedSSRModuleForPath(pathname, clientDir, cwd, isWatchMode);\n\t\tif (debug)\n\t\t\tconsole.log(\n\t\t\t\t`[Setup] ${pathname} - seedModule: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t);\n\t});\n\n\t// 2. Reset SSR access tracking and create bundle preload\n\tresetSSRAccessTracking();\n\tconst bundlePreload = createBundlePreload(bundleUrl);\n\n\t// 3. Preload content module\n\tconst preloadResult = await withSpan('ssr.preload', async (span) => {\n\t\tspan.setAttribute('pathname', pathname);\n\t\tconst result = await preloadContentModule(\n\t\t\tpathname,\n\t\t\tclientDir,\n\t\t\tcwd,\n\t\t\tisWatchMode,\n\t\t);\n\t\tspan.setAttribute('has_module', !!result.modulePath);\n\t\tif (debug)\n\t\t\tconsole.log(\n\t\t\t\t`[Setup] ${pathname} - preloadContent: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t);\n\t\treturn result;\n\t});\n\n\t// 4. Compute SSR data\n\tconst computeResult: ComputeResult = await withSpan(\n\t\t'ssr.compute.data',\n\t\tasync (span) => {\n\t\t\tspan.setAttribute('pathname', pathname);\n\t\t\tspan.setAttribute('streaming', streaming);\n\t\t\tconst result = await computeSSRData(\n\t\t\t\tpathname,\n\t\t\t\tclientDir,\n\t\t\t\tcwd,\n\t\t\t\tisWatchMode,\n\t\t\t\t{ streaming, maxAge },\n\t\t\t\tsearchParams,\n\t\t\t);\n\t\t\tspan.setAttribute('has_error', !!result.error);\n\t\t\tspan.setAttribute('has_data', Object.keys(result.data).length > 0);\n\t\t\tif (debug)\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[Setup] ${pathname} - computeSSRData: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t\t);\n\t\t\treturn result;\n\t\t},\n\t);\n\n\tsetGlobalSSRData(computeResult.data);\n\n\t// 5. Load content collections (use cached if available)\n\tconst usingCachedCollections = !!options.cachedCollections;\n\tconst byCollectionForSSR = await withSpan(\n\t\t'ssr.load.collections',\n\t\tasync (span) => {\n\t\t\tspan.setAttribute('pathname', pathname);\n\t\t\tspan.setAttribute('cached', usingCachedCollections);\n\t\t\tconst collections = options.cachedCollections\n\t\t\t\t? options.cachedCollections\n\t\t\t\t: await loadCollections(cwd, isWatchMode);\n\t\t\tspan.setAttribute('collection_count', Object.keys(collections).length);\n\t\t\tif (debug)\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[Setup] ${pathname} - loadCollections (cached: ${usingCachedCollections}): ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t\t);\n\t\t\treturn collections;\n\t\t},\n\t);\n\tsetGlobalCollections(byCollectionForSSR);\n\n\t// 6. Inline Tailwind CSS (use cached if available)\n\tconst usingCachedCSS = !!options.cachedTailwindCSS;\n\tconst inlineStyleTag = await withSpan('ssr.inline.css', async (span) => {\n\t\tconst css = options.cachedTailwindCSS\n\t\t\t? options.cachedTailwindCSS\n\t\t\t: await inlineTailwindCSS(clientDir, !streaming, isWatchMode);\n\t\tspan.setAttributes({\n\t\t\t'reroute.cached': usingCachedCSS,\n\t\t\t'reroute.css.size': css.length,\n\t\t});\n\t\tif (debug)\n\t\t\tconsole.log(\n\t\t\t\t`[Setup] ${pathname} - inlineTailwindCSS (cached: ${usingCachedCSS}): ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t);\n\t\treturn css;\n\t});\n\n\t// 7. Determine initial status override\n\tlet statusOverride = preloadResult.statusOverride;\n\tif (computeResult.statusContainer.value) {\n\t\tstatusOverride = computeResult.statusContainer.value;\n\t}\n\n\t// 8. Extract page metadata\n\tconst metadataResult = await withSpan(\n\t\t'ssr.extract.metadata',\n\t\tasync (span) => {\n\t\t\tconst result = await extractPageMetadata(\n\t\t\t\tpathname,\n\t\t\t\tclientDir,\n\t\t\t\tcwd,\n\t\t\t\tisWatchMode,\n\t\t\t\tstatusOverride,\n\t\t\t\togConfig,\n\t\t\t\toptions.baseUrl,\n\t\t\t\toptions.autoCanonical,\n\t\t\t);\n\t\t\tspan.setAttributes({\n\t\t\t\t'reroute.pathname': pathname,\n\t\t\t\t'reroute.metadata.exists': !!result.perPageHead,\n\t\t\t});\n\t\t\tif (debug)\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[Setup] ${pathname} - extractMetadata: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t\t);\n\t\t\treturn result;\n\t\t},\n\t);\n\n\treturn {\n\t\tssrData: computeResult.data,\n\t\tssrError: computeResult.error,\n\t\tstatusContainer: computeResult.statusContainer,\n\t\tbyCollectionForSSR,\n\t\tbundlePreload,\n\t\tpreloadExtraHead: preloadResult.extraHead,\n\t\tpreloadHydrationScript: preloadResult.hydrationScript,\n\t\tpreloadStatusOverride: preloadResult.statusOverride,\n\t\tinlineStyleTag,\n\t\tmetadataResult,\n\t\tpending: computeResult.pending,\n\t};\n}\n\n/**\n * Generate hydration scripts for collections that were accessed during SSR.\n */\nfunction generateCollectionScripts(\n\tbyCollectionForSSR: Record<string, unknown[]>,\n): string {\n\ttry {\n\t\tconst g = globalThis as unknown as { __REROUTE_SSR_ACCESSED__?: unknown };\n\t\tconst acc = g.__REROUTE_SSR_ACCESSED__;\n\n\t\tif (acc) {\n\t\t\tconst { subset, partial } = processCollections(acc, byCollectionForSSR);\n\t\t\tif (Object.keys(subset).length > 0) {\n\t\t\t\treturn createCollectionScript(subset, partial);\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Ignore errors\n\t}\n\treturn '';\n}\n\n/**\n * Generate all hydration scripts for SSR\n */\nfunction generateHydrationScripts(\n\tssrData: Record<string, unknown>,\n\tisWatchMode: boolean,\n\tssrError?: string,\n\tcollectionScripts = '',\n\tpreloadScript = '',\n\tbundleUrl = '',\n\tpathname = '',\n\tbrowserTelemetryConfig?: Record<string, unknown>,\n\ttraceContext?: { traceparent?: string; tracestate?: string },\n): string {\n\tlet scripts = preloadScript;\n\n\t// Add collection scripts\n\tscripts += collectionScripts;\n\n\t// Add SSR data script (pathname is used to scope content HTML and exports to current request)\n\tscripts += createDataScript(\n\t\tssrData,\n\t\tisWatchMode ? ssrError : undefined,\n\t\tpathname,\n\t\tbrowserTelemetryConfig,\n\t\ttraceContext,\n\t);\n\n\t// Add feeds and llms scripts\n\tscripts += createFeedsScript();\n\tscripts += createLlmsScript();\n\n\t// Add bundle script\n\tif (bundleUrl) {\n\t\tscripts += `<script type=\"module\" src=\"${bundleUrl}\"></script>`;\n\t}\n\n\t// Add dev watcher in watch mode\n\tif (isWatchMode) {\n\t\tscripts += `<script type=\"module\" src=\"/__reroute_watch.js\"></script>`;\n\t}\n\n\treturn scripts;\n}\n\nexport type { SSRSetupOptions, SSRSetupResult };\nexport { performSSRSetup, generateCollectionScripts, generateHydrationScripts };\n",
23
23
  "// Types\n\n// Core utilities\nexport * from './cache';\n// Content handling\nexport * from './collections';\n// HTTP utilities\nexport * from './compression';\n// SSR compute\nexport * from './compute';\nexport { computeSSRDataForPath } from './data';\n// HTML handling\nexport * from './html';\nexport * from './imports';\nexport * from './layouts';\nexport * from './metadata';\nexport * from './mime';\nexport * from './modules';\nexport * from './path';\nexport * from './preload';\n// Script generation\nexport * from './scripts';\nexport * from './seed';\n// Shared setup\nexport * from './setup';\nexport * from './styles';\nexport * from './template';\nexport * from './types';\n",
24
- "import type { Span } from '@opentelemetry/api';\nimport dedent from 'dedent';\nimport { cloneElement, type ReactElement } from 'react';\nimport { renderToString } from 'react-dom/server';\nimport {\n\tgetTraceContextForInjection,\n\twithSpan,\n\twithSpanSync,\n} from 'reroute-js/telemetry/server';\nimport { loadConfig, type OGImageOptions } from '../config';\nimport {\n\ttype Doc,\n\tduplicateQueryParamData,\n\tgenerateCollectionScripts,\n\tgenerateHydrationScripts,\n\tperformSSRSetup,\n\tsetGlobalSSRData,\n} from './lib';\nimport { applyIndexTemplate, loadIndexHtml } from './lib/html';\n\ntype SSRRenderOptions = {\n\tpathname: string;\n\trootComponent: ReactElement;\n\tclientDir: string;\n\tcwd: string;\n\tisWatchMode: boolean;\n\tbundleUrl: string;\n\tcachedCollections?: Record<string, unknown[]>;\n\tcachedTailwindCSS?: string;\n\thead?: string;\n\tlang?: string;\n\tappId?: string;\n\tminify?: boolean;\n\tmaxAge?: number;\n\tsearchParams?: URLSearchParams;\n\togConfig?: OGImageOptions;\n\tparentSpan?: Span | null;\n};\n\ntype SSRRenderResult = {\n\thtml: string;\n\tstatus: number;\n};\n\n/**\n * Render a React component to a complete HTML document for SSR.\n * Uses synchronous rendering (renderToString) for full HTML generation.\n */\nasync function renderSSRDocument(\n\toptions: SSRRenderOptions,\n): Promise<SSRRenderResult> {\n\tconst {\n\t\tpathname,\n\t\trootComponent,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tbundleUrl,\n\t\thead = '',\n\t\tlang = 'en',\n\t\tappId = 'root',\n\t\tmaxAge = 0,\n\t\tsearchParams,\n\t\togConfig,\n\t} = options;\n\n\t// Perform shared SSR setup\n\tconst setup = await performSSRSetup(\n\t\t{\n\t\t\tpathname,\n\t\t\tclientDir,\n\t\t\tcwd,\n\t\t\tisWatchMode,\n\t\t\tparentSpan: options.parentSpan,\n\t\t\tbundleUrl,\n\t\t\tmaxAge,\n\t\t\tsearchParams,\n\t\t\togConfig,\n\t\t\tcachedCollections: options.cachedCollections,\n\t\t\tcachedTailwindCSS: options.cachedTailwindCSS,\n\t\t},\n\t\tfalse, // not streaming\n\t);\n\n\t// Duplicate data for query param routes\n\tconst duplicatedData = duplicateQueryParamData(setup.ssrData);\n\tsetGlobalSSRData(duplicatedData);\n\n\t// Render React component to string\n\tconst appHtml = await withSpan('ssr.render.react', async (span) => {\n\t\tconst componentWithPathname = cloneElement<Doc>(rootComponent, {\n\t\t\tpathname,\n\t\t\tsearchParams,\n\t\t} as Doc);\n\t\tspan.setAttribute('reroute.pathname', pathname);\n\t\tconst html = renderToString(componentWithPathname);\n\t\tspan.setAttribute('reroute.html.final.size', html.length);\n\t\treturn html;\n\t});\n\n\t// Load base template\n\tconst baseTemplate = await withSpan('ssr.load.template', async (span) => {\n\t\tconst template = await loadIndexHtml(clientDir);\n\t\tspan.setAttribute('reroute.template.size', template.length);\n\t\treturn template;\n\t});\n\n\t// Generate collection scripts from accessed collections\n\tconst collectionScripts = generateCollectionScripts(setup.byCollectionForSSR);\n\n\t// Load config to get browser telemetry settings\n\tconst config = await loadConfig(cwd);\n\tconst browserTelemetryConfigRaw = config.telemetry?.browser as\n\t\t| Record<string, unknown>\n\t\t| undefined;\n\n\t// Serialize browser telemetry config (convert functions to strings for JSON)\n\tconst { serializeBrowserTelemetryConfig } = await import('./lib/serialize');\n\tconst browserTelemetryConfig = serializeBrowserTelemetryConfig(\n\t\tbrowserTelemetryConfigRaw,\n\t);\n\n\t// Extract trace context from parent span for distributed tracing\n\tconst traceContext = getTraceContextForInjection(options.parentSpan);\n\n\t// Generate all hydration scripts\n\tconst hydrationScript = await withSpan(\n\t\t'ssr.generate.scripts',\n\t\tasync (span) => {\n\t\t\tconst script = generateHydrationScripts(\n\t\t\t\tsetup.ssrData,\n\t\t\t\tisWatchMode,\n\t\t\t\tsetup.ssrError,\n\t\t\t\tcollectionScripts,\n\t\t\t\tsetup.preloadHydrationScript,\n\t\t\t\tbundleUrl,\n\t\t\t\tpathname,\n\t\t\t\tbrowserTelemetryConfig,\n\t\t\t\ttraceContext,\n\t\t\t);\n\t\t\tspan.setAttribute('reroute.scripts.size', script.length);\n\t\t\treturn script;\n\t\t},\n\t);\n\n\t// Determine final status\n\tlet statusOverride = setup.preloadStatusOverride;\n\tif (setup.statusContainer.value) {\n\t\tstatusOverride = setup.statusContainer.value;\n\t}\n\tif (setup.metadataResult.statusOverride) {\n\t\tstatusOverride = setup.metadataResult.statusOverride;\n\t}\n\n\t// Build combined head content\n\tconst extraHead = setup.bundlePreload + setup.preloadExtraHead;\n\tconst combinedHead = dedent(\n\t\t[\n\t\t\tdedent(head) || '',\n\t\t\tdedent(extraHead),\n\t\t\tdedent(setup.metadataResult.perPageHead),\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join('\\n'),\n\t);\n\n\t// Apply template with SSR content\n\tconst html = withSpanSync('ssr.apply.template', (span) => {\n\t\tconst result = applyIndexTemplate(baseTemplate, appHtml, {\n\t\t\thead: [setup.inlineStyleTag, combinedHead].filter(Boolean).join('\\n'),\n\t\t\thydrationScript,\n\t\t\tlang: setup.metadataResult.pageLang || lang,\n\t\t\tappId,\n\t\t});\n\t\tspan.setAttributes({\n\t\t\t'reroute.html.final.size': result.length,\n\t\t\t'reroute.html.original.size': appHtml.length,\n\t\t});\n\t\treturn result;\n\t});\n\n\treturn {\n\t\thtml,\n\t\tstatus: statusOverride || 200,\n\t};\n}\n\nexport { renderSSRDocument, type SSRRenderOptions, type SSRRenderResult };\n",
24
+ "import type { Span } from '@opentelemetry/api';\nimport dedent from 'dedent';\nimport { cloneElement, type ReactElement } from 'react';\nimport { renderToString } from 'react-dom/server';\nimport {\n\tgetTraceContextForInjection,\n\twithSpan,\n\twithSpanSync,\n} from 'reroute-js/telemetry/server';\nimport { loadConfig, type OGImageOptions } from '../config';\nimport {\n\ttype Doc,\n\tduplicateQueryParamData,\n\tgenerateCollectionScripts,\n\tgenerateHydrationScripts,\n\tperformSSRSetup,\n\tsetGlobalSSRData,\n} from './lib';\nimport { applyIndexTemplate, loadIndexHtml } from './lib/html';\n\ntype SSRRenderOptions = {\n\tpathname: string;\n\trootComponent: ReactElement;\n\tclientDir: string;\n\tcwd: string;\n\tisWatchMode: boolean;\n\tbundleUrl: string;\n\tcachedCollections?: Record<string, unknown[]>;\n\tcachedTailwindCSS?: string;\n\thead?: string;\n\tlang?: string;\n\tappId?: string;\n\tminify?: boolean;\n\tmaxAge?: number;\n\tsearchParams?: URLSearchParams;\n\togConfig?: OGImageOptions;\n\tbaseUrl?: string;\n\tautoCanonical?: boolean;\n\tparentSpan?: Span | null;\n};\n\ntype SSRRenderResult = {\n\thtml: string;\n\tstatus: number;\n};\n\n/**\n * Render a React component to a complete HTML document for SSR.\n * Uses synchronous rendering (renderToString) for full HTML generation.\n */\nasync function renderSSRDocument(\n\toptions: SSRRenderOptions,\n): Promise<SSRRenderResult> {\n\tconst {\n\t\tpathname,\n\t\trootComponent,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tbundleUrl,\n\t\thead = '',\n\t\tlang = 'en',\n\t\tappId = 'root',\n\t\tmaxAge = 0,\n\t\tsearchParams,\n\t\togConfig,\n\t} = options;\n\n\t// Perform shared SSR setup\n\tconst setup = await performSSRSetup(\n\t\t{\n\t\t\tpathname,\n\t\t\tclientDir,\n\t\t\tcwd,\n\t\t\tisWatchMode,\n\t\t\tparentSpan: options.parentSpan,\n\t\t\tbundleUrl,\n\t\t\tmaxAge,\n\t\t\tsearchParams,\n\t\t\togConfig,\n\t\t\tbaseUrl: options.baseUrl,\n\t\t\tautoCanonical: options.autoCanonical,\n\t\t\tcachedCollections: options.cachedCollections,\n\t\t\tcachedTailwindCSS: options.cachedTailwindCSS,\n\t\t},\n\t\tfalse, // not streaming\n\t);\n\n\t// Duplicate data for query param routes\n\tconst duplicatedData = duplicateQueryParamData(setup.ssrData);\n\tsetGlobalSSRData(duplicatedData);\n\n\t// Render React component to string\n\tconst appHtml = await withSpan('ssr.render.react', async (span) => {\n\t\tconst componentWithPathname = cloneElement<Doc>(rootComponent, {\n\t\t\tpathname,\n\t\t\tsearchParams,\n\t\t} as Doc);\n\t\tspan.setAttribute('reroute.pathname', pathname);\n\t\tconst html = renderToString(componentWithPathname);\n\t\tspan.setAttribute('reroute.html.final.size', html.length);\n\t\treturn html;\n\t});\n\n\t// Load base template\n\tconst baseTemplate = await withSpan('ssr.load.template', async (span) => {\n\t\tconst template = await loadIndexHtml(clientDir);\n\t\tspan.setAttribute('reroute.template.size', template.length);\n\t\treturn template;\n\t});\n\n\t// Generate collection scripts from accessed collections\n\tconst collectionScripts = generateCollectionScripts(setup.byCollectionForSSR);\n\n\t// Load config to get browser telemetry settings\n\tconst config = await loadConfig(cwd);\n\tconst browserTelemetryConfigRaw = config.telemetry?.browser as\n\t\t| Record<string, unknown>\n\t\t| undefined;\n\n\t// Serialize browser telemetry config (convert functions to strings for JSON)\n\tconst { serializeBrowserTelemetryConfig } = await import('./lib/serialize');\n\tconst browserTelemetryConfig = serializeBrowserTelemetryConfig(\n\t\tbrowserTelemetryConfigRaw,\n\t);\n\n\t// Extract trace context from parent span for distributed tracing\n\tconst traceContext = getTraceContextForInjection(options.parentSpan);\n\n\t// Generate all hydration scripts\n\tconst hydrationScript = await withSpan(\n\t\t'ssr.generate.scripts',\n\t\tasync (span) => {\n\t\t\tconst script = generateHydrationScripts(\n\t\t\t\tsetup.ssrData,\n\t\t\t\tisWatchMode,\n\t\t\t\tsetup.ssrError,\n\t\t\t\tcollectionScripts,\n\t\t\t\tsetup.preloadHydrationScript,\n\t\t\t\tbundleUrl,\n\t\t\t\tpathname,\n\t\t\t\tbrowserTelemetryConfig,\n\t\t\t\ttraceContext,\n\t\t\t);\n\t\t\tspan.setAttribute('reroute.scripts.size', script.length);\n\t\t\treturn script;\n\t\t},\n\t);\n\n\t// Determine final status\n\tlet statusOverride = setup.preloadStatusOverride;\n\tif (setup.statusContainer.value) {\n\t\tstatusOverride = setup.statusContainer.value;\n\t}\n\tif (setup.metadataResult.statusOverride) {\n\t\tstatusOverride = setup.metadataResult.statusOverride;\n\t}\n\n\t// Build combined head content\n\tconst extraHead = setup.bundlePreload + setup.preloadExtraHead;\n\tconst combinedHead = dedent(\n\t\t[\n\t\t\tdedent(head) || '',\n\t\t\tdedent(extraHead),\n\t\t\tdedent(setup.metadataResult.perPageHead),\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join('\\n'),\n\t);\n\n\t// Apply template with SSR content\n\tconst html = withSpanSync('ssr.apply.template', (span) => {\n\t\tconst result = applyIndexTemplate(baseTemplate, appHtml, {\n\t\t\thead: [setup.inlineStyleTag, combinedHead].filter(Boolean).join('\\n'),\n\t\t\thydrationScript,\n\t\t\tlang: setup.metadataResult.pageLang || lang,\n\t\t\tappId,\n\t\t});\n\t\tspan.setAttributes({\n\t\t\t'reroute.html.final.size': result.length,\n\t\t\t'reroute.html.original.size': appHtml.length,\n\t\t});\n\t\treturn result;\n\t});\n\n\treturn {\n\t\thtml,\n\t\tstatus: statusOverride || 200,\n\t};\n}\n\nexport { renderSSRDocument, type SSRRenderOptions, type SSRRenderResult };\n",
25
25
  "import { pathToFileURL } from 'node:url';\nimport type { ReactElement } from 'react';\nimport { renderToStaticMarkup } from 'react-dom/server';\nimport type { LLMsOptions } from '../config';\nimport { join } from '../ssr/lib/path';\nimport type { Doc } from '../ssr/lib/types';\nimport { renderSSRDocument } from '../ssr/render';\nimport { extractTitle, htmlToMarkdown, stripHtmlTags } from './formatter';\n\n/**\n * Check if a route should be excluded from LLM features\n * Supports strings (substring match), RegExp, and custom functions\n */\nexport function shouldExcludeRoute(\n\tpathname: string,\n\texcludeRoutes?: (string | RegExp | ((pathname: string) => boolean))[],\n): boolean {\n\tif (!excludeRoutes || excludeRoutes.length === 0) {\n\t\treturn false;\n\t}\n\n\treturn Boolean(\n\t\texcludeRoutes.find((pattern) => {\n\t\t\tif (typeof pattern === 'string') {\n\t\t\t\t// Substring match for simplicity\n\t\t\t\treturn pathname.includes(pattern);\n\t\t\t}\n\t\t\tif (pattern instanceof RegExp) {\n\t\t\t\treturn pattern.test(pathname);\n\t\t\t}\n\t\t\tif (typeof pattern === 'function') {\n\t\t\t\treturn pattern(pathname);\n\t\t\t}\n\t\t\treturn false;\n\t\t}),\n\t);\n}\n\nasync function loadCollectionItem(\n\tcwd: string,\n\tpathname: string,\n\tisWatchMode: boolean,\n): Promise<{ item: Doc; collection: string } | null> {\n\tconst parts = pathname.split('/').filter(Boolean);\n\tif (parts.length < 2) return null;\n\n\tconst collection = parts[0];\n\tconst collectionFile = join(\n\t\tcwd,\n\t\t'.reroute',\n\t\t'collections',\n\t\t`${collection}.js`,\n\t);\n\tconst exists = await Bun.file(collectionFile).exists();\n\tif (!exists) return null;\n\n\tconst url = `${pathToFileURL(collectionFile).href}${isWatchMode ? `?t=${Date.now()}` : ''}`;\n\tconst mod = await import(url);\n\tconst items = mod.items || [];\n\n\tconst item = items.find((i: Doc) => i.href === pathname);\n\tif (!item) return null;\n\n\treturn { item, collection };\n}\n\nasync function findComponentPath(\n\tclientDir: string,\n\tcollection: string,\n\tslug: string,\n): Promise<string | null> {\n\tconst extensions = ['.mdx', '.md', '.tsx', '.jsx'];\n\n\tfor (const ext of extensions) {\n\t\tconst testPath = join(\n\t\t\tclientDir,\n\t\t\t'routes',\n\t\t\tcollection,\n\t\t\t'content',\n\t\t\t`${slug}${ext}`,\n\t\t);\n\t\tconst file = Bun.file(testPath);\n\t\tif (await file.exists()) {\n\t\t\treturn testPath;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction stripFrontmatterAndJsx(content: string, isMdx: boolean): string {\n\tlet rawContent = content.replace(/^---\\n[\\s\\S]*?\\n---\\n/, '');\n\n\tif (isMdx) {\n\t\trawContent = rawContent.replace(\n\t\t\t/^import\\s+.*?from\\s+['\"].*?['\"];?\\s*$/gm,\n\t\t\t'',\n\t\t);\n\t\trawContent = rawContent.replace(/<[A-Z][\\w]*[^>]*\\/>/g, '');\n\t\trawContent = rawContent.replace(\n\t\t\t/<[A-Z][\\w]*[^>]*>[\\s\\S]*?<\\/[A-Z][\\w]*>/g,\n\t\t\t'',\n\t\t);\n\t}\n\n\treturn rawContent.trim();\n}\n\nasync function extractMarkdownContent(\n\tcomponentPath: string,\n\tmeta: Record<string, unknown>,\n): Promise<{ title?: string; body: string; markdown: string }> {\n\tconst file = Bun.file(componentPath);\n\tlet rawContent = await file.text();\n\n\tconst isMdx = componentPath.endsWith('.mdx');\n\trawContent = stripFrontmatterAndJsx(rawContent, isMdx);\n\n\treturn {\n\t\ttitle: (meta.title as string) || extractTitle(rawContent),\n\t\tbody: stripHtmlTags(rawContent),\n\t\tmarkdown: rawContent,\n\t};\n}\n\nasync function extractComponentContent(\n\tcomponentPath: string,\n\tmeta: Record<string, unknown>,\n\tisWatchMode: boolean,\n): Promise<{ title?: string; body: string; markdown: string } | null> {\n\ttry {\n\t\tconst componentUrl = `${pathToFileURL(componentPath).href}${isWatchMode ? `?t=${Date.now()}` : ''}`;\n\t\tconst componentMod = await import(componentUrl);\n\n\t\tconst Component = componentMod.default;\n\t\tif (!Component || typeof Component !== 'function') return null;\n\n\t\tconst html = renderToStaticMarkup(Component({}));\n\n\t\treturn {\n\t\t\ttitle: (meta.title as string) || extractTitle(html),\n\t\t\tbody: stripHtmlTags(html),\n\t\t\tmarkdown: htmlToMarkdown(html),\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\n\t\t\t`[reroute/llms] Failed to import component ${componentPath}:`,\n\t\t\terror,\n\t\t);\n\t\treturn null;\n\t}\n}\n\n/**\n * Extract content from a collection item (markdown/mdx)\n */\nasync function extractCollectionContent(\n\tcwd: string,\n\tclientDir: string,\n\tpathname: string,\n\tisWatchMode: boolean,\n\t_format: 'txt' | 'md',\n): Promise<{ title?: string; body: string; markdown: string } | null> {\n\ttry {\n\t\tconst collectionData = await loadCollectionItem(cwd, pathname, isWatchMode);\n\t\tif (!collectionData) return null;\n\n\t\tconst { item, collection } = collectionData;\n\t\tconst slug = item.slug || item.name;\n\t\tif (!slug) return null;\n\n\t\tconst componentPath = await findComponentPath(clientDir, collection, slug);\n\t\tif (!componentPath) return null;\n\n\t\tconst meta = item.meta || {};\n\n\t\tif (componentPath.endsWith('.md') || componentPath.endsWith('.mdx')) {\n\t\t\treturn await extractMarkdownContent(componentPath, meta);\n\t\t}\n\n\t\treturn await extractComponentContent(componentPath, meta, isWatchMode);\n\t} catch (error) {\n\t\tconsole.error(\n\t\t\t`[reroute/llms] Failed to extract collection content for ${pathname}:`,\n\t\t\terror,\n\t\t);\n\t\treturn null;\n\t}\n}\n\n/**\n * Extract content from an SSR route using full app rendering\n */\nasync function extractSSRContent(\n\tpathname: string,\n\trootComponent: ReactElement,\n\tclientDir: string,\n\tcwd: string,\n\tisWatchMode: boolean,\n\tbundleUrl: string,\n\t_format: 'txt' | 'md',\n): Promise<{ title?: string; body: string; markdown: string } | null> {\n\ttry {\n\t\t// Use the full SSR rendering pipeline to get the complete HTML\n\t\t// This includes all providers, context, and hooks - just like a real request\n\t\tconst { html } = await renderSSRDocument({\n\t\t\tpathname,\n\t\t\trootComponent,\n\t\t\tclientDir,\n\t\t\tcwd,\n\t\t\tisWatchMode,\n\t\t\tbundleUrl,\n\t\t\tminify: false,\n\t\t\tmaxAge: 0,\n\t\t});\n\n\t\t// Extract just the content from the rendered HTML\n\t\t// Remove script tags, styles, nav, footer, etc.\n\t\tlet contentHtml = html;\n\n\t\t// Extract the body content (inside the app div)\n\t\tconst appDivMatch = html.match(/<div id=\"[^\"]+\">(.+?)<\\/div>\\s*<script/s);\n\t\tif (appDivMatch) {\n\t\t\tcontentHtml = appDivMatch[1];\n\t\t}\n\n\t\t// Remove nav and footer elements (common layout noise)\n\t\tcontentHtml = contentHtml.replace(/<nav[\\s\\S]*?<\\/nav>/gi, '');\n\t\tcontentHtml = contentHtml.replace(/<footer[\\s\\S]*?<\\/footer>/gi, '');\n\t\tcontentHtml = contentHtml.replace(/<header[\\s\\S]*?<\\/header>/gi, '');\n\t\tcontentHtml = contentHtml.replace(/<aside[\\s\\S]*?<\\/aside>/gi, '');\n\n\t\treturn {\n\t\t\ttitle: extractTitle(html),\n\t\t\tbody: stripHtmlTags(contentHtml),\n\t\t\tmarkdown: htmlToMarkdown(contentHtml),\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\n\t\t\t`[reroute/llms] Failed to extract SSR content for ${pathname}:`,\n\t\t\terror,\n\t\t);\n\t\treturn null;\n\t}\n}\n\n/**\n * Main content extraction function\n * Extracts clean, LLM-optimized content from any route type\n */\nexport async function extractContentForLLMs(options: {\n\tpathname: string;\n\trootComponent?: ReactElement;\n\tclientDir: string;\n\tcwd: string;\n\tisWatchMode: boolean;\n\tbundleUrl?: string;\n\tformat: 'txt' | 'md';\n\tllmsConfig?: LLMsOptions;\n}): Promise<string> {\n\tconst {\n\t\tpathname,\n\t\trootComponent,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tbundleUrl,\n\t\tformat,\n\t\tllmsConfig,\n\t} = options;\n\n\t// Check if route should be excluded\n\tif (shouldExcludeRoute(pathname, llmsConfig?.excludeRoutes)) {\n\t\tthrow new Error('Route excluded from LLM features');\n\t}\n\n\t// Try collection content first (most common case for content sites)\n\tlet content = await extractCollectionContent(\n\t\tcwd,\n\t\tclientDir,\n\t\tpathname,\n\t\tisWatchMode,\n\t\tformat,\n\t);\n\n\t// Fall back to SSR route (uses full app rendering)\n\tif (!content && rootComponent && bundleUrl) {\n\t\tcontent = await extractSSRContent(\n\t\t\tpathname,\n\t\t\trootComponent,\n\t\t\tclientDir,\n\t\t\tcwd,\n\t\t\tisWatchMode,\n\t\t\tbundleUrl,\n\t\t\tformat,\n\t\t);\n\t}\n\n\t// If we still don't have content, throw\n\tif (!content) {\n\t\tthrow new Error('Content not found');\n\t}\n\n\t// Return based on format\n\tif (format === 'md') {\n\t\t// Return markdown with title as h1\n\t\tconst parts: string[] = [];\n\t\tif (content.title) {\n\t\t\tparts.push(`# ${content.title}`);\n\t\t\tparts.push('');\n\t\t}\n\t\tparts.push(content.markdown);\n\t\treturn parts.join('\\n');\n\t}\n\n\t// Return plain text\n\tconst parts: string[] = [];\n\tif (content.title) {\n\t\tparts.push(content.title);\n\t\tparts.push('');\n\t}\n\tparts.push(content.body);\n\treturn parts.join('\\n');\n}\n",
26
26
  "import type { ReactElement } from 'react';\nimport type { LLMsOptions } from '../config';\nimport { extractContentForLLMs, shouldExcludeRoute } from './extractor';\n\ntype RouteEntry = {\n\tpath: string;\n\tdate?: string;\n};\n\nfunction buildHeader(baseUrl: string, llmsConfig?: LLMsOptions): string[] {\n\tconst parts: string[] = [];\n\n\tif (llmsConfig?.siteName) {\n\t\tparts.push(`# ${llmsConfig.siteName}`);\n\t\tparts.push('');\n\t}\n\n\tif (llmsConfig?.siteDescription) {\n\t\tparts.push(llmsConfig.siteDescription);\n\t\tparts.push('');\n\t}\n\n\tif (parts.length > 0) {\n\t\tparts.push(`${baseUrl}/index.txt`);\n\t\tparts.push('');\n\t\tparts.push('---');\n\t\tparts.push('');\n\t}\n\n\treturn parts;\n}\n\nasync function discoverAllRoutes(\n\tcwd: string,\n\tclientDir: string,\n\tcollections: string[],\n\tisWatchMode: boolean,\n\tllmsConfig?: LLMsOptions,\n): Promise<RouteEntry[]> {\n\tconst {\n\t\tdiscoverStaticRoutes,\n\t\tdiscoverCollectionRoutes,\n\t\tdiscoverSSRDataRoutes,\n\t} = await import('./index-generator');\n\n\tconst staticRoutes = await discoverStaticRoutes(cwd, isWatchMode);\n\tconst collectionsMap = await discoverCollectionRoutes(\n\t\tcwd,\n\t\tcollections,\n\t\tisWatchMode,\n\t\tllmsConfig,\n\t);\n\tconst ssrDataRoutes = await discoverSSRDataRoutes(\n\t\tcwd,\n\t\tclientDir,\n\t\tstaticRoutes,\n\t\tisWatchMode,\n\t);\n\n\tconst allRoutes: RouteEntry[] = [];\n\n\tfor (const route of staticRoutes) {\n\t\tif (!shouldExcludeRoute(route.path, llmsConfig?.excludeRoutes)) {\n\t\t\tallRoutes.push({ path: route.path });\n\t\t}\n\t}\n\n\tfor (const [_collection, routes] of collectionsMap.entries()) {\n\t\tfor (const route of routes) {\n\t\t\tif (!shouldExcludeRoute(route.path, llmsConfig?.excludeRoutes)) {\n\t\t\t\tallRoutes.push({ path: route.path });\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const [_routePattern, routes] of ssrDataRoutes.entries()) {\n\t\tfor (const route of routes) {\n\t\t\tif (!shouldExcludeRoute(route.path, llmsConfig?.excludeRoutes)) {\n\t\t\t\tallRoutes.push({ path: route.path });\n\t\t\t}\n\t\t}\n\t}\n\n\treturn allRoutes;\n}\n\nfunction formatContentBlock(\n\tcontent: string,\n\troutePath: string,\n\tbaseUrl: string,\n): string[] {\n\tconst parts: string[] = [];\n\tconst lines = content.split('\\n');\n\tconst title = lines[0] || 'Untitled';\n\tconst body = lines.slice(lines[1] === '' ? 2 : 1).join('\\n');\n\n\tconst urlPath = routePath === '/' ? '/index' : routePath;\n\tconst url = `${baseUrl}${urlPath}.txt`;\n\n\tparts.push(title);\n\tparts.push('');\n\tparts.push(url);\n\tparts.push('');\n\tif (body.trim()) {\n\t\tparts.push(body);\n\t\tparts.push('');\n\t}\n\tparts.push('---');\n\tparts.push('');\n\n\treturn parts;\n}\n\nasync function extractRouteContents(\n\troutes: RouteEntry[],\n\toptions: {\n\t\trootComponent?: ReactElement;\n\t\tcwd: string;\n\t\tclientDir: string;\n\t\tbaseUrl: string;\n\t\tisWatchMode: boolean;\n\t\tbundleUrl?: string;\n\t\tllmsConfig?: LLMsOptions;\n\t},\n): Promise<{ parts: string[]; itemCount: number; currentSize: number }> {\n\tconst parts: string[] = [];\n\tconst maxSize = options.llmsConfig?.maxSize || 50 * 1024 * 1024;\n\tlet itemCount = 0;\n\tlet currentSize = 0;\n\n\tfor (const route of routes) {\n\t\ttry {\n\t\t\tconst content = await extractContentForLLMs({\n\t\t\t\tpathname: route.path,\n\t\t\t\trootComponent: options.rootComponent,\n\t\t\t\tclientDir: options.clientDir,\n\t\t\t\tcwd: options.cwd,\n\t\t\t\tisWatchMode: options.isWatchMode,\n\t\t\t\tbundleUrl: options.bundleUrl,\n\t\t\t\tformat: 'txt',\n\t\t\t\tllmsConfig: options.llmsConfig,\n\t\t\t});\n\n\t\t\tconst contentSize = Buffer.byteLength(content, 'utf8');\n\t\t\tif (currentSize + contentSize > maxSize) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[reroute/llms] Reached size limit (${maxSize} bytes), stopping at ${itemCount} items`,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst blockParts = formatContentBlock(\n\t\t\t\tcontent,\n\t\t\t\troute.path,\n\t\t\t\toptions.baseUrl,\n\t\t\t);\n\t\t\tparts.push(...blockParts);\n\n\t\t\titemCount++;\n\t\t\tcurrentSize += contentSize;\n\t\t} catch (error) {\n\t\t\tconsole.warn(\n\t\t\t\t`[reroute/llms] Failed to extract content for ${route.path}:`,\n\t\t\t\terror,\n\t\t\t);\n\t\t}\n\t}\n\n\treturn { parts, itemCount, currentSize };\n}\n\nfunction buildFooter(parts: string[]): void {\n\tif (parts.length === 0) return;\n\n\t// Remove last separator\n\tif (parts[parts.length - 1] === '') parts.pop();\n\tif (parts[parts.length - 1] === '---') parts.pop();\n\tif (parts[parts.length - 1] === '') parts.pop();\n\n\tparts.push('---');\n\tparts.push('');\n\tparts.push(\n\t\t'Formats: .txt | .md | Accept: text/plain | Accept: text/markdown',\n\t);\n}\n\n/**\n * Generate /llms-full.txt - all site content in one file\n * Runtime-only generation with aggressive caching (7 days default)\n */\nexport async function generateLLMsFullContent(options: {\n\trootComponent?: ReactElement;\n\tcwd: string;\n\tclientDir: string;\n\tcollections: string[];\n\tbaseUrl: string;\n\tisWatchMode: boolean;\n\tbundleUrl?: string;\n\tllmsConfig?: LLMsOptions;\n}): Promise<{\n\tcontent: string;\n\tstats: { itemCount: number; byteSize: number };\n}> {\n\tconst { cwd, clientDir, collections, baseUrl, isWatchMode, llmsConfig } =\n\t\toptions;\n\n\tconst parts = buildHeader(baseUrl, llmsConfig);\n\n\tconst allRoutes = await discoverAllRoutes(\n\t\tcwd,\n\t\tclientDir,\n\t\tcollections,\n\t\tisWatchMode,\n\t\tllmsConfig,\n\t);\n\n\tconst maxItems = llmsConfig?.maxItems || 10000;\n\tconst routesToProcess = allRoutes.slice(0, maxItems);\n\n\tconst extracted = await extractRouteContents(routesToProcess, options);\n\tparts.push(...extracted.parts);\n\n\tbuildFooter(parts);\n\n\tconst fullContent = parts.join('\\n');\n\tconst byteSize = Buffer.byteLength(fullContent, 'utf8');\n\n\treturn {\n\t\tcontent: fullContent,\n\t\tstats: { itemCount: extracted.itemCount, byteSize },\n\t};\n}\n",
27
27
  "import { pathToFileURL } from 'node:url';\nimport type { LLMsOptions } from '../config';\nimport { join } from '../ssr/lib/path';\nimport type { Doc } from '../ssr/lib/types';\nimport { shouldExcludeRoute } from './extractor';\n\ntype RouteEntry = {\n\tpath: string;\n\tsection?: string;\n\ttitle?: string;\n};\n\n/**\n * Discover static routes from routes.ts\n */\nexport async function discoverStaticRoutes(\n\tcwd: string,\n\tisWatchMode: boolean,\n): Promise<RouteEntry[]> {\n\tconst routes: RouteEntry[] = [];\n\n\ttry {\n\t\t// Check for bundled routes first (compiled binary support)\n\t\tlet routesList = (globalThis as Record<string, unknown>)\n\t\t\t.__REROUTE_ROUTES__ as Doc[] | undefined;\n\n\t\t// Fallback to dynamic import (dev mode)\n\t\tif (!routesList) {\n\t\t\tconst routesPath = join(cwd, '.reroute', 'routes.ts');\n\t\t\tconst url = pathToFileURL(routesPath).href;\n\t\t\tconst mod = await import(\n\t\t\t\t`${url}${isWatchMode ? `?t=${Date.now()}` : ''}`\n\t\t\t);\n\t\t\troutesList = (mod as Doc)?.routes as Doc[] | undefined;\n\t\t}\n\t\tif (Array.isArray(routesList)) {\n\t\t\tfor (const route of routesList) {\n\t\t\t\tconst pattern = String(route?.pattern || '');\n\n\t\t\t\t// Skip error pages, layouts, and dynamic routes\n\t\t\t\tif (\n\t\t\t\t\tpattern.includes('[404]') ||\n\t\t\t\t\tpattern.includes('[layout]') ||\n\t\t\t\t\tpattern.includes('[skeleton]') ||\n\t\t\t\t\tpattern.includes(':')\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\troutes.push({\n\t\t\t\t\tpath: pattern,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.error('[reroute/llms] Failed to discover routes for index:', error);\n\t}\n\n\treturn routes;\n}\n\nasync function loadCollectionModule(\n\tcwd: string,\n\tcollection: string,\n\tisWatchMode: boolean,\n): Promise<Doc[] | null> {\n\tconst collectionFile = join(\n\t\tcwd,\n\t\t'.reroute',\n\t\t'collections',\n\t\t`${collection}.js`,\n\t);\n\tconst exists = await Bun.file(collectionFile).exists();\n\n\tif (!exists) return null;\n\n\tconst url = `${pathToFileURL(collectionFile).href}${isWatchMode ? `?t=${Date.now()}` : ''}`;\n\tconst mod = await import(url);\n\treturn mod.items || [];\n}\n\nfunction createRouteEntriesFromItems(\n\titems: Doc[],\n\tcollection: string,\n): RouteEntry[] {\n\tconst routes: RouteEntry[] = [];\n\n\tfor (const item of items) {\n\t\tconst href = String(item.href || '');\n\t\tif (href) {\n\t\t\tconst title = item.meta?.title || item.meta?.name || item.name;\n\t\t\troutes.push({\n\t\t\t\tpath: href,\n\t\t\t\tsection: collection,\n\t\t\t\ttitle,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn routes;\n}\n\nfunction sortRoutesByDate(routes: RouteEntry[], items: Doc[]): void {\n\troutes.sort((a, b) => {\n\t\tconst aItem = items.find((i: Doc) => i.href === a.path);\n\t\tconst bItem = items.find((i: Doc) => i.href === b.path);\n\n\t\tconst aDate = aItem?.meta?.date;\n\t\tconst bDate = bItem?.meta?.date;\n\n\t\tif (aDate && bDate) {\n\t\t\treturn new Date(bDate).getTime() - new Date(aDate).getTime();\n\t\t}\n\n\t\treturn 0;\n\t});\n}\n\n/**\n * Discover collection content\n */\nexport async function discoverCollectionRoutes(\n\tcwd: string,\n\tcollections: string[],\n\tisWatchMode: boolean,\n\tllmsConfig?: LLMsOptions,\n): Promise<Map<string, RouteEntry[]>> {\n\tconst collectionsMap = new Map<string, RouteEntry[]>();\n\n\tfor (const collection of collections) {\n\t\tif (llmsConfig?.excludeCollections?.includes(collection)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\tconst items = await loadCollectionModule(cwd, collection, isWatchMode);\n\t\t\tif (!items) continue;\n\n\t\t\tconst routes = createRouteEntriesFromItems(items, collection);\n\n\t\t\tif (routes.length > 0) {\n\t\t\t\tsortRoutesByDate(routes, items);\n\t\t\t\tcollectionsMap.set(collection, routes);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(\n\t\t\t\t`[reroute/llms] Failed to discover collection ${collection}:`,\n\t\t\t\terror,\n\t\t\t);\n\t\t}\n\t}\n\n\treturn collectionsMap;\n}\n\nasync function loadRouteModule(\n\tclientDir: string,\n\troutePath: string,\n\tisWatchMode: boolean,\n): Promise<Doc | null> {\n\ttry {\n\t\tconst abs = join(clientDir, 'routes', routePath);\n\t\tconst modUrl = `${pathToFileURL(abs).href}${isWatchMode ? `?t=${Date.now()}` : ''}`;\n\t\treturn (await import(modUrl)) as Doc;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nasync function callDataFunction(\n\tdataFn: (ctx: Doc) => unknown | Promise<unknown>,\n\troutePath: string,\n): Promise<unknown> {\n\tconst mockSet = { status: 200 };\n\treturn await dataFn({\n\t\tpathname: routePath,\n\t\tparams: {},\n\t\tset: mockSet,\n\t});\n}\n\nfunction extractIdentifier(item: Record<string, unknown>): string | undefined {\n\treturn (item.version || item.slug || item.id || item.name || item.key) as\n\t\t| string\n\t\t| undefined;\n}\n\nfunction createEntriesFromArray(array: Doc[], routePath: string): RouteEntry[] {\n\tconst entries: RouteEntry[] = [];\n\n\tfor (const item of array) {\n\t\tif (typeof item !== 'object' || item === null) continue;\n\n\t\tconst identifier = extractIdentifier(item);\n\t\tif (identifier) {\n\t\t\tentries.push({\n\t\t\t\tpath: `${routePath}/${identifier}`,\n\t\t\t\tsection: routePath.split('/').filter(Boolean)[0],\n\t\t\t});\n\t\t}\n\t}\n\n\treturn entries;\n}\n\n/**\n * Discover SSR data routes (routes with ssr.data that return arrays)\n */\nexport async function discoverSSRDataRoutes(\n\t_cwd: string,\n\tclientDir: string,\n\tstaticRoutes: RouteEntry[],\n\tisWatchMode: boolean,\n): Promise<Map<string, RouteEntry[]>> {\n\tconst ssrDataRoutes = new Map<string, RouteEntry[]>();\n\n\tfor (const route of staticRoutes) {\n\t\tconst mod = await loadRouteModule(clientDir, route.path, isWatchMode);\n\t\tif (!mod) continue;\n\n\t\tconst ssr = (mod as Doc)?.ssr as Doc | undefined;\n\t\tconst dataFn = (ssr as Doc)?.data as\n\t\t\t| ((ctx: Doc) => unknown | Promise<unknown>)\n\t\t\t| undefined;\n\n\t\tif (typeof dataFn !== 'function') continue;\n\n\t\tconst result = await callDataFunction(dataFn, route.path);\n\t\tconst arrays = findArraysInData(result);\n\n\t\tfor (const array of arrays) {\n\t\t\tif (array.length === 0) continue;\n\n\t\t\tconst entries = createEntriesFromArray(array, route.path);\n\t\t\tif (entries.length > 0) {\n\t\t\t\tssrDataRoutes.set(route.path, entries);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ssrDataRoutes;\n}\n\n/**\n * Find arrays in data object (recursive)\n */\nfunction findArraysInData(obj: unknown): Doc[] {\n\tconst arrays: Doc[] = [];\n\n\tif (!obj || typeof obj !== 'object') {\n\t\treturn arrays;\n\t}\n\n\tfor (const value of Object.values(obj)) {\n\t\tif (Array.isArray(value)) {\n\t\t\tarrays.push(value);\n\t\t} else if (value && typeof value === 'object') {\n\t\t\tarrays.push(...findArraysInData(value));\n\t\t}\n\t}\n\n\treturn arrays;\n}\n\nfunction addIndexHeader(parts: string[], llmsConfig?: LLMsOptions): void {\n\tif (llmsConfig?.siteName) {\n\t\tparts.push(`# ${llmsConfig.siteName}`);\n\t\tparts.push('');\n\t}\n\n\tif (llmsConfig?.siteDescription) {\n\t\tparts.push(llmsConfig.siteDescription);\n\t\tparts.push('');\n\t}\n}\n\nfunction groupStaticRoutes(\n\tstaticRoutes: RouteEntry[],\n\tllmsConfig?: LLMsOptions,\n): { sections: Map<string, RouteEntry[]>; rootRoutes: RouteEntry[] } {\n\tconst sections = new Map<string, RouteEntry[]>();\n\tconst rootRoutes: RouteEntry[] = [];\n\n\tfor (const route of staticRoutes) {\n\t\tif (shouldExcludeRoute(route.path, llmsConfig?.excludeRoutes)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (route.path === '/') {\n\t\t\trootRoutes.push(route);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst firstSegment = route.path.split('/').filter(Boolean)[0];\n\t\tif (!firstSegment) {\n\t\t\trootRoutes.push(route);\n\t\t} else {\n\t\t\tif (!sections.has(firstSegment)) {\n\t\t\t\tsections.set(firstSegment, []);\n\t\t\t}\n\t\t\tsections.get(firstSegment)?.push(route);\n\t\t}\n\t}\n\n\treturn { sections, rootRoutes };\n}\n\nfunction formatRouteUrl(routePath: string, baseUrl: string): string {\n\tconst urlPath = routePath === '/' ? '/index' : routePath;\n\treturn `${baseUrl}${urlPath}.txt`;\n}\n\nfunction getRouteTitle(route: RouteEntry): string {\n\treturn (\n\t\troute.title ||\n\t\t(route.path === '/' ? 'Home' : route.path.split('/').pop() || 'Page')\n\t);\n}\n\nfunction addRootRoutes(\n\tparts: string[],\n\trootRoutes: RouteEntry[],\n\tbaseUrl: string,\n\tisSingleCollection: boolean,\n): void {\n\tif (isSingleCollection || rootRoutes.length === 0) return;\n\n\tfor (const route of rootRoutes) {\n\t\tconst title = getRouteTitle(route);\n\t\tconst url = formatRouteUrl(route.path, baseUrl);\n\t\tparts.push(`- [${title}](${url})`);\n\t}\n\tparts.push('');\n}\n\nfunction addCollectionSection(\n\tparts: string[],\n\tcollection: string,\n\troutes: RouteEntry[],\n\tbaseUrl: string,\n\tllmsConfig?: LLMsOptions,\n): void {\n\tconst filteredRoutes = routes.filter(\n\t\t(r) => !shouldExcludeRoute(r.path, llmsConfig?.excludeRoutes),\n\t);\n\n\tif (filteredRoutes.length === 0) return;\n\n\tconst sectionName = collection.charAt(0).toUpperCase() + collection.slice(1);\n\tparts.push(`## ${sectionName}`);\n\tparts.push('');\n\n\tfor (const route of filteredRoutes) {\n\t\tconst title = route.title || route.path.split('/').pop() || 'Untitled';\n\t\tconst url = `${baseUrl}${route.path}.txt`;\n\t\tparts.push(`- [${title}](${url})`);\n\t}\n\tparts.push('');\n}\n\nfunction shouldIncludeSection(\n\tsection: string,\n\tisSingleCollection: boolean,\n\ttargetCollection: string | null,\n): boolean {\n\treturn !isSingleCollection || section === targetCollection;\n}\n\nfunction addSSRDataSection(\n\tparts: string[],\n\troutePattern: string,\n\troutes: RouteEntry[],\n\tbaseUrl: string,\n\tisSingleCollection: boolean,\n\ttargetCollection: string | null,\n\tllmsConfig?: LLMsOptions,\n): void {\n\tconst routeSection = routePattern.split('/').filter(Boolean)[0];\n\n\tif (\n\t\t!shouldIncludeSection(routeSection, isSingleCollection, targetCollection)\n\t) {\n\t\treturn;\n\t}\n\n\tconst filteredRoutes = routes.filter(\n\t\t(r) => !shouldExcludeRoute(r.path, llmsConfig?.excludeRoutes),\n\t);\n\n\tif (filteredRoutes.length === 0) return;\n\n\tconst sectionName =\n\t\trouteSection?.charAt(0).toUpperCase() + routeSection?.slice(1) || 'Content';\n\tparts.push(`## ${sectionName}`);\n\tparts.push('');\n\n\tfor (const route of filteredRoutes) {\n\t\tconst title = route.title || route.path.split('/').pop() || 'Untitled';\n\t\tconst url = `${baseUrl}${route.path}.txt`;\n\t\tparts.push(`- [${title}](${url})`);\n\t}\n\tparts.push('');\n}\n\nfunction addStaticSection(\n\tparts: string[],\n\tsection: string,\n\troutes: RouteEntry[],\n\tbaseUrl: string,\n\tisSingleCollection: boolean,\n\ttargetCollection: string | null,\n\tcollectionsMap: Map<string, RouteEntry[]>,\n\tllmsConfig?: LLMsOptions,\n): void {\n\tif (!shouldIncludeSection(section, isSingleCollection, targetCollection)) {\n\t\treturn;\n\t}\n\n\tconst filteredRoutes = routes.filter(\n\t\t(r) => !shouldExcludeRoute(r.path, llmsConfig?.excludeRoutes),\n\t);\n\n\tif (filteredRoutes.length === 0 || collectionsMap.has(section)) return;\n\n\tconst sectionName = section.charAt(0).toUpperCase() + section.slice(1);\n\tparts.push(`## ${sectionName}`);\n\tparts.push('');\n\n\tfor (const route of filteredRoutes) {\n\t\tconst title = route.title || route.path.split('/').pop() || 'Untitled';\n\t\tconst url = `${baseUrl}${route.path}.txt`;\n\t\tparts.push(`- [${title}](${url})`);\n\t}\n\tparts.push('');\n}\n\n/**\n * Generate /llms.txt index\n * Simple, token-efficient format: just URLs grouped by section\n */\nexport async function generateLLMsIndex(options: {\n\tcwd: string;\n\tclientDir: string;\n\tcollections: string[];\n\tbaseUrl: string;\n\tisWatchMode: boolean;\n\tllmsConfig?: LLMsOptions;\n}): Promise<string> {\n\tconst { cwd, clientDir, collections, baseUrl, isWatchMode, llmsConfig } =\n\t\toptions;\n\n\tconst parts: string[] = [];\n\taddIndexHeader(parts, llmsConfig);\n\n\tconst staticRoutes = await discoverStaticRoutes(cwd, isWatchMode);\n\tconst collectionsMap = await discoverCollectionRoutes(\n\t\tcwd,\n\t\tcollections,\n\t\tisWatchMode,\n\t\tllmsConfig,\n\t);\n\tconst ssrDataRoutes = await discoverSSRDataRoutes(\n\t\tcwd,\n\t\tclientDir,\n\t\tstaticRoutes,\n\t\tisWatchMode,\n\t);\n\n\tconst isSingleCollection = collections.length === 1;\n\tconst targetCollection = isSingleCollection ? collections[0] : null;\n\n\tconst { sections, rootRoutes } = groupStaticRoutes(staticRoutes, llmsConfig);\n\n\taddRootRoutes(parts, rootRoutes, baseUrl, isSingleCollection);\n\n\tfor (const [collection, routes] of collectionsMap.entries()) {\n\t\tif (routes.length > 0) {\n\t\t\taddCollectionSection(parts, collection, routes, baseUrl, llmsConfig);\n\t\t}\n\t}\n\n\tfor (const [routePattern, routes] of ssrDataRoutes.entries()) {\n\t\tif (routes.length > 0) {\n\t\t\taddSSRDataSection(\n\t\t\t\tparts,\n\t\t\t\troutePattern,\n\t\t\t\troutes,\n\t\t\t\tbaseUrl,\n\t\t\t\tisSingleCollection,\n\t\t\t\ttargetCollection,\n\t\t\t\tllmsConfig,\n\t\t\t);\n\t\t}\n\t}\n\n\tfor (const [section, routes] of sections.entries()) {\n\t\tif (routes.length > 0) {\n\t\t\taddStaticSection(\n\t\t\t\tparts,\n\t\t\t\tsection,\n\t\t\t\troutes,\n\t\t\t\tbaseUrl,\n\t\t\t\tisSingleCollection,\n\t\t\t\ttargetCollection,\n\t\t\t\tcollectionsMap,\n\t\t\t\tllmsConfig,\n\t\t\t);\n\t\t}\n\t}\n\n\tparts.push('---');\n\tparts.push('');\n\tparts.push(\n\t\t'Formats: .txt | .md | Accept: text/plain | Accept: text/markdown',\n\t);\n\n\treturn parts.join('\\n');\n}\n",
@@ -31,7 +31,7 @@
31
31
  "export * from './discovery';\nexport * from './generator';\nexport * from './policies';\n",
32
32
  "export * from './discovery';\nexport * from './generator';\n",
33
33
  "export * from './discovery';\nexport * from './generator';\n",
34
- "import type { Span } from '@opentelemetry/api';\nimport { cloneElement, type ReactElement } from 'react';\nimport { renderToReadableStream } from 'react-dom/server';\nimport {\n\tgetTraceContextForInjection,\n\twithParentSpan,\n\twithSpan,\n} from 'reroute-js/telemetry/server';\nimport { loadConfig, type OGImageOptions } from '../config';\nimport {\n\tcreateDataScript,\n\tcreateFeedsScript,\n\tcreateLlmsScript,\n\ttype Doc,\n\tgenerateCollectionScripts,\n\tperformSSRSetup,\n} from './lib';\nimport { deduplicateMetaTags, loadIndexHtml } from './lib/html';\nimport { isThenable } from './lib/imports';\nimport { splitTemplate } from './lib/template';\n\ntype StreamingSSROptions = {\n\tpathname: string;\n\trootComponent: ReactElement;\n\tclientDir: string;\n\tcwd: string;\n\tisWatchMode: boolean;\n\tbundleUrl: string;\n\tcachedCollections?: Record<string, unknown[]>;\n\tcachedTailwindCSS?: string;\n\tcachedIndexHtml?: string;\n\tdebug?: boolean;\n\thead?: string;\n\tlang?: string;\n\tappId?: string;\n\tmaxAge?: number;\n\tsearchParams?: URLSearchParams;\n\togConfig?: OGImageOptions;\n\tparentSpan?: Span | null;\n};\n\ntype StreamingSSRResult = {\n\tstream: ReadableStream<Uint8Array>;\n\tstatus: number;\n};\n\n/**\n * Render a React component to a streaming HTML response.\n * Uses React 19's streaming with progressive Suspense resolution.\n */\nasync function renderSSRDocumentStream(\n\toptions: StreamingSSROptions,\n): Promise<StreamingSSRResult> {\n\tconst debug = options.debug ?? false;\n\tconst t0 = debug ? performance.now() : 0;\n\tconst {\n\t\tpathname,\n\t\trootComponent,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tbundleUrl,\n\t\thead = '',\n\t\tlang = 'en',\n\t\tappId = 'root',\n\t\tmaxAge = 0,\n\t\tsearchParams,\n\t\togConfig,\n\t} = options;\n\n\tif (debug) console.log(`[renderStream] ${pathname} - start: 0ms`);\n\n\t// Perform shared SSR setup\n\tconst setup = await performSSRSetup(\n\t\t{\n\t\t\tpathname,\n\t\t\tclientDir,\n\t\t\tcwd,\n\t\t\tisWatchMode,\n\t\t\tparentSpan: options.parentSpan,\n\t\t\tbundleUrl,\n\t\t\tmaxAge,\n\t\t\tsearchParams,\n\t\t\togConfig,\n\t\t\tcachedCollections: options.cachedCollections,\n\t\t\tcachedTailwindCSS: options.cachedTailwindCSS,\n\t\t\tdebug,\n\t\t},\n\t\ttrue, // streaming mode\n\t);\n\tif (debug)\n\t\tconsole.log(\n\t\t\t`[renderStream] ${pathname} - performSSRSetup: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t);\n\n\t// Determine status\n\tlet statusOverride = setup.preloadStatusOverride;\n\tif (setup.statusContainer.value) {\n\t\tstatusOverride = setup.statusContainer.value;\n\t}\n\tif (setup.metadataResult.statusOverride) {\n\t\tstatusOverride = setup.metadataResult.statusOverride;\n\t}\n\n\t// Set up streaming\n\tconst encoder = new TextEncoder();\n\tconst { readable, writable } = new TransformStream<Uint8Array>();\n\tconst writer = writable.getWriter();\n\n\t// Load and split template (use cached if available)\n\tconst usingCache = !!options.cachedIndexHtml;\n\tconst { htmlHead, rootStart, rootEnd, htmlTail } = await withSpan(\n\t\t'ssr.load.template',\n\t\tasync (span) => {\n\t\t\tconst template = options.cachedIndexHtml\n\t\t\t\t? options.cachedIndexHtml\n\t\t\t\t: await loadIndexHtml(clientDir);\n\n\t\t\tspan.setAttribute('reroute.cached', usingCache);\n\t\t\tspan.setAttribute('reroute.template.size', template.length);\n\n\t\t\tif (debug)\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[renderStream] ${pathname} - loadIndexHtml (cached: ${usingCache}): ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t\t);\n\n\t\t\tconst parts = splitTemplate(template, appId);\n\n\t\t\tif (debug)\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[renderStream] ${pathname} - splitTemplate: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t\t);\n\n\t\t\treturn {\n\t\t\t\t...parts,\n\t\t\t};\n\t\t},\n\t);\n\n\t// Build head with lang attribute\n\tconst pageLang = setup.metadataResult.pageLang || lang;\n\tlet headWithLang = htmlHead.replace(\n\t\t/<html([^>]*)>/i,\n\t\t`<html$1 lang=\"${pageLang}\">`,\n\t);\n\n\t// Build extra head content\n\tconst extraHead =\n\t\tsetup.bundlePreload +\n\t\tsetup.preloadExtraHead +\n\t\tsetup.metadataResult.perPageHead;\n\n\t// Remove default title/description from template if we have page-specific ones\n\tif (/<title[\\s\\S]*?<\\/title>/i.test(extraHead)) {\n\t\theadWithLang = headWithLang.replace(/<title[\\s\\S]*?<\\/title>/i, '');\n\t}\n\tif (/<meta\\s+name\\s*=\\s*['\"]description['\"][^>]*>/i.test(extraHead)) {\n\t\theadWithLang = headWithLang.replace(\n\t\t\t/<meta\\s+name\\s*=\\s*['\"]description['\"][^>]*>/i,\n\t\t\t'',\n\t\t);\n\t}\n\n\t// Load config to get browser telemetry settings\n\tconst config = await loadConfig(cwd);\n\tconst browserTelemetryConfigRaw = config.telemetry?.browser as\n\t\t| Record<string, unknown>\n\t\t| undefined;\n\n\t// Serialize browser telemetry config (convert functions to strings for JSON)\n\tconst { serializeBrowserTelemetryConfig } = await import('./lib/serialize');\n\tconst browserTelemetryConfig = serializeBrowserTelemetryConfig(\n\t\tbrowserTelemetryConfigRaw,\n\t);\n\n\t// Extract trace context from parent span for distributed tracing\n\tconst traceContext = getTraceContextForInjection(options.parentSpan);\n\n\t// Start streaming in background\n\tstreamSSRContent(writer, encoder, {\n\t\trootComponent,\n\t\tpathname,\n\t\tsearchParams,\n\t\theadWithLang,\n\t\thead,\n\t\textraHead,\n\t\tinlineStyleTag: setup.inlineStyleTag,\n\t\tpageLang,\n\t\trootStart,\n\t\trootEnd,\n\t\thtmlTail,\n\t\tbundleUrl,\n\t\tisWatchMode,\n\t\tdebug,\n\t\tssrData: setup.ssrData,\n\t\tssrError: setup.ssrError,\n\t\tbyCollectionForSSR: setup.byCollectionForSSR,\n\t\tpreloadHydrationScript: setup.preloadHydrationScript,\n\t\tbrowserTelemetryConfig,\n\t\ttraceContext,\n\t\tparentSpan: options.parentSpan,\n\t});\n\n\tif (debug)\n\t\tconsole.log(\n\t\t\t`[renderStream] ${pathname} - returning stream: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t);\n\treturn { stream: readable, status: statusOverride || 200 };\n}\n\ntype StreamContext = {\n\trootComponent: ReactElement;\n\tpathname: string;\n\tsearchParams?: URLSearchParams;\n\theadWithLang: string;\n\thead: string;\n\textraHead: string;\n\tinlineStyleTag: string;\n\tpageLang: string;\n\trootStart: string;\n\trootEnd: string;\n\thtmlTail: string;\n\tbundleUrl: string;\n\tisWatchMode: boolean;\n\tdebug: boolean;\n\tssrData: Record<string, unknown>;\n\tssrError?: string;\n\tbyCollectionForSSR: Record<string, unknown[]>;\n\tpreloadHydrationScript: string;\n\tbrowserTelemetryConfig?: Record<string, unknown>;\n\ttraceContext?: { traceparent?: string; tracestate?: string };\n\tparentSpan?: Span | null;\n};\n\n/**\n * Stream SSR content progressively\n * NOTE: This runs during the HTTP request lifecycle - Elysia waits for the stream\n * to complete before calling onAfterResponse\n */\nasync function streamSSRContent(\n\twriter: WritableStreamDefaultWriter<Uint8Array>,\n\tencoder: TextEncoder,\n\tctx: StreamContext,\n): Promise<void> {\n\t// Execute within parent span context to properly nest spans\n\treturn withParentSpan(ctx.parentSpan, async () => {\n\t\tconst t0 = ctx.debug ? performance.now() : 0;\n\t\t// Set a maximum streaming timeout to prevent server hangs\n\t\t// This ensures the stream always completes even if React is waiting for promises\n\t\tconst STREAM_TIMEOUT_MS = 60000; // 60 seconds max for entire streaming\n\t\tlet streamTimedOut = false;\n\t\tlet timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n\t\tconst cleanup = () => {\n\t\t\tif (timeoutId) {\n\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\ttimeoutId = null;\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\t// 1. Send HTML head immediately (shell)\n\t\t\tconst combinedHead = deduplicateMetaTags(\n\t\t\t\t[ctx.inlineStyleTag, ctx.head, ctx.extraHead]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join('\\n'),\n\t\t\t);\n\t\t\t// Inject combined head BEFORE </head> (not after)\n\t\t\tconst headWithLangAndContent = ctx.headWithLang\n\t\t\t\t.replace(/<html([^>]*)>/i, `<html$1 lang=\"${ctx.pageLang}\">`)\n\t\t\t\t.replace(\n\t\t\t\t\t/<\\/head>/i,\n\t\t\t\t\t`${combinedHead ? `${combinedHead}\\n` : ''}</head>`,\n\t\t\t\t);\n\t\t\tconst headContent = `${headWithLangAndContent}<body>`;\n\t\t\tawait writer.write(encoder.encode(headContent));\n\t\t\tif (ctx.debug)\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[Stream] ${ctx.pathname} - first byte written: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t\t);\n\n\t\t\t// 2. Send root div start\n\t\t\tawait writer.write(encoder.encode(ctx.rootStart));\n\n\t\t\t// 3. Stream React content (both create and pipe)\n\t\t\t// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Stream creation and piping requires timeout handling\n\t\t\tawait withSpan('ssr.document.stream', async (span) => {\n\t\t\t\tconst componentWithPathname = cloneElement(ctx.rootComponent, {\n\t\t\t\t\tpathname: ctx.pathname,\n\t\t\t\t\tsearchParams: ctx.searchParams,\n\t\t\t\t} as Doc);\n\n\t\t\t\tspan.setAttribute('reroute.pathname', ctx.pathname);\n\n\t\t\t\tlet streamError: Error | null = null;\n\t\t\t\tconst streamPromise = renderToReadableStream(componentWithPathname, {\n\t\t\t\t\tonError(error) {\n\t\t\t\t\t\tconsole.error('[reroute] SSR stream error:', error);\n\t\t\t\t\t\tstreamError =\n\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error));\n\t\t\t\t\t},\n\t\t\t\t}).catch((err) => {\n\t\t\t\t\tstreamError = err;\n\t\t\t\t\tthrow err;\n\t\t\t\t});\n\n\t\t\t\tconst reactStream = await streamPromise;\n\t\t\t\tif (streamError) throw streamError;\n\n\t\t\t\t// Pipe React stream to writer\n\t\t\t\t// Set up streaming timeout - if React takes too long, force close\n\t\t\t\tconst streamTimeoutPromise = new Promise<{\n\t\t\t\t\tdone: true;\n\t\t\t\t\tvalue: undefined;\n\t\t\t\t}>((resolve) => {\n\t\t\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`[reroute] Stream timeout after ${STREAM_TIMEOUT_MS}ms for ${ctx.pathname}, forcing close`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstreamTimedOut = true;\n\t\t\t\t\t\tresolve({ done: true, value: undefined });\n\t\t\t\t\t}, STREAM_TIMEOUT_MS);\n\t\t\t\t});\n\n\t\t\t\tconst reader = reactStream.getReader();\n\t\t\t\tlet chunkCount = 0;\n\t\t\t\twhile (true) {\n\t\t\t\t\t// Race between getting next chunk and timeout\n\t\t\t\t\tconst result = await Promise.race([\n\t\t\t\t\t\treader.read(),\n\t\t\t\t\t\tstreamTimeoutPromise,\n\t\t\t\t\t]);\n\n\t\t\t\t\tif (result.done || streamTimedOut) {\n\t\t\t\t\t\t// Release the reader lock before breaking\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treader.releaseLock();\n\t\t\t\t\t\t} catch {}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (result.value) {\n\t\t\t\t\t\tawait writer.write(result.value);\n\t\t\t\t\t\tchunkCount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcleanup();\n\n\t\t\t\tspan.setAttributes({\n\t\t\t\t\t'reroute.stream.chunks': chunkCount,\n\t\t\t\t\t'reroute.stream.timedOut': streamTimedOut,\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t// 4. Close root div\n\t\t\tawait writer.write(encoder.encode(ctx.rootEnd));\n\n\t\t\t// 5. Generate scripts\n\t\t\tconst allScripts = await withSpan(\n\t\t\t\t'ssr.generate.scripts',\n\t\t\t\tasync (span) => {\n\t\t\t\t\tconst scripts = buildStreamingScripts(ctx);\n\t\t\t\t\tspan.setAttribute('reroute.script_size', scripts.length);\n\t\t\t\t\treturn scripts;\n\t\t\t\t},\n\t\t\t);\n\t\t\tawait writer.write(encoder.encode(allScripts + ctx.htmlTail));\n\t\t\tawait writer.close();\n\t\t} catch (error) {\n\t\t\tcleanup();\n\t\t\tconsole.error('[reroute] Stream error:', error);\n\t\t\ttry {\n\t\t\t\tawait writer.abort(error);\n\t\t\t} catch {\n\t\t\t\t// Writer might already be closed\n\t\t\t}\n\t\t}\n\t});\n}\n\n/**\n * Build all scripts for streaming SSR\n */\nfunction buildStreamingScripts(ctx: StreamContext): string {\n\t// Generate collection scripts\n\tconst collectionScripts = generateCollectionScripts(ctx.byCollectionForSSR);\n\n\t// Create snapshot of resolved SSR data\n\tconst ssrDataSnapshot: Record<string, unknown> = {};\n\tfor (const key of Object.keys(ctx.ssrData)) {\n\t\tconst value = ctx.ssrData[key];\n\t\tif (!isThenable(value)) {\n\t\t\tssrDataSnapshot[key] = value;\n\t\t}\n\t}\n\n\t// Build scripts\n\tconst dataScript = createDataScript(\n\t\tssrDataSnapshot,\n\t\tctx.isWatchMode ? ctx.ssrError : undefined,\n\t\tctx.pathname,\n\t\tctx.browserTelemetryConfig,\n\t\tctx.traceContext,\n\t);\n\tconst feedsScript = createFeedsScript();\n\tconst llmsScript = createLlmsScript();\n\n\tlet allScripts =\n\t\tdataScript +\n\t\tfeedsScript +\n\t\tllmsScript +\n\t\tcollectionScripts +\n\t\tctx.preloadHydrationScript;\n\n\t// Add bundle script\n\tallScripts += `<script type=\"module\" src=\"${ctx.bundleUrl}\"></script>`;\n\n\t// Add dev watcher\n\tif (ctx.isWatchMode) {\n\t\tallScripts += `<script type=\"module\" src=\"/__reroute_watch.js\"></script>`;\n\t}\n\n\treturn allScripts;\n}\n\nexport { renderSSRDocumentStream };\nexport type { StreamingSSROptions, StreamingSSRResult };\n",
34
+ "import type { Span } from '@opentelemetry/api';\nimport { cloneElement, type ReactElement } from 'react';\nimport { renderToReadableStream } from 'react-dom/server';\nimport {\n\tgetTraceContextForInjection,\n\twithParentSpan,\n\twithSpan,\n} from 'reroute-js/telemetry/server';\nimport { loadConfig, type OGImageOptions } from '../config';\nimport {\n\tcreateDataScript,\n\tcreateFeedsScript,\n\tcreateLlmsScript,\n\ttype Doc,\n\tgenerateCollectionScripts,\n\tperformSSRSetup,\n} from './lib';\nimport { deduplicateMetaTags, loadIndexHtml } from './lib/html';\nimport { isThenable } from './lib/imports';\nimport { splitTemplate } from './lib/template';\n\ntype StreamingSSROptions = {\n\tpathname: string;\n\trootComponent: ReactElement;\n\tclientDir: string;\n\tcwd: string;\n\tisWatchMode: boolean;\n\tbundleUrl: string;\n\tcachedCollections?: Record<string, unknown[]>;\n\tcachedTailwindCSS?: string;\n\tcachedIndexHtml?: string;\n\tdebug?: boolean;\n\thead?: string;\n\tlang?: string;\n\tappId?: string;\n\tmaxAge?: number;\n\tsearchParams?: URLSearchParams;\n\togConfig?: OGImageOptions;\n\tbaseUrl?: string;\n\tautoCanonical?: boolean;\n\tparentSpan?: Span | null;\n};\n\ntype StreamingSSRResult = {\n\tstream: ReadableStream<Uint8Array>;\n\tstatus: number;\n};\n\n/**\n * Render a React component to a streaming HTML response.\n * Uses React 19's streaming with progressive Suspense resolution.\n */\nasync function renderSSRDocumentStream(\n\toptions: StreamingSSROptions,\n): Promise<StreamingSSRResult> {\n\tconst debug = options.debug ?? false;\n\tconst t0 = debug ? performance.now() : 0;\n\tconst {\n\t\tpathname,\n\t\trootComponent,\n\t\tclientDir,\n\t\tcwd,\n\t\tisWatchMode,\n\t\tbundleUrl,\n\t\thead = '',\n\t\tlang = 'en',\n\t\tappId = 'root',\n\t\tmaxAge = 0,\n\t\tsearchParams,\n\t\togConfig,\n\t} = options;\n\n\tif (debug) console.log(`[renderStream] ${pathname} - start: 0ms`);\n\n\t// Perform shared SSR setup\n\tconst setup = await performSSRSetup(\n\t\t{\n\t\t\tpathname,\n\t\t\tclientDir,\n\t\t\tcwd,\n\t\t\tisWatchMode,\n\t\t\tparentSpan: options.parentSpan,\n\t\t\tbundleUrl,\n\t\t\tmaxAge,\n\t\t\tsearchParams,\n\t\t\togConfig,\n\t\t\tbaseUrl: options.baseUrl,\n\t\t\tautoCanonical: options.autoCanonical,\n\t\t\tcachedCollections: options.cachedCollections,\n\t\t\tcachedTailwindCSS: options.cachedTailwindCSS,\n\t\t\tdebug,\n\t\t},\n\t\ttrue, // streaming mode\n\t);\n\tif (debug)\n\t\tconsole.log(\n\t\t\t`[renderStream] ${pathname} - performSSRSetup: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t);\n\n\t// Determine status\n\tlet statusOverride = setup.preloadStatusOverride;\n\tif (setup.statusContainer.value) {\n\t\tstatusOverride = setup.statusContainer.value;\n\t}\n\tif (setup.metadataResult.statusOverride) {\n\t\tstatusOverride = setup.metadataResult.statusOverride;\n\t}\n\n\t// Set up streaming\n\tconst encoder = new TextEncoder();\n\tconst { readable, writable } = new TransformStream<Uint8Array>();\n\tconst writer = writable.getWriter();\n\n\t// Load and split template (use cached if available)\n\tconst usingCache = !!options.cachedIndexHtml;\n\tconst { htmlHead, rootStart, rootEnd, htmlTail } = await withSpan(\n\t\t'ssr.load.template',\n\t\tasync (span) => {\n\t\t\tconst template = options.cachedIndexHtml\n\t\t\t\t? options.cachedIndexHtml\n\t\t\t\t: await loadIndexHtml(clientDir);\n\n\t\t\tspan.setAttribute('reroute.cached', usingCache);\n\t\t\tspan.setAttribute('reroute.template.size', template.length);\n\n\t\t\tif (debug)\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[renderStream] ${pathname} - loadIndexHtml (cached: ${usingCache}): ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t\t);\n\n\t\t\tconst parts = splitTemplate(template, appId);\n\n\t\t\tif (debug)\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[renderStream] ${pathname} - splitTemplate: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t\t);\n\n\t\t\treturn {\n\t\t\t\t...parts,\n\t\t\t};\n\t\t},\n\t);\n\n\t// Build head with lang attribute\n\tconst pageLang = setup.metadataResult.pageLang || lang;\n\tlet headWithLang = htmlHead.replace(\n\t\t/<html([^>]*)>/i,\n\t\t`<html$1 lang=\"${pageLang}\">`,\n\t);\n\n\t// Build extra head content\n\tconst extraHead =\n\t\tsetup.bundlePreload +\n\t\tsetup.preloadExtraHead +\n\t\tsetup.metadataResult.perPageHead;\n\n\t// Remove default title/description from template if we have page-specific ones\n\tif (/<title[\\s\\S]*?<\\/title>/i.test(extraHead)) {\n\t\theadWithLang = headWithLang.replace(/<title[\\s\\S]*?<\\/title>/i, '');\n\t}\n\tif (/<meta\\s+name\\s*=\\s*['\"]description['\"][^>]*>/i.test(extraHead)) {\n\t\theadWithLang = headWithLang.replace(\n\t\t\t/<meta\\s+name\\s*=\\s*['\"]description['\"][^>]*>/i,\n\t\t\t'',\n\t\t);\n\t}\n\n\t// Load config to get browser telemetry settings\n\tconst config = await loadConfig(cwd);\n\tconst browserTelemetryConfigRaw = config.telemetry?.browser as\n\t\t| Record<string, unknown>\n\t\t| undefined;\n\n\t// Serialize browser telemetry config (convert functions to strings for JSON)\n\tconst { serializeBrowserTelemetryConfig } = await import('./lib/serialize');\n\tconst browserTelemetryConfig = serializeBrowserTelemetryConfig(\n\t\tbrowserTelemetryConfigRaw,\n\t);\n\n\t// Extract trace context from parent span for distributed tracing\n\tconst traceContext = getTraceContextForInjection(options.parentSpan);\n\n\t// Start streaming in background\n\tstreamSSRContent(writer, encoder, {\n\t\trootComponent,\n\t\tpathname,\n\t\tsearchParams,\n\t\theadWithLang,\n\t\thead,\n\t\textraHead,\n\t\tinlineStyleTag: setup.inlineStyleTag,\n\t\tpageLang,\n\t\trootStart,\n\t\trootEnd,\n\t\thtmlTail,\n\t\tbundleUrl,\n\t\tisWatchMode,\n\t\tdebug,\n\t\tssrData: setup.ssrData,\n\t\tssrError: setup.ssrError,\n\t\tbyCollectionForSSR: setup.byCollectionForSSR,\n\t\tpreloadHydrationScript: setup.preloadHydrationScript,\n\t\tbrowserTelemetryConfig,\n\t\ttraceContext,\n\t\tparentSpan: options.parentSpan,\n\t});\n\n\tif (debug)\n\t\tconsole.log(\n\t\t\t`[renderStream] ${pathname} - returning stream: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t);\n\treturn { stream: readable, status: statusOverride || 200 };\n}\n\ntype StreamContext = {\n\trootComponent: ReactElement;\n\tpathname: string;\n\tsearchParams?: URLSearchParams;\n\theadWithLang: string;\n\thead: string;\n\textraHead: string;\n\tinlineStyleTag: string;\n\tpageLang: string;\n\trootStart: string;\n\trootEnd: string;\n\thtmlTail: string;\n\tbundleUrl: string;\n\tisWatchMode: boolean;\n\tdebug: boolean;\n\tssrData: Record<string, unknown>;\n\tssrError?: string;\n\tbyCollectionForSSR: Record<string, unknown[]>;\n\tpreloadHydrationScript: string;\n\tbrowserTelemetryConfig?: Record<string, unknown>;\n\ttraceContext?: { traceparent?: string; tracestate?: string };\n\tparentSpan?: Span | null;\n};\n\n/**\n * Stream SSR content progressively\n * NOTE: This runs during the HTTP request lifecycle - Elysia waits for the stream\n * to complete before calling onAfterResponse\n */\nasync function streamSSRContent(\n\twriter: WritableStreamDefaultWriter<Uint8Array>,\n\tencoder: TextEncoder,\n\tctx: StreamContext,\n): Promise<void> {\n\t// Execute within parent span context to properly nest spans\n\treturn withParentSpan(ctx.parentSpan, async () => {\n\t\tconst t0 = ctx.debug ? performance.now() : 0;\n\t\t// Set a maximum streaming timeout to prevent server hangs\n\t\t// This ensures the stream always completes even if React is waiting for promises\n\t\tconst STREAM_TIMEOUT_MS = 60000; // 60 seconds max for entire streaming\n\t\tlet streamTimedOut = false;\n\t\tlet timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n\t\tconst cleanup = () => {\n\t\t\tif (timeoutId) {\n\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\ttimeoutId = null;\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\t// 1. Send HTML head immediately (shell)\n\t\t\tconst combinedHead = deduplicateMetaTags(\n\t\t\t\t[ctx.inlineStyleTag, ctx.head, ctx.extraHead]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join('\\n'),\n\t\t\t);\n\t\t\t// Inject combined head BEFORE </head> (not after)\n\t\t\tconst headWithLangAndContent = ctx.headWithLang\n\t\t\t\t.replace(/<html([^>]*)>/i, `<html$1 lang=\"${ctx.pageLang}\">`)\n\t\t\t\t.replace(\n\t\t\t\t\t/<\\/head>/i,\n\t\t\t\t\t`${combinedHead ? `${combinedHead}\\n` : ''}</head>`,\n\t\t\t\t);\n\t\t\tconst headContent = `${headWithLangAndContent}<body>`;\n\t\t\tawait writer.write(encoder.encode(headContent));\n\t\t\tif (ctx.debug)\n\t\t\t\tconsole.log(\n\t\t\t\t\t`[Stream] ${ctx.pathname} - first byte written: ${(performance.now() - t0).toFixed(2)}ms`,\n\t\t\t\t);\n\n\t\t\t// 2. Send root div start\n\t\t\tawait writer.write(encoder.encode(ctx.rootStart));\n\n\t\t\t// 3. Stream React content (both create and pipe)\n\t\t\t// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Stream creation and piping requires timeout handling\n\t\t\tawait withSpan('ssr.document.stream', async (span) => {\n\t\t\t\tconst componentWithPathname = cloneElement(ctx.rootComponent, {\n\t\t\t\t\tpathname: ctx.pathname,\n\t\t\t\t\tsearchParams: ctx.searchParams,\n\t\t\t\t} as Doc);\n\n\t\t\t\tspan.setAttribute('reroute.pathname', ctx.pathname);\n\n\t\t\t\tlet streamError: Error | null = null;\n\t\t\t\tconst streamPromise = renderToReadableStream(componentWithPathname, {\n\t\t\t\t\tonError(error) {\n\t\t\t\t\t\tconsole.error('[reroute] SSR stream error:', error);\n\t\t\t\t\t\tstreamError =\n\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error));\n\t\t\t\t\t},\n\t\t\t\t}).catch((err) => {\n\t\t\t\t\tstreamError = err;\n\t\t\t\t\tthrow err;\n\t\t\t\t});\n\n\t\t\t\tconst reactStream = await streamPromise;\n\t\t\t\tif (streamError) throw streamError;\n\n\t\t\t\t// Pipe React stream to writer\n\t\t\t\t// Set up streaming timeout - if React takes too long, force close\n\t\t\t\tconst streamTimeoutPromise = new Promise<{\n\t\t\t\t\tdone: true;\n\t\t\t\t\tvalue: undefined;\n\t\t\t\t}>((resolve) => {\n\t\t\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`[reroute] Stream timeout after ${STREAM_TIMEOUT_MS}ms for ${ctx.pathname}, forcing close`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstreamTimedOut = true;\n\t\t\t\t\t\tresolve({ done: true, value: undefined });\n\t\t\t\t\t}, STREAM_TIMEOUT_MS);\n\t\t\t\t});\n\n\t\t\t\tconst reader = reactStream.getReader();\n\t\t\t\tlet chunkCount = 0;\n\t\t\t\twhile (true) {\n\t\t\t\t\t// Race between getting next chunk and timeout\n\t\t\t\t\tconst result = await Promise.race([\n\t\t\t\t\t\treader.read(),\n\t\t\t\t\t\tstreamTimeoutPromise,\n\t\t\t\t\t]);\n\n\t\t\t\t\tif (result.done || streamTimedOut) {\n\t\t\t\t\t\t// Release the reader lock before breaking\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treader.releaseLock();\n\t\t\t\t\t\t} catch {}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (result.value) {\n\t\t\t\t\t\tawait writer.write(result.value);\n\t\t\t\t\t\tchunkCount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcleanup();\n\n\t\t\t\tspan.setAttributes({\n\t\t\t\t\t'reroute.stream.chunks': chunkCount,\n\t\t\t\t\t'reroute.stream.timedOut': streamTimedOut,\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t// 4. Close root div\n\t\t\tawait writer.write(encoder.encode(ctx.rootEnd));\n\n\t\t\t// 5. Generate scripts\n\t\t\tconst allScripts = await withSpan(\n\t\t\t\t'ssr.generate.scripts',\n\t\t\t\tasync (span) => {\n\t\t\t\t\tconst scripts = buildStreamingScripts(ctx);\n\t\t\t\t\tspan.setAttribute('reroute.script_size', scripts.length);\n\t\t\t\t\treturn scripts;\n\t\t\t\t},\n\t\t\t);\n\t\t\tawait writer.write(encoder.encode(allScripts + ctx.htmlTail));\n\t\t\tawait writer.close();\n\t\t} catch (error) {\n\t\t\tcleanup();\n\t\t\tconsole.error('[reroute] Stream error:', error);\n\t\t\ttry {\n\t\t\t\tawait writer.abort(error);\n\t\t\t} catch {\n\t\t\t\t// Writer might already be closed\n\t\t\t}\n\t\t}\n\t});\n}\n\n/**\n * Build all scripts for streaming SSR\n */\nfunction buildStreamingScripts(ctx: StreamContext): string {\n\t// Generate collection scripts\n\tconst collectionScripts = generateCollectionScripts(ctx.byCollectionForSSR);\n\n\t// Create snapshot of resolved SSR data\n\tconst ssrDataSnapshot: Record<string, unknown> = {};\n\tfor (const key of Object.keys(ctx.ssrData)) {\n\t\tconst value = ctx.ssrData[key];\n\t\tif (!isThenable(value)) {\n\t\t\tssrDataSnapshot[key] = value;\n\t\t}\n\t}\n\n\t// Build scripts\n\tconst dataScript = createDataScript(\n\t\tssrDataSnapshot,\n\t\tctx.isWatchMode ? ctx.ssrError : undefined,\n\t\tctx.pathname,\n\t\tctx.browserTelemetryConfig,\n\t\tctx.traceContext,\n\t);\n\tconst feedsScript = createFeedsScript();\n\tconst llmsScript = createLlmsScript();\n\n\tlet allScripts =\n\t\tdataScript +\n\t\tfeedsScript +\n\t\tllmsScript +\n\t\tcollectionScripts +\n\t\tctx.preloadHydrationScript;\n\n\t// Add bundle script\n\tallScripts += `<script type=\"module\" src=\"${ctx.bundleUrl}\"></script>`;\n\n\t// Add dev watcher\n\tif (ctx.isWatchMode) {\n\t\tallScripts += `<script type=\"module\" src=\"/__reroute_watch.js\"></script>`;\n\t}\n\n\treturn allScripts;\n}\n\nexport { renderSSRDocumentStream };\nexport type { StreamingSSROptions, StreamingSSRResult };\n",
35
35
  "export * from './lib';\nexport * from './render';\nexport * from './stream';\n",
36
36
  "export * from './bundler';\nexport * from './config';\nexport * from './content';\nexport * from './llms';\nexport * from './og';\nexport * from './robots';\nexport * from './rss';\nexport * from './sitemap';\nexport * from './ssr';\n",
37
37
  "export * from './src';\n",
@@ -40,7 +40,7 @@
40
40
  "export * from './context';\nexport * from './instrumentation';\nexport * from './plugin';\nexport * from './sourcemap';\n",
41
41
  "export * from './src/server';\n"
42
42
  ],
43
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AA8BO,SAAS,UAAU,CAAC,YAA0C;AAAA,EACpE,MAAM,UAAU,eAAe,SAAS,KAAK,CAAC;AAAA,EAC9C,MAAM,U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