reroute-js 1.0.0-alpha.1 → 1.0.0-alpha.3

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 (197) hide show
  1. package/cli/bin.d.ts +1 -1
  2. package/cli/bin.js +136 -56
  3. package/cli/bin.js.map +4 -4
  4. package/cli/index.d.ts +1 -1
  5. package/cli/index.js +61 -8
  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/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/terminal-ui.d.ts +1 -1
  29. package/cli/src/commands/lib/theme.d.ts +17 -3
  30. package/cli/src/commands/lib/theme.d.ts.map +1 -1
  31. package/cli/src/commands/lib/version.d.ts +1 -1
  32. package/cli/src/commands/og.d.ts +1 -1
  33. package/cli/src/commands/start.d.ts +1 -1
  34. package/cli/src/index.d.ts +1 -1
  35. package/core/index.d.ts +1 -1
  36. package/core/index.js +2 -2
  37. package/core/index.js.map +1 -1
  38. package/core/src/bundler/hash.d.ts +1 -1
  39. package/core/src/bundler/index.d.ts +1 -1
  40. package/core/src/config.d.ts +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/i18n/catalog.d.ts +1 -1
  45. package/core/src/i18n/discover.d.ts +1 -1
  46. package/core/src/i18n/index.d.ts +1 -1
  47. package/core/src/i18n/messages.d.ts +1 -1
  48. package/core/src/i18n/negotiate.d.ts +1 -1
  49. package/core/src/i18n/pathname.d.ts +1 -1
  50. package/core/src/i18n/resolve.d.ts +1 -1
  51. package/core/src/i18n/types.d.ts +1 -1
  52. package/core/src/index.d.ts +1 -1
  53. package/core/src/llms/extractor.d.ts +1 -1
  54. package/core/src/llms/formatter.d.ts +1 -1
  55. package/core/src/llms/full-generator.d.ts +1 -1
  56. package/core/src/llms/index-generator.d.ts +1 -1
  57. package/core/src/llms/index.d.ts +1 -1
  58. package/core/src/og/discovery.d.ts +1 -1
  59. package/core/src/og/index.d.ts +1 -1
  60. package/core/src/og/meta.d.ts +1 -1
  61. package/core/src/og/render.d.ts +1 -1
  62. package/core/src/og/types.d.ts +1 -1
  63. package/core/src/robots/discovery.d.ts +1 -1
  64. package/core/src/robots/generator.d.ts +1 -1
  65. package/core/src/robots/index.d.ts +1 -1
  66. package/core/src/robots/policies.d.ts +1 -1
  67. package/core/src/rss/discovery.d.ts +1 -1
  68. package/core/src/rss/generator.d.ts +1 -1
  69. package/core/src/rss/index.d.ts +1 -1
  70. package/core/src/sitemap/discovery.d.ts +1 -1
  71. package/core/src/sitemap/generator.d.ts +1 -1
  72. package/core/src/sitemap/index.d.ts +1 -1
  73. package/core/src/ssr/index.d.ts +1 -1
  74. package/core/src/ssr/lib/cache.d.ts +1 -1
  75. package/core/src/ssr/lib/cleanup.d.ts +1 -1
  76. package/core/src/ssr/lib/collections.d.ts +1 -1
  77. package/core/src/ssr/lib/compression.d.ts +1 -1
  78. package/core/src/ssr/lib/compute/content.d.ts +1 -1
  79. package/core/src/ssr/lib/compute/index.d.ts +1 -1
  80. package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
  81. package/core/src/ssr/lib/compute/routes.d.ts +1 -1
  82. package/core/src/ssr/lib/content-path.d.ts +1 -1
  83. package/core/src/ssr/lib/data.d.ts +1 -1
  84. package/core/src/ssr/lib/html.d.ts +1 -1
  85. package/core/src/ssr/lib/imports.d.ts +1 -1
  86. package/core/src/ssr/lib/index.d.ts +1 -1
  87. package/core/src/ssr/lib/layouts.d.ts +1 -1
  88. package/core/src/ssr/lib/metadata.d.ts +1 -1
  89. package/core/src/ssr/lib/mime.d.ts +1 -1
  90. package/core/src/ssr/lib/modules.d.ts +1 -1
  91. package/core/src/ssr/lib/path.d.ts +1 -1
  92. package/core/src/ssr/lib/preload.d.ts +1 -1
  93. package/core/src/ssr/lib/route-match.d.ts +1 -1
  94. package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
  95. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  96. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  97. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  98. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  99. package/core/src/ssr/lib/seed.d.ts +1 -1
  100. package/core/src/ssr/lib/serialize.d.ts +1 -1
  101. package/core/src/ssr/lib/setup.d.ts +1 -1
  102. package/core/src/ssr/lib/styles.d.ts +1 -1
  103. package/core/src/ssr/lib/template.d.ts +1 -1
  104. package/core/src/ssr/lib/types.d.ts +1 -1
  105. package/core/src/ssr/render.d.ts +1 -1
  106. package/core/src/ssr/stream.d.ts +1 -1
  107. package/elysia/index.d.ts +1 -1
  108. package/elysia/index.js +95 -19
  109. package/elysia/index.js.map +4 -4
  110. package/elysia/src/index.d.ts +1 -1
  111. package/elysia/src/libs/assets.d.ts +1 -1
  112. package/elysia/src/libs/cache.d.ts +1 -1
  113. package/elysia/src/libs/caching.d.ts +1 -1
  114. package/elysia/src/libs/http.d.ts +1 -1
  115. package/elysia/src/libs/i18n.d.ts +1 -1
  116. package/elysia/src/libs/image.d.ts +1 -1
  117. package/elysia/src/libs/index.d.ts +1 -1
  118. package/elysia/src/libs/llms.d.ts +1 -1
  119. package/elysia/src/libs/response.d.ts +1 -1
  120. package/elysia/src/libs/serving.d.ts +1 -1
  121. package/elysia/src/plugin.d.ts +1 -1
  122. package/elysia/src/plugin.d.ts.map +1 -1
  123. package/elysia/src/routes/artifacts.d.ts +1 -1
  124. package/elysia/src/routes/content.d.ts +1 -1
  125. package/elysia/src/routes/image.d.ts +1 -1
  126. package/elysia/src/routes/index.d.ts +1 -1
  127. package/elysia/src/routes/internal.d.ts +3 -2
  128. package/elysia/src/routes/internal.d.ts.map +1 -1
  129. package/elysia/src/routes/llms.d.ts +1 -1
  130. package/elysia/src/routes/og.d.ts +1 -1
  131. package/elysia/src/routes/redirects.d.ts +1 -1
  132. package/elysia/src/routes/robots.d.ts +1 -1
  133. package/elysia/src/routes/rss.d.ts +1 -1
  134. package/elysia/src/routes/search.d.ts +1 -1
  135. package/elysia/src/routes/sitemap.d.ts +1 -1
  136. package/elysia/src/routes/ssr.d.ts +1 -1
  137. package/elysia/src/routes/static.d.ts +1 -1
  138. package/elysia/src/types.d.ts +1 -1
  139. package/package.json +1 -1
  140. package/react/index.d.ts +1 -1
  141. package/react/index.js +2 -2
  142. package/react/index.js.map +1 -1
  143. package/react/src/components/ClientOnly.d.ts +1 -1
  144. package/react/src/components/ContentRoute.d.ts +1 -1
  145. package/react/src/components/Image.d.ts +1 -1
  146. package/react/src/components/LazyRoute.d.ts +1 -1
  147. package/react/src/components/Link.d.ts +1 -1
  148. package/react/src/components/Markdown.d.ts +1 -1
  149. package/react/src/components/Outlet.d.ts +1 -1
  150. package/react/src/components/index.d.ts +1 -1
  151. package/react/src/hooks/index.d.ts +1 -1
  152. package/react/src/hooks/useContent.d.ts +1 -1
  153. package/react/src/hooks/useData.d.ts +1 -1
  154. package/react/src/hooks/useFeed.d.ts +1 -1
  155. package/react/src/hooks/useLayoutData.d.ts +1 -1
  156. package/react/src/hooks/useLlms.d.ts +1 -1
  157. package/react/src/hooks/useNavigate.d.ts +1 -1
  158. package/react/src/hooks/useParams.d.ts +1 -1
  159. package/react/src/hooks/useRouter.d.ts +1 -1
  160. package/react/src/hooks/useSearch.d.ts +1 -1
  161. package/react/src/hooks/useSearchParams.d.ts +1 -1
  162. package/react/src/hooks/useToc.d.ts +1 -1
  163. package/react/src/i18n/LocaleProvider.d.ts +1 -1
  164. package/react/src/i18n/helpers.d.ts +1 -1
  165. package/react/src/i18n/index.d.ts +1 -1
  166. package/react/src/index.d.ts +1 -1
  167. package/react/src/lib/collection.d.ts +1 -1
  168. package/react/src/lib/content.d.ts +1 -1
  169. package/react/src/lib/head.d.ts +1 -1
  170. package/react/src/lib/index.d.ts +1 -1
  171. package/react/src/lib/lazy-route.d.ts +1 -1
  172. package/react/src/lib/route-loader.d.ts +1 -1
  173. package/react/src/providers/ContentProvider.d.ts +1 -1
  174. package/react/src/providers/RerouteProvider.d.ts +1 -1
  175. package/react/src/providers/RouterProvider.d.ts +1 -1
  176. package/react/src/providers/index.d.ts +1 -1
  177. package/react/src/types/any.d.ts +1 -1
  178. package/react/src/types/index.d.ts +1 -1
  179. package/react/src/types/router.d.ts +1 -1
  180. package/telemetry/react.d.ts +1 -1
  181. package/telemetry/react.js +2 -2
  182. package/telemetry/react.js.map +1 -1
  183. package/telemetry/server.d.ts +1 -1
  184. package/telemetry/server.js +2 -2
  185. package/telemetry/server.js.map +1 -1
  186. package/telemetry/src/react/api.d.ts +1 -1
  187. package/telemetry/src/react/context.d.ts +1 -1
  188. package/telemetry/src/react/index.d.ts +1 -1
  189. package/telemetry/src/react/telemetry.d.ts +1 -1
  190. package/telemetry/src/server/context.d.ts +1 -1
  191. package/telemetry/src/server/headers/extractor.d.ts +1 -1
  192. package/telemetry/src/server/headers/index.d.ts +1 -1
  193. package/telemetry/src/server/headers/presets.d.ts +1 -1
  194. package/telemetry/src/server/index.d.ts +1 -1
  195. package/telemetry/src/server/instrumentation.d.ts +1 -1
  196. package/telemetry/src/server/plugin.d.ts +1 -1
  197. package/telemetry/src/server/sourcemap.d.ts +1 -1
