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

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 (206) hide show
  1. package/cli/bin.d.ts +1 -1
  2. package/cli/bin.js +755 -683
  3. package/cli/bin.js.map +12 -12
  4. package/cli/index.d.ts +1 -1
  5. package/cli/index.js +37 -25
  6. package/cli/index.js.map +3 -3
  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 +5 -6
  11. package/cli/src/commands/dev.d.ts.map +1 -1
  12. package/cli/src/commands/gen.d.ts +4 -1
  13. package/cli/src/commands/gen.d.ts.map +1 -1
  14. package/cli/src/commands/index.d.ts +1 -1
  15. package/cli/src/commands/init.d.ts +1 -1
  16. package/cli/src/commands/lib/assets.d.ts +1 -1
  17. package/cli/src/commands/lib/bundler.d.ts +1 -1
  18. package/cli/src/commands/lib/command.d.ts +1 -1
  19. package/cli/src/commands/lib/env.d.ts +1 -1
  20. package/cli/src/commands/lib/index.d.ts +1 -1
  21. package/cli/src/commands/lib/log.d.ts +1 -1
  22. package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
  23. package/cli/src/commands/lib/markdown/index.d.ts +1 -1
  24. package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
  25. package/cli/src/commands/lib/production.d.ts +1 -1
  26. package/cli/src/commands/lib/server.d.ts +2 -1
  27. package/cli/src/commands/lib/server.d.ts.map +1 -1
  28. package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
  29. package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
  30. package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
  31. package/cli/src/commands/lib/theme.d.ts +1 -1
  32. package/cli/src/commands/lib/version.d.ts +1 -1
  33. package/cli/src/commands/og.d.ts +1 -1
  34. package/cli/src/commands/start.d.ts +1 -1
  35. package/cli/src/index.d.ts +1 -1
  36. package/core/index.d.ts +1 -1
  37. package/core/index.js +223 -172
  38. package/core/index.js.map +7 -7
  39. package/core/src/bundler/hash.d.ts +1 -1
  40. package/core/src/bundler/index.d.ts +1 -1
  41. package/core/src/config.d.ts +1 -1
  42. package/core/src/content/discovery.d.ts +1 -1
  43. package/core/src/content/index.d.ts +1 -1
  44. package/core/src/content/metadata.d.ts +1 -1
  45. package/core/src/i18n/catalog.d.ts +1 -1
  46. package/core/src/i18n/discover.d.ts +1 -1
  47. package/core/src/i18n/index.d.ts +1 -1
  48. package/core/src/i18n/messages.d.ts +1 -1
  49. package/core/src/i18n/negotiate.d.ts +1 -1
  50. package/core/src/i18n/pathname.d.ts +1 -1
  51. package/core/src/i18n/resolve.d.ts +1 -1
  52. package/core/src/i18n/types.d.ts +1 -1
  53. package/core/src/index.d.ts +1 -1
  54. package/core/src/llms/extractor.d.ts +1 -1
  55. package/core/src/llms/formatter.d.ts +1 -1
  56. package/core/src/llms/full-generator.d.ts +3 -1
  57. package/core/src/llms/full-generator.d.ts.map +1 -1
  58. package/core/src/llms/index-generator.d.ts +3 -1
  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 +8 -3
  89. package/core/src/ssr/lib/imports.d.ts.map +1 -1
  90. package/core/src/ssr/lib/index.d.ts +1 -1
  91. package/core/src/ssr/lib/layouts.d.ts +1 -1
  92. package/core/src/ssr/lib/metadata.d.ts +1 -1
  93. package/core/src/ssr/lib/mime.d.ts +1 -1
  94. package/core/src/ssr/lib/modules.d.ts +1 -1
  95. package/core/src/ssr/lib/path.d.ts +1 -1
  96. package/core/src/ssr/lib/preload.d.ts +1 -1
  97. package/core/src/ssr/lib/route-match.d.ts +1 -1
  98. package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
  99. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  100. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  101. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  102. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  103. package/core/src/ssr/lib/seed.d.ts +6 -1
  104. package/core/src/ssr/lib/seed.d.ts.map +1 -1
  105. package/core/src/ssr/lib/serialize.d.ts +1 -1
  106. package/core/src/ssr/lib/setup.d.ts +1 -1
  107. package/core/src/ssr/lib/styles.d.ts +1 -1
  108. package/core/src/ssr/lib/template.d.ts +1 -1
  109. package/core/src/ssr/lib/types.d.ts +1 -1
  110. package/core/src/ssr/render.d.ts +1 -1
  111. package/core/src/ssr/stream.d.ts +1 -1
  112. package/elysia/index.d.ts +1 -1
  113. package/elysia/index.js +302 -223
  114. package/elysia/index.js.map +14 -13
  115. package/elysia/src/index.d.ts +1 -1
  116. package/elysia/src/libs/assets.d.ts +1 -1
  117. package/elysia/src/libs/cache.d.ts +1 -1
  118. package/elysia/src/libs/caching.d.ts +1 -1
  119. package/elysia/src/libs/http.d.ts +1 -1
  120. package/elysia/src/libs/i18n.d.ts +1 -1
  121. package/elysia/src/libs/image.d.ts +1 -1
  122. package/elysia/src/libs/index.d.ts +1 -1
  123. package/elysia/src/libs/llms.d.ts +1 -1
  124. package/elysia/src/libs/response.d.ts +1 -1
  125. package/elysia/src/libs/serving.d.ts +1 -1
  126. package/elysia/src/plugin.d.ts +1 -1
  127. package/elysia/src/plugin.d.ts.map +1 -1
  128. package/elysia/src/routes/artifacts.d.ts +1 -1
  129. package/elysia/src/routes/content.d.ts +2 -2
  130. package/elysia/src/routes/content.d.ts.map +1 -1
  131. package/elysia/src/routes/image.d.ts +1 -1
  132. package/elysia/src/routes/index.d.ts +1 -1
  133. package/elysia/src/routes/internal.d.ts +1 -1
  134. package/elysia/src/routes/internal.d.ts.map +1 -1
  135. package/elysia/src/routes/llms.d.ts +1 -1
  136. package/elysia/src/routes/llms.d.ts.map +1 -1
  137. package/elysia/src/routes/og.d.ts +1 -1
  138. package/elysia/src/routes/redirects.d.ts +1 -1
  139. package/elysia/src/routes/robots.d.ts +1 -1
  140. package/elysia/src/routes/rss.d.ts +1 -1
  141. package/elysia/src/routes/search.d.ts +1 -1
  142. package/elysia/src/routes/sitemap.d.ts +1 -1
  143. package/elysia/src/routes/ssr.d.ts +1 -1
  144. package/elysia/src/routes/static.d.ts +1 -1
  145. package/elysia/src/routes/themeCssRefresh.d.ts +17 -0
  146. package/elysia/src/routes/themeCssRefresh.d.ts.map +1 -0
  147. package/elysia/src/types.d.ts +1 -1
  148. package/package.json +1 -1
  149. package/react/index.d.ts +1 -1
  150. package/react/index.js +71 -71
  151. package/react/index.js.map +1 -1
  152. package/react/src/components/ClientOnly.d.ts +1 -1
  153. package/react/src/components/ContentRoute.d.ts +1 -1
  154. package/react/src/components/Image.d.ts +1 -1
  155. package/react/src/components/LazyRoute.d.ts +1 -1
  156. package/react/src/components/Link.d.ts +1 -1
  157. package/react/src/components/Markdown.d.ts +1 -1
  158. package/react/src/components/Outlet.d.ts +1 -1
  159. package/react/src/components/index.d.ts +1 -1
  160. package/react/src/hooks/index.d.ts +1 -1
  161. package/react/src/hooks/useContent.d.ts +1 -1
  162. package/react/src/hooks/useData.d.ts +1 -1
  163. package/react/src/hooks/useFeed.d.ts +1 -1
  164. package/react/src/hooks/useLayoutData.d.ts +1 -1
  165. package/react/src/hooks/useLlms.d.ts +1 -1
  166. package/react/src/hooks/useNavigate.d.ts +1 -1
  167. package/react/src/hooks/useParams.d.ts +1 -1
  168. package/react/src/hooks/useRouter.d.ts +1 -1
  169. package/react/src/hooks/useSearch.d.ts +1 -1
  170. package/react/src/hooks/useSearchParams.d.ts +1 -1
  171. package/react/src/hooks/useToc.d.ts +1 -1
  172. package/react/src/i18n/LocaleProvider.d.ts +1 -1
  173. package/react/src/i18n/helpers.d.ts +1 -1
  174. package/react/src/i18n/index.d.ts +1 -1
  175. package/react/src/index.d.ts +1 -1
  176. package/react/src/lib/collection.d.ts +1 -1
  177. package/react/src/lib/content.d.ts +1 -1
  178. package/react/src/lib/head.d.ts +1 -1
  179. package/react/src/lib/index.d.ts +1 -1
  180. package/react/src/lib/lazy-route.d.ts +1 -1
  181. package/react/src/lib/route-loader.d.ts +1 -1
  182. package/react/src/providers/ContentProvider.d.ts +1 -1
  183. package/react/src/providers/RerouteProvider.d.ts +1 -1
  184. package/react/src/providers/RouterProvider.d.ts +1 -1
  185. package/react/src/providers/index.d.ts +1 -1
  186. package/react/src/types/any.d.ts +1 -1
  187. package/react/src/types/index.d.ts +1 -1
  188. package/react/src/types/router.d.ts +1 -1
  189. package/telemetry/react.d.ts +1 -1
  190. package/telemetry/react.js +16 -16
  191. package/telemetry/react.js.map +2 -2
  192. package/telemetry/server.d.ts +1 -1
  193. package/telemetry/server.js +28 -220
  194. package/telemetry/server.js.map +7 -6
  195. package/telemetry/src/react/api.d.ts +1 -1
  196. package/telemetry/src/react/context.d.ts +1 -1
  197. package/telemetry/src/react/index.d.ts +1 -1
  198. package/telemetry/src/react/telemetry.d.ts +1 -1
  199. package/telemetry/src/server/context.d.ts +1 -1
  200. package/telemetry/src/server/headers/extractor.d.ts +1 -1
  201. package/telemetry/src/server/headers/index.d.ts +1 -1
  202. package/telemetry/src/server/headers/presets.d.ts +1 -1
  203. package/telemetry/src/server/index.d.ts +1 -1
  204. package/telemetry/src/server/instrumentation.d.ts +1 -1
  205. package/telemetry/src/server/plugin.d.ts +1 -1
  206. package/telemetry/src/server/sourcemap.d.ts +1 -1
