reroute-js 0.25.3 → 0.26.0

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/README.md +150 -52
  2. package/cli/bin.d.ts +1 -1
  3. package/cli/bin.js +446 -150
  4. package/cli/bin.js.map +13 -9
  5. package/cli/index.d.ts +1 -1
  6. package/cli/index.js +4 -4
  7. package/cli/index.js.map +1 -1
  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/dev.d.ts +1 -1
  12. package/cli/src/commands/gen.d.ts +1 -1
  13. package/cli/src/commands/gen.d.ts.map +1 -1
  14. package/cli/src/commands/index.d.ts +1 -1
  15. package/cli/src/commands/init.d.ts +1 -1
  16. package/cli/src/commands/lib/assets.d.ts +1 -1
  17. package/cli/src/commands/lib/bundler.d.ts +1 -1
  18. package/cli/src/commands/lib/command.d.ts +1 -1
  19. package/cli/src/commands/lib/env.d.ts +1 -1
  20. package/cli/src/commands/lib/index.d.ts +1 -1
  21. package/cli/src/commands/lib/log.d.ts +1 -1
  22. package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
  23. package/cli/src/commands/lib/markdown/index.d.ts +1 -1
  24. package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
  25. package/cli/src/commands/lib/production.d.ts +1 -1
  26. package/cli/src/commands/lib/server.d.ts +1 -1
  27. package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
  28. package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
  29. package/cli/src/commands/lib/tailwind.d.ts +1 -1
  30. package/cli/src/commands/lib/terminal-ui.d.ts +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 +912 -589
  37. package/core/index.js.map +22 -14
  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 +243 -2
  41. package/core/src/config.d.ts.map +1 -1
  42. package/core/src/content/discovery.d.ts +1 -1
  43. package/core/src/content/index.d.ts +1 -1
  44. package/core/src/content/metadata.d.ts +1 -1
  45. package/core/src/index.d.ts +1 -1
  46. package/core/src/llms/extractor.d.ts +1 -1
  47. package/core/src/llms/formatter.d.ts +1 -1
  48. package/core/src/llms/full-generator.d.ts +1 -1
  49. package/core/src/llms/index-generator.d.ts +1 -1
  50. package/core/src/llms/index.d.ts +1 -1
  51. package/core/src/og/discovery.d.ts +1 -1
  52. package/core/src/og/index.d.ts +1 -1
  53. package/core/src/og/meta.d.ts +1 -1
  54. package/core/src/og/render.d.ts +1 -1
  55. package/core/src/og/types.d.ts +1 -1
  56. package/core/src/robots/discovery.d.ts +1 -1
  57. package/core/src/robots/generator.d.ts +1 -1
  58. package/core/src/robots/index.d.ts +1 -1
  59. package/core/src/robots/policies.d.ts +1 -1
  60. package/core/src/rss/discovery.d.ts +1 -1
  61. package/core/src/rss/generator.d.ts +1 -1
  62. package/core/src/rss/index.d.ts +1 -1
  63. package/core/src/sitemap/discovery.d.ts +1 -1
  64. package/core/src/sitemap/generator.d.ts +1 -1
  65. package/core/src/sitemap/index.d.ts +1 -1
  66. package/core/src/ssr/index.d.ts +1 -1
  67. package/core/src/ssr/lib/cache.d.ts +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 +2 -2
  86. package/core/src/ssr/lib/scripts/data.d.ts.map +1 -1
  87. package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
  88. package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
  89. package/core/src/ssr/lib/scripts/index.d.ts +1 -1
  90. package/core/src/ssr/lib/seed.d.ts +1 -1
  91. package/core/src/ssr/lib/setup.d.ts +4 -2
  92. package/core/src/ssr/lib/setup.d.ts.map +1 -1
  93. package/core/src/ssr/lib/styles.d.ts +1 -1
  94. package/core/src/ssr/lib/template.d.ts +1 -1
  95. package/core/src/ssr/lib/types.d.ts +1 -1
  96. package/core/src/ssr/render.d.ts +4 -2
  97. package/core/src/ssr/render.d.ts.map +1 -1
  98. package/core/src/ssr/stream.d.ts +4 -2
  99. package/core/src/ssr/stream.d.ts.map +1 -1
  100. package/elysia/index.d.ts +1 -1
  101. package/elysia/index.js +715 -468
  102. package/elysia/index.js.map +15 -11
  103. package/elysia/src/index.d.ts +1 -1
  104. package/elysia/src/libs/assets.d.ts +1 -1
  105. package/elysia/src/libs/cache.d.ts +1 -1
  106. package/elysia/src/libs/caching.d.ts +1 -1
  107. package/elysia/src/libs/http.d.ts +1 -1
  108. package/elysia/src/libs/image.d.ts +1 -1
  109. package/elysia/src/libs/index.d.ts +1 -1
  110. package/elysia/src/libs/llms.d.ts +1 -1
  111. package/elysia/src/libs/response.d.ts +1 -1
  112. package/elysia/src/libs/serving.d.ts +1 -1
  113. package/elysia/src/plugin.d.ts +1 -1
  114. package/elysia/src/routes/artifacts.d.ts +1 -1
  115. package/elysia/src/routes/content.d.ts +1 -1
  116. package/elysia/src/routes/content.d.ts.map +1 -1
  117. package/elysia/src/routes/image.d.ts +1 -1
  118. package/elysia/src/routes/index.d.ts +1 -1
  119. package/elysia/src/routes/internal.d.ts +1 -1
  120. package/elysia/src/routes/llms.d.ts +1 -1
  121. package/elysia/src/routes/og.d.ts +1 -1
  122. package/elysia/src/routes/redirects.d.ts +1 -1
  123. package/elysia/src/routes/robots.d.ts +1 -1
  124. package/elysia/src/routes/rss.d.ts +1 -1
  125. package/elysia/src/routes/search.d.ts +1 -1
  126. package/elysia/src/routes/sitemap.d.ts +1 -1
  127. package/elysia/src/routes/ssr.d.ts +1 -1
  128. package/elysia/src/routes/ssr.d.ts.map +1 -1
  129. package/elysia/src/routes/static.d.ts +1 -1
  130. package/elysia/src/routes/static.d.ts.map +1 -1
  131. package/elysia/src/types.d.ts +1 -1
  132. package/package.json +2 -9
  133. package/react/index.d.ts +1 -1
  134. package/react/index.js +2 -2
  135. package/react/index.js.map +1 -1
  136. package/react/src/components/ClientOnly.d.ts +1 -1
  137. package/react/src/components/ContentRoute.d.ts +1 -1
  138. package/react/src/components/Image.d.ts +1 -1
  139. package/react/src/components/LazyRoute.d.ts +1 -1
  140. package/react/src/components/Link.d.ts +1 -1
  141. package/react/src/components/Markdown.d.ts +1 -1
  142. package/react/src/components/Outlet.d.ts +1 -1
  143. package/react/src/components/index.d.ts +1 -1
  144. package/react/src/hooks/index.d.ts +1 -1
  145. package/react/src/hooks/useContent.d.ts +1 -1
  146. package/react/src/hooks/useData.d.ts +1 -1
  147. package/react/src/hooks/useFeed.d.ts +1 -1
  148. package/react/src/hooks/useLayoutData.d.ts +1 -1
  149. package/react/src/hooks/useLlms.d.ts +1 -1
  150. package/react/src/hooks/useNavigate.d.ts +1 -1
  151. package/react/src/hooks/useParams.d.ts +1 -1
  152. package/react/src/hooks/useRouter.d.ts +1 -1
  153. package/react/src/hooks/useSearch.d.ts +1 -1
  154. package/react/src/hooks/useSearchParams.d.ts +1 -1
  155. package/react/src/hooks/useToc.d.ts +1 -1
  156. package/react/src/index.d.ts +1 -1
  157. package/react/src/lib/collection.d.ts +1 -1
  158. package/react/src/lib/content.d.ts +1 -1
  159. package/react/src/lib/head.d.ts +1 -1
  160. package/react/src/lib/index.d.ts +1 -1
  161. package/react/src/lib/lazy-route.d.ts +1 -1
  162. package/react/src/lib/route-loader.d.ts +1 -1
  163. package/react/src/providers/ContentProvider.d.ts +1 -1
  164. package/react/src/providers/RerouteProvider.d.ts +1 -1
  165. package/react/src/providers/RouterProvider.d.ts +1 -1
  166. package/react/src/providers/index.d.ts +1 -1
  167. package/react/src/types/any.d.ts +1 -1
  168. package/react/src/types/index.d.ts +1 -1
  169. package/react/src/types/router.d.ts +1 -1
  170. package/telemetry/react.d.ts +2 -2
  171. package/telemetry/react.d.ts.map +1 -1
  172. package/telemetry/react.js +164 -183
  173. package/telemetry/react.js.map +7 -6
  174. package/telemetry/{index.d.ts → server.d.ts} +2 -2
  175. package/telemetry/server.d.ts.map +1 -0
  176. package/telemetry/server.js +1134 -0
  177. package/telemetry/server.js.map +44 -0
  178. package/telemetry/src/{browser/react.d.ts → react/api.d.ts} +4 -12
  179. package/telemetry/src/react/api.d.ts.map +1 -0
  180. package/telemetry/{browser.d.ts → src/react/index.d.ts} +4 -3
  181. package/telemetry/src/react/index.d.ts.map +1 -0
  182. package/telemetry/src/{browser/index.d.ts → react/telemetry.d.ts} +13 -13
  183. package/telemetry/src/react/telemetry.d.ts.map +1 -0
  184. package/telemetry/src/server/index.d.ts +3 -101
  185. package/telemetry/src/server/index.d.ts.map +1 -1
  186. package/telemetry/src/server/instrumentation.d.ts +62 -0
  187. package/telemetry/src/server/instrumentation.d.ts.map +1 -0
  188. package/telemetry/src/server/plugin.d.ts +72 -0
  189. package/telemetry/src/server/plugin.d.ts.map +1 -0
  190. package/telemetry/browser.d.ts.map +0 -1
  191. package/telemetry/browser.js +0 -383
  192. package/telemetry/browser.js.map +0 -10
  193. package/telemetry/index.d.ts.map +0 -1
  194. package/telemetry/index.js +0 -525
  195. package/telemetry/index.js.map +0 -10
  196. package/telemetry/src/browser/index.d.ts.map +0 -1
  197. package/telemetry/src/browser/react.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.25.3