package/cli/bin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.1
2
+ * reroute-js v1.0.0-alpha.3
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 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 v1.0.0-alpha.1
4
+ * reroute-js v1.0.0-alpha.3
5
5
  *
6
6
  * @license MIT
7
7
  * @copyright 2026 stewones <hi@stewan.io>
@@ -66,7 +66,7 @@ async function getVersionString() {
66
66
  }
67
67
  async function getVersion() {
68
68
  if (true) {
69
- return "1.0.0-alpha.1";
69
+ return "1.0.0-alpha.3";
70
70
  }
71
71
  const possiblePaths = [
72
72
  path.join(import.meta.dir, "../../../../package.json"),
@@ -84,7 +84,7 @@ async function getVersion() {
84
84
  }
85
85
  async function getCommit() {
86
86
  if (true) {
87
- return "6889da1";
87
+ return "7cf20f6";
88
88
  }
89
89
  return "dev";
90
90
  }
@@ -7376,25 +7376,79 @@ var AUTO_HEADER = `// \uD83D\uDEA8 Auto-generated streaming wrapper by Reroute -
7376
7376
  var init_suspense = () => {};
7377
7377
 
7378
7378
  // packages/cli/src/commands/lib/theme.ts
7379
- import { existsSync as existsSync5 } from "node:fs";
7380
- import { mkdir as mkdir2 } from "node:fs/promises";
7381
- import { dirname as dirname5, join as join9 } from "node:path";
7379
+ import { existsSync as existsSync5, readFileSync as readFileSync4 } from "node:fs";
7380
+ import { mkdir as mkdir2, writeFile } from "node:fs/promises";
7381
+ import { dirname as dirname5, isAbsolute, join as join9, resolve as resolve2 } from "node:path";
7382
7382
  function getCssPaths(cwd) {
7383
7383
  const input = join9(cwd, "src/client/index.css");
7384
7384
  const output = join9(cwd, ".reroute/index.css");
7385
7385
  return { input, output };
7386
7386
  }
7387
+ function isFileImport(specifier) {
7388
+ if (specifier.startsWith("http://") || specifier.startsWith("https://") || specifier.startsWith("data:") || specifier.startsWith("/")) {
7389
+ return false;
7390
+ }
7391
+ return true;
7392
+ }
7393
+ function bundleCssEntrypoint(entryPath) {
7394
+ const absEntry = resolve2(entryPath);
7395
+ const stack = new Set;
7396
+ const completed = new Set;
7397
+ function bundleFile(filePath) {
7398
+ const absPath = resolve2(filePath);
7399
+ if (completed.has(absPath)) {
7400
+ return "";
7401
+ }
7402
+ if (stack.has(absPath)) {
7403
+ throw new Error(`[reroute/theme] Circular @import detected: ${absPath}`);
7404
+ }
7405
+ if (!existsSync5(absPath)) {
7406
+ throw new Error(`[reroute/theme] Missing CSS import: ${absPath}`);
7407
+ }
7408
+ stack.add(absPath);
7409
+ const source = readFileSync4(absPath, "utf-8");
7410
+ const baseDir = dirname5(absPath);
7411
+ const bundled = source.replace(IMPORT_RE, (full, single, double, bare, rest) => {
7412
+ const specifier = single || double || bare;
7413
+ const condition = (rest ?? "").trim();
7414
+ if (condition || !isFileImport(specifier)) {
7415
+ return full;
7416
+ }
7417
+ const importedPath = isAbsolute(specifier) ? specifier : resolve2(baseDir, specifier);
7418
+ return `/* ${specifier} */
7419
+ ${bundleFile(importedPath)}
7420
+ `;
7421
+ });
7422
+ stack.delete(absPath);
7423
+ completed.add(absPath);
7424
+ return bundled;
7425
+ }
7426
+ return bundleFile(absEntry);
7427
+ }
7387
7428
  async function syncThemeCss(cwd) {
7388
7429
  const { input, output } = getCssPaths(cwd);
7389
7430
  if (!existsSync5(input)) {
7390
7431
  return false;
7391
7432
  }
7392
7433
  await mkdir2(dirname5(output), { recursive: true });
7393
- await Bun.write(output, Bun.file(input));
7434
+ try {
7435
+ const css = bundleCssEntrypoint(input);
7436
+ await writeFile(output, css, "utf-8");
7437
+ } catch (err) {
7438
+ const message = err instanceof Error ? err.message : String(err);
7439
+ if (message.startsWith("[reroute/theme]")) {
7440
+ throw err;
7441
+ }
7442
+ throw new Error(`[reroute/theme] Failed to bundle index.css:
7443
+ ${message}`);
7444
+ }
7394
7445
  console.log("[reroute/theme] synced index.css");
7395
7446
  return true;
7396
7447
  }
7397
- var init_theme = () => {};
7448
+ var IMPORT_RE;
7449
+ var init_theme = __esm(() => {
7450
+ IMPORT_RE = /@import\s+(?:url\(\s*)?(?:'([^']+)'|"([^"]+)"|([^'")\s]+))\s*\)?\s*([^;]*);/g;
7451
+ });
7398
7452
 
7399
7453
  // packages/cli/src/commands/gen.ts
7400
7454
  var exports_gen = {};
@@ -7402,8 +7456,8 @@ __export(exports_gen, {
7402
7456
  default: () => gen
7403
7457
  });
7404
7458
  import { watch } from "node:fs";
7405
- import { mkdir as mkdir3, readdir as readdir7, rm } from "node:fs/promises";
7406
- import { dirname as dirname6, join as join10 } from "node:path";
7459
+ import { copyFile, mkdir as mkdir3, readdir as readdir7, rm, unlink } from "node:fs/promises";
7460
+ import { dirname as dirname6, extname as extname3, join as join10 } from "node:path";
7407
7461
  import { pathToFileURL as pathToFileURL8 } from "node:url";
7408
7462
  async function bundleThemeCssIntoArtifacts(cwd) {
7409
7463
  const cssPath = join10(cwd, ".reroute", "index.css");
@@ -7915,6 +7969,19 @@ async function sha8(text) {
7915
7969
  hex += b.toString(16).padStart(2, "0");
7916
7970
  return hex.slice(0, 8);
7917
7971
  }
7972
+ async function loadContentMeta(absSrc, buildSrc, isMarkdown) {
7973
+ if (isMarkdown) {
7974
+ return processMarkdownFile(absSrc).frontmatter || {};
7975
+ }
7976
+ const tmp = join10(dirname6(buildSrc), `.meta-${Date.now()}-${Math.random().toString(36).slice(2)}${extname3(buildSrc)}`);
7977
+ try {
7978
+ await copyFile(buildSrc, tmp);
7979
+ const m = await import(pathToFileURL8(tmp).href);
7980
+ return m.meta || {};
7981
+ } finally {
7982
+ await unlink(tmp).catch(() => {});
7983
+ }
7984
+ }
7918
7985
  function serializeConfig(config2) {
7919
7986
  function serializeValue(value, indent = 0) {
7920
7987
  const spaces = " ".repeat(indent);
@@ -8031,9 +8098,7 @@ async function buildSingleContentChunk(cwd, collection, fileRef, contentDir, arg
8031
8098
  } catch {}
8032
8099
  let meta = {};
8033
8100
  try {
8034
- const url = `${pathToFileURL8(buildSrc).href}?t=${Date.now()}`;
8035
- const m = await import(url);
8036
- meta = m.meta || {};
8101
+ meta = await loadContentMeta(absSrc, buildSrc, isMarkdown);
8037
8102
  } catch {}
8038
8103
  const isProd = isProductionMode(args);
8039
8104
  if (isProd && meta.draft === true) {
@@ -8759,14 +8824,16 @@ async function gen(args) {
8759
8824
  console.log(`[reroute/gen] rebuilding notified (port ${port}, ${data.clients} browser(s))`);
8760
8825
  } catch (_err) {}
8761
8826
  };
8762
- const notifyReload = async (reason) => {
8827
+ const notifyReload = async (reason, mode = "full") => {
8763
8828
  const port = getPort();
8764
8829
  try {
8765
8830
  const response = await fetch(`http://localhost:${port}/__reroute_reload`, {
8766
- method: "POST"
8831
+ method: "POST",
8832
+ headers: { "content-type": "application/json" },
8833
+ body: JSON.stringify({ mode })
8767
8834
  });
