reroute-js 0.34.8 → 0.34.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/cli/bin.d.ts +1 -1
  2. package/cli/bin.js +175 -71
  3. package/cli/bin.js.map +6 -6
  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 +171 -67
  35. package/core/index.js.map +6 -6
  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 +1 -1
  39. package/core/src/content/discovery.d.ts +1 -1
  40. package/core/src/content/index.d.ts +1 -1
  41. package/core/src/content/metadata.d.ts +1 -1
  42. package/core/src/index.d.ts +1 -1
  43. package/core/src/llms/extractor.d.ts +1 -1
  44. package/core/src/llms/formatter.d.ts +1 -1
  45. package/core/src/llms/full-generator.d.ts +1 -1
  46. package/core/src/llms/full-generator.d.ts.map +1 -1
  47. package/core/src/llms/index-generator.d.ts +2 -3
  48. package/core/src/llms/index-generator.d.ts.map +1 -1
  49. package/core/src/llms/index.d.ts +1 -1
  50. package/core/src/og/discovery.d.ts +1 -1
  51. package/core/src/og/index.d.ts +1 -1
  52. package/core/src/og/meta.d.ts +1 -1
  53. package/core/src/og/render.d.ts +1 -1
  54. package/core/src/og/types.d.ts +1 -1
  55. package/core/src/robots/discovery.d.ts +1 -1
  56. package/core/src/robots/generator.d.ts +1 -1
  57. package/core/src/robots/index.d.ts +1 -1
  58. package/core/src/robots/policies.d.ts +1 -1
  59. package/core/src/rss/discovery.d.ts +4 -4
  60. package/core/src/rss/discovery.d.ts.map +1 -1
  61. package/core/src/rss/generator.d.ts +1 -1
  62. package/core/src/rss/index.d.ts +1 -1
  63. package/core/src/sitemap/discovery.d.ts +3 -3
  64. package/core/src/sitemap/discovery.d.ts.map +1 -1
  65. package/core/src/sitemap/generator.d.ts +1 -1
  66. package/core/src/sitemap/index.d.ts +1 -1
  67. package/core/src/ssr/index.d.ts +1 -1
  68. package/core/src/ssr/lib/cache.d.ts +1 -1
  69. package/core/src/ssr/lib/collections.d.ts +1 -1
  70. package/core/src/ssr/lib/compression.d.ts +1 -1
  71. package/core/src/ssr/lib/compute/content.d.ts +1 -1
  72. package/core/src/ssr/lib/compute/index.d.ts +1 -1
  73. package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
  74. package/core/src/ssr/lib/compute/routes.d.ts +1 -1
  75. package/core/src/ssr/lib/data.d.ts +1 -1
  76. package/core/src/ssr/lib/html.d.ts +1 -1
  77. package/core/src/ssr/lib/imports.d.ts +1 -1
  78. package/core/src/ssr/lib/index.d.ts +1 -1
  79. package/core/src/ssr/lib/layouts.d.ts +1 -1
  80. package/core/src/ssr/lib/metadata.d.ts +1 -1
  81. package/core/src/ssr/lib/mime.d.ts +1 -1
  82. package/core/src/ssr/lib/modules.d.ts +1 -1
  83. package/core/src/ssr/lib/path.d.ts +1 -1
  84. package/core/src/ssr/lib/preload.d.ts +1 -1
  85. package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
  86. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  87. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  88. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  89. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  90. package/core/src/ssr/lib/seed.d.ts +1 -1
  91. package/core/src/ssr/lib/serialize.d.ts +1 -1
  92. package/core/src/ssr/lib/setup.d.ts +1 -1
  93. package/core/src/ssr/lib/styles.d.ts +1 -1
  94. package/core/src/ssr/lib/template.d.ts +1 -1
  95. package/core/src/ssr/lib/types.d.ts +1 -1
  96. package/core/src/ssr/render.d.ts +1 -1
  97. package/core/src/ssr/stream.d.ts +1 -1
  98. package/elysia/index.d.ts +1 -1
  99. package/elysia/index.js +181 -81
  100. package/elysia/index.js.map +10 -10
  101. package/elysia/src/index.d.ts +1 -1
  102. package/elysia/src/libs/assets.d.ts +1 -1
  103. package/elysia/src/libs/cache.d.ts +1 -1
  104. package/elysia/src/libs/caching.d.ts +1 -1
  105. package/elysia/src/libs/http.d.ts +1 -1
  106. package/elysia/src/libs/image.d.ts +1 -1
  107. package/elysia/src/libs/index.d.ts +1 -1
  108. package/elysia/src/libs/llms.d.ts +1 -1
  109. package/elysia/src/libs/response.d.ts +1 -1
  110. package/elysia/src/libs/serving.d.ts +1 -1
  111. package/elysia/src/plugin.d.ts +1 -1
  112. package/elysia/src/plugin.d.ts.map +1 -1
  113. package/elysia/src/routes/artifacts.d.ts +1 -1
  114. package/elysia/src/routes/content.d.ts +1 -1
  115. package/elysia/src/routes/image.d.ts +1 -1
  116. package/elysia/src/routes/index.d.ts +1 -1
  117. package/elysia/src/routes/internal.d.ts +1 -1
  118. package/elysia/src/routes/llms.d.ts +1 -1
  119. package/elysia/src/routes/llms.d.ts.map +1 -1
  120. package/elysia/src/routes/og.d.ts +1 -1
  121. package/elysia/src/routes/redirects.d.ts +1 -1
  122. package/elysia/src/routes/robots.d.ts +1 -1
  123. package/elysia/src/routes/rss.d.ts +1 -1
  124. package/elysia/src/routes/rss.d.ts.map +1 -1
  125. package/elysia/src/routes/search.d.ts +1 -1
  126. package/elysia/src/routes/sitemap.d.ts +1 -2
  127. package/elysia/src/routes/sitemap.d.ts.map +1 -1
  128. package/elysia/src/routes/ssr.d.ts +1 -1
  129. package/elysia/src/routes/static.d.ts +1 -1
  130. package/elysia/src/types.d.ts +1 -1
  131. package/package.json +1 -1
  132. package/react/index.d.ts +1 -1
  133. package/react/index.js +2 -2
  134. package/react/index.js.map +1 -1
  135. package/react/src/components/ClientOnly.d.ts +1 -1
  136. package/react/src/components/ContentRoute.d.ts +1 -1
  137. package/react/src/components/Image.d.ts +1 -1
  138. package/react/src/components/LazyRoute.d.ts +1 -1
  139. package/react/src/components/Link.d.ts +1 -1
  140. package/react/src/components/Markdown.d.ts +1 -1
  141. package/react/src/components/Outlet.d.ts +1 -1
  142. package/react/src/components/index.d.ts +1 -1
  143. package/react/src/hooks/index.d.ts +1 -1
  144. package/react/src/hooks/useContent.d.ts +1 -1
  145. package/react/src/hooks/useData.d.ts +1 -1
  146. package/react/src/hooks/useFeed.d.ts +1 -1
  147. package/react/src/hooks/useLayoutData.d.ts +1 -1
  148. package/react/src/hooks/useLlms.d.ts +1 -1
  149. package/react/src/hooks/useNavigate.d.ts +1 -1
  150. package/react/src/hooks/useParams.d.ts +1 -1
  151. package/react/src/hooks/useRouter.d.ts +1 -1
  152. package/react/src/hooks/useSearch.d.ts +1 -1
  153. package/react/src/hooks/useSearchParams.d.ts +1 -1
  154. package/react/src/hooks/useToc.d.ts +1 -1
  155. package/react/src/index.d.ts +1 -1
  156. package/react/src/lib/collection.d.ts +1 -1
  157. package/react/src/lib/content.d.ts +1 -1
  158. package/react/src/lib/head.d.ts +1 -1
  159. package/react/src/lib/index.d.ts +1 -1
  160. package/react/src/lib/lazy-route.d.ts +1 -1
  161. package/react/src/lib/route-loader.d.ts +1 -1
  162. package/react/src/providers/ContentProvider.d.ts +1 -1
  163. package/react/src/providers/RerouteProvider.d.ts +1 -1
  164. package/react/src/providers/RouterProvider.d.ts +1 -1
  165. package/react/src/providers/index.d.ts +1 -1
  166. package/react/src/types/any.d.ts +1 -1
  167. package/react/src/types/index.d.ts +1 -1
  168. package/react/src/types/router.d.ts +1 -1
  169. package/telemetry/react.d.ts +1 -1
  170. package/telemetry/react.js +2 -2
  171. package/telemetry/react.js.map +1 -1
  172. package/telemetry/server.d.ts +1 -1
  173. package/telemetry/server.js +2 -2
  174. package/telemetry/server.js.map +3 -3
  175. package/telemetry/src/react/api.d.ts +1 -1
  176. package/telemetry/src/react/context.d.ts +1 -1
  177. package/telemetry/src/react/index.d.ts +1 -1
  178. package/telemetry/src/react/telemetry.d.ts +1 -1
  179. package/telemetry/src/server/context.d.ts +1 -1
  180. package/telemetry/src/server/index.d.ts +1 -1
  181. package/telemetry/src/server/instrumentation.d.ts +1 -1
  182. package/telemetry/src/server/plugin.d.ts +1 -1
  183. package/telemetry/src/server/sourcemap.d.ts +1 -1
