reroute-js 1.0.0-alpha.4 → 1.0.0-alpha.40

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 (307) hide show
  1. package/README.md +45 -3
  2. package/cli/bin.d.ts +1 -1
  3. package/cli/bin.js +3229 -1217
  4. package/cli/bin.js.map +66 -53
  5. package/cli/index.d.ts +1 -1
  6. package/cli/index.js +672 -45
  7. package/cli/index.js.map +57 -7
  8. package/cli/src/cli.d.ts +1 -1
  9. package/cli/src/commands/analyze.d.ts +1 -1
  10. package/cli/src/commands/analyze.d.ts.map +1 -1
  11. package/cli/src/commands/build.d.ts +6 -3
  12. package/cli/src/commands/build.d.ts.map +1 -1
  13. package/cli/src/commands/dev.d.ts +6 -6
  14. package/cli/src/commands/dev.d.ts.map +1 -1
  15. package/cli/src/commands/gen.d.ts +4 -1
  16. package/cli/src/commands/gen.d.ts.map +1 -1
  17. package/cli/src/commands/index.d.ts +1 -1
  18. package/cli/src/commands/init.d.ts +1 -1
  19. package/cli/src/commands/lib/assets.d.ts +1 -1
  20. package/cli/src/commands/lib/bundler.d.ts +8 -1
  21. package/cli/src/commands/lib/bundler.d.ts.map +1 -1
  22. package/cli/src/commands/lib/command.d.ts +1 -1
  23. package/cli/src/commands/lib/env.d.ts +4 -3
  24. package/cli/src/commands/lib/env.d.ts.map +1 -1
  25. package/cli/src/commands/lib/images.d.ts +12 -0
  26. package/cli/src/commands/lib/images.d.ts.map +1 -0
  27. package/cli/src/commands/lib/index.d.ts +1 -1
  28. package/cli/src/commands/lib/log.d.ts +1 -1
  29. package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
  30. package/cli/src/commands/lib/markdown/index.d.ts +1 -1
  31. package/cli/src/commands/lib/markdown/processor.d.ts +11 -1
  32. package/cli/src/commands/lib/markdown/processor.d.ts.map +1 -1
  33. package/cli/src/commands/lib/prerender.d.ts +40 -0
  34. package/cli/src/commands/lib/prerender.d.ts.map +1 -0
  35. package/cli/src/commands/lib/production.d.ts +3 -3
  36. package/cli/src/commands/lib/production.d.ts.map +1 -1
  37. package/cli/src/commands/lib/routes.d.ts +40 -0
  38. package/cli/src/commands/lib/routes.d.ts.map +1 -0
  39. package/cli/src/commands/lib/server.d.ts +2 -1
  40. package/cli/src/commands/lib/server.d.ts.map +1 -1
  41. package/cli/src/commands/lib/ssr-strip.d.ts +33 -0
  42. package/cli/src/commands/lib/ssr-strip.d.ts.map +1 -0
  43. package/cli/src/commands/lib/static.d.ts +86 -0
  44. package/cli/src/commands/lib/static.d.ts.map +1 -0
  45. package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
  46. package/cli/src/commands/lib/streaming/suspense.d.ts +2 -2
  47. package/cli/src/commands/lib/streaming/suspense.d.ts.map +1 -1
  48. package/cli/src/commands/lib/supervise.d.ts +23 -0
  49. package/cli/src/commands/lib/supervise.d.ts.map +1 -0
  50. package/cli/src/commands/lib/terminal-ui.d.ts +2 -2
  51. package/cli/src/commands/lib/terminal-ui.d.ts.map +1 -1
  52. package/cli/src/commands/lib/theme.d.ts +9 -4
  53. package/cli/src/commands/lib/theme.d.ts.map +1 -1
  54. package/cli/src/commands/lib/version.d.ts +1 -1
  55. package/cli/src/commands/lib/watch.d.ts +37 -0
  56. package/cli/src/commands/lib/watch.d.ts.map +1 -0
  57. package/cli/src/commands/og.d.ts +1 -1
  58. package/cli/src/commands/og.d.ts.map +1 -1
  59. package/cli/src/commands/start.d.ts +2 -2
  60. package/cli/src/commands/start.d.ts.map +1 -1
  61. package/cli/src/commands/static-render.d.ts +18 -0
  62. package/cli/src/commands/static-render.d.ts.map +1 -0
  63. package/cli/src/index.d.ts +1 -1
  64. package/core/index.d.ts +1 -1
  65. package/core/index.js +1102 -369
  66. package/core/index.js.map +40 -37
  67. package/core/src/app-paths.d.ts +32 -0
  68. package/core/src/app-paths.d.ts.map +1 -0
  69. package/core/src/bundler/hash.d.ts +1 -1
  70. package/core/src/bundler/index.d.ts +1 -1
  71. package/core/src/config.d.ts +98 -7
  72. package/core/src/config.d.ts.map +1 -1
  73. package/core/src/content/discovery.d.ts +1 -1
  74. package/core/src/content/index.d.ts +1 -1
  75. package/core/src/content/metadata.d.ts +1 -1
  76. package/core/src/i18n/catalog.d.ts +1 -1
  77. package/core/src/i18n/discover.d.ts +1 -1
  78. package/core/src/i18n/discover.d.ts.map +1 -1
  79. package/core/src/i18n/index.d.ts +2 -2
  80. package/core/src/i18n/index.d.ts.map +1 -1
  81. package/core/src/i18n/messages.d.ts +1 -1
  82. package/core/src/i18n/negotiate.d.ts +1 -1
  83. package/core/src/i18n/pathname.d.ts +32 -4
  84. package/core/src/i18n/pathname.d.ts.map +1 -1
  85. package/core/src/i18n/resolve.d.ts +5 -3
  86. package/core/src/i18n/resolve.d.ts.map +1 -1
  87. package/core/src/i18n/types.d.ts +48 -1
  88. package/core/src/i18n/types.d.ts.map +1 -1
  89. package/core/src/image.d.ts +29 -0
  90. package/core/src/image.d.ts.map +1 -0
  91. package/core/src/index.d.ts +3 -1
  92. package/core/src/index.d.ts.map +1 -1
  93. package/core/src/llms/discovery.d.ts +35 -0
  94. package/core/src/llms/discovery.d.ts.map +1 -0
  95. package/core/src/llms/extractor.d.ts +6 -1
  96. package/core/src/llms/extractor.d.ts.map +1 -1
  97. package/core/src/llms/formatter.d.ts +1 -1
  98. package/core/src/llms/formatter.d.ts.map +1 -1
  99. package/core/src/llms/full-generator.d.ts +3 -1
  100. package/core/src/llms/full-generator.d.ts.map +1 -1
  101. package/core/src/llms/index-generator.d.ts +6 -3
  102. package/core/src/llms/index-generator.d.ts.map +1 -1
  103. package/core/src/llms/index.d.ts +5 -2
  104. package/core/src/llms/index.d.ts.map +1 -1
  105. package/core/src/og/discovery.d.ts +8 -1
  106. package/core/src/og/discovery.d.ts.map +1 -1
  107. package/core/src/og/index.d.ts +1 -1
  108. package/core/src/og/meta.d.ts +1 -1
  109. package/core/src/og/render.d.ts +1 -1
  110. package/core/src/og/types.d.ts +1 -1
  111. package/core/src/robots/discovery.d.ts +1 -1
  112. package/core/src/robots/generator.d.ts +1 -1
  113. package/core/src/robots/generator.d.ts.map +1 -1
  114. package/core/src/robots/index.d.ts +1 -1
  115. package/core/src/robots/policies.d.ts +1 -1
  116. package/core/src/rss/discovery.d.ts +2 -2
  117. package/core/src/rss/discovery.d.ts.map +1 -1
  118. package/core/src/rss/generator.d.ts +1 -1
  119. package/core/src/rss/index.d.ts +1 -1
  120. package/core/src/sitemap/discovery.d.ts +7 -2
  121. package/core/src/sitemap/discovery.d.ts.map +1 -1
  122. package/core/src/sitemap/generator.d.ts +12 -2
  123. package/core/src/sitemap/generator.d.ts.map +1 -1
  124. package/core/src/sitemap/index.d.ts +1 -1
  125. package/core/src/ssr/index.d.ts +1 -1
  126. package/core/src/ssr/lib/cache.d.ts +1 -1
  127. package/core/src/ssr/lib/cleanup.d.ts +1 -1
  128. package/core/src/ssr/lib/collections.d.ts +17 -1
  129. package/core/src/ssr/lib/collections.d.ts.map +1 -1
  130. package/core/src/ssr/lib/compression.d.ts +1 -1
  131. package/core/src/ssr/lib/compute/content.d.ts +1 -1
  132. package/core/src/ssr/lib/compute/index.d.ts +1 -1
  133. package/core/src/ssr/lib/compute/index.d.ts.map +1 -1
  134. package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
  135. package/core/src/ssr/lib/compute/layouts.d.ts.map +1 -1
  136. package/core/src/ssr/lib/compute/routes.d.ts +1 -1
  137. package/core/src/ssr/lib/compute/routes.d.ts.map +1 -1
  138. package/core/src/ssr/lib/content-path.d.ts +13 -2
  139. package/core/src/ssr/lib/content-path.d.ts.map +1 -1
  140. package/core/src/ssr/lib/data.d.ts +1 -1
  141. package/core/src/ssr/lib/html.d.ts +7 -1
  142. package/core/src/ssr/lib/html.d.ts.map +1 -1
  143. package/core/src/ssr/lib/imports.d.ts +8 -3
  144. package/core/src/ssr/lib/imports.d.ts.map +1 -1
  145. package/core/src/ssr/lib/index.d.ts +1 -1
  146. package/core/src/ssr/lib/layouts.d.ts +15 -2
  147. package/core/src/ssr/lib/layouts.d.ts.map +1 -1
  148. package/core/src/ssr/lib/metadata.d.ts +1 -1
  149. package/core/src/ssr/lib/metadata.d.ts.map +1 -1
  150. package/core/src/ssr/lib/mime.d.ts +1 -1
  151. package/core/src/ssr/lib/modules.d.ts +1 -1
  152. package/core/src/ssr/lib/path.d.ts +1 -1
  153. package/core/src/ssr/lib/preload.d.ts +16 -3
  154. package/core/src/ssr/lib/preload.d.ts.map +1 -1
  155. package/core/src/ssr/lib/route-match.d.ts +1 -1
  156. package/core/src/ssr/lib/scripts/collections.d.ts +2 -2
  157. package/core/src/ssr/lib/scripts/collections.d.ts.map +1 -1
  158. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  159. package/core/src/ssr/lib/scripts/data.d.ts.map +1 -1
  160. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  161. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  162. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  163. package/core/src/ssr/lib/seed.d.ts +6 -1
  164. package/core/src/ssr/lib/seed.d.ts.map +1 -1
  165. package/core/src/ssr/lib/serialize.d.ts +1 -1
  166. package/core/src/ssr/lib/setup.d.ts +2 -2
  167. package/core/src/ssr/lib/setup.d.ts.map +1 -1
  168. package/core/src/ssr/lib/styles.d.ts +5 -4
  169. package/core/src/ssr/lib/styles.d.ts.map +1 -1
  170. package/core/src/ssr/lib/template.d.ts +1 -1
  171. package/core/src/ssr/lib/types.d.ts +36 -2
  172. package/core/src/ssr/lib/types.d.ts.map +1 -1
  173. package/core/src/ssr/render.d.ts +1 -1
  174. package/core/src/ssr/render.d.ts.map +1 -1
  175. package/core/src/ssr/stream.d.ts +1 -1
  176. package/core/src/ssr/stream.d.ts.map +1 -1
  177. package/elysia/index.d.ts +1 -1
  178. package/elysia/index.js +1893 -719
  179. package/elysia/index.js.map +56 -48
  180. package/elysia/src/index.d.ts +2 -1
  181. package/elysia/src/index.d.ts.map +1 -1
  182. package/elysia/src/libs/assets.d.ts +1 -1
  183. package/elysia/src/libs/cache.d.ts +6 -1
  184. package/elysia/src/libs/cache.d.ts.map +1 -1
  185. package/elysia/src/libs/caching.d.ts +1 -1
  186. package/elysia/src/libs/devReload.d.ts +53 -0
  187. package/elysia/src/libs/devReload.d.ts.map +1 -0
  188. package/elysia/src/libs/http.d.ts +1 -1
  189. package/elysia/src/libs/i18n.d.ts +15 -4
  190. package/elysia/src/libs/i18n.d.ts.map +1 -1
  191. package/elysia/src/libs/image.d.ts +30 -1
  192. package/elysia/src/libs/image.d.ts.map +1 -1
  193. package/elysia/src/libs/index.d.ts +2 -2
  194. package/elysia/src/libs/index.d.ts.map +1 -1
  195. package/elysia/src/libs/lazyData.d.ts +38 -0
  196. package/elysia/src/libs/lazyData.d.ts.map +1 -0
  197. package/elysia/src/libs/llms.d.ts +1 -1
  198. package/elysia/src/libs/response.d.ts +1 -1
  199. package/elysia/src/libs/serving.d.ts +1 -1
  200. package/elysia/src/plugin.d.ts +1 -1
  201. package/elysia/src/plugin.d.ts.map +1 -1
  202. package/elysia/src/routes/artifacts.d.ts +1 -1
  203. package/elysia/src/routes/artifacts.d.ts.map +1 -1
  204. package/elysia/src/routes/content.d.ts +2 -2
  205. package/elysia/src/routes/content.d.ts.map +1 -1
  206. package/elysia/src/routes/image.d.ts +1 -1
  207. package/elysia/src/routes/index.d.ts +1 -1
  208. package/elysia/src/routes/internal.d.ts +18 -2
  209. package/elysia/src/routes/internal.d.ts.map +1 -1
  210. package/elysia/src/routes/liveReloadClient.d.ts +16 -0
  211. package/elysia/src/routes/liveReloadClient.d.ts.map +1 -0
  212. package/elysia/src/routes/llms.d.ts +1 -1
  213. package/elysia/src/routes/llms.d.ts.map +1 -1
  214. package/elysia/src/routes/og.d.ts +1 -1
  215. package/elysia/src/routes/redirects.d.ts +1 -1
  216. package/elysia/src/routes/robots.d.ts +3 -1
  217. package/elysia/src/routes/robots.d.ts.map +1 -1
  218. package/elysia/src/routes/rss.d.ts +1 -1
  219. package/elysia/src/routes/search.d.ts +1 -1
  220. package/elysia/src/routes/sitemap.d.ts +3 -1
  221. package/elysia/src/routes/sitemap.d.ts.map +1 -1
  222. package/elysia/src/routes/ssr.d.ts +4 -2
  223. package/elysia/src/routes/ssr.d.ts.map +1 -1
  224. package/elysia/src/routes/static.d.ts +1 -1
  225. package/elysia/src/routes/themeCssRefresh.d.ts +17 -0
  226. package/elysia/src/routes/themeCssRefresh.d.ts.map +1 -0
  227. package/elysia/src/types.d.ts +1 -1
  228. package/package.json +1 -1
  229. package/react/index.d.ts +1 -1
  230. package/react/index.js +718 -369
  231. package/react/index.js.map +19 -16
  232. package/react/src/components/ClientOnly.d.ts +1 -1
  233. package/react/src/components/ContentRoute.d.ts +1 -1
  234. package/react/src/components/Image.d.ts +5 -1
  235. package/react/src/components/Image.d.ts.map +1 -1
  236. package/react/src/components/LazyRoute.d.ts +1 -1
  237. package/react/src/components/Link.d.ts +18 -5
  238. package/react/src/components/Link.d.ts.map +1 -1
  239. package/react/src/components/Markdown.d.ts +1 -1
  240. package/react/src/components/Markdown.d.ts.map +1 -1
  241. package/react/src/components/Outlet.d.ts +1 -1
  242. package/react/src/components/index.d.ts +1 -1
  243. package/react/src/hooks/index.d.ts +1 -1
  244. package/react/src/hooks/useContent.d.ts +1 -1
  245. package/react/src/hooks/useContent.d.ts.map +1 -1
  246. package/react/src/hooks/useData.d.ts +11 -1
  247. package/react/src/hooks/useData.d.ts.map +1 -1
  248. package/react/src/hooks/useFeed.d.ts +1 -1
  249. package/react/src/hooks/useLayoutData.d.ts +11 -1
  250. package/react/src/hooks/useLayoutData.d.ts.map +1 -1
  251. package/react/src/hooks/useLlms.d.ts +1 -1
  252. package/react/src/hooks/useNavigate.d.ts +1 -1
  253. package/react/src/hooks/useParams.d.ts +1 -1
  254. package/react/src/hooks/useRouter.d.ts +1 -1
  255. package/react/src/hooks/useSearch.d.ts +1 -1
  256. package/react/src/hooks/useSearchParams.d.ts +1 -1
  257. package/react/src/hooks/useToc.d.ts +1 -1
  258. package/react/src/i18n/LocaleProvider.d.ts +20 -2
  259. package/react/src/i18n/LocaleProvider.d.ts.map +1 -1
  260. package/react/src/i18n/helpers.d.ts +31 -3
  261. package/react/src/i18n/helpers.d.ts.map +1 -1
  262. package/react/src/i18n/index.d.ts +2 -2
  263. package/react/src/i18n/index.d.ts.map +1 -1
  264. package/react/src/index.d.ts +1 -1
  265. package/react/src/lib/bundle.d.ts +27 -0
  266. package/react/src/lib/bundle.d.ts.map +1 -0
  267. package/react/src/lib/collection.d.ts +1 -1
  268. package/react/src/lib/content.d.ts +1 -1
  269. package/react/src/lib/head.d.ts +37 -1
  270. package/react/src/lib/head.d.ts.map +1 -1
  271. package/react/src/lib/index.d.ts +4 -1
  272. package/react/src/lib/index.d.ts.map +1 -1
  273. package/react/src/lib/layouts.d.ts +26 -0
  274. package/react/src/lib/layouts.d.ts.map +1 -0
  275. package/react/src/lib/lazy-route.d.ts +12 -19
  276. package/react/src/lib/lazy-route.d.ts.map +1 -1
  277. package/react/src/lib/route-loader.d.ts +1 -1
  278. package/react/src/lib/static-data.d.ts +31 -0
  279. package/react/src/lib/static-data.d.ts.map +1 -0
  280. package/react/src/providers/ContentProvider.d.ts +1 -1
  281. package/react/src/providers/RerouteProvider.d.ts +2 -2
  282. package/react/src/providers/RerouteProvider.d.ts.map +1 -1
  283. package/react/src/providers/RouterProvider.d.ts +31 -3
  284. package/react/src/providers/RouterProvider.d.ts.map +1 -1
  285. package/react/src/providers/index.d.ts +1 -1
  286. package/react/src/types/any.d.ts +1 -1
  287. package/react/src/types/index.d.ts +1 -1
  288. package/react/src/types/router.d.ts +15 -1
  289. package/react/src/types/router.d.ts.map +1 -1
  290. package/telemetry/react.d.ts +1 -1
  291. package/telemetry/react.js +16 -16
  292. package/telemetry/react.js.map +2 -2
  293. package/telemetry/server.d.ts +1 -1
  294. package/telemetry/server.js +82 -232
  295. package/telemetry/server.js.map +30 -24
  296. package/telemetry/src/react/api.d.ts +1 -1
  297. package/telemetry/src/react/context.d.ts +1 -1
  298. package/telemetry/src/react/index.d.ts +1 -1
  299. package/telemetry/src/react/telemetry.d.ts +1 -1
  300. package/telemetry/src/server/context.d.ts +1 -1
  301. package/telemetry/src/server/headers/extractor.d.ts +1 -1
  302. package/telemetry/src/server/headers/index.d.ts +1 -1
  303. package/telemetry/src/server/headers/presets.d.ts +1 -1
  304. package/telemetry/src/server/index.d.ts +1 -1
  305. package/telemetry/src/server/instrumentation.d.ts +1 -1
  306. package/telemetry/src/server/plugin.d.ts +1 -1
  307. package/telemetry/src/server/sourcemap.d.ts +1 -1