8768
8835
  const data = await response.json();
8769
- console.log(`[reroute/gen] reload notified (port ${port}, ${data.clients} browser(s))${reason ? `: ${reason}` : ""}`);
8836
+ console.log(`[reroute/gen] reload notified (port ${port}, ${data.clients} browser(s), ${mode})${reason ? `: ${reason}` : ""}`);
8770
8837
  } catch {}
8771
8838
  };
8772
8839
  await notifyReload("initial generation");
@@ -8775,30 +8842,35 @@ async function gen(args) {
8775
8842
  let isBuilding = false;
8776
8843
  let pendingBuild = null;
8777
8844
  let skipCurrentBuild = false;
8778
- function scheduleBuild(buildFn, reason) {
8845
+ function scheduleBuild(buildFn, reason, reloadMode = "full") {
8779
8846
  if (isBuilding) {
8780
8847
  if (!skipCurrentBuild) {
8781
8848
  skipCurrentBuild = true;
8782
8849
  console.log(`[reroute/watch] ⏭️ Superseding current build with: ${reason}`);
8783
8850
  }
8784
- pendingBuild = { fn: buildFn, reason };
8851
+ pendingBuild = { fn: buildFn, reason, reloadMode };
8785
8852
  return;
8786
8853
  }
8787
8854
  if (pendingBuild) {
8788
8855
  console.log(`[reroute/watch] ⏭️ Replacing queued build with: ${reason}`);
8856
+ const mergedMode = pendingBuild.reloadMode === "css" && reloadMode === "css" ? "css" : "full";
8857
+ pendingBuild = { fn: buildFn, reason, reloadMode: mergedMode };
8858
+ } else {
8859
+ pendingBuild = { fn: buildFn, reason, reloadMode };
8789
8860
  }
8790
- pendingBuild = { fn: buildFn, reason };
8791
8861
  processPendingBuild();
8792
8862
  }
8793
8863
  async function processPendingBuild() {
8794
8864
  if (!pendingBuild || isBuilding)
8795
8865
  return;
8796
- const { fn: buildFn, reason } = pendingBuild;
8866
+ const { fn: buildFn, reason, reloadMode } = pendingBuild;
8797
8867
  pendingBuild = null;
8798
8868
  skipCurrentBuild = false;
8799
8869
  isBuilding = true;
8800
8870
  const startTime = performance.now();
8801
- await notifyRebuilding();
8871
+ if (reloadMode !== "css") {
8872
+ await notifyRebuilding();
8873
+ }
8802
8874
  try {
8803
8875
  await buildFn();
8804
8876
  if (skipCurrentBuild) {
@@ -8807,12 +8879,14 @@ async function gen(args) {
8807
8879
  }
8808
8880
  const duration = ((performance.now() - startTime) / 1000).toFixed(2);
8809
8881
  console.log(`[reroute/watch] ✓ Rebuild complete in ${duration}s (${reason})`);
8810
- await Bun.sleep(200);
8882
+ if (reloadMode !== "css") {
8883
+ await Bun.sleep(200);
8884
+ }
8811
8885
  if (skipCurrentBuild || pendingBuild) {
8812
8886
  console.log(`[reroute/watch] ⏭️ Skipping reload, new build pending`);
8813
8887
  return;
8814
8888
  }
8815
- await notifyReload(reason);
8889
+ await notifyReload(reason, reloadMode);
8816
8890
  } catch (err) {
8817
8891
  if (!skipCurrentBuild) {
8818
8892
  console.error(`[reroute/watch] ✗ Build failed (${reason}):`, err);
@@ -8970,6 +9044,7 @@ async function gen(args) {
8970
9044
  });
8971
9045
  const clientPath = join10(cwd, "src", "client");
8972
9046
  console.log(`[reroute/watch] \uD83D\uDCE6 Watching ${clientPath}...`);
9047
+ let pendingClientFiles = new Set;
8973
9048
  const clientWatcher = watch(clientPath, { recursive: true }, (_ev, filename) => {
8974
9049
  if (!filename)
8975
9050
  return;
@@ -8980,10 +9055,15 @@ async function gen(args) {
8980
9055
  return;
8981
9056
  if (!/\.(tsx|ts|jsx|js|html|md|mdx|css)$/.test(name))
8982
9057
  return;
9058
+ pendingClientFiles.add(name);
8983
9059
  mediumDebounce(() => {
9060
+ const names = [...pendingClientFiles];
9061
+ pendingClientFiles = new Set;
9062
+ const reloadMode = names.every((n) => n.endsWith(".css")) ? "css" : "full";
9063
+ const label = names.length === 1 ? names[0] : `${names.length} files`;
8984
9064
  scheduleBuild(async () => {
8985
- console.log(`[reroute/watch] \uD83D\uDCE6 Client changed: ${name}`);
8986
- if (name.endsWith(".ts") || name.endsWith(".tsx")) {
9065
+ console.log(`[reroute/watch] \uD83D\uDCE6 Client changed: ${label}`);
9066
+ if (names.some((n) => n.endsWith(".ts") || n.endsWith(".tsx"))) {
8987
9067
  console.log("[reroute/watch] ├─ Rebuilding bundle...");
8988
9068
  const bundleStart = performance.now();
8989
9069
  try {
@@ -8999,7 +9079,7 @@ async function gen(args) {
8999
9079
  if (themeSynced) {
9000
9080
  console.log("[reroute/watch] ├─ index.css synced");
9001
9081
  }
9002
- }, "client change");
9082
+ }, "client change", reloadMode);
9003
9083
  });
9004
9084
  });
9005
9085
  console.log(`[reroute/watch] ✓ Watch mode active - ready for changes!
@@ -9096,7 +9176,7 @@ async function waitForServerReady(port = 3000, timeout = 30000) {
9096
9176
  return;
9097
9177
  }
9098
9178
  } catch {}
9099
- await new Promise((resolve2) => setTimeout(resolve2, checkInterval));
9179
+ await new Promise((resolve3) => setTimeout(resolve3, checkInterval));
9100
9180
  checkInterval = Math.min(checkInterval * 1.5, maxInterval);
9101
9181
  }
9102
9182
  throw new Error(`Timeout waiting for server to respond after ${timeout}ms. ` + `Make sure your server is starting correctly on port ${port}.`);
@@ -19437,12 +19517,12 @@ var require_screen = __commonJS((exports, module) => {
19437
19517
  env: process.env,
19438
19518
  cwd: process.env.HOME
19439
19519
  };
19440
- function writeFile(callback2) {
19520
+ function writeFile2(callback2) {
19441
19521
  if (!options.value)
19442
19522
  return callback2();
19443
19523
  return fs.writeFile(file, options.value, callback2);
19444
19524
  }
19445
- return writeFile(function(err) {
19525
+ return writeFile2(function(err) {
19446
19526
  if (err)
19447
19527
  return callback(err);
19448
19528
  return self2.exec(editor, args, opt, function(err2, success) {
@@ -94793,7 +94873,7 @@ Should be of format "before:after"`);
94793
94873
  }
94794
94874
  }
94795
94875
  function objectize(node) {
94796
- function resolve2(value, key) {
94876
+ function resolve3(value, key) {
94797
94877
  if (!value._parent)
94798
94878
  return;
94799
94879
  if (value._parent._default && value._parent._default[key])
@@ -94816,8 +94896,8 @@ Should be of format "before:after"`);
94816
94896
  if (isObject(value)) {
94817
94897
  if (!value._before && !value._after)
94818
94898
  return objectize(value);
94819
- value._before = value._before || resolve2(value, "_before");
94820
- value._after = value._after || resolve2(value, "_after");
94899
+ value._before = value._before || resolve3(value, "_before");
94900
+ value._after = value._after || resolve3(value, "_after");
94821
94901
  return;
94822
94902
  }
94823
94903
  throw new Error("nodes need to be either {String}, {Object} or {Function}." + value + " is neither.");
@@ -103726,7 +103806,7 @@ function getRerouteCommand() {
103726
103806
  async function waitForInitialBuild(genProcess) {
103727
103807
  console.log("[reroute/dev] Waiting for initial build...");
103728
103808
  const outputBuffer = [];
103729
- const buildCompletePromise = new Promise((resolve2, reject) => {
103809
+ const buildCompletePromise = new Promise((resolve3, reject) => {
103730
103810
  const timeout = setTimeout(() => {
103731
103811
  reject(new Error("Timeout waiting for initial build to complete (120s)"));
103732
103812
  }, 120000);
@@ -103736,7 +103816,7 @@ async function waitForInitialBuild(genProcess) {
103736
103816
  clearTimeout(timeout);
103737
103817
  genProcess.stdout?.removeListener("data", checkComplete);
103738
103818
  genProcess.stderr?.removeListener("data", checkComplete);
103739
- resolve2();
103819
+ resolve3();
103740
103820
  }
103741
103821
  };
103742
103822
  genProcess.stdout?.on("data", checkComplete);
@@ -103922,7 +104002,7 @@ async function start(args) {
103922
104002
  `);
103923
104003
  const genCommand = useShell ? `${rerouteCmd} gen ${genArgs.join(" ")}` : rerouteCmd;
103924
104004
  const genArgsWithCmd = useShell ? [] : ["gen", ...genArgs];
103925
- await new Promise((resolve2, reject) => {
104005
+ await new Promise((resolve3, reject) => {
103926
104006
  const genProcess = spawn2(genCommand, genArgsWithCmd, {
103927
104007
  stdio: ["ignore", "pipe", "pipe"],
103928
104008
  shell: useShell
@@ -103933,7 +104013,7 @@ async function start(args) {
103933
104013
  if (code !== null && code !== 0) {
103934
104014
  reject(new Error(`Gen exited with code ${code}`));
103935
104015
  } else {
103936
- resolve2();
104016
+ resolve3();
103937
104017
  }
103938
104018
  });
103939
104019
  genProcess.on("error", (error) => {
@@ -103974,13 +104054,13 @@ async function start(args) {
103974
104054
  serverProcess.kill("SIGINT");
103975
104055
  process.exit(0);
103976
104056
  });
103977
- await new Promise((resolve2, reject) => {
104057
+ await new Promise((resolve3, reject) => {
103978
104058
  serverProcess.on("exit", (code) => {
103979
104059
  if (code !== null && code !== 0) {
103980
104060
  console.error(colorizeLogPrefixAnsi(`[reroute/start] Server exited with code ${code}`));
103981
104061
  reject(new Error(`Server exited with code ${code}`));
103982
104062
  } else {
103983
- resolve2();
104063
+ resolve3();
103984
104064
  }
103985
104065
  });
103986
104066
  serverProcess.on("error", (error) => {
@@ -104042,7 +104122,7 @@ __export(exports_build, {
104042
104122
  default: () => build
104043
104123
  });
104044
104124
  import { spawn as spawn3 } from "node:child_process";
104045
- import { existsSync as existsSync9, readFileSync as readFileSync4, rmSync, unlinkSync } from "node:fs";
104125
+ import { existsSync as existsSync9, readFileSync as readFileSync5, rmSync, unlinkSync } from "node:fs";
104046
104126
  import { join as join14 } from "node:path";
104047
104127
  function getRerouteCommand3() {
104048
104128
  const binPath = join14(import.meta.dir, "..", "..", "bin.ts");
@@ -104069,7 +104149,7 @@ function getOutputName() {
104069
104149
  const packageJsonPath = join14(cwd, "package.json");
104070
104150
  if (existsSync9(packageJsonPath)) {
104071
104151
  try {
104072
- const packageJson = JSON.parse(readFileSync4(packageJsonPath, "utf-8"));
104152
+ const packageJson = JSON.parse(readFileSync5(packageJsonPath, "utf-8"));
104073
104153
  const name = packageJson.name;
104074
104154
  if (name) {
104075
104155
  const parts = name.split("-");
@@ -104111,7 +104191,7 @@ async function cleanRerouteFolder(cwd) {
104111
104191
  process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] Cleaning .reroute folder...
104112
104192
  `));
104113
104193
  rmSync(rerouteDir, { recursive: true, force: true });
104114
- await new Promise((resolve2) => setTimeout(resolve2, 100));
104194
+ await new Promise((resolve3) => setTimeout(resolve3, 100));
104115
104195
  process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] ✓ .reroute folder cleaned
104116
104196
  `));
104117
104197
  }
@@ -104137,7 +104217,7 @@ async function runGenCommand(rerouteCmd, useShell, noCompression) {
104137
104217
  const genArgs = useShell ? [] : ["gen", "--prod", noCompression ? "--no-compression" : ""];
104138
104218
  const genBuffer = { current: "" };
104139
104219
  const handleGenOutput = createOutputHandler(genBuffer);
104140
- await new Promise((resolve2, reject) => {
104220
+ await new Promise((resolve3, reject) => {
104141
104221
  const genProcess = spawn3(genCommand, genArgs, {
104142
104222
  stdio: ["ignore", "pipe", "pipe"],
104143
104223
  shell: useShell
@@ -104148,7 +104228,7 @@ async function runGenCommand(rerouteCmd, useShell, noCompression) {
104148
104228
  if (code !== null && code !== 0) {
104149
104229
  reject(new Error(`Gen exited with code ${code}`));
104150
104230
  } else {
104151
- resolve2();
104231
+ resolve3();
104152
104232
  }
104153
104233
  });
104154
104234
  genProcess.on("error", (error) => {
@@ -104319,7 +104399,7 @@ __export(exports_analyze, {
104319
104399
  default: () => analyze
104320
104400
  });
104321
104401
  import { existsSync as existsSync11, statSync } from "node:fs";
104322
- import { readdir as readdir8, readFile, stat as stat5, writeFile } from "node:fs/promises";
104402
+ import { readdir as readdir8, readFile, stat as stat5, writeFile as writeFile2 } from "node:fs/promises";
104323
104403
  import { basename as basename3, join as join16, relative as relative3 } from "node:path";
104324
104404
  import Table from "cli-table3";
104325
104405
  async function findChunkBundles(cwd) {
@@ -104426,11 +104506,11 @@ async function findBrowserEntry(cwd) {
104426
104506
  const code = await output.text();
104427
104507
  const actualHash = await generateContentHash2(code);
104428
104508
  const bundlePath = join16(tempDir, `index.${actualHash}.js`);
104429
- await writeFile(bundlePath, code, "utf-8");
104509
+ await writeFile2(bundlePath, code, "utf-8");
104430
104510
  const mapOutput = result.outputs.find((o) => o.path.endsWith(".map"));
104431
104511
  if (mapOutput) {
104432
104512
  const mapContent = await mapOutput.text();
104433
- await writeFile(`${bundlePath}.map`, mapContent, "utf-8");
104513
+ await writeFile2(`${bundlePath}.map`, mapContent, "utf-8");
104434
104514
  }
104435
104515
  return bundlePath;
104436
104516
  } catch (error) {
@@ -106348,7 +106428,7 @@ async function analyze(args) {
106348
106428
  const useShell = rerouteCmd.includes(" ");
106349
106429
  const buildCommand = useShell ? `${rerouteCmd} build` : rerouteCmd;
106350
106430
  const buildArgs = useShell ? [] : ["build"];
106351
- await new Promise((resolve2, reject) => {
106431
+ await new Promise((resolve3, reject) => {
106352
106432
  const buildProcess = spawn4(buildCommand, buildArgs, {
106353
106433
  stdio: "inherit",
106354
106434
  shell: useShell
@@ -106357,7 +106437,7 @@ async function analyze(args) {
106357
106437
  if (code !== null && code !== 0) {
106358
106438
  reject(new Error(`Build exited with code ${code}`));
106359
106439
  } else {
106360
- resolve2();
106440
+ resolve3();
106361
106441
  }
106362
106442
  });
106363
106443
  buildProcess.on("error", (error) => {
@@ -106420,11 +106500,11 @@ async function analyze(args) {
106420
106500
  const output = result.outputs[0];
106421
106501
  const code = await output.text();
106422
106502
  const analysisEntry = join16(serverAnalysisDir, "index.js");
106423
- await writeFile(analysisEntry, code, "utf-8");
106503
+ await writeFile2(analysisEntry, code, "utf-8");
106424
106504
  const mapOutput = result.outputs.find((o) => o.path.endsWith(".map"));
106425
106505
  if (mapOutput) {
106426
106506
  const mapContent = await mapOutput.text();
106427
- await writeFile(`${analysisEntry}.map`, mapContent, "utf-8");
106507
+ await writeFile2(`${analysisEntry}.map`, mapContent, "utf-8");
106428
106508
  }
106429
106509
  entry = analysisEntry;
106430
106510
  }
@@ -106484,7 +106564,7 @@ async function analyze(args) {
106484
106564
  const html2 = await generateHTMLReport(stats, depTree, mainInfo, browserDepTree, browserInfo, initialSearch);
106485
106565
  const { mkdir: mkdir4 } = await import("node:fs/promises");
106486
106566
  await mkdir4(join16(cwd, ".reroute"), { recursive: true });
106487
- await writeFile(htmlPath, html2, "utf-8");
106567
+ await writeFile2(htmlPath, html2, "utf-8");
106488
106568
  console.log(colorizeLogPrefixAnsi(`[reroute/analyze] HTML report generated: ${relative3(cwd, htmlPath)}
106489
106569
  `));
106490
106570
  if (openBrowser) {
@@ -106563,8 +106643,8 @@ async function killProcessOnPort(port) {
106563
106643
  const proc = spawn4("bunx", ["kill-port", String(port)], {
106564
106644
  stdio: "ignore"
106565
106645
  });
106566
- await new Promise((resolve2) => {
106567
- proc.on("close", () => resolve2());
106646
+ await new Promise((resolve3) => {
106647
+ proc.on("close", () => resolve3());
106568
106648
  });
106569
106649
  } catch {}
106570
106650
  }
@@ -106928,7 +107008,7 @@ async function getVersionString2() {
106928
107008
  }
106929
107009
  async function getVersion2() {
106930
107010
  if (true) {
106931
- return "1.0.0-alpha.1";
107011
+ return "1.0.0-alpha.3";
106932
107012
  }
106933
107013
  const possiblePaths = [
106934
107014
  path3.join(import.meta.dir, "../../../package.json"),
@@ -106945,10 +107025,10 @@ async function getVersion2() {
106945
107025
  }
106946
107026
  async function getCommit2() {
106947
107027
  if (true) {
106948
- return "6889da1";
107028
+ return "7cf20f6";
106949
107029
  }
106950
107030
  return "dev";
106951
107031
  }
106952
107032
  main();
106953
107033
 
106954
- //# debugId=E36304ED6CA0A40264756E2164756E21
107034
+ //# debugId=944B98E3E3F64BCD64756E2164756E21