package/cli/bin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.34.8
2
+ * reroute-js v0.34.9
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.34.9
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.34.9";
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 "58d33f1";
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")
3476
3473
  continue;
3477
- const entries = createEntriesFromArray(array, route.path);
3478
- if (entries.length > 0) {
3479
- ssrDataRoutes.set(route.path, entries);
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)
3489
+ continue;
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);
@@ -4170,30 +4193,58 @@ async function discoverCollectionContent(cwd, collection, isWatchMode, baseUrl)
4170
4193
  }
4171
4194
  return entries;
4172
4195
  }
4173
- async function discoverSSRDataRoutes2(_cwd, clientDir, staticRoutes, isWatchMode, baseUrl, sitemapConfig) {
4196
+ async function discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode, baseUrl, sitemapConfig) {
4174
4197
  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;
4198
+ const bundledRoutes = globalThis.__REROUTE_ROUTES__;
4199
+ if (bundledRoutes && Array.isArray(bundledRoutes)) {
4200
+ for (const route of staticRoutes) {
4201
+ if (sitemapConfig?.excludeDiscovery?.includes(route.pattern)) {
4202
+ continue;
4203
+ }
4204
+ const bundledRoute = bundledRoutes.find((r) => r?.pattern === route.pattern);
4205
+ if (!bundledRoute)
4206
+ continue;
4207
+ const ssr = bundledRoute?.ssr;
4183
4208
  const dataFn = ssr?.data;
4184
4209
  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
- }
4210
+ try {
4211
+ const mockSet = { status: 200 };
4212
+ const result = await dataFn({
4213
+ pathname: route.pattern,
4214
+ params: {},
4215
+ set: mockSet
4216
+ });
4217
+ const entries = extractEntriesFromData(result, route.pattern, baseUrl, sitemapConfig);
4218
+ if (entries.length > 0) {
4219
+ ssrDataRoutes.set(route.pattern, entries);
4220
+ }
4221
+ } catch {}
4195
4222
  }
4196
- } catch {}
4223
+ }
4224
+ } else {
4225
+ for (const route of staticRoutes) {
4226
+ if (sitemapConfig?.excludeDiscovery?.includes(route.pattern)) {
4227
+ continue;
4228
+ }
4229
+ try {
4230
+ const routeModulePath = join2(cwd, "src", "client", "routes", route.path);
4231
+ const mod = await import(Bun.pathToFileURL(routeModulePath).href + (isWatchMode ? `?t=${Date.now()}` : ""));
4232
+ const ssr = mod?.ssr;
4233
+ const dataFn = ssr?.data;
4234
+ if (typeof dataFn === "function") {
4235
+ const mockSet = { status: 200 };
4236
+ const result = await dataFn({
4237
+ pathname: route.pattern,
4238
+ params: {},
4239
+ set: mockSet
4240
+ });
4241
+ const entries = extractEntriesFromData(result, route.pattern, baseUrl, sitemapConfig);
4242
+ if (entries.length > 0) {
4243
+ ssrDataRoutes.set(route.pattern, entries);
4244
+ }
4245
+ }
4246
+ } catch {}
4247
+ }
4197
4248
  }
