reroute-js 1.0.0-alpha.26 → 1.0.0-alpha.27

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 (211) hide show
  1. package/cli/bin.d.ts +1 -1
  2. package/cli/bin.js +160 -83
  3. package/cli/bin.js.map +5 -5
  4. package/cli/index.d.ts +1 -1
  5. package/cli/index.js +13 -5
  6. package/cli/index.js.map +3 -3
  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/gen.d.ts.map +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/images.d.ts +1 -1
  20. package/cli/src/commands/lib/index.d.ts +1 -1
  21. package/cli/src/commands/lib/log.d.ts +1 -1
  22. package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
  23. package/cli/src/commands/lib/markdown/index.d.ts +1 -1
  24. package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
  25. package/cli/src/commands/lib/prerender.d.ts +1 -1
  26. package/cli/src/commands/lib/production.d.ts +1 -1
  27. package/cli/src/commands/lib/server.d.ts +1 -1
  28. package/cli/src/commands/lib/static.d.ts +1 -1
  29. package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
  30. package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
  31. package/cli/src/commands/lib/supervise.d.ts +1 -1
  32. package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
  33. package/cli/src/commands/lib/theme.d.ts +3 -1
  34. package/cli/src/commands/lib/theme.d.ts.map +1 -1
  35. package/cli/src/commands/lib/version.d.ts +1 -1
  36. package/cli/src/commands/lib/watch.d.ts +12 -1
  37. package/cli/src/commands/lib/watch.d.ts.map +1 -1
  38. package/cli/src/commands/og.d.ts +1 -1
  39. package/cli/src/commands/start.d.ts +1 -1
  40. package/cli/src/commands/static-render.d.ts +1 -1
  41. package/cli/src/index.d.ts +1 -1
  42. package/core/index.d.ts +1 -1
  43. package/core/index.js +2 -2
  44. package/core/index.js.map +1 -1
  45. package/core/src/app-paths.d.ts +1 -1
  46. package/core/src/bundler/hash.d.ts +1 -1
  47. package/core/src/bundler/index.d.ts +1 -1
  48. package/core/src/config.d.ts +1 -1
  49. package/core/src/content/discovery.d.ts +1 -1
  50. package/core/src/content/index.d.ts +1 -1
  51. package/core/src/content/metadata.d.ts +1 -1
  52. package/core/src/i18n/catalog.d.ts +1 -1
  53. package/core/src/i18n/discover.d.ts +1 -1
  54. package/core/src/i18n/index.d.ts +1 -1
  55. package/core/src/i18n/messages.d.ts +1 -1
  56. package/core/src/i18n/negotiate.d.ts +1 -1
  57. package/core/src/i18n/pathname.d.ts +1 -1
  58. package/core/src/i18n/resolve.d.ts +1 -1
  59. package/core/src/i18n/types.d.ts +1 -1
  60. package/core/src/image.d.ts +1 -1
  61. package/core/src/index.d.ts +1 -1
  62. package/core/src/llms/discovery.d.ts +1 -1
  63. package/core/src/llms/extractor.d.ts +1 -1
  64. package/core/src/llms/formatter.d.ts +1 -1
  65. package/core/src/llms/full-generator.d.ts +1 -1
  66. package/core/src/llms/index-generator.d.ts +1 -1
  67. package/core/src/llms/index.d.ts +1 -1
  68. package/core/src/og/discovery.d.ts +1 -1
  69. package/core/src/og/index.d.ts +1 -1
  70. package/core/src/og/meta.d.ts +1 -1
  71. package/core/src/og/render.d.ts +1 -1
  72. package/core/src/og/types.d.ts +1 -1
  73. package/core/src/robots/discovery.d.ts +1 -1
  74. package/core/src/robots/generator.d.ts +1 -1
  75. package/core/src/robots/index.d.ts +1 -1
  76. package/core/src/robots/policies.d.ts +1 -1
  77. package/core/src/rss/discovery.d.ts +1 -1
  78. package/core/src/rss/generator.d.ts +1 -1
  79. package/core/src/rss/index.d.ts +1 -1
  80. package/core/src/sitemap/discovery.d.ts +1 -1
  81. package/core/src/sitemap/generator.d.ts +1 -1
  82. package/core/src/sitemap/index.d.ts +1 -1
  83. package/core/src/ssr/index.d.ts +1 -1
  84. package/core/src/ssr/lib/cache.d.ts +1 -1
  85. package/core/src/ssr/lib/cleanup.d.ts +1 -1
  86. package/core/src/ssr/lib/collections.d.ts +1 -1
  87. package/core/src/ssr/lib/compression.d.ts +1 -1
  88. package/core/src/ssr/lib/compute/content.d.ts +1 -1
  89. package/core/src/ssr/lib/compute/index.d.ts +1 -1
  90. package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
  91. package/core/src/ssr/lib/compute/routes.d.ts +1 -1
  92. package/core/src/ssr/lib/content-path.d.ts +1 -1
  93. package/core/src/ssr/lib/data.d.ts +1 -1
  94. package/core/src/ssr/lib/html.d.ts +1 -1
  95. package/core/src/ssr/lib/imports.d.ts +1 -1
  96. package/core/src/ssr/lib/index.d.ts +1 -1
  97. package/core/src/ssr/lib/layouts.d.ts +1 -1
  98. package/core/src/ssr/lib/metadata.d.ts +1 -1
  99. package/core/src/ssr/lib/mime.d.ts +1 -1
  100. package/core/src/ssr/lib/modules.d.ts +1 -1
  101. package/core/src/ssr/lib/path.d.ts +1 -1
  102. package/core/src/ssr/lib/preload.d.ts +1 -1
  103. package/core/src/ssr/lib/route-match.d.ts +1 -1
  104. package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
  105. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  106. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  107. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  108. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  109. package/core/src/ssr/lib/seed.d.ts +1 -1
  110. package/core/src/ssr/lib/serialize.d.ts +1 -1
  111. package/core/src/ssr/lib/setup.d.ts +1 -1
  112. package/core/src/ssr/lib/styles.d.ts +1 -1
  113. package/core/src/ssr/lib/template.d.ts +1 -1
  114. package/core/src/ssr/lib/types.d.ts +1 -1
  115. package/core/src/ssr/render.d.ts +1 -1
  116. package/core/src/ssr/stream.d.ts +1 -1
  117. package/elysia/index.d.ts +1 -1
  118. package/elysia/index.js +2 -2
  119. package/elysia/index.js.map +1 -1
  120. package/elysia/src/index.d.ts +1 -1
  121. package/elysia/src/libs/assets.d.ts +1 -1
  122. package/elysia/src/libs/cache.d.ts +1 -1
  123. package/elysia/src/libs/caching.d.ts +1 -1
  124. package/elysia/src/libs/devReload.d.ts +1 -1
  125. package/elysia/src/libs/http.d.ts +1 -1
  126. package/elysia/src/libs/i18n.d.ts +1 -1
  127. package/elysia/src/libs/image.d.ts +1 -1
  128. package/elysia/src/libs/index.d.ts +1 -1
  129. package/elysia/src/libs/llms.d.ts +1 -1
  130. package/elysia/src/libs/response.d.ts +1 -1
  131. package/elysia/src/libs/serving.d.ts +1 -1
  132. package/elysia/src/plugin.d.ts +1 -1
  133. package/elysia/src/routes/artifacts.d.ts +1 -1
  134. package/elysia/src/routes/content.d.ts +1 -1
  135. package/elysia/src/routes/image.d.ts +1 -1
  136. package/elysia/src/routes/index.d.ts +1 -1
  137. package/elysia/src/routes/internal.d.ts +1 -1
  138. package/elysia/src/routes/liveReloadClient.d.ts +1 -1
  139. package/elysia/src/routes/llms.d.ts +1 -1
  140. package/elysia/src/routes/og.d.ts +1 -1
  141. package/elysia/src/routes/redirects.d.ts +1 -1
  142. package/elysia/src/routes/robots.d.ts +1 -1
  143. package/elysia/src/routes/rss.d.ts +1 -1
  144. package/elysia/src/routes/search.d.ts +1 -1
  145. package/elysia/src/routes/sitemap.d.ts +1 -1
  146. package/elysia/src/routes/ssr.d.ts +1 -1
  147. package/elysia/src/routes/static.d.ts +1 -1
  148. package/elysia/src/routes/themeCssRefresh.d.ts +1 -1
  149. package/elysia/src/types.d.ts +1 -1
  150. package/package.json +1 -1
  151. package/react/index.d.ts +1 -1
  152. package/react/index.js +2 -2
  153. package/react/index.js.map +1 -1
  154. package/react/src/components/ClientOnly.d.ts +1 -1
  155. package/react/src/components/ContentRoute.d.ts +1 -1
  156. package/react/src/components/Image.d.ts +1 -1
  157. package/react/src/components/LazyRoute.d.ts +1 -1
  158. package/react/src/components/Link.d.ts +1 -1
  159. package/react/src/components/Markdown.d.ts +1 -1
  160. package/react/src/components/Outlet.d.ts +1 -1
  161. package/react/src/components/index.d.ts +1 -1
  162. package/react/src/hooks/index.d.ts +1 -1
  163. package/react/src/hooks/useContent.d.ts +1 -1
  164. package/react/src/hooks/useData.d.ts +1 -1
  165. package/react/src/hooks/useFeed.d.ts +1 -1
  166. package/react/src/hooks/useLayoutData.d.ts +1 -1
  167. package/react/src/hooks/useLlms.d.ts +1 -1
  168. package/react/src/hooks/useNavigate.d.ts +1 -1
  169. package/react/src/hooks/useParams.d.ts +1 -1
  170. package/react/src/hooks/useRouter.d.ts +1 -1
  171. package/react/src/hooks/useSearch.d.ts +1 -1
  172. package/react/src/hooks/useSearchParams.d.ts +1 -1
  173. package/react/src/hooks/useToc.d.ts +1 -1
  174. package/react/src/i18n/LocaleProvider.d.ts +1 -1
  175. package/react/src/i18n/helpers.d.ts +1 -1
  176. package/react/src/i18n/index.d.ts +1 -1
  177. package/react/src/index.d.ts +1 -1
  178. package/react/src/lib/bundle.d.ts +1 -1
  179. package/react/src/lib/collection.d.ts +1 -1
  180. package/react/src/lib/content.d.ts +1 -1
  181. package/react/src/lib/head.d.ts +1 -1
  182. package/react/src/lib/index.d.ts +1 -1
  183. package/react/src/lib/layouts.d.ts +1 -1
  184. package/react/src/lib/lazy-route.d.ts +1 -1
  185. package/react/src/lib/route-loader.d.ts +1 -1
  186. package/react/src/lib/static-data.d.ts +1 -1
  187. package/react/src/providers/ContentProvider.d.ts +1 -1
  188. package/react/src/providers/RerouteProvider.d.ts +1 -1
  189. package/react/src/providers/RouterProvider.d.ts +1 -1
  190. package/react/src/providers/index.d.ts +1 -1
  191. package/react/src/types/any.d.ts +1 -1
  192. package/react/src/types/index.d.ts +1 -1
  193. package/react/src/types/router.d.ts +1 -1
  194. package/telemetry/react.d.ts +1 -1
  195. package/telemetry/react.js +2 -2
  196. package/telemetry/react.js.map +1 -1
  197. package/telemetry/server.d.ts +1 -1
  198. package/telemetry/server.js +2 -2
  199. package/telemetry/server.js.map +1 -1
  200. package/telemetry/src/react/api.d.ts +1 -1
  201. package/telemetry/src/react/context.d.ts +1 -1
  202. package/telemetry/src/react/index.d.ts +1 -1
  203. package/telemetry/src/react/telemetry.d.ts +1 -1
  204. package/telemetry/src/server/context.d.ts +1 -1
  205. package/telemetry/src/server/headers/extractor.d.ts +1 -1
  206. package/telemetry/src/server/headers/index.d.ts +1 -1
  207. package/telemetry/src/server/headers/presets.d.ts +1 -1
  208. package/telemetry/src/server/index.d.ts +1 -1
  209. package/telemetry/src/server/instrumentation.d.ts +1 -1
  210. package/telemetry/src/server/plugin.d.ts +1 -1
  211. package/telemetry/src/server/sourcemap.d.ts +1 -1
