reroute-js 1.0.0-alpha.6 → 1.0.0-alpha.7

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 (202) hide show
  1. package/README.md +5 -3
  2. package/cli/bin.d.ts +1 -1
  3. package/cli/bin.js +103 -32
  4. package/cli/bin.js.map +5 -5
  5. package/cli/index.d.ts +1 -1
  6. package/cli/index.js +4 -4
  7. package/cli/index.js.map +1 -1
  8. package/cli/src/cli.d.ts +1 -1
  9. package/cli/src/commands/analyze.d.ts +1 -1
  10. package/cli/src/commands/build.d.ts +1 -1
  11. package/cli/src/commands/dev.d.ts +1 -1
  12. package/cli/src/commands/gen.d.ts +1 -1
  13. package/cli/src/commands/index.d.ts +1 -1
  14. package/cli/src/commands/init.d.ts +1 -1
  15. package/cli/src/commands/lib/assets.d.ts +1 -1
  16. package/cli/src/commands/lib/bundler.d.ts +1 -1
  17. package/cli/src/commands/lib/command.d.ts +1 -1
  18. package/cli/src/commands/lib/env.d.ts +1 -1
  19. package/cli/src/commands/lib/index.d.ts +1 -1
  20. package/cli/src/commands/lib/log.d.ts +1 -1
  21. package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
  22. package/cli/src/commands/lib/markdown/index.d.ts +1 -1
  23. package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
  24. package/cli/src/commands/lib/production.d.ts +1 -1
  25. package/cli/src/commands/lib/server.d.ts +1 -1
  26. package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
  27. package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
  28. package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
  29. package/cli/src/commands/lib/theme.d.ts +1 -1
  30. package/cli/src/commands/lib/version.d.ts +1 -1
  31. package/cli/src/commands/og.d.ts +1 -1
  32. package/cli/src/commands/start.d.ts +1 -1
  33. package/cli/src/index.d.ts +1 -1
  34. package/core/index.d.ts +1 -1
  35. package/core/index.js +99 -28
  36. package/core/index.js.map +5 -5
  37. package/core/src/bundler/hash.d.ts +1 -1
  38. package/core/src/bundler/index.d.ts +1 -1
  39. package/core/src/config.d.ts +7 -1
  40. package/core/src/config.d.ts.map +1 -1
  41. package/core/src/content/discovery.d.ts +1 -1
  42. package/core/src/content/index.d.ts +1 -1
  43. package/core/src/content/metadata.d.ts +1 -1
  44. package/core/src/i18n/catalog.d.ts +1 -1
  45. package/core/src/i18n/discover.d.ts +1 -1
  46. package/core/src/i18n/index.d.ts +1 -1
  47. package/core/src/i18n/messages.d.ts +1 -1
  48. package/core/src/i18n/negotiate.d.ts +1 -1
  49. package/core/src/i18n/pathname.d.ts +1 -1
  50. package/core/src/i18n/resolve.d.ts +4 -3
  51. package/core/src/i18n/resolve.d.ts.map +1 -1
  52. package/core/src/i18n/types.d.ts +5 -1
  53. package/core/src/i18n/types.d.ts.map +1 -1
  54. package/core/src/index.d.ts +1 -1
  55. package/core/src/llms/extractor.d.ts +1 -1
  56. package/core/src/llms/formatter.d.ts +1 -1
  57. package/core/src/llms/full-generator.d.ts +1 -1
  58. package/core/src/llms/index-generator.d.ts +3 -2
  59. package/core/src/llms/index-generator.d.ts.map +1 -1
  60. package/core/src/llms/index.d.ts +1 -1
  61. package/core/src/og/discovery.d.ts +1 -1
  62. package/core/src/og/index.d.ts +1 -1
  63. package/core/src/og/meta.d.ts +1 -1
  64. package/core/src/og/render.d.ts +1 -1
  65. package/core/src/og/types.d.ts +1 -1
  66. package/core/src/robots/discovery.d.ts +1 -1
  67. package/core/src/robots/generator.d.ts +1 -1
  68. package/core/src/robots/index.d.ts +1 -1
  69. package/core/src/robots/policies.d.ts +1 -1
  70. package/core/src/rss/discovery.d.ts +1 -1
  71. package/core/src/rss/generator.d.ts +1 -1
  72. package/core/src/rss/index.d.ts +1 -1
  73. package/core/src/sitemap/discovery.d.ts +1 -1
  74. package/core/src/sitemap/generator.d.ts +1 -1
  75. package/core/src/sitemap/index.d.ts +1 -1
  76. package/core/src/ssr/index.d.ts +1 -1
  77. package/core/src/ssr/lib/cache.d.ts +1 -1
  78. package/core/src/ssr/lib/cleanup.d.ts +1 -1
  79. package/core/src/ssr/lib/collections.d.ts +1 -1
  80. package/core/src/ssr/lib/compression.d.ts +1 -1
  81. package/core/src/ssr/lib/compute/content.d.ts +1 -1
  82. package/core/src/ssr/lib/compute/index.d.ts +1 -1
  83. package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
  84. package/core/src/ssr/lib/compute/routes.d.ts +1 -1
  85. package/core/src/ssr/lib/content-path.d.ts +1 -1
  86. package/core/src/ssr/lib/data.d.ts +1 -1
  87. package/core/src/ssr/lib/html.d.ts +1 -1
  88. package/core/src/ssr/lib/imports.d.ts +1 -1
  89. package/core/src/ssr/lib/index.d.ts +1 -1
  90. package/core/src/ssr/lib/layouts.d.ts +1 -1
  91. package/core/src/ssr/lib/metadata.d.ts +1 -1
  92. package/core/src/ssr/lib/mime.d.ts +1 -1
  93. package/core/src/ssr/lib/modules.d.ts +1 -1
  94. package/core/src/ssr/lib/path.d.ts +1 -1
  95. package/core/src/ssr/lib/preload.d.ts +1 -1
  96. package/core/src/ssr/lib/route-match.d.ts +1 -1
  97. package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
  98. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  99. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  100. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  101. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  102. package/core/src/ssr/lib/seed.d.ts +1 -1
  103. package/core/src/ssr/lib/serialize.d.ts +1 -1
  104. package/core/src/ssr/lib/setup.d.ts +1 -1
  105. package/core/src/ssr/lib/styles.d.ts +1 -1
  106. package/core/src/ssr/lib/template.d.ts +1 -1
  107. package/core/src/ssr/lib/types.d.ts +1 -1
  108. package/core/src/ssr/render.d.ts +1 -1
  109. package/core/src/ssr/stream.d.ts +1 -1
  110. package/elysia/index.d.ts +1 -1
  111. package/elysia/index.js +106 -33
  112. package/elysia/index.js.map +7 -7
  113. package/elysia/src/index.d.ts +1 -1
  114. package/elysia/src/libs/assets.d.ts +1 -1
  115. package/elysia/src/libs/cache.d.ts +1 -1
  116. package/elysia/src/libs/caching.d.ts +1 -1
  117. package/elysia/src/libs/http.d.ts +1 -1
  118. package/elysia/src/libs/i18n.d.ts +2 -2
  119. package/elysia/src/libs/i18n.d.ts.map +1 -1
  120. package/elysia/src/libs/image.d.ts +1 -1
  121. package/elysia/src/libs/index.d.ts +1 -1
  122. package/elysia/src/libs/llms.d.ts +1 -1
  123. package/elysia/src/libs/response.d.ts +1 -1
  124. package/elysia/src/libs/serving.d.ts +1 -1
  125. package/elysia/src/plugin.d.ts +1 -1
  126. package/elysia/src/routes/artifacts.d.ts +1 -1
  127. package/elysia/src/routes/content.d.ts +1 -1
  128. package/elysia/src/routes/image.d.ts +1 -1
  129. package/elysia/src/routes/index.d.ts +1 -1
  130. package/elysia/src/routes/internal.d.ts +1 -1
  131. package/elysia/src/routes/llms.d.ts +1 -1
  132. package/elysia/src/routes/og.d.ts +1 -1
  133. package/elysia/src/routes/redirects.d.ts +1 -1
  134. package/elysia/src/routes/robots.d.ts +1 -1
  135. package/elysia/src/routes/rss.d.ts +1 -1
  136. package/elysia/src/routes/search.d.ts +1 -1
  137. package/elysia/src/routes/sitemap.d.ts +1 -1
  138. package/elysia/src/routes/ssr.d.ts +1 -1
  139. package/elysia/src/routes/ssr.d.ts.map +1 -1
  140. package/elysia/src/routes/static.d.ts +1 -1
  141. package/elysia/src/routes/themeCssRefresh.d.ts +1 -1
  142. package/elysia/src/types.d.ts +1 -1
  143. package/package.json +1 -1
  144. package/react/index.d.ts +1 -1
  145. package/react/index.js +7 -24
  146. package/react/index.js.map +3 -3
  147. package/react/src/components/ClientOnly.d.ts +1 -1
  148. package/react/src/components/ContentRoute.d.ts +1 -1
  149. package/react/src/components/Image.d.ts +1 -1
  150. package/react/src/components/LazyRoute.d.ts +1 -1
  151. package/react/src/components/Link.d.ts +1 -1
  152. package/react/src/components/Markdown.d.ts +1 -1
  153. package/react/src/components/Outlet.d.ts +1 -1
  154. package/react/src/components/index.d.ts +1 -1
  155. package/react/src/hooks/index.d.ts +1 -1
  156. package/react/src/hooks/useContent.d.ts +1 -1
  157. package/react/src/hooks/useData.d.ts +1 -1
  158. package/react/src/hooks/useFeed.d.ts +1 -1
  159. package/react/src/hooks/useLayoutData.d.ts +1 -1
  160. package/react/src/hooks/useLlms.d.ts +1 -1
  161. package/react/src/hooks/useNavigate.d.ts +1 -1
  162. package/react/src/hooks/useParams.d.ts +1 -1
  163. package/react/src/hooks/useRouter.d.ts +1 -1
  164. package/react/src/hooks/useSearch.d.ts +1 -1
  165. package/react/src/hooks/useSearchParams.d.ts +1 -1
  166. package/react/src/hooks/useToc.d.ts +1 -1
  167. package/react/src/i18n/LocaleProvider.d.ts +1 -1
  168. package/react/src/i18n/LocaleProvider.d.ts.map +1 -1
  169. package/react/src/i18n/helpers.d.ts +1 -1
  170. package/react/src/i18n/index.d.ts +1 -1
  171. package/react/src/index.d.ts +1 -1
  172. package/react/src/lib/collection.d.ts +1 -1
  173. package/react/src/lib/content.d.ts +1 -1
  174. package/react/src/lib/head.d.ts +1 -1
  175. package/react/src/lib/index.d.ts +1 -1
  176. package/react/src/lib/lazy-route.d.ts +1 -1
  177. package/react/src/lib/route-loader.d.ts +1 -1
  178. package/react/src/providers/ContentProvider.d.ts +1 -1
  179. package/react/src/providers/RerouteProvider.d.ts +1 -1
  180. package/react/src/providers/RouterProvider.d.ts +1 -1
  181. package/react/src/providers/index.d.ts +1 -1
  182. package/react/src/types/any.d.ts +1 -1
  183. package/react/src/types/index.d.ts +1 -1
  184. package/react/src/types/router.d.ts +1 -1
  185. package/telemetry/react.d.ts +1 -1
  186. package/telemetry/react.js +2 -2
  187. package/telemetry/react.js.map +1 -1
  188. package/telemetry/server.d.ts +1 -1
  189. package/telemetry/server.js +2 -2
  190. package/telemetry/server.js.map +5 -5
  191. package/telemetry/src/react/api.d.ts +1 -1
  192. package/telemetry/src/react/context.d.ts +1 -1
  193. package/telemetry/src/react/index.d.ts +1 -1
  194. package/telemetry/src/react/telemetry.d.ts +1 -1
  195. package/telemetry/src/server/context.d.ts +1 -1
  196. package/telemetry/src/server/headers/extractor.d.ts +1 -1
  197. package/telemetry/src/server/headers/index.d.ts +1 -1
  198. package/telemetry/src/server/headers/presets.d.ts +1 -1
  199. package/telemetry/src/server/index.d.ts +1 -1
  200. package/telemetry/src/server/instrumentation.d.ts +1 -1
  201. package/telemetry/src/server/plugin.d.ts +1 -1
  202. package/telemetry/src/server/sourcemap.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.6
