@sentry/cloudflare 11.11.0 → 11.13.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 (628) hide show
  1. package/build/cjs/dev/_virtual/_rolldown/runtime.js +22 -0
  2. package/build/cjs/dev/baseSdk.js +98 -103
  3. package/build/cjs/dev/baseSdk.js.map +1 -1
  4. package/build/cjs/dev/client.js +213 -237
  5. package/build/cjs/dev/client.js.map +1 -1
  6. package/build/cjs/dev/clientCache.js +8 -8
  7. package/build/cjs/dev/clientCache.js.map +1 -1
  8. package/build/cjs/dev/debug-build.js +9 -5
  9. package/build/cjs/dev/debug-build.js.map +1 -1
  10. package/build/cjs/dev/defineCloudflareOptions.js +5 -8
  11. package/build/cjs/dev/defineCloudflareOptions.js.map +1 -1
  12. package/build/cjs/dev/durableobject.js +290 -163
  13. package/build/cjs/dev/durableobject.js.map +1 -1
  14. package/build/cjs/dev/flush.js +104 -77
  15. package/build/cjs/dev/flush.js.map +1 -1
  16. package/build/cjs/dev/index.js +181 -182
  17. package/build/cjs/dev/instrument.js +53 -39
  18. package/build/cjs/dev/instrument.js.map +1 -1
  19. package/build/cjs/dev/instrumentations/agents/index.js +34 -13
  20. package/build/cjs/dev/instrumentations/agents/index.js.map +1 -1
  21. package/build/cjs/dev/instrumentations/agents/instrumentAgentCallableRpc.js +46 -49
  22. package/build/cjs/dev/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -1
  23. package/build/cjs/dev/instrumentations/agents/instrumentAgentRequestConversation.js +23 -16
  24. package/build/cjs/dev/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -1
  25. package/build/cjs/dev/instrumentations/agents/instrumentChatAgentConversation.js +36 -28
  26. package/build/cjs/dev/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -1
  27. package/build/cjs/dev/instrumentations/agents/types.js +103 -58
  28. package/build/cjs/dev/instrumentations/agents/types.js.map +1 -1
  29. package/build/cjs/dev/instrumentations/instrumentDurableObjectHandlers.js +87 -118
  30. package/build/cjs/dev/instrumentations/instrumentDurableObjectHandlers.js.map +1 -1
  31. package/build/cjs/dev/instrumentations/instrumentDurableObjectNamespace.js +46 -44
  32. package/build/cjs/dev/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
  33. package/build/cjs/dev/instrumentations/instrumentDurableObjectStorage.js +70 -71
  34. package/build/cjs/dev/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
  35. package/build/cjs/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js +31 -39
  36. package/build/cjs/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -1
  37. package/build/cjs/dev/instrumentations/instrumentSqlStorage.js +50 -52
  38. package/build/cjs/dev/instrumentations/instrumentSqlStorage.js.map +1 -1
  39. package/build/cjs/dev/instrumentations/instrumentWorkerEntrypoint.js +136 -123
  40. package/build/cjs/dev/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  41. package/build/cjs/dev/instrumentations/worker/instrumentD1.js +131 -146
  42. package/build/cjs/dev/instrumentations/worker/instrumentD1.js.map +1 -1
  43. package/build/cjs/dev/instrumentations/worker/instrumentEmail.js +63 -61
  44. package/build/cjs/dev/instrumentations/worker/instrumentEmail.js.map +1 -1
  45. package/build/cjs/dev/instrumentations/worker/instrumentEnv.js +83 -87
  46. package/build/cjs/dev/instrumentations/worker/instrumentEnv.js.map +1 -1
  47. package/build/cjs/dev/instrumentations/worker/instrumentFetch.js +41 -48
  48. package/build/cjs/dev/instrumentations/worker/instrumentFetch.js.map +1 -1
  49. package/build/cjs/dev/instrumentations/worker/instrumentFetcher.js +25 -21
  50. package/build/cjs/dev/instrumentations/worker/instrumentFetcher.js.map +1 -1
  51. package/build/cjs/dev/instrumentations/worker/instrumentKV.js +54 -67
  52. package/build/cjs/dev/instrumentations/worker/instrumentKV.js.map +1 -1
  53. package/build/cjs/dev/instrumentations/worker/instrumentQueue.js +100 -76
  54. package/build/cjs/dev/instrumentations/worker/instrumentQueue.js.map +1 -1
  55. package/build/cjs/dev/instrumentations/worker/instrumentQueueProducer.js +91 -75
  56. package/build/cjs/dev/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
  57. package/build/cjs/dev/instrumentations/worker/instrumentR2.js +128 -115
  58. package/build/cjs/dev/instrumentations/worker/instrumentR2.js.map +1 -1
  59. package/build/cjs/dev/instrumentations/worker/instrumentScheduled.js +90 -94
  60. package/build/cjs/dev/instrumentations/worker/instrumentScheduled.js.map +1 -1
  61. package/build/cjs/dev/instrumentations/worker/instrumentTail.js +100 -55
  62. package/build/cjs/dev/instrumentations/worker/instrumentTail.js.map +1 -1
  63. package/build/cjs/dev/integrations/cronTriggers.js +130 -85
  64. package/build/cjs/dev/integrations/cronTriggers.js.map +1 -1
  65. package/build/cjs/dev/integrations/fetch.js +9 -9
  66. package/build/cjs/dev/integrations/fetch.js.map +1 -1
  67. package/build/cjs/dev/integrations/httpServer.js +41 -22
  68. package/build/cjs/dev/integrations/httpServer.js.map +1 -1
  69. package/build/cjs/dev/integrations/spotlight.js +52 -55
  70. package/build/cjs/dev/integrations/spotlight.js.map +1 -1
  71. package/build/cjs/dev/opentelemetry/tracer.js +10 -8
  72. package/build/cjs/dev/opentelemetry/tracer.js.map +1 -1
  73. package/build/cjs/dev/options.js +55 -39
  74. package/build/cjs/dev/options.js.map +1 -1
  75. package/build/cjs/dev/orchestrion-deferred-channels.js +45 -29
  76. package/build/cjs/dev/orchestrion-deferred-channels.js.map +1 -1
  77. package/build/cjs/dev/orchestrion-diagnostics-channel.js +97 -72
  78. package/build/cjs/dev/orchestrion-diagnostics-channel.js.map +1 -1
  79. package/build/cjs/dev/pages-plugin.js +20 -21
  80. package/build/cjs/dev/pages-plugin.js.map +1 -1
  81. package/build/cjs/dev/request.js +16 -10
  82. package/build/cjs/dev/request.js.map +1 -1
  83. package/build/cjs/dev/scope-utils.js +12 -12
  84. package/build/cjs/dev/scope-utils.js.map +1 -1
  85. package/build/cjs/dev/sdk.js +24 -15
  86. package/build/cjs/dev/sdk.js.map +1 -1
  87. package/build/cjs/dev/transport.js +93 -86
  88. package/build/cjs/dev/transport.js.map +1 -1
  89. package/build/cjs/dev/utils/asyncContextStrategy.js +10 -10
  90. package/build/cjs/dev/utils/asyncContextStrategy.js.map +1 -1
  91. package/build/cjs/dev/utils/bindingPropagation.js +24 -0
  92. package/build/cjs/dev/utils/bindingPropagation.js.map +1 -0
  93. package/build/cjs/dev/utils/cloudflareTrace.js +34 -0
  94. package/build/cjs/dev/utils/cloudflareTrace.js.map +1 -0
  95. package/build/cjs/dev/utils/instrumentContext.js +74 -58
  96. package/build/cjs/dev/utils/instrumentContext.js.map +1 -1
  97. package/build/cjs/dev/utils/internalSqlQuery.js +38 -21
  98. package/build/cjs/dev/utils/internalSqlQuery.js.map +1 -1
  99. package/build/cjs/dev/utils/internalStorageKey.js +41 -38
  100. package/build/cjs/dev/utils/internalStorageKey.js.map +1 -1
  101. package/build/cjs/dev/utils/invocationContext.js +42 -32
  102. package/build/cjs/dev/utils/invocationContext.js.map +1 -1
  103. package/build/cjs/dev/utils/invocationScope.js +45 -21
  104. package/build/cjs/dev/utils/invocationScope.js.map +1 -1
  105. package/build/cjs/dev/utils/isBinding.js +47 -15
  106. package/build/cjs/dev/utils/isBinding.js.map +1 -1
  107. package/build/cjs/dev/utils/isCloudflareClass.js +11 -20
  108. package/build/cjs/dev/utils/isCloudflareClass.js.map +1 -1
  109. package/build/cjs/dev/utils/queueTraceMeta.js +33 -0
  110. package/build/cjs/dev/utils/queueTraceMeta.js.map +1 -0
  111. package/build/cjs/dev/utils/rpcMeta.js +37 -27
  112. package/build/cjs/dev/utils/rpcMeta.js.map +1 -1
  113. package/build/cjs/dev/utils/traceLinks.js +52 -42
  114. package/build/cjs/dev/utils/traceLinks.js.map +1 -1
  115. package/build/cjs/dev/vendor/stacktrace.js +32 -24
  116. package/build/cjs/dev/vendor/stacktrace.js.map +1 -1
  117. package/build/cjs/dev/vite/agentClass.js +105 -98
  118. package/build/cjs/dev/vite/agentClass.js.map +1 -1
  119. package/build/cjs/dev/vite/autoInstrument.js +121 -122
  120. package/build/cjs/dev/vite/autoInstrument.js.map +1 -1
  121. package/build/cjs/dev/vite/index.js +44 -21
  122. package/build/cjs/dev/vite/index.js.map +1 -1
  123. package/build/cjs/dev/vite/instrumentFile.js +37 -20
  124. package/build/cjs/dev/vite/instrumentFile.js.map +1 -1
  125. package/build/cjs/dev/vite/mastraObservability.js +19 -12
  126. package/build/cjs/dev/vite/mastraObservability.js.map +1 -1
  127. package/build/cjs/dev/vite/moduleShape.js +220 -201
  128. package/build/cjs/dev/vite/moduleShape.js.map +1 -1
  129. package/build/cjs/dev/vite/providedModulePlugin.js +62 -45
  130. package/build/cjs/dev/vite/providedModulePlugin.js.map +1 -1
  131. package/build/cjs/dev/vite/transform.js +333 -284
  132. package/build/cjs/dev/vite/transform.js.map +1 -1
  133. package/build/cjs/dev/vite/workerEntrypoint.js +66 -57
  134. package/build/cjs/dev/vite/workerEntrypoint.js.map +1 -1
  135. package/build/cjs/dev/vite/wranglerConfig.js +92 -67
  136. package/build/cjs/dev/vite/wranglerConfig.js.map +1 -1
  137. package/build/cjs/dev/withSentry.js +32 -26
  138. package/build/cjs/dev/withSentry.js.map +1 -1
  139. package/build/cjs/dev/workflows.js +165 -149
  140. package/build/cjs/dev/workflows.js.map +1 -1
  141. package/build/cjs/dev/wrapMethodWithSentry.js +148 -169
  142. package/build/cjs/dev/wrapMethodWithSentry.js.map +1 -1
  143. package/build/cjs/dev/wrapRequestHandlerWithInit.js +78 -72
  144. package/build/cjs/dev/wrapRequestHandlerWithInit.js.map +1 -1
  145. package/build/cjs/prod/_virtual/_rolldown/runtime.js +22 -0
  146. package/build/cjs/prod/baseSdk.js +94 -93
  147. package/build/cjs/prod/baseSdk.js.map +1 -1
  148. package/build/cjs/prod/client.js +213 -237
  149. package/build/cjs/prod/client.js.map +1 -1
  150. package/build/cjs/prod/clientCache.js +8 -8
  151. package/build/cjs/prod/clientCache.js.map +1 -1
  152. package/build/cjs/prod/debug-build.js +9 -5
  153. package/build/cjs/prod/debug-build.js.map +1 -1
  154. package/build/cjs/prod/defineCloudflareOptions.js +5 -8
  155. package/build/cjs/prod/defineCloudflareOptions.js.map +1 -1
  156. package/build/cjs/prod/durableobject.js +290 -163
  157. package/build/cjs/prod/durableobject.js.map +1 -1
  158. package/build/cjs/prod/flush.js +104 -77
  159. package/build/cjs/prod/flush.js.map +1 -1
  160. package/build/cjs/prod/index.js +181 -182
  161. package/build/cjs/prod/instrument.js +53 -39
  162. package/build/cjs/prod/instrument.js.map +1 -1
  163. package/build/cjs/prod/instrumentations/agents/index.js +34 -13
  164. package/build/cjs/prod/instrumentations/agents/index.js.map +1 -1
  165. package/build/cjs/prod/instrumentations/agents/instrumentAgentCallableRpc.js +46 -49
  166. package/build/cjs/prod/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -1
  167. package/build/cjs/prod/instrumentations/agents/instrumentAgentRequestConversation.js +23 -16
  168. package/build/cjs/prod/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -1
  169. package/build/cjs/prod/instrumentations/agents/instrumentChatAgentConversation.js +36 -28
  170. package/build/cjs/prod/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -1
  171. package/build/cjs/prod/instrumentations/agents/types.js +103 -58
  172. package/build/cjs/prod/instrumentations/agents/types.js.map +1 -1
  173. package/build/cjs/prod/instrumentations/instrumentDurableObjectHandlers.js +87 -118
  174. package/build/cjs/prod/instrumentations/instrumentDurableObjectHandlers.js.map +1 -1
  175. package/build/cjs/prod/instrumentations/instrumentDurableObjectNamespace.js +46 -44
  176. package/build/cjs/prod/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
  177. package/build/cjs/prod/instrumentations/instrumentDurableObjectStorage.js +70 -71
  178. package/build/cjs/prod/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
  179. package/build/cjs/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js +31 -39
  180. package/build/cjs/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -1
  181. package/build/cjs/prod/instrumentations/instrumentSqlStorage.js +50 -52
  182. package/build/cjs/prod/instrumentations/instrumentSqlStorage.js.map +1 -1
  183. package/build/cjs/prod/instrumentations/instrumentWorkerEntrypoint.js +136 -123
  184. package/build/cjs/prod/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  185. package/build/cjs/prod/instrumentations/worker/instrumentD1.js +131 -146
  186. package/build/cjs/prod/instrumentations/worker/instrumentD1.js.map +1 -1
  187. package/build/cjs/prod/instrumentations/worker/instrumentEmail.js +63 -61
  188. package/build/cjs/prod/instrumentations/worker/instrumentEmail.js.map +1 -1
  189. package/build/cjs/prod/instrumentations/worker/instrumentEnv.js +83 -87
  190. package/build/cjs/prod/instrumentations/worker/instrumentEnv.js.map +1 -1
  191. package/build/cjs/prod/instrumentations/worker/instrumentFetch.js +41 -48
  192. package/build/cjs/prod/instrumentations/worker/instrumentFetch.js.map +1 -1
  193. package/build/cjs/prod/instrumentations/worker/instrumentFetcher.js +25 -21
  194. package/build/cjs/prod/instrumentations/worker/instrumentFetcher.js.map +1 -1
  195. package/build/cjs/prod/instrumentations/worker/instrumentKV.js +54 -67
  196. package/build/cjs/prod/instrumentations/worker/instrumentKV.js.map +1 -1
  197. package/build/cjs/prod/instrumentations/worker/instrumentQueue.js +100 -76
  198. package/build/cjs/prod/instrumentations/worker/instrumentQueue.js.map +1 -1
  199. package/build/cjs/prod/instrumentations/worker/instrumentQueueProducer.js +91 -75
  200. package/build/cjs/prod/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
  201. package/build/cjs/prod/instrumentations/worker/instrumentR2.js +128 -115
  202. package/build/cjs/prod/instrumentations/worker/instrumentR2.js.map +1 -1
  203. package/build/cjs/prod/instrumentations/worker/instrumentScheduled.js +90 -94
  204. package/build/cjs/prod/instrumentations/worker/instrumentScheduled.js.map +1 -1
  205. package/build/cjs/prod/instrumentations/worker/instrumentTail.js +100 -55
  206. package/build/cjs/prod/instrumentations/worker/instrumentTail.js.map +1 -1
  207. package/build/cjs/prod/integrations/cronTriggers.js +130 -85
  208. package/build/cjs/prod/integrations/cronTriggers.js.map +1 -1
  209. package/build/cjs/prod/integrations/fetch.js +9 -9
  210. package/build/cjs/prod/integrations/fetch.js.map +1 -1
  211. package/build/cjs/prod/integrations/httpServer.js +41 -22
  212. package/build/cjs/prod/integrations/httpServer.js.map +1 -1
  213. package/build/cjs/prod/integrations/spotlight.js +52 -55
  214. package/build/cjs/prod/integrations/spotlight.js.map +1 -1
  215. package/build/cjs/prod/opentelemetry/tracer.js +10 -8
  216. package/build/cjs/prod/opentelemetry/tracer.js.map +1 -1
  217. package/build/cjs/prod/options.js +37 -24
  218. package/build/cjs/prod/options.js.map +1 -1
  219. package/build/cjs/prod/orchestrion-deferred-channels.js +45 -29
  220. package/build/cjs/prod/orchestrion-deferred-channels.js.map +1 -1
  221. package/build/cjs/prod/orchestrion-diagnostics-channel.js +97 -72
  222. package/build/cjs/prod/orchestrion-diagnostics-channel.js.map +1 -1
  223. package/build/cjs/prod/pages-plugin.js +20 -21
  224. package/build/cjs/prod/pages-plugin.js.map +1 -1
  225. package/build/cjs/prod/request.js +16 -10
  226. package/build/cjs/prod/request.js.map +1 -1
  227. package/build/cjs/prod/scope-utils.js +12 -12
  228. package/build/cjs/prod/scope-utils.js.map +1 -1
  229. package/build/cjs/prod/sdk.js +24 -15
  230. package/build/cjs/prod/sdk.js.map +1 -1
  231. package/build/cjs/prod/transport.js +93 -86
  232. package/build/cjs/prod/transport.js.map +1 -1
  233. package/build/cjs/prod/utils/asyncContextStrategy.js +10 -10
  234. package/build/cjs/prod/utils/asyncContextStrategy.js.map +1 -1
  235. package/build/cjs/prod/utils/bindingPropagation.js +24 -0
  236. package/build/cjs/prod/utils/bindingPropagation.js.map +1 -0
  237. package/build/cjs/prod/utils/cloudflareTrace.js +34 -0
  238. package/build/cjs/prod/utils/cloudflareTrace.js.map +1 -0
  239. package/build/cjs/prod/utils/instrumentContext.js +74 -58
  240. package/build/cjs/prod/utils/instrumentContext.js.map +1 -1
  241. package/build/cjs/prod/utils/internalSqlQuery.js +38 -21
  242. package/build/cjs/prod/utils/internalSqlQuery.js.map +1 -1
  243. package/build/cjs/prod/utils/internalStorageKey.js +41 -38
  244. package/build/cjs/prod/utils/internalStorageKey.js.map +1 -1
  245. package/build/cjs/prod/utils/invocationContext.js +42 -32
  246. package/build/cjs/prod/utils/invocationContext.js.map +1 -1
  247. package/build/cjs/prod/utils/invocationScope.js +45 -21
  248. package/build/cjs/prod/utils/invocationScope.js.map +1 -1
  249. package/build/cjs/prod/utils/isBinding.js +47 -15
  250. package/build/cjs/prod/utils/isBinding.js.map +1 -1
  251. package/build/cjs/prod/utils/isCloudflareClass.js +11 -20
  252. package/build/cjs/prod/utils/isCloudflareClass.js.map +1 -1
  253. package/build/cjs/prod/utils/queueTraceMeta.js +33 -0
  254. package/build/cjs/prod/utils/queueTraceMeta.js.map +1 -0
  255. package/build/cjs/prod/utils/rpcMeta.js +37 -27
  256. package/build/cjs/prod/utils/rpcMeta.js.map +1 -1
  257. package/build/cjs/prod/utils/traceLinks.js +52 -42
  258. package/build/cjs/prod/utils/traceLinks.js.map +1 -1
  259. package/build/cjs/prod/vendor/stacktrace.js +32 -24
  260. package/build/cjs/prod/vendor/stacktrace.js.map +1 -1
  261. package/build/cjs/prod/vite/agentClass.js +105 -98
  262. package/build/cjs/prod/vite/agentClass.js.map +1 -1
  263. package/build/cjs/prod/vite/autoInstrument.js +121 -122
  264. package/build/cjs/prod/vite/autoInstrument.js.map +1 -1
  265. package/build/cjs/prod/vite/index.js +44 -21
  266. package/build/cjs/prod/vite/index.js.map +1 -1
  267. package/build/cjs/prod/vite/instrumentFile.js +37 -20
  268. package/build/cjs/prod/vite/instrumentFile.js.map +1 -1
  269. package/build/cjs/prod/vite/mastraObservability.js +19 -12
  270. package/build/cjs/prod/vite/mastraObservability.js.map +1 -1
  271. package/build/cjs/prod/vite/moduleShape.js +220 -201
  272. package/build/cjs/prod/vite/moduleShape.js.map +1 -1
  273. package/build/cjs/prod/vite/providedModulePlugin.js +62 -45
  274. package/build/cjs/prod/vite/providedModulePlugin.js.map +1 -1
  275. package/build/cjs/prod/vite/transform.js +333 -284
  276. package/build/cjs/prod/vite/transform.js.map +1 -1
  277. package/build/cjs/prod/vite/workerEntrypoint.js +66 -57
  278. package/build/cjs/prod/vite/workerEntrypoint.js.map +1 -1
  279. package/build/cjs/prod/vite/wranglerConfig.js +92 -67
  280. package/build/cjs/prod/vite/wranglerConfig.js.map +1 -1
  281. package/build/cjs/prod/withSentry.js +32 -26
  282. package/build/cjs/prod/withSentry.js.map +1 -1
  283. package/build/cjs/prod/workflows.js +165 -149
  284. package/build/cjs/prod/workflows.js.map +1 -1
  285. package/build/cjs/prod/wrapMethodWithSentry.js +148 -169
  286. package/build/cjs/prod/wrapMethodWithSentry.js.map +1 -1
  287. package/build/cjs/prod/wrapRequestHandlerWithInit.js +78 -72
  288. package/build/cjs/prod/wrapRequestHandlerWithInit.js.map +1 -1
  289. package/build/esm/dev/baseSdk.js +98 -101
  290. package/build/esm/dev/baseSdk.js.map +1 -1
  291. package/build/esm/dev/client.js +213 -235
  292. package/build/esm/dev/client.js.map +1 -1
  293. package/build/esm/dev/clientCache.js +8 -6
  294. package/build/esm/dev/clientCache.js.map +1 -1
  295. package/build/esm/dev/debug-build.js +9 -3
  296. package/build/esm/dev/debug-build.js.map +1 -1
  297. package/build/esm/dev/defineCloudflareOptions.js +5 -6
  298. package/build/esm/dev/defineCloudflareOptions.js.map +1 -1
  299. package/build/esm/dev/durableobject.js +290 -161
  300. package/build/esm/dev/durableobject.js.map +1 -1
  301. package/build/esm/dev/flush.js +104 -75
  302. package/build/esm/dev/flush.js.map +1 -1
  303. package/build/esm/dev/index.js +19 -18
  304. package/build/esm/dev/instrument.js +53 -37
  305. package/build/esm/dev/instrument.js.map +1 -1
  306. package/build/esm/dev/instrumentations/agents/index.js +34 -11
  307. package/build/esm/dev/instrumentations/agents/index.js.map +1 -1
  308. package/build/esm/dev/instrumentations/agents/instrumentAgentCallableRpc.js +46 -47
  309. package/build/esm/dev/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -1
  310. package/build/esm/dev/instrumentations/agents/instrumentAgentRequestConversation.js +23 -14
  311. package/build/esm/dev/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -1
  312. package/build/esm/dev/instrumentations/agents/instrumentChatAgentConversation.js +36 -26
  313. package/build/esm/dev/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -1
  314. package/build/esm/dev/instrumentations/agents/types.js +103 -56
  315. package/build/esm/dev/instrumentations/agents/types.js.map +1 -1
  316. package/build/esm/dev/instrumentations/instrumentDurableObjectHandlers.js +87 -116
  317. package/build/esm/dev/instrumentations/instrumentDurableObjectHandlers.js.map +1 -1
  318. package/build/esm/dev/instrumentations/instrumentDurableObjectNamespace.js +46 -42
  319. package/build/esm/dev/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
  320. package/build/esm/dev/instrumentations/instrumentDurableObjectStorage.js +70 -69
  321. package/build/esm/dev/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
  322. package/build/esm/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js +31 -37
  323. package/build/esm/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -1
  324. package/build/esm/dev/instrumentations/instrumentSqlStorage.js +50 -50
  325. package/build/esm/dev/instrumentations/instrumentSqlStorage.js.map +1 -1
  326. package/build/esm/dev/instrumentations/instrumentWorkerEntrypoint.js +136 -121
  327. package/build/esm/dev/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  328. package/build/esm/dev/instrumentations/worker/instrumentD1.js +131 -144
  329. package/build/esm/dev/instrumentations/worker/instrumentD1.js.map +1 -1
  330. package/build/esm/dev/instrumentations/worker/instrumentEmail.js +63 -59
  331. package/build/esm/dev/instrumentations/worker/instrumentEmail.js.map +1 -1
  332. package/build/esm/dev/instrumentations/worker/instrumentEnv.js +83 -85
  333. package/build/esm/dev/instrumentations/worker/instrumentEnv.js.map +1 -1
  334. package/build/esm/dev/instrumentations/worker/instrumentFetch.js +41 -46
  335. package/build/esm/dev/instrumentations/worker/instrumentFetch.js.map +1 -1
  336. package/build/esm/dev/instrumentations/worker/instrumentFetcher.js +25 -19
  337. package/build/esm/dev/instrumentations/worker/instrumentFetcher.js.map +1 -1
  338. package/build/esm/dev/instrumentations/worker/instrumentKV.js +54 -65
  339. package/build/esm/dev/instrumentations/worker/instrumentKV.js.map +1 -1
  340. package/build/esm/dev/instrumentations/worker/instrumentQueue.js +100 -74
  341. package/build/esm/dev/instrumentations/worker/instrumentQueue.js.map +1 -1
  342. package/build/esm/dev/instrumentations/worker/instrumentQueueProducer.js +91 -73
  343. package/build/esm/dev/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
  344. package/build/esm/dev/instrumentations/worker/instrumentR2.js +128 -113
  345. package/build/esm/dev/instrumentations/worker/instrumentR2.js.map +1 -1
  346. package/build/esm/dev/instrumentations/worker/instrumentScheduled.js +90 -92
  347. package/build/esm/dev/instrumentations/worker/instrumentScheduled.js.map +1 -1
  348. package/build/esm/dev/instrumentations/worker/instrumentTail.js +100 -53
  349. package/build/esm/dev/instrumentations/worker/instrumentTail.js.map +1 -1
  350. package/build/esm/dev/integrations/cronTriggers.js +129 -82
  351. package/build/esm/dev/integrations/cronTriggers.js.map +1 -1
  352. package/build/esm/dev/integrations/fetch.js +9 -6
  353. package/build/esm/dev/integrations/fetch.js.map +1 -1
  354. package/build/esm/dev/integrations/httpServer.js +40 -19
  355. package/build/esm/dev/integrations/httpServer.js.map +1 -1
  356. package/build/esm/dev/integrations/spotlight.js +51 -52
  357. package/build/esm/dev/integrations/spotlight.js.map +1 -1
  358. package/build/esm/dev/opentelemetry/tracer.js +10 -6
  359. package/build/esm/dev/opentelemetry/tracer.js.map +1 -1
  360. package/build/esm/dev/options.js +55 -37
  361. package/build/esm/dev/options.js.map +1 -1
  362. package/build/esm/dev/orchestrion-deferred-channels.js +45 -27
  363. package/build/esm/dev/orchestrion-deferred-channels.js.map +1 -1
  364. package/build/esm/dev/orchestrion-diagnostics-channel.js +87 -66
  365. package/build/esm/dev/orchestrion-diagnostics-channel.js.map +1 -1
  366. package/build/esm/dev/package.json +1 -1
  367. package/build/esm/dev/pages-plugin.js +20 -19
  368. package/build/esm/dev/pages-plugin.js.map +1 -1
  369. package/build/esm/dev/request.js +14 -7
  370. package/build/esm/dev/request.js.map +1 -1
  371. package/build/esm/dev/scope-utils.js +12 -10
  372. package/build/esm/dev/scope-utils.js.map +1 -1
  373. package/build/esm/dev/sdk.js +23 -13
  374. package/build/esm/dev/sdk.js.map +1 -1
  375. package/build/esm/dev/transport.js +93 -84
  376. package/build/esm/dev/transport.js.map +1 -1
  377. package/build/esm/dev/utils/asyncContextStrategy.js +10 -8
  378. package/build/esm/dev/utils/asyncContextStrategy.js.map +1 -1
  379. package/build/esm/dev/utils/bindingPropagation.js +23 -0
  380. package/build/esm/dev/utils/bindingPropagation.js.map +1 -0
  381. package/build/esm/dev/utils/cloudflareTrace.js +34 -0
  382. package/build/esm/dev/utils/cloudflareTrace.js.map +1 -0
  383. package/build/esm/dev/utils/instrumentContext.js +74 -56
  384. package/build/esm/dev/utils/instrumentContext.js.map +1 -1
  385. package/build/esm/dev/utils/internalSqlQuery.js +38 -19
  386. package/build/esm/dev/utils/internalSqlQuery.js.map +1 -1
  387. package/build/esm/dev/utils/internalStorageKey.js +41 -36
  388. package/build/esm/dev/utils/internalStorageKey.js.map +1 -1
  389. package/build/esm/dev/utils/invocationContext.js +42 -30
  390. package/build/esm/dev/utils/invocationContext.js.map +1 -1
  391. package/build/esm/dev/utils/invocationScope.js +45 -19
  392. package/build/esm/dev/utils/invocationScope.js.map +1 -1
  393. package/build/esm/dev/utils/isBinding.js +47 -13
  394. package/build/esm/dev/utils/isBinding.js.map +1 -1
  395. package/build/esm/dev/utils/isCloudflareClass.js +11 -18
  396. package/build/esm/dev/utils/isCloudflareClass.js.map +1 -1
  397. package/build/esm/dev/utils/queueTraceMeta.js +32 -0
  398. package/build/esm/dev/utils/queueTraceMeta.js.map +1 -0
  399. package/build/esm/dev/utils/rpcMeta.js +37 -25
  400. package/build/esm/dev/utils/rpcMeta.js.map +1 -1
  401. package/build/esm/dev/utils/traceLinks.js +52 -40
  402. package/build/esm/dev/utils/traceLinks.js.map +1 -1
  403. package/build/esm/dev/vendor/stacktrace.js +31 -21
  404. package/build/esm/dev/vendor/stacktrace.js.map +1 -1
  405. package/build/esm/dev/vite/agentClass.js +105 -96
  406. package/build/esm/dev/vite/agentClass.js.map +1 -1
  407. package/build/esm/dev/vite/autoInstrument.js +121 -120
  408. package/build/esm/dev/vite/autoInstrument.js.map +1 -1
  409. package/build/esm/dev/vite/index.js +43 -19
  410. package/build/esm/dev/vite/index.js.map +1 -1
  411. package/build/esm/dev/vite/instrumentFile.js +37 -18
  412. package/build/esm/dev/vite/instrumentFile.js.map +1 -1
  413. package/build/esm/dev/vite/mastraObservability.js +19 -10
  414. package/build/esm/dev/vite/mastraObservability.js.map +1 -1
  415. package/build/esm/dev/vite/moduleShape.js +220 -199
  416. package/build/esm/dev/vite/moduleShape.js.map +1 -1
  417. package/build/esm/dev/vite/providedModulePlugin.js +60 -43
  418. package/build/esm/dev/vite/providedModulePlugin.js.map +1 -1
  419. package/build/esm/dev/vite/transform.js +331 -282
  420. package/build/esm/dev/vite/transform.js.map +1 -1
  421. package/build/esm/dev/vite/workerEntrypoint.js +66 -55
  422. package/build/esm/dev/vite/workerEntrypoint.js.map +1 -1
  423. package/build/esm/dev/vite/wranglerConfig.js +92 -65
  424. package/build/esm/dev/vite/wranglerConfig.js.map +1 -1
  425. package/build/esm/dev/withSentry.js +32 -24
  426. package/build/esm/dev/withSentry.js.map +1 -1
  427. package/build/esm/dev/workflows.js +165 -147
  428. package/build/esm/dev/workflows.js.map +1 -1
  429. package/build/esm/dev/wrapMethodWithSentry.js +148 -167
  430. package/build/esm/dev/wrapMethodWithSentry.js.map +1 -1
  431. package/build/esm/dev/wrapRequestHandlerWithInit.js +78 -70
  432. package/build/esm/dev/wrapRequestHandlerWithInit.js.map +1 -1
  433. package/build/esm/prod/baseSdk.js +94 -91
  434. package/build/esm/prod/baseSdk.js.map +1 -1
  435. package/build/esm/prod/client.js +213 -235
  436. package/build/esm/prod/client.js.map +1 -1
  437. package/build/esm/prod/clientCache.js +8 -6
  438. package/build/esm/prod/clientCache.js.map +1 -1
  439. package/build/esm/prod/debug-build.js +9 -3
  440. package/build/esm/prod/debug-build.js.map +1 -1
  441. package/build/esm/prod/defineCloudflareOptions.js +5 -6
  442. package/build/esm/prod/defineCloudflareOptions.js.map +1 -1
  443. package/build/esm/prod/durableobject.js +290 -161
  444. package/build/esm/prod/durableobject.js.map +1 -1
  445. package/build/esm/prod/flush.js +104 -75
  446. package/build/esm/prod/flush.js.map +1 -1
  447. package/build/esm/prod/index.js +19 -18
  448. package/build/esm/prod/instrument.js +53 -37
  449. package/build/esm/prod/instrument.js.map +1 -1
  450. package/build/esm/prod/instrumentations/agents/index.js +34 -11
  451. package/build/esm/prod/instrumentations/agents/index.js.map +1 -1
  452. package/build/esm/prod/instrumentations/agents/instrumentAgentCallableRpc.js +46 -47
  453. package/build/esm/prod/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -1
  454. package/build/esm/prod/instrumentations/agents/instrumentAgentRequestConversation.js +23 -14
  455. package/build/esm/prod/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -1
  456. package/build/esm/prod/instrumentations/agents/instrumentChatAgentConversation.js +36 -26
  457. package/build/esm/prod/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -1
  458. package/build/esm/prod/instrumentations/agents/types.js +103 -56
  459. package/build/esm/prod/instrumentations/agents/types.js.map +1 -1
  460. package/build/esm/prod/instrumentations/instrumentDurableObjectHandlers.js +87 -116
  461. package/build/esm/prod/instrumentations/instrumentDurableObjectHandlers.js.map +1 -1
  462. package/build/esm/prod/instrumentations/instrumentDurableObjectNamespace.js +46 -42
  463. package/build/esm/prod/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
  464. package/build/esm/prod/instrumentations/instrumentDurableObjectStorage.js +70 -69
  465. package/build/esm/prod/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
  466. package/build/esm/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js +31 -37
  467. package/build/esm/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -1
  468. package/build/esm/prod/instrumentations/instrumentSqlStorage.js +50 -50
  469. package/build/esm/prod/instrumentations/instrumentSqlStorage.js.map +1 -1
  470. package/build/esm/prod/instrumentations/instrumentWorkerEntrypoint.js +136 -121
  471. package/build/esm/prod/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  472. package/build/esm/prod/instrumentations/worker/instrumentD1.js +131 -144
  473. package/build/esm/prod/instrumentations/worker/instrumentD1.js.map +1 -1
  474. package/build/esm/prod/instrumentations/worker/instrumentEmail.js +63 -59
  475. package/build/esm/prod/instrumentations/worker/instrumentEmail.js.map +1 -1
  476. package/build/esm/prod/instrumentations/worker/instrumentEnv.js +83 -85
  477. package/build/esm/prod/instrumentations/worker/instrumentEnv.js.map +1 -1
  478. package/build/esm/prod/instrumentations/worker/instrumentFetch.js +41 -46
  479. package/build/esm/prod/instrumentations/worker/instrumentFetch.js.map +1 -1
  480. package/build/esm/prod/instrumentations/worker/instrumentFetcher.js +25 -19
  481. package/build/esm/prod/instrumentations/worker/instrumentFetcher.js.map +1 -1
  482. package/build/esm/prod/instrumentations/worker/instrumentKV.js +54 -65
  483. package/build/esm/prod/instrumentations/worker/instrumentKV.js.map +1 -1
  484. package/build/esm/prod/instrumentations/worker/instrumentQueue.js +100 -74
  485. package/build/esm/prod/instrumentations/worker/instrumentQueue.js.map +1 -1
  486. package/build/esm/prod/instrumentations/worker/instrumentQueueProducer.js +91 -73
  487. package/build/esm/prod/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
  488. package/build/esm/prod/instrumentations/worker/instrumentR2.js +128 -113
  489. package/build/esm/prod/instrumentations/worker/instrumentR2.js.map +1 -1
  490. package/build/esm/prod/instrumentations/worker/instrumentScheduled.js +90 -92
  491. package/build/esm/prod/instrumentations/worker/instrumentScheduled.js.map +1 -1
  492. package/build/esm/prod/instrumentations/worker/instrumentTail.js +100 -53
  493. package/build/esm/prod/instrumentations/worker/instrumentTail.js.map +1 -1
  494. package/build/esm/prod/integrations/cronTriggers.js +129 -82
  495. package/build/esm/prod/integrations/cronTriggers.js.map +1 -1
  496. package/build/esm/prod/integrations/fetch.js +9 -6
  497. package/build/esm/prod/integrations/fetch.js.map +1 -1
  498. package/build/esm/prod/integrations/httpServer.js +40 -19
  499. package/build/esm/prod/integrations/httpServer.js.map +1 -1
  500. package/build/esm/prod/integrations/spotlight.js +51 -52
  501. package/build/esm/prod/integrations/spotlight.js.map +1 -1
  502. package/build/esm/prod/opentelemetry/tracer.js +10 -6
  503. package/build/esm/prod/opentelemetry/tracer.js.map +1 -1
  504. package/build/esm/prod/options.js +37 -22
  505. package/build/esm/prod/options.js.map +1 -1
  506. package/build/esm/prod/orchestrion-deferred-channels.js +45 -27
  507. package/build/esm/prod/orchestrion-deferred-channels.js.map +1 -1
  508. package/build/esm/prod/orchestrion-diagnostics-channel.js +87 -66
  509. package/build/esm/prod/orchestrion-diagnostics-channel.js.map +1 -1
  510. package/build/esm/prod/package.json +1 -1
  511. package/build/esm/prod/pages-plugin.js +20 -19
  512. package/build/esm/prod/pages-plugin.js.map +1 -1
  513. package/build/esm/prod/request.js +14 -7
  514. package/build/esm/prod/request.js.map +1 -1
  515. package/build/esm/prod/scope-utils.js +12 -10
  516. package/build/esm/prod/scope-utils.js.map +1 -1
  517. package/build/esm/prod/sdk.js +23 -13
  518. package/build/esm/prod/sdk.js.map +1 -1
  519. package/build/esm/prod/transport.js +93 -84
  520. package/build/esm/prod/transport.js.map +1 -1
  521. package/build/esm/prod/utils/asyncContextStrategy.js +10 -8
  522. package/build/esm/prod/utils/asyncContextStrategy.js.map +1 -1
  523. package/build/esm/prod/utils/bindingPropagation.js +23 -0
  524. package/build/esm/prod/utils/bindingPropagation.js.map +1 -0
  525. package/build/esm/prod/utils/cloudflareTrace.js +34 -0
  526. package/build/esm/prod/utils/cloudflareTrace.js.map +1 -0
  527. package/build/esm/prod/utils/instrumentContext.js +74 -56
  528. package/build/esm/prod/utils/instrumentContext.js.map +1 -1
  529. package/build/esm/prod/utils/internalSqlQuery.js +38 -19
  530. package/build/esm/prod/utils/internalSqlQuery.js.map +1 -1
  531. package/build/esm/prod/utils/internalStorageKey.js +41 -36
  532. package/build/esm/prod/utils/internalStorageKey.js.map +1 -1
  533. package/build/esm/prod/utils/invocationContext.js +42 -30
  534. package/build/esm/prod/utils/invocationContext.js.map +1 -1
  535. package/build/esm/prod/utils/invocationScope.js +45 -19
  536. package/build/esm/prod/utils/invocationScope.js.map +1 -1
  537. package/build/esm/prod/utils/isBinding.js +47 -13
  538. package/build/esm/prod/utils/isBinding.js.map +1 -1
  539. package/build/esm/prod/utils/isCloudflareClass.js +11 -18
  540. package/build/esm/prod/utils/isCloudflareClass.js.map +1 -1
  541. package/build/esm/prod/utils/queueTraceMeta.js +32 -0
  542. package/build/esm/prod/utils/queueTraceMeta.js.map +1 -0
  543. package/build/esm/prod/utils/rpcMeta.js +37 -25
  544. package/build/esm/prod/utils/rpcMeta.js.map +1 -1
  545. package/build/esm/prod/utils/traceLinks.js +52 -40
  546. package/build/esm/prod/utils/traceLinks.js.map +1 -1
  547. package/build/esm/prod/vendor/stacktrace.js +31 -21
  548. package/build/esm/prod/vendor/stacktrace.js.map +1 -1
  549. package/build/esm/prod/vite/agentClass.js +105 -96
  550. package/build/esm/prod/vite/agentClass.js.map +1 -1
  551. package/build/esm/prod/vite/autoInstrument.js +121 -120
  552. package/build/esm/prod/vite/autoInstrument.js.map +1 -1
  553. package/build/esm/prod/vite/index.js +43 -19
  554. package/build/esm/prod/vite/index.js.map +1 -1
  555. package/build/esm/prod/vite/instrumentFile.js +37 -18
  556. package/build/esm/prod/vite/instrumentFile.js.map +1 -1
  557. package/build/esm/prod/vite/mastraObservability.js +19 -10
  558. package/build/esm/prod/vite/mastraObservability.js.map +1 -1
  559. package/build/esm/prod/vite/moduleShape.js +220 -199
  560. package/build/esm/prod/vite/moduleShape.js.map +1 -1
  561. package/build/esm/prod/vite/providedModulePlugin.js +60 -43
  562. package/build/esm/prod/vite/providedModulePlugin.js.map +1 -1
  563. package/build/esm/prod/vite/transform.js +331 -282
  564. package/build/esm/prod/vite/transform.js.map +1 -1
  565. package/build/esm/prod/vite/workerEntrypoint.js +66 -55
  566. package/build/esm/prod/vite/workerEntrypoint.js.map +1 -1
  567. package/build/esm/prod/vite/wranglerConfig.js +92 -65
  568. package/build/esm/prod/vite/wranglerConfig.js.map +1 -1
  569. package/build/esm/prod/withSentry.js +32 -24
  570. package/build/esm/prod/withSentry.js.map +1 -1
  571. package/build/esm/prod/workflows.js +165 -147
  572. package/build/esm/prod/workflows.js.map +1 -1
  573. package/build/esm/prod/wrapMethodWithSentry.js +148 -167
  574. package/build/esm/prod/wrapMethodWithSentry.js.map +1 -1
  575. package/build/esm/prod/wrapRequestHandlerWithInit.js +78 -70
  576. package/build/esm/prod/wrapRequestHandlerWithInit.js.map +1 -1
  577. package/build/types/client.d.ts +32 -1
  578. package/build/types/client.d.ts.map +1 -1
  579. package/build/types/durableobject.d.ts.map +1 -1
  580. package/build/types/index.d.ts +3 -2
  581. package/build/types/index.d.ts.map +1 -1
  582. package/build/types/instrumentations/worker/instrumentEmail.d.ts.map +1 -1
  583. package/build/types/instrumentations/worker/instrumentEnv.d.ts +1 -1
  584. package/build/types/instrumentations/worker/instrumentEnv.d.ts.map +1 -1
  585. package/build/types/instrumentations/worker/instrumentFetcher.d.ts.map +1 -1
  586. package/build/types/instrumentations/worker/instrumentQueue.d.ts.map +1 -1
  587. package/build/types/instrumentations/worker/instrumentQueueProducer.d.ts +1 -1
  588. package/build/types/instrumentations/worker/instrumentQueueProducer.d.ts.map +1 -1
  589. package/build/types/instrumentations/worker/instrumentScheduled.d.ts.map +1 -1
  590. package/build/types/instrumentations/worker/instrumentTail.d.ts +4 -2
  591. package/build/types/instrumentations/worker/instrumentTail.d.ts.map +1 -1
  592. package/build/types/utils/{rpcPropagation.d.ts → bindingPropagation.d.ts} +6 -1
  593. package/build/types/utils/bindingPropagation.d.ts.map +1 -0
  594. package/build/types/utils/cloudflareTrace.d.ts +13 -0
  595. package/build/types/utils/cloudflareTrace.d.ts.map +1 -0
  596. package/build/types/utils/queueTraceMeta.d.ts +7 -0
  597. package/build/types/utils/queueTraceMeta.d.ts.map +1 -0
  598. package/build/types/vite/autoInstrument.d.ts.map +1 -1
  599. package/build/types/vite/index.d.ts.map +1 -1
  600. package/build/types/vite/providedModulePlugin.d.ts +15 -11
  601. package/build/types/vite/providedModulePlugin.d.ts.map +1 -1
  602. package/build/types/workflows.d.ts.map +1 -1
  603. package/build/types/wrapMethodWithSentry.d.ts.map +1 -1
  604. package/build/types/wrapRequestHandlerWithInit.d.ts.map +1 -1
  605. package/package.json +20 -21
  606. package/build/cjs/dev/index.js.map +0 -1
  607. package/build/cjs/dev/utils/rpcPropagation.js +0 -15
  608. package/build/cjs/dev/utils/rpcPropagation.js.map +0 -1
  609. package/build/cjs/dev/vite/flueRuntime.js +0 -15
  610. package/build/cjs/dev/vite/flueRuntime.js.map +0 -1
  611. package/build/cjs/prod/index.js.map +0 -1
  612. package/build/cjs/prod/utils/rpcPropagation.js +0 -15
  613. package/build/cjs/prod/utils/rpcPropagation.js.map +0 -1
  614. package/build/cjs/prod/vite/flueRuntime.js +0 -15
  615. package/build/cjs/prod/vite/flueRuntime.js.map +0 -1
  616. package/build/esm/dev/index.js.map +0 -1
  617. package/build/esm/dev/utils/rpcPropagation.js +0 -13
  618. package/build/esm/dev/utils/rpcPropagation.js.map +0 -1
  619. package/build/esm/dev/vite/flueRuntime.js +0 -13
  620. package/build/esm/dev/vite/flueRuntime.js.map +0 -1
  621. package/build/esm/prod/index.js.map +0 -1
  622. package/build/esm/prod/utils/rpcPropagation.js +0 -13
  623. package/build/esm/prod/utils/rpcPropagation.js.map +0 -1
  624. package/build/esm/prod/vite/flueRuntime.js +0 -13
  625. package/build/esm/prod/vite/flueRuntime.js.map +0 -1
  626. package/build/types/utils/rpcPropagation.d.ts.map +0 -1
  627. package/build/types/vite/flueRuntime.d.ts +0 -12
  628. package/build/types/vite/flueRuntime.d.ts.map +0 -1
