reroute-js 0.45.2 → 0.45.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 (184) hide show
  1. package/cli/bin.d.ts +1 -1
  2. package/cli/bin.js +150 -63
  3. package/cli/bin.js.map +5 -5
  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 +1 -1
  10. package/cli/src/commands/dev.d.ts +1 -1
  11. package/cli/src/commands/dev.d.ts.map +1 -1
  12. package/cli/src/commands/gen.d.ts +1 -1
  13. package/cli/src/commands/index.d.ts +1 -1
  14. package/cli/src/commands/init.d.ts +1 -1
  15. package/cli/src/commands/lib/assets.d.ts +1 -1
  16. package/cli/src/commands/lib/bundler.d.ts +1 -1
  17. package/cli/src/commands/lib/command.d.ts +1 -1
  18. package/cli/src/commands/lib/env.d.ts +1 -1
  19. package/cli/src/commands/lib/index.d.ts +1 -1
  20. package/cli/src/commands/lib/log.d.ts +1 -1
  21. package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
  22. package/cli/src/commands/lib/markdown/index.d.ts +1 -1
  23. package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
  24. package/cli/src/commands/lib/production.d.ts +1 -1
  25. package/cli/src/commands/lib/server.d.ts +1 -1
  26. package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
  27. package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
  28. package/cli/src/commands/lib/tailwind.d.ts +1 -1
  29. package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
  30. package/cli/src/commands/lib/version.d.ts +1 -1
  31. package/cli/src/commands/og.d.ts +1 -1
  32. package/cli/src/commands/start.d.ts +1 -1
  33. package/cli/src/commands/start.d.ts.map +1 -1
  34. package/cli/src/index.d.ts +1 -1
  35. package/core/index.d.ts +1 -1
  36. package/core/index.js +76 -21
  37. package/core/index.js.map +3 -3
  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/index.d.ts +1 -1
  45. package/core/src/llms/extractor.d.ts +1 -1
  46. package/core/src/llms/formatter.d.ts +1 -1
  47. package/core/src/llms/full-generator.d.ts +1 -1
  48. package/core/src/llms/index-generator.d.ts +1 -1
  49. package/core/src/llms/index.d.ts +1 -1
  50. package/core/src/og/discovery.d.ts +1 -1
  51. package/core/src/og/index.d.ts +1 -1
  52. package/core/src/og/meta.d.ts +1 -1
  53. package/core/src/og/render.d.ts +1 -1
  54. package/core/src/og/types.d.ts +1 -1
  55. package/core/src/robots/discovery.d.ts +1 -1
  56. package/core/src/robots/generator.d.ts +1 -1
  57. package/core/src/robots/index.d.ts +1 -1
  58. package/core/src/robots/policies.d.ts +1 -1
  59. package/core/src/rss/discovery.d.ts +1 -1
  60. package/core/src/rss/generator.d.ts +1 -1
  61. package/core/src/rss/index.d.ts +1 -1
  62. package/core/src/sitemap/discovery.d.ts +1 -1
  63. package/core/src/sitemap/generator.d.ts +1 -1
  64. package/core/src/sitemap/index.d.ts +1 -1
  65. package/core/src/ssr/index.d.ts +1 -1
  66. package/core/src/ssr/lib/cache.d.ts +22 -2
  67. package/core/src/ssr/lib/cache.d.ts.map +1 -1
  68. package/core/src/ssr/lib/collections.d.ts +1 -1
  69. package/core/src/ssr/lib/compression.d.ts +1 -1
  70. package/core/src/ssr/lib/compute/content.d.ts +1 -1
  71. package/core/src/ssr/lib/compute/index.d.ts +1 -1
  72. package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
  73. package/core/src/ssr/lib/compute/routes.d.ts +1 -1
  74. package/core/src/ssr/lib/data.d.ts +1 -1
  75. package/core/src/ssr/lib/html.d.ts +1 -1
  76. package/core/src/ssr/lib/imports.d.ts +1 -1
  77. package/core/src/ssr/lib/index.d.ts +1 -1
  78. package/core/src/ssr/lib/layouts.d.ts +1 -1
  79. package/core/src/ssr/lib/metadata.d.ts +1 -1
  80. package/core/src/ssr/lib/mime.d.ts +1 -1
  81. package/core/src/ssr/lib/modules.d.ts +1 -1
  82. package/core/src/ssr/lib/path.d.ts +1 -1
  83. package/core/src/ssr/lib/preload.d.ts +1 -1
  84. package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
  85. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  86. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  87. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  88. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  89. package/core/src/ssr/lib/seed.d.ts +1 -1
  90. package/core/src/ssr/lib/serialize.d.ts +1 -1
  91. package/core/src/ssr/lib/setup.d.ts +1 -1
  92. package/core/src/ssr/lib/styles.d.ts +1 -1
  93. package/core/src/ssr/lib/template.d.ts +1 -1
  94. package/core/src/ssr/lib/types.d.ts +1 -1
  95. package/core/src/ssr/render.d.ts +1 -1
  96. package/core/src/ssr/stream.d.ts +1 -1
  97. package/elysia/index.d.ts +1 -1
  98. package/elysia/index.js +186 -88
  99. package/elysia/index.js.map +6 -6
  100. package/elysia/src/index.d.ts +1 -1
  101. package/elysia/src/libs/assets.d.ts +1 -1
  102. package/elysia/src/libs/cache.d.ts +1 -1
  103. package/elysia/src/libs/caching.d.ts +1 -1
  104. package/elysia/src/libs/http.d.ts +1 -1
  105. package/elysia/src/libs/image.d.ts +1 -1
  106. package/elysia/src/libs/index.d.ts +1 -1
  107. package/elysia/src/libs/llms.d.ts +1 -1
  108. package/elysia/src/libs/response.d.ts +1 -1
  109. package/elysia/src/libs/serving.d.ts +1 -1
  110. package/elysia/src/plugin.d.ts +1 -1
  111. package/elysia/src/plugin.d.ts.map +1 -1
  112. package/elysia/src/routes/artifacts.d.ts +1 -1
  113. package/elysia/src/routes/content.d.ts +1 -1
  114. package/elysia/src/routes/image.d.ts +1 -1
  115. package/elysia/src/routes/index.d.ts +1 -1
  116. package/elysia/src/routes/internal.d.ts +1 -1
  117. package/elysia/src/routes/llms.d.ts +1 -1
  118. package/elysia/src/routes/og.d.ts +1 -1
  119. package/elysia/src/routes/og.d.ts.map +1 -1
  120. package/elysia/src/routes/redirects.d.ts +1 -1
  121. package/elysia/src/routes/robots.d.ts +1 -1
  122. package/elysia/src/routes/rss.d.ts +1 -1
  123. package/elysia/src/routes/search.d.ts +1 -1
  124. package/elysia/src/routes/sitemap.d.ts +1 -1
  125. package/elysia/src/routes/ssr.d.ts +1 -1
  126. package/elysia/src/routes/ssr.d.ts.map +1 -1
  127. package/elysia/src/routes/static.d.ts +1 -1
  128. package/elysia/src/types.d.ts +1 -1
  129. package/package.json +1 -1
  130. package/react/index.d.ts +1 -1
  131. package/react/index.js +2 -2
  132. package/react/index.js.map +1 -1
  133. package/react/src/components/ClientOnly.d.ts +1 -1
  134. package/react/src/components/ContentRoute.d.ts +1 -1
  135. package/react/src/components/Image.d.ts +1 -1
  136. package/react/src/components/LazyRoute.d.ts +1 -1
  137. package/react/src/components/Link.d.ts +1 -1
  138. package/react/src/components/Markdown.d.ts +1 -1
  139. package/react/src/components/Outlet.d.ts +1 -1
  140. package/react/src/components/index.d.ts +1 -1
  141. package/react/src/hooks/index.d.ts +1 -1
  142. package/react/src/hooks/useContent.d.ts +1 -1
  143. package/react/src/hooks/useData.d.ts +1 -1
  144. package/react/src/hooks/useFeed.d.ts +1 -1
  145. package/react/src/hooks/useLayoutData.d.ts +1 -1
  146. package/react/src/hooks/useLlms.d.ts +1 -1
  147. package/react/src/hooks/useNavigate.d.ts +1 -1
  148. package/react/src/hooks/useParams.d.ts +1 -1
  149. package/react/src/hooks/useRouter.d.ts +1 -1
  150. package/react/src/hooks/useSearch.d.ts +1 -1
  151. package/react/src/hooks/useSearchParams.d.ts +1 -1
  152. package/react/src/hooks/useToc.d.ts +1 -1
  153. package/react/src/index.d.ts +1 -1
  154. package/react/src/lib/collection.d.ts +1 -1
  155. package/react/src/lib/content.d.ts +1 -1
  156. package/react/src/lib/head.d.ts +1 -1
  157. package/react/src/lib/index.d.ts +1 -1
  158. package/react/src/lib/lazy-route.d.ts +1 -1
  159. package/react/src/lib/route-loader.d.ts +1 -1
  160. package/react/src/providers/ContentProvider.d.ts +1 -1
  161. package/react/src/providers/RerouteProvider.d.ts +1 -1
  162. package/react/src/providers/RouterProvider.d.ts +1 -1
  163. package/react/src/providers/index.d.ts +1 -1
  164. package/react/src/types/any.d.ts +1 -1
  165. package/react/src/types/index.d.ts +1 -1
  166. package/react/src/types/router.d.ts +1 -1
  167. package/telemetry/react.d.ts +1 -1
  168. package/telemetry/react.js +2 -17
  169. package/telemetry/react.js.map +2 -2
  170. package/telemetry/server.d.ts +1 -1
  171. package/telemetry/server.js +76 -6
  172. package/telemetry/server.js.map +3 -3
  173. package/telemetry/src/react/api.d.ts +1 -1
  174. package/telemetry/src/react/context.d.ts +1 -1
  175. package/telemetry/src/react/index.d.ts +1 -1
  176. package/telemetry/src/react/telemetry.d.ts +1 -1
  177. package/telemetry/src/server/context.d.ts +1 -1
  178. package/telemetry/src/server/headers/extractor.d.ts +1 -1
  179. package/telemetry/src/server/headers/index.d.ts +1 -1
  180. package/telemetry/src/server/headers/presets.d.ts +1 -1
  181. package/telemetry/src/server/index.d.ts +1 -1
  182. package/telemetry/src/server/instrumentation.d.ts +1 -1
  183. package/telemetry/src/server/plugin.d.ts +1 -1
  184. package/telemetry/src/server/sourcemap.d.ts +1 -1
