reroute-js 0.40.0 → 0.40.2

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 (181) hide show
  1. package/cli/bin.d.ts +2 -2
  2. package/cli/bin.js +31 -22
  3. package/cli/bin.js.map +5 -5
  4. package/cli/index.d.ts +2 -2
  5. package/cli/index.js +5 -5
  6. package/cli/index.js.map +1 -1
  7. package/cli/src/cli.d.ts +2 -2
  8. package/cli/src/commands/analyze.d.ts +2 -2
  9. package/cli/src/commands/build.d.ts +2 -2
  10. package/cli/src/commands/dev.d.ts +2 -2
  11. package/cli/src/commands/gen.d.ts +2 -2
  12. package/cli/src/commands/index.d.ts +2 -2
  13. package/cli/src/commands/init.d.ts +2 -2
  14. package/cli/src/commands/lib/assets.d.ts +2 -2
  15. package/cli/src/commands/lib/bundler.d.ts +2 -2
  16. package/cli/src/commands/lib/command.d.ts +2 -2
  17. package/cli/src/commands/lib/env.d.ts +2 -2
  18. package/cli/src/commands/lib/index.d.ts +2 -2
  19. package/cli/src/commands/lib/log.d.ts +2 -2
  20. package/cli/src/commands/lib/markdown/availability.d.ts +2 -2
  21. package/cli/src/commands/lib/markdown/index.d.ts +2 -2
  22. package/cli/src/commands/lib/markdown/processor.d.ts +2 -2
  23. package/cli/src/commands/lib/production.d.ts +2 -2
  24. package/cli/src/commands/lib/server.d.ts +2 -2
  25. package/cli/src/commands/lib/streaming/analyzer.d.ts +2 -2
  26. package/cli/src/commands/lib/streaming/suspense.d.ts +2 -2
  27. package/cli/src/commands/lib/tailwind.d.ts +2 -2
  28. package/cli/src/commands/lib/terminal-ui.d.ts +2 -2
  29. package/cli/src/commands/lib/version.d.ts +2 -2
  30. package/cli/src/commands/og.d.ts +2 -2
  31. package/cli/src/commands/start.d.ts +2 -2
  32. package/cli/src/index.d.ts +2 -2
  33. package/core/index.d.ts +2 -2
  34. package/core/index.js +27 -18
  35. package/core/index.js.map +5 -5
  36. package/core/src/bundler/hash.d.ts +2 -2
  37. package/core/src/bundler/index.d.ts +2 -2
  38. package/core/src/config.d.ts +2 -2
  39. package/core/src/content/discovery.d.ts +2 -2
  40. package/core/src/content/index.d.ts +2 -2
  41. package/core/src/content/metadata.d.ts +2 -2
  42. package/core/src/index.d.ts +2 -2
  43. package/core/src/llms/extractor.d.ts +2 -2
  44. package/core/src/llms/formatter.d.ts +2 -2
  45. package/core/src/llms/full-generator.d.ts +2 -2
  46. package/core/src/llms/index-generator.d.ts +2 -2
  47. package/core/src/llms/index.d.ts +2 -2
  48. package/core/src/og/discovery.d.ts +2 -2
  49. package/core/src/og/index.d.ts +2 -2
  50. package/core/src/og/meta.d.ts +2 -2
  51. package/core/src/og/render.d.ts +2 -2
  52. package/core/src/og/types.d.ts +2 -2
  53. package/core/src/robots/discovery.d.ts +2 -2
  54. package/core/src/robots/generator.d.ts +2 -2
  55. package/core/src/robots/index.d.ts +2 -2
  56. package/core/src/robots/policies.d.ts +2 -2
  57. package/core/src/rss/discovery.d.ts +2 -2
  58. package/core/src/rss/discovery.d.ts.map +1 -1
  59. package/core/src/rss/generator.d.ts +2 -2
  60. package/core/src/rss/index.d.ts +2 -2
  61. package/core/src/sitemap/discovery.d.ts +2 -2
  62. package/core/src/sitemap/discovery.d.ts.map +1 -1
  63. package/core/src/sitemap/generator.d.ts +2 -2
  64. package/core/src/sitemap/index.d.ts +2 -2
  65. package/core/src/ssr/index.d.ts +2 -2
  66. package/core/src/ssr/lib/cache.d.ts +2 -2
  67. package/core/src/ssr/lib/collections.d.ts +2 -2
  68. package/core/src/ssr/lib/compression.d.ts +2 -2
  69. package/core/src/ssr/lib/compute/content.d.ts +2 -2
  70. package/core/src/ssr/lib/compute/index.d.ts +2 -2
  71. package/core/src/ssr/lib/compute/layouts.d.ts +2 -2
  72. package/core/src/ssr/lib/compute/routes.d.ts +2 -2
  73. package/core/src/ssr/lib/data.d.ts +2 -2
  74. package/core/src/ssr/lib/html.d.ts +2 -2
  75. package/core/src/ssr/lib/imports.d.ts +2 -2
  76. package/core/src/ssr/lib/index.d.ts +2 -2
  77. package/core/src/ssr/lib/layouts.d.ts +2 -2
  78. package/core/src/ssr/lib/metadata.d.ts +2 -2
  79. package/core/src/ssr/lib/metadata.d.ts.map +1 -1
  80. package/core/src/ssr/lib/mime.d.ts +2 -2
  81. package/core/src/ssr/lib/modules.d.ts +2 -2
  82. package/core/src/ssr/lib/path.d.ts +2 -2
  83. package/core/src/ssr/lib/preload.d.ts +2 -2
  84. package/core/src/ssr/lib/scripts/collections.d.ts +2 -2
  85. package/core/src/ssr/lib/scripts/data.d.ts +2 -2
  86. package/core/src/ssr/lib/scripts/escape.d.ts +2 -2
  87. package/core/src/ssr/lib/scripts/feeds.d.ts +2 -2
  88. package/core/src/ssr/lib/scripts/index.d.ts +2 -2
  89. package/core/src/ssr/lib/seed.d.ts +2 -2
  90. package/core/src/ssr/lib/serialize.d.ts +2 -2
  91. package/core/src/ssr/lib/setup.d.ts +2 -2
  92. package/core/src/ssr/lib/styles.d.ts +2 -2
  93. package/core/src/ssr/lib/template.d.ts +2 -2
  94. package/core/src/ssr/lib/types.d.ts +2 -2
  95. package/core/src/ssr/render.d.ts +2 -2
  96. package/core/src/ssr/stream.d.ts +2 -2
  97. package/elysia/index.d.ts +2 -2
  98. package/elysia/index.js +27 -18
  99. package/elysia/index.js.map +5 -5
  100. package/elysia/src/index.d.ts +2 -2
  101. package/elysia/src/libs/assets.d.ts +2 -2
  102. package/elysia/src/libs/cache.d.ts +2 -2
  103. package/elysia/src/libs/caching.d.ts +2 -2
  104. package/elysia/src/libs/http.d.ts +2 -2
  105. package/elysia/src/libs/image.d.ts +2 -2
  106. package/elysia/src/libs/index.d.ts +2 -2
  107. package/elysia/src/libs/llms.d.ts +2 -2
  108. package/elysia/src/libs/response.d.ts +2 -2
  109. package/elysia/src/libs/serving.d.ts +2 -2
  110. package/elysia/src/plugin.d.ts +2 -2
  111. package/elysia/src/routes/artifacts.d.ts +2 -2
  112. package/elysia/src/routes/content.d.ts +2 -2
  113. package/elysia/src/routes/image.d.ts +2 -2
  114. package/elysia/src/routes/index.d.ts +2 -2
  115. package/elysia/src/routes/internal.d.ts +2 -2
  116. package/elysia/src/routes/llms.d.ts +2 -2
  117. package/elysia/src/routes/og.d.ts +2 -2
  118. package/elysia/src/routes/redirects.d.ts +2 -2
  119. package/elysia/src/routes/robots.d.ts +2 -2
  120. package/elysia/src/routes/rss.d.ts +2 -2
  121. package/elysia/src/routes/search.d.ts +2 -2
  122. package/elysia/src/routes/sitemap.d.ts +2 -2
  123. package/elysia/src/routes/ssr.d.ts +2 -2
  124. package/elysia/src/routes/static.d.ts +2 -2
  125. package/elysia/src/types.d.ts +2 -2
  126. package/package.json +1 -1
  127. package/react/index.d.ts +2 -2
  128. package/react/index.js +3 -3
  129. package/react/index.js.map +1 -1
  130. package/react/src/components/ClientOnly.d.ts +2 -2
  131. package/react/src/components/ContentRoute.d.ts +2 -2
  132. package/react/src/components/Image.d.ts +2 -2
  133. package/react/src/components/LazyRoute.d.ts +2 -2
  134. package/react/src/components/Link.d.ts +2 -2
  135. package/react/src/components/Markdown.d.ts +2 -2
  136. package/react/src/components/Outlet.d.ts +2 -2
  137. package/react/src/components/index.d.ts +2 -2
  138. package/react/src/hooks/index.d.ts +2 -2
  139. package/react/src/hooks/useContent.d.ts +2 -2
  140. package/react/src/hooks/useData.d.ts +2 -2
  141. package/react/src/hooks/useFeed.d.ts +2 -2
  142. package/react/src/hooks/useLayoutData.d.ts +2 -2
  143. package/react/src/hooks/useLlms.d.ts +2 -2
  144. package/react/src/hooks/useNavigate.d.ts +2 -2
  145. package/react/src/hooks/useParams.d.ts +2 -2
  146. package/react/src/hooks/useRouter.d.ts +2 -2
  147. package/react/src/hooks/useSearch.d.ts +2 -2
  148. package/react/src/hooks/useSearchParams.d.ts +2 -2
  149. package/react/src/hooks/useToc.d.ts +2 -2
  150. package/react/src/index.d.ts +2 -2
  151. package/react/src/lib/collection.d.ts +2 -2
  152. package/react/src/lib/content.d.ts +2 -2
  153. package/react/src/lib/head.d.ts +2 -2
  154. package/react/src/lib/index.d.ts +2 -2
  155. package/react/src/lib/lazy-route.d.ts +2 -2
  156. package/react/src/lib/route-loader.d.ts +2 -2
  157. package/react/src/providers/ContentProvider.d.ts +2 -2
  158. package/react/src/providers/RerouteProvider.d.ts +2 -2
  159. package/react/src/providers/RouterProvider.d.ts +2 -2
  160. package/react/src/providers/index.d.ts +2 -2
  161. package/react/src/types/any.d.ts +2 -2
  162. package/react/src/types/index.d.ts +2 -2
  163. package/react/src/types/router.d.ts +2 -2
  164. package/telemetry/react.d.ts +2 -2
  165. package/telemetry/react.js +3 -3
  166. package/telemetry/react.js.map +1 -1
  167. package/telemetry/server.d.ts +2 -2
  168. package/telemetry/server.js +3 -3
  169. package/telemetry/server.js.map +2 -2
  170. package/telemetry/src/react/api.d.ts +2 -2
  171. package/telemetry/src/react/context.d.ts +2 -2
  172. package/telemetry/src/react/index.d.ts +2 -2
  173. package/telemetry/src/react/telemetry.d.ts +2 -2
  174. package/telemetry/src/server/context.d.ts +2 -2
  175. package/telemetry/src/server/headers/extractor.d.ts +2 -2
  176. package/telemetry/src/server/headers/index.d.ts +2 -2
  177. package/telemetry/src/server/headers/presets.d.ts +2 -2
  178. package/telemetry/src/server/index.d.ts +2 -2
  179. package/telemetry/src/server/instrumentation.d.ts +2 -2
  180. package/telemetry/src/server/plugin.d.ts +2 -2
  181. package/telemetry/src/server/sourcemap.d.ts +2 -2