package/README.md CHANGED
@@ -130,6 +130,7 @@ Reroute is a feature-rich file-based routing framework for building fullstack Re
130
130
  - `<Link>` - Client-side navigation with automatic prefetching (localizes content hrefs)
131
131
  - `<Image>` - Optimized images with automatic format negotiation and lazy loading
132
132
  - `<Outlet>` - Render nested route components
133
+ - Route groups - `routes/(app)/[layout].tsx` wraps the routes in `(app)/` with one layout, no URL segment
133
134
  - `<ContentRoute>` - Dynamic content rendering with metadata injection
134
135
  - `<ClientOnly>` - Client-side only rendering with optional layout preservation (className/style props)
135
136
  - 🎭 **Providers**:
@@ -144,6 +145,7 @@ Reroute is a feature-rich file-based routing framework for building fullstack Re
144
145
  - 🎨 **Format Control** - Support for auto, AVIF, WebP, JPEG, and PNG formats
145
146
  - 📐 **Responsive Images** - Automatic srcset generation for multiple device sizes (640-3840px)
146
147
  - ⚡ **On-Demand Processing** - Server-side image transformation using Sharp
148
+ - 🧱 **Build-Time Preprocess** - Optional mobile / tablet / desktop bake at `reroute gen --prod`
147
149
  - 💾 **Smart Caching** - In-memory and disk cache for optimized images (1-year cache headers)