package/core/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.4
2
+ * reroute-js v1.0.0-alpha.6
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -390,14 +390,14 @@ var init_negotiate = () => {};
390
390
  // packages/core/src/i18n/pathname.ts
391
391
  var exports_pathname = {};
392
392
  __export(exports_pathname, {
393
- toOgLocale: () => toOgLocale,
394
- parseContentPath: () => parseContentPath,
395
- normalizePathname: () => normalizePathname,
396
- looksLikeLocale: () => looksLikeLocale,
397
- localizeHref: () => localizeHref,
398
- localizeContentHref: () => localizeContentHref,
393
+ contentKey: () => contentKey,
399
394
  hreflangTags: () => hreflangTags,
400
- contentKey: () => contentKey
395
+ localizeContentHref: () => localizeContentHref,
396
+ localizeHref: () => localizeHref,
397
+ looksLikeLocale: () => looksLikeLocale,
398
+ normalizePathname: () => normalizePathname,
399
+ parseContentPath: () => parseContentPath,
400
+ toOgLocale: () => toOgLocale
401
401
  });
402
402
  function looksLikeLocale(segment) {
403
403
  return /^[a-z]{2}(?:-[A-Za-z0-9]{2,8})*$/i.test(segment);
@@ -1049,11 +1049,39 @@ function cleanupPathScopedSSRData(pathname) {
1049
1049
  }
1050
1050
 
1051
1051
  // packages/core/src/ssr/lib/imports.ts
1052
+ import { copyFile, realpath, stat as stat3, unlink } from "node:fs/promises";
1053
+ import { basename as basename2, dirname, extname as extname2, join as join3 } from "node:path";
1052
1054
  import { pathToFileURL as pathToFileURL3 } from "node:url";
1055
+ function clearWatchImportCache() {
1056
+ watchImportCache.clear();
1057
+ }
1058
+ function bustCopyPath(absolutePath) {
1059
+ const dir = dirname(absolutePath);
1060
+ const ext = extname2(absolutePath);
1061
+ const base = basename2(absolutePath, ext);
1062
+ const token = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
1063
+ return join3(dir, `${base}.bust-${token}${ext}`);
1064
+ }
1053
1065
  async function dynamicImport(absolutePath, isWatchMode) {
1054
1066
  const href = pathToFileURL3(absolutePath).href;
1055
- const url = isWatchMode ? `${href}?t=${Date.now()}` : href;
1056
- return await import(url);
1067
+ if (!isWatchMode) {
1068
+ return await import(href);
1069
+ }
1070
+ const resolved = await realpath(absolutePath);
1071
+ const mtimeMs = (await stat3(resolved)).mtimeMs;
1072
+ const cached = watchImportCache.get(resolved);
1073
+ if (cached && cached.mtimeMs === mtimeMs) {
1074
+ return cached.mod;
1075
+ }
1076
+ const tmp = bustCopyPath(resolved);
1077
+ await copyFile(resolved, tmp);
1078
+ try {
1079
+ const mod = await import(pathToFileURL3(tmp).href);
1080
+ watchImportCache.set(resolved, { mtimeMs, mod });
1081
+ return mod;
1082
+ } finally {
1083
+ await unlink(tmp).catch(() => {});
1084
+ }
1057
1085
  }
1058
1086
  function isThenable(value) {
1059
1087
  return typeof value === "object" && value !== null && typeof value.then === "function";
@@ -1061,7 +1089,10 @@ function isThenable(value) {
1061
1089
  function toPromise(input) {
1062
1090
  return input instanceof Promise ? input : Promise.resolve(input);
1063
1091
  }
1064
- var init_imports = () => {};
1092
+ var watchImportCache;
1093
+ var init_imports = __esm(() => {
1094
+ watchImportCache = new Map;
1095
+ });
1065
1096
 
1066
1097
  // packages/core/src/ssr/lib/collections.ts
1067
1098
  async function loadCollections(cwd, isWatchMode) {
@@ -1851,7 +1882,7 @@ var init_compute = __esm(() => {
1851
1882
  });
1852
1883
 
1853
1884
  // packages/core/src/ssr/lib/modules.ts
1854
- import { readdir as readdir3, stat as stat3 } from "node:fs/promises";
1885
+ import { readdir as readdir3, stat as stat4 } from "node:fs/promises";
1855
1886
  async function importContentModuleForPath(pathname, clientDir, cwd, isWatchMode) {
1856
1887
  try {
1857
1888
  const resolved = resolveContentPathParts(pathname);
@@ -1909,7 +1940,7 @@ async function tryChunkImport(collection, name, cwd, isWatchMode) {
1909
1940
  let latestM = 0;
1910
1941
  for (const f of matches) {
1911
1942
  try {
1912
- const s = await stat3(join(chunkDir, f));
1943
+ const s = await stat4(join(chunkDir, f));
1913
1944
  if (s.mtimeMs >= latestM) {
1914
1945
  latestM = s.mtimeMs;
1915
1946
  latest = f;
@@ -1966,6 +1997,16 @@ function touchModule(key) {
1966
1997
  evictLRUModule();
1967
1998
  }
1968
1999
  }
2000
+ function clearSSRModuleStores() {
2001
+ const g = globalThis;
2002
+ if (g.__REROUTE_SSR_MODULES__) {
2003
+ g.__REROUTE_SSR_MODULES__ = {};
2004
+ }
2005
+ if (g.__REROUTE_SSR_EXPORTS__) {
2006
+ g.__REROUTE_SSR_EXPORTS__ = {};
2007
+ }
2008
+ moduleAccessOrder.length = 0;
2009
+ }
1969
2010
  async function seedSSRModuleForPath(pathname, clientDir, cwd, isWatchMode) {
1970
2011
  try {
1971
2012
  const resolved = resolveContentPathParts(pathname);
@@ -2950,7 +2991,7 @@ var init_metadata2 = __esm(() => {
2950
2991
  });
2951
2992
 
2952
2993
  // packages/core/src/ssr/lib/preload.ts
2953
- import { readdir as readdir5, stat as stat4 } from "node:fs/promises";
2994
+ import { readdir as readdir5, stat as stat5 } from "node:fs/promises";
2954
2995
  async function preloadContentModule(pathname, clientDir, cwd, isWatchMode) {
2955
2996
  let extraHead = "";
2956
2997
  let hydrationScript = "";
@@ -2984,14 +3025,14 @@ async function isContentCollection(clientDir, collection) {
2984
3025
  if (isProduction) {
2985
3026
  const collectionFile = join(clientDir, "collections", `${collection}.js`);
2986
3027
  try {
2987
- const s2 = await stat4(collectionFile);
3028
+ const s2 = await stat5(collectionFile);
2988
3029
  return s2?.isFile() ?? false;
2989
3030
  } catch {
2990
3031
  return false;
2991
3032
  }
2992
3033
  }
2993
3034
  const maybeDir = join(clientDir, "routes", collection, "content");
2994
- const s = await stat4(maybeDir);
3035
+ const s = await stat5(maybeDir);
2995
3036
  return typeof s?.isDirectory === "function" ? s.isDirectory() : true;
2996
3037
  } catch {
2997
3038
  return false;
@@ -3002,7 +3043,7 @@ async function findLatestCandidate(chunkDir, candidates) {
3002
3043
  let latestM = 0;
3003
3044
  for (const candidateName of candidates) {
3004
3045
  try {
3005
- const s = await stat4(join(chunkDir, candidateName));
3046
+ const s = await stat5(join(chunkDir, candidateName));
3006
3047
  if (s.mtimeMs >= latestM) {
3007
3048
  latestM = s.mtimeMs;
3008
3049
  latest = candidateName;
@@ -3390,15 +3431,15 @@ var init_scripts = __esm(() => {
3390
3431
  // packages/core/src/ssr/lib/styles.ts
3391
3432
  async function inlineThemeCSS(clientDir, minify = false, isWatchMode = false) {
3392
3433
  try {
3434
+ if (isWatchMode) {
3435
+ const timestamp = Date.now();
3436
+ return `<link rel="stylesheet" href="/.reroute/index.css?t=${timestamp}" data-reroute="theme">`;
3437
+ }
3393
3438
  const bundledCss = globalThis.__REROUTE_THEME_CSS__;
3394
3439
  if (bundledCss) {
3395
3440
  const css2 = minify ? minifyCSS(bundledCss) : bundledCss;
3396
3441
  return `<style data-reroute="theme">${css2}</style>`;
3397
3442
  }
3398
- if (isWatchMode) {
3399
- const timestamp = Date.now();
3400
- return `<link rel="stylesheet" href="/.reroute/index.css?t=${timestamp}" data-reroute="theme">`;
3401
- }
3402
3443
  const candidates = [
3403
3444
  join(clientDir, "..", ".reroute", "index.css"),
3404
3445
  join(clientDir, "..", "..", ".reroute", "index.css"),
@@ -4117,10 +4158,10 @@ var init_extractor = __esm(() => {
4117
4158
  // packages/core/src/llms/index-generator.ts
4118
4159
  var exports_index_generator = {};
4119
4160
  __export(exports_index_generator, {
4120
- generateLLMsIndex: () => generateLLMsIndex,
4121
- discoverStaticRoutes: () => discoverStaticRoutes,
4161
+ discoverCollectionRoutes: () => discoverCollectionRoutes,
4122
4162
  discoverSSRDataRoutes: () => discoverSSRDataRoutes,
4123
- discoverCollectionRoutes: () => discoverCollectionRoutes
4163
+ discoverStaticRoutes: () => discoverStaticRoutes,
4164
+ generateLLMsIndex: () => generateLLMsIndex
4124
4165
  });
4125
4166
  import { pathToFileURL as pathToFileURL6 } from "node:url";
4126
4167
  async function discoverStaticRoutes(cwd, isWatchMode) {
@@ -4341,8 +4382,8 @@ function formatRouteUrl(routePath, baseUrl) {
4341
4382
  function getRouteTitle(route) {
4342
4383
  return route.title || (route.path === "/" ? "Home" : route.path.split("/").pop() || "Page");
4343
4384
  }
4344
- function addRootRoutes(parts, rootRoutes, baseUrl, isSingleCollection) {
4345
- if (isSingleCollection || rootRoutes.length === 0)
4385
+ function addRootRoutes(parts, rootRoutes, baseUrl, isScoped) {
4386
+ if (isScoped || rootRoutes.length === 0)
4346
4387
  return;
4347
4388
  for (const route of rootRoutes) {
4348
4389
  const title = getRouteTitle(route);
@@ -4365,12 +4406,12 @@ function addCollectionSection(parts, collection, routes, baseUrl, llmsConfig) {
4365
4406
  }
4366
4407
  parts.push("");
4367
4408
  }
4368
- function shouldIncludeSection(section, isSingleCollection, targetCollection) {
4369
- return !isSingleCollection || section === targetCollection;
4409
+ function shouldIncludeSection(section, isScoped, targetCollection) {
4410
+ return !isScoped || section === targetCollection;
4370
4411
  }
4371
- function addSSRDataSection(parts, routePattern, routes, baseUrl, isSingleCollection, targetCollection, llmsConfig) {
4412
+ function addSSRDataSection(parts, routePattern, routes, baseUrl, isScoped, targetCollection, llmsConfig) {
4372
4413
  const routeSection = routePattern.split("/").filter(Boolean)[0];
4373
- if (!shouldIncludeSection(routeSection, isSingleCollection, targetCollection)) {
4414
+ if (!shouldIncludeSection(routeSection, isScoped, targetCollection)) {
4374
4415
  return;
4375
4416
  }
4376
4417
  const filteredRoutes = routes.filter((r) => !shouldExcludeRoute(r.path, llmsConfig?.excludeRoutes));
@@ -4386,8 +4427,8 @@ function addSSRDataSection(parts, routePattern, routes, baseUrl, isSingleCollect
4386
4427
  }
4387
4428
  parts.push("");
4388
4429
  }
4389
- function addStaticSection(parts, section, routes, baseUrl, isSingleCollection, targetCollection, collectionsMap, llmsConfig) {
4390
- if (!shouldIncludeSection(section, isSingleCollection, targetCollection)) {
4430
+ function addStaticSection(parts, section, routes, baseUrl, isScoped, targetCollection, collectionsMap, llmsConfig) {
4431
+ if (!shouldIncludeSection(section, isScoped, targetCollection)) {
4391
4432
  return;
4392
4433
  }
4393
4434
  const filteredRoutes = routes.filter((r) => !shouldExcludeRoute(r.path, llmsConfig?.excludeRoutes));
@@ -4405,15 +4446,15 @@ function addStaticSection(parts, section, routes, baseUrl, isSingleCollection, t
4405
4446
  }
4406
4447
  async function generateLLMsIndex(options) {
4407
4448
  const { cwd, collections: collections2, baseUrl, isWatchMode, llmsConfig } = options;
4449
+ const targetCollection = options.targetCollection ?? null;
4450
+ const isScoped = targetCollection !== null;
4408
4451
  const parts = [];
4409
4452
  addIndexHeader(parts, llmsConfig);
4410
4453
  const staticRoutes = await discoverStaticRoutes(cwd, isWatchMode);
4411
4454
  const collectionsMap = await discoverCollectionRoutes(cwd, collections2, isWatchMode, llmsConfig);
4412
4455
  const ssrDataRoutes = await discoverSSRDataRoutes(cwd, staticRoutes, isWatchMode);
4413
- const isSingleCollection = collections2.length === 1;
4414
- const targetCollection = isSingleCollection ? collections2[0] : null;
4415
4456
  const { sections, rootRoutes } = groupStaticRoutes(staticRoutes, llmsConfig);
4416
- addRootRoutes(parts, rootRoutes, baseUrl, isSingleCollection);
4457
+ addRootRoutes(parts, rootRoutes, baseUrl, isScoped);
4417
4458
  for (const [collection, routes] of collectionsMap.entries()) {
4418
4459
  if (routes.length > 0) {
4419
4460
  addCollectionSection(parts, collection, routes, baseUrl, llmsConfig);
@@ -4421,17 +4462,20 @@ async function generateLLMsIndex(options) {
4421
4462
  }
4422
4463
  for (const [routePattern, routes] of ssrDataRoutes.entries()) {
4423
4464
  if (routes.length > 0) {
4424
- addSSRDataSection(parts, routePattern, routes, baseUrl, isSingleCollection, targetCollection, llmsConfig);
4465
+ addSSRDataSection(parts, routePattern, routes, baseUrl, isScoped, targetCollection, llmsConfig);
4425
4466
  }
4426
4467
  }
4427
4468
  for (const [section, routes] of sections.entries()) {
4428
4469
  if (routes.length > 0) {
4429
- addStaticSection(parts, section, routes, baseUrl, isSingleCollection, targetCollection, collectionsMap, llmsConfig);
4470
+ addStaticSection(parts, section, routes, baseUrl, isScoped, targetCollection, collectionsMap, llmsConfig);
4430
4471
  }
4431
4472
  }
4432
4473
  parts.push("---");
4433
4474
  parts.push("");
4434
4475
  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
+ }
4435
4479
  return parts.join(`
4436
4480
  `);
4437
4481
  }
@@ -4489,6 +4533,9 @@ async function discoverAllRoutes(cwd, collections2, isWatchMode, llmsConfig) {
4489
4533
  }
4490
4534
  return allRoutes;
4491
4535
  }
4536
+ function routeBelongsToCollection(path2, collection) {
4537
+ return path2 === `/${collection}` || path2.startsWith(`/${collection}/`);
4538
+ }
4492
4539
  function formatContentBlock(content, routePath, baseUrl) {
4493
4540
  const parts = [];
4494
4541
  const lines = content.split(`
@@ -4558,7 +4605,9 @@ function buildFooter(parts) {
4558
4605
  async function generateLLMsFullContent(options) {
4559
4606
  const { cwd, collections: collections2, baseUrl, isWatchMode, llmsConfig } = options;
4560
4607
  const parts = buildHeader(baseUrl, llmsConfig);
4561
- const allRoutes = await discoverAllRoutes(cwd, collections2, isWatchMode, llmsConfig);
4608
+ const discovered = await discoverAllRoutes(cwd, collections2, isWatchMode, llmsConfig);
4609
+ const targetCollection = options.targetCollection;
4610
+ const allRoutes = targetCollection ? discovered.filter((route) => routeBelongsToCollection(route.path, targetCollection)) : discovered;
4562
4611
  const maxItems = llmsConfig?.maxItems || 1e4;
4563
4612
  const routesToProcess = allRoutes.slice(0, maxItems);
4564
4613
  const extracted = await extractRouteContents(routesToProcess, options);
@@ -4903,10 +4952,10 @@ var init_robots = __esm(() => {
4903
4952
  // packages/core/src/sitemap/discovery.ts
4904
4953
  var exports_discovery = {};
4905
4954
  __export(exports_discovery, {
4906
- discoverSitemapData: () => discoverSitemapData,
4907
- discoverSSRDataRoutes: () => discoverSSRDataRoutes2,
4955
+ discoverCollectionContent: () => discoverCollectionContent,
4908
4956
  discoverRoutes: () => discoverRoutes,
4909
- discoverCollectionContent: () => discoverCollectionContent
4957
+ discoverSSRDataRoutes: () => discoverSSRDataRoutes2,
4958
+ discoverSitemapData: () => discoverSitemapData
4910
4959
  });
4911
4960
  async function loadRoutesModule2(cwd, isWatchMode) {
4912
4961
  let routes = globalThis.__REROUTE_ROUTES__;
@@ -6194,137 +6243,139 @@ var init_core = __esm(() => {
6194
6243
  init_core();
6195
6244
 
6196
6245
  export {
6197
- toPromise,
6198
- toOgLocale,
6199
- toBytes,
6200
- stripStart,
6201
- stripHtmlTags,
6202
- stripEnd,
6203
- statusCache,
6204
- ssrCache,
6205
- splitTemplate,
6206
- shouldExcludeRoute,
6207
- setGlobalSSRData,
6208
- setGlobalCollections,
6209
- seedSSRModuleForPath,
6210
- resolveLocale,
6211
- resetSSRAccessTracking,
6212
- renderSSRDocumentStream,
6213
- renderSSRDocument,
6214
- renderOGImageToPNG,
6215
- removeOverriddenMetaTags,
6216
- processCollections,
6217
- preloadContentModule,
6218
- performSSRSetup,
6219
- parseCookieValue,
6220
- parseContentPath,
6221
- normalizePathname,
6222
- negotiateLocale,
6223
- mergeLayoutData,
6224
- matchRoutes,
6225
- matchRoutePattern,
6226
- lookupMessage,
6227
- looksLikeLocale,
6228
- localizeHref,
6229
- localizeContentHref,
6230
- loadRoutesModule,
6231
- loadOGImageComponent,
6232
- loadIndexHtml,
6233
- loadConfig,
6234
- loadCollections,
6235
- listContentFiles,
6236
- join,
6237
- isThenable,
6238
- isCompressible,
6239
- inlineThemeCSS,
6240
- importContentModuleForPath,
6241
- htmlToMarkdown,
6242
- hreflangTags,
6243
- gzipIfAccepted,
6244
- getSitemapExcludedRoutes,
6245
- getRedirectSourcePaths,
6246
- getPatternDepth,
6247
- getMimeType,
6248
- getMessage,
6249
- getMatchingLayouts,
6250
- getContentMeta,
6251
- generateSitemapXML,
6252
- generateSitemapIndexXML,
6253
- generateSitemap,
6254
- generateRobots,
6255
- generateRSSXML,
6256
- generateOGImageMetaTags,
6257
- generateLLMsIndex,
6258
- generateLLMsFullContent,
6259
- generateLLMsFooter,
6260
- generateHydrationScripts,
6261
- generateFeed,
6262
- generateContentHash,
6263
- generateCollectionScripts,
6264
- generateAtomXML,
6265
- formatMessage,
6266
- formatAsText,
6267
- formatAsMarkdown,
6268
- findOGImageForPath,
6269
- extractTitle,
6270
- extractParamsFromPath,
6271
- extractPageMetadata,
6272
- extractContentForLLMs,
6273
- extname,
6274
- escapeXml2 as escapeXml,
6275
- escapeJsonForScript,
6276
- dynamicImport,
6277
- duplicateQueryParamData,
6278
- discoverSitemapData,
6279
- discoverSSRDataRoutes2 as discoverSSRDataRoutes,
6280
- discoverSSRDataFeedItems,
6281
- discoverRoutesForRobots,
6282
- discoverRoutes,
6283
- discoverRobotsData,
6284
- discoverRSSData,
6285
- discoverI18n,
6286
- discoverCollections,
6287
- discoverCollectionContent,
6288
- defineConfig,
6289
- deduplicateMetaTags,
6290
- createTranslator,
6291
- createLlmsScript,
6292
- createLayoutDataKey,
6293
- createLayoutCacheKey,
6294
- createFeedsScript,
6295
- createDataScript,
6296
- createCollectionScript,
6297
- createBundlePreload,
6298
- contentNegotiateRedirect,
6299
- contentKey,
6300
- computeSSRDataForPath,
6301
- computeSSRData,
6302
- computeRouteData,
6303
- computeLayoutData,
6304
- computeContentData,
6305
- compressStreamIfAccepted,
6306
- compareRouteSpecificity,
6307
- cleanupPathScopedSSRData,
6308
- buildLocaleCookie,
6309
- buildHeadFromMeta,
6310
- blockSearchCrawlers,
6311
- blockAITrainingCrawlers,
6312
- blockAICrawlers,
6313
- basename,
6314
- applyIndexTemplate,
6315
- allowSearchCrawlers,
6316
- allowAICrawlers,
6317
- acceptsGzip,
6318
- acceptsBrotli,
6319
- TTLCache,
6320
- SSRDataCache,
6321
- SEARCH_CRAWLERS,
6322
- LRUCache,
6323
- DefaultOGTemplate,
6324
- DEFAULT_LOCALES_DIR,
6325
- DEFAULT_LOCALE,
6246
+ AI_CRAWLERS,
6326
6247
  DEFAULT_COOKIE,
6327
- AI_CRAWLERS
6248
+ DEFAULT_LOCALE,
6249
+ DEFAULT_LOCALES_DIR,
6250
+ DefaultOGTemplate,
6251
+ LRUCache,
6252
+ SEARCH_CRAWLERS,
6253
+ SSRDataCache,
6254
+ TTLCache,
6255
+ acceptsBrotli,
6256
+ acceptsGzip,
6257
+ allowAICrawlers,
6258
+ allowSearchCrawlers,
6259
+ applyIndexTemplate,
6260
+ basename,
6261
+ blockAICrawlers,
6262
+ blockAITrainingCrawlers,
6263
+ blockSearchCrawlers,
6264
+ buildHeadFromMeta,
6265
+ buildLocaleCookie,
6266
+ cleanupPathScopedSSRData,
6267
+ clearSSRModuleStores,
6268
+ clearWatchImportCache,
6269
+ compareRouteSpecificity,
6270
+ compressStreamIfAccepted,
6271
+ computeContentData,
6272
+ computeLayoutData,
6273
+ computeRouteData,
6274
+ computeSSRData,
6275
+ computeSSRDataForPath,
6276
+ contentKey,
6277
+ contentNegotiateRedirect,
6278
+ createBundlePreload,
6279
+ createCollectionScript,
6280
+ createDataScript,
6281
+ createFeedsScript,
6282
+ createLayoutCacheKey,
6283
+ createLayoutDataKey,
6284
+ createLlmsScript,
6285
+ createTranslator,
6286
+ deduplicateMetaTags,
6287
+ defineConfig,
6288
+ discoverCollectionContent,
6289
+ discoverCollections,
6290
+ discoverI18n,
6291
+ discoverRSSData,
6292
+ discoverRobotsData,
6293
+ discoverRoutes,
6294
+ discoverRoutesForRobots,
6295
+ discoverSSRDataFeedItems,
6296
+ discoverSSRDataRoutes2 as discoverSSRDataRoutes,
6297
+ discoverSitemapData,
6298
+ duplicateQueryParamData,
6299
+ dynamicImport,
6300
+ escapeJsonForScript,
6301
+ escapeXml2 as escapeXml,
6302
+ extname,
6303
+ extractContentForLLMs,
6304
+ extractPageMetadata,
6305
+ extractParamsFromPath,
6306
+ extractTitle,
6307
+ findOGImageForPath,
6308
+ formatAsMarkdown,
6309
+ formatAsText,
6310
+ formatMessage,
6311
+ generateAtomXML,
6312
+ generateCollectionScripts,
6313
+ generateContentHash,
6314
+ generateFeed,
6315
+ generateHydrationScripts,
6316
+ generateLLMsFooter,
6317
+ generateLLMsFullContent,
6318
+ generateLLMsIndex,
6319
+ generateOGImageMetaTags,
6320
+ generateRSSXML,
6321
+ generateRobots,
6322
+ generateSitemap,
6323
+ generateSitemapIndexXML,
6324
+ generateSitemapXML,
6325
+ getContentMeta,
6326
+ getMatchingLayouts,
6327
+ getMessage,
6328
+ getMimeType,
6329
+ getPatternDepth,
6330
+ getRedirectSourcePaths,
6331
+ getSitemapExcludedRoutes,
6332
+ gzipIfAccepted,
6333
+ hreflangTags,
6334
+ htmlToMarkdown,
6335
+ importContentModuleForPath,
6336
+ inlineThemeCSS,
6337
+ isCompressible,
6338
+ isThenable,
6339
+ join,
6340
+ listContentFiles,
6341
+ loadCollections,
6342
+ loadConfig,
6343
+ loadIndexHtml,
6344
+ loadOGImageComponent,
6345
+ loadRoutesModule,
6346
+ localizeContentHref,
6347
+ localizeHref,
6348
+ looksLikeLocale,
6349
+ lookupMessage,
6350
+ matchRoutePattern,
6351
+ matchRoutes,
6352
+ mergeLayoutData,
6353
+ negotiateLocale,
6354
+ normalizePathname,
6355
+ parseContentPath,
6356
+ parseCookieValue,
6357
+ performSSRSetup,
6358
+ preloadContentModule,
6359
+ processCollections,
6360
+ removeOverriddenMetaTags,
6361
+ renderOGImageToPNG,
6362
+ renderSSRDocument,
6363
+ renderSSRDocumentStream,
6364
+ resetSSRAccessTracking,
6365
+ resolveLocale,
6366
+ seedSSRModuleForPath,
6367
+ setGlobalCollections,
6368
+ setGlobalSSRData,
6369
+ shouldExcludeRoute,
6370
+ splitTemplate,
6371
+ ssrCache,
6372
+ statusCache,
6373
+ stripEnd,
6374
+ stripHtmlTags,
6375
+ stripStart,
6376
+ toBytes,
6377
+ toOgLocale,
6378
+ toPromise
6328
6379
  };
6329
6380
 
6330
- //# debugId=D5B84417D804DD6B64756E2164756E21
6381
+ //# debugId=F25428F1DCD3BB1C64756E2164756E21