reroute-js 1.0.0-alpha.21 → 1.0.0-alpha.23

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 (215) hide show
  1. package/README.md +1 -0
  2. package/cli/bin.d.ts +1 -1
  3. package/cli/bin.js +651 -248
  4. package/cli/bin.js.map +13 -10
  5. package/cli/index.d.ts +1 -1
  6. package/cli/index.js +14 -7
  7. package/cli/index.js.map +5 -5
  8. package/cli/src/cli.d.ts +1 -1
  9. package/cli/src/commands/analyze.d.ts +1 -1
  10. package/cli/src/commands/build.d.ts +1 -1
  11. package/cli/src/commands/build.d.ts.map +1 -1
  12. package/cli/src/commands/dev.d.ts +1 -1
  13. package/cli/src/commands/dev.d.ts.map +1 -1
  14. package/cli/src/commands/gen.d.ts +1 -1
  15. package/cli/src/commands/gen.d.ts.map +1 -1
  16. package/cli/src/commands/index.d.ts +1 -1
  17. package/cli/src/commands/init.d.ts +1 -1
  18. package/cli/src/commands/lib/assets.d.ts +1 -1
  19. package/cli/src/commands/lib/bundler.d.ts +1 -1
  20. package/cli/src/commands/lib/command.d.ts +1 -1
  21. package/cli/src/commands/lib/env.d.ts +1 -1
  22. package/cli/src/commands/lib/images.d.ts +12 -0
  23. package/cli/src/commands/lib/images.d.ts.map +1 -0
  24. package/cli/src/commands/lib/index.d.ts +1 -1
  25. package/cli/src/commands/lib/log.d.ts +1 -1
  26. package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
  27. package/cli/src/commands/lib/markdown/index.d.ts +1 -1
  28. package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
  29. package/cli/src/commands/lib/production.d.ts +3 -3
  30. package/cli/src/commands/lib/production.d.ts.map +1 -1
  31. package/cli/src/commands/lib/server.d.ts +1 -1
  32. package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
  33. package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
  34. package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
  35. package/cli/src/commands/lib/theme.d.ts +1 -1
  36. package/cli/src/commands/lib/version.d.ts +1 -1
  37. package/cli/src/commands/lib/watch.d.ts +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/index.d.ts +1 -1
  41. package/core/index.d.ts +1 -1
  42. package/core/index.js +61 -2
  43. package/core/index.js.map +6 -5
  44. package/core/src/app-paths.d.ts +1 -1
  45. package/core/src/bundler/hash.d.ts +1 -1
  46. package/core/src/bundler/index.d.ts +1 -1
  47. package/core/src/config.d.ts +41 -2
  48. package/core/src/config.d.ts.map +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 +29 -0
  61. package/core/src/image.d.ts.map +1 -0
  62. package/core/src/index.d.ts +2 -1
  63. package/core/src/index.d.ts.map +1 -1
  64. package/core/src/llms/discovery.d.ts +1 -1
  65. package/core/src/llms/extractor.d.ts +1 -1
  66. package/core/src/llms/formatter.d.ts +1 -1
  67. package/core/src/llms/full-generator.d.ts +1 -1
  68. package/core/src/llms/index-generator.d.ts +1 -1
  69. package/core/src/llms/index.d.ts +1 -1
  70. package/core/src/og/discovery.d.ts +1 -1
  71. package/core/src/og/index.d.ts +1 -1
  72. package/core/src/og/meta.d.ts +1 -1
  73. package/core/src/og/render.d.ts +1 -1
  74. package/core/src/og/types.d.ts +1 -1
  75. package/core/src/robots/discovery.d.ts +1 -1
  76. package/core/src/robots/generator.d.ts +1 -1
  77. package/core/src/robots/index.d.ts +1 -1
  78. package/core/src/robots/policies.d.ts +1 -1
  79. package/core/src/rss/discovery.d.ts +1 -1
  80. package/core/src/rss/generator.d.ts +1 -1
  81. package/core/src/rss/index.d.ts +1 -1
  82. package/core/src/sitemap/discovery.d.ts +1 -1
  83. package/core/src/sitemap/generator.d.ts +1 -1
  84. package/core/src/sitemap/index.d.ts +1 -1
  85. package/core/src/ssr/index.d.ts +1 -1
  86. package/core/src/ssr/lib/cache.d.ts +1 -1
  87. package/core/src/ssr/lib/cleanup.d.ts +1 -1
  88. package/core/src/ssr/lib/collections.d.ts +1 -1
  89. package/core/src/ssr/lib/compression.d.ts +1 -1
  90. package/core/src/ssr/lib/compute/content.d.ts +1 -1
  91. package/core/src/ssr/lib/compute/index.d.ts +1 -1
  92. package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
  93. package/core/src/ssr/lib/compute/routes.d.ts +1 -1
  94. package/core/src/ssr/lib/content-path.d.ts +1 -1
  95. package/core/src/ssr/lib/data.d.ts +1 -1
  96. package/core/src/ssr/lib/html.d.ts +1 -1
  97. package/core/src/ssr/lib/imports.d.ts +1 -1
  98. package/core/src/ssr/lib/index.d.ts +1 -1
  99. package/core/src/ssr/lib/layouts.d.ts +1 -1
  100. package/core/src/ssr/lib/metadata.d.ts +1 -1
  101. package/core/src/ssr/lib/mime.d.ts +1 -1
  102. package/core/src/ssr/lib/modules.d.ts +1 -1
  103. package/core/src/ssr/lib/path.d.ts +1 -1
  104. package/core/src/ssr/lib/preload.d.ts +1 -1
  105. package/core/src/ssr/lib/route-match.d.ts +1 -1
  106. package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
  107. package/core/src/ssr/lib/scripts/data.d.ts +1 -1
  108. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  109. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  110. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  111. package/core/src/ssr/lib/seed.d.ts +1 -1
  112. package/core/src/ssr/lib/serialize.d.ts +1 -1
  113. package/core/src/ssr/lib/setup.d.ts +1 -1
  114. package/core/src/ssr/lib/styles.d.ts +1 -1
  115. package/core/src/ssr/lib/template.d.ts +1 -1
  116. package/core/src/ssr/lib/types.d.ts +1 -1
  117. package/core/src/ssr/render.d.ts +1 -1
  118. package/core/src/ssr/stream.d.ts +1 -1
  119. package/elysia/index.d.ts +1 -1
  120. package/elysia/index.js +295 -135
  121. package/elysia/index.js.map +7 -6
  122. package/elysia/src/index.d.ts +2 -1
  123. package/elysia/src/index.d.ts.map +1 -1
  124. package/elysia/src/libs/assets.d.ts +1 -1
  125. package/elysia/src/libs/cache.d.ts +1 -1
  126. package/elysia/src/libs/caching.d.ts +1 -1
  127. package/elysia/src/libs/http.d.ts +1 -1
  128. package/elysia/src/libs/i18n.d.ts +1 -1
  129. package/elysia/src/libs/image.d.ts +30 -1
  130. package/elysia/src/libs/image.d.ts.map +1 -1
  131. package/elysia/src/libs/index.d.ts +2 -2
  132. package/elysia/src/libs/index.d.ts.map +1 -1
  133. package/elysia/src/libs/llms.d.ts +1 -1
  134. package/elysia/src/libs/response.d.ts +1 -1
  135. package/elysia/src/libs/serving.d.ts +1 -1
  136. package/elysia/src/plugin.d.ts +1 -1
  137. package/elysia/src/routes/artifacts.d.ts +1 -1
  138. package/elysia/src/routes/content.d.ts +1 -1
  139. package/elysia/src/routes/image.d.ts +1 -1
  140. package/elysia/src/routes/index.d.ts +1 -1
  141. package/elysia/src/routes/internal.d.ts +1 -1
  142. package/elysia/src/routes/liveReloadClient.d.ts +1 -1
  143. package/elysia/src/routes/llms.d.ts +1 -1
  144. package/elysia/src/routes/og.d.ts +1 -1
  145. package/elysia/src/routes/redirects.d.ts +1 -1
  146. package/elysia/src/routes/robots.d.ts +1 -1
  147. package/elysia/src/routes/rss.d.ts +1 -1
  148. package/elysia/src/routes/search.d.ts +1 -1
  149. package/elysia/src/routes/sitemap.d.ts +1 -1
  150. package/elysia/src/routes/ssr.d.ts +1 -1
  151. package/elysia/src/routes/static.d.ts +1 -1
  152. package/elysia/src/routes/themeCssRefresh.d.ts +1 -1
  153. package/elysia/src/types.d.ts +1 -1
  154. package/package.json +1 -1
  155. package/react/index.d.ts +1 -1
  156. package/react/index.js +54 -17
  157. package/react/index.js.map +4 -4
  158. package/react/src/components/ClientOnly.d.ts +1 -1
  159. package/react/src/components/ContentRoute.d.ts +1 -1
  160. package/react/src/components/Image.d.ts +5 -1
  161. package/react/src/components/Image.d.ts.map +1 -1
  162. package/react/src/components/LazyRoute.d.ts +1 -1
  163. package/react/src/components/Link.d.ts +1 -1
  164. package/react/src/components/Markdown.d.ts +1 -1
  165. package/react/src/components/Outlet.d.ts +1 -1
  166. package/react/src/components/index.d.ts +1 -1
  167. package/react/src/hooks/index.d.ts +1 -1
  168. package/react/src/hooks/useContent.d.ts +1 -1
  169. package/react/src/hooks/useData.d.ts +1 -1
  170. package/react/src/hooks/useFeed.d.ts +1 -1
  171. package/react/src/hooks/useLayoutData.d.ts +1 -1
  172. package/react/src/hooks/useLlms.d.ts +1 -1
  173. package/react/src/hooks/useNavigate.d.ts +1 -1
  174. package/react/src/hooks/useParams.d.ts +1 -1
  175. package/react/src/hooks/useRouter.d.ts +1 -1
  176. package/react/src/hooks/useSearch.d.ts +1 -1
  177. package/react/src/hooks/useSearchParams.d.ts +1 -1
  178. package/react/src/hooks/useToc.d.ts +1 -1
  179. package/react/src/i18n/LocaleProvider.d.ts +1 -1
  180. package/react/src/i18n/helpers.d.ts +1 -1
  181. package/react/src/i18n/index.d.ts +1 -1
  182. package/react/src/index.d.ts +1 -1
  183. package/react/src/lib/bundle.d.ts +1 -1
  184. package/react/src/lib/collection.d.ts +1 -1
  185. package/react/src/lib/content.d.ts +1 -1
  186. package/react/src/lib/head.d.ts +1 -1
  187. package/react/src/lib/index.d.ts +1 -1
  188. package/react/src/lib/lazy-route.d.ts +9 -2
  189. package/react/src/lib/lazy-route.d.ts.map +1 -1
  190. package/react/src/lib/route-loader.d.ts +1 -1
  191. package/react/src/providers/ContentProvider.d.ts +1 -1
  192. package/react/src/providers/RerouteProvider.d.ts +1 -1
  193. package/react/src/providers/RouterProvider.d.ts +1 -1
  194. package/react/src/providers/index.d.ts +1 -1
  195. package/react/src/types/any.d.ts +1 -1
  196. package/react/src/types/index.d.ts +1 -1
  197. package/react/src/types/router.d.ts +1 -1
  198. package/telemetry/react.d.ts +1 -1
  199. package/telemetry/react.js +2 -2
  200. package/telemetry/react.js.map +1 -1
  201. package/telemetry/server.d.ts +1 -1
  202. package/telemetry/server.js +6 -2
  203. package/telemetry/server.js.map +4 -4
  204. package/telemetry/src/react/api.d.ts +1 -1
  205. package/telemetry/src/react/context.d.ts +1 -1
  206. package/telemetry/src/react/index.d.ts +1 -1
  207. package/telemetry/src/react/telemetry.d.ts +1 -1
  208. package/telemetry/src/server/context.d.ts +1 -1
  209. package/telemetry/src/server/headers/extractor.d.ts +1 -1
  210. package/telemetry/src/server/headers/index.d.ts +1 -1
  211. package/telemetry/src/server/headers/presets.d.ts +1 -1
  212. package/telemetry/src/server/index.d.ts +1 -1
  213. package/telemetry/src/server/instrumentation.d.ts +1 -1
  214. package/telemetry/src/server/plugin.d.ts +1 -1
  215. package/telemetry/src/server/sourcemap.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -7,6 +7,7 @@