package/cli/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
3
  /**
4
- * reroute-js v1.0.0-alpha.26
4
+ * reroute-js v1.0.0-alpha.27
5
5
  *
6
6
  * @license MIT
7
7
  * @copyright 2026 stewones <hi@stewan.io>
@@ -68,7 +68,7 @@ async function getVersionString() {
68
68
  }
69
69
  async function getVersion() {
70
70
  if (true) {
71
- return "1.0.0-alpha.26";
71
+ return "1.0.0-alpha.27";
72
72
  }
73
73
  const possiblePaths = [
74
74
  path.join(import.meta.dir, "../../../../package.json"),
@@ -86,7 +86,7 @@ async function getVersion() {
86
86
  }
87
87
  async function getCommit() {
88
88
  if (true) {
89
- return "f166380";
89
+ return "18a14e0";
90
90
  }
91
91
  return "dev";
92
92
  }
@@ -8228,6 +8228,12 @@ function isFileImport(specifier) {
8228
8228
  return true;
8229
8229
  }
8230
8230
  function bundleCssEntrypoint(entryPath) {
8231
+ return walkCssEntrypoint(entryPath).css;
8232
+ }
8233
+ function cssEntrypointFiles(entryPath) {
8234
+ return walkCssEntrypoint(entryPath).files;
8235
+ }
8236
+ function walkCssEntrypoint(entryPath) {
8231
8237
  const absEntry = resolve3(entryPath);
8232
8238
  const stack = new Set;
8233
8239
  const completed = new Set;
@@ -8260,7 +8266,8 @@ ${bundleFile(importedPath)}
8260
8266
  completed.add(absPath);
8261
8267
  return bundled;
8262
8268
  }
8263
- return bundleFile(absEntry);
8269
+ const css = bundleFile(absEntry);
8270
+ return { css, files: [...completed] };
8264
8271
  }
8265
8272
  async function pruneStaleThemeCss(bundlesDir, keep) {
8266
8273
  const files = await readdir7(bundlesDir);
@@ -8303,7 +8310,7 @@ var init_theme = __esm(() => {
8303
8310
  // packages/cli/src/commands/lib/watch.ts
8304
8311
  import { createHash as createHash3 } from "node:crypto";
8305
8312
  import { readFile } from "node:fs/promises";
8306
- import { join as join13, sep } from "node:path";
8313
+ import { dirname as dirname7, isAbsolute as isAbsolute2, join as join13, resolve as resolve4, sep } from "node:path";
8307
8314
  function isWatchNoise(name) {
8308
8315
  return name.split(/[/\\]/).some((part) => part.startsWith(".")) || /\.bust-[^/\\]+$/.test(name);
8309
8316
  }
@@ -8368,9 +8375,26 @@ async function retainChangedFiles(root, names, fingerprint) {
8368
8375
  }
8369
8376
  return changed;
8370
8377
  }
8371
- var sourceFile;
8378
+ function bundleInputFiles(metafile, base = process.cwd()) {
8379
+ if (typeof metafile !== "object" || metafile === null || !("inputs" in metafile) || typeof metafile.inputs !== "object" || metafile.inputs === null) {
8380
+ return [];
8381
+ }
8382
+ return Object.keys(metafile.inputs).filter((path3) => !(namespaced.test(path3) || path3.includes("node_modules") || path3.includes(".reroute"))).map((path3) => isAbsolute2(path3) ? path3 : resolve4(base, path3));
8383
+ }
8384
+ function importedWatchDirs(files, coveredRoots) {
8385
+ const covered = coveredRoots.map((root) => root.endsWith(sep) ? root : `${root}${sep}`);
8386
+ const dirs = new Set;
8387
+ for (const file of files) {
8388
+ if (covered.some((root) => file.startsWith(root)))
8389
+ continue;
8390
+ dirs.add(dirname7(file));
8391
+ }
8392
+ return [...dirs].sort();
8393
+ }
8394
+ var sourceFile, namespaced;
8372
8395
  var init_watch = __esm(() => {
8373
8396
  sourceFile = /\.(tsx?|jsx?|mdx?|css|json)$/;
8397
+ namespaced = /^[a-z][a-z0-9+.-]+:(?![\\/])/i;
8374
8398
  });
8375
8399
 
8376
8400
  // packages/cli/src/commands/gen.ts
@@ -8379,9 +8403,9 @@ __export(exports_gen, {
8379
8403
  default: () => gen,
8380
8404
  startGenWatch: () => startGenWatch
8381
8405
  });
8382
- import { watch } from "node:fs";
8406
+ import { existsSync as existsSync8, watch } from "node:fs";
8383
8407
  import { copyFile as copyFile2, mkdir as mkdir3, readdir as readdir8, rm, unlink as unlink3 } from "node:fs/promises";
8384
- import { dirname as dirname7, extname as extname4, join as join14, resolve as resolve4 } from "node:path";
8408
+ import { dirname as dirname8, extname as extname4, join as join14, relative as relative3, resolve as resolve5 } from "node:path";
8385
8409
  import { pathToFileURL as pathToFileURL8 } from "node:url";
8386
8410
  async function bundleThemeCssIntoArtifacts(cwd) {
8387
8411
  const cssPath = join14(cwd, ".reroute", "bundles", "index.css");
@@ -8875,7 +8899,7 @@ async function buildStreamingWrappersForTree(cwd, routesPath, tree, config2) {
8875
8899
  if (!analysis.needsStreaming)
8876
8900
  continue;
8877
8901
  const wrapperPath = join14(streamingDir, candidate.filePath).replace(/\.(tsx|ts)$/, ".tsx");
8878
- await mkdir3(dirname7(wrapperPath), { recursive: true });
8902
+ await mkdir3(dirname8(wrapperPath), { recursive: true });
8879
8903
  const code = await generateStreamingWrapper({
8880
8904
  cwd,
8881
8905
  relativeFilePath: candidate.filePath,
@@ -8943,7 +8967,7 @@ async function loadContentMeta(absSrc, buildSrc, isMarkdown) {
8943
8967
  if (isMarkdown) {
8944
8968
  return processMarkdownFile(absSrc).frontmatter || {};
8945
8969
  }
8946
- const tmp = join14(dirname7(buildSrc), `.meta-${Date.now()}-${Math.random().toString(36).slice(2)}${extname4(buildSrc)}`);
8970
+ const tmp = join14(dirname8(buildSrc), `.meta-${Date.now()}-${Math.random().toString(36).slice(2)}${extname4(buildSrc)}`);
8947
8971
  try {
8948
8972
  await copyFile2(buildSrc, tmp);
8949
8973
  const m = await import(pathToFileURL8(tmp).href);
@@ -9385,6 +9409,7 @@ async function buildEntrypointBundle(cwd, args = []) {
9385
9409
  minify: isProd,
9386
9410
  ...getCommonBuildOptions(),
9387
9411
  naming: getNamingConfig({ entry: "index.[hash].[ext]" }),
9412
+ ...bundleGraphOptions,
9388
9413
  jsx: {
9389
9414
  runtime: "automatic",
9390
9415
  importSource: "react",
@@ -9445,6 +9470,7 @@ async function buildEntrypointBundle(cwd, args = []) {
9445
9470
  console.error(log);
9446
9471
  throw new Error("Bundle failed");
9447
9472
  }
9473
+ clientBundleInputs = bundleInputFiles("metafile" in result ? result.metafile : undefined);
9448
9474
  const outputs = [];
9449
9475
  let entryFile = "";
9450
9476
  let entryContent = "";
@@ -9915,6 +9941,7 @@ async function startGenWatch(cwd, args) {
9915
9941
  }
9916
9942
  const duration = ((performance.now() - startTime) / 1000).toFixed(2);
9917
9943
  console.log(`[reroute/watch] ✓ Rebuild complete in ${duration}s (${reason})`);
9944
+ syncImportedWatchers();
9918
9945
  if (reloadMode !== "css") {
9919
9946
  await Bun.sleep(200);
9920
9947
  }
@@ -10124,6 +10151,7 @@ async function startGenWatch(cwd, args) {
10124
10151
  }
10125
10152
  const watchClientSources = (dir, skipRoutes) => {
10126
10153
  let pending = new Set;
10154
+ const debounce = createDebouncer(150);
10127
10155
  return watch(dir, { recursive: true }, (_ev, filename) => {
10128
10156
  if (!filename)
10129
10157
  return;
@@ -10131,7 +10159,7 @@ async function startGenWatch(cwd, args) {
10131
10159
  if (!isClientSource(name, skipRoutes))
10132
10160
  return;
10133
10161
  pending.add(name);
10134
- mediumDebounce(() => {
10162
+ debounce(() => {
10135
10163
  const names = [...pending];
10136
10164
  pending = new Set;
10137
10165
  retainChangedFiles(dir, names, fingerprint).then((changed) => {
@@ -10145,10 +10173,57 @@ async function startGenWatch(cwd, args) {
10145
10173
  };
10146
10174
  const clientWatcher = watchClientSources(clientPath, true);
10147
10175
  const extraWatchers = (loadedConfig.app?.watch ?? []).map((entry) => {
10148
- const dir = resolve4(cwd, entry);
10176
+ const dir = resolve5(cwd, entry);
10149
10177
  console.log(`[reroute/watch] \uD83D\uDCE6 Watching ${dir}...`);
10150
10178
  return watchClientSources(dir, false);
10151
10179
  });
10180
+ const coveredRoots = [
10181
+ clientPath,
10182
+ ...(loadedConfig.app?.watch ?? []).map((entry) => resolve5(cwd, entry))
10183
+ ];
10184
+ const cssEntryPath = join14(cwd, watchPaths.cssEntry);
10185
+ const importedWatchers = new Map;
10186
+ const importedDebounce = createDebouncer(150);
10187
+ let importedPending = new Set;
10188
+ const watchImportedDir = (dir) => watch(dir, (_ev, filename) => {
10189
+ if (!filename)
10190
+ return;
10191
+ const name = String(filename);
10192
+ if (!isClientSource(name, false))
10193
+ return;
10194
+ importedPending.add(join14(dir, name));
10195
+ importedDebounce(() => {
10196
+ const files = [...importedPending];
10197
+ importedPending = new Set;
10198
+ retainChangedFiles("", files, fingerprint).then((changed) => {
10199
+ if (changed.length === 0)
10200
+ return;
10201
+ const reloadMode = changed.every((n) => n.endsWith(".css")) ? "css" : "full";
10202
+ scheduleBuild(() => rebuildWatchedClient(changed.map((f) => relative3(cwd, f))), "client change", reloadMode);
10203
+ });
10204
+ });
10205
+ });
10206
+ function syncImportedWatchers() {
10207
+ let files = clientBundleInputs;
10208
+ try {
10209
+ if (existsSync8(cssEntryPath)) {
10210
+ files = files.concat(cssEntrypointFiles(cssEntryPath));
10211
+ }
10212
+ } catch {}
10213
+ const added = [];
10214
+ for (const dir of importedWatchDirs(files, coveredRoots)) {
10215
+ if (importedWatchers.has(dir))
10216
+ continue;
10217
+ try {
10218
+ importedWatchers.set(dir, watchImportedDir(dir));
10219
+ added.push(dir);
10220
+ } catch {}
10221
+ }
10222
+ if (added.length > 0) {
10223
+ console.log(`[reroute/watch] \uD83D\uDCE6 Watching ${added.length} imported folder(s) outside the client root`);
10224
+ }
10225
+ }
10226
+ syncImportedWatchers();
10152
10227
  console.log(`[reroute/watch] ✓ Watch mode active - ready for changes!
10153
10228
  `);
10154
10229
  const watchers = [
@@ -10163,7 +10238,7 @@ async function startGenWatch(cwd, args) {
10163
10238
  close() {
10164
10239
  console.log(`
10165
10240
  [reroute/watch] \uD83D\uDED1 Stopping watch mode...`);
10166
- for (const watcher of watchers) {
10241
+ for (const watcher of [...watchers, ...importedWatchers.values()]) {
10167
10242
  try {
10168
10243
  watcher?.close();
10169
10244
  } catch {}
@@ -10188,15 +10263,15 @@ async function gen(args) {
10188
10263
  process.exit(0);
10189
10264
  }
10190
10265
  const session = await startGenWatch(cwd, args);
10191
- await new Promise((resolve5) => {
10266
+ await new Promise((resolve6) => {
10192
10267
  process.on("SIGINT", () => {
10193
10268
  session.close();
10194
- resolve5();
10269
+ resolve6();
10195
10270
  });
10196
10271
  });
10197
10272
  process.exit(0);
10198
10273
  }
10199
- var OUTPUT_DIR = ".reroute", OUTPUT_ROUTES = ".reroute/routes.ts", OUTPUT_ROUTES_CLIENT = ".reroute/routes.client.ts", OUTPUT_CONTENT_TS = ".reroute/content.ts", OUTPUT_COLLECTIONS_DIR = ".reroute/collections", OUTPUT_SEARCH_INDEX = ".reroute/search.json", OUTPUT_ARTIFACTS = ".reroute/artifacts.ts", OUTPUT_ARTIFACTS_SERVER = ".reroute/artifacts.server.ts", OUTPUT_ARTIFACTS_CLIENT = ".reroute/artifacts.client.ts", OUTPUT_CLIENT_ENTRY = ".reroute/client-entry.ts", OUTPUT_INDEX = ".reroute/index.ts";
10274
+ var OUTPUT_DIR = ".reroute", OUTPUT_ROUTES = ".reroute/routes.ts", OUTPUT_ROUTES_CLIENT = ".reroute/routes.client.ts", OUTPUT_CONTENT_TS = ".reroute/content.ts", OUTPUT_COLLECTIONS_DIR = ".reroute/collections", OUTPUT_SEARCH_INDEX = ".reroute/search.json", OUTPUT_ARTIFACTS = ".reroute/artifacts.ts", OUTPUT_ARTIFACTS_SERVER = ".reroute/artifacts.server.ts", OUTPUT_ARTIFACTS_CLIENT = ".reroute/artifacts.client.ts", OUTPUT_CLIENT_ENTRY = ".reroute/client-entry.ts", OUTPUT_INDEX = ".reroute/index.ts", clientBundleInputs, bundleGraphOptions;
10200
10275
  var init_gen = __esm(() => {
10201
10276
  init_core();
10202
10277
  init_env();
@@ -10206,6 +10281,8 @@ var init_gen = __esm(() => {
10206
10281
  init_suspense();
10207
10282
  init_theme();
10208
10283
  init_watch();
10284
+ clientBundleInputs = [];
10285
+ bundleGraphOptions = { metafile: true };
10209
10286
  });
10210
10287
 
10211
10288
  // packages/cli/src/commands/lib/command.ts
@@ -10213,11 +10290,11 @@ var exports_command = {};
10213
10290
  __export(exports_command, {
10214
10291
  getRerouteCommand: () => getRerouteCommand
10215
10292
  });
10216
- import { existsSync as existsSync8 } from "node:fs";
10293
+ import { existsSync as existsSync9 } from "node:fs";
10217
10294
  import { join as join15 } from "node:path";
10218
10295
  function getRerouteCommand() {
10219
10296
  const binPath = join15(import.meta.dir, "..", "..", "bin.ts");
10220
- const isBunDev = existsSync8(binPath);
10297
+ const isBunDev = existsSync9(binPath);
10221
10298
  if (isBunDev) {
10222
10299
  return `bun ${binPath}`;
10223
10300
  }
@@ -10229,7 +10306,7 @@ function getRerouteCommand() {
10229
10306
  join15(cwd, "..", "..", "..", "node_modules", ".bin", "reroute")
10230
10307
  ];
10231
10308
  for (const binPath2 of nodeModulesPaths) {
10232
- if (existsSync8(binPath2)) {
10309
+ if (existsSync9(binPath2)) {
10233
10310
  return binPath2;
10234
10311
  }
10235
10312
  }
@@ -10312,7 +10389,7 @@ async function waitForServerReady(port = 3000, timeout = 30000) {
10312
10389
  return;
10313
10390
  }
10314
10391
  } catch {}
10315
- await new Promise((resolve5) => setTimeout(resolve5, checkInterval));
10392
+ await new Promise((resolve6) => setTimeout(resolve6, checkInterval));
10316
10393
  checkInterval = Math.min(checkInterval * 1.5, maxInterval);
10317
10394
  }
10318
10395
  throw new Error(`Timeout waiting for server to respond after ${timeout}ms. ` + `Make sure your server is starting correctly on port ${port}.`);
@@ -10339,7 +10416,7 @@ async function supervise() {
10339
10416
  const onTerm = forward("SIGTERM");
10340
10417
  process.on("SIGINT", onInt);
10341
10418
  process.on("SIGTERM", onTerm);
10342
- const code = await new Promise((resolve5) => child.on("exit", (exitCode) => resolve5(exitCode)));
10419
+ const code = await new Promise((resolve6) => child.on("exit", (exitCode) => resolve6(exitCode)));
10343
10420
  process.off("SIGINT", onInt);
10344
10421
  process.off("SIGTERM", onTerm);
10345
10422
  if (afterDevExit(code) === "exit")
@@ -96041,7 +96118,7 @@ Should be of format "before:after"`);
96041
96118
  }
96042
96119
  }
96043
96120
  function objectize(node) {
96044
- function resolve5(value, key) {
96121
+ function resolve6(value, key) {
96045
96122
  if (!value._parent)
96046
96123
  return;
96047
96124
  if (value._parent._default && value._parent._default[key])
@@ -96064,8 +96141,8 @@ Should be of format "before:after"`);
96064
96141
  if (isObject(value)) {
96065
96142
  if (!value._before && !value._after)
96066
96143
  return objectize(value);
96067
- value._before = value._before || resolve5(value, "_before");
96068
- value._after = value._after || resolve5(value, "_after");
96144
+ value._before = value._before || resolve6(value, "_before");
96145
+ value._after = value._after || resolve6(value, "_after");
96069
96146
  return;
96070
96147
  }
96071
96148
  throw new Error("nodes need to be either {String}, {Object} or {Function}." + value + " is neither.");
@@ -104949,7 +105026,7 @@ __export(exports_dev, {
104949
105026
  default: () => dev
104950
105027
  });
104951
105028
  import { spawn as spawn2 } from "node:child_process";
104952
- import { existsSync as existsSync9 } from "node:fs";
105029
+ import { existsSync as existsSync10 } from "node:fs";
104953
105030
  import { join as join16 } from "node:path";
104954
105031
  import { pathToFileURL as pathToFileURL9 } from "node:url";
104955
105032
  function parsePort(args) {
@@ -104962,7 +105039,7 @@ function parsePort(args) {
104962
105039
  async function waitForInitialBuild(genProcess) {
104963
105040
  console.log("[reroute/dev] Waiting for initial build...");
104964
105041
  const outputBuffer = [];
104965
- const buildCompletePromise = new Promise((resolve5, reject) => {
105042
+ const buildCompletePromise = new Promise((resolve6, reject) => {
104966
105043
  const timeout = setTimeout(() => {
104967
105044
  reject(new Error("Timeout waiting for initial build to complete (120s)"));
104968
105045
  }, 120000);
@@ -104972,7 +105049,7 @@ async function waitForInitialBuild(genProcess) {
104972
105049
  clearTimeout(timeout);
104973
105050
  genProcess.stdout?.removeListener("data", checkComplete);
104974
105051
  genProcess.stderr?.removeListener("data", checkComplete);
104975
- resolve5();
105052
+ resolve6();
104976
105053
  }
104977
105054
  };
104978
105055
  genProcess.stdout?.on("data", checkComplete);
@@ -105042,7 +105119,7 @@ async function startDefault(port, args) {
105042
105119
  const session = await startGenWatch(process.cwd(), genWatchArgs(args));
105043
105120
  const { server: server2 } = resolveAppPaths(await loadConfig(process.cwd()));
105044
105121
  const entry = join16(process.cwd(), server2);
105045
- if (!existsSync9(entry)) {
105122
+ if (!existsSync10(entry)) {
105046
105123
  session.close();
105047
105124
  throw new Error(`[reroute/dev] Missing ${entry}`);
105048
105125
  }
@@ -105118,11 +105195,11 @@ __export(exports_start, {
105118
105195
  default: () => start
105119
105196
  });
105120
105197
  import { spawn as spawn3 } from "node:child_process";
105121
- import { existsSync as existsSync10 } from "node:fs";
105198
+ import { existsSync as existsSync11 } from "node:fs";
105122
105199
  import { join as join17 } from "node:path";
105123
105200
  function getRerouteCommand2() {
105124
105201
  const binPath = join17(import.meta.dir, "..", "..", "bin.ts");
105125
- const isBunDev = existsSync10(binPath);
105202
+ const isBunDev = existsSync11(binPath);
105126
105203
  if (isBunDev) {
105127
105204
  return `bun ${binPath}`;
105128
105205
  }
@@ -105134,7 +105211,7 @@ function getRerouteCommand2() {
105134
105211
  join17(cwd, "..", "..", "..", "node_modules", ".bin", "reroute")
105135
105212
  ];
105136
105213
  for (const binPath2 of nodeModulesPaths) {
105137
- if (existsSync10(binPath2)) {
105214
+ if (existsSync11(binPath2)) {
105138
105215
  return binPath2;
105139
105216
  }
105140
105217
  }
@@ -105171,7 +105248,7 @@ async function start(args) {
105171
105248
  `);
105172
105249
  const genCommand = useShell ? `${rerouteCmd} gen ${genArgs.join(" ")}` : rerouteCmd;
105173
105250
  const genArgsWithCmd = useShell ? [] : ["gen", ...genArgs];
105174
- await new Promise((resolve5, reject) => {
105251
+ await new Promise((resolve6, reject) => {
105175
105252
  const genProcess = spawn3(genCommand, genArgsWithCmd, {
105176
105253
  stdio: ["ignore", "pipe", "pipe"],
105177
105254
  shell: useShell
@@ -105182,7 +105259,7 @@ async function start(args) {
105182
105259
  if (code !== null && code !== 0) {
105183
105260
  reject(new Error(`Gen exited with code ${code}`));
105184
105261
  } else {
105185
- resolve5();
105262
+ resolve6();
105186
105263
  }
105187
105264
  });
105188
105265
  genProcess.on("error", (error) => {
@@ -105224,13 +105301,13 @@ async function start(args) {
105224
105301
  serverProcess.kill("SIGINT");
105225
105302
  process.exit(0);
105226
105303
  });
105227
- await new Promise((resolve5, reject) => {
105304
+ await new Promise((resolve6, reject) => {
105228
105305
  serverProcess.on("exit", (code) => {
105229
105306
  if (code !== null && code !== 0) {
105230
105307
  console.error(colorizeLogPrefixAnsi(`[reroute/start] Server exited with code ${code}`));
105231
105308
  reject(new Error(`Server exited with code ${code}`));
105232
105309
  } else {
105233
- resolve5();
105310
+ resolve6();
105234
105311
  }
105235
105312
  });
105236
105313
  serverProcess.on("error", (error) => {
@@ -105257,17 +105334,17 @@ var init_start = __esm(() => {
105257
105334
  // packages/cli/src/commands/lib/assets.ts
105258
105335
  import {
105259
105336
  cpSync,
105260
- existsSync as existsSync11,
105337
+ existsSync as existsSync12,
105261
105338
  mkdirSync,
105262
105339
  readdirSync as readdirSync3
105263
105340
  } from "node:fs";
105264
105341
  import { join as join18 } from "node:path";
105265
105342
  function copyAssetsToReroute(cwd, sourceAssetsDir, rerouteAssetsDir) {
105266
- if (!existsSync11(sourceAssetsDir)) {
105343
+ if (!existsSync12(sourceAssetsDir)) {
105267
105344
  return 0;
105268
105345
  }
105269
105346
  const rerouteDir = join18(cwd, ".reroute");
105270
- if (!existsSync11(rerouteDir)) {
105347
+ if (!existsSync12(rerouteDir)) {
105271
105348
  mkdirSync(rerouteDir, { recursive: true });
105272
105349
  }
105273
105350
  cpSync(sourceAssetsDir, rerouteAssetsDir, { recursive: true });
@@ -105293,11 +105370,11 @@ __export(exports_build, {
105293
105370
  default: () => build
105294
105371
  });
105295
105372
  import { spawn as spawn4 } from "node:child_process";
105296
- import { existsSync as existsSync12, readFileSync as readFileSync5, rmSync, unlinkSync } from "node:fs";
105373
+ import { existsSync as existsSync13, readFileSync as readFileSync5, rmSync, unlinkSync } from "node:fs";
105297
105374
  import { join as join19 } from "node:path";
105298
105375
  function getRerouteCommand3() {
105299
105376
  const binPath = join19(import.meta.dir, "..", "..", "bin.ts");
105300
- const isBunDev = existsSync12(binPath);
105377
+ const isBunDev = existsSync13(binPath);
105301
105378
  if (isBunDev) {
105302
105379
  return `bun ${binPath}`;
105303
105380
  }
@@ -105309,7 +105386,7 @@ function getRerouteCommand3() {
105309
105386
  join19(cwd, "..", "..", "..", "node_modules", ".bin", "reroute")
105310
105387
  ];
105311
105388
  for (const binPath2 of nodeModulesPaths) {
105312
- if (existsSync12(binPath2)) {
105389
+ if (existsSync13(binPath2)) {
105313
105390
  return binPath2;
105314
105391
  }
105315
105392
  }
@@ -105318,7 +105395,7 @@ function getRerouteCommand3() {
105318
105395
  function getOutputName() {
105319
105396
  const cwd = process.cwd();
105320
105397
  const packageJsonPath = join19(cwd, "package.json");
105321
- if (existsSync12(packageJsonPath)) {
105398
+ if (existsSync13(packageJsonPath)) {
105322
105399
  try {
105323
105400
  const packageJson = JSON.parse(readFileSync5(packageJsonPath, "utf-8"));
105324
105401
  const name = packageJson.name;
@@ -105351,7 +105428,7 @@ function parseBuildArgs(args) {
105351
105428
  }
105352
105429
  function cleanDistFolder(cwd) {
105353
105430
  const distDir = join19(cwd, "dist");
105354
- if (existsSync12(distDir)) {
105431
+ if (existsSync13(distDir)) {
105355
105432
  process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] Cleaning dist folder...
105356
105433
  `));
105357
105434
  rmSync(distDir, { recursive: true });
@@ -105359,11 +105436,11 @@ function cleanDistFolder(cwd) {
105359
105436
  }
105360
105437
  async function cleanRerouteFolder(cwd) {
105361
105438
  const rerouteDir = join19(cwd, ".reroute");
105362
- if (existsSync12(rerouteDir)) {
105439
+ if (existsSync13(rerouteDir)) {
105363
105440
  process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] Cleaning .reroute folder...
105364
105441
  `));
105365
105442
  rmSync(rerouteDir, { recursive: true, force: true });
105366
- await new Promise((resolve5) => setTimeout(resolve5, 100));
105443
+ await new Promise((resolve6) => setTimeout(resolve6, 100));
105367
105444
  process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] ✓ .reroute folder cleaned
105368
105445
  `));
105369
105446
  }
@@ -105387,7 +105464,7 @@ async function runRerouteStep(rerouteCmd, useShell, stepArgs, env = process.env)
105387
105464
  const commandArgs = useShell ? [] : stepArgs;
105388
105465
  const outputBuffer = { current: "" };
105389
105466
  const handleOutput = createOutputHandler(outputBuffer);
105390
- await new Promise((resolve5, reject) => {
105467
+ await new Promise((resolve6, reject) => {
105391
105468
  const stepProcess = spawn4(command, commandArgs, {
105392
105469
  stdio: ["ignore", "pipe", "pipe"],
105393
105470
  shell: useShell,
@@ -105399,7 +105476,7 @@ async function runRerouteStep(rerouteCmd, useShell, stepArgs, env = process.env)
105399
105476
  if (code !== null && code !== 0) {
105400
105477
  reject(new Error(`${stepArgs[0]} exited with code ${code}`));
105401
105478
  } else {
105402
- resolve5();
105479
+ resolve6();
105403
105480
  }
105404
105481
  });
105405
105482
  stepProcess.on("error", (error) => {
@@ -105495,7 +105572,7 @@ function cleanupBundledFiles(rerouteDir) {
105495
105572
  ];
105496
105573
  for (const file of tsFilesToRemove) {
105497
105574
  const filePath = join19(rerouteDir, file);
105498
- if (existsSync12(filePath)) {
105575
+ if (existsSync13(filePath)) {
105499
105576
  try {
105500
105577
  unlinkSync(filePath);
105501
105578
  cleanupCount++;
@@ -105505,7 +105582,7 @@ function cleanupBundledFiles(rerouteDir) {
105505
105582
  const dirsToRemove = ["markdown", "streaming"];
105506
105583
  for (const dir of dirsToRemove) {
105507
105584
  const dirPath = join19(rerouteDir, dir);
105508
- if (existsSync12(dirPath)) {
105585
+ if (existsSync13(dirPath)) {
105509
105586
  try {
105510
105587
  rmSync(dirPath, { recursive: true });
105511
105588
  cleanupCount++;
@@ -105571,14 +105648,14 @@ var exports_analyze = {};
105571
105648
  __export(exports_analyze, {
105572
105649
  default: () => analyze
105573
105650
  });
105574
- import { existsSync as existsSync13, statSync } from "node:fs";
105651
+ import { existsSync as existsSync14, statSync } from "node:fs";
105575
105652
  import { readdir as readdir9, readFile as readFile2, stat as stat6, writeFile as writeFile2 } from "node:fs/promises";
105576
- import { basename as basename4, join as join20, relative as relative3 } from "node:path";
105653
+ import { basename as basename4, join as join20, relative as relative4 } from "node:path";
105577
105654
  import Table from "cli-table3";
105578
105655
  async function findChunkBundles(cwd) {
105579
105656
  const bundles = [];
105580
105657
  const chunksDir = join20(cwd, ".reroute", "chunks");
105581
- if (!existsSync13(chunksDir))
105658
+ if (!existsSync14(chunksDir))
105582
105659
  return bundles;
105583
105660
  const collections2 = await readdir9(chunksDir, { withFileTypes: true });
105584
105661
  for (const collection of collections2) {
@@ -105598,7 +105675,7 @@ async function findChunkBundles(cwd) {
105598
105675
  name: file,
105599
105676
  size: stats.size,
105600
105677
  gzippedSize,
105601
- relativePath: relative3(cwd, filePath),
105678
+ relativePath: relative4(cwd, filePath),
105602
105679
  type: "chunk"
105603
105680
  });
105604
105681
  }
@@ -105608,7 +105685,7 @@ async function findChunkBundles(cwd) {
105608
105685
  async function findDistBundles(cwd) {
105609
105686
  const bundles = [];
105610
105687
  const distDir = join20(cwd, "dist");
105611
- if (!existsSync13(distDir))
105688
+ if (!existsSync14(distDir))
105612
105689
  return bundles;
105613
105690
  const files = await readdir9(distDir);
105614
105691
  for (const file of files) {
@@ -105622,7 +105699,7 @@ async function findDistBundles(cwd) {
105622
105699
  name: file,
105623
105700
  size: stats.size,
105624
105701
  gzippedSize,
105625
- relativePath: relative3(cwd, filePath),
105702
+ relativePath: relative4(cwd, filePath),
105626
105703
  type: "binary"
105627
105704
  });
105628
105705
  }
@@ -105642,9 +105719,9 @@ async function findBrowserEntry(cwd) {
105642
105719
  const tsxEntry = join20(clientDir, "index.tsx");
105643
105720
  const tsEntry = join20(clientDir, "index.ts");
105644
105721
  let sourceEntry = null;
105645
- if (existsSync13(tsxEntry)) {
105722
+ if (existsSync14(tsxEntry)) {
105646
105723
  sourceEntry = tsxEntry;
105647
- } else if (existsSync13(tsEntry)) {
105724
+ } else if (existsSync14(tsEntry)) {
105648
105725
  sourceEntry = tsEntry;
105649
105726
  }
105650
105727
  if (!sourceEntry)
@@ -105731,7 +105808,7 @@ function calculateStats(bundles) {
105731
105808
  async function getInstalledPackageSizes(cwd) {
105732
105809
  const packageSizes = new Map;
105733
105810
  const nodeModulesDir = join20(cwd, "node_modules");
105734
- if (!existsSync13(nodeModulesDir))
105811
+ if (!existsSync14(nodeModulesDir))
105735
105812
  return packageSizes;
105736
105813
  try {
105737
105814
  const { execSync } = await import("node:child_process");
@@ -105769,7 +105846,7 @@ async function getInstalledPackageSizes(cwd) {
105769
105846
  }
105770
105847
  async function buildDependencyTree(entryPath, cwd) {
105771
105848
  try {
105772
- if (!existsSync13(entryPath))
105849
+ if (!existsSync14(entryPath))
105773
105850
  return null;
105774
105851
  const root = {
105775
105852
  name: basename4(entryPath),
@@ -105798,7 +105875,7 @@ async function buildDependencyTree(entryPath, cwd) {
105798
105875
  size
105799
105876
  });
105800
105877
  }, placeInSrc = function(filePath, size) {
105801
- const rel = relative3(cwd, filePath);
105878
+ const rel = relative4(cwd, filePath);
105802
105879
  const parts = rel.split("/").filter(Boolean);
105803
105880
  let current = srcNode;
105804
105881
  for (let i = 0;i < parts.length - 1; i++) {
@@ -105912,7 +105989,7 @@ async function buildTreeFromSourceMap(bundlePath, cwd) {
105912
105989
  return node.size;
105913
105990
  };
105914
105991
  const mapPath = `${bundlePath}.map`;
105915
- if (!existsSync13(mapPath))
105992
+ if (!existsSync14(mapPath))
105916
105993
  return null;
105917
105994
  const [bundle, mapJson] = await Promise.all([
105918
105995
  readFile2(bundlePath, "utf-8"),
@@ -106028,7 +106105,7 @@ async function buildTreeFromSourceMap(bundlePath, cwd) {
106028
106105
  size
106029
106106
  });
106030
106107
  } else {
106031
- const rel = relative3(cwd, srcPath);
106108
+ const rel = relative4(cwd, srcPath);
106032
106109
  const parts = rel.split("/").filter(Boolean);
106033
106110
  let current = srcNode;
106034
106111
  for (let i2 = 0;i2 < parts.length - 1; i2++) {
@@ -106068,7 +106145,7 @@ async function generateHTMLReport(stats, depTree, mainInfo, browserDepTree, brow
106068
106145
  let actualServerBinaryGzipped = null;
106069
106146
  try {
106070
106147
  const distDir = join20(process.cwd(), "dist");
106071
- if (existsSync13(distDir)) {
106148
+ if (existsSync14(distDir)) {
106072
106149
  const files = await readdir9(distDir);
106073
106150
  for (const file of files) {
106074
106151
  const filePath = join20(distDir, file);
@@ -107554,7 +107631,7 @@ async function printConsoleReport(stats, depTree, mainInfo, browserDepTree, brow
107554
107631
  let actualServerBinaryGzipped = null;
107555
107632
  try {
107556
107633
  const distDir = join20(process.cwd(), "dist");
107557
- if (existsSync13(distDir)) {
107634
+ if (existsSync14(distDir)) {
107558
107635
  const files = await readdir9(distDir);
107559
107636
  for (const file of files) {
107560
107637
  const filePath = join20(distDir, file);
@@ -107592,7 +107669,7 @@ async function analyze(args) {
107592
107669
  const searchIndex = args.indexOf("--search");
107593
107670
  const initialSearch = searchIndex !== -1 && args[searchIndex + 1] ? args[searchIndex + 1] : "";
107594
107671
  const rerouteIndexPath = join20(cwd, ".reroute", "index.ts");
107595
- if (!existsSync13(rerouteIndexPath)) {
107672
+ if (!existsSync14(rerouteIndexPath)) {
107596
107673
  console.log(colorizeLogPrefixAnsi(`[reroute/analyze] .reroute artifacts not found, running build...
107597
107674
  `));
107598
107675
  const { spawn: spawn5 } = await import("node:child_process");
@@ -107601,7 +107678,7 @@ async function analyze(args) {
107601
107678
  const useShell = rerouteCmd.includes(" ");
107602
107679
  const buildCommand = useShell ? `${rerouteCmd} build` : rerouteCmd;
107603
107680
  const buildArgs = useShell ? [] : ["build"];
107604
- await new Promise((resolve5, reject) => {
107681
+ await new Promise((resolve6, reject) => {
107605
107682
  const buildProcess = spawn5(buildCommand, buildArgs, {
107606
107683
  stdio: "inherit",
107607
107684
  shell: useShell
@@ -107610,7 +107687,7 @@ async function analyze(args) {
107610
107687
  if (code !== null && code !== 0) {
107611
107688
  reject(new Error(`Build exited with code ${code}`));
107612
107689
  } else {
107613
- resolve5();
107690
+ resolve6();
107614
107691
  }
107615
107692
  });
107616
107693
  buildProcess.on("error", (error) => {
@@ -107630,7 +107707,7 @@ async function analyze(args) {
107630
107707
  let browserDepTree = null;
107631
107708
  let browserInfo = null;
107632
107709
  if (browserEntry) {
107633
- console.log(colorizeLogPrefixAnsi(`[reroute/analyze] Analyzing browser bundle: ${relative3(cwd, browserEntry)}
107710
+ console.log(colorizeLogPrefixAnsi(`[reroute/analyze] Analyzing browser bundle: ${relative4(cwd, browserEntry)}
107634
107711
  `));
107635
107712
  browserDepTree = await buildDependencyTree(browserEntry, cwd);
107636
107713
  if (!browserDepTree) {
@@ -107655,7 +107732,7 @@ async function analyze(args) {
107655
107732
  let depTree = null;
107656
107733
  let mainInfo = null;
107657
107734
  const srcEntry = join20(cwd, resolveAppPaths(await loadConfig(cwd)).server);
107658
- if (existsSync13(srcEntry)) {
107735
+ if (existsSync14(srcEntry)) {
107659
107736
  console.log(colorizeLogPrefixAnsi(`[reroute/analyze] Building server binary for analysis...
107660
107737
  `));
107661
107738
  const { mkdir: mkdir4 } = await import("node:fs/promises");
@@ -107683,7 +107760,7 @@ async function analyze(args) {
107683
107760
  }
107684
107761
  }
107685
107762
  if (entry) {
107686
- console.log(colorizeLogPrefixAnsi(`[reroute/analyze] Building dependency graph for ${relative3(cwd, entry)}
107763
+ console.log(colorizeLogPrefixAnsi(`[reroute/analyze] Building dependency graph for ${relative4(cwd, entry)}
107687
107764
  `));
107688
107765
  depTree = await buildDependencyTree(entry, cwd);
107689
107766
  console.log(colorizeLogPrefixAnsi(`[reroute/analyze] Checking installed package sizes...
@@ -107691,7 +107768,7 @@ async function analyze(args) {
107691
107768
  const installedSizes = await getInstalledPackageSizes(cwd);
107692
107769
  if (depTree) {
107693
107770
  const packageJsonPath = join20(cwd, "package.json");
107694
- if (existsSync13(packageJsonPath)) {
107771
+ if (existsSync14(packageJsonPath)) {
107695
107772
  try {
107696
107773
  const packageJson = JSON.parse(await readFile2(packageJsonPath, "utf-8"));
107697
107774
  const runtimeDeps = packageJson.dependencies || {};
@@ -107738,7 +107815,7 @@ async function analyze(args) {
107738
107815
  const { mkdir: mkdir4 } = await import("node:fs/promises");
107739
107816
  await mkdir4(join20(cwd, ".reroute"), { recursive: true });
107740
107817
  await writeFile2(htmlPath, html2, "utf-8");
107741
- console.log(colorizeLogPrefixAnsi(`[reroute/analyze] HTML report generated: ${relative3(cwd, htmlPath)}
107818
+ console.log(colorizeLogPrefixAnsi(`[reroute/analyze] HTML report generated: ${relative4(cwd, htmlPath)}
107742
107819
  `));
107743
107820
  if (openBrowser) {
107744
107821
  try {
@@ -107817,8 +107894,8 @@ async function killProcessOnPort(port) {
107817
107894
  const proc = spawn5("bunx", ["kill-port", String(port)], {
107818
107895
  stdio: "ignore"
107819
107896
  });
107820
- await new Promise((resolve5) => {
107821
- proc.on("close", () => resolve5());
107897
+ await new Promise((resolve6) => {
107898
+ proc.on("close", () => resolve6());
107822
107899
  });
107823
107900
  } catch {}
107824
107901
  }
@@ -108223,15 +108300,15 @@ var init_static = __esm(() => {
108223
108300
  // packages/cli/src/commands/lib/prerender.ts
108224
108301
  import {
108225
108302
  cpSync as cpSync2,
108226
- existsSync as existsSync14,
108303
+ existsSync as existsSync15,
108227
108304
  mkdirSync as mkdirSync2,
108228
108305
  readFileSync as readFileSync6,
108229
108306
  writeFileSync
108230
108307
  } from "node:fs";
108231
- import { dirname as dirname8, join as join22 } from "node:path";
108308
+ import { dirname as dirname9, join as join22 } from "node:path";
108232
108309
  function writeOutput(state, relativePath, body) {
108233
108310
  const target = join22(state.outDir, relativePath);
108234
- mkdirSync2(dirname8(target), { recursive: true });
108311
+ mkdirSync2(dirname9(target), { recursive: true });
108235
108312
  writeFileSync(target, body);
108236
108313
  state.files++;
108237
108314
  }
@@ -108240,7 +108317,7 @@ function enqueue(state, path3) {
108240
108317
  return;
108241
108318
  state.queued.add(path3);
108242
108319
  if (COPIED_PREFIXES.some((prefix) => path3.startsWith(prefix))) {
108243
- if (!existsSync14(join22(state.outDir, toOutputPath(path3)))) {
108320
+ if (!existsSync15(join22(state.outDir, toOutputPath(path3)))) {
108244
108321
  state.warnings.push(`Referenced file is missing from the build: ${path3}`);
108245
108322
  }
108246
108323
  return;
@@ -108343,7 +108420,7 @@ async function writeNotFoundPage(state) {
108343
108420
  writeOutput(state, "404.html", injectStaticFlag(finalizeNotFoundPage(text, NOT_FOUND_PROBE)));
108344
108421
  }
108345
108422
  function copyBuildDir(from, to) {
108346
- if (!existsSync14(from))
108423
+ if (!existsSync15(from))
108347
108424
  return;
108348
108425
  cpSync2(from, to, {
108349
108426
  recursive: true,
@@ -108352,7 +108429,7 @@ function copyBuildDir(from, to) {
108352
108429
  }
108353
108430
  function readManifestRoutes(cwd) {
108354
108431
  const manifestPath = join22(cwd, ".reroute", "manifest.json");
108355
- if (!existsSync14(manifestPath))
108432
+ if (!existsSync15(manifestPath))
108356
108433
  return ["/"];
108357
108434
  const manifest = JSON.parse(readFileSync6(manifestPath, "utf-8"));
108358
108435
  return [
@@ -108554,7 +108631,7 @@ async function getVersionString2() {
108554
108631
  }
108555
108632
  async function getVersion2() {
108556
108633
  if (true) {
108557
- return "1.0.0-alpha.26";
108634
+ return "1.0.0-alpha.27";
108558
108635
  }
108559
108636
  const possiblePaths = [
108560
108637
  path3.join(import.meta.dir, "../../../package.json"),
@@ -108571,10 +108648,10 @@ async function getVersion2() {
108571
108648
  }
108572
108649
  async function getCommit2() {
108573
108650
  if (true) {
108574
- return "f166380";
108651
+ return "18a14e0";
108575
108652
  }
108576
108653
  return "dev";
108577
108654
  }
108578
108655
  main();
108579
108656
 
108580
- //# debugId=209C291AD1922D2B64756E2164756E21
108657
+ //# debugId=5E799413BA22752A64756E2164756E21