reroute-js 0.34.8 → 0.35.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 (186) hide show
  1. package/cli/bin.d.ts +1 -1
  2. package/cli/bin.js +178 -71
  3. package/cli/bin.js.map +8 -8
  4. package/cli/index.d.ts +1 -1
  5. package/cli/index.js +4 -4
  6. package/cli/index.js.map +1 -1
  7. package/cli/src/cli.d.ts +1 -1
  8. package/cli/src/commands/analyze.d.ts +1 -1
  9. package/cli/src/commands/build.d.ts +1 -1
  10. package/cli/src/commands/dev.d.ts +1 -1
  11. package/cli/src/commands/gen.d.ts +1 -1
  12. package/cli/src/commands/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 +174 -67
  35. package/core/index.js.map +8 -8
  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 +3 -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/full-generator.d.ts.map +1 -1
  48. package/core/src/llms/index-generator.d.ts +2 -3
  49. package/core/src/llms/index-generator.d.ts.map +1 -1
  50. package/core/src/llms/index.d.ts +1 -1
  51. package/core/src/og/discovery.d.ts +1 -1
  52. package/core/src/og/index.d.ts +1 -1
  53. package/core/src/og/meta.d.ts +1 -1
  54. package/core/src/og/render.d.ts +1 -1
  55. package/core/src/og/types.d.ts +1 -1
  56. package/core/src/robots/discovery.d.ts +1 -1
  57. package/core/src/robots/discovery.d.ts.map +1 -1
  58. package/core/src/robots/generator.d.ts +1 -1
  59. package/core/src/robots/index.d.ts +1 -1
  60. package/core/src/robots/policies.d.ts +1 -1
  61. package/core/src/rss/discovery.d.ts +4 -4
  62. package/core/src/rss/discovery.d.ts.map +1 -1
  63. package/core/src/rss/generator.d.ts +1 -1
  64. package/core/src/rss/index.d.ts +1 -1
  65. package/core/src/sitemap/discovery.d.ts +3 -3
  66. package/core/src/sitemap/discovery.d.ts.map +1 -1
  67. package/core/src/sitemap/generator.d.ts +1 -1
  68. package/core/src/sitemap/index.d.ts +1 -1
  69. package/core/src/ssr/index.d.ts +1 -1
  70. package/core/src/ssr/lib/cache.d.ts +1 -1
  71. package/core/src/ssr/lib/collections.d.ts +1 -1
  72. package/core/src/ssr/lib/compression.d.ts +1 -1
  73. package/core/src/ssr/lib/compute/content.d.ts +1 -1
  74. package/core/src/ssr/lib/compute/index.d.ts +1 -1
  75. package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
  76. package/core/src/ssr/lib/compute/routes.d.ts +1 -1
  77. package/core/src/ssr/lib/data.d.ts +1 -1
  78. package/core/src/ssr/lib/html.d.ts +1 -1
  79. package/core/src/ssr/lib/imports.d.ts +1 -1
  80. package/core/src/ssr/lib/index.d.ts +1 -1
  81. package/core/src/ssr/lib/layouts.d.ts +1 -1
  82. package/core/src/ssr/lib/metadata.d.ts +1 -1
  83. package/core/src/ssr/lib/mime.d.ts +1 -1
  84. package/core/src/ssr/lib/modules.d.ts +1 -1
  85. package/core/src/ssr/lib/path.d.ts +1 -1
  86. package/core/src/ssr/lib/preload.d.ts +1 -1
  87. package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
  88. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  89. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  90. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  91. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  92. package/core/src/ssr/lib/seed.d.ts +1 -1
  93. package/core/src/ssr/lib/serialize.d.ts +1 -1
  94. package/core/src/ssr/lib/setup.d.ts +1 -1
  95. package/core/src/ssr/lib/styles.d.ts +1 -1
  96. package/core/src/ssr/lib/template.d.ts +1 -1
  97. package/core/src/ssr/lib/types.d.ts +1 -1
  98. package/core/src/ssr/render.d.ts +1 -1
  99. package/core/src/ssr/stream.d.ts +1 -1
  100. package/elysia/index.d.ts +1 -1
  101. package/elysia/index.js +189 -82
  102. package/elysia/index.js.map +13 -13
  103. package/elysia/src/index.d.ts +1 -1
  104. package/elysia/src/libs/assets.d.ts +1 -1
  105. package/elysia/src/libs/cache.d.ts +1 -1
  106. package/elysia/src/libs/caching.d.ts +1 -1
  107. package/elysia/src/libs/http.d.ts +1 -1
  108. package/elysia/src/libs/image.d.ts +1 -1
  109. package/elysia/src/libs/index.d.ts +1 -1
  110. package/elysia/src/libs/llms.d.ts +1 -1
  111. package/elysia/src/libs/response.d.ts +1 -1
  112. package/elysia/src/libs/serving.d.ts +1 -1
  113. package/elysia/src/plugin.d.ts +1 -1
  114. package/elysia/src/plugin.d.ts.map +1 -1
  115. package/elysia/src/routes/artifacts.d.ts +1 -1
  116. package/elysia/src/routes/content.d.ts +1 -1
  117. package/elysia/src/routes/image.d.ts +1 -1
  118. package/elysia/src/routes/index.d.ts +1 -1
  119. package/elysia/src/routes/internal.d.ts +1 -1
  120. package/elysia/src/routes/llms.d.ts +1 -1
  121. package/elysia/src/routes/llms.d.ts.map +1 -1
  122. package/elysia/src/routes/og.d.ts +1 -1
  123. package/elysia/src/routes/redirects.d.ts +1 -1
  124. package/elysia/src/routes/redirects.d.ts.map +1 -1
  125. package/elysia/src/routes/robots.d.ts +1 -1
  126. package/elysia/src/routes/rss.d.ts +1 -1
  127. package/elysia/src/routes/rss.d.ts.map +1 -1
  128. package/elysia/src/routes/search.d.ts +1 -1
  129. package/elysia/src/routes/sitemap.d.ts +1 -2
  130. package/elysia/src/routes/sitemap.d.ts.map +1 -1
  131. package/elysia/src/routes/ssr.d.ts +1 -1
  132. package/elysia/src/routes/static.d.ts +1 -1
  133. package/elysia/src/types.d.ts +1 -1
  134. package/package.json +1 -1
  135. package/react/index.d.ts +1 -1
  136. package/react/index.js +2 -2
  137. package/react/index.js.map +1 -1
  138. package/react/src/components/ClientOnly.d.ts +1 -1
  139. package/react/src/components/ContentRoute.d.ts +1 -1
  140. package/react/src/components/Image.d.ts +1 -1
  141. package/react/src/components/LazyRoute.d.ts +1 -1
  142. package/react/src/components/Link.d.ts +1 -1
  143. package/react/src/components/Markdown.d.ts +1 -1
  144. package/react/src/components/Outlet.d.ts +1 -1
  145. package/react/src/components/index.d.ts +1 -1
  146. package/react/src/hooks/index.d.ts +1 -1
  147. package/react/src/hooks/useContent.d.ts +1 -1
  148. package/react/src/hooks/useData.d.ts +1 -1
  149. package/react/src/hooks/useFeed.d.ts +1 -1
  150. package/react/src/hooks/useLayoutData.d.ts +1 -1
  151. package/react/src/hooks/useLlms.d.ts +1 -1
  152. package/react/src/hooks/useNavigate.d.ts +1 -1
  153. package/react/src/hooks/useParams.d.ts +1 -1
  154. package/react/src/hooks/useRouter.d.ts +1 -1
  155. package/react/src/hooks/useSearch.d.ts +1 -1
  156. package/react/src/hooks/useSearchParams.d.ts +1 -1
  157. package/react/src/hooks/useToc.d.ts +1 -1
  158. package/react/src/index.d.ts +1 -1
  159. package/react/src/lib/collection.d.ts +1 -1
  160. package/react/src/lib/content.d.ts +1 -1
  161. package/react/src/lib/head.d.ts +1 -1
  162. package/react/src/lib/index.d.ts +1 -1
  163. package/react/src/lib/lazy-route.d.ts +1 -1
  164. package/react/src/lib/route-loader.d.ts +1 -1
  165. package/react/src/providers/ContentProvider.d.ts +1 -1
  166. package/react/src/providers/RerouteProvider.d.ts +1 -1
  167. package/react/src/providers/RouterProvider.d.ts +1 -1
  168. package/react/src/providers/index.d.ts +1 -1
  169. package/react/src/types/any.d.ts +1 -1
  170. package/react/src/types/index.d.ts +1 -1
  171. package/react/src/types/router.d.ts +1 -1
  172. package/telemetry/react.d.ts +1 -1
  173. package/telemetry/react.js +2 -2
  174. package/telemetry/react.js.map +1 -1
  175. package/telemetry/server.d.ts +1 -1
  176. package/telemetry/server.js +2 -2
  177. package/telemetry/server.js.map +5 -5
  178. package/telemetry/src/react/api.d.ts +1 -1
  179. package/telemetry/src/react/context.d.ts +1 -1
  180. package/telemetry/src/react/index.d.ts +1 -1
  181. package/telemetry/src/react/telemetry.d.ts +1 -1
  182. package/telemetry/src/server/context.d.ts +1 -1
  183. package/telemetry/src/server/index.d.ts +1 -1
  184. package/telemetry/src/server/instrumentation.d.ts +1 -1
  185. package/telemetry/src/server/plugin.d.ts +1 -1
  186. package/telemetry/src/server/sourcemap.d.ts +1 -1