148
150
  - 🔍 **Lazy Loading** - Native lazy loading with IntersectionObserver fallback for older browsers
149
151
  - ⏫ **Priority Loading** - Opt-in eager loading for above-the-fold images
@@ -616,6 +618,8 @@ Files are loaded in order, with later files overriding earlier ones.
616
618
  - ❌ `DATABASE_URL` - Server-only
617
619
  - ❌ `SECRET_KEY` - Server-only
618
620
 
621
+ A route's or layout's `ssr` (`data`, `head`, `lang`, `sitemap`) is server code too: the browser bundle leaves it out, with every import only `ssr` uses, so a loader can import a database client or call `Bun` freely. Declare it as `export const ssr = …` (or `const ssr = …; export { ssr }`); a form the build can't leave out fails it. When the browser navigates, the server sends the page's head and lang, built as for a full page load (layouts, `meta`, content and `ssr.head`), with its data; the browser swaps the page's own head for it.
622
+
619
623
  ### TypeScript Support
620
624
 
621
625
  For type safety, create a `env.d.ts` file:
@@ -670,7 +674,40 @@ src/client/routes/blog/content/
670
674
  - Flat files under `content/` are the default locale; nest under `content/{locale}/` for translations
671
675
  - Collections without locale folders behave as before
672
676
  - Default-locale prefix (`/blog/en-US/...`) 302s to the unprefixed URL