2
+ * reroute-js v0.26.0
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2025 stewones <hi@stewan.io>
@@ -7,5 +7,6 @@
7
7
  *
8
8
  * Built with Bun <3
9
9
  */
10
- export * from './src/browser';
11
- //# sourceMappingURL=browser.d.ts.map
10
+ export * from './api';
11
+ export * from './telemetry';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/telemetry/src/react/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.25.3
2
+ * reroute-js v0.26.0
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2025 stewones <hi@stewan.io>
@@ -9,6 +9,11 @@
9
9
  */
10
10
  /** biome-ignore-all lint/suspicious/noExplicitAny: That's fine */
11
11
  export interface BrowserTelemetryOptions {
12
+ /**
13
+ * Enable browser telemetry
14
+ * @default true
15
+ */
16
+ enabled?: boolean;
12
17
  /**
13
18
  * Service name for browser telemetry
14
19
  * @default 'reroute-app-browser'
@@ -29,19 +34,14 @@ export interface BrowserTelemetryOptions {
29
34
  */
30
35
  apiKey?: string;
31
36
  /**
32
- * Whether running in production
33
- * @default import.meta.env.PROD
37
+ * Deployment environment (e.g., 'production', 'staging', 'development')
38
+ * @default 'development'
34
39
  */
35
- isProduction?: boolean;
40
+ environment?: string;
36
41
  /**
37
- * Enable Web Vitals tracking (LCP, CLS, TTFB, INP)
42
+ * Enable console.error capture
38
43
  * @default true
39
44
  */
40
- enableWebVitals?: boolean;
41
- /**
42
- * Enable console.error capture (recommended for production only)
43
- * @default isProduction
44
- */
45
45
  enableConsoleCapture?: boolean;
46
46
  }