@@ -1,115 +1,122 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const node_fs = require('node:fs');
4
- const moduleShape = require('./moduleShape.js');
5
-
1
+ const require_moduleShape = require("./moduleShape.js");
2
+ let node_fs = require("node:fs");
3
+ // src/vite/agentClass.ts
4
+ /**
5
+ * Agent base classes, keyed by the module specifier they are imported from. A class extending any
6
+ * of these — directly or through a chain of local/imported subclasses — is an `agents` Agent rather
7
+ * than a plain Durable Object.
8
+ *
9
+ * `McpAgent`, `AIChatAgent` and `Think` all extend `Agent` themselves, but they live in packages
10
+ * whose sources we never walk into (see {@link followImport}), so each needs its own entry.
11
+ */
6
12
  const AGENT_BASE_CLASSES = {
7
- agents: /* @__PURE__ */ new Set(["Agent"]),
8
- "agents/mcp": /* @__PURE__ */ new Set(["McpAgent"]),
9
- "@cloudflare/ai-chat": /* @__PURE__ */ new Set(["AIChatAgent"]),
10
- "@cloudflare/think": /* @__PURE__ */ new Set(["Think"])
13
+ agents: /* @__PURE__ */ new Set(["Agent"]),
14
+ "agents/mcp": /* @__PURE__ */ new Set(["McpAgent"]),
15
+ "@cloudflare/ai-chat": /* @__PURE__ */ new Set(["AIChatAgent"]),
16
+ "@cloudflare/think": /* @__PURE__ */ new Set(["Think"])
11
17
  };