2
+ * reroute-js v1.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.6
2
+ * reroute-js v1.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.6
2
+ * reroute-js v1.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.6
2
+ * reroute-js v1.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.6
2
+ * reroute-js v1.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.6
2
+ * reroute-js v1.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.6
2
+ * reroute-js v1.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.6
2
+ * reroute-js v1.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
package/elysia/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.6
2
+ * reroute-js v1.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
package/elysia/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.6
2
+ * reroute-js v1.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -480,9 +480,30 @@ function hreflangTags(baseUrl, collection, name, locales, defaultLocale) {
480
480
  var init_pathname = () => {};
481
481
 
482
482
  // packages/core/src/i18n/resolve.ts
483
+ function canonicalLocale(value, availableLocales) {
484
+ return availableLocales.find((l) => l.toLowerCase() === value.toLowerCase()) || value;
485
+ }
486
+ function parseLangParam(search, isAvailable, availableLocales) {
487
+ if (!search)
488
+ return;
489
+ const params = new URLSearchParams(search.startsWith("?") ? search.slice(1) : search);
490
+ const raw = params.get("lang") ?? undefined;
491
+ if (!isAvailable(raw))
492
+ return;
493
+ return canonicalLocale(raw, availableLocales);
494
+ }
495
+ function stripLangParam(search) {
496
+ if (!search)
497
+ return "";
498
+ const params = new URLSearchParams(search.startsWith("?") ? search.slice(1) : search);
499
+ params.delete("lang");
500
+ const rest = params.toString();
501
+ return rest ? `?${rest}` : "";
502
+ }
483
503
  function resolveLocale(input) {
484
504
  const {
485
505
  pathname,
506
+ search,
486
507
  cookieHeader,
487
508
  acceptLanguage,
488
509
  availableLocales,
@@ -493,14 +514,32 @@ function resolveLocale(input) {
493
514
  const parsed = parseContentPath(pathname, availableLocales, collections);
494
515
  const availableLower = new Set(availableLocales.map((l) => l.toLowerCase()));
495
516
  const isAvailable = (locale) => !!locale && availableLower.has(locale.toLowerCase());
517
+ const routingPathname = parsed?.routingPathname ?? pathname.split("?")[0];
518
+ const restSearch = stripLangParam(search);
519
+ const queryLocale = parseLangParam(search, isAvailable, availableLocales);
520
+ if (queryLocale) {
521
+ const target = parsed ? localizeContentHref(parsed.collection, parsed.name, queryLocale, defaultLocale) : routingPathname;
522
+ return {
523
+ locale: queryLocale,
524
+ routingPathname,
525
+ fromPath: false,
526
+ fromQuery: true,
527
+ redirectTo: `${target}${restSearch}`,
528
+ parsed: parsed ? {
529
+ ...parsed,
530
+ locale: queryLocale === defaultLocale ? undefined : queryLocale
531
+ } : undefined
532
+ };
533
+ }
496
534
  if (parsed?.locale && isAvailable(parsed.locale)) {
497
- const locale = availableLocales.find((l) => l.toLowerCase() === parsed.locale?.toLowerCase()) || parsed.locale;
535
+ const locale = canonicalLocale(parsed.locale, availableLocales);
498
536
  if (locale === defaultLocale && parsed.pathname !== parsed.routingPathname) {
499
537
  return {
500
538
  locale,
501
539
  routingPathname: parsed.routingPathname,
502
540
  fromPath: true,
503
- redirectTo: parsed.routingPathname,
541
+ fromQuery: false,
542
+ redirectTo: `${parsed.routingPathname}${restSearch}`,
504
543
  parsed: { ...parsed, locale }
505
544
  };
506
545
  }
@@ -508,17 +547,18 @@ function resolveLocale(input) {
508
547
  locale,
509
548
  routingPathname: parsed.routingPathname,
510
549
  fromPath: true,
550
+ fromQuery: false,
511
551
  parsed: { ...parsed, locale }
512
552
  };
513
553
  }
514
- const routingPathname = parsed?.routingPathname ?? pathname.split("?")[0];
515
554
  const cookieLocale = parseCookieValue(cookieHeader, cookieName);
516
555
  if (isAvailable(cookieLocale)) {
517
- const locale = availableLocales.find((l) => l.toLowerCase() === cookieLocale.toLowerCase()) || cookieLocale;
556
+ const locale = canonicalLocale(cookieLocale, availableLocales);
518
557
  return {
519
558
  locale,
520
559
  routingPathname,
521
560
  fromPath: false,
561
+ fromQuery: false,
522
562
  parsed: parsed ? { ...parsed, locale: undefined } : undefined
523
563
  };
524
564
  }
@@ -527,13 +567,14 @@ function resolveLocale(input) {
527
567
  locale: negotiated,
528
568
  routingPathname,
529
569
  fromPath: false,
570
+ fromQuery: false,
530
571
  parsed: parsed ? { ...parsed, locale: undefined } : undefined
531
572
  };
532
573
  }
533
574
  function contentNegotiateRedirect(resolution, defaultLocale, enabled) {
534
575
  if (!enabled)
535
576
  return;
536
- if (resolution.fromPath)
577
+ if (resolution.fromPath || resolution.fromQuery)
537
578
  return;
538
579
  if (resolution.locale === defaultLocale)
539
580
  return;
@@ -4164,6 +4205,25 @@ __export(exports_index_generator, {
4164
4205
  generateLLMsIndex: () => generateLLMsIndex
4165
4206
  });
4166
4207
  import { pathToFileURL as pathToFileURL6 } from "node:url";
4208
+ function oneLine(value) {
4209
+ return value.replace(/\s+/g, " ").trim();
4210
+ }
4211
+ function stringField(record, key) {
4212
+ const value = record?.[key];
4213
+ if (typeof value !== "string")
4214
+ return;
4215
+ const trimmed = oneLine(value);
4216
+ return trimmed.length > 0 ? trimmed : undefined;
4217
+ }
4218
+ function metaFromUnknown(meta) {
4219
+ if (!meta || typeof meta !== "object")
4220
+ return {};
4221
+ const record = meta;
4222
+ return {
4223
+ title: stringField(record, "title") ?? stringField(record, "name"),
4224
+ description: stringField(record, "description") ?? stringField(record, "excerpt")
4225
+ };
4226
+ }
4167
4227
  async function discoverStaticRoutes(cwd, isWatchMode) {
4168
4228
  const routes = [];
4169
4229
  try {
@@ -4180,8 +4240,11 @@ async function discoverStaticRoutes(cwd, isWatchMode) {
4180
4240
  if (pattern.includes("[404]") || pattern.includes("[layout]") || pattern.includes("[skeleton]") || pattern.includes(":")) {
4181
4241
  continue;
4182
4242
  }
4243
+ const { title, description } = metaFromUnknown(route?.meta);
4183
4244
  routes.push({
4184
- path: pattern
4245
+ path: pattern,
4246
+ title,
4247
+ description
4185
4248
  });
4186
4249
  }
4187
4250
  }
@@ -4204,11 +4267,13 @@ function createRouteEntriesFromItems(items, collection) {
4204
4267
  for (const item of items) {
4205
4268
  const href = String(item.href || "");
4206
4269
  if (href) {
4207
- const title = item.meta?.title || item.meta?.name || item.name;
4270
+ const fromMeta = metaFromUnknown(item.meta);
4271
+ const title = fromMeta.title || (typeof item.name === "string" ? item.name : undefined);
4208
4272
  routes.push({
4209
4273
  path: href,
4210
4274
  section: collection,
4211
- title
4275
+ title,
4276
+ description: fromMeta.description
4212
4277
  });
4213
4278
  }
4214
4279
  }
@@ -4274,9 +4339,13 @@ function createEntriesFromArray(array, routePath) {
4274
4339
  continue;
4275
4340
  const identifier = extractIdentifier(item);
4276
4341
  if (identifier) {
4342
+ const fromItem = metaFromUnknown(item);
4343
+ const fromMeta = metaFromUnknown(item.meta);
4277
4344
  entries.push({
4278
4345
  path: `${routePath}/${identifier}`,
4279
- section: routePath.split("/").filter(Boolean)[0]
4346
+ section: routePath.split("/").filter(Boolean)[0],
4347
+ title: fromItem.title ?? fromMeta.title,
4348
+ description: fromItem.description ?? fromMeta.description
4280
4349
  });
4281
4350
  }
4282
4351
  }
@@ -4382,13 +4451,21 @@ function formatRouteUrl(routePath, baseUrl) {
4382
4451
  function getRouteTitle(route) {
4383
4452
  return route.title || (route.path === "/" ? "Home" : route.path.split("/").pop() || "Page");
4384
4453
  }
4385
- function addRootRoutes(parts, rootRoutes, baseUrl, isScoped) {
4454
+ function formatIndexLine(route, url, summaries) {
4455
+ const link = `- [${getRouteTitle(route)}](${url})`;
4456
+ if (!(summaries && route.description))
4457
+ return link;
4458
+ return `${link}: ${route.description}`;
4459
+ }
4460
+ function summariesEnabled(llmsConfig) {
4461
+ return llmsConfig?.indexSummaries !== false;
4462
+ }
4463
+ function addRootRoutes(parts, rootRoutes, baseUrl, isScoped, llmsConfig) {
4386
4464
  if (isScoped || rootRoutes.length === 0)
4387
4465
  return;
4466
+ const summaries = summariesEnabled(llmsConfig);
4388
4467
  for (const route of rootRoutes) {
4389
- const title = getRouteTitle(route);
4390
- const url = formatRouteUrl(route.path, baseUrl);
4391
- parts.push(`- [${title}](${url})`);
4468
+ parts.push(formatIndexLine(route, formatRouteUrl(route.path, baseUrl), summaries));
4392
4469
  }
4393
4470
  parts.push("");
4394
4471
  }
@@ -4399,10 +4476,9 @@ function addCollectionSection(parts, collection, routes, baseUrl, llmsConfig) {
4399
4476
  const sectionName = collection.charAt(0).toUpperCase() + collection.slice(1);
4400
4477
  parts.push(`## ${sectionName}`);
4401
4478
  parts.push("");
4479
+ const summaries = summariesEnabled(llmsConfig);
4402
4480
  for (const route of filteredRoutes) {
4403
- const title = route.title || route.path.split("/").pop() || "Untitled";
4404
- const url = `${baseUrl}${route.path}.txt`;
4405
- parts.push(`- [${title}](${url})`);
4481
+ parts.push(formatIndexLine(route, `${baseUrl}${route.path}.txt`, summaries));
4406
4482
  }
4407
4483
  parts.push("");
4408
4484
  }
@@ -4420,10 +4496,9 @@ function addSSRDataSection(parts, routePattern, routes, baseUrl, isScoped, targe
4420
4496
  const sectionName = routeSection?.charAt(0).toUpperCase() + routeSection?.slice(1) || "Content";
4421
4497
  parts.push(`## ${sectionName}`);
4422
4498
  parts.push("");
4499
+ const summaries = summariesEnabled(llmsConfig);
4423
4500
  for (const route of filteredRoutes) {
4424
- const title = route.title || route.path.split("/").pop() || "Untitled";
4425
- const url = `${baseUrl}${route.path}.txt`;
4426
- parts.push(`- [${title}](${url})`);
4501
+ parts.push(formatIndexLine(route, `${baseUrl}${route.path}.txt`, summaries));
4427
4502
  }
4428
4503
  parts.push("");
4429
4504
  }
@@ -4437,10 +4512,9 @@ function addStaticSection(parts, section, routes, baseUrl, isScoped, targetColle
4437
4512
  const sectionName = section.charAt(0).toUpperCase() + section.slice(1);
4438
4513
  parts.push(`## ${sectionName}`);
4439
4514
  parts.push("");
4515
+ const summaries = summariesEnabled(llmsConfig);
4440
4516
  for (const route of filteredRoutes) {
4441
- const title = route.title || route.path.split("/").pop() || "Untitled";
4442
- const url = `${baseUrl}${route.path}.txt`;
4443
- parts.push(`- [${title}](${url})`);
4517
+ parts.push(formatIndexLine(route, `${baseUrl}${route.path}.txt`, summaries));
4444
4518
  }
4445
4519
  parts.push("");
4446
4520
  }
@@ -4454,7 +4528,7 @@ async function generateLLMsIndex(options) {
4454
4528
  const collectionsMap = await discoverCollectionRoutes(cwd, collections2, isWatchMode, llmsConfig);
4455
4529
  const ssrDataRoutes = await discoverSSRDataRoutes(cwd, staticRoutes, isWatchMode);
4456
4530
  const { sections, rootRoutes } = groupStaticRoutes(staticRoutes, llmsConfig);
4457
- addRootRoutes(parts, rootRoutes, baseUrl, isScoped);
4531
+ addRootRoutes(parts, rootRoutes, baseUrl, isScoped, llmsConfig);
4458
4532
  for (const [collection, routes] of collectionsMap.entries()) {
4459
4533
  if (routes.length > 0) {
4460
4534
  addCollectionSection(parts, collection, routes, baseUrl, llmsConfig);
@@ -4473,9 +4547,6 @@ async function generateLLMsIndex(options) {
4473
4547
  parts.push("---");
4474
4548
  parts.push("");
4475
4549
  parts.push("Formats: .txt | .md | Accept: text/plain | Accept: text/markdown");
4476
- if (!isScoped && baseUrl) {
4477
- parts.push(`Full dump: ${baseUrl}/llms-full.txt`);
4478
- }
4479
4550
  return parts.join(`
4480
4551
  `);
4481
4552
  }
@@ -8909,7 +8980,7 @@ async function listContentCollections(cwd) {
8909
8980
  return [];
8910
8981
  }
8911
8982
  }
8912
- async function resolveI18nForRequest(cwd, pathname, headers2, collections2) {
8983
+ async function resolveI18nForRequest(cwd, pathname, headers2, collections2, search) {
8913
8984
  const i18n2 = await loadI18nState(cwd);
8914
8985
  const disabled = {
8915
8986
  enabled: false,
@@ -8926,6 +8997,7 @@ async function resolveI18nForRequest(cwd, pathname, headers2, collections2) {
8926
8997
  const knownCollections = collections2?.length ? collections2 : await listContentCollections(cwd);
8927
8998
  const resolution = resolveLocale({
8928
8999
  pathname,
9000
+ search,
8929
9001
  cookieHeader: headers2.cookie,
8930
9002
  acceptLanguage: headers2["accept-language"],
8931
9003
  availableLocales: i18n2.locales,
@@ -8986,9 +9058,10 @@ function isOtelAvailable3() {
8986
9058
  return false;
8987
9059
  }
8988
9060
  }
8989
- async function applyI18nForSSR(cwd, pathname, headers2, set, fallbackLang) {
8990
- const i18nResult = await resolveI18nForRequest(cwd, pathname, headers2);
8991
- if (i18nResult.redirectTo && i18nResult.redirectTo !== pathname) {
9061
+ async function applyI18nForSSR(cwd, pathname, headers2, set, fallbackLang, search = "") {
9062
+ const i18nResult = await resolveI18nForRequest(cwd, pathname, headers2, undefined, search);
9063
+ const current = `${pathname}${search}`;
9064
+ if (i18nResult.redirectTo && i18nResult.redirectTo !== current) {
8992
9065
  const redirectHeaders = {
8993
9066
  Location: i18nResult.redirectTo
8994
9067
  };
@@ -9083,7 +9156,7 @@ function registerSSRRoutes(app, options) {
9083
9156
  request.headers.forEach((value, key) => {
9084
9157
  headers2[key.toLowerCase()] = value;
9085
9158
  });
9086
- const i18n2 = await applyI18nForSSR(cwd, pathname, headers2, set, lang);
9159
+ const i18n2 = await applyI18nForSSR(cwd, pathname, headers2, set, lang, url.search);
9087
9160
  if (i18n2.redirect)
9088
9161
  return i18n2.redirect;
9089
9162
  const parentSpan = store.telemetrySpan;
@@ -9963,4 +10036,4 @@ export {
9963
10036
  reroute
9964
10037
  };
9965
10038
 
9966
- //# debugId=0148350251EC358E64756E2164756E21
10039
+ //# debugId=40A8A1EA3D8ED46164756E2164756E21