7
7
  *
8
8
  * Built with Bun <3
9
9
  */
10
+ export { imageCacheIdentity, initImageCache, isImageFile, optimizeImage, preprocessConcurrency, preprocessImages, } from './libs/image';
10
11
  export * from './plugin';
11
12
  export * from './types';
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/elysia/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/elysia/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,gBAAgB,GAChB,MAAM,cAAc,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -7,6 +7,7 @@
7
7
  *
8
8
  * Built with Bun <3
9
9
  */
10
+ import type { ImagePreprocessFormat } from 'reroute-js/core';
10
11
  interface ImageTransformOptions {
11
12
  width?: number;
12
13
  height?: number;
@@ -26,10 +27,38 @@ interface ImageOptimizationResult {
26
27
  * Initialize disk cache directory
27
28
  */
28
29
  export declare function initImageCache(cacheDir: string): void;
30
+ /**
31
+ * Identity used in the disk-cache key. Local files are keyed by their
32
+ * `/assets/…` suffix so `src/client/assets` and `.reroute/assets` share
33
+ * the same entries after build-time preprocess.
34
+ */
35
+ export declare function imageCacheIdentity(imagePath: string): string;
29
36
  export declare function optimizeImage(imagePath: string, options: ImageTransformOptions, acceptHeader?: string): Promise<ImageOptimizationResult>;
30
37
  /**
31
38
  * Check if path is an image file
32
39
  */
33
40
  export declare function isImageFile(path: string): boolean;
41
+ type ImagePreprocessRunOptions = {
42
+ assetsDir: string;
43
+ cacheDir: string;
44
+ widths: number[];
45
+ formats: ImagePreprocessFormat[];
46
+ quality: number;
47
+ qualities?: number[];
48
+ concurrency?: number;
49
+ };
50
+ type ImagePreprocessResult = {
51
+ sources: number;
52
+ generated: number;
53
+ cached: number;
54
+ jobs: number;
55
+ concurrency: number;
56
+ };
57
+ export declare function preprocessConcurrency(override?: number): number;
58
+ /**
59
+ * Bake width × format variants into the Sharp disk cache so the first
60
+ * `/__reroute_image` request does not encode on the hot path.
61
+ */
62
+ export declare function preprocessImages(options: ImagePreprocessRunOptions): Promise<ImagePreprocessResult>;
34
63
  export {};
35
64
  //# sourceMappingURL=image.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/libs/image.ts"],"names":[],"mappings":"AAIA,UAAU,qBAAqB;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IACnD,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;CAC1D;AAED,UAAU,uBAAuB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACb;AASD;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,QAE9C;AAgLD,wBAAsB,aAAa,CAClC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,qBAAqB,EAC9B,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,uBAAuB,CAAC,CAyElC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIjD"}
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/libs/image.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAG7D,UAAU,qBAAqB;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IACnD,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;CAC1D;AAED,UAAU,uBAAuB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACb;AASD;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,QAE9C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAgLD,wBAAsB,aAAa,CAClC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,qBAAqB,EAC9B,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,uBAAuB,CAAC,CAyElC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIjD;AAwBD,KAAK,yBAAyB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB,CAAC;AA2EF,wBAAgB,qBAAqB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAK/D;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,yBAAyB,GAChC,OAAO,CAAC,qBAAqB,CAAC,CAoChC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -15,7 +15,7 @@ export { resolveClientDir } from './assets';
15
15
  export { getEncoding } from './cache';
16
16
  export { type BufferCacheEntry, type CacheEntry, type ContentCacheEntry, encodedKey, getIfValid, getOrCompute, isValid, namespacedKey, setWithTTL, type TextCacheEntry, toTTL, type XmlCacheEntry, } from './caching';
17
17
  export { jsonError, jsonWithCache } from './http';
18
- export { isImageFile, optimizeImage } from './image';
18
+ export { imageCacheIdentity, initImageCache, isImageFile, optimizeImage, preprocessConcurrency, preprocessImages, } from './image';
19
19
  export { buildLlmsCacheKey, buildLlmsFullCacheKey, buildLlmsIndexCacheKey, type CollectionMeta, type ContentNegotiationConfig, calculateLlmsDefaults, capitalize, cleanPathname, formatByteSize, getCollectionLlmsRoutes, getCollectionMeta, getFormatFromAccept, getRootLlmsRoutes, isLlmsSpecificRoute, type LlmsConfigDefaults, type ParsedContentFormat, parseAcceptHeader, parseContentFormat, shouldEnableContentNegotiation, } from './llms';
20
20
  export { buildCacheControl, buildDevCacheControl, type ContentType, createResponse, feedResponse, htmlResponse, jsResponse, markdownResponse, pngResponse, type ResponseOptions, textResponse, xmlResponse, } from './response';
21
21
  export { type CachedFileData, getAssetCacheControl, getHashedFileCacheControl, type ServeFileOptions, serveFile, } from './serving';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/libs/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,OAAO,EACP,aAAa,EACb,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,EACL,KAAK,aAAa,GAClB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAErD,OAAO,EACN,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,kBAAkB,EAClB,8BAA8B,GAC9B,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACN,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,WAAW,EAChB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,KAAK,eAAe,EACpB,YAAY,EACZ,WAAW,GACX,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,KAAK,cAAc,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,KAAK,gBAAgB,EACrB,SAAS,GACT,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/libs/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,OAAO,EACP,aAAa,EACb,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,EACL,KAAK,aAAa,GAClB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EACN,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,gBAAgB,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACN,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,kBAAkB,EAClB,8BAA8B,GAC9B,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACN,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,WAAW,EAChB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,KAAK,eAAe,EACpB,YAAY,EACZ,WAAW,GACX,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,KAAK,cAAc,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,KAAK,gBAAgB,EACrB,SAAS,GACT,MAAM,WAAW,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reroute-js",
3
- "version": "1.0.0-alpha.21",
3
+ "version": "1.0.0-alpha.23",
4
4
  "type": "module",
5
5
  "author": "stewones <hi@stewan.io>",
6
6
  "scripts": {
package/react/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
package/react/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v1.0.0-alpha.21
2
+ * reroute-js v1.0.0-alpha.23
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2026 stewones <hi@stewan.io>
@@ -3152,8 +3152,30 @@ import {
3152
3152
  } from "react";
3153
3153
  import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
3154
3154
  var DEFAULT_DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
3155
+ var DEFAULT_IMAGE_QUALITY = 75;
3156
+ function readImageRuntime() {
3157
+ const value = globalThis.__REROUTE_IMAGE__;
3158
+ if (!value || typeof value !== "object") {
3159
+ return;
3160
+ }
3161
+ const record = value;
3162
+ if (!Array.isArray(record.sizes) || record.sizes.some((size) => typeof size !== "number")) {
3163
+ return;
3164
+ }
3165
+ return {
3166
+ sizes: record.sizes,
3167
+ quality: typeof record.quality === "number" ? record.quality : DEFAULT_IMAGE_QUALITY
3168
+ };
3169
+ }
3170
+ function getImageDeviceSizes() {
3171
+ return readImageRuntime()?.sizes ?? [...DEFAULT_DEVICE_SIZES];
3172
+ }
3173
+ function getImageQuality() {
3174
+ return readImageRuntime()?.quality ?? DEFAULT_IMAGE_QUALITY;
3175
+ }
3155
3176
  function generateSrcSet(src, width, quality, format, loader) {
3156
- const sizes = width ? DEFAULT_DEVICE_SIZES.filter((size) => size <= width * 2) : DEFAULT_DEVICE_SIZES;
3177
+ const deviceSizes = getImageDeviceSizes();
3178
+ const sizes = width ? deviceSizes.filter((size) => size <= width * 2) : deviceSizes;
3157
3179
  if (sizes.length === 0 || !width) {
3158
3180
  return "";
3159
3181
  }
@@ -3187,7 +3209,7 @@ function Image({
3187
3209
  src,
3188
3210
  width,
3189
3211
  height,
3190
- quality = 75,
3212
+ quality,
3191
3213
  format = "auto",
3192
3214
  sizes,
3193
3215
  priority = false,
@@ -3215,7 +3237,7 @@ function Image({
3215
3237
  const imgRef = useRef2(null);
3216
3238
  const numWidth = typeof width === "string" ? parseInt(width, 10) : width;
3217
3239
  const numHeight = typeof height === "string" ? parseInt(height, 10) : height;
3218
- const numQuality = typeof quality === "string" ? parseInt(quality, 10) : quality || 75;
3240
+ const numQuality = typeof quality === "string" ? parseInt(quality, 10) : quality ?? getImageQuality();
3219
3241
  const imageUrl = loader ? loader({ src, width: numWidth || 0, quality: numQuality, format }) : numWidth ? defaultLoader({ src, width: numWidth, quality: numQuality, format }) : src;
3220
3242
  useEffect9(() => {
3221
3243
  const img = imgRef.current;
@@ -3771,14 +3793,22 @@ function getCapturedRouteHtml() {
3771
3793
  return null;
3772
3794
  }
3773
3795
  }
3774
- function isInitialHydration3() {
3796
+ function shouldReuseCapturedRouteHtml() {
3797
+ if (!isBrowser3)
3798
+ return false;
3775
3799
  try {
3776
- return !!globalThis.__REROUTE_INITIAL_HYDRATION__;
3800
+ const g = globalThis;
3801
+ if (!g.__REROUTE_INITIAL_HYDRATION__)
3802
+ return false;
3803
+ const ssrPath = g.__REROUTE_SSR_PATHNAME__;
3804
+ if (typeof ssrPath !== "string")
3805
+ return false;
3806
+ return window.location.pathname === ssrPath;
3777
3807
  } catch {
3778
3808
  return false;
3779
3809
  }
3780
3810
  }
3781
- function createLazyRoute(lazyImport, routePattern, serverComponent) {
3811
+ function createLazyRoute(lazyImport, routePattern, serverComponent, Fallback) {
3782
3812
  if (!isBrowser3) {
3783
3813
  let ServerRoute = function(props) {
3784
3814
  return createElement("div", {
@@ -3798,8 +3828,6 @@ function createLazyRoute(lazyImport, routePattern, serverComponent) {
3798
3828
  const LazyComp = lazy(lazyImport);
3799
3829
  function ClientRoute(props) {
3800
3830
  const [Resolved, setResolved] = useState10(null);
3801
- const initialHydration = isInitialHydration3();
3802
- const capturedHtml = initialHydration ? getCapturedRouteHtml() : null;
3803
3831
  useEffect10(() => {
3804
3832
  let alive = true;
3805
3833
  lazyImport().then((mod) => {
@@ -3813,13 +3841,19 @@ function createLazyRoute(lazyImport, routePattern, serverComponent) {
3813
3841
  if (Resolved) {
3814
3842
  return createElement(Resolved, props);
3815
3843
  }
3816
- if (capturedHtml && initialHydration) {
3817
- return createElement("div", {
3818
- "data-reroute-route": "ssr",
3819
- style: { display: "contents" },
3820
- suppressHydrationWarning: true,
3821
- dangerouslySetInnerHTML: { __html: capturedHtml }
3822
- });
3844
+ if (shouldReuseCapturedRouteHtml()) {
3845
+ const capturedHtml = getCapturedRouteHtml();
3846
+ if (capturedHtml) {
3847
+ return createElement("div", {
3848
+ "data-reroute-route": "ssr",
3849
+ style: { display: "contents" },
3850
+ suppressHydrationWarning: true,
3851
+ dangerouslySetInnerHTML: { __html: capturedHtml }
3852
+ });
3853
+ }
3854
+ }
3855
+ if (Fallback) {
3856
+ return createElement(Fallback);
3823
3857
  }
3824
3858
  return createElement(Suspense, { fallback: null }, createElement(LazyComp, props));
3825
3859
  }
@@ -3854,6 +3888,8 @@ export {
3854
3888
  createTranslator,
3855
3889
  dispatchDataEvent,
3856
3890
  fetchRouteData,
3891
+ getImageDeviceSizes,
3892
+ getImageQuality,
3857
3893
  getRerouteDataStore,
3858
3894
  isModifiedClick,
3859
3895
  localizeContentHref,
@@ -3872,6 +3908,7 @@ export {
3872
3908
  readInjectedBundle,
3873
3909
  readServerBundle,
3874
3910
  resolveBundleField,
3911
+ shouldReuseCapturedRouteHtml,
3875
3912
  shouldSkipInterception,
3876
3913
  storeAndDispatchData,
3877
3914
  t,
@@ -3895,4 +3932,4 @@ export {
3895
3932
  useToc
3896
3933
  };
3897
3934
 
3898
- //# debugId=FE3E1397860AC40E64756E2164756E21
3935
+ //# debugId=671BEE3857AA622464756E2164756E21