package/cli/bin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.45.2
2
+ * reroute-js v0.45.4
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 v0.45.2
4
+ * reroute-js v0.45.4
5
5
  *
6
6
  * @license MIT
7
7
  * @copyright 2026 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.45.2";
51
+ return "0.45.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 "3df0c37";
69
+ return "615060e";
70
70
  }
71
71
  return "dev";
72
72
  }
@@ -805,9 +805,12 @@ class TTLCache {
805
805
  maxSize;
806
806
  defaultTtlMs;
807
807
  cleanupInterval = null;
808
- constructor(maxSize = 100, defaultTtlMs = 300000, cleanupIntervalMs = 60000) {
808
+ maxMemoryBytes = null;
809
+ currentMemoryBytes = 0;
810
+ constructor(maxSize = 100, defaultTtlMs = 300000, cleanupIntervalMs = 60000, maxMemoryMB) {
809
811
  this.maxSize = maxSize;
810
812
  this.defaultTtlMs = defaultTtlMs;
813
+ this.maxMemoryBytes = maxMemoryMB ? maxMemoryMB * 1024 * 1024 : null;
811
814
  this.cleanupInterval = setInterval(() => {
812
815
  this.cleanup();
813
816
  }, cleanupIntervalMs);
@@ -825,36 +828,103 @@ class TTLCache {
825
828
  }
826
829
  return entry.value;
827
830
  }
831
+ estimateSize(value) {
832
+ if (value instanceof Buffer || value instanceof ArrayBuffer) {
833
+ return value.byteLength;
834
+ }
835
+ if (typeof value === "string") {
836
+ return value.length * 2;
837
+ }
838
+ try {
839
+ return JSON.stringify(value).length * 2;
840
+ } catch {
841
+ return 1024;
842
+ }
843
+ }
828
844
  set(key, value, ttlMs) {
829
- this.cache.delete(key);
845
+ const entrySize = this.estimateSize(value);
846
+ const existing = this.cache.get(key);
847
+ if (existing) {
848
+ this.cache.delete(key);
849
+ if (existing.size) {
850
+ this.currentMemoryBytes -= existing.size;
851
+ }
852
+ }
853
+ if (this.maxMemoryBytes && this.currentMemoryBytes + entrySize > this.maxMemoryBytes) {
854
+ this.evictForMemory(entrySize);
855
+ }
830
856
  if (this.cache.size >= this.maxSize) {
831
857
  const firstKey = this.cache.keys().next().value;
832
858
  if (firstKey !== undefined) {
859
+ const evicted = this.cache.get(firstKey);
833
860
  this.cache.delete(firstKey);
861
+ if (evicted?.size) {
862
+ this.currentMemoryBytes -= evicted.size;
863
+ }
834
864
  }
835
865
  }
836
866
  this.cache.set(key, {
837
867
  value,
838
- exp: Date.now() + (ttlMs ?? this.defaultTtlMs)
868
+ exp: Date.now() + (ttlMs ?? this.defaultTtlMs),
869
+ size: entrySize
839
870
  });
871
+ this.currentMemoryBytes += entrySize;
840
872
  }
841
873
  has(key) {
842
874
  return this.get(key) !== undefined;
843
875
  }
876
+ evictForMemory(neededBytes) {
877
+ if (!this.maxMemoryBytes)
878
+ return;
879
+ const targetBytes = this.maxMemoryBytes * 0.7;
880
+ const keys = Array.from(this.cache.keys());
881
+ for (const key of keys) {
882
+ if (this.currentMemoryBytes + neededBytes <= targetBytes) {
883
+ break;
884
+ }
885
+ const entry = this.cache.get(key);
886
+ if (entry) {
887
+ this.cache.delete(key);
888
+ if (entry.size) {
889
+ this.currentMemoryBytes -= entry.size;
890
+ }
891
+ }
892
+ }
893
+ }
844
894
  delete(key) {
845
- return this.cache.delete(key);
895
+ const entry = this.cache.get(key);
896
+ const deleted = this.cache.delete(key);
897
+ if (deleted && entry?.size) {
898
+ this.currentMemoryBytes -= entry.size;
899
+ }
900
+ return deleted;
846
901
  }
847
902
  clear() {
848
903
  this.cache.clear();
904
+ this.currentMemoryBytes = 0;
849
905
  }
850
906
  get size() {
851
907
  return this.cache.size;
852
908
  }
909
+ stats() {
910
+ const memoryMB = this.currentMemoryBytes / (1024 * 1024);
911
+ const maxMemoryMB = this.maxMemoryBytes ? this.maxMemoryBytes / (1024 * 1024) : null;
912
+ const memoryUsagePercent = maxMemoryMB ? memoryMB / maxMemoryMB * 100 : null;
913
+ return {
914
+ entries: this.cache.size,
915
+ memoryMB: Math.round(memoryMB * 100) / 100,
916
+ maxMemoryMB: maxMemoryMB ? Math.round(maxMemoryMB) : null,
917
+ memoryUsagePercent: memoryUsagePercent ? Math.round(memoryUsagePercent) : null
918
+ };
919
+ }
853
920
  cleanup() {
854
921
  const now = Date.now();
855
922
  for (const [key, entry] of this.cache.entries()) {
856
923
  if (entry.exp <= now) {
857
924
  this.cache.delete(key);
925
+ if (entry.size) {
926
+ this.currentMemoryBytes -= entry.size;
927
+ }
858
928
  }
859
929
  }
860
930
  }
@@ -82238,7 +82308,7 @@ var require_encode = __commonJS((exports, module) => {
82238
82308
  }
82239
82309
  return new Buffer([27].concat(bytes(xs)));
82240
82310
  };
82241
- var ord = encode.ord = function ord(c) {
82311
+ var ord = encode.ord = function ord2(c) {
82242
82312
  return c.charCodeAt(0);
82243
82313
  };
82244
82314
  });
@@ -82303,7 +82373,7 @@ var require_charm = __commonJS((exports, module) => {
82303
82373
  });
82304
82374
  return charm;
82305
82375
  };