4198
4249
  return ssrDataRoutes;
4199
4250
  }
@@ -4303,7 +4354,7 @@ function createEntryFromItem(item, routePattern, baseUrl, sitemapConfig) {
4303
4354
  }
4304
4355
  return entry;
4305
4356
  }
4306
- async function discoverSitemapData(cwd, clientDir, collections2, baseUrl, isWatchMode, sitemapConfig) {
4357
+ async function discoverSitemapData(cwd, collections2, baseUrl, isWatchMode, sitemapConfig) {
4307
4358
  const { staticRoutes, dynamicRoutes } = await discoverRoutes(cwd, isWatchMode);
4308
4359
  const collectionsMap = new Map;
4309
4360
  for (const collection of collections2) {
@@ -4312,7 +4363,7 @@ async function discoverSitemapData(cwd, clientDir, collections2, baseUrl, isWatc
4312
4363
  collectionsMap.set(collection, entries);
4313
4364
  }
4314
4365
  }
4315
- const ssrDataRoutes = await discoverSSRDataRoutes2(cwd, clientDir, staticRoutes, isWatchMode, baseUrl, sitemapConfig);
4366
+ const ssrDataRoutes = await discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode, baseUrl, sitemapConfig);
4316
4367
  return {
4317
4368
  staticRoutes,
4318
4369
  dynamicRoutes,
@@ -4427,10 +4478,10 @@ async function discoverCollectionFeedItems(cwd, collection, isWatchMode, baseUrl
4427
4478
  sortByPubDate(items);
4428
4479
  return items;
4429
4480
  }
4430
- async function discoverSSRDataFeedItems(_cwd, clientDir, routePattern, routePath, isWatchMode, baseUrl, rssConfig) {
4481
+ async function discoverSSRDataFeedItems(cwd, routePattern, routePath, isWatchMode, baseUrl, rssConfig) {
4431
4482
  const items = [];
4432
4483
  try {
4433
- const abs = join2(clientDir, "routes", routePath);
4484
+ const abs = join2(cwd, "src", "client", "routes", routePath);
4434
4485
  const mod = await import(pathToFileURL7(abs).href + (isWatchMode ? `?t=${Date.now()}` : ""));
4435
4486
  const ssr = mod?.ssr;
4436
4487
  const dataFn = ssr?.data;
@@ -4566,7 +4617,7 @@ function createRSSItemFromData(item, routePattern, baseUrl, rssConfig) {
4566
4617
  }
4567
4618
  return rssItem;
4568
4619
  }
4569
- async function discoverRSSData(cwd, clientDir, collections2, baseUrl, isWatchMode, rssConfig) {
4620
+ async function discoverRSSData(cwd, collections2, baseUrl, isWatchMode, rssConfig) {
4570
4621
  const collectionsMap = new Map;
4571
4622
  for (const collection of collections2) {
4572
4623
  const items = await discoverCollectionFeedItems(cwd, collection, isWatchMode, baseUrl, rssConfig);
@@ -4575,18 +4626,48 @@ async function discoverRSSData(cwd, clientDir, collections2, baseUrl, isWatchMod
4575
4626
  }
4576
4627
  }
4577
4628
  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;
4629
+ const bundledRoutes = globalThis.__REROUTE_ROUTES__;
4630
+ if (bundledRoutes && Array.isArray(bundledRoutes)) {
4631
+ const { discoverRoutes: discoverRoutes2 } = await Promise.resolve().then(() => (init_discovery4(), exports_discovery));
4632
+ const { staticRoutes } = await discoverRoutes2(cwd, isWatchMode);
4633
+ for (const route of staticRoutes) {
4634
+ if (rssConfig?.excludeDiscovery?.includes(route.pattern)) {
4635
+ continue;
4636
+ }
4637
+ const bundledRoute = bundledRoutes.find((r) => r?.pattern === route.pattern);
4638
+ if (!bundledRoute)
4639
+ continue;
4640
+ const ssr = bundledRoute?.ssr;
4641
+ const dataFn = ssr?.data;
4642
+ if (typeof dataFn === "function") {
4643
+ try {
4644
+ const mockSet = { status: 200 };
4645
+ const result = await dataFn({
4646
+ pathname: route.pattern,
4647
+ params: {},
4648
+ set: mockSet
4649
+ });
4650
+ const items = extractRSSItemsFromData(result, route.pattern, baseUrl, rssConfig);
4651
+ if (items.length > 0) {
4652
+ ssrDataFeeds.set(route.pattern, items);
4653
+ }
4654
+ } catch {}
4655
+ }
4583
4656
  }
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);
4657
+ } else {
4658
+ const { discoverRoutes: discoverRoutes2 } = await Promise.resolve().then(() => (init_discovery4(), exports_discovery));
4659
+ const { staticRoutes } = await discoverRoutes2(cwd, isWatchMode);
4660
+ for (const route of staticRoutes) {
4661
+ if (rssConfig?.excludeDiscovery?.includes(route.pattern)) {
4662
+ continue;
4663
+ }
4664
+ const items = await discoverSSRDataFeedItems(cwd, route.pattern, route.path, isWatchMode, baseUrl, rssConfig);
4665
+ if (items.length > 0) {
4666
+ ssrDataFeeds.set(route.pattern, items);
4667
+ }
4587
4668
  }
4588
4669
  }
4589
- const layoutFeeds = await discoverLayoutFeedItems(cwd, clientDir, isWatchMode, baseUrl, rssConfig);
4670
+ const layoutFeeds = await discoverLayoutFeedItems(cwd, isWatchMode, baseUrl, rssConfig);
4590
4671
  for (const [pattern, items] of layoutFeeds.entries()) {
4591
4672
  const existing = ssrDataFeeds.get(pattern) || [];
4592
4673
  ssrDataFeeds.set(pattern, [...existing, ...items]);
@@ -4610,13 +4691,13 @@ async function loadLayouts(cwd, isWatchMode) {
4610
4691
  return;
4611
4692
  }
4612
4693
  }
4613
- async function processLayoutForRSS(layout, clientDir, isWatchMode, baseUrl, rssConfig) {
4694
+ async function processLayoutForRSS(layout, cwd, isWatchMode, baseUrl, rssConfig) {
4614
4695
  const pattern = String(layout?.pattern || "/");
4615
4696
  const path3 = String(layout?.path || "");
4616
4697
  if (!path3)
4617
4698
  return null;
4618
4699
  try {
4619
- const abs = join2(clientDir, "routes", path3);
4700
+ const abs = join2(cwd, "src", "client", "routes", path3);
4620
4701
  const layoutMod = await import(pathToFileURL7(abs).href + (isWatchMode ? `?t=${Date.now()}` : ""));
4621
4702
  const ssr = layoutMod?.ssr;
4622
4703
  const dataFn = ssr?.data;
@@ -4635,16 +4716,39 @@ async function processLayoutForRSS(layout, clientDir, isWatchMode, baseUrl, rssC
4635
4716
  } catch {}
4636
4717
  return null;
4637
4718
  }
4638
- async function discoverLayoutFeedItems(cwd, clientDir, isWatchMode, baseUrl, rssConfig) {
4719
+ async function discoverLayoutFeedItems(cwd, isWatchMode, baseUrl, rssConfig) {
4639
4720
  const layoutFeeds = new Map;
4640
4721
  const layouts2 = await loadLayouts(cwd, isWatchMode);
4641
4722
  if (!Array.isArray(layouts2)) {
4642
4723
  return layoutFeeds;
4643
4724
  }
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);
4725
+ const bundledLayouts = globalThis.__REROUTE_LAYOUTS__;
4726
+ if (bundledLayouts && Array.isArray(bundledLayouts)) {
4727
+ for (const layout of bundledLayouts) {
4728
+ const pattern = String(layout?.pattern || "/");
4729
+ const ssr = layout?.ssr;
4730
+ const dataFn = ssr?.data;
4731
+ if (typeof dataFn === "function") {
4732
+ try {
4733
+ const mockSet = { status: 200 };
4734
+ const result = await dataFn({
4735
+ pathname: pattern,
4736
+ params: {},
4737
+ set: mockSet
4738
+ });
4739
+ const items = extractRSSItemsFromData(result, pattern, baseUrl, rssConfig);
4740
+ if (items.length > 0) {
4741
+ layoutFeeds.set(pattern, items);
4742
+ }
4743
+ } catch {}
4744
+ }
4745
+ }
4746
+ } else {
4747
+ for (const layout of layouts2) {
4748
+ const result = await processLayoutForRSS(layout, cwd, isWatchMode, baseUrl, rssConfig);
4749
+ if (result) {
4750
+ layoutFeeds.set(result.pattern, result.items);
4751
+ }
4648
4752
  }
4649
4753
  }
4650
4754
  return layoutFeeds;
@@ -105477,7 +105581,7 @@ async function getVersionString2() {
105477
105581
  }
105478
105582
  async function getVersion2() {
105479
105583
  if (true) {
105480
- return "0.34.8";
105584
+ return "0.34.9";
105481
105585
  }
105482
105586
  const possiblePaths = [
105483
105587
  path3.join(import.meta.dir, "../../../package.json"),
@@ -105494,10 +105598,10 @@ async function getVersion2() {
105494
105598
  }
105495
105599
  async function getCommit2() {
105496
105600
  if (true) {
105497
- return "61ce1ff";
105601
+ return "58d33f1";
105498
105602
  }
105499
105603
  return "dev";
105500
105604
  }
105501
105605
  main();
105502
105606
 
105503
- //# debugId=C0212B02D1FE7E5C64756E2164756E21
105607
+ //# debugId=D0C606DE313168C464756E2164756E21