18
+ /**
19
+ * How many modules deep the base-class chain is followed. Guards against pathological module graphs;
20
+ * real Agent hierarchies are only a few levels deep.
21
+ */
12
22
  const MAX_DEPTH = 8;
23
+ /**
24
+ * Find which of `candidates` (top-level class names in the entry module) are Cloudflare
25
+ * [`agents`](https://www.npmjs.com/package/agents) Agents.
26
+ *
27
+ * An Agent is a Durable Object under the hood, so wrangler configures it as one and the transform
28
+ * would otherwise reach for `instrumentDurableObjectWithSentry`. Detecting the Agent base chain lets
29
+ * it pick `instrumentAgentWithSentry` instead, which adds the Agent-specific telemetry on top.
30
+ *
31
+ * Unlike `WorkerEntrypoint` detection, the chain is followed *across* modules: base classes commonly
32
+ * live in their own file (`import { MyBase } from './base'`), and there is no runtime fallback that
33
+ * would catch a missed one. Resolution stops at package boundaries — a base class imported from
34
+ * `node_modules` is only recognized when it is one of {@link AGENT_BASE_CLASSES}.
35
+ */
13
36
  async function detectAgentClasses(ast, entryId, candidates, resolver) {
14
- const ctx = { resolver, modules: /* @__PURE__ */ new Map([[entryId, moduleShape.shapeFromAst(ast)]]) };
15
- const detected = /* @__PURE__ */ new Set();
16
- for (const name of candidates) {
17
- if (await isAgentBinding(ctx, entryId, name, 0, /* @__PURE__ */ new Set())) {
18
- detected.add(name);
19
- }
20
- }
21
- return detected;
37
+ const ctx = {
38
+ resolver,
39
+ modules: /* @__PURE__ */ new Map([[entryId, require_moduleShape.shapeFromAst(ast)]])
40
+ };
41
+ const detected = /* @__PURE__ */ new Set();
42
+ for (const name of candidates) if (await isAgentBinding(ctx, entryId, name, 0, /* @__PURE__ */ new Set())) detected.add(name);
43
+ return detected;
22
44
  }
45
+ /**
46
+ * The entry-module binding names a configured class name could refer to — a class declared under
47
+ * that name, an import of it from another module, a `export { X } from './x'` re-export, or the
48
+ * local binding an `export { Local as Configured }` specifier aliases.
49
+ *
50
+ * Keeps detection (which reads and scans other modules) off names no binding points at.
51
+ */
23
52
  function collectAgentCandidates(ast, configuredNames) {
24
- const shape = moduleShape.shapeFromAst(ast);
25
- const candidates = /* @__PURE__ */ new Set();
26
- const isResolvable = (name) => shape.classes.has(name) || shape.imports.has(name) || shape.reexports.has(name);
27
- for (const configured of configuredNames) {
28
- if (isResolvable(configured)) {
29
- candidates.add(configured);
30
- }
31
- const local = shape.localExports.get(configured);
32
- if (local && isResolvable(local)) {
33
- candidates.add(local);
34
- }
35
- }
36
- return candidates;
53
+ const shape = require_moduleShape.shapeFromAst(ast);
54
+ const candidates = /* @__PURE__ */ new Set();
55
+ const isResolvable = (name) => shape.classes.has(name) || shape.imports.has(name) || shape.reexports.has(name);
56
+ for (const configured of configuredNames) {
57
+ if (isResolvable(configured)) candidates.add(configured);
58
+ const local = shape.localExports.get(configured);
59
+ if (local && isResolvable(local)) candidates.add(local);
60
+ }
61
+ return candidates;
37
62
  }
38
63
  async function isAgentBinding(ctx, moduleId, name, depth, visited) {
39
- if (depth > MAX_DEPTH) return false;
40
- const key = `${moduleId} ${name}`;
41
- if (visited.has(key)) return false;
42
- visited.add(key);
43
- const shape = await getModuleShape(ctx, moduleId);
44
- if (!shape) return false;
45
- if (shape.classes.has(name)) {
46
- return extendsAgent(ctx, shape, moduleId, shape.classes.get(name), depth, visited);
47
- }
48
- const imported = shape.imports.get(name);
49
- if (imported) {
50
- return followImport(ctx, moduleId, imported.source, imported.imported, depth, visited);
51
- }
52
- if (name === moduleShape.DEFAULT_EXPORT) {
53
- if (shape.defaultExportIsClass) {
54
- return extendsAgent(ctx, shape, moduleId, shape.defaultExportSuper, depth, visited);
55
- }
56
- if (shape.defaultExportName) {
57
- return isAgentBinding(ctx, moduleId, shape.defaultExportName, depth + 1, visited);
58
- }
59
- }
60
- const localName = shape.localExports.get(name);
61
- if (localName) {
62
- return isAgentBinding(ctx, moduleId, localName, depth + 1, visited);
63
- }
64
- const reexport = shape.reexports.get(name);
65
- if (reexport) {
66
- return followImport(ctx, moduleId, reexport.source, reexport.imported, depth, visited);
67
- }
68
- for (const source of shape.starExports) {
69
- if (await followImport(ctx, moduleId, source, name, depth, visited)) {
70
- return true;
71
- }
72
- }
73
- return false;
64
+ if (depth > MAX_DEPTH) return false;
65
+ const key = `${moduleId} ${name}`;
66
+ if (visited.has(key)) return false;
67
+ visited.add(key);
68
+ const shape = await getModuleShape(ctx, moduleId);
69
+ if (!shape) return false;
70
+ if (shape.classes.has(name)) return extendsAgent(ctx, shape, moduleId, shape.classes.get(name), depth, visited);
71
+ const imported = shape.imports.get(name);
72
+ if (imported) return followImport(ctx, moduleId, imported.source, imported.imported, depth, visited);
73
+ if (name === "default") {
74
+ if (shape.defaultExportIsClass) return extendsAgent(ctx, shape, moduleId, shape.defaultExportSuper, depth, visited);
75
+ if (shape.defaultExportName) return isAgentBinding(ctx, moduleId, shape.defaultExportName, depth + 1, visited);
76
+ }
77
+ const localName = shape.localExports.get(name);
78
+ if (localName) return isAgentBinding(ctx, moduleId, localName, depth + 1, visited);
79
+ const reexport = shape.reexports.get(name);
80
+ if (reexport) return followImport(ctx, moduleId, reexport.source, reexport.imported, depth, visited);
81
+ for (const source of shape.starExports) if (await followImport(ctx, moduleId, source, name, depth, visited)) return true;
82
+ return false;
74
83
  }
84
+ /**
85
+ * Whether a superclass reference resolves to an Agent base — a bare identifier (imported, or a
86
+ * subclass declared in the same module) or `ns.Agent` off a namespace import.
87
+ */
75
88
  async function extendsAgent(ctx, shape, moduleId, superClass, depth, visited) {
76
- if (!superClass) return false;
77
- if (superClass.kind === "identifier") {
78
- return isAgentBinding(ctx, moduleId, superClass.name, depth + 1, visited);
79
- }
80
- const source = shape.namespaces.get(superClass.object);
81
- if (source) {
82
- return followImport(ctx, moduleId, source, superClass.property, depth, visited);
83
- }
84
- return false;
89
+ if (!superClass) return false;
90
+ if (superClass.kind === "identifier") return isAgentBinding(ctx, moduleId, superClass.name, depth + 1, visited);
91
+ const source = shape.namespaces.get(superClass.object);
92
+ if (source) return followImport(ctx, moduleId, source, superClass.property, depth, visited);
93
+ return false;
85
94
  }
95
+ /** Resolve an import to its module and continue the search there, stopping at package boundaries. */
86
96
  async function followImport(ctx, importerId, source, importedName, depth, visited) {
87
- if (AGENT_BASE_CLASSES[source]?.has(importedName)) return true;
88
- if (!ctx.resolver.resolve) return false;
89
- let resolved;
90
- try {
91
- resolved = await ctx.resolver.resolve(source, importerId);
92
- } catch {
93
- return false;
94
- }
95
- if (!resolved?.id) return false;
96
- if (resolved.id.includes("/node_modules/") || resolved.id.includes("\\node_modules\\")) return false;
97
- return isAgentBinding(ctx, resolved.id, importedName, depth + 1, visited);
97
+ if (AGENT_BASE_CLASSES[source]?.has(importedName)) return true;
98
+ if (!ctx.resolver.resolve) return false;
99
+ let resolved;
100
+ try {
101
+ resolved = await ctx.resolver.resolve(source, importerId);
102
+ } catch {
103
+ return false;
104
+ }
105
+ if (!resolved?.id) return false;
106
+ if (resolved.id.includes("/node_modules/") || resolved.id.includes("\\node_modules\\")) return false;
107
+ return isAgentBinding(ctx, resolved.id, importedName, depth + 1, visited);
98
108
  }
99
109
  async function getModuleShape(ctx, moduleId) {
100
- if (ctx.modules.has(moduleId)) return ctx.modules.get(moduleId);
101
- let shape;
102
- try {
103
- const code = ctx.resolver.readFile ? ctx.resolver.readFile(moduleId) : node_fs.readFileSync(moduleId.replace(/[?#].*$/, ""), "utf8");
104
- if (typeof code === "string") {
105
- shape = moduleShape.shapeFromSource(code);
106
- }
107
- } catch {
108
- }
109
- ctx.modules.set(moduleId, shape);
110
- return shape;
110
+ if (ctx.modules.has(moduleId)) return ctx.modules.get(moduleId);
111
+ let shape;
112
+ try {
113
+ const code = ctx.resolver.readFile ? ctx.resolver.readFile(moduleId) : (0, node_fs.readFileSync)(moduleId.replace(/[?#].*$/, ""), "utf8");
114
+ if (typeof code === "string") shape = require_moduleShape.shapeFromSource(code);
115
+ } catch {}
116
+ ctx.modules.set(moduleId, shape);
117
+ return shape;
111
118
  }
112
-
113
119
  exports.collectAgentCandidates = collectAgentCandidates;
114
120
  exports.detectAgentClasses = detectAgentClasses;
115
- //# sourceMappingURL=agentClass.js.map
121
+
122
+ //# sourceMappingURL=agentClass.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agentClass.js","sources":["../../../../src/vite/agentClass.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { DEFAULT_EXPORT, type ModuleShape, shapeFromAst, shapeFromSource, type SuperRef } from './moduleShape';\nimport type { ProgramBody } from './transform';\n\n/**\n * Agent base classes, keyed by the module specifier they are imported from. A class extending any\n * of these — directly or through a chain of local/imported subclasses — is an `agents` Agent rather\n * than a plain Durable Object.\n *\n * `McpAgent`, `AIChatAgent` and `Think` all extend `Agent` themselves, but they live in packages\n * whose sources we never walk into (see {@link followImport}), so each needs its own entry.\n */\nconst AGENT_BASE_CLASSES: Record<string, ReadonlySet<string>> = {\n agents: new Set(['Agent']),\n 'agents/mcp': new Set(['McpAgent']),\n '@cloudflare/ai-chat': new Set(['AIChatAgent']),\n '@cloudflare/think': new Set(['Think']),\n};\n\n/**\n * How many modules deep the base-class chain is followed. Guards against pathological module graphs;\n * real Agent hierarchies are only a few levels deep.\n */\nconst MAX_DEPTH = 8;\n\n/**\n * The subset of the Vite/Rollup plugin context needed to walk the module graph.\n *\n * `resolve` is optional: without it detection still works, but only for base-class chains declared\n * inside the entry module itself. `readFile` is injectable for tests and defaults to reading disk.\n *\n * Deliberately **no `load`**: awaiting the plugin context's `load()` from inside a `transform` hook\n * deadlocks the build — the module cannot finish loading while its own transform is still pending\n * (Rollup documents this hazard, and Vite's Rolldown pipeline is stricter still). Sibling modules\n * are therefore read straight off disk; see {@link getModuleShape}.\n */\nexport interface ModuleResolver {\n parse(code: string): ProgramBody;\n resolve?(source: string, importer: string): Promise<{ id: string } | null | undefined>;\n readFile?(id: string): string | undefined;\n}\n\ninterface DetectContext {\n resolver: ModuleResolver;\n modules: Map<string, ModuleShape | undefined>;\n}\n\n/**\n * Find which of `candidates` (top-level class names in the entry module) are Cloudflare\n * [`agents`](https://www.npmjs.com/package/agents) Agents.\n *\n * An Agent is a Durable Object under the hood, so wrangler configures it as one and the transform\n * would otherwise reach for `instrumentDurableObjectWithSentry`. Detecting the Agent base chain lets\n * it pick `instrumentAgentWithSentry` instead, which adds the Agent-specific telemetry on top.\n *\n * Unlike `WorkerEntrypoint` detection, the chain is followed *across* modules: base classes commonly\n * live in their own file (`import { MyBase } from './base'`), and there is no runtime fallback that\n * would catch a missed one. Resolution stops at package boundaries — a base class imported from\n * `node_modules` is only recognized when it is one of {@link AGENT_BASE_CLASSES}.\n */\nexport async function detectAgentClasses(\n ast: ProgramBody,\n entryId: string,\n candidates: Iterable<string>,\n resolver: ModuleResolver,\n): Promise<Set<string>> {\n // The entry's shape comes from the AST Vite already handed us (TypeScript stripped, full\n // fidelity); only sibling modules fall back to source scanning.\n const ctx: DetectContext = { resolver, modules: new Map([[entryId, shapeFromAst(ast)]]) };\n\n const detected = new Set<string>();\n for (const name of candidates) {\n // A fresh cycle guard per candidate: a shared one would record \"not an Agent\" for bindings\n // visited while resolving an earlier candidate that turned out to be unrelated.\n if (await isAgentBinding(ctx, entryId, name, 0, new Set())) {\n detected.add(name);\n }\n }\n return detected;\n}\n\n/**\n * The entry-module binding names a configured class name could refer to — a class declared under\n * that name, an import of it from another module, a `export { X } from './x'` re-export, or the\n * local binding an `export { Local as Configured }` specifier aliases.\n *\n * Keeps detection (which reads and scans other modules) off names no binding points at.\n */\nexport function collectAgentCandidates(ast: ProgramBody, configuredNames: Iterable<string>): Set<string> {\n const shape = shapeFromAst(ast);\n const candidates = new Set<string>();\n\n const isResolvable = (name: string): boolean =>\n shape.classes.has(name) || shape.imports.has(name) || shape.reexports.has(name);\n\n for (const configured of configuredNames) {\n if (isResolvable(configured)) {\n candidates.add(configured);\n }\n const local = shape.localExports.get(configured);\n if (local && isResolvable(local)) {\n candidates.add(local);\n }\n }\n\n return candidates;\n}\n\nasync function isAgentBinding(\n ctx: DetectContext,\n moduleId: string,\n name: string,\n depth: number,\n visited: Set<string>,\n): Promise<boolean> {\n if (depth > MAX_DEPTH) return false;\n\n const key = `${moduleId} ${name}`;\n if (visited.has(key)) return false;\n visited.add(key);\n\n const shape = await getModuleShape(ctx, moduleId);\n if (!shape) return false;\n\n if (shape.classes.has(name)) {\n return extendsAgent(ctx, shape, moduleId, shape.classes.get(name), depth, visited);\n }\n\n const imported = shape.imports.get(name);\n if (imported) {\n return followImport(ctx, moduleId, imported.source, imported.imported, depth, visited);\n }\n\n if (name === DEFAULT_EXPORT) {\n if (shape.defaultExportIsClass) {\n return extendsAgent(ctx, shape, moduleId, shape.defaultExportSuper, depth, visited);\n }\n if (shape.defaultExportName) {\n return isAgentBinding(ctx, moduleId, shape.defaultExportName, depth + 1, visited);\n }\n }\n\n // `export { Local as Requested }` — the caller asked by exported name.\n const localName = shape.localExports.get(name);\n if (localName) {\n return isAgentBinding(ctx, moduleId, localName, depth + 1, visited);\n }\n\n const reexport = shape.reexports.get(name);\n if (reexport) {\n return followImport(ctx, moduleId, reexport.source, reexport.imported, depth, visited);\n }\n\n // Barrel modules (`export * from './base'`) don't name the binding, so every star source is a\n // candidate home for it.\n for (const source of shape.starExports) {\n if (await followImport(ctx, moduleId, source, name, depth, visited)) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Whether a superclass reference resolves to an Agent base — a bare identifier (imported, or a\n * subclass declared in the same module) or `ns.Agent` off a namespace import.\n */\nasync function extendsAgent(\n ctx: DetectContext,\n shape: ModuleShape,\n moduleId: string,\n superClass: SuperRef | undefined,\n depth: number,\n visited: Set<string>,\n): Promise<boolean> {\n if (!superClass) return false;\n\n if (superClass.kind === 'identifier') {\n return isAgentBinding(ctx, moduleId, superClass.name, depth + 1, visited);\n }\n\n const source = shape.namespaces.get(superClass.object);\n if (source) {\n return followImport(ctx, moduleId, source, superClass.property, depth, visited);\n }\n\n return false;\n}\n\n/** Resolve an import to its module and continue the search there, stopping at package boundaries. */\nasync function followImport(\n ctx: DetectContext,\n importerId: string,\n source: string,\n importedName: string,\n depth: number,\n visited: Set<string>,\n): Promise<boolean> {\n if (AGENT_BASE_CLASSES[source]?.has(importedName)) return true;\n\n if (!ctx.resolver.resolve) return false;\n\n let resolved: { id: string } | null | undefined;\n try {\n resolved = await ctx.resolver.resolve(source, importerId);\n } catch {\n return false;\n }\n if (!resolved?.id) return false;\n\n // Third-party sources are not walked: they are large, may not be plain JS by the time we see\n // them, and any Agent base worth knowing about is listed in AGENT_BASE_CLASSES.\n if (resolved.id.includes('/node_modules/') || resolved.id.includes('\\\\node_modules\\\\')) return false;\n\n return isAgentBinding(ctx, resolved.id, importedName, depth + 1, visited);\n}\n\nasync function getModuleShape(ctx: DetectContext, moduleId: string): Promise<ModuleShape | undefined> {\n if (ctx.modules.has(moduleId)) return ctx.modules.get(moduleId);\n\n let shape: ModuleShape | undefined;\n try {\n const code = ctx.resolver.readFile\n ? ctx.resolver.readFile(moduleId)\n : readFileSync(moduleId.replace(/[?#].*$/, ''), 'utf8');\n if (typeof code === 'string') {\n shape = shapeFromSource(code);\n }\n } catch {\n // Unreadable or not a source file — treat as \"not an Agent\" rather than failing the build.\n }\n\n ctx.modules.set(moduleId, shape);\n return shape;\n}\n"],"names":["shapeFromAst","DEFAULT_EXPORT","readFileSync","shapeFromSource"],"mappings":";;;;;AAYA,MAAM,kBAAA,GAA0D;AAAA,EAC9D,MAAA,kBAAQ,IAAI,GAAA,CAAI,CAAC,OAAO,CAAC,CAAA;AAAA,EACzB,YAAA,kBAAc,IAAI,GAAA,CAAI,CAAC,UAAU,CAAC,CAAA;AAAA,EAClC,qBAAA,kBAAuB,IAAI,GAAA,CAAI,CAAC,aAAa,CAAC,CAAA;AAAA,EAC9C,mBAAA,kBAAqB,IAAI,GAAA,CAAI,CAAC,OAAO,CAAC;AACxC,CAAA;AAMA,MAAM,SAAA,GAAY,CAAA;AAqClB,eAAsB,kBAAA,CACpB,GAAA,EACA,OAAA,EACA,UAAA,EACA,QAAA,EACsB;AAGtB,EAAA,MAAM,GAAA,GAAqB,EAAE,QAAA,EAAU,OAAA,sBAAa,GAAA,CAAI,CAAC,CAAC,OAAA,EAASA,wBAAA,CAAa,GAAG,CAAC,CAAC,CAAC,CAAA,EAAE;AAExF,EAAA,MAAM,QAAA,uBAAe,GAAA,EAAY;AACjC,EAAA,KAAA,MAAW,QAAQ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AA,CAAS,OAAA,CAAQ,QAAQ,UAAU,CAAA;AAAA,EAC1D,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,CAAC,QAAA,EAAU,EAAA,EAAI,OAAO,KAAA;AAI1B,EAAA,IAAI,QAAA,CAAS,EAAA,CAAG,QAAA,CAAS,gBAAgB,CAAA,IAAK,SAAS,EAAA,CAAG,QAAA,CAAS,kBAAkB,CAAA,EAAG,OAAO,KAAA;AAE/F,EAAA,OAAO,eAAe,GAAA,EAAK,QAAA,CAAS,IAAI,YAAA,EAAc,KAAA,GAAQ,GAAG,OAAO,CAAA;AAC1E;AAEA,eAAe,cAAA,CAAe,KAAoB,QAAA,EAAoD;AACpG,EAAA,IAAI,GAAA,CAAI,QAAQ,GAAA,CAAI,QAAQ,GAAG,OAAO,GAAA,CAAI,OAAA,CAAQ,GAAA,CAAI,QAAQ,CAAA;AAE9D,EAAA,IAAI,KAAA;AACJ,EAAA,IAAI;AACF,IAAA,MAAM,IAAA,GAAO,GAAA,CAAI,QAAA,CAAS,QAAA,GACtB,IAAI,QAAA,CAAS,QAAA,CAAS,QAAQ,CAAA,GAC9BC,qBAAa,QAAA,CAAS,OAAA,CAAQ,SAAA,EAAW,EAAE,GAAG,MAAM,CAAA;AACxD,IAAA,IAAI,OAAO,SAAS,QAAA,EAAU;AAC5B,MAAA,KAAA,GAAQC,4BAAgB,IAAI,CAAA;AAAA,IAC9B;AAAA,EACF,CAAA,CAAA,MAAQ;AAAA,EAER;AAEA,EAAA,GAAA,CAAI,OAAA,CAAQ,GAAA,CAAI,QAAA,EAAU,KAAK,CAAA;AAC/B,EAAA,OAAO,KAAA;AACT;;;;;"}
1
+ {"version":3,"file":"agentClass.js","names":["shapeFromAst","readFileSync","shapeFromSource"],"sources":["../../../../src/vite/agentClass.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { DEFAULT_EXPORT, type ModuleShape, shapeFromAst, shapeFromSource, type SuperRef } from './moduleShape';\nimport type { ProgramBody } from './transform';\n\n/**\n * Agent base classes, keyed by the module specifier they are imported from. A class extending any\n * of these — directly or through a chain of local/imported subclasses — is an `agents` Agent rather\n * than a plain Durable Object.\n *\n * `McpAgent`, `AIChatAgent` and `Think` all extend `Agent` themselves, but they live in packages\n * whose sources we never walk into (see {@link followImport}), so each needs its own entry.\n */\nconst AGENT_BASE_CLASSES: Record<string, ReadonlySet<string>> = {\n agents: new Set(['Agent']),\n 'agents/mcp': new Set(['McpAgent']),\n '@cloudflare/ai-chat': new Set(['AIChatAgent']),\n '@cloudflare/think': new Set(['Think']),\n};\n\n/**\n * How many modules deep the base-class chain is followed. Guards against pathological module graphs;\n * real Agent hierarchies are only a few levels deep.\n */\nconst MAX_DEPTH = 8;\n\n/**\n * The subset of the Vite/Rollup plugin context needed to walk the module graph.\n *\n * `resolve` is optional: without it detection still works, but only for base-class chains declared\n * inside the entry module itself. `readFile` is injectable for tests and defaults to reading disk.\n *\n * Deliberately **no `load`**: awaiting the plugin context's `load()` from inside a `transform` hook\n * deadlocks the build — the module cannot finish loading while its own transform is still pending\n * (Rollup documents this hazard, and Vite's Rolldown pipeline is stricter still). Sibling modules\n * are therefore read straight off disk; see {@link getModuleShape}.\n */\nexport interface ModuleResolver {\n parse(code: string): ProgramBody;\n resolve?(source: string, importer: string): Promise<{ id: string } | null | undefined>;\n readFile?(id: string): string | undefined;\n}\n\ninterface DetectContext {\n resolver: ModuleResolver;\n modules: Map<string, ModuleShape | undefined>;\n}\n\n/**\n * Find which of `candidates` (top-level class names in the entry module) are Cloudflare\n * [`agents`](https://www.npmjs.com/package/agents) Agents.\n *\n * An Agent is a Durable Object under the hood, so wrangler configures it as one and the transform\n * would otherwise reach for `instrumentDurableObjectWithSentry`. Detecting the Agent base chain lets\n * it pick `instrumentAgentWithSentry` instead, which adds the Agent-specific telemetry on top.\n *\n * Unlike `WorkerEntrypoint` detection, the chain is followed *across* modules: base classes commonly\n * live in their own file (`import { MyBase } from './base'`), and there is no runtime fallback that\n * would catch a missed one. Resolution stops at package boundaries — a base class imported from\n * `node_modules` is only recognized when it is one of {@link AGENT_BASE_CLASSES}.\n */\nexport async function detectAgentClasses(\n ast: ProgramBody,\n entryId: string,\n candidates: Iterable<string>,\n resolver: ModuleResolver,\n): Promise<Set<string>> {\n // The entry's shape comes from the AST Vite already handed us (TypeScript stripped, full\n // fidelity); only sibling modules fall back to source scanning.\n const ctx: DetectContext = { resolver, modules: new Map([[entryId, shapeFromAst(ast)]]) };\n\n const detected = new Set<string>();\n for (const name of candidates) {\n // A fresh cycle guard per candidate: a shared one would record \"not an Agent\" for bindings\n // visited while resolving an earlier candidate that turned out to be unrelated.\n if (await isAgentBinding(ctx, entryId, name, 0, new Set())) {\n detected.add(name);\n }\n }\n return detected;\n}\n\n/**\n * The entry-module binding names a configured class name could refer to — a class declared under\n * that name, an import of it from another module, a `export { X } from './x'` re-export, or the\n * local binding an `export { Local as Configured }` specifier aliases.\n *\n * Keeps detection (which reads and scans other modules) off names no binding points at.\n */\nexport function collectAgentCandidates(ast: ProgramBody, configuredNames: Iterable<string>): Set<string> {\n const shape = shapeFromAst(ast);\n const candidates = new Set<string>();\n\n const isResolvable = (name: string): boolean =>\n shape.classes.has(name) || shape.imports.has(name) || shape.reexports.has(name);\n\n for (const configured of configuredNames) {\n if (isResolvable(configured)) {\n candidates.add(configured);\n }\n const local = shape.localExports.get(configured);\n if (local && isResolvable(local)) {\n candidates.add(local);\n }\n }\n\n return candidates;\n}\n\nasync function isAgentBinding(\n ctx: DetectContext,\n moduleId: string,\n name: string,\n depth: number,\n visited: Set<string>,\n): Promise<boolean> {\n if (depth > MAX_DEPTH) return false;\n\n const key = `${moduleId} ${name}`;\n if (visited.has(key)) return false;\n visited.add(key);\n\n const shape = await getModuleShape(ctx, moduleId);\n if (!shape) return false;\n\n if (shape.classes.has(name)) {\n return extendsAgent(ctx, shape, moduleId, shape.classes.get(name), depth, visited);\n }\n\n const imported = shape.imports.get(name);\n if (imported) {\n return followImport(ctx, moduleId, imported.source, imported.imported, depth, visited);\n }\n\n if (name === DEFAULT_EXPORT) {\n if (shape.defaultExportIsClass) {\n return extendsAgent(ctx, shape, moduleId, shape.defaultExportSuper, depth, visited);\n }\n if (shape.defaultExportName) {\n return isAgentBinding(ctx, moduleId, shape.defaultExportName, depth + 1, visited);\n }\n }\n\n // `export { Local as Requested }` — the caller asked by exported name.\n const localName = shape.localExports.get(name);\n if (localName) {\n return isAgentBinding(ctx, moduleId, localName, depth + 1, visited);\n }\n\n const reexport = shape.reexports.get(name);\n if (reexport) {\n return followImport(ctx, moduleId, reexport.source, reexport.imported, depth, visited);\n }\n\n // Barrel modules (`export * from './base'`) don't name the binding, so every star source is a\n // candidate home for it.\n for (const source of shape.starExports) {\n if (await followImport(ctx, moduleId, source, name, depth, visited)) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Whether a superclass reference resolves to an Agent base — a bare identifier (imported, or a\n * subclass declared in the same module) or `ns.Agent` off a namespace import.\n */\nasync function extendsAgent(\n ctx: DetectContext,\n shape: ModuleShape,\n moduleId: string,\n superClass: SuperRef | undefined,\n depth: number,\n visited: Set<string>,\n): Promise<boolean> {\n if (!superClass) return false;\n\n if (superClass.kind === 'identifier') {\n return isAgentBinding(ctx, moduleId, superClass.name, depth + 1, visited);\n }\n\n const source = shape.namespaces.get(superClass.object);\n if (source) {\n return followImport(ctx, moduleId, source, superClass.property, depth, visited);\n }\n\n return false;\n}\n\n/** Resolve an import to its module and continue the search there, stopping at package boundaries. */\nasync function followImport(\n ctx: DetectContext,\n importerId: string,\n source: string,\n importedName: string,\n depth: number,\n visited: Set<string>,\n): Promise<boolean> {\n if (AGENT_BASE_CLASSES[source]?.has(importedName)) return true;\n\n if (!ctx.resolver.resolve) return false;\n\n let resolved: { id: string } | null | undefined;\n try {\n resolved = await ctx.resolver.resolve(source, importerId);\n } catch {\n return false;\n }\n if (!resolved?.id) return false;\n\n // Third-party sources are not walked: they are large, may not be plain JS by the time we see\n // them, and any Agent base worth knowing about is listed in AGENT_BASE_CLASSES.\n if (resolved.id.includes('/node_modules/') || resolved.id.includes('\\\\node_modules\\\\')) return false;\n\n return isAgentBinding(ctx, resolved.id, importedName, depth + 1, visited);\n}\n\nasync function getModuleShape(ctx: DetectContext, moduleId: string): Promise<ModuleShape | undefined> {\n if (ctx.modules.has(moduleId)) return ctx.modules.get(moduleId);\n\n let shape: ModuleShape | undefined;\n try {\n const code = ctx.resolver.readFile\n ? ctx.resolver.readFile(moduleId)\n : readFileSync(moduleId.replace(/[?#].*$/, ''), 'utf8');\n if (typeof code === 'string') {\n shape = shapeFromSource(code);\n }\n } catch {\n // Unreadable or not a source file — treat as \"not an Agent\" rather than failing the build.\n }\n\n ctx.modules.set(moduleId, shape);\n return shape;\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,qBAA0D;CAC9D,wBAAQ,IAAI,IAAI,CAAC,OAAO,CAAC;CACzB,8BAAc,IAAI,IAAI,CAAC,UAAU,CAAC;CAClC,uCAAuB,IAAI,IAAI,CAAC,aAAa,CAAC;CAC9C,qCAAqB,IAAI,IAAI,CAAC,OAAO,CAAC;AACxC;;;;;AAMA,MAAM,YAAY;;;;;;;;;;;;;;AAqClB,eAAsB,mBACpB,KACA,SACA,YACA,UACsB;CAGtB,MAAM,MAAqB;EAAE;EAAU,yBAAS,IAAI,IAAI,CAAC,CAAC,SAASA,oBAAAA,aAAa,GAAG,CAAC,CAAC,CAAC;CAAE;CAExF,MAAM,2BAAW,IAAI,IAAY;CACjC,KAAK,MAAM,QAAQ,YAGjB,IAAI,MAAM,eAAe,KAAK,SAAS,MAAM,mBAAG,IAAI,IAAI,CAAC,GACvD,SAAS,IAAI,IAAI;CAGrB,OAAO;AACT;;;;;;;;AASA,SAAgB,uBAAuB,KAAkB,iBAAgD;CACvG,MAAM,QAAQA,oBAAAA,aAAa,GAAG;CAC9B,MAAM,6BAAa,IAAI,IAAY;CAEnC,MAAM,gBAAgB,SACpB,MAAM,QAAQ,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,OAAO;AACT"}
@@ -1,131 +1,130 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const node_path = require('node:path');
4
- const vite = require('vite');
5
- const agentClass = require('./agentClass.js');
6
- const instrumentFile = require('./instrumentFile.js');
7
- const transform = require('./transform.js');
8
- const wranglerConfig = require('./wranglerConfig.js');
9
-
1
+ const require_agentClass = require("./agentClass.js");
2
+ const require_instrumentFile = require("./instrumentFile.js");
3
+ const require_transform = require("./transform.js");
4
+ const require_wranglerConfig = require("./wranglerConfig.js");
5
+ let node_path = require("node:path");
6
+ let vite = require("vite");
7
+ // src/vite/autoInstrument.ts
10
8
  function normalizePath(path) {
11
- return path.replace(/\\/g, "/");
9
+ return path.replace(/\\/g, "/");
12
10
  }
13
11
  const JS_EXTENSION_REGEX = /\.[cm]?[jt]sx?$/;
14
12
  const NEXTJS_CLOUDFLARE_MODULE = "@sentry/nextjs/cloudflare";
13
+ /**
14
+ * Whether `@sentry/nextjs/cloudflare` resolves from `importer`. Vite throws instead of returning `null` when
15
+ * `@sentry/nextjs` is installed in a version without that entry.
16
+ */
15
17
  async function resolvesNextjsCloudflare(resolver, importer) {
16
- try {
17
- return !!await resolver.resolve?.(NEXTJS_CLOUDFLARE_MODULE, importer);
18
- } catch {
19
- return false;
20
- }
18
+ try {
19
+ return !!await resolver.resolve?.(NEXTJS_CLOUDFLARE_MODULE, importer);
20
+ } catch {
21
+ return false;
22
+ }
23
+ }
24
+ /**
25
+ * Whether the module re-exports everything from another module of its own file, as the shim
26
+ * `@sentry/tanstackstart-react` loads for the server entry does (`export * from "<entry>?sentry-tunnel-original"`).
27
+ * That module is transformed as the entry too, and its classes are wrapped there.
28
+ */
29
+ function reexportsAllFromSameFile(ast, normalizedId) {
30
+ return ast.body.some((node) => {
31
+ if (node.type !== "ExportAllDeclaration") return false;
32
+ const { exported, source } = node;
33
+ const value = source?.value;
34
+ return !exported && typeof value === "string" && normalizePath(value.replace(/[?#].*$/, "")) === normalizedId;
35
+ });
21
36
  }
22
37
  function sentryCloudflareAutoInstrumentPlugin(options = {}) {
23
- let wranglerConfig$1;
24
- let entryFilePath;
25
- let entrySpecifier;
26
- let wranglerConfigPath;
27
- let resolveId;
28
- const resolvedEntries = /* @__PURE__ */ new Map();
29
- let instrumentFilePath;
30
- let isVinext = false;
31
- function resolveEntrySpecifier(ctx, specifier) {
32
- const environment = ctx.environment;
33
- if (!environment || !resolveId) return Promise.resolve(void 0);
34
- let entry = resolvedEntries.get(environment.name);
35
- if (!entry) {
36
- entry = resolveId(environment, specifier, wranglerConfigPath).catch(() => void 0).then((id) => {
37
- if (!id) {
38
- ctx.warn?.(
39
- `[sentry] Could not resolve the wrangler \`main\` "${specifier}". Auto-instrumentation disabled.`
40
- );
41
- return void 0;
42
- }
43
- return normalizePath(id.replace(/[?#].*$/, ""));
44
- });
45
- resolvedEntries.set(environment.name, entry);
46
- }
47
- return entry;
48
- }
49
- return {
50
- name: "sentry-cloudflare-auto-instrument",
51
- configResolved(config) {
52
- isVinext = config.plugins?.some((plugin) => plugin.name?.startsWith("vinext:")) ?? false;
53
- const result = wranglerConfig.resolveWranglerConfig(config.root, options.wranglerConfigPath);
54
- if (!result) {
55
- config.logger?.warn(
56
- options.wranglerConfigPath ? `[sentry] Could not find or parse the wrangler config "${node_path.basename(options.wranglerConfigPath)}" (resolved against the Vite root) \u2014 auto-instrumentation disabled.` : "[sentry] No parseable wrangler config found \u2014 auto-instrumentation disabled. Set `wranglerConfigPath` if your config uses a custom name."
57
- );
58
- return;
59
- }
60
- wranglerConfig$1 = result.config;
61
- const main = wranglerConfig$1.main;
62
- if (main && node_path.isAbsolute(main)) {
63
- entryFilePath = normalizePath(main);
64
- instrumentFilePath = instrumentFile.resolveInstrumentFile(node_path.dirname(main));
65
- } else if (main) {
66
- entrySpecifier = main;
67
- wranglerConfigPath = result.configPath;
68
- resolveId = vite.createIdResolver(config);
69
- instrumentFilePath = instrumentFile.resolveInstrumentFile(result.configDir);
70
- }
71
- },
72
- async transform(code, id) {
73
- if (!wranglerConfig$1 || !entryFilePath && !entrySpecifier) return void 0;
74
- if (this.environment?.name === "client") return void 0;
75
- const entryPath = entrySpecifier ? await resolveEntrySpecifier(this, entrySpecifier) : entryFilePath;
76
- if (!entryPath) return void 0;
77
- const normalizedId = normalizePath(id.replace(/[?#].*$/, ""));
78
- if (normalizedId !== entryPath) {
79
- if (!JS_EXTENSION_REGEX.test(normalizedId) || !JS_EXTENSION_REGEX.test(entryPath)) return void 0;
80
- if (normalizedId.replace(JS_EXTENSION_REGEX, "") !== entryPath.replace(JS_EXTENSION_REGEX, "")) {
81
- return void 0;
82
- }
83
- }
84
- let ast;
85
- try {
86
- ast = this.parse(code);
87
- } catch {
88
- return void 0;
89
- }
90
- const classWrappers = /* @__PURE__ */ new Map();
91
- for (const { className } of wranglerConfig$1.durableObjects) {
92
- classWrappers.set(className, "durableObject");
93
- }
94
- for (const { className } of wranglerConfig$1.workflows) {
95
- classWrappers.set(className, "workflow");
96
- }
97
- for (const className of wranglerConfig$1.workerEntrypoints) {
98
- classWrappers.set(className, "workerEntrypoint");
99
- }
100
- const agentCandidates = agentClass.collectAgentCandidates(
101
- ast,
102
- [...classWrappers].filter(([, kind]) => kind === "durableObject").map(([name]) => name)
103
- );
104
- const agentClasses = agentCandidates.size > 0 ? await agentClass.detectAgentClasses(ast, normalizedId, agentCandidates, {
105
- parse: (code2) => this.parse(code2),
106
- resolve: this.resolve ? (source, importer) => this.resolve(source, importer) : void 0
107
- }) : void 0;
108
- const sentryModule = isVinext && await resolvesNextjsCloudflare(this, normalizedId) ? NEXTJS_CLOUDFLARE_MODULE : void 0;
109
- const { optionsFn, importStmt: optionsImport } = instrumentFilePath ? instrumentFile.buildOptionsImport(entryPath, instrumentFilePath) : { optionsFn: instrumentFile.ENV_FALLBACK_OPTIONS_FN, importStmt: void 0 };
110
- const result = transform.applyAutoInstrumentTransforms(code, ast, {
111
- classWrappers,
112
- agentClasses,
113
- optionsFn,
114
- optionsImport,
115
- sameWorkerBindings: wranglerConfig$1.sameWorkerBindings,
116
- sentryModule
117
- });
118
- const wrappedClasses = result?.wrappedClasses ?? /* @__PURE__ */ new Set();
119
- const missing = [...classWrappers.keys()].filter((name) => !wrappedClasses.has(name));
120
- if (missing.length > 0) {
121
- this.warn?.(
122
- `[sentry] Could not auto-instrument ${missing.join(", ")}.The worker entry has no export matching them. Star re-exports (\`export * from "./do"\`) are not matched. Export them by name or wrap them manually with corresponding \`instrument*WithSentry\` helpers.`
123
- );
124
- }
125
- return result ?? void 0;
126
- }
127
- };
38
+ let wranglerConfig;
39
+ let entryFilePath;
40
+ let entrySpecifier;
41
+ let wranglerConfigPath;
42
+ let resolveId;
43
+ const resolvedEntries = /* @__PURE__ */ new Map();
44
+ let instrumentFilePath;
45
+ let isVinext = false;
46
+ function resolveEntrySpecifier(ctx, specifier) {
47
+ const environment = ctx.environment;
48
+ if (!environment || !resolveId) return Promise.resolve(void 0);
49
+ let entry = resolvedEntries.get(environment.name);
50
+ if (!entry) {
51
+ entry = resolveId(environment, specifier, wranglerConfigPath).catch(() => void 0).then((id) => {
52
+ if (!id) {
53
+ ctx.warn?.(`[sentry] Could not resolve the wrangler \`main\` "${specifier}". Auto-instrumentation disabled.`);
54
+ return;
55
+ }
56
+ return normalizePath(id.replace(/[?#].*$/, ""));
57
+ });
58
+ resolvedEntries.set(environment.name, entry);
59
+ }
60
+ return entry;
61
+ }
62
+ return {
63
+ name: "sentry-cloudflare-auto-instrument",
64
+ configResolved(config) {
65
+ isVinext = config.plugins?.some((plugin) => plugin.name?.startsWith("vinext:")) ?? false;
66
+ const result = require_wranglerConfig.resolveWranglerConfig(config.root, options.wranglerConfigPath);
67
+ if (!result) {
68
+ config.logger?.warn(options.wranglerConfigPath ? `[sentry] Could not find or parse the wrangler config "${(0, node_path.basename)(options.wranglerConfigPath)}" (resolved against the Vite root) — auto-instrumentation disabled.` : "[sentry] No parseable wrangler config found — auto-instrumentation disabled. Set `wranglerConfigPath` if your config uses a custom name.");
69
+ return;
70
+ }
71
+ wranglerConfig = result.config;
72
+ const main = wranglerConfig.main;
73
+ if (main && (0, node_path.isAbsolute)(main)) {
74
+ entryFilePath = normalizePath(main);
75
+ instrumentFilePath = require_instrumentFile.resolveInstrumentFile((0, node_path.dirname)(main));
76
+ } else if (main) {
77
+ entrySpecifier = main;
78
+ wranglerConfigPath = result.configPath;
79
+ resolveId = (0, vite.createIdResolver)(config);
80
+ instrumentFilePath = require_instrumentFile.resolveInstrumentFile(result.configDir);
81
+ }
82
+ },
83
+ async transform(code, id) {
84
+ if (!wranglerConfig || !entryFilePath && !entrySpecifier) return void 0;
85
+ if (this.environment?.name === "client") return void 0;
86
+ const entryPath = entrySpecifier ? await resolveEntrySpecifier(this, entrySpecifier) : entryFilePath;
87
+ if (!entryPath) return void 0;
88
+ const normalizedId = normalizePath(id.replace(/[?#].*$/, ""));
89
+ if (normalizedId !== entryPath) {
90
+ if (!JS_EXTENSION_REGEX.test(normalizedId) || !JS_EXTENSION_REGEX.test(entryPath)) return void 0;
91
+ if (normalizedId.replace(JS_EXTENSION_REGEX, "") !== entryPath.replace(JS_EXTENSION_REGEX, "")) return;
92
+ }
93
+ let ast;
94
+ try {
95
+ ast = this.parse(code);
96
+ } catch {
97
+ return;
98
+ }
99
+ const classWrappers = /* @__PURE__ */ new Map();
100
+ for (const { className } of wranglerConfig.durableObjects) classWrappers.set(className, "durableObject");
101
+ for (const { className } of wranglerConfig.workflows) classWrappers.set(className, "workflow");
102
+ for (const className of wranglerConfig.workerEntrypoints) classWrappers.set(className, "workerEntrypoint");
103
+ const agentCandidates = require_agentClass.collectAgentCandidates(ast, [...classWrappers].filter(([, kind]) => kind === "durableObject").map(([name]) => name));
104
+ const agentClasses = agentCandidates.size > 0 ? await require_agentClass.detectAgentClasses(ast, normalizedId, agentCandidates, {
105
+ parse: (code) => this.parse(code),
106
+ resolve: this.resolve ? (source, importer) => this.resolve(source, importer) : void 0
107
+ }) : void 0;
108
+ const sentryModule = isVinext && await resolvesNextjsCloudflare(this, normalizedId) ? NEXTJS_CLOUDFLARE_MODULE : void 0;
109
+ const { optionsFn, importStmt: optionsImport } = instrumentFilePath ? require_instrumentFile.buildOptionsImport(entryPath, instrumentFilePath) : {
110
+ optionsFn: require_instrumentFile.ENV_FALLBACK_OPTIONS_FN,
111
+ importStmt: void 0
112
+ };
113
+ const result = require_transform.applyAutoInstrumentTransforms(code, ast, {
114
+ classWrappers,
115
+ agentClasses,
116
+ optionsFn,
117
+ optionsImport,
118
+ sameWorkerBindings: wranglerConfig.sameWorkerBindings,
119
+ sentryModule
120
+ });
121
+ const wrappedClasses = result?.wrappedClasses ?? /* @__PURE__ */ new Set();
122
+ const missing = [...classWrappers.keys()].filter((name) => !wrappedClasses.has(name));
123
+ if (missing.length > 0 && !reexportsAllFromSameFile(ast, normalizedId)) this.warn?.(`[sentry] Could not auto-instrument ${missing.join(", ")}. The worker entry has no export matching them. Star re-exports (\`export * from "./do"\`) are not matched. Export them by name or wrap them manually with corresponding \`instrument*WithSentry\` helpers.`);
124
+ return result ?? void 0;
125
+ }
126
+ };
128
127
  }
129
-
130
128
  exports.sentryCloudflareAutoInstrumentPlugin = sentryCloudflareAutoInstrumentPlugin;
131
- //# sourceMappingURL=autoInstrument.js.map
129
+
130
+ //# sourceMappingURL=autoInstrument.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"autoInstrument.js","sources":["../../../../src/vite/autoInstrument.ts"],"sourcesContent":["import { basename, dirname, isAbsolute } from 'node:path';\nimport { createIdResolver, type ResolvedConfig } from 'vite';\nimport { collectAgentCandidates, detectAgentClasses, type ModuleResolver } from './agentClass';\nimport { buildOptionsImport, ENV_FALLBACK_OPTIONS_FN, resolveInstrumentFile } from './instrumentFile';\nimport { applyAutoInstrumentTransforms, type ClassWrapperKind, type ProgramBody } from './transform';\nimport { resolveWranglerConfig, type WranglerConfig } from './wranglerConfig';\n\n// Vite normalizes module IDs to posix separators even on Windows, while\n// `path.resolve` yields backslashes there — normalize before comparing.\nfunction normalizePath(path: string): string {\n return path.replace(/\\\\/g, '/');\n}\n\n// Extensions the entry-module match may tolerate swapping (e.g. wrangler's\n// `main` says `.ts` but the served module is `.js`). Anything else — `.css`,\n// `.html`, … — sharing the entry's basename must never be treated as the entry.\nconst JS_EXTENSION_REGEX = /\\.[cm]?[jt]sx?$/;\n\n// Re-exports everything the generated code uses, and adds the Next.js span handling and OpenTelemetry context.\nconst NEXTJS_CLOUDFLARE_MODULE = '@sentry/nextjs/cloudflare';\n\n/**\n * Whether `@sentry/nextjs/cloudflare` resolves from `importer`. Vite throws instead of returning `null` when\n * `@sentry/nextjs` is installed in a version without that entry.\n */\nasync function resolvesNextjsCloudflare(resolver: ModuleResolver, importer: string): Promise<boolean> {\n try {\n return !!(await resolver.resolve?.(NEXTJS_CLOUDFLARE_MODULE, importer));\n } catch {\n return false;\n }\n}\n\ntype TransformContext = ModuleResolver & {\n warn?(msg: string): void;\n environment?: Parameters<ReturnType<typeof createIdResolver>>[0];\n};\n\nexport function sentryCloudflareAutoInstrumentPlugin(options: { wranglerConfigPath?: string } = {}) {\n let wranglerConfig: WranglerConfig | undefined;\n let entryFilePath: string | undefined;\n // A `main` that is not a file path (a package export or virtual module).\n let entrySpecifier: string | undefined;\n let wranglerConfigPath: string | undefined;\n let resolveId: ReturnType<typeof createIdResolver> | undefined;\n // Each environment resolves with its own conditions, so the entry may differ between them.\n const resolvedEntries = new Map<string, Promise<string | undefined>>();\n\n let instrumentFilePath: string | undefined;\n let isVinext = false;\n\n function resolveEntrySpecifier(ctx: TransformContext, specifier: string): Promise<string | undefined> {\n const environment = ctx.environment;\n if (!environment || !resolveId) return Promise.resolve(undefined);\n\n let entry = resolvedEntries.get(environment.name);\n if (!entry) {\n // Resolved from the wrangler config, as wrangler does. Without an importer, Vite's resolver\n // tries the specifier as a path below the root first.\n entry = resolveId(environment, specifier, wranglerConfigPath)\n .catch(() => undefined)\n .then(id => {\n if (!id) {\n ctx.warn?.(\n `[sentry] Could not resolve the wrangler \\`main\\` \"${specifier}\". Auto-instrumentation disabled.`,\n );\n return undefined;\n }\n return normalizePath(id.replace(/[?#].*$/, ''));\n });\n resolvedEntries.set(environment.name, entry);\n }\n return entry;\n }\n\n return {\n name: 'sentry-cloudflare-auto-instrument',\n\n configResolved(config: {\n root: string;\n plugins?: readonly { name?: string }[];\n logger?: { warn(msg: string): void };\n }): void {\n isVinext = config.plugins?.some(plugin => plugin.name?.startsWith('vinext:')) ?? false;\n\n const result = resolveWranglerConfig(config.root, options.wranglerConfigPath);\n if (!result) {\n // An explicit path that fails is a misconfiguration worth naming;\n // without one, hint at the option so custom-named configs (e.g. a\n // `configPath` handed to @cloudflare/vite-plugin) are discoverable.\n config.logger?.warn(\n options.wranglerConfigPath\n ? `[sentry] Could not find or parse the wrangler config \"${basename(options.wranglerConfigPath)}\" ` +\n '(resolved against the Vite root) — auto-instrumentation disabled.'\n : '[sentry] No parseable wrangler config found — auto-instrumentation disabled. ' +\n 'Set `wranglerConfigPath` if your config uses a custom name.',\n );\n return;\n }\n\n wranglerConfig = result.config;\n const main = wranglerConfig.main;\n if (main && isAbsolute(main)) {\n // Normalize separators so the entry-module comparison holds on Windows.\n entryFilePath = normalizePath(main);\n instrumentFilePath = resolveInstrumentFile(dirname(main));\n } else if (main) {\n entrySpecifier = main;\n wranglerConfigPath = result.configPath;\n // Not `this.resolve()`: Rollup's commonjs resolver loads the module it resolves, so a\n // resolve of the entry from the entry's own `transform` never finishes.\n resolveId = createIdResolver(config as ResolvedConfig);\n // A package entry has no project directory of its own.\n instrumentFilePath = resolveInstrumentFile(result.configDir);\n }\n },\n\n async transform(\n this: TransformContext,\n code: string,\n id: string,\n ): Promise<{ code: string; map: unknown } | undefined> {\n if (!wranglerConfig || (!entryFilePath && !entrySpecifier)) return undefined;\n\n // The worker entry never belongs to the client (browser) environment.\n // Skipping it keeps a same-basename sibling (e.g. a `src/index.tsx`\n // client entry next to a `src/index.ts` worker) out of the browser bundle.\n if (this.environment?.name === 'client') return undefined;\n\n const entryPath = entrySpecifier ? await resolveEntrySpecifier(this, entrySpecifier) : entryFilePath;\n if (!entryPath) return undefined;\n\n // Vite may append query/hash params to the module ID.\n const normalizedId = normalizePath(id.replace(/[?#].*$/, ''));\n if (normalizedId !== entryPath) {\n // Tolerate a differing JS-flavored extension (e.g. `.js` vs `.ts`).\n if (!JS_EXTENSION_REGEX.test(normalizedId) || !JS_EXTENSION_REGEX.test(entryPath)) return undefined;\n if (normalizedId.replace(JS_EXTENSION_REGEX, '') !== entryPath.replace(JS_EXTENSION_REGEX, '')) {\n return undefined;\n }\n }\n\n let ast: ProgramBody;\n try {\n ast = this.parse(code);\n } catch {\n // Raw TypeScript or syntax error — esbuild hasn't run yet (unlikely)\n // or the file is genuinely broken. Either way, skip silently.\n return undefined;\n }\n\n const classWrappers = new Map<string, ClassWrapperKind>();\n for (const { className } of wranglerConfig.durableObjects) {\n classWrappers.set(className, 'durableObject');\n }\n for (const { className } of wranglerConfig.workflows) {\n classWrappers.set(className, 'workflow');\n }\n for (const className of wranglerConfig.workerEntrypoints) {\n classWrappers.set(className, 'workerEntrypoint');\n }\n\n // An `agents` Agent is a Durable Object, so wrangler lists it among the DO bindings and only\n // its base-class chain tells the two apart. Detection walks the module graph (base classes\n // usually live in their own file), so it is limited to the configured DO classes.\n //\n // Only `resolve` is handed over — never `load`: awaiting `load()` from inside a transform\n // hook deadlocks the build, since the module can't finish loading while this transform is\n // still pending. `agentClass` reads sibling modules off disk instead.\n const agentCandidates = collectAgentCandidates(\n ast,\n [...classWrappers].filter(([, kind]) => kind === 'durableObject').map(([name]) => name),\n );\n const agentClasses =\n agentCandidates.size > 0\n ? await detectAgentClasses(ast, normalizedId, agentCandidates, {\n parse: code => this.parse(code),\n resolve: this.resolve ? (source, importer) => this.resolve!(source, importer) : undefined,\n })\n : undefined;\n\n // A vinext app with `@sentry/nextjs` installed gets `withSentry` of `@sentry/nextjs/cloudflare`.\n const sentryModule =\n isVinext && (await resolvesNextjsCloudflare(this, normalizedId)) ? NEXTJS_CLOUDFLARE_MODULE : undefined;\n\n const { optionsFn, importStmt: optionsImport } = instrumentFilePath\n ? buildOptionsImport(entryPath, instrumentFilePath)\n : { optionsFn: ENV_FALLBACK_OPTIONS_FN, importStmt: undefined };\n\n // No registration import is injected here: the orchestrion plugin's\n // subscribe-injection makes each bundled package self-register its channel\n // subscriber on the global marker, so wrapping the entry with `withSentry`\n // is all this plugin needs to do.\n const result = applyAutoInstrumentTransforms(code, ast, {\n classWrappers,\n agentClasses,\n optionsFn,\n optionsImport,\n sameWorkerBindings: wranglerConfig.sameWorkerBindings,\n sentryModule,\n });\n\n const wrappedClasses = result?.wrappedClasses ?? new Set<string>();\n const missing = [...classWrappers.keys()].filter(name => !wrappedClasses.has(name));\n if (missing.length > 0) {\n this.warn?.(\n `[sentry] Could not auto-instrument ${missing.join(', ')}.` +\n 'The worker entry has no export matching them. ' +\n 'Star re-exports (`export * from \"./do\"`) are not matched. ' +\n 'Export them by name or wrap them manually with corresponding `instrument*WithSentry` helpers.',\n );\n }\n\n return result ?? undefined;\n },\n };\n}\n"],"names":["wranglerConfig","resolveWranglerConfig","basename","isAbsolute","resolveInstrumentFile","dirname","createIdResolver","collectAgentCandidates","detectAgentClasses","code","buildOptionsImport","ENV_FALLBACK_OPTIONS_FN","applyAutoInstrumentTransforms"],"mappings":";;;;;;;;;AASA,SAAS,cAAc,IAAA,EAAsB;AAC3C,EAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,GAAG,CAAA;AAChC;AAKA,MAAM,kBAAA,GAAqB,iBAAA;AAG3B,MAAM,wBAAA,GAA2B,2BAAA;AAMjC,eAAe,wBAAA,CAAyB,UAA0B,QAAA,EAAoC;AACpG,EAAA,IAAI;AACF,IAAA,OAAO,CAAC,CAAE,MAAM,QAAA,CAAS,OAAA,GAAU,0BAA0B,QAAQ,CAAA;AAAA,EACvE,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF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,UACH,CAAA,mCAAA,EAAsC,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAC,CAAA,0MAAA;AAAA,SAI1D;AAAA,MACF;AAEA,MAAA,OAAO,MAAA,IAAU,MAAA;AAAA,IACnB;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"autoInstrument.js","names":["resolveWranglerConfig","basename","isAbsolute","resolveInstrumentFile","dirname","createIdResolver","collectAgentCandidates","detectAgentClasses","buildOptionsImport","ENV_FALLBACK_OPTIONS_FN","applyAutoInstrumentTransforms"],"sources":["../../../../src/vite/autoInstrument.ts"],"sourcesContent":["import { basename, dirname, isAbsolute } from 'node:path';\nimport { createIdResolver, type ResolvedConfig } from 'vite';\nimport { collectAgentCandidates, detectAgentClasses, type ModuleResolver } from './agentClass';\nimport { buildOptionsImport, ENV_FALLBACK_OPTIONS_FN, resolveInstrumentFile } from './instrumentFile';\nimport { applyAutoInstrumentTransforms, type BaseNode, type ClassWrapperKind, type ProgramBody } from './transform';\nimport { resolveWranglerConfig, type WranglerConfig } from './wranglerConfig';\n\n// Vite normalizes module IDs to posix separators even on Windows, while\n// `path.resolve` yields backslashes there — normalize before comparing.\nfunction normalizePath(path: string): string {\n return path.replace(/\\\\/g, '/');\n}\n\n// Extensions the entry-module match may tolerate swapping (e.g. wrangler's\n// `main` says `.ts` but the served module is `.js`). Anything else — `.css`,\n// `.html`, … — sharing the entry's basename must never be treated as the entry.\nconst JS_EXTENSION_REGEX = /\\.[cm]?[jt]sx?$/;\n\n// Re-exports everything the generated code uses, and adds the Next.js span handling and OpenTelemetry context.\nconst NEXTJS_CLOUDFLARE_MODULE = '@sentry/nextjs/cloudflare';\n\n/**\n * Whether `@sentry/nextjs/cloudflare` resolves from `importer`. Vite throws instead of returning `null` when\n * `@sentry/nextjs` is installed in a version without that entry.\n */\nasync function resolvesNextjsCloudflare(resolver: ModuleResolver, importer: string): Promise<boolean> {\n try {\n return !!(await resolver.resolve?.(NEXTJS_CLOUDFLARE_MODULE, importer));\n } catch {\n return false;\n }\n}\n\n/**\n * Whether the module re-exports everything from another module of its own file, as the shim\n * `@sentry/tanstackstart-react` loads for the server entry does (`export * from \"<entry>?sentry-tunnel-original\"`).\n * That module is transformed as the entry too, and its classes are wrapped there.\n */\nfunction reexportsAllFromSameFile(ast: ProgramBody, normalizedId: string): boolean {\n return ast.body.some(node => {\n if (node.type !== 'ExportAllDeclaration') return false;\n const { exported, source } = node as BaseNode & { exported?: unknown; source?: { value?: unknown } };\n const value = source?.value;\n return !exported && typeof value === 'string' && normalizePath(value.replace(/[?#].*$/, '')) === normalizedId;\n });\n}\n\ntype TransformContext = ModuleResolver & {\n warn?(msg: string): void;\n environment?: Parameters<ReturnType<typeof createIdResolver>>[0];\n};\n\nexport function sentryCloudflareAutoInstrumentPlugin(options: { wranglerConfigPath?: string } = {}) {\n let wranglerConfig: WranglerConfig | undefined;\n let entryFilePath: string | undefined;\n // A `main` that is not a file path (a package export or virtual module).\n let entrySpecifier: string | undefined;\n let wranglerConfigPath: string | undefined;\n let resolveId: ReturnType<typeof createIdResolver> | undefined;\n // Each environment resolves with its own conditions, so the entry may differ between them.\n const resolvedEntries = new Map<string, Promise<string | undefined>>();\n\n let instrumentFilePath: string | undefined;\n let isVinext = false;\n\n function resolveEntrySpecifier(ctx: TransformContext, specifier: string): Promise<string | undefined> {\n const environment = ctx.environment;\n if (!environment || !resolveId) return Promise.resolve(undefined);\n\n let entry = resolvedEntries.get(environment.name);\n if (!entry) {\n // Resolved from the wrangler config, as wrangler does. Without an importer, Vite's resolver\n // tries the specifier as a path below the root first.\n entry = resolveId(environment, specifier, wranglerConfigPath)\n .catch(() => undefined)\n .then(id => {\n if (!id) {\n ctx.warn?.(\n `[sentry] Could not resolve the wrangler \\`main\\` \"${specifier}\". Auto-instrumentation disabled.`,\n );\n return undefined;\n }\n return normalizePath(id.replace(/[?#].*$/, ''));\n });\n resolvedEntries.set(environment.name, entry);\n }\n return entry;\n }\n\n return {\n name: 'sentry-cloudflare-auto-instrument',\n\n configResolved(config: {\n root: string;\n plugins?: readonly { name?: string }[];\n logger?: { warn(msg: string): void };\n }): void {\n isVinext = config.plugins?.some(plugin => plugin.name?.startsWith('vinext:')) ?? false;\n\n const result = resolveWranglerConfig(config.root, options.wranglerConfigPath);\n if (!result) {\n // An explicit path that fails is a misconfiguration worth naming;\n // without one, hint at the option so custom-named configs (e.g. a\n // `configPath` handed to @cloudflare/vite-plugin) are discoverable.\n config.logger?.warn(\n options.wranglerConfigPath\n ? `[sentry] Could not find or parse the wrangler config \"${basename(options.wranglerConfigPath)}\" ` +\n '(resolved against the Vite root) — auto-instrumentation disabled.'\n : '[sentry] No parseable wrangler config found — auto-instrumentation disabled. ' +\n 'Set `wranglerConfigPath` if your config uses a custom name.',\n );\n return;\n }\n\n wranglerConfig = result.config;\n const main = wranglerConfig.main;\n if (main && isAbsolute(main)) {\n // Normalize separators so the entry-module comparison holds on Windows.\n entryFilePath = normalizePath(main);\n instrumentFilePath = resolveInstrumentFile(dirname(main));\n } else if (main) {\n entrySpecifier = main;\n wranglerConfigPath = result.configPath;\n // Not `this.resolve()`: Rollup's commonjs resolver loads the module it resolves, so a\n // resolve of the entry from the entry's own `transform` never finishes.\n resolveId = createIdResolver(config as ResolvedConfig);\n // A package entry has no project directory of its own.\n instrumentFilePath = resolveInstrumentFile(result.configDir);\n }\n },\n\n async transform(\n this: TransformContext,\n code: string,\n id: string,\n ): Promise<{ code: string; map: unknown } | undefined> {\n if (!wranglerConfig || (!entryFilePath && !entrySpecifier)) return undefined;\n\n // The worker entry never belongs to the client (browser) environment.\n // Skipping it keeps a same-basename sibling (e.g. a `src/index.tsx`\n // client entry next to a `src/index.ts` worker) out of the browser bundle.\n if (this.environment?.name === 'client') return undefined;\n\n const entryPath = entrySpecifier ? await resolveEntrySpecifier(this, entrySpecifier) : entryFilePath;\n if (!entryPath) return undefined;\n\n // Vite may append query/hash params to the module ID.\n const normalizedId = normalizePath(id.replace(/[?#].*$/, ''));\n if (normalizedId !== entryPath) {\n // Tolerate a differing JS-flavored extension (e.g. `.js` vs `.ts`).\n if (!JS_EXTENSION_REGEX.test(normalizedId) || !JS_EXTENSION_REGEX.test(entryPath)) return undefined;\n if (normalizedId.replace(JS_EXTENSION_REGEX, '') !== entryPath.replace(JS_EXTENSION_REGEX, '')) {\n return undefined;\n }\n }\n\n let ast: ProgramBody;\n try {\n ast = this.parse(code);\n } catch {\n // Raw TypeScript or syntax error — esbuild hasn't run yet (unlikely)\n // or the file is genuinely broken. Either way, skip silently.\n return undefined;\n }\n\n const classWrappers = new Map<string, ClassWrapperKind>();\n for (const { className } of wranglerConfig.durableObjects) {\n classWrappers.set(className, 'durableObject');\n }\n for (const { className } of wranglerConfig.workflows) {\n classWrappers.set(className, 'workflow');\n }\n for (const className of wranglerConfig.workerEntrypoints) {\n classWrappers.set(className, 'workerEntrypoint');\n }\n\n // An `agents` Agent is a Durable Object, so wrangler lists it among the DO bindings and only\n // its base-class chain tells the two apart. Detection walks the module graph (base classes\n // usually live in their own file), so it is limited to the configured DO classes.\n //\n // Only `resolve` is handed over — never `load`: awaiting `load()` from inside a transform\n // hook deadlocks the build, since the module can't finish loading while this transform is\n // still pending. `agentClass` reads sibling modules off disk instead.\n const agentCandidates = collectAgentCandidates(\n ast,\n [...classWrappers].filter(([, kind]) => kind === 'durableObject').map(([name]) => name),\n );\n const agentClasses =\n agentCandidates.size > 0\n ? await detectAgentClasses(ast, normalizedId, agentCandidates, {\n parse: code => this.parse(code),\n resolve: this.resolve ? (source, importer) => this.resolve!(source, importer) : undefined,\n })\n : undefined;\n\n // A vinext app with `@sentry/nextjs` installed gets `withSentry` of `@sentry/nextjs/cloudflare`.\n const sentryModule =\n isVinext && (await resolvesNextjsCloudflare(this, normalizedId)) ? NEXTJS_CLOUDFLARE_MODULE : undefined;\n\n const { optionsFn, importStmt: optionsImport } = instrumentFilePath\n ? buildOptionsImport(entryPath, instrumentFilePath)\n : { optionsFn: ENV_FALLBACK_OPTIONS_FN, importStmt: undefined };\n\n // No registration import is injected here: the orchestrion plugin's\n // subscribe-injection makes each bundled package self-register its channel\n // subscriber on the global marker, so wrapping the entry with `withSentry`\n // is all this plugin needs to do.\n const result = applyAutoInstrumentTransforms(code, ast, {\n classWrappers,\n agentClasses,\n optionsFn,\n optionsImport,\n sameWorkerBindings: wranglerConfig.sameWorkerBindings,\n sentryModule,\n });\n\n const wrappedClasses = result?.wrappedClasses ?? new Set<string>();\n const missing = [...classWrappers.keys()].filter(name => !wrappedClasses.has(name));\n if (missing.length > 0 && !reexportsAllFromSameFile(ast, normalizedId)) {\n this.warn?.(\n `[sentry] Could not auto-instrument ${missing.join(', ')}. ` +\n 'The worker entry has no export matching them. ' +\n 'Star re-exports (`export * from \"./do\"`) are not matched. ' +\n 'Export them by name or wrap them manually with corresponding `instrument*WithSentry` helpers.',\n );\n }\n\n return result ?? undefined;\n },\n };\n}\n"],"mappings":";;;;;;;AASA,SAAS,cAAc,MAAsB;CAC3C,OAAO,KAAK,QAAQ,OAAO,GAAG;AAChC;AAKA,MAAM,qBAAqB;AAG3B,MAAM,2BAA2B;;;;;AAMjC,eAAe,yBAAyB,UAA0B,UAAoC;CACpG,IAAI;EACF,OAAO,CAAC,CAAE,MAAM,SAAS,UAAU,0BAA0B,QAAQ;CACvE,QAAQ;EACN,OAAO;CACT;AACF;;;;;;AAOA,SAAS,yBAAyB,KAAkB,cAA+B;CACjF,OAAO,IAAI,KAAK,MAAK,SAAQ;EAC3B,IAAI,KAAK,SAAS,wBAAwB,OAAO;EACjD,MAAM,EAAE,UAAU,WAAW;EAC7B,MAAM,QAAQ,QAAQ;EACtB,OAAO,CAAC,YAAY,OAAO,UAAU,YAAY,cAAc,MAAM,QAAQ,WAAW,EAAE,CAAC,MAAM;CACnG,CAAC;AACH;AAOA,SAAgB,qCAAqC,UAA2C,CAAC,GAAG;CAClG,IAAI;CACJ,IAAI;CAEJ,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,MAAM,kCAAkB,IAAI,IAAyC;CA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