reroute-js 0.20.3 → 0.20.4

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 (162) hide show
  1. package/cli/bin.d.ts +1 -1
  2. package/cli/bin.js +121 -110
  3. package/cli/bin.js.map +5 -4
  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 +3 -3
  10. package/cli/src/commands/build.d.ts.map +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 +24 -0
  16. package/cli/src/commands/lib/assets.d.ts.map +1 -0
  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/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 +2 -2
  35. package/core/index.js.map +1 -1
  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/index-generator.d.ts +1 -1
  47. package/core/src/llms/index.d.ts +1 -1
  48. package/core/src/og/discovery.d.ts +1 -1
  49. package/core/src/og/index.d.ts +1 -1
  50. package/core/src/og/meta.d.ts +1 -1
  51. package/core/src/og/render.d.ts +1 -1
  52. package/core/src/og/types.d.ts +1 -1
  53. package/core/src/robots/discovery.d.ts +1 -1
  54. package/core/src/robots/generator.d.ts +1 -1
  55. package/core/src/robots/index.d.ts +1 -1
  56. package/core/src/robots/policies.d.ts +1 -1
  57. package/core/src/rss/discovery.d.ts +1 -1
  58. package/core/src/rss/generator.d.ts +1 -1
  59. package/core/src/rss/index.d.ts +1 -1
  60. package/core/src/sitemap/discovery.d.ts +1 -1
  61. package/core/src/sitemap/generator.d.ts +1 -1
  62. package/core/src/sitemap/index.d.ts +1 -1
  63. package/core/src/ssr/index.d.ts +1 -1
  64. package/core/src/ssr/lib/cache.d.ts +1 -1
  65. package/core/src/ssr/lib/collections.d.ts +1 -1
  66. package/core/src/ssr/lib/compression.d.ts +1 -1
  67. package/core/src/ssr/lib/compute/content.d.ts +1 -1
  68. package/core/src/ssr/lib/compute/index.d.ts +1 -1
  69. package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
  70. package/core/src/ssr/lib/compute/routes.d.ts +1 -1
  71. package/core/src/ssr/lib/data.d.ts +1 -1
  72. package/core/src/ssr/lib/html.d.ts +1 -1
  73. package/core/src/ssr/lib/imports.d.ts +1 -1
  74. package/core/src/ssr/lib/index.d.ts +1 -1
  75. package/core/src/ssr/lib/layouts.d.ts +1 -1
  76. package/core/src/ssr/lib/metadata.d.ts +1 -1
  77. package/core/src/ssr/lib/mime.d.ts +1 -1
  78. package/core/src/ssr/lib/modules.d.ts +1 -1
  79. package/core/src/ssr/lib/path.d.ts +1 -1
  80. package/core/src/ssr/lib/preload.d.ts +1 -1
  81. package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
  82. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  83. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  84. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  85. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  86. package/core/src/ssr/lib/seed.d.ts +1 -1
  87. package/core/src/ssr/lib/setup.d.ts +1 -1
  88. package/core/src/ssr/lib/styles.d.ts +1 -1
  89. package/core/src/ssr/lib/template.d.ts +1 -1
  90. package/core/src/ssr/lib/types.d.ts +1 -1
  91. package/core/src/ssr/render.d.ts +1 -1
  92. package/core/src/ssr/stream.d.ts +1 -1
  93. package/elysia/index.d.ts +1 -1
  94. package/elysia/index.js +21 -26
  95. package/elysia/index.js.map +5 -4
  96. package/elysia/src/index.d.ts +1 -1
  97. package/elysia/src/libs/assets.d.ts +15 -0
  98. package/elysia/src/libs/assets.d.ts.map +1 -0
  99. package/elysia/src/libs/cache.d.ts +1 -1
  100. package/elysia/src/libs/caching.d.ts +1 -1
  101. package/elysia/src/libs/http.d.ts +1 -1
  102. package/elysia/src/libs/image.d.ts +1 -1
  103. package/elysia/src/libs/index.d.ts +2 -1
  104. package/elysia/src/libs/index.d.ts.map +1 -1
  105. package/elysia/src/libs/llms.d.ts +1 -1
  106. package/elysia/src/libs/response.d.ts +1 -1
  107. package/elysia/src/libs/serving.d.ts +1 -1
  108. package/elysia/src/plugin.d.ts +1 -1
  109. package/elysia/src/plugin.d.ts.map +1 -1
  110. package/elysia/src/routes/artifacts.d.ts +1 -1
  111. package/elysia/src/routes/content.d.ts +1 -1
  112. package/elysia/src/routes/image.d.ts +1 -1
  113. package/elysia/src/routes/index.d.ts +1 -1
  114. package/elysia/src/routes/internal.d.ts +1 -1
  115. package/elysia/src/routes/llms.d.ts +1 -1
  116. package/elysia/src/routes/og.d.ts +1 -1
  117. package/elysia/src/routes/redirects.d.ts +1 -1
  118. package/elysia/src/routes/robots.d.ts +1 -1
  119. package/elysia/src/routes/rss.d.ts +1 -1
  120. package/elysia/src/routes/search.d.ts +1 -1
  121. package/elysia/src/routes/sitemap.d.ts +1 -1
  122. package/elysia/src/routes/ssr.d.ts +1 -1
  123. package/elysia/src/routes/static.d.ts +1 -1
  124. package/elysia/src/types.d.ts +1 -1
  125. package/package.json +1 -1
  126. package/react/index.d.ts +1 -1
  127. package/react/index.js +2 -2
  128. package/react/index.js.map +1 -1
  129. package/react/src/components/ClientOnly.d.ts +1 -1
  130. package/react/src/components/ContentRoute.d.ts +1 -1
  131. package/react/src/components/Image.d.ts +1 -1
  132. package/react/src/components/LazyRoute.d.ts +1 -1
  133. package/react/src/components/Link.d.ts +1 -1
  134. package/react/src/components/Markdown.d.ts +1 -1
  135. package/react/src/components/Outlet.d.ts +1 -1
  136. package/react/src/components/index.d.ts +1 -1
  137. package/react/src/hooks/index.d.ts +1 -1
  138. package/react/src/hooks/useContent.d.ts +1 -1
  139. package/react/src/hooks/useData.d.ts +1 -1
  140. package/react/src/hooks/useFeed.d.ts +1 -1
  141. package/react/src/hooks/useLayoutData.d.ts +1 -1
  142. package/react/src/hooks/useLlms.d.ts +1 -1
  143. package/react/src/hooks/useNavigate.d.ts +1 -1
  144. package/react/src/hooks/useParams.d.ts +1 -1
  145. package/react/src/hooks/useRouter.d.ts +1 -1
  146. package/react/src/hooks/useSearch.d.ts +1 -1
  147. package/react/src/hooks/useSearchParams.d.ts +1 -1
  148. package/react/src/hooks/useToc.d.ts +1 -1
  149. package/react/src/index.d.ts +1 -1
  150. package/react/src/lib/collection.d.ts +1 -1
  151. package/react/src/lib/content.d.ts +1 -1
  152. package/react/src/lib/head.d.ts +1 -1
  153. package/react/src/lib/index.d.ts +1 -1
  154. package/react/src/lib/lazy-route.d.ts +1 -1
  155. package/react/src/lib/route-loader.d.ts +1 -1
  156. package/react/src/providers/ContentProvider.d.ts +1 -1
  157. package/react/src/providers/RerouteProvider.d.ts +1 -1
  158. package/react/src/providers/RouterProvider.d.ts +1 -1
  159. package/react/src/providers/index.d.ts +1 -1
  160. package/react/src/types/any.d.ts +1 -1
  161. package/react/src/types/index.d.ts +1 -1
  162. package/react/src/types/router.d.ts +1 -1