package/cli/bin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.34.8
2
+ * reroute-js v0.35.0
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2025 stewones <hi@stewan.io>
package/cli/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
3
  /**
4
- * reroute-js v0.34.8
4
+ * reroute-js v0.35.0
5
5
  *
6
6
  * @license MIT
7
7
  * @copyright 2025 stewones <hi@stewan.io>
@@ -48,7 +48,7 @@ async function getVersionString() {
48
48
  }
49
49
  async function getVersion() {
50
50
  if (true) {
51
- return "0.34.8";
51
+ return "0.35.0";
52
52
  }
53
53
  const possiblePaths = [
54
54
  path.join(import.meta.dir, "../../../../package.json"),
@@ -66,7 +66,7 @@ async function getVersion() {
66
66
  }
67
67
  async function getCommit() {
68
68
  if (true) {
69
- return "61ce1ff";
69
+ return "e2f562f";
70
70
  }
71
71
  return "dev";
72
72
  }
@@ -3424,9 +3424,9 @@ async function discoverCollectionRoutes(cwd, collections2, isWatchMode, llmsConf
3424
3424
  }
3425
3425
  return collectionsMap;
3426
3426
  }
3427
- async function loadRouteModule(clientDir, routePath, isWatchMode) {
3427
+ async function loadRouteModule(cwd, routePath, isWatchMode) {
3428
3428
  try {
3429
- const abs = join2(clientDir, "routes", routePath);
3429
+ const abs = join2(cwd, "src", "client", "routes", routePath);
3430
3430
  const modUrl = `${pathToFileURL6(abs).href}${isWatchMode ? `?t=${Date.now()}` : ""}`;
3431
3431
  return await import(modUrl);
3432
3432
  } catch {
@@ -3459,24 +3459,47 @@ function createEntriesFromArray(array, routePath) {
3459
3459
  }
3460
3460
  return entries;
3461
3461
  }
3462
- async function discoverSSRDataRoutes(_cwd, clientDir, staticRoutes, isWatchMode) {
3462
+ async function discoverSSRDataRoutes(cwd, staticRoutes, isWatchMode) {
3463
3463
  const ssrDataRoutes = new Map;
3464
- for (const route of staticRoutes) {
3465
- const mod = await loadRouteModule(clientDir, route.path, isWatchMode);
3466
- if (!mod)
3467
- continue;
3468
- const ssr = mod?.ssr;
3469
- const dataFn = ssr?.data;
3470
- if (typeof dataFn !== "function")
3471
- continue;
3472
- const result = await callDataFunction(dataFn, route.path);
3473
- const arrays = findArraysInData(result);
3474
- for (const array of arrays) {
3475
- if (array.length === 0)
3464
+ const bundledRoutes = globalThis.__REROUTE_ROUTES__;
3465
+ if (bundledRoutes && Array.isArray(bundledRoutes)) {
3466
+ for (const route of staticRoutes) {
3467
+ const bundledRoute = bundledRoutes.find((r) => r?.path === route.path);
3468
+ if (!bundledRoute)
3469
+ continue;
3470
+ const ssr = bundledRoute?.ssr;
3471
+ const dataFn = ssr?.data;
3472
+ if (typeof dataFn !== "function")
3473
+ continue;
3474
+ const result = await callDataFunction(dataFn, route.path);
3475
+ const arrays = findArraysInData(result);
3476
+ for (const array of arrays) {
3477
+ if (array.length === 0)
3478
+ continue;
3479
+ const entries = createEntriesFromArray(array, route.path);
3480
+ if (entries.length > 0) {
3481
+ ssrDataRoutes.set(route.path, entries);
3482
+ }
3483
+ }
3484
+ }
3485
+ } else {
3486
+ for (const route of staticRoutes) {
3487
+ const mod = await loadRouteModule(cwd, route.path, isWatchMode);
3488
+ if (!mod)
3476
3489
  continue;
3477
- const entries = createEntriesFromArray(array, route.path);
3478
- if (entries.length > 0) {
3479
- ssrDataRoutes.set(route.path, entries);
3490
+ const ssr = mod?.ssr;
3491
+ const dataFn = ssr?.data;
3492
+ if (typeof dataFn !== "function")
3493
+ continue;
3494
+ const result = await callDataFunction(dataFn, route.path);
3495
+ const arrays = findArraysInData(result);
3496
+ for (const array of arrays) {
3497
+ if (array.length === 0)
3498
+ continue;
3499
+ const entries = createEntriesFromArray(array, route.path);
3500
+ if (entries.length > 0) {
3501
+ ssrDataRoutes.set(route.path, entries);
3502
+ }
3480
3503
  }
3481
3504
  }
3482
3505
  }
@@ -3599,12 +3622,12 @@ function addStaticSection(parts, section, routes, baseUrl, isSingleCollection, t
3599
3622
  parts.push("");
3600
3623
  }
3601
3624
  async function generateLLMsIndex(options) {
3602
- const { cwd, clientDir, collections: collections2, baseUrl, isWatchMode, llmsConfig } = options;
3625
+ const { cwd, collections: collections2, baseUrl, isWatchMode, llmsConfig } = options;
3603
3626
  const parts = [];
3604
3627
  addIndexHeader(parts, llmsConfig);
3605
3628
  const staticRoutes = await discoverStaticRoutes(cwd, isWatchMode);
3606
3629
  const collectionsMap = await discoverCollectionRoutes(cwd, collections2, isWatchMode, llmsConfig);
3607
- const ssrDataRoutes = await discoverSSRDataRoutes(cwd, clientDir, staticRoutes, isWatchMode);
3630
+ const ssrDataRoutes = await discoverSSRDataRoutes(cwd, staticRoutes, isWatchMode);
3608
3631
  const isSingleCollection = collections2.length === 1;
3609
3632
  const targetCollection = isSingleCollection ? collections2[0] : null;
3610
3633
  const { sections, rootRoutes } = groupStaticRoutes(staticRoutes, llmsConfig);
@@ -3653,7 +3676,7 @@ function buildHeader(baseUrl, llmsConfig) {
3653
3676
  }
3654
3677
  return parts;
3655
3678
  }
3656
- async function discoverAllRoutes(cwd, clientDir, collections2, isWatchMode, llmsConfig) {
3679
+ async function discoverAllRoutes(cwd, collections2, isWatchMode, llmsConfig) {
3657
3680
  const {
3658
3681
  discoverStaticRoutes: discoverStaticRoutes2,
3659
3682
  discoverCollectionRoutes: discoverCollectionRoutes2,
@@ -3661,7 +3684,7 @@ async function discoverAllRoutes(cwd, clientDir, collections2, isWatchMode, llms
3661
3684
  } = await Promise.resolve().then(() => (init_index_generator(), exports_index_generator));
3662
3685
  const staticRoutes = await discoverStaticRoutes2(cwd, isWatchMode);
3663
3686
  const collectionsMap = await discoverCollectionRoutes2(cwd, collections2, isWatchMode, llmsConfig);
3664
- const ssrDataRoutes = await discoverSSRDataRoutes2(cwd, clientDir, staticRoutes, isWatchMode);
3687
+ const ssrDataRoutes = await discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode);
3665
3688
  const allRoutes = [];
3666
3689
  for (const route of staticRoutes) {
3667
3690
  if (!shouldExcludeRoute(route.path, llmsConfig?.excludeRoutes)) {
@@ -3751,9 +3774,9 @@ function buildFooter(parts) {
3751
3774
  parts.push("Formats: .txt | .md | Accept: text/plain | Accept: text/markdown");
3752
3775
  }
3753
3776
  async function generateLLMsFullContent(options) {
3754
- const { cwd, clientDir, collections: collections2, baseUrl, isWatchMode, llmsConfig } = options;
3777
+ const { cwd, collections: collections2, baseUrl, isWatchMode, llmsConfig } = options;
3755
3778
  const parts = buildHeader(baseUrl, llmsConfig);
3756
- const allRoutes = await discoverAllRoutes(cwd, clientDir, collections2, isWatchMode, llmsConfig);
3779
+ const allRoutes = await discoverAllRoutes(cwd, collections2, isWatchMode, llmsConfig);
3757
3780
  const maxItems = llmsConfig?.maxItems || 1e4;
3758
3781
  const routesToProcess = allRoutes.slice(0, maxItems);
3759
3782
  const extracted = await extractRouteContents(routesToProcess, options);
@@ -3920,6 +3943,9 @@ function getRedirectSourcePaths(redirects) {
3920
3943
  }
3921
3944
  const sources = [];
3922
3945
  for (const redirect of redirects) {
3946
+ if (redirect.enabled === false) {
3947
+ continue;
3948
+ }
3923
3949
  if (typeof redirect.source === "string") {
3924
3950
  sources.push(redirect.source);
3925
3951
  }
@@ -4170,30 +4196,58 @@ async function discoverCollectionContent(cwd, collection, isWatchMode, baseUrl)
4170
4196
  }
4171
4197
  return entries;
4172
4198
  }
4173
- async function discoverSSRDataRoutes2(_cwd, clientDir, staticRoutes, isWatchMode, baseUrl, sitemapConfig) {
4199
+ async function discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode, baseUrl, sitemapConfig) {
4174
4200
  const ssrDataRoutes = new Map;
4175
- for (const route of staticRoutes) {
4176
- if (sitemapConfig?.excludeDiscovery?.includes(route.pattern)) {
4177
- continue;
4178
- }
4179
- try {
4180
- const abs = join2(clientDir, "routes", route.path);
4181
- const mod = await import(Bun.pathToFileURL(abs).href + (isWatchMode ? `?t=${Date.now()}` : ""));
4182
- const ssr = mod?.ssr;
4201
+ const bundledRoutes = globalThis.__REROUTE_ROUTES__;
4202
+ if (bundledRoutes && Array.isArray(bundledRoutes)) {
4203
+ for (const route of staticRoutes) {
4204
+ if (sitemapConfig?.excludeDiscovery?.includes(route.pattern)) {
4205
+ continue;
4206
+ }
4207
+ const bundledRoute = bundledRoutes.find((r) => r?.pattern === route.pattern);
4208
+ if (!bundledRoute)
4209
+ continue;
4210
+ const ssr = bundledRoute?.ssr;
4183
4211
  const dataFn = ssr?.data;
4184
4212
  if (typeof dataFn === "function") {
4185
- const mockSet = { status: 200 };
4186
- const result = await dataFn({
4187
- pathname: route.pattern,
4188
- params: {},
4189
- set: mockSet
4190
- });
4191
- const entries = extractEntriesFromData(result, route.pattern, baseUrl, sitemapConfig);
4192
- if (entries.length > 0) {
4193
- ssrDataRoutes.set(route.pattern, entries);
4194
- }
4213
+ try {
4214
+ const mockSet = { status: 200 };
4215
+ const result = await dataFn({
4216
+ pathname: route.pattern,
4217
+ params: {},
4218
+ set: mockSet
4219
+ });
4220
+ const entries = extractEntriesFromData(result, route.pattern, baseUrl, sitemapConfig);
4221
+ if (entries.length > 0) {
4222
+ ssrDataRoutes.set(route.pattern, entries);
4223
+ }
4224
+ } catch {}
4195
4225
  }
4196
- } catch {}
4226
+ }
4227
+ } else {
4228
+ for (const route of staticRoutes) {
4229
+ if (sitemapConfig?.excludeDiscovery?.includes(route.pattern)) {
4230
+ continue;
4231
+ }
4232
+ try {
4233
+ const routeModulePath = join2(cwd, "src", "client", "routes", route.path);
4234
+ const mod = await import(Bun.pathToFileURL(routeModulePath).href + (isWatchMode ? `?t=${Date.now()}` : ""));
4235
+ const ssr = mod?.ssr;
4236
+ const dataFn = ssr?.data;
4237
+ if (typeof dataFn === "function") {
4238
+ const mockSet = { status: 200 };
4239
+ const result = await dataFn({
4240
+ pathname: route.pattern,
4241
+ params: {},
4242
+ set: mockSet
4243
+ });
4244
+ const entries = extractEntriesFromData(result, route.pattern, baseUrl, sitemapConfig);
4245
+ if (entries.length > 0) {
4246
+ ssrDataRoutes.set(route.pattern, entries);
4247
+ }
4248
+ }
4249
+ } catch {}
4250
+ }
4197
4251
  }
4198
4252
  return ssrDataRoutes;
4199
4253
  }
@@ -4303,7 +4357,7 @@ function createEntryFromItem(item, routePattern, baseUrl, sitemapConfig) {
4303
4357
  }
4304
4358
  return entry;
4305
4359
  }
4306
- async function discoverSitemapData(cwd, clientDir, collections2, baseUrl, isWatchMode, sitemapConfig) {
4360
+ async function discoverSitemapData(cwd, collections2, baseUrl, isWatchMode, sitemapConfig) {
4307
4361
  const { staticRoutes, dynamicRoutes } = await discoverRoutes(cwd, isWatchMode);
4308
4362
  const collectionsMap = new Map;
4309
4363
  for (const collection of collections2) {
@@ -4312,7 +4366,7 @@ async function discoverSitemapData(cwd, clientDir, collections2, baseUrl, isWatc
4312
4366
  collectionsMap.set(collection, entries);
4313
4367
  }
4314
4368
  }
4315
- const ssrDataRoutes = await discoverSSRDataRoutes2(cwd, clientDir, staticRoutes, isWatchMode, baseUrl, sitemapConfig);
4369
+ const ssrDataRoutes = await discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode, baseUrl, sitemapConfig);
4316
4370
  return {
4317
4371
  staticRoutes,
4318
4372
  dynamicRoutes,
@@ -4427,10 +4481,10 @@ async function discoverCollectionFeedItems(cwd, collection, isWatchMode, baseUrl
4427
4481
  sortByPubDate(items);
4428
4482
  return items;
4429
4483
  }
4430
- async function discoverSSRDataFeedItems(_cwd, clientDir, routePattern, routePath, isWatchMode, baseUrl, rssConfig) {
4484
+ async function discoverSSRDataFeedItems(cwd, routePattern, routePath, isWatchMode, baseUrl, rssConfig) {
4431
4485
  const items = [];
4432
4486
  try {
4433
- const abs = join2(clientDir, "routes", routePath);
4487
+ const abs = join2(cwd, "src", "client", "routes", routePath);
4434
4488
  const mod = await import(pathToFileURL7(abs).href + (isWatchMode ? `?t=${Date.now()}` : ""));
4435
4489
  const ssr = mod?.ssr;
4436
4490
  const dataFn = ssr?.data;
@@ -4566,7 +4620,7 @@ function createRSSItemFromData(item, routePattern, baseUrl, rssConfig) {
4566
4620
  }
4567
4621
  return rssItem;
4568
4622
  }
4569
- async function discoverRSSData(cwd, clientDir, collections2, baseUrl, isWatchMode, rssConfig) {
4623
+ async function discoverRSSData(cwd, collections2, baseUrl, isWatchMode, rssConfig) {
4570
4624
  const collectionsMap = new Map;
4571
4625
  for (const collection of collections2) {
4572
4626
  const items = await discoverCollectionFeedItems(cwd, collection, isWatchMode, baseUrl, rssConfig);
@@ -4575,18 +4629,48 @@ async function discoverRSSData(cwd, clientDir, collections2, baseUrl, isWatchMod
4575
4629
  }
4576
4630
  }
4577
4631
  const ssrDataFeeds = new Map;
4578
- const { discoverRoutes: discoverRoutes2 } = await Promise.resolve().then(() => (init_discovery4(), exports_discovery));
4579
- const { staticRoutes } = await discoverRoutes2(cwd, isWatchMode);
4580
- for (const route of staticRoutes) {
4581
- if (rssConfig?.excludeDiscovery?.includes(route.pattern)) {
4582
- continue;
4632
+ const bundledRoutes = globalThis.__REROUTE_ROUTES__;
4633
+ if (bundledRoutes && Array.isArray(bundledRoutes)) {
4634
+ const { discoverRoutes: discoverRoutes2 } = await Promise.resolve().then(() => (init_discovery4(), exports_discovery));
4635
+ const { staticRoutes } = await discoverRoutes2(cwd, isWatchMode);
4636
+ for (const route of staticRoutes) {
4637
+ if (rssConfig?.excludeDiscovery?.includes(route.pattern)) {
4638
+ continue;
4639
+ }
4640
+ const bundledRoute = bundledRoutes.find((r) => r?.pattern === route.pattern);
4641
+ if (!bundledRoute)
4642
+ continue;
4643
+ const ssr = bundledRoute?.ssr;
4644
+ const dataFn = ssr?.data;
4645
+ if (typeof dataFn === "function") {
4646
+ try {
4647
+ const mockSet = { status: 200 };
4648
+ const result = await dataFn({
4649
+ pathname: route.pattern,
4650
+ params: {},
4651
+ set: mockSet
4652
+ });
4653
+ const items = extractRSSItemsFromData(result, route.pattern, baseUrl, rssConfig);
4654
+ if (items.length > 0) {
4655
+ ssrDataFeeds.set(route.pattern, items);
4656
+ }
4657
+ } catch {}
4658
+ }
4583
4659
  }
4584
- const items = await discoverSSRDataFeedItems(cwd, clientDir, route.pattern, route.path, isWatchMode, baseUrl, rssConfig);
4585
- if (items.length > 0) {
4586
- ssrDataFeeds.set(route.pattern, items);
4660
+ } else {
4661
+ const { discoverRoutes: discoverRoutes2 } = await Promise.resolve().then(() => (init_discovery4(), exports_discovery));
4662
+ const { staticRoutes } = await discoverRoutes2(cwd, isWatchMode);
4663
+ for (const route of staticRoutes) {
4664
+ if (rssConfig?.excludeDiscovery?.includes(route.pattern)) {
4665
+ continue;
4666
+ }
4667
+ const items = await discoverSSRDataFeedItems(cwd, route.pattern, route.path, isWatchMode, baseUrl, rssConfig);
4668
+ if (items.length > 0) {
4669
+ ssrDataFeeds.set(route.pattern, items);
4670
+ }
4587
4671
  }
4588
4672
  }
4589
- const layoutFeeds = await discoverLayoutFeedItems(cwd, clientDir, isWatchMode, baseUrl, rssConfig);
4673
+ const layoutFeeds = await discoverLayoutFeedItems(cwd, isWatchMode, baseUrl, rssConfig);
4590
4674
  for (const [pattern, items] of layoutFeeds.entries()) {
4591
4675
  const existing = ssrDataFeeds.get(pattern) || [];
4592
4676
  ssrDataFeeds.set(pattern, [...existing, ...items]);
@@ -4610,13 +4694,13 @@ async function loadLayouts(cwd, isWatchMode) {
4610
4694
  return;
4611
4695
  }
4612
4696
  }
4613
- async function processLayoutForRSS(layout, clientDir, isWatchMode, baseUrl, rssConfig) {
4697
+ async function processLayoutForRSS(layout, cwd, isWatchMode, baseUrl, rssConfig) {
4614
4698
  const pattern = String(layout?.pattern || "/");
4615
4699
  const path3 = String(layout?.path || "");
4616
4700
  if (!path3)
4617
4701
  return null;
4618
4702
  try {
4619
- const abs = join2(clientDir, "routes", path3);
4703
+ const abs = join2(cwd, "src", "client", "routes", path3);
4620
4704
  const layoutMod = await import(pathToFileURL7(abs).href + (isWatchMode ? `?t=${Date.now()}` : ""));
4621
4705
  const ssr = layoutMod?.ssr;
4622
4706
  const dataFn = ssr?.data;
@@ -4635,16 +4719,39 @@ async function processLayoutForRSS(layout, clientDir, isWatchMode, baseUrl, rssC
4635
4719
  } catch {}
4636
4720
  return null;
4637
4721
  }
4638
- async function discoverLayoutFeedItems(cwd, clientDir, isWatchMode, baseUrl, rssConfig) {
4722
+ async function discoverLayoutFeedItems(cwd, isWatchMode, baseUrl, rssConfig) {
4639
4723
  const layoutFeeds = new Map;
4640
4724
  const layouts2 = await loadLayouts(cwd, isWatchMode);
4641
4725
  if (!Array.isArray(layouts2)) {
4642
4726
  return layoutFeeds;
4643
4727
  }
4644
- for (const layout of layouts2) {
4645
- const result = await processLayoutForRSS(layout, clientDir, isWatchMode, baseUrl, rssConfig);
4646
- if (result) {
4647
- layoutFeeds.set(result.pattern, result.items);
4728
+ const bundledLayouts = globalThis.__REROUTE_LAYOUTS__;
4729
+ if (bundledLayouts && Array.isArray(bundledLayouts)) {
4730
+ for (const layout of bundledLayouts) {
4731
+ const pattern = String(layout?.pattern || "/");
4732
+ const ssr = layout?.ssr;
4733
+ const dataFn = ssr?.data;
4734
+ if (typeof dataFn === "function") {
4735
+ try {
4736
+ const mockSet = { status: 200 };
4737
+ const result = await dataFn({
4738
+ pathname: pattern,
4739
+ params: {},
4740
+ set: mockSet
4741
+ });
4742
+ const items = extractRSSItemsFromData(result, pattern, baseUrl, rssConfig);
4743
+ if (items.length > 0) {
4744
+ layoutFeeds.set(pattern, items);
4745
+ }
4746
+ } catch {}
4747
+ }
4748
+ }
4749
+ } else {
4750
+ for (const layout of layouts2) {
4751
+ const result = await processLayoutForRSS(layout, cwd, isWatchMode, baseUrl, rssConfig);
4752
+ if (result) {
4753
+ layoutFeeds.set(result.pattern, result.items);
4754
+ }
4648
4755
  }
4649
4756
  }
4650
4757
  return layoutFeeds;
@@ -105477,7 +105584,7 @@ async function getVersionString2() {
105477
105584
  }
105478
105585
  async function getVersion2() {
105479
105586
  if (true) {
105480
- return "0.34.8";
105587
+ return "0.35.0";
105481
105588
  }
105482
105589
  const possiblePaths = [
105483
105590
  path3.join(import.meta.dir, "../../../package.json"),
@@ -105494,10 +105601,10 @@ async function getVersion2() {
105494
105601
  }
105495
105602
  async function getCommit2() {
105496
105603
  if (true) {
105497
- return "61ce1ff";
105604
+ return "e2f562f";
105498
105605
  }
105499
105606
  return "dev";
105500
105607
  }
105501
105608
  main();
105502
105609
 
105503
- //# debugId=C0212B02D1FE7E5C64756E2164756E21
105610
+ //# debugId=264E24008D5581A464756E2164756E21