47
47
  /**
@@ -50,12 +50,12 @@ export interface BrowserTelemetryOptions {
50
50
  *
51
51
  * @example
52
52
  * ```typescript
53
- * import { initBrowserTelemetry } from 'reroute-js/telemetry/browser';
53
+ * import { initBrowserTelemetry } from 'reroute-js/telemetry/react';
54
54
  *
55
55
  * initBrowserTelemetry({
56
56
  * serviceName: 'My App Browser',
57
57
  * otlpEndpoint: '/api/telemetry', // Same-origin proxy
58
- * isProduction: true,
58
+ * environment: 'production',
59
59
  * });
60
60
  * ```
61
61
  */
@@ -97,4 +97,4 @@ export declare function trackError(error: Error, context?: Record<string, string
97
97
  * Gracefully shutdown telemetry
98
98
  */
99
99
  export declare function shutdownTelemetry(): Promise<void>;
100
- //# sourceMappingURL=index.d.ts.map
100
+ //# sourceMappingURL=telemetry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../../../../../packages/telemetry/src/react/telemetry.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,WAAW,uBAAuB;IACvC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAOD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,GAAE,uBAA4B,iBAgIrC;AA6ND;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACzB,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAM,OAqC1D;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACzB,SAAS,EAAE,MAAM,EACjB,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAM,QAY1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACzB,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAM,QA0CvD;AAED;;GAEG;AACH,wBAAsB,iBAAiB,kBAMtC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.25.3
2
+ * reroute-js v0.26.0
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2025 stewones <hi@stewan.io>
@@ -7,104 +7,6 @@
7
7
  *
8
8
  * Built with Bun <3
9
9
  */
10
- import type { Elysia } from 'elysia';
11
- export interface ServerTelemetryOptions {
12
- /**
13
- * Service name for telemetry
14
- * @default 'reroute-app'
15
- */
16
- serviceName?: string;
17
- /**
18
- * Service version
19
- * @default process.env.npm_package_version || '1.0.0'
20
- */
21
- serviceVersion?: string;
22
- /**
23
- * OTLP endpoint URL
24
- * @default process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318'
25
- */
26
- otlpEndpoint?: string;
27
- /**
28
- * API key for authentication (optional, only needed for SigNoz Cloud)
29
- */
30
- apiKey?: string;
31
- /**
32
- * Whether running in production
33
- * @default process.env.NODE_ENV === 'production'
34
- */
35
- isProduction?: boolean;
36
- /**
37
- * Enable system metrics (CPU, memory, connections)
38
- * @default true
39
- */
40
- enableSystemMetrics?: boolean;
41
- /**
42
- * Metric export interval in milliseconds
43
- * @default 5000
44
- */
45
- metricsInterval?: number;
46
- /**
47
- * Enable browser telemetry proxy
48
- * Creates /api/telemetry/* endpoints to forward browser traces
49
- * This avoids CORS issues and ad blockers
50
- * @default false
51
- */
52
- proxy?: boolean;
53
- /**
54
- * Enable verbose logging for proxy
55
- * @default false
56
- */
57
- proxyVerbose?: boolean;
58
- }
59
- /**
60
- * Server-side telemetry plugin for Elysia
61
- *
62
- * Automatically captures:
63
- * - HTTP requests and responses
64
- * - Errors with full stack traces
65
- * - System metrics (CPU, memory)
66
- * - Request/response sizes
67
- * - Active connections
68
- *
69
- * @example
70
- * ```typescript
71
- * import { Elysia } from 'elysia';
72
- * import { telemetry } from 'reroute-js/telemetry/server';
73
- *
74
- * new Elysia()
75
- * .use(telemetry({
76
- * serviceName: 'My App',
77
- * isProduction: true,
78
- * }))
79
- * .listen(3000);
80
- * ```
81
- */
82
- export declare function telemetry(options?: ServerTelemetryOptions): (app: Elysia) => Elysia<"", {
83
- decorator: {};
84
- store: {};
85
- derive: {};
86
- resolve: {};
87
- }, {
88
- typebox: {};
89
- error: {};
90
- }, {
91
- schema: {};
92
- standaloneSchema: {};
93
- macro: {};
94
- macroFn: {};
95
- parser: {};
96
- response: {};
97
- }, {}, {
98
- derive: {};
99
- resolve: {};
100
- schema: {};
101
- standaloneSchema: {};
102
- response: {};
103
- }, {
104
- derive: {};
105
- resolve: {};
106
- schema: {};
107
- standaloneSchema: {};
108
- response: {};
109
- }>;
10
+ export * from './instrumentation';
11
+ export * from './plugin';
110
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/telemetry/src/server/index.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,MAAM,WAAW,sBAAsB;IACtC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB;AAgCD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,wBAAgB,SAAS,CAAC,OAAO,GAAE,sBAA2B,IA6OrD,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;GAobnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/telemetry/src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * reroute-js v0.26.0
3
+ *
4
+ * @license MIT
5
+ * @copyright 2025 stewones <hi@stewan.io>
6
+ * @see https://github.com/stewones/reroute
7
+ *
8
+ * Built with Bun <3
9
+ */
10
+ /**
11
+ * Telemetry utilities for instrumenting operations
12
+ *
13
+ * This module provides helpers to create spans for custom instrumentation:
14
+ * - API endpoints
15
+ * - Database queries
16
+ * - External service calls
17
+ * - Business logic operations
18
+ */
19
+ import { type Span } from '@opentelemetry/api';
20
+ /**
21
+ * Execute a function within a named span for distributed tracing
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const result = await withSpan('database.query', async (span) => {
26
+ * span.setAttribute('query', 'SELECT * FROM users');
27
+ * return await db.query('SELECT * FROM users');
28
+ * });
29
+ * ```
30
+ */
31
+ export declare function withSpan<T>(name: string, fn: (span: Span) => Promise<T>, attributes?: Record<string, string | number | boolean>): Promise<T>;
32
+ /**
33
+ * Execute a synchronous function within a named span
34
+ */
35
+ export declare function withSpanSync<T>(name: string, fn: (span: Span) => T, attributes?: Record<string, string | number | boolean>): T;
36
+ /**
37
+ * Add attributes to the current active span (if available)
38
+ */
39
+ export declare function setSpanAttributes(attributes: Record<string, string | number | boolean>): void;
40
+ /**
41
+ * Record an event in the current active span
42
+ */
43
+ export declare function addSpanEvent(name: string, attributes?: Record<string, string | number | boolean>): void;
44
+ /**
45
+ * Execute a function within the context of a parent span
46
+ * This ensures child spans created inside the function are properly nested
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const parentSpan = store.telemetrySpan;
51
+ * await withParentSpan(parentSpan, async () => {
52
+ * // Any spans created here will be children of parentSpan
53
+ * await withSpan('child.operation', async () => {...});
54
+ * });
55
+ * ```
56
+ */
57
+ export declare function withParentSpan<T>(parentSpan: Span | undefined | null, fn: () => Promise<T>): Promise<T>;
58
+ /**
59
+ * Execute a synchronous function within the context of a parent span
60
+ */
61
+ export declare function withParentSpanSync<T>(parentSpan: Span | undefined | null, fn: () => T): T;
62
+ //# sourceMappingURL=instrumentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../../../../packages/telemetry/src/server/instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAW,KAAK,IAAI,EAAyB,MAAM,oBAAoB,CAAC;AA8D/E;;;;;;;;;;GAUG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAC/B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACpD,OAAO,CAAC,CAAC,CAAC,CAqBZ;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC7B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,EACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACpD,CAAC,CAqBH;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,QAQrD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC3B,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,QAQtD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACrC,UAAU,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,EACnC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAClB,OAAO,CAAC,CAAC,CAAC,CAQZ;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EACnC,UAAU,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,EACnC,EAAE,EAAE,MAAM,CAAC,GACT,CAAC,CAOH"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * reroute-js v0.26.0
3
+ *
4
+ * @license MIT
5
+ * @copyright 2025 stewones <hi@stewan.io>
6
+ * @see https://github.com/stewones/reroute
7
+ *
8
+ * Built with Bun <3
9
+ */
10
+ import type { Elysia } from 'elysia';
11
+ import { type TelemetryOptions } from 'reroute-js/core';
12
+ /**
13
+ * Server telemetry options
14
+ * Extends TelemetryOptions from config - all options can be set in reroute.config.ts
15
+ * or passed directly here (direct options override config values)
16
+ */
17
+ export interface ServerTelemetryOptions extends TelemetryOptions {
18
+ }
19
+ /**
20
+ * Server-side telemetry plugin for Elysia
21
+ *
22
+ * Automatically captures:
23
+ * - HTTP requests and responses
24
+ * - Errors with full stack traces
25
+ * - System metrics (CPU, memory)
26
+ * - Request/response sizes
27
+ * - Active connections
28
+ *
29
+ * Configuration is loaded from reroute.config.ts automatically.
30
+ * Direct options override config values.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * import { Elysia } from 'elysia';
35
+ * import { telemetry } from 'reroute-js/telemetry/server';
36
+ *
37
+ * new Elysia()
38
+ * .use(telemetry({
39
+ * serviceName: 'My App',
40
+ * }))
41
+ * .listen(3000);
42
+ * ```
43
+ */
44
+ export declare function telemetry(options?: ServerTelemetryOptions): (app: Elysia) => Promise<Elysia<"", {
45
+ decorator: {};
46
+ store: {};
47
+ derive: {};
48
+ resolve: {};
49
+ }, {
50
+ typebox: {};
51
+ error: {};
52
+ }, {
53
+ schema: {};
54
+ standaloneSchema: {};
55
+ macro: {};
56
+ macroFn: {};
57
+ parser: {};
58
+ response: {};
59
+ }, {}, {
60
+ derive: {};
61
+ resolve: {};
62
+ schema: {};
63
+ standaloneSchema: {};
64
+ response: {};
65
+ }, {
66
+ derive: {};
67
+ resolve: {};
68
+ schema: {};
69
+ standaloneSchema: {};
70
+ response: {};
71
+ }>>;
72
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/telemetry/src/server/plugin.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;CAAG;AAoEnE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,sBAA2B,IAE/C,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;IAowBzB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../packages/telemetry/browser.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}