package/cli/bin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.20.3
2
+ * reroute-js v0.20.4
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.20.3
4
+ * reroute-js v0.20.4
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.20.3";
51
+ return "0.20.4";
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 "71a926d";
69
+ return "b55c7e7";
70
70
  }
71
71
  return "dev";
72
72
  }
@@ -10636,35 +10636,62 @@ var init_start = __esm(() => {
10636
10636
  init_log();
10637
10637
  });
10638
10638
 
10639
+ // packages/cli/src/commands/lib/assets.ts
10640
+ import {
10641
+ cpSync,
10642
+ existsSync as existsSync8,
10643
+ mkdirSync,
10644
+ readdirSync
10645
+ } from "node:fs";
10646
+ import { join as join12 } from "node:path";
10647
+ function copyAssetsToReroute(cwd, sourceAssetsDir, rerouteAssetsDir) {
10648
+ if (!existsSync8(sourceAssetsDir)) {
10649
+ return 0;
10650
+ }
10651
+ const rerouteDir = join12(cwd, ".reroute");
10652
+ if (!existsSync8(rerouteDir)) {
10653
+ mkdirSync(rerouteDir, { recursive: true });
10654
+ }
10655
+ cpSync(sourceAssetsDir, rerouteAssetsDir, { recursive: true });
10656
+ return countFiles(rerouteAssetsDir);
10657
+ }
10658
+ function countFiles(dir) {
10659
+ let count = 0;
10660
+ const entries = readdirSync(dir, { withFileTypes: true });
10661
+ for (const entry of entries) {
10662
+ if (entry.isDirectory()) {
10663
+ count += countFiles(join12(dir, entry.name));
10664
+ } else {
10665
+ count++;
10666
+ }
10667
+ }
10668
+ return count;
10669
+ }
10670
+ var init_assets = () => {};
10671
+
10639
10672
  // packages/cli/src/commands/build.ts