673
- - Optional negotiate: `Accept-Language` / cookie can 302 default content URLs to a localized path (`i18n.redirectContentOnNegotiate`, default `true`)
677
+ - A locale segment in the URL always wins over cookie / `Accept-Language`
678
+ - `setLocale()` writes `?lang=` and the server 302s to the canonical content URL (and sets the cookie). That is the only way to leave a URL that already has a locale in the path
679
+ - Optional negotiate: `Accept-Language` / cookie can 302 **unprefixed** content URLs to a localized path (`i18n.redirectContentOnNegotiate`, default `true`)
680
+
681
+ ### Locale-prefixed pages (`i18n.prefixPages`)
682
+
683
+ Off by default. With `prefixPages: true` every page carries its locale in the URL, so each response depends on its URL alone and a CDN that caches by URL never serves one visitor's language to the next:
684
+
685
+ | URL | Locale |
686
+ |-----|--------|
687
+ | `/compare` | default |
688
+ | `/pt-BR/compare`, `/pt-BR` | pt-BR |
689
+ | `/help/pt-BR/slug` | pt-BR (content keeps its format) |
690
+
691
+ - The cookie and `Accept-Language` never pick a page's locale, and page/data responses send no `Set-Cookie`
692
+ - `/en-US/compare` 301s to `/compare`; a prefix in front of a content URL (`/pt-BR/help/slug`) 301s to `/help/pt-BR/slug`
693
+ - `?lang=xx` 302s to that locale's URL (and only that redirect sets the cookie); `setLocale()` uses it
694
+ - `<Link to="/compare">` renders `/pt-BR/compare` on a pt-BR page; a path that names a locale (`/pt-BR/...`) is left as written, and a link to another locale loads the document
695
+ - `ssr.data` gets the full path as `pathname` (`/pt-BR/compare`), so data is keyed and cached per locale; routes, layouts and params match the unprefixed path
696
+ - Every page gets `hreflang` alternates for each locale plus `x-default`; the sitemap lists each page once per locale
697
+ - `unprefixedPaths: ['/portfolio', '/auth']`: pages that keep one URL for every locale (a PWA scope, a universal link, a payment return). `/portfolio` covers `/portfolio/...`, not `/portfolios`. A prefixed one (`/pt-BR/portfolio`) 301s to its bare URL; otherwise its locale comes from `?lang=`, the cookie or `Accept-Language`, as without `prefixPages`, and it may set the cookie, so don't let a CDN cache it. `Link` leaves them as written, they get no `hreflang`, and the sitemap lists them once. A link from a locale-prefixed page to one loads the document
698
+ - `useRouter().routingPathname` is the path routes match (`/pt-BR/compare` → `/compare`): compare it, not `pathname`, to literals such as `'/'`
699
+
700
+ #### One URL per page, the CDN picks the locale (`localeParam`)
701
+
702
+ For pages shared as one link (a public profile), where `/pt-BR/...` URLs don't fit: a CDN reads the visitor's language and adds it as a query parameter that is part of its cache key, and the page renders in that locale.
703
+
704
+ ```ts
705
+ i18n: { localeParam: '__locale' },
706
+ ```
707
+
708
+ - The page's locale is that parameter (a content URL's segment still wins), else the default. The cookie, `Accept-Language` and `?lang=` are never read, nothing redirects and no cookie is set, so each response is a function of its URL and the CDN may cache it
709
+ - The CDN adds the parameter to every request, `/__reroute_data` included (reroute reads it from the data request's own query). With Cloudflare, a URL Rewrite Transform Rule: when `starts_with(lower(http.request.headers["accept-language"][0]), "pt")`, set the query to `concat(http.request.uri.query, "&__locale=pt-BR")`
710
+ - Without the CDN (local dev), pages render in the default locale; add `?__locale=pt-BR` to see another
674
711
 
675
712
  ### UI Strings
676
713
 
@@ -713,6 +750,9 @@ export default defineConfig({
713
750
  localesDir: 'locales', // catalog directory
714
751
  cookie: 'reroute-locale',
715
752
  redirectContentOnNegotiate: true, // 302 default content → localized URL
753
+ prefixPages: false, // true: /pt-BR/compare, URL-only locale
754
+ unprefixedPaths: [], // with prefixPages: paths never prefixed
755
+ localeParam: '', // '__locale': a CDN names the locale in the query
716
756
  },
717
757
  });