82306
- var Charm = exports.Charm = function Charm() {
82376
+ var Charm = exports.Charm = function Charm2() {
82307
82377
  this.writable = true;
82308
82378
  this.readable = true;
82309
82379
  this.pending = [];
@@ -84932,7 +85002,7 @@ var require_memorystream = __commonJS((exports, module) => {
84932
85002
  this.init(data, options);
84933
85003
  }
84934
85004
  UTIL.inherits(MemoryDuplexStream, STREAM.Duplex);
84935
- MemoryReadableStream.prototype.init = MemoryWritableStream.prototype.init = MemoryDuplexStream.prototype.init = function init(data, options) {
85005
+ MemoryReadableStream.prototype.init = MemoryWritableStream.prototype.init = MemoryDuplexStream.prototype.init = function init2(data, options) {
84936
85006
  var self2 = this;
84937
85007
  this.queue = [];
84938
85008
  if (data) {
@@ -85592,7 +85662,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
85592
85662
  '"': "&quot;",
85593
85663
  "'": "&#39;"
85594
85664
  };
85595
- var getEscapeReplacement = function getEscapeReplacement(ch) {
85665
+ var getEscapeReplacement = function getEscapeReplacement2(ch) {
85596
85666
  return escapeReplacements[ch];
85597
85667
  };
85598
85668
  function escape(html2, encode) {
@@ -85689,7 +85759,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
85689
85759
  }
85690
85760
  }
85691
85761
  var noopTest = {
85692
- exec: function noopTest() {}
85762
+ exec: function noopTest2() {}
85693
85763
  };
85694
85764
  function splitCells(tableRow, count) {
85695
85765
  var row = tableRow.replace(/\|/g, function(match, offset, str) {
@@ -85916,7 +85986,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
85916
85986
  var raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
85917
85987
  var bull = cap[1].trim();
85918
85988
  var isordered = bull.length > 1;
85919
- var list = {
85989
+ var list2 = {
85920
85990
  type: "list",
85921
85991
  raw: "",
85922
85992
  ordered: isordered,
@@ -86016,9 +86086,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
86016
86086
  line = nextLine.slice(indent);
86017
86087
  }
86018
86088
  }
86019
- if (!list.loose) {
86089
+ if (!list2.loose) {
86020
86090
  if (endsWithBlankLine) {
86021
- list.loose = true;
86091
+ list2.loose = true;
86022
86092
  } else if (/\n *\n *$/.test(raw)) {
86023
86093
  endsWithBlankLine = true;
86024
86094
  }
@@ -86030,7 +86100,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
86030
86100
  itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
86031
86101
  }
86032
86102
  }
86033
- list.items.push({
86103
+ list2.items.push({
86034
86104
  type: "list_item",
86035
86105
  raw,
86036
86106
  task: !!istask,
@@ -86038,34 +86108,34 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
86038
86108
  loose: false,
86039
86109
  text: itemContents
86040
86110
  });
86041
- list.raw += raw;
86111
+ list2.raw += raw;
86042
86112
  }
86043
- list.items[list.items.length - 1].raw = raw.trimRight();
86044
- list.items[list.items.length - 1].text = itemContents.trimRight();
86045
- list.raw = list.raw.trimRight();
86046
- var l = list.items.length;
86113
+ list2.items[list2.items.length - 1].raw = raw.trimRight();
86114
+ list2.items[list2.items.length - 1].text = itemContents.trimRight();
86115
+ list2.raw = list2.raw.trimRight();
86116
+ var l = list2.items.length;
86047
86117
  for (i = 0;i < l; i++) {
86048
86118
  this.lexer.state.top = false;
86049
- list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
86050
- if (!list.loose) {
86051
- var spacers = list.items[i].tokens.filter(function(t) {
86119
+ list2.items[i].tokens = this.lexer.blockTokens(list2.items[i].text, []);
86120
+ if (!list2.loose) {
86121
+ var spacers = list2.items[i].tokens.filter(function(t) {
86052
86122
  return t.type === "space";
86053
86123
  });
86054
86124
  var hasMultipleLineBreaks = spacers.length > 0 && spacers.some(function(t) {
86055
86125
  return /\n.*\n/.test(t.raw);
86056
86126
  });
86057
- list.loose = hasMultipleLineBreaks;
86127
+ list2.loose = hasMultipleLineBreaks;
86058
86128
  }
86059
86129
  }
86060
- if (list.loose) {
86130
+ if (list2.loose) {
86061
86131
  for (i = 0;i < l; i++) {
86062
- list.items[i].loose = true;
86132
+ list2.items[i].loose = true;
86063
86133
  }
86064
86134
  }
86065
- return list;
86135
+ return list2;
86066
86136
  }
86067
86137
  };
86068
- _proto.html = function html(src2) {
86138
+ _proto.html = function html2(src2) {
86069
86139
  var cap = this.rules.block.html.exec(src2);
86070
86140
  if (cap) {
86071
86141
  var token = {
@@ -86243,10 +86313,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
86243
86313
  var href = cap[2];
86244
86314
  var title = "";
86245
86315
  if (this.options.pedantic) {
86246
- var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
86247
- if (link) {
86248
- href = link[1];
86249
- title = link[3];
86316
+ var link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
86317
+ if (link2) {
86318
+ href = link2[1];
86319
+ title = link2[3];
86250
86320
  }
86251
86321
  } else {
86252
86322
  title = cap[3] ? cap[3].slice(1, -1) : "";
@@ -86795,7 +86865,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
86795
86865
  this.state.top = true;
86796
86866
  return tokens;
86797
86867
  };
86798
- _proto.inline = function inline(src2, tokens) {
86868
+ _proto.inline = function inline2(src2, tokens) {
86799
86869
  if (tokens === undefined) {
86800
86870
  tokens = [];
86801
86871
  }
@@ -86995,7 +87065,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
86995
87065
  ` + quote + `</blockquote>
86996
87066
  `;
86997
87067
  };
86998
- _proto.html = function html(_html) {
87068
+ _proto.html = function html2(_html) {
86999
87069
  return _html;
87000
87070
  };
87001
87071
  _proto.heading = function heading(text, level, raw, slugger) {
@@ -87108,7 +87178,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
87108
87178
  _proto.del = function del(text) {
87109
87179
  return text;
87110
87180
  };
87111
- _proto.html = function html(text) {
87181
+ _proto.html = function html2(text) {
87112
87182
  return text;
87113
87183
  };
87114
87184
  _proto.text = function text(_text) {
@@ -87153,8 +87223,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
87153
87223
  if (options2 === undefined) {
87154
87224
  options2 = {};
87155
87225
  }
87156
- var slug = this.serialize(value);
87157
- return this.getNextSafeSlug(slug, options2.dryrun);
87226
+ var slug2 = this.serialize(value);
87227
+ return this.getNextSafeSlug(slug2, options2.dryrun);
87158
87228
  };
87159
87229
  return Slugger2;
87160
87230
  }();
@@ -87167,16 +87237,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
87167
87237
  this.textRenderer = new TextRenderer;
87168
87238
  this.slugger = new Slugger;
87169
87239
  }
87170
- Parser2.parse = function parse(tokens, options2) {
87240
+ Parser2.parse = function parse2(tokens, options2) {
87171
87241
  var parser2 = new Parser2(options2);
87172
87242
  return parser2.parse(tokens);
87173
87243
  };
87174
- Parser2.parseInline = function parseInline(tokens, options2) {
87244
+ Parser2.parseInline = function parseInline2(tokens, options2) {
87175
87245
  var parser2 = new Parser2(options2);
87176
87246
  return parser2.parseInline(tokens);
87177
87247
  };
87178
87248
  var _proto = Parser2.prototype;
87179
- _proto.parse = function parse(tokens, top) {
87249
+ _proto.parse = function parse2(tokens, top) {
87180
87250
  if (top === undefined) {
87181
87251
  top = true;
87182
87252
  }
@@ -87308,7 +87378,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
87308
87378
  }
87309
87379
  return out;
87310
87380
  };
87311
- _proto.parseInline = function parseInline(tokens, renderer) {
87381
+ _proto.parseInline = function parseInline2(tokens, renderer) {
87312
87382
  renderer = renderer || this.renderer;
87313
87383
  var out = "", i, token, ret;
87314
87384
  var l = tokens.length;
@@ -87448,7 +87518,7 @@ Please report this to https://github.com/markedjs/marked.`;
87448
87518
  } catch (e) {
87449
87519
  return throwError(e);
87450
87520
  }
87451
- var done = function done(err) {
87521
+ var done = function done2(err) {
87452
87522
  var out;
87453
87523
  if (!err) {
87454
87524
  try {
@@ -87606,7 +87676,7 @@ Please report this to https://github.com/markedjs/marked.`;
87606
87676
  if (pack.renderer) {
87607
87677
  (function() {
87608
87678
  var renderer = marked.defaults.renderer || new Renderer;
87609
- var _loop = function _loop(prop2) {
87679
+ var _loop = function _loop2(prop2) {
87610
87680
  var prevRenderer = renderer[prop2];
87611
87681
  renderer[prop2] = function() {
87612
87682
  for (var _len3 = arguments.length, args2 = new Array(_len3), _key3 = 0;_key3 < _len3; _key3++) {
@@ -87628,7 +87698,7 @@ Please report this to https://github.com/markedjs/marked.`;
87628
87698
  if (pack.tokenizer) {
87629
87699
  (function() {
87630
87700
  var tokenizer = marked.defaults.tokenizer || new Tokenizer;
87631
- var _loop2 = function _loop2(prop2) {
87701
+ var _loop2 = function _loop22(prop2) {
87632
87702
  var prevTokenizer = tokenizer[prop2];
87633
87703
  tokenizer[prop2] = function() {
87634
87704
  for (var _len4 = arguments.length, args2 = new Array(_len4), _key4 = 0;_key4 < _len4; _key4++) {
@@ -87650,7 +87720,7 @@ Please report this to https://github.com/markedjs/marked.`;
87650
87720
  if (pack.hooks) {
87651
87721
  (function() {
87652
87722
  var hooks = marked.defaults.hooks || new Hooks;
87653
- var _loop3 = function _loop3(prop2) {
87723
+ var _loop3 = function _loop32(prop2) {
87654
87724
  var prevHook = hooks[prop2];
87655
87725
  if (Hooks.passThroughHooks.has(prop2)) {
87656
87726
  hooks[prop2] = function(arg) {
@@ -87697,7 +87767,7 @@ Please report this to https://github.com/markedjs/marked.`;
87697
87767
  };
87698
87768
  marked.walkTokens = function(tokens, callback) {
87699
87769
  var values = [];
87700
- var _loop4 = function _loop4() {
87770
+ var _loop4 = function _loop42() {
87701
87771
  var token = _step.value;
87702
87772
  values = values.concat(callback.call(marked, token));
87703
87773
  switch (token.type) {
@@ -95348,7 +95418,7 @@ var require_emoji2 = __commonJS((exports, module) => {
95348
95418
  Emoji.replace = function replace(str, replacement, cleanSpaces) {
95349
95419
  if (!str)
95350
95420
  return "";
95351
- var replace = typeof replacement === "function" ? replacement : function() {
95421
+ var replace2 = typeof replacement === "function" ? replacement : function() {
95352
95422
  return replacement;
95353
95423
  };
95354
95424
  var words = toArray(str);
@@ -95357,7 +95427,7 @@ var require_emoji2 = __commonJS((exports, module) => {
95357
95427
  if (emoji && cleanSpaces && words[idx + 1] === " ") {
95358
95428
  words[idx + 1] = "";
95359
95429
  }
95360
- return emoji ? replace(emoji) : word;
95430
+ return emoji ? replace2(emoji) : word;
95361
95431
  }).join("");
95362
95432
  return cleanSpaces ? replaced.replace(trimSpaceRegex, "") : replaced;
95363
95433
  };
@@ -97712,7 +97782,7 @@ var require_lodash = __commonJS((exports, module) => {
97712
97782
  function unicodeWords(string) {
97713
97783
  return string.match(reUnicodeWord) || [];
97714
97784
  }
97715
- var runInContext = function runInContext(context4) {
97785
+ var runInContext = function runInContext2(context4) {
97716
97786
  context4 = context4 == null ? root : _.defaults(root.Object(), context4, _.pick(root, contextProps));
97717
97787
  var { Array: Array2, Date: Date2, Error: Error2, Function: Function2, Math: Math2, Object: Object2, RegExp: RegExp2, String: String2, TypeError: TypeError2 } = context4;
97718
97788
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
@@ -102225,7 +102295,7 @@ __p += '`;
102225
102295
  lodash.replace = replace;
102226
102296
  lodash.result = result;
102227
102297
  lodash.round = round;
102228
- lodash.runInContext = runInContext;
102298
+ lodash.runInContext = runInContext2;
102229
102299
  lodash.sample = sample;
102230
102300
  lodash.size = size;
102231
102301
  lodash.snakeCase = snakeCase;
@@ -102916,12 +102986,15 @@ async function waitForInitialBuild(genProcess) {
102916
102986
  console.log("[reroute/dev] Initial build complete!");
102917
102987
  return outputBuffer;
102918
102988
  }
102919
- async function startServerProcess(genProcess) {
102989
+ async function startServerProcess(genProcess, port) {
102920
102990
  const serverProcess = spawn2("bun", ["--watch", "src/index.ts"], {
102921
- stdio: ["ignore", "pipe", "pipe"]
102991
+ stdio: ["ignore", "pipe", "pipe"],
102992
+ env: {
102993
+ ...process.env,
102994
+ PORT: String(port)
102995
+ }
102922
102996
  });
102923
102997
  console.log("[reroute/dev] Starting server...");
102924
- const port = Number(process.env.PORT || "3000");
102925
102998
  try {
102926
102999
  await waitForServerReady(port);
102927
103000
  console.log(`[reroute/dev] ✓ Server ready at http://localhost:${port}
@@ -102991,6 +103064,8 @@ async function setupTerminalUI(genProcess, serverProcess, outputBuffer) {
102991
103064
  }
102992
103065
  async function dev(args) {
102993
103066
  const terminalUI = args.includes("--tui") || args.includes("-t");
103067
+ const portIndex = args.findIndex((arg) => arg === "--port" || arg === "-p");
103068
+ const port = portIndex !== -1 && args[portIndex + 1] ? Number(args[portIndex + 1]) : Number(process.env.PORT || "3000");
102994
103069
  try {
102995
103070
  console.log("[reroute/dev] Starting development servers...");
102996
103071
  console.log(`[reroute/dev] Press Ctrl+C to stop
@@ -103008,7 +103083,7 @@ async function dev(args) {
103008
103083
  genProcess.kill();
103009
103084
  process.exit(1);
103010
103085
  });
103011
- const serverProcess = await startServerProcess(genProcess);
103086
+ const serverProcess = await startServerProcess(genProcess, port);
103012
103087
  if (!terminalUI) {
103013
103088
  setupDefaultMode(genProcess, serverProcess, outputBuffer);
103014
103089
  } else {
@@ -103057,6 +103132,15 @@ function getRerouteCommand2() {
103057
103132
  return "reroute";
103058
103133
  }
103059
103134
  async function start(args) {
103135
+ const portIndex = args.findIndex((arg) => arg === "--port" || arg === "-p");
103136
+ const port = portIndex !== -1 && args[portIndex + 1] ? Number(args[portIndex + 1]) : Number(process.env.PORT || "3000");
103137
+ const genArgs = args.filter((arg, index) => {
103138
+ if (arg === "--port" || arg === "-p")
103139
+ return false;
103140
+ if (portIndex !== -1 && index === portIndex + 1)
103141
+ return false;
103142
+ return true;
103143
+ });
103060
103144
  try {
103061
103145
  const rerouteCmd = getRerouteCommand2();
103062
103146
  const useShell = rerouteCmd.includes(" ");
@@ -103076,10 +103160,10 @@ async function start(args) {
103076
103160
  };
103077
103161
  process.stdout.write(`${colorizeLogPrefixAnsi("[reroute/start] Running gen...")}
103078
103162
  `);
103079
- const genCommand = useShell ? `${rerouteCmd} gen ${args.join(" ")}` : rerouteCmd;
103080
- const genArgs = useShell ? [] : ["gen", ...args];
103163
+ const genCommand = useShell ? `${rerouteCmd} gen ${genArgs.join(" ")}` : rerouteCmd;
103164
+ const genArgsWithCmd = useShell ? [] : ["gen", ...genArgs];
103081
103165
  await new Promise((resolve2, reject) => {
103082
- const genProcess = spawn3(genCommand, genArgs, {
103166
+ const genProcess = spawn3(genCommand, genArgsWithCmd, {
103083
103167
  stdio: ["ignore", "pipe", "pipe"],
103084
103168
  shell: useShell
103085
103169
  });
@@ -103101,7 +103185,11 @@ async function start(args) {
103101
103185
  process.stdout.write(`${colorizeLogPrefixAnsi("[reroute/start] Starting server...")}
103102
103186
  `);
103103
103187
  const serverProcess = spawn3("bun", ["src/index.ts"], {
103104
- stdio: ["ignore", "pipe", "pipe"]
103188
+ stdio: ["ignore", "pipe", "pipe"],
103189
+ env: {
103190
+ ...process.env,
103191
+ PORT: String(port)
103192
+ }
103105
103193
  });
103106
103194
  const serverBuffer = { current: "" };
103107
103195
  const handleServerOutput = createServerOutputHandler(serverBuffer);
@@ -103109,7 +103197,6 @@ async function start(args) {
103109
103197
  serverProcess.stderr?.on("data", handleServerOutput);
103110
103198
  process.stdout.write(colorizeLogPrefixAnsi(`[reroute/start] Waiting for server to be ready...
103111
103199
  `));
103112
- const port = Number(process.env.PORT || "3000");
103113
103200
  try {
103114
103201
  await waitForServerReady(port, 1e4);
103115
103202
  process.stdout.write(colorizeLogPrefixAnsi(`[reroute/start] Server is ready!
@@ -106081,7 +106168,7 @@ async function getVersionString2() {
106081
106168
  }
106082
106169
  async function getVersion2() {
106083
106170
  if (true) {
106084
- return "0.45.2";
106171
+ return "0.45.4";
106085
106172
  }
106086
106173
  const possiblePaths = [
106087
106174
  path3.join(import.meta.dir, "../../../package.json"),
@@ -106098,10 +106185,10 @@ async function getVersion2() {
106098
106185
  }
106099
106186
  async function getCommit2() {
106100
106187
  if (true) {
106101
- return "3df0c37";
106188
+ return "615060e";
106102
106189
  }
106103
106190
  return "dev";
106104
106191
  }
106105
106192
  main();
106106
106193
 
106107
- //# debugId=0448E20E0CE344EC64756E2164756E21
106194
+ //# debugId=AF08BA809BAD0EDC64756E2164756E21