@@ -1,8 +1,8 @@
1
1
  /**
2
- * reroute-js v0.40.0
2
+ * reroute-js v0.40.2
3
3
  *
4
4
  * @license MIT
5
- * @copyright 2025 stewones <hi@stewan.io>
5
+ * @copyright 2026 stewones <hi@stewan.io>
6
6
  * @see https://github.com/stewones/reroute
7
7
  *
8
8
  * Built with Bun <3
@@ -1,8 +1,8 @@
1
1
  /**
2
- * reroute-js v0.40.0
2
+ * reroute-js v0.40.2
3
3
  *
4
4
  * @license MIT
5
- * @copyright 2025 stewones <hi@stewan.io>
5
+ * @copyright 2026 stewones <hi@stewan.io>
6
6
  * @see https://github.com/stewones/reroute
7
7
  *
8
8
  * Built with Bun <3
@@ -1,8 +1,8 @@
1
1
  /**
2
- * reroute-js v0.40.0
2
+ * reroute-js v0.40.2
3
3
  *
4
4
  * @license MIT
5
- * @copyright 2025 stewones <hi@stewan.io>
5
+ * @copyright 2026 stewones <hi@stewan.io>
6
6
  * @see https://github.com/stewones/reroute
7
7
  *
8
8
  * Built with Bun <3
@@ -1,8 +1,8 @@
1
1
  /**
2
- * reroute-js v0.40.0
2
+ * reroute-js v0.40.2
3
3
  *
4
4
  * @license MIT
5
- * @copyright 2025 stewones <hi@stewan.io>
5
+ * @copyright 2026 stewones <hi@stewan.io>
6
6
  * @see https://github.com/stewones/reroute
7
7
  *
8
8
  * Built with Bun <3
@@ -1,8 +1,8 @@
1
1
  /**
2
- * reroute-js v0.40.0
2
+ * reroute-js v0.40.2
3
3
  *
4
4
  * @license MIT
5
- * @copyright 2025 stewones <hi@stewan.io>
5
+ * @copyright 2026 stewones <hi@stewan.io>
6
6
  * @see https://github.com/stewones/reroute
7
7
  *
8
8
  * Built with Bun <3
@@ -1,8 +1,8 @@
1
1
  /**
2
- * reroute-js v0.40.0
2
+ * reroute-js v0.40.2
3
3
  *
4
4
  * @license MIT
5
- * @copyright 2025 stewones <hi@stewan.io>
5
+ * @copyright 2026 stewones <hi@stewan.io>
6
6
  * @see https://github.com/stewones/reroute
7
7
  *
8
8
  * Built with Bun <3
@@ -1,8 +1,8 @@
1
1
  /**
2
- * reroute-js v0.40.0
2
+ * reroute-js v0.40.2
3
3
  *
4
4
  * @license MIT
5
- * @copyright 2025 stewones <hi@stewan.io>
5
+ * @copyright 2026 stewones <hi@stewan.io>
6
6
  * @see https://github.com/stewones/reroute
7
7
  *
8
8
  * Built with Bun <3
package/elysia/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * reroute-js v0.40.0
2
+ * reroute-js v0.40.2
3
3
  *
4
4
  * @license MIT
5
- * @copyright 2025 stewones <hi@stewan.io>
5
+ * @copyright 2026 stewones <hi@stewan.io>
6
6
  * @see https://github.com/stewones/reroute
7
7
  *
8
8
  * Built with Bun <3
package/elysia/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * reroute-js v0.40.0
2
+ * reroute-js v0.40.2
3
3
  *
4
4
  * @license MIT
5
- * @copyright 2025 stewones <hi@stewan.io>
5
+ * @copyright 2026 stewones <hi@stewan.io>
6
6
  * @see https://github.com/stewones/reroute
7
7
  *
8
8
  * Built with Bun <3
@@ -1776,6 +1776,22 @@ var init_meta = __esm(() => {
1776
1776
  });
1777
1777
 
1778
1778
  // packages/core/src/ssr/lib/metadata.ts
1779
+ async function loadModuleMetaAndSSR(moduleObj, absolutePath, isWatchMode) {
1780
+ const bundledMeta = moduleObj?.meta;
1781
+ const bundledSSR = moduleObj?.ssr;
1782
+ if (bundledMeta !== undefined || bundledSSR !== undefined) {
1783
+ return { meta: bundledMeta, ssr: bundledSSR };
1784
+ }
1785
+ try {
1786
+ const mod = await dynamicImport(absolutePath, isWatchMode);
1787
+ return {
1788
+ meta: mod?.meta,
1789
+ ssr: mod?.ssr
1790
+ };
1791
+ } catch {
1792
+ return {};
1793
+ }
1794
+ }
1779
1795
  function generateCanonicalUrl(baseUrl, pathname) {
1780
1796
  const cleanBaseUrl = baseUrl.replace(/\/$/, "");
1781
1797
  const cleanPathname = pathname.split("?")[0];
@@ -1835,9 +1851,7 @@ async function processLayoutForMetadata(layout, clientDir, isWatchMode, addHead,
1835
1851
  return;
1836
1852
  try {
1837
1853
  const abs = join(clientDir, "routes", String(layout.path));
1838
- const mod = await dynamicImport(abs, isWatchMode);
1839
- const meta = mod?.meta;
1840
- const ssr = mod?.ssr;
1854
+ const { meta, ssr } = await loadModuleMetaAndSSR(layout, abs, isWatchMode);
1841
1855
  if (meta)
1842
1856
  addHead(buildHeadFromMeta(meta));
1843
1857
  if (ssr) {
@@ -1853,8 +1867,7 @@ ${ssrHead}`);
1853
1867
  }
1854
1868
  async function extractLayoutMetadata(pathname, clientDir, cwd, isWatchMode, addHead, setLang) {
1855
1869
  try {
1856
- const routesPath = join(cwd, ".reroute", "routes.ts");
1857
- const m = await dynamicImport(routesPath, isWatchMode);
1870
+ const m = await loadRoutesModule(cwd, isWatchMode);
1858
1871
  const matchingLayouts = getMatchingLayouts(pathname, m?.layouts);
1859
1872
  for (const layout of matchingLayouts) {
1860
1873
  await processLayoutForMetadata(layout, clientDir, isWatchMode, addHead, setLang);
@@ -1891,9 +1904,7 @@ async function extractMatchedRouteMetadata(pathname, clientDir, m, isWatchMode,
1891
1904
  if (r && typeof r.path === "string") {
1892
1905
  try {
1893
1906
  const abs = join(clientDir, "routes", String(r.path));
1894
- const mod = await dynamicImport(abs, isWatchMode);
1895
- const meta = mod?.meta;
1896
- const ssr = mod?.ssr;
1907
+ const { meta, ssr } = await loadModuleMetaAndSSR(r, abs, isWatchMode);
1897
1908
  let head = "";
1898
1909
  if (meta)
1899
1910
  head += buildHeadFromMeta(meta);
@@ -1962,9 +1973,7 @@ async function extractNotFoundMetadata(pathname, clientDir, routesModule, isWatc
1962
1973
  const chosen = findBestNotFoundRoute(list, pathname);
1963
1974
  if (chosen && typeof chosen.path === "string") {
1964
1975
  const abs = join(clientDir, "routes", String(chosen.path));
1965
- const mod = await dynamicImport(abs, isWatchMode);
1966
- const meta = mod?.meta;
1967
- const ssr = mod?.ssr;
1976
+ const { meta, ssr } = await loadModuleMetaAndSSR(chosen, abs, isWatchMode);
1968
1977
  if (meta)
1969
1978
  head += buildHeadFromMeta(meta);
1970
1979
  const ssrHead = extractSSRHead(ssr);
@@ -3988,7 +3997,7 @@ async function discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode, baseUrl, s
3988
3997
  const bundledRoutes = globalThis.__REROUTE_ROUTES__;
3989
3998
  if (bundledRoutes && Array.isArray(bundledRoutes)) {
3990
3999
  for (const route of staticRoutes) {
3991
- if (sitemapConfig?.excludeDiscovery?.includes(route.pattern)) {
4000
+ if (sitemapConfig?.excludeDiscovery?.some((excluded) => route.pattern.startsWith(excluded))) {
3992
4001
  continue;
3993
4002
  }
3994
4003
  const bundledRoute = bundledRoutes.find((r) => r?.pattern === route.pattern);
@@ -4013,7 +4022,7 @@ async function discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode, baseUrl, s
4013
4022
  }
4014
4023
  } else {
4015
4024
  for (const route of staticRoutes) {
4016
- if (sitemapConfig?.excludeDiscovery?.includes(route.pattern)) {
4025
+ if (sitemapConfig?.excludeDiscovery?.some((excluded) => route.pattern.startsWith(excluded))) {
4017
4026
  continue;
4018
4027
  }
4019
4028
  try {
@@ -4421,7 +4430,7 @@ async function discoverRSSData(cwd, collections2, baseUrl, isWatchMode, rssConfi
4421
4430
  const { discoverRoutes: discoverRoutes2 } = await Promise.resolve().then(() => (init_discovery4(), exports_discovery));
4422
4431
  const { staticRoutes } = await discoverRoutes2(cwd, isWatchMode);
4423
4432
  for (const route of staticRoutes) {
4424
- if (rssConfig?.excludeDiscovery?.includes(route.pattern)) {
4433
+ if (rssConfig?.excludeDiscovery?.some((excluded) => route.pattern.startsWith(excluded))) {
4425
4434
  continue;
4426
4435
  }
4427
4436
  const bundledRoute = bundledRoutes.find((r) => r?.pattern === route.pattern);
@@ -4448,7 +4457,7 @@ async function discoverRSSData(cwd, collections2, baseUrl, isWatchMode, rssConfi
4448
4457
  const { discoverRoutes: discoverRoutes2 } = await Promise.resolve().then(() => (init_discovery4(), exports_discovery));
4449
4458
  const { staticRoutes } = await discoverRoutes2(cwd, isWatchMode);
4450
4459
  for (const route of staticRoutes) {
4451
- if (rssConfig?.excludeDiscovery?.includes(route.pattern)) {
4460
+ if (rssConfig?.excludeDiscovery?.some((excluded) => route.pattern.startsWith(excluded))) {
4452
4461
  continue;
4453
4462
  }
4454
4463
  const items = await discoverSSRDataFeedItems(cwd, route.pattern, route.path, isWatchMode, baseUrl, rssConfig);
@@ -8258,4 +8267,4 @@ export {
8258
8267
  reroute
8259
8268
  };
8260
8269
 
8261
- //# debugId=2EAF0AA689012AC064756E2164756E21
8270
+ //# debugId=E9B46B80C24001D364756E2164756E21