718
758
  ```
@@ -1165,8 +1205,9 @@ export default defineConfig({
1165
1205
  Your site now supports:
1166
1206
  - `.txt` and `.md` extensions on any route (e.g., `/blog/post.txt`, `/about.md`)
1167
1207
  - Accept header content negotiation (`Accept: text/plain`, `Accept: text/markdown`)
1168
- - `/llms.txt` - Index of all content organized by section
1169
- - `/llms-full.txt` - Complete site content in one file
1208
+ - `/llms.txt` - Index of all content: title, description, and link per page
1209
+ - `/llms-full.txt` - Complete site content in one file (optional; large)
1210
+ - HTML discovery: `Link: rel=alternate` + `<link type="text/markdown">` pointing at the `.md` twin, `Link: rel=llms-txt`, `Vary: Accept`, and `Content-Signal` (also a `Content-Signal:` line in `robots.txt` when robots is enabled)
1170
1211
 
1171
1212
  #### How It Works
1172
1213
 
@@ -1199,6 +1240,7 @@ curl -H "Accept: text/html" https://example.com/blog/hello-world # Default
1199
1240
  - **Flexible exclusions** - Strings, RegExp, or custom functions
1200
1241
  - **Works everywhere** - Collections, SSR routes, static pages
1201
1242
  - **Auto-discovery** - All content automatically indexed
1243
+ - **Crawler hints** - HTML `Link` / `<link rel="alternate">`, `Content-Signal`, `Vary: Accept`
1202
1244
 
1203
1245
  #### Discovering LLM Files in Your UI
1204
1246
 
package/cli/bin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.4
2
+ * reroute-js v1.0.0-alpha.40
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>