10640
10673
  var exports_build = {};
10641
10674
  __export(exports_build, {
10642
10675
  default: () => build
10643
10676
  });
10644
10677
  import { spawn as spawn4 } from "node:child_process";
10645
- import {
10646
- cpSync,
10647
- existsSync as existsSync8,
10648
- mkdirSync,
10649
- readdirSync,
10650
- readFileSync as readFileSync5
10651
- } from "node:fs";
10652
- import { dirname as dirname6, join as join12 } from "node:path";
10678
+ import { existsSync as existsSync9, readFileSync as readFileSync5 } from "node:fs";
10679
+ import { join as join13 } from "node:path";
10653
10680
  function getRerouteCommand3() {
10654
- const binPath = join12(import.meta.dir, "..", "..", "bin.ts");
10655
- const isBunDev = existsSync8(binPath);
10681
+ const binPath = join13(import.meta.dir, "..", "..", "bin.ts");
10682
+ const isBunDev = existsSync9(binPath);
10656
10683
  if (isBunDev) {
10657
10684
  return `bun ${binPath}`;
10658
10685
  }
10659
10686
  const cwd = process.cwd();
10660
10687
  const nodeModulesPaths = [
10661
- join12(cwd, "node_modules", ".bin", "reroute"),
10662
- join12(cwd, "..", "node_modules", ".bin", "reroute"),
10663
- join12(cwd, "..", "..", "node_modules", ".bin", "reroute"),
10664
- join12(cwd, "..", "..", "..", "node_modules", ".bin", "reroute")
10688
+ join13(cwd, "node_modules", ".bin", "reroute"),
10689
+ join13(cwd, "..", "node_modules", ".bin", "reroute"),
10690
+ join13(cwd, "..", "..", "node_modules", ".bin", "reroute"),
10691
+ join13(cwd, "..", "..", "..", "node_modules", ".bin", "reroute")
10665
10692
  ];
10666
10693
  for (const binPath2 of nodeModulesPaths) {
10667
- if (existsSync8(binPath2)) {
10694
+ if (existsSync9(binPath2)) {
10668
10695
  return binPath2;
10669
10696
  }
10670
10697
  }
@@ -10672,8 +10699,8 @@ function getRerouteCommand3() {
10672
10699
  }
10673
10700
  function getOutputName() {
10674
10701
  const cwd = process.cwd();
10675
- const packageJsonPath = join12(cwd, "package.json");
10676
- if (existsSync8(packageJsonPath)) {
10702
+ const packageJsonPath = join13(cwd, "package.json");
10703
+ if (existsSync9(packageJsonPath)) {
10677
10704
  try {
10678
10705
  const packageJson = JSON.parse(readFileSync5(packageJsonPath, "utf-8"));
10679
10706
  const name = packageJson.name;
@@ -10737,6 +10764,18 @@ async function build(args) {
10737
10764
  });
10738
10765
  process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] Generation complete
10739
10766
  `));
10767
+ const cwd = process.cwd();
10768
+ const config2 = await loadConfig(cwd);
10769
+ const assetsPath = config2.options?.assets || "src/client";
10770
+ const sourceAssetsDir = join13(cwd, assetsPath, "assets");
10771
+ const rerouteAssetsDir = join13(cwd, ".reroute", "assets");
10772
+ process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] Copying assets...
10773
+ `));
10774
+ const fileCount = copyAssetsToReroute(cwd, sourceAssetsDir, rerouteAssetsDir);
10775
+ if (fileCount > 0) {
10776
+ process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] Copied ${fileCount} assets to ${rerouteAssetsDir}
10777
+ `));
10778
+ }
10740
10779
  process.stdout.write(`${colorizeLogPrefixAnsi(`[reroute/build] Building binary to ${outputPath}...`)}
10741
10780
  `);
10742
10781
  const buildArgs = [
@@ -10778,35 +10817,6 @@ async function build(args) {
10778
10817
  reject(error);
10779
10818
  });
10780
10819
  });
10781
- const cwd = process.cwd();
10782
- const config2 = await loadConfig(cwd);
10783
- const assetsPath = config2.options?.assets || "src/client";
10784
- const sourceAssetsDir = join12(cwd, assetsPath, "assets");
10785
- const distDir = dirname6(outputPath);
10786
- const destAssetsDir = join12(distDir, "assets");
10787
- if (existsSync8(sourceAssetsDir)) {
10788
- process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] Copying assets...
10789
- `));
10790
- if (!existsSync8(distDir)) {
10791
- mkdirSync(distDir, { recursive: true });
10792
- }
10793
- cpSync(sourceAssetsDir, destAssetsDir, { recursive: true });
10794
- const countFiles = (dir) => {
10795
- let count = 0;
10796
- const entries = readdirSync(dir, { withFileTypes: true });
10797
- for (const entry of entries) {
10798
- if (entry.isDirectory()) {
10799
- count += countFiles(join12(dir, entry.name));
10800
- } else {
10801
- count++;
10802
- }
10803
- }
10804
- return count;
10805
- };
10806
- const fileCount = countFiles(destAssetsDir);
10807
- process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] Copied ${fileCount} assets to ${destAssetsDir}
10808
- `));
10809
- }
10810
10820
  } catch (error) {
10811
10821
  process.stderr.write(`${colorizeLogPrefixAnsi("[reroute/build] Error: ") + String(error)}
10812
10822
  `);
@@ -10815,6 +10825,7 @@ async function build(args) {
10815
10825
  }
10816
10826
  var init_build = __esm(() => {
10817
10827
  init_core();
10828
+ init_assets();
10818
10829
  init_log();
10819
10830
  });
10820
10831
 
@@ -10823,23 +10834,23 @@ var exports_command = {};
10823
10834
  __export(exports_command, {
10824
10835
  getRerouteCommand: () => getRerouteCommand4
10825
10836
  });
10826
- import { existsSync as existsSync9 } from "node:fs";
10827
- import { join as join13 } from "node:path";
10837
+ import { existsSync as existsSync10 } from "node:fs";
10838
+ import { join as join14 } from "node:path";
10828
10839
  function getRerouteCommand4() {
10829
- const binPath = join13(import.meta.dir, "..", "..", "bin.ts");
10830
- const isBunDev = existsSync9(binPath);
10840
+ const binPath = join14(import.meta.dir, "..", "..", "bin.ts");
10841
+ const isBunDev = existsSync10(binPath);
10831
10842
  if (isBunDev) {
10832
10843
  return `bun ${binPath}`;
10833
10844
  }
10834
10845
  const cwd = process.cwd();
10835
10846
  const nodeModulesPaths = [
10836
- join13(cwd, "node_modules", ".bin", "reroute"),
10837
- join13(cwd, "..", "node_modules", ".bin", "reroute"),
10838
- join13(cwd, "..", "..", "node_modules", ".bin", "reroute"),
10839
- join13(cwd, "..", "..", "..", "node_modules", ".bin", "reroute")
10847
+ join14(cwd, "node_modules", ".bin", "reroute"),
10848
+ join14(cwd, "..", "node_modules", ".bin", "reroute"),
10849
+ join14(cwd, "..", "..", "node_modules", ".bin", "reroute"),
10850
+ join14(cwd, "..", "..", "..", "node_modules", ".bin", "reroute")
10840
10851
  ];
10841
10852
  for (const binPath2 of nodeModulesPaths) {
10842
- if (existsSync9(binPath2)) {
10853
+ if (existsSync10(binPath2)) {
10843
10854
  return binPath2;
10844
10855
  }
10845
10856
  }
@@ -10852,24 +10863,24 @@ var exports_analyze = {};
10852
10863
  __export(exports_analyze, {
10853
10864
  default: () => analyze
10854
10865
  });
10855
- import { existsSync as existsSync10, statSync } from "node:fs";
10866
+ import { existsSync as existsSync11, statSync } from "node:fs";
10856
10867
  import { readdir as readdir6, readFile, stat as stat5, writeFile } from "node:fs/promises";
10857
- import { basename as basename3, join as join14, relative as relative3 } from "node:path";
10868
+ import { basename as basename3, join as join15, relative as relative3 } from "node:path";
10858
10869
  import Table from "cli-table3";
10859
10870
  async function findBundles(cwd) {
10860
10871
  const bundles = [];
10861
- const chunksDir = join14(cwd, ".reroute", "chunks");
10862
- if (existsSync10(chunksDir)) {
10872
+ const chunksDir = join15(cwd, ".reroute", "chunks");
10873
+ if (existsSync11(chunksDir)) {
10863
10874
  const collections2 = await readdir6(chunksDir, { withFileTypes: true });
10864
10875
  for (const collection of collections2) {
10865
10876
  if (!collection.isDirectory())
10866
10877
  continue;
10867
- const collectionDir = join14(chunksDir, collection.name);
10878
+ const collectionDir = join15(chunksDir, collection.name);
10868
10879
  const files = await readdir6(collectionDir);
10869
10880
  for (const file of files) {
10870
10881
  if (!file.endsWith(".js"))
10871
10882
  continue;
10872
- const filePath = join14(collectionDir, file);
10883
+ const filePath = join15(collectionDir, file);
10873
10884
  const stats = await stat5(filePath);
10874
10885
  const content2 = await Bun.file(filePath).arrayBuffer();
10875
10886
  const gzippedSize = Bun.gzipSync(new Uint8Array(content2)).length;
@@ -10884,11 +10895,11 @@ async function findBundles(cwd) {
10884
10895
  }
10885
10896
  }
10886
10897
  }
10887
- const distDir = join14(cwd, "dist");
10888
- if (existsSync10(distDir)) {
10898
+ const distDir = join15(cwd, "dist");
10899
+ if (existsSync11(distDir)) {
10889
10900
  const files = await readdir6(distDir);
10890
10901
  for (const file of files) {
10891
- const filePath = join14(distDir, file);
10902
+ const filePath = join15(distDir, file);
10892
10903
  const stats = statSync(filePath);
10893
10904
  if (stats.isFile() && !file.endsWith(".map") && !file.endsWith(".d.ts")) {
10894
10905
  const content2 = await Bun.file(filePath).arrayBuffer();
@@ -10908,13 +10919,13 @@ async function findBundles(cwd) {
10908
10919
  }
10909
10920
  async function findBrowserEntry(cwd) {
10910
10921
  try {
10911
- const clientDir = join14(cwd, "src", "client");
10912
- const tsxEntry = join14(clientDir, "index.tsx");
10913
- const tsEntry = join14(clientDir, "index.ts");
10922
+ const clientDir = join15(cwd, "src", "client");
10923
+ const tsxEntry = join15(clientDir, "index.tsx");
10924
+ const tsEntry = join15(clientDir, "index.ts");
10914
10925
  let sourceEntry = null;
10915
- if (existsSync10(tsxEntry)) {
10926
+ if (existsSync11(tsxEntry)) {
10916
10927
  sourceEntry = tsxEntry;
10917
- } else if (existsSync10(tsEntry)) {
10928
+ } else if (existsSync11(tsEntry)) {
10918
10929
  sourceEntry = tsEntry;
10919
10930
  }
10920
10931
  if (!sourceEntry)
@@ -10943,12 +10954,12 @@ async function findBrowserEntry(cwd) {
10943
10954
  console.warn("[reroute/analyze] Browser build produced no outputs");
10944
10955
  return null;
10945
10956
  }
10946
- const tempDir = join14(cwd, ".reroute", "browser");
10957
+ const tempDir = join15(cwd, ".reroute", "browser");
10947
10958
  await import("node:fs/promises").then((fs) => fs.mkdir(tempDir, { recursive: true }));
10948
10959
  const output = result.outputs[0];
10949
10960
  const code = await output.text();
10950
10961
  const actualHash = await generateContentHash2(code);
10951
- const bundlePath = join14(tempDir, `index.${actualHash}.js`);
10962
+ const bundlePath = join15(tempDir, `index.${actualHash}.js`);
10952
10963
  await writeFile(bundlePath, code, "utf-8");
10953
10964
  const mapOutput = result.outputs.find((o) => o.path.endsWith(".map"));
10954
10965
  if (mapOutput) {
@@ -11000,8 +11011,8 @@ function calculateStats(bundles) {
11000
11011
  }
11001
11012
  async function getInstalledPackageSizes(cwd) {
11002
11013
  const packageSizes = new Map;
11003
- const nodeModulesDir = join14(cwd, "node_modules");
11004
- if (!existsSync10(nodeModulesDir))
11014
+ const nodeModulesDir = join15(cwd, "node_modules");
11015
+ if (!existsSync11(nodeModulesDir))
11005
11016
  return packageSizes;
11006
11017
  try {
11007
11018
  const { execSync } = await import("node:child_process");
@@ -11039,7 +11050,7 @@ async function getInstalledPackageSizes(cwd) {
11039
11050
  }
11040
11051
  async function buildDependencyTree(entryPath, cwd) {
11041
11052
  try {
11042
- if (!existsSync10(entryPath))
11053
+ if (!existsSync11(entryPath))
11043
11054
  return null;
11044
11055
  const root = {
11045
11056
  name: basename3(entryPath),
@@ -11059,7 +11070,7 @@ async function buildDependencyTree(entryPath, cwd) {
11059
11070
  if (!pkgNode) {
11060
11071
  pkgNode = {
11061
11072
  name: pkgName || "unknown",
11062
- path: join14(cwd, "node_modules", pkgName || ""),
11073
+ path: join15(cwd, "node_modules", pkgName || ""),
11063
11074
  size: 0,
11064
11075
  children: []
11065
11076
  };
@@ -11080,7 +11091,7 @@ async function buildDependencyTree(entryPath, cwd) {
11080
11091
  if (!child) {
11081
11092
  child = {
11082
11093
  name: part,
11083
- path: join14(cwd, ...parts.slice(0, i + 1)),
11094
+ path: join15(cwd, ...parts.slice(0, i + 1)),
11084
11095
  size: 0,
11085
11096
  children: []
11086
11097
  };
@@ -11104,7 +11115,7 @@ async function buildDependencyTree(entryPath, cwd) {
11104
11115
  const modulePattern = /\/\/\s*(.+?\.(?:ts|tsx|js|jsx|mjs|cjs))\s*$/gm;
11105
11116
  const nodeModulesNode = {
11106
11117
  name: "node_modules",
11107
- path: join14(cwd, "node_modules"),
11118
+ path: join15(cwd, "node_modules"),
11108
11119
  size: 0,
11109
11120
  children: []
11110
11121
  };
@@ -11170,7 +11181,7 @@ async function buildTreeFromSourceMap(bundlePath, cwd) {
11170
11181
  if (sourcePath.startsWith("/") || sourcePath.match(/^[A-Za-z]:\\/))
11171
11182
  return sourcePath;
11172
11183
  const bundleDir = bundlePath.substring(0, bundlePath.lastIndexOf("/"));
11173
- return join14(bundleDir, sourceRoot || "", sourcePath);
11184
+ return join15(bundleDir, sourceRoot || "", sourcePath);
11174
11185
  }, computeSizes = function(node) {
11175
11186
  if (node.children && node.children.length > 0) {
11176
11187
  node.size = node.children.reduce((s, c) => s + computeSizes(c), 0);
@@ -11178,7 +11189,7 @@ async function buildTreeFromSourceMap(bundlePath, cwd) {
11178
11189
  return node.size;
11179
11190
  };
11180
11191
  const mapPath = `${bundlePath}.map`;
11181
- if (!existsSync10(mapPath))
11192
+ if (!existsSync11(mapPath))
11182
11193
  return null;
11183
11194
  const [bundle, mapJson] = await Promise.all([
11184
11195
  readFile(bundlePath, "utf-8"),
@@ -11242,7 +11253,7 @@ async function buildTreeFromSourceMap(bundlePath, cwd) {
11242
11253
  };
11243
11254
  const nodeModulesNode = {
11244
11255
  name: "node_modules",
11245
- path: join14(cwd, "node_modules"),
11256
+ path: join15(cwd, "node_modules"),
11246
11257
  size: 0,
11247
11258
  children: []
11248
11259
  };
@@ -11282,7 +11293,7 @@ async function buildTreeFromSourceMap(bundlePath, cwd) {
11282
11293
  if (!pkgNode) {
11283
11294
  pkgNode = {
11284
11295
  name: pkgName || "unknown",
11285
- path: join14(cwd, "node_modules", pkgName || ""),
11296
+ path: join15(cwd, "node_modules", pkgName || ""),
11286
11297
  size: 0,
11287
11298
  children: []
11288
11299
  };
@@ -11303,7 +11314,7 @@ async function buildTreeFromSourceMap(bundlePath, cwd) {
11303
11314
  if (!child) {
11304
11315
  child = {
11305
11316
  name: part,
11306
- path: join14(cwd, ...parts.slice(0, i2 + 1)),
11317
+ path: join15(cwd, ...parts.slice(0, i2 + 1)),
11307
11318
  size: 0,
11308
11319
  children: []
11309
11320
  };
@@ -11333,11 +11344,11 @@ async function generateHTMLReport(stats, depTree, mainInfo, browserDepTree, brow
11333
11344
  let actualServerBinarySize = null;
11334
11345
  let actualServerBinaryGzipped = null;
11335
11346
  try {
11336
- const distDir = join14(process.cwd(), "dist");
11337
- if (existsSync10(distDir)) {
11347
+ const distDir = join15(process.cwd(), "dist");
11348
+ if (existsSync11(distDir)) {
11338
11349
  const files = await readdir6(distDir);
11339
11350
  for (const file of files) {
11340
- const filePath = join14(distDir, file);
11351
+ const filePath = join15(distDir, file);
11341
11352
  const stats2 = statSync(filePath);
11342
11353
  if (stats2.isFile() && !file.includes(".")) {
11343
11354
  actualServerBinarySize = stats2.size;
@@ -12819,11 +12830,11 @@ async function printConsoleReport(stats, depTree, mainInfo, browserDepTree, brow
12819
12830
  let actualServerBinarySize = null;
12820
12831
  let actualServerBinaryGzipped = null;
12821
12832
  try {
12822
- const distDir = join14(process.cwd(), "dist");
12823
- if (existsSync10(distDir)) {
12833
+ const distDir = join15(process.cwd(), "dist");
12834
+ if (existsSync11(distDir)) {
12824
12835
  const files = await readdir6(distDir);
12825
12836
  for (const file of files) {
12826
- const filePath = join14(distDir, file);
12837
+ const filePath = join15(distDir, file);
12827
12838
  const stats2 = statSync(filePath);
12828
12839
  if (stats2.isFile() && !file.includes(".")) {
12829
12840
  actualServerBinarySize = stats2.size;
@@ -12857,8 +12868,8 @@ async function analyze(args) {
12857
12868
  const isProd = isProductionMode(args);
12858
12869
  const searchIndex = args.indexOf("--search");
12859
12870
  const initialSearch = searchIndex !== -1 && args[searchIndex + 1] ? args[searchIndex + 1] : "";
12860
- const rerouteIndexPath = join14(cwd, ".reroute", "index.ts");
12861
- if (!existsSync10(rerouteIndexPath)) {
12871
+ const rerouteIndexPath = join15(cwd, ".reroute", "index.ts");
12872
+ if (!existsSync11(rerouteIndexPath)) {
12862
12873
  console.log(colorizeLogPrefixAnsi(`[reroute/analyze] .reroute artifacts not found, running build...
12863
12874
  `));
12864
12875
  const { spawn: spawn5 } = await import("node:child_process");
@@ -12920,12 +12931,12 @@ async function analyze(args) {
12920
12931
  let entry = null;
12921
12932
  let depTree = null;
12922
12933
  let mainInfo = null;
12923
- const srcEntry = join14(cwd, "src", "index.ts");
12924
- if (existsSync10(srcEntry)) {
12934
+ const srcEntry = join15(cwd, "src", "index.ts");
12935
+ if (existsSync11(srcEntry)) {
12925
12936
  console.log(colorizeLogPrefixAnsi(`[reroute/analyze] Building server binary for analysis...
12926
12937
  `));
12927
12938
  const { mkdir: mkdir3 } = await import("node:fs/promises");
12928
- const serverAnalysisDir = join14(cwd, ".reroute", "server");
12939
+ const serverAnalysisDir = join15(cwd, ".reroute", "server");
12929
12940
  await mkdir3(serverAnalysisDir, { recursive: true });
12930
12941
  const result = await Bun.build({
12931
12942
  entrypoints: [srcEntry],
@@ -12938,7 +12949,7 @@ async function analyze(args) {
12938
12949
  if (result.success && result.outputs.length > 0) {
12939
12950
  const output = result.outputs[0];
12940
12951
  const code = await output.text();
12941
- const analysisEntry = join14(serverAnalysisDir, "index.js");
12952
+ const analysisEntry = join15(serverAnalysisDir, "index.js");
12942
12953
  await writeFile(analysisEntry, code, "utf-8");
12943
12954
  const mapOutput = result.outputs.find((o) => o.path.endsWith(".map"));
12944
12955
  if (mapOutput) {
@@ -12956,8 +12967,8 @@ async function analyze(args) {
12956
12967
  `));
12957
12968
  const installedSizes = await getInstalledPackageSizes(cwd);
12958
12969
  if (depTree) {
12959
- const packageJsonPath = join14(cwd, "package.json");
12960
- if (existsSync10(packageJsonPath)) {
12970
+ const packageJsonPath = join15(cwd, "package.json");
12971
+ if (existsSync11(packageJsonPath)) {
12961
12972
  try {
12962
12973
  const packageJson = JSON.parse(await readFile(packageJsonPath, "utf-8"));
12963
12974
  const runtimeDeps = packageJson.dependencies || {};
@@ -12968,7 +12979,7 @@ async function analyze(args) {
12968
12979
  if (!trackedPkgs.has(pkgName) && installedSizes.has(pkgName)) {
12969
12980
  nodeModulesNode.children?.push({
12970
12981
  name: pkgName,
12971
- path: join14(cwd, "node_modules", pkgName),
12982
+ path: join15(cwd, "node_modules", pkgName),
12972
12983
  size: installedSizes.get(pkgName) || 0
12973
12984
  });
12974
12985
  }
@@ -12999,10 +13010,10 @@ async function analyze(args) {
12999
13010
  const fullOutput = args.includes("--full");
13000
13011
  await printConsoleReport(stats, depTree, mainInfo, browserDepTree, browserInfo, fullOutput);
13001
13012
  if (outputHtml || openBrowser) {
13002
- const htmlPath = join14(cwd, ".reroute", "analysis.html");
13013
+ const htmlPath = join15(cwd, ".reroute", "analysis.html");
13003
13014
  const html2 = await generateHTMLReport(stats, depTree, mainInfo, browserDepTree, browserInfo, initialSearch);
13004
13015
  const { mkdir: mkdir3 } = await import("node:fs/promises");
13005
- await mkdir3(join14(cwd, ".reroute"), { recursive: true });
13016
+ await mkdir3(join15(cwd, ".reroute"), { recursive: true });
13006
13017
  await writeFile(htmlPath, html2, "utf-8");
13007
13018
  console.log(colorizeLogPrefixAnsi(`[reroute/analyze] HTML report generated: ${relative3(cwd, htmlPath)}
13008
13019
  `));
@@ -13066,7 +13077,7 @@ __export(exports_og, {
13066
13077
  });
13067
13078
  import { spawn as spawn5 } from "node:child_process";
13068
13079
  import { readdir as readdir7 } from "node:fs/promises";
13069
- import { join as join15 } from "node:path";
13080
+ import { join as join16 } from "node:path";
13070
13081
  async function findAvailablePort() {
13071
13082
  const server = Bun.serve({
13072
13083
  port: 0,
@@ -13120,14 +13131,14 @@ Error output:`, errorOutput);
13120
13131
  return { port, process: proc };
13121
13132
  }
13122
13133
  async function findRoutesWithOG(cwd) {
13123
- const routesPath = join15(cwd, ROUTES_DIR2);
13134
+ const routesPath = join16(cwd, ROUTES_DIR2);
13124
13135
  const routes = [];
13125
13136
  async function scan(dir, base = "") {
13126
13137
  try {
13127
13138
  const entries = await readdir7(dir, { withFileTypes: true });
13128
13139
  for (const entry of entries) {
13129
- const fullPath = join15(dir, entry.name);
13130
- const relativePath = join15(base, entry.name);
13140
+ const fullPath = join16(dir, entry.name);
13141
+ const relativePath = join16(base, entry.name);
13131
13142
  if (entry.isDirectory()) {
13132
13143
  if (entry.name === "content")
13133
13144
  continue;
@@ -13144,7 +13155,7 @@ async function findRoutesWithOG(cwd) {
13144
13155
  const entries = await readdir7(routesPath, { withFileTypes: true });
13145
13156
  for (const entry of entries) {
13146
13157
  if (entry.isDirectory()) {
13147
- const contentDir = join15(routesPath, entry.name, "content");
13158
+ const contentDir = join16(routesPath, entry.name, "content");
13148
13159
  try {
13149
13160
  const contentFiles = await readdir7(contentDir);
13150
13161
  if (contentFiles.length > 0) {
@@ -13389,7 +13400,7 @@ async function getVersionString2() {
13389
13400
  }
13390
13401
  async function getVersion2() {
13391
13402
  if (true) {
13392
- return "0.20.3";
13403
+ return "0.20.4";
13393
13404
  }
13394
13405
  const possiblePaths = [
13395
13406
  path3.join(import.meta.dir, "../../../package.json"),
@@ -13406,10 +13417,10 @@ async function getVersion2() {
13406
13417
  }
13407
13418
  async function getCommit2() {
13408
13419
  if (true) {
13409
- return "71a926d";
13420
+ return "b55c7e7";
13410
13421
  }
13411
13422
  return "dev";
13412
13423
  }
13413
13424
  main();
13414
13425
 
13415
- //# debugId=92865B18E2048CEB64756E2164756E21
13426
+ //# debugId=87B653DED7FC6A5164756E2164756E21