reroute-js 0.34.1 → 0.34.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 (180) hide show
  1. package/README.md +3 -3
  2. package/cli/bin.d.ts +1 -1
  3. package/cli/bin.js +11 -11
  4. package/cli/bin.js.map +5 -5
  5. package/cli/index.d.ts +1 -1
  6. package/cli/index.js +4 -4
  7. package/cli/index.js.map +1 -1
  8. package/cli/src/cli.d.ts +1 -1
  9. package/cli/src/commands/analyze.d.ts +1 -1
  10. package/cli/src/commands/build.d.ts +1 -1
  11. package/cli/src/commands/dev.d.ts +1 -1
  12. package/cli/src/commands/gen.d.ts +1 -1
  13. package/cli/src/commands/index.d.ts +1 -1
  14. package/cli/src/commands/init.d.ts +1 -1
  15. package/cli/src/commands/lib/assets.d.ts +1 -1
  16. package/cli/src/commands/lib/bundler.d.ts +1 -1
  17. package/cli/src/commands/lib/command.d.ts +1 -1
  18. package/cli/src/commands/lib/env.d.ts +1 -1
  19. package/cli/src/commands/lib/index.d.ts +1 -1
  20. package/cli/src/commands/lib/log.d.ts +1 -1
  21. package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
  22. package/cli/src/commands/lib/markdown/index.d.ts +1 -1
  23. package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
  24. package/cli/src/commands/lib/production.d.ts +1 -1
  25. package/cli/src/commands/lib/server.d.ts +1 -1
  26. package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
  27. package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
  28. package/cli/src/commands/lib/tailwind.d.ts +1 -1
  29. package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
  30. package/cli/src/commands/lib/version.d.ts +1 -1
  31. package/cli/src/commands/og.d.ts +1 -1
  32. package/cli/src/commands/start.d.ts +1 -1
  33. package/cli/src/index.d.ts +1 -1
  34. package/core/index.d.ts +1 -1
  35. package/core/index.js +2 -2
  36. package/core/index.js.map +3 -3
  37. package/core/src/bundler/hash.d.ts +1 -1
  38. package/core/src/bundler/index.d.ts +1 -1
  39. package/core/src/config.d.ts +53 -17
  40. package/core/src/config.d.ts.map +1 -1
  41. package/core/src/content/discovery.d.ts +1 -1
  42. package/core/src/content/index.d.ts +1 -1
  43. package/core/src/content/metadata.d.ts +1 -1
  44. package/core/src/index.d.ts +1 -1
  45. package/core/src/llms/extractor.d.ts +1 -1
  46. package/core/src/llms/formatter.d.ts +1 -1
  47. package/core/src/llms/full-generator.d.ts +1 -1
  48. package/core/src/llms/index-generator.d.ts +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 +1 -1
  60. package/core/src/rss/generator.d.ts +1 -1
  61. package/core/src/rss/index.d.ts +1 -1
  62. package/core/src/sitemap/discovery.d.ts +1 -1
  63. package/core/src/sitemap/generator.d.ts +1 -1
  64. package/core/src/sitemap/index.d.ts +1 -1
  65. package/core/src/ssr/index.d.ts +1 -1
  66. package/core/src/ssr/lib/cache.d.ts +1 -1
  67. package/core/src/ssr/lib/collections.d.ts +1 -1
  68. package/core/src/ssr/lib/compression.d.ts +1 -1
  69. package/core/src/ssr/lib/compute/content.d.ts +1 -1
  70. package/core/src/ssr/lib/compute/index.d.ts +1 -1
  71. package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
  72. package/core/src/ssr/lib/compute/routes.d.ts +1 -1
  73. package/core/src/ssr/lib/data.d.ts +1 -1
  74. package/core/src/ssr/lib/html.d.ts +1 -1
  75. package/core/src/ssr/lib/imports.d.ts +1 -1
  76. package/core/src/ssr/lib/index.d.ts +1 -1
  77. package/core/src/ssr/lib/layouts.d.ts +1 -1
  78. package/core/src/ssr/lib/metadata.d.ts +1 -1
  79. package/core/src/ssr/lib/mime.d.ts +1 -1
  80. package/core/src/ssr/lib/modules.d.ts +1 -1
  81. package/core/src/ssr/lib/path.d.ts +1 -1
  82. package/core/src/ssr/lib/preload.d.ts +1 -1
  83. package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
  84. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  85. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  86. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  87. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  88. package/core/src/ssr/lib/seed.d.ts +1 -1
  89. package/core/src/ssr/lib/serialize.d.ts +1 -1
  90. package/core/src/ssr/lib/setup.d.ts +1 -1
  91. package/core/src/ssr/lib/styles.d.ts +1 -1
  92. package/core/src/ssr/lib/template.d.ts +1 -1
  93. package/core/src/ssr/lib/types.d.ts +1 -1
  94. package/core/src/ssr/render.d.ts +1 -1
  95. package/core/src/ssr/stream.d.ts +1 -1
  96. package/elysia/index.d.ts +1 -1
  97. package/elysia/index.js +60 -97
  98. package/elysia/index.js.map +6 -7
  99. package/elysia/src/index.d.ts +1 -1
  100. package/elysia/src/libs/assets.d.ts +1 -1
  101. package/elysia/src/libs/cache.d.ts +1 -1
  102. package/elysia/src/libs/caching.d.ts +1 -1
  103. package/elysia/src/libs/http.d.ts +1 -1
  104. package/elysia/src/libs/image.d.ts +1 -1
  105. package/elysia/src/libs/index.d.ts +1 -1
  106. package/elysia/src/libs/llms.d.ts +1 -1
  107. package/elysia/src/libs/response.d.ts +1 -1
  108. package/elysia/src/libs/serving.d.ts +1 -1
  109. package/elysia/src/plugin.d.ts +2 -3
  110. package/elysia/src/plugin.d.ts.map +1 -1
  111. package/elysia/src/routes/artifacts.d.ts +1 -1
  112. package/elysia/src/routes/content.d.ts +1 -1
  113. package/elysia/src/routes/image.d.ts +1 -1
  114. package/elysia/src/routes/index.d.ts +1 -1
  115. package/elysia/src/routes/internal.d.ts +1 -1
  116. package/elysia/src/routes/llms.d.ts +1 -1
  117. package/elysia/src/routes/og.d.ts +1 -1
  118. package/elysia/src/routes/redirects.d.ts +1 -1
  119. package/elysia/src/routes/robots.d.ts +1 -1
  120. package/elysia/src/routes/rss.d.ts +1 -1
  121. package/elysia/src/routes/search.d.ts +1 -1
  122. package/elysia/src/routes/sitemap.d.ts +1 -1
  123. package/elysia/src/routes/ssr.d.ts +1 -1
  124. package/elysia/src/routes/static.d.ts +2 -4
  125. package/elysia/src/routes/static.d.ts.map +1 -1
  126. package/elysia/src/types.d.ts +2 -54
  127. package/elysia/src/types.d.ts.map +1 -1
  128. package/package.json +1 -1
  129. package/react/index.d.ts +1 -1
  130. package/react/index.js +2 -2
  131. package/react/index.js.map +1 -1
  132. package/react/src/components/ClientOnly.d.ts +1 -1
  133. package/react/src/components/ContentRoute.d.ts +1 -1
  134. package/react/src/components/Image.d.ts +1 -1
  135. package/react/src/components/LazyRoute.d.ts +1 -1
  136. package/react/src/components/Link.d.ts +1 -1
  137. package/react/src/components/Markdown.d.ts +1 -1
  138. package/react/src/components/Outlet.d.ts +1 -1
  139. package/react/src/components/index.d.ts +1 -1
  140. package/react/src/hooks/index.d.ts +1 -1
  141. package/react/src/hooks/useContent.d.ts +1 -1
  142. package/react/src/hooks/useData.d.ts +1 -1
  143. package/react/src/hooks/useFeed.d.ts +1 -1
  144. package/react/src/hooks/useLayoutData.d.ts +1 -1
  145. package/react/src/hooks/useLlms.d.ts +1 -1
  146. package/react/src/hooks/useNavigate.d.ts +1 -1
  147. package/react/src/hooks/useParams.d.ts +1 -1
  148. package/react/src/hooks/useRouter.d.ts +1 -1
  149. package/react/src/hooks/useSearch.d.ts +1 -1
  150. package/react/src/hooks/useSearchParams.d.ts +1 -1
  151. package/react/src/hooks/useToc.d.ts +1 -1
  152. package/react/src/index.d.ts +1 -1
  153. package/react/src/lib/collection.d.ts +1 -1
  154. package/react/src/lib/content.d.ts +1 -1
  155. package/react/src/lib/head.d.ts +1 -1
  156. package/react/src/lib/index.d.ts +1 -1
  157. package/react/src/lib/lazy-route.d.ts +1 -1
  158. package/react/src/lib/route-loader.d.ts +1 -1
  159. package/react/src/providers/ContentProvider.d.ts +1 -1
  160. package/react/src/providers/RerouteProvider.d.ts +1 -1
  161. package/react/src/providers/RouterProvider.d.ts +1 -1
  162. package/react/src/providers/index.d.ts +1 -1
  163. package/react/src/types/any.d.ts +1 -1
  164. package/react/src/types/index.d.ts +1 -1
  165. package/react/src/types/router.d.ts +1 -1
  166. package/telemetry/react.d.ts +1 -1
  167. package/telemetry/react.js +2 -2
  168. package/telemetry/react.js.map +1 -1
  169. package/telemetry/server.d.ts +1 -1
  170. package/telemetry/server.js +2 -2
  171. package/telemetry/server.js.map +3 -3
  172. package/telemetry/src/react/api.d.ts +1 -1
  173. package/telemetry/src/react/context.d.ts +1 -1
  174. package/telemetry/src/react/index.d.ts +1 -1
  175. package/telemetry/src/react/telemetry.d.ts +1 -1
  176. package/telemetry/src/server/context.d.ts +1 -1
  177. package/telemetry/src/server/index.d.ts +1 -1
  178. package/telemetry/src/server/instrumentation.d.ts +1 -1
  179. package/telemetry/src/server/plugin.d.ts +1 -1
  180. package/telemetry/src/server/sourcemap.d.ts +1 -1
package/elysia/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.34.1
2
+ * reroute-js v0.34.2
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2025 stewones <hi@stewan.io>
@@ -4930,25 +4930,12 @@ var init_core = __esm(() => {
4930
4930
 
4931
4931
  // packages/elysia/src/plugin.ts
4932
4932
  init_core();
4933
+ import { existsSync as existsSync3 } from "node:fs";
4933
4934
  import { pathToFileURL as pathToFileURL8 } from "node:url";
4934
4935
  import { createElement as createElement2 } from "react";
4935
4936
 
4936
- // packages/elysia/src/libs/assets.ts
4937
- import { existsSync } from "node:fs";
4938
- function resolveClientDir(cwd, assets) {
4939
- if (assets.startsWith("/")) {
4940
- return assets;
4941
- }
4942
- const rerouteAssetsPath = `${cwd}/.reroute/assets`;
4943
- if (existsSync(rerouteAssetsPath)) {
4944
- return `${cwd}/.reroute`;
4945
- }
4946
- const devPath = `${cwd.replace(/\/$/, "")}/${assets.replace(/^\.\//, "")}`;
4947
- return devPath;
4948
- }
4949
-
4950
4937
  // packages/elysia/src/libs/image.ts
4951
- import { existsSync as existsSync2 } from "node:fs";
4938
+ import { existsSync } from "node:fs";
4952
4939
  import { join as join2 } from "node:path";
4953
4940
  import sharp from "sharp";
4954
4941
  var imageCache = new Map;
@@ -4994,7 +4981,7 @@ async function loadFromDiskCache(cacheKey) {
4994
4981
  try {
4995
4982
  const cachePath = join2(diskCacheDir, `${cacheKey}.json`);
4996
4983
  const imagePath = join2(diskCacheDir, `${cacheKey}.img`);
4997
- if (!(existsSync2(cachePath) && existsSync2(imagePath))) {
4984
+ if (!(existsSync(cachePath) && existsSync(imagePath))) {
4998
4985
  return null;
4999
4986
  }
5000
4987
  const metadata3 = JSON.parse(await Bun.file(cachePath).text());
@@ -5420,7 +5407,7 @@ function registerContentRoutes(app, cwd, collectionCache, directive, maxAge, isW
5420
5407
 
5421
5408
  // packages/elysia/src/routes/image.ts
5422
5409
  init_core();
5423
- import { existsSync as existsSync3 } from "node:fs";
5410
+ import { existsSync as existsSync2 } from "node:fs";
5424
5411
  import { join as join3 } from "node:path";
5425
5412
  function parseNumericParam(value) {
5426
5413
  if (!value)
@@ -5473,7 +5460,7 @@ function registerImageRoutes(app, options) {
5473
5460
  if (!normalizedPath.startsWith(clientDir2)) {
5474
5461
  return { error: "Access denied" };
5475
5462
  }
5476
- if (!existsSync3(imagePath)) {
5463
+ if (!existsSync2(imagePath)) {
5477
5464
  return { error: "Image not found" };
5478
5465
  }
5479
5466
  if (!isImageFile(imagePath)) {
@@ -6289,8 +6276,8 @@ import { NotFoundError as NotFoundError6 } from "elysia";
6289
6276
  async function tryLoadPrebuiltCollection(cwd, collection, slug, meta) {
6290
6277
  try {
6291
6278
  const jsPath = `${cwd}/.reroute/collections/${collection}.js`;
6292
- const { existsSync: existsSync4 } = await import("node:fs");
6293
- if (existsSync4(jsPath)) {
6279
+ const { existsSync: existsSync3 } = await import("node:fs");
6280
+ if (existsSync3(jsPath)) {
6294
6281
  try {
6295
6282
  const mod = await import(jsPath);
6296
6283
  const items = mod.items || [];
@@ -6423,7 +6410,7 @@ async function loadOgImageFromRoute(_cwd, clientDir, pathname, isWatchMode) {
6423
6410
  }
6424
6411
  }
6425
6412
  const { pathToFileURL: pathToFileURL8 } = await import("node:url");
6426
- const { existsSync: existsSync4 } = await import("node:fs");
6413
+ const { existsSync: existsSync3 } = await import("node:fs");
6427
6414
  const pathnameOnly = pathname.split("?")[0];
6428
6415
  const cleanPath = pathnameOnly === "/" ? "index" : pathnameOnly.replace(/^\//, "").replace(/\/$/, "");
6429
6416
  const possiblePaths = [
@@ -6433,7 +6420,7 @@ async function loadOgImageFromRoute(_cwd, clientDir, pathname, isWatchMode) {
6433
6420
  `${clientDir}/routes/${cleanPath}/index.ts`
6434
6421
  ];
6435
6422
  for (const routePath of possiblePaths) {
6436
- if (existsSync4(routePath)) {
6423
+ if (existsSync3(routePath)) {
6437
6424
  const routeMod = await import(pathToFileURL8(routePath).href + (isWatchMode ? `?t=${Date.now()}` : ""));
6438
6425
  return {
6439
6426
  meta: routeMod.meta,
@@ -6514,7 +6501,7 @@ function registerOGRoutes(app, options) {
6514
6501
  let fonts;
6515
6502
  if (ogConfig2.fonts && ogConfig2.fonts.length > 0) {
6516
6503
  const { join: join4, dirname } = await import("node:path");
6517
- const { existsSync: existsSync4 } = await import("node:fs");
6504
+ const { existsSync: existsSync3 } = await import("node:fs");
6518
6505
  const loadedFonts = [];
6519
6506
  const isCompiledBinary = typeof Bun !== "undefined" && process.argv[0]?.endsWith(process.argv[1]);
6520
6507
  const baseDir = isCompiledBinary ? dirname(process.argv[1]) : cwd2;
@@ -6530,7 +6517,7 @@ function registerOGRoutes(app, options) {
6530
6517
  ];
6531
6518
  let loaded = false;
6532
6519
  for (const fontPath of possiblePaths) {
6533
- if (existsSync4(fontPath)) {
6520
+ if (existsSync3(fontPath)) {
6534
6521
  const fontFile = Bun.file(fontPath);
6535
6522
  const data = await fontFile.arrayBuffer();
6536
6523
  loadedFonts.push({
@@ -7609,11 +7596,9 @@ function isOtelAvailable4() {
7609
7596
  }
7610
7597
  function registerStaticRoutes(app, options) {
7611
7598
  const {
7612
- clientDir,
7613
- prefix,
7599
+ staticAssetsDir,
7614
7600
  maxAge,
7615
7601
  directive,
7616
- indexHTML,
7617
7602
  staticHeaders = {},
7618
7603
  shouldIgnore,
7619
7604
  fileCache,
@@ -7636,18 +7621,9 @@ function registerStaticRoutes(app, options) {
7636
7621
  }
7637
7622
  currentSpan?.setAttributes(attrs);
7638
7623
  }
7639
- async function resolveFilePath(filePath, indexHTML2) {
7640
- let actualFilePath = filePath;
7641
- let exists = await Bun.file(actualFilePath).exists();
7642
- if (!exists && indexHTML2) {
7643
- actualFilePath = join(filePath, "index.html");
7644
- exists = await Bun.file(actualFilePath).exists();
7645
- }
7646
- return { path: actualFilePath, exists };
7647
- }
7648
- app.get(`${prefix}/*`, async function serveStaticFile({ params, headers }) {
7624
+ app.get("/assets/*", async function serveStaticFile({ params, headers }) {
7649
7625
  const requestPath = params["*"];
7650
- const filePath = join(clientDir, requestPath);
7626
+ const filePath = join(staticAssetsDir, requestPath);
7651
7627
  try {
7652
7628
  const acceptEncoding = headers["accept-encoding"] ?? "";
7653
7629
  const encoding = getEncoding(acceptEncoding);
@@ -7659,20 +7635,20 @@ function registerStaticRoutes(app, options) {
7659
7635
  response2.headers.set("Reroute-Cache", "HIT");
7660
7636
  return response2;
7661
7637
  }
7662
- const { path: actualFilePath, exists } = await resolveFilePath(filePath, indexHTML);
7638
+ const exists = await Bun.file(filePath).exists();
7663
7639
  if (!exists) {
7664
7640
  setOtelAttributes(404, false, requestPath, undefined, "file_not_exists");
7665
7641
  throw new NotFoundError12;
7666
7642
  }
7667
- if (shouldIgnore(actualFilePath)) {
7643
+ if (shouldIgnore(filePath)) {
7668
7644
  setOtelAttributes(404, false, requestPath, undefined, "file_ignored");
7669
7645
  throw new NotFoundError12;
7670
7646
  }
7671
- const contentBuf = await Bun.file(actualFilePath).arrayBuffer();
7647
+ const contentBuf = await Bun.file(filePath).arrayBuffer();
7672
7648
  const content2 = new Uint8Array(contentBuf);
7673
- const contentType = getMimeType(actualFilePath);
7649
+ const contentType = getMimeType(filePath);
7674
7650
  const { body, extraHeaders } = compression2 ? gzipIfAccepted(content2, contentType, acceptEncoding) : { body: content2, extraHeaders: {} };
7675
- const cacheControl = getAssetCacheControl(actualFilePath, contentType, maxAge, directive, isWatchMode);
7651
+ const cacheControl = getAssetCacheControl(filePath, contentType, maxAge, directive, isWatchMode);
7676
7652
  const response = new Response(body, {
7677
7653
  headers: {
7678
7654
  "Content-Type": contentType,
@@ -7709,7 +7685,7 @@ function registerStaticRoutes(app, options) {
7709
7685
  }
7710
7686
 
7711
7687
  // packages/elysia/src/plugin.ts
7712
- var reroute = (options = {}) => async (app) => {
7688
+ var reroute = () => async (app) => {
7713
7689
  const cwd = typeof process !== "undefined" && typeof process.cwd === "function" ? process.cwd() : "/";
7714
7690
  app.onRequest(({ request }) => {
7715
7691
  if (request.method === "HEAD") {
@@ -7722,54 +7698,45 @@ var reroute = (options = {}) => async (app) => {
7722
7698
  const globalConfig = await loadConfig(cwd);
7723
7699
  let rootComponent;
7724
7700
  const globalApp = globalThis.__REROUTE_APP_COMPONENT__;
7725
- if (options.app) {
7726
- if (typeof options.app === "string") {
7727
- const appPath = options.app.startsWith("/") ? options.app : `${cwd}/${options.app.replace(/^\.\//, "")}`;
7728
- const AppModule = await import(`${pathToFileURL8(appPath).href}?t=${Date.now()}`);
7729
- rootComponent = createElement2(AppModule.default);
7730
- } else {
7731
- rootComponent = options.app;
7732
- }
7733
- } else if (globalApp) {
7701
+ if (globalApp) {
7734
7702
  rootComponent = createElement2(globalApp);
7735
- } else if (globalConfig.options?.app) {
7736
- const appPath = globalConfig.options.app.startsWith("/") ? globalConfig.options.app : `${cwd}/${globalConfig.options.app.replace(/^\.\//, "")}`;
7703
+ } else if (globalConfig.app?.src) {
7704
+ const appPath = globalConfig.app.src.startsWith("/") ? globalConfig.app.src : `${cwd}/${globalConfig.app.src.replace(/^\.\//, "")}`;
7737
7705
  const AppModule = await import(`${pathToFileURL8(appPath).href}?t=${Date.now()}`);
7738
7706
  rootComponent = createElement2(AppModule.default);
7739
7707
  }
7740
7708
  if (!rootComponent) {
7741
7709
  console.warn("[reroute] No app component provided. SSR routes will not be registered.");
7742
7710
  }
7743
- const ssrHead = options.head ?? globalConfig.options?.head ?? "";
7744
- const ssrLang = options.lang ?? globalConfig.options?.lang ?? "en";
7745
- const ssrAppId = options.appId ?? globalConfig.options?.appId ?? "root";
7746
- const assets = options.assets ?? globalConfig.options?.assets ?? "src/client";
7747
- let prefix = options.prefix ?? globalConfig.options?.prefix ?? "/";
7748
- const ignorePatterns = options.ignorePatterns ?? globalConfig.options?.ignorePatterns ?? [
7711
+ const ssrHead = globalConfig.app?.head ?? "";
7712
+ const ssrLang = globalConfig.app?.lang ?? "en";
7713
+ const ssrAppId = globalConfig.app?.appId ?? "root";
7714
+ const staticAssetsDir = existsSync3(`${cwd}/.reroute/assets`) ? `${cwd}/.reroute/assets` : `${cwd}/src/client/assets`;
7715
+ const staticConfig = globalConfig.static ?? {};
7716
+ const ignorePatterns = staticConfig.ignorePatterns ?? [
7749
7717
  ".DS_Store",
7750
7718
  ".git",
7751
- ".env",
7752
- "index.html",
7753
- /favicon\.ico/,
7754
- /\.well-known/
7719
+ ".env"
7755
7720
  ];
7756
- const staticHeaders = options.staticHeaders ?? globalConfig.options?.staticHeaders;
7757
- const maxAge = options.maxAge ?? globalConfig.options?.maxAge ?? 3600;
7758
- const directive = options.directive ?? globalConfig.options?.directive ?? "public";
7759
- const indexHTML = options.indexHTML ?? globalConfig.options?.indexHTML ?? true;
7760
- const compression2 = options.compression ?? globalConfig.options?.compression ?? true;
7761
- const debug = options.debug ?? globalConfig.options?.debug ?? false;
7762
- const imageMaxAge = options.imageMaxAge ?? globalConfig.options?.imageMaxAge ?? 31536000;
7763
- const imageAllowedDomains = options.imageAllowedDomains ?? globalConfig.options?.imageAllowedDomains ?? [];
7764
- const imageMaxWidth = options.imageMaxWidth ?? globalConfig.options?.imageMaxWidth ?? 3840;
7765
- const imageMaxHeight = options.imageMaxHeight ?? globalConfig.options?.imageMaxHeight ?? 2160;
7766
- const bundleMaxAge = options.bundleMaxAge ?? globalConfig.options?.bundleMaxAge ?? 3600;
7767
- const streamingEnabled = options.streaming?.enabled ?? globalConfig.streaming?.enabled ?? false;
7768
- const baseUrl = globalConfig.options?.baseUrl;
7769
- const autoCanonical = globalConfig.options?.autoCanonical;
7721
+ const staticHeaders = staticConfig.headers;
7722
+ const maxAge = globalConfig.app?.maxAge ?? 3600;
7723
+ const directive = globalConfig.app?.directive ?? "public";
7724
+ const staticMaxAge = staticConfig.maxAge ?? maxAge;
7725
+ const staticDirective = staticConfig.directive ?? directive;
7726
+ const compression2 = globalConfig.app?.compression ?? true;
7727
+ const debug = globalConfig.app?.debug ?? false;
7728
+ const imageConfig = globalConfig.image ?? {};
7729
+ const imageMaxAge = imageConfig.maxAge ?? 31536000;
7730
+ const imageAllowedDomains = imageConfig.allowedDomains ?? [];
7731
+ const imageMaxWidth = imageConfig.maxWidth ?? 3840;
7732
+ const imageMaxHeight = imageConfig.maxHeight ?? 2160;
7733
+ const bundleMaxAge = globalConfig.app?.bundleMaxAge ?? 3600;
7734
+ const streamingEnabled = globalConfig.streaming?.enabled ?? false;
7735
+ const baseUrl = globalConfig.app?.baseUrl;
7736
+ const autoCanonical = globalConfig.app?.autoCanonical;
7770
7737
  const sitemapConfig = globalConfig.sitemap;
7771
7738
  const sitemapEnabled = sitemapConfig?.enabled === true;
7772
- const sitemapBaseUrl = options.sitemapBaseUrl ?? sitemapConfig?.baseUrl;
7739
+ const sitemapBaseUrl = sitemapConfig?.baseUrl;
7773
7740
  const rssConfig = globalConfig.rss;
7774
7741
  const rssEnabled = rssConfig?.enabled === true;
7775
7742
  const rssBaseUrl = rssConfig?.baseUrl;
@@ -7779,8 +7746,6 @@ var reroute = (options = {}) => async (app) => {
7779
7746
  const llmsEnabled = llmsConfig?.enabled === true;
7780
7747
  const robotsConfig = globalConfig.robots;
7781
7748
  const robotsEnabled = robotsConfig?.enabled === true;
7782
- if (prefix === "/")
7783
- prefix = "";
7784
7749
  const fileCache = new LRUCache(100);
7785
7750
  const dataCache = new LRUCache(100);
7786
7751
  const collectionCache = new LRUCache(50);
@@ -7822,7 +7787,7 @@ var reroute = (options = {}) => async (app) => {
7822
7787
  }
7823
7788
  }
7824
7789
  };
7825
- const clientDir = resolveClientDir(cwd, assets);
7790
+ const clientDir = existsSync3(`${cwd}/.reroute/assets`) ? `${cwd}/.reroute` : `${cwd}/src/client`;
7826
7791
  const shouldIgnore = !ignorePatterns.length ? () => false : (file) => ignorePatterns.find((pattern) => typeof pattern === "string" ? file.includes(pattern) : pattern.test(file));
7827
7792
  const isWatchMode = Array.isArray(process.execArgv) && process.execArgv.includes("--watch") || Array.isArray(process.argv) && process.argv.includes("--watch");
7828
7793
  const dataCacheControl = `${directive}, max-age=${maxAge}`;
@@ -7908,6 +7873,16 @@ var reroute = (options = {}) => async (app) => {
7908
7873
  maxHeight: imageMaxHeight,
7909
7874
  compression: compression2
7910
7875
  });
7876
+ registerStaticRoutes(app, {
7877
+ staticAssetsDir,
7878
+ maxAge: staticMaxAge,
7879
+ directive: staticDirective,
7880
+ staticHeaders,
7881
+ shouldIgnore,
7882
+ fileCache,
7883
+ isWatchMode,
7884
+ compression: compression2
7885
+ });
7911
7886
  if (rootComponent) {
7912
7887
  try {
7913
7888
  const collections2 = await discoverCollections(clientDir);
@@ -8035,18 +8010,6 @@ var reroute = (options = {}) => async (app) => {
8035
8010
  throw error;
8036
8011
  }
8037
8012
  }
8038
- registerStaticRoutes(app, {
8039
- clientDir,
8040
- prefix,
8041
- maxAge,
8042
- directive,
8043
- indexHTML,
8044
- staticHeaders,
8045
- shouldIgnore,
8046
- fileCache,
8047
- isWatchMode,
8048
- compression: compression2
8049
- });
8050
8013
  app.onError(({ set, error }) => {
8051
8014
  if ("status" in error && error.status === 404) {
8052
8015
  set.status = 404;
@@ -8062,4 +8025,4 @@ export {
8062
8025
  reroute
8063
8026
  };
8064
8027
 
8065
- //# debugId=F3FE7256D5C5218864756E2164756E21
8028
+ //# debugId=203F5F1F5634A54D64756E2164756E21