@sentry/cloudflare 10.68.0 → 10.70.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 (177) hide show
  1. package/build/cjs/client.js +5 -0
  2. package/build/cjs/client.js.map +1 -1
  3. package/build/cjs/durableobject.js +210 -97
  4. package/build/cjs/durableobject.js.map +1 -1
  5. package/build/cjs/flush.js.map +1 -1
  6. package/build/cjs/index.js +3 -0
  7. package/build/cjs/index.js.map +1 -1
  8. package/build/cjs/instrumentations/agents/index.js +16 -0
  9. package/build/cjs/instrumentations/agents/index.js.map +1 -0
  10. package/build/cjs/instrumentations/agents/instrumentAgentCallableRpc.js +52 -0
  11. package/build/cjs/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -0
  12. package/build/cjs/instrumentations/agents/instrumentAgentRequestConversation.js +19 -0
  13. package/build/cjs/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -0
  14. package/build/cjs/instrumentations/agents/instrumentChatAgentConversation.js +31 -0
  15. package/build/cjs/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -0
  16. package/build/cjs/instrumentations/agents/types.js +77 -0
  17. package/build/cjs/instrumentations/agents/types.js.map +1 -0
  18. package/build/cjs/instrumentations/instrumentDurableObjectStorage.js +6 -0
  19. package/build/cjs/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
  20. package/build/cjs/instrumentations/instrumentSqlStorage.js +1 -1
  21. package/build/cjs/instrumentations/instrumentSqlStorage.js.map +1 -1
  22. package/build/cjs/integrations/spotlight.js +64 -0
  23. package/build/cjs/integrations/spotlight.js.map +1 -0
  24. package/build/cjs/nodejs_compat/index.js +5 -2
  25. package/build/cjs/nodejs_compat/index.js.map +1 -1
  26. package/build/cjs/options.js +14 -1
  27. package/build/cjs/options.js.map +1 -1
  28. package/build/cjs/request.js +3 -2
  29. package/build/cjs/request.js.map +1 -1
  30. package/build/cjs/sdk.js +8 -0
  31. package/build/cjs/sdk.js.map +1 -1
  32. package/build/cjs/utils/internalSqlQuery.js +13 -7
  33. package/build/cjs/utils/internalSqlQuery.js.map +1 -1
  34. package/build/cjs/utils/internalStorageKey.js +44 -0
  35. package/build/cjs/utils/internalStorageKey.js.map +1 -0
  36. package/build/cjs/utils/invocationScope.js +12 -0
  37. package/build/cjs/utils/invocationScope.js.map +1 -0
  38. package/build/cjs/utils/rpcMeta.js +4 -0
  39. package/build/cjs/utils/rpcMeta.js.map +1 -1
  40. package/build/cjs/vite/agentClass.js +114 -0
  41. package/build/cjs/vite/agentClass.js.map +1 -0
  42. package/build/cjs/vite/autoInstrument.js +17 -4
  43. package/build/cjs/vite/autoInstrument.js.map +1 -1
  44. package/build/cjs/vite/index.js +1 -1
  45. package/build/cjs/vite/index.js.map +1 -1
  46. package/build/cjs/vite/moduleShape.js +231 -0
  47. package/build/cjs/vite/moduleShape.js.map +1 -0
  48. package/build/cjs/vite/transform.js +6 -1
  49. package/build/cjs/vite/transform.js.map +1 -1
  50. package/build/cjs/vite/wranglerConfig.js +1 -1
  51. package/build/cjs/vite/wranglerConfig.js.map +1 -1
  52. package/build/cjs/workflows.js +1 -1
  53. package/build/cjs/workflows.js.map +1 -1
  54. package/build/cjs/wrapMethodWithSentry.js +2 -3
  55. package/build/cjs/wrapMethodWithSentry.js.map +1 -1
  56. package/build/esm/client.js +6 -1
  57. package/build/esm/client.js.map +1 -1
  58. package/build/esm/durableobject.js +211 -101
  59. package/build/esm/durableobject.js.map +1 -1
  60. package/build/esm/flush.js.map +1 -1
  61. package/build/esm/index.js +2 -1
  62. package/build/esm/index.js.map +1 -1
  63. package/build/esm/instrumentations/agents/index.js +14 -0
  64. package/build/esm/instrumentations/agents/index.js.map +1 -0
  65. package/build/esm/instrumentations/agents/instrumentAgentCallableRpc.js +50 -0
  66. package/build/esm/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -0
  67. package/build/esm/instrumentations/agents/instrumentAgentRequestConversation.js +17 -0
  68. package/build/esm/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -0
  69. package/build/esm/instrumentations/agents/instrumentChatAgentConversation.js +29 -0
  70. package/build/esm/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -0
  71. package/build/esm/instrumentations/agents/types.js +69 -0
  72. package/build/esm/instrumentations/agents/types.js.map +1 -0
  73. package/build/esm/instrumentations/instrumentDurableObjectStorage.js +7 -1
  74. package/build/esm/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
  75. package/build/esm/instrumentations/instrumentSqlStorage.js +1 -1
  76. package/build/esm/instrumentations/instrumentSqlStorage.js.map +1 -1
  77. package/build/esm/integrations/spotlight.js +61 -0
  78. package/build/esm/integrations/spotlight.js.map +1 -0
  79. package/build/esm/nodejs_compat/index.js +2 -1
  80. package/build/esm/nodejs_compat/index.js.map +1 -1
  81. package/build/esm/options.js +14 -1
  82. package/build/esm/options.js.map +1 -1
  83. package/build/esm/package.json +1 -1
  84. package/build/esm/request.js +4 -3
  85. package/build/esm/request.js.map +1 -1
  86. package/build/esm/sdk.js +8 -0
  87. package/build/esm/sdk.js.map +1 -1
  88. package/build/esm/utils/internalSqlQuery.js +13 -7
  89. package/build/esm/utils/internalSqlQuery.js.map +1 -1
  90. package/build/esm/utils/internalStorageKey.js +41 -0
  91. package/build/esm/utils/internalStorageKey.js.map +1 -0
  92. package/build/esm/utils/invocationScope.js +10 -0
  93. package/build/esm/utils/invocationScope.js.map +1 -0
  94. package/build/esm/utils/rpcMeta.js +4 -1
  95. package/build/esm/utils/rpcMeta.js.map +1 -1
  96. package/build/esm/utils/traceLinks.js +1 -1
  97. package/build/esm/vite/agentClass.js +111 -0
  98. package/build/esm/vite/agentClass.js.map +1 -0
  99. package/build/esm/vite/autoInstrument.js +17 -4
  100. package/build/esm/vite/autoInstrument.js.map +1 -1
  101. package/build/esm/vite/index.js +1 -1
  102. package/build/esm/vite/index.js.map +1 -1
  103. package/build/esm/vite/moduleShape.js +227 -0
  104. package/build/esm/vite/moduleShape.js.map +1 -0
  105. package/build/esm/vite/transform.js +6 -1
  106. package/build/esm/vite/transform.js.map +1 -1
  107. package/build/esm/vite/wranglerConfig.js +1 -1
  108. package/build/esm/vite/wranglerConfig.js.map +1 -1
  109. package/build/esm/workflows.js +2 -2
  110. package/build/esm/workflows.js.map +1 -1
  111. package/build/esm/wrapMethodWithSentry.js +3 -4
  112. package/build/esm/wrapMethodWithSentry.js.map +1 -1
  113. package/build/types/client.d.ts +37 -0
  114. package/build/types/client.d.ts.map +1 -1
  115. package/build/types/durableobject.d.ts +90 -0
  116. package/build/types/durableobject.d.ts.map +1 -1
  117. package/build/types/flush.d.ts +1 -1
  118. package/build/types/flush.d.ts.map +1 -1
  119. package/build/types/index.d.ts +2 -1
  120. package/build/types/index.d.ts.map +1 -1
  121. package/build/types/instrumentations/agents/index.d.ts +25 -0
  122. package/build/types/instrumentations/agents/index.d.ts.map +1 -0
  123. package/build/types/instrumentations/agents/instrumentAgentCallableRpc.d.ts +14 -0
  124. package/build/types/instrumentations/agents/instrumentAgentCallableRpc.d.ts.map +1 -0
  125. package/build/types/instrumentations/agents/instrumentAgentRequestConversation.d.ts +16 -0
  126. package/build/types/instrumentations/agents/instrumentAgentRequestConversation.d.ts.map +1 -0
  127. package/build/types/instrumentations/agents/instrumentChatAgentConversation.d.ts +23 -0
  128. package/build/types/instrumentations/agents/instrumentChatAgentConversation.d.ts.map +1 -0
  129. package/build/types/instrumentations/agents/types.d.ts +94 -0
  130. package/build/types/instrumentations/agents/types.d.ts.map +1 -0
  131. package/build/types/instrumentations/instrumentDurableObjectStorage.d.ts.map +1 -1
  132. package/build/types/integrations/spotlight.d.ts +22 -0
  133. package/build/types/integrations/spotlight.d.ts.map +1 -0
  134. package/build/types/options.d.ts.map +1 -1
  135. package/build/types/request.d.ts.map +1 -1
  136. package/build/types/sdk.d.ts.map +1 -1
  137. package/build/types/utils/internalSqlQuery.d.ts +4 -2
  138. package/build/types/utils/internalSqlQuery.d.ts.map +1 -1
  139. package/build/types/utils/internalStorageKey.d.ts +22 -0
  140. package/build/types/utils/internalStorageKey.d.ts.map +1 -0
  141. package/build/types/utils/invocationScope.d.ts +24 -0
  142. package/build/types/utils/invocationScope.d.ts.map +1 -0
  143. package/build/types/utils/rpcMeta.d.ts +8 -0
  144. package/build/types/utils/rpcMeta.d.ts.map +1 -1
  145. package/build/types/vite/agentClass.d.ts +41 -0
  146. package/build/types/vite/agentClass.d.ts.map +1 -0
  147. package/build/types/vite/autoInstrument.d.ts +7 -6
  148. package/build/types/vite/autoInstrument.d.ts.map +1 -1
  149. package/build/types/vite/index.d.ts +14 -4
  150. package/build/types/vite/index.d.ts.map +1 -1
  151. package/build/types/vite/moduleShape.d.ts +52 -0
  152. package/build/types/vite/moduleShape.d.ts.map +1 -0
  153. package/build/types/vite/transform.d.ts +6 -1
  154. package/build/types/vite/transform.d.ts.map +1 -1
  155. package/build/types/wrapMethodWithSentry.d.ts +1 -1
  156. package/build/types/wrapMethodWithSentry.d.ts.map +1 -1
  157. package/build/types-ts3.8/client.d.ts +37 -0
  158. package/build/types-ts3.8/durableobject.d.ts +90 -0
  159. package/build/types-ts3.8/flush.d.ts +1 -1
  160. package/build/types-ts3.8/index.d.ts +2 -1
  161. package/build/types-ts3.8/instrumentations/agents/index.d.ts +25 -0
  162. package/build/types-ts3.8/instrumentations/agents/instrumentAgentCallableRpc.d.ts +14 -0
  163. package/build/types-ts3.8/instrumentations/agents/instrumentAgentRequestConversation.d.ts +16 -0
  164. package/build/types-ts3.8/instrumentations/agents/instrumentChatAgentConversation.d.ts +23 -0
  165. package/build/types-ts3.8/instrumentations/agents/types.d.ts +94 -0
  166. package/build/types-ts3.8/integrations/spotlight.d.ts +22 -0
  167. package/build/types-ts3.8/utils/internalSqlQuery.d.ts +4 -2
  168. package/build/types-ts3.8/utils/internalStorageKey.d.ts +22 -0
  169. package/build/types-ts3.8/utils/invocationScope.d.ts +24 -0
  170. package/build/types-ts3.8/utils/rpcMeta.d.ts +8 -0
  171. package/build/types-ts3.8/vite/agentClass.d.ts +41 -0
  172. package/build/types-ts3.8/vite/autoInstrument.d.ts +7 -6
  173. package/build/types-ts3.8/vite/index.d.ts +14 -4
  174. package/build/types-ts3.8/vite/moduleShape.d.ts +52 -0
  175. package/build/types-ts3.8/vite/transform.d.ts +6 -1
  176. package/build/types-ts3.8/wrapMethodWithSentry.d.ts +1 -1
  177. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport {\n consoleIntegration,\n conversationIdIntegration,\n dedupeIntegration,\n functionToStringIntegration,\n getIntegrationsToSetup,\n GLOBAL_OBJ,\n inboundFiltersIntegration,\n initAndBind,\n linkedErrorsIntegration,\n requestDataIntegration,\n stackParserFromStackParserOptions,\n} from '@sentry/core';\nimport type { CloudflareClientOptions, CloudflareOptions } from './client';\nimport { CloudflareClient } from './client';\nimport { makeFlushLock } from './flush';\nimport { httpServerIntegration } from './integrations/httpServer';\nimport { fetchIntegration } from './integrations/fetch';\nimport { honoIntegration } from './integrations/hono';\nimport { setupOpenTelemetryTracer } from './opentelemetry/tracer';\nimport { makeCloudflareTransport } from './transport';\nimport { defaultStackParser } from './vendor/stacktrace';\n\n/**\n * Instantiate the channel-subscriber factories the `@sentry/cloudflare/vite`\n * plugin registered on the global marker. The plugin splices a small snippet\n * into each instrumented module that `.set`s its factory here (keyed by export\n * name), so the marker holds one factory per package actually bundled.\n *\n * The marker is read directly instead of importing the factories, so a worker\n * built without the plugin — where the channels never fire — ships none of this\n * code.\n * TODO(v11): Use `@sentry/server-utils/orchestrion` once we move to `nodejs_compat` by default.\n */\nfunction getRegisteredChannelIntegrations(): Integration[] {\n const registered = GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.integrations;\n\n return registered ? [...registered.values()].map(factory => factory()) : [];\n}\n\n/** Get the default integrations for the Cloudflare SDK. */\nexport function getDefaultIntegrations(options: CloudflareOptions): Integration[] {\n // TODO(v11): Drop this transitional gating and let `requestDataIntegration` rely on the resolved\n // `dataCollection` defaults directly. Until then, preserve the historical Cloudflare behavior of not\n // attaching cookies unless the user explicitly opts in via `sendDefaultPii` or `dataCollection.cookies`.\n // eslint-disable-next-line typescript/no-deprecated\n const cookiesEnabled = options.sendDefaultPii || options.dataCollection?.cookies != null;\n return [\n // The Dedupe integration should not be used in workflows because we want to\n // capture all step failures, even if they are the same error.\n ...(options.enableDedupe === false ? [] : [dedupeIntegration()]),\n // TODO(v11): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`\n // eslint-disable-next-line typescript/no-deprecated\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n conversationIdIntegration(),\n linkedErrorsIntegration(),\n fetchIntegration(),\n // eslint-disable-next-line typescript/no-deprecated\n honoIntegration(),\n httpServerIntegration(),\n requestDataIntegration(cookiesEnabled ? undefined : { include: { cookies: false } }),\n consoleIntegration(),\n // The orchestrion diagnostics-channel subscribers (mysql, pg, …). The\n // `@sentry/cloudflare/vite` plugin injects the channels at build time and,\n // next to each, a snippet that registers the matching subscriber factory on\n // the global marker. Read from there instead of importing them so bundles\n // built without the plugin — where the channels would never fire — don't\n // ship the code.\n ...getRegisteredChannelIntegrations(),\n ];\n}\n\n/**\n * Initializes the cloudflare SDK.\n */\nexport function init(options: CloudflareOptions): CloudflareClient | undefined {\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrations(options);\n }\n\n const flushLock = options.ctx ? makeFlushLock(options.ctx) : undefined;\n delete options.ctx;\n\n const clientOptions: CloudflareClientOptions = {\n ...options,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeCloudflareTransport,\n flushLock,\n };\n\n /**\n * The Cloudflare SDK is not OpenTelemetry native, however, we set up some OpenTelemetry compatibility\n * via a custom trace provider.\n * This ensures that any spans emitted via `@opentelemetry/api` will be captured by Sentry.\n * HOWEVER, big caveat: This does not handle custom context handling, it will always work off the current scope.\n * This should be good enough for many, but not all integrations.\n */\n if (!options.skipOpenTelemetrySetup) {\n setupOpenTelemetryTracer();\n }\n\n return initAndBind(CloudflareClient, clientOptions) as CloudflareClient;\n}\n"],"names":["GLOBAL_OBJ","dedupeIntegration","inboundFiltersIntegration","functionToStringIntegration","conversationIdIntegration","linkedErrorsIntegration","fetchIntegration","honoIntegration","httpServerIntegration","requestDataIntegration","consoleIntegration","makeFlushLock","stackParserFromStackParserOptions","defaultStackParser","getIntegrationsToSetup","makeCloudflareTransport","setupOpenTelemetryTracer","initAndBind","CloudflareClient"],"mappings":";;;;;;;;;;;;AAmCA,SAAS,gCAAA,GAAkD;AACzD,EAAA,MAAM,UAAA,GAAaA,gBAAW,sBAAA,EAAwB,YAAA;AAEtD,EAAA,OAAO,UAAA,GAAa,CAAC,GAAG,UAAA,CAAW,MAAA,EAAQ,CAAA,CAAE,GAAA,CAAI,CAAA,OAAA,KAAW,OAAA,EAAS,CAAA,GAAI,EAAC;AAC5E;AAGO,SAAS,uBAAuB,OAAA,EAA2C;AAKhF,EAAA,MAAM,cAAA,GAAiB,OAAA,CAAQ,cAAA,IAAkB,OAAA,CAAQ,gBAAgB,OAAA,IAAW,IAAA;AACpF,EAAA,OAAO;AAAA;AAAA;AAAA,IAGL,GAAI,QAAQ,YAAA,KAAiB,KAAA,GAAQ,EAAC,GAAI,CAACC,wBAAmB,CAAA;AAAA;AAAA;AAAA,IAG9DC,8BAAA,EAA0B;AAAA,IAC1BC,gCAAA,EAA4B;AAAA,IAC5BC,8BAAA,EAA0B;AAAA,IAC1BC,4BAAA,EAAwB;AAAA,IACxBC,sBAAA,EAAiB;AAAA;AAAA,IAEjBC,oBAAA,EAAgB;AAAA,IAChBC,gCAAA,EAAsB;AAAA,IACtBC,2BAAA,CAAuB,iBAAiB,MAAA,GAAY,EAAE,SAAS,EAAE,OAAA,EAAS,KAAA,EAAM,EAAG,CAAA;AAAA,IACnFC,uBAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOnB,GAAG,gCAAA;AAAiC,GACtC;AACF;AAKO,SAAS,KAAK,OAAA,EAA0D;AAC7E,EAAA,IAAI,OAAA,CAAQ,wBAAwB,MAAA,EAAW;AAC7C,IAAA,OAAA,CAAQ,mBAAA,GAAsB,uBAAuB,OAAO,CAAA;AAAA,EAC9D;AAEA,EAAA,MAAM,YAAY,OAAA,CAAQ,GAAA,GAAMC,mBAAA,CAAc,OAAA,CAAQ,GAAG,CAAA,GAAI,MAAA;AAC7D,EAAA,OAAO,OAAA,CAAQ,GAAA;AAEf,EAAA,MAAM,aAAA,GAAyC;AAAA,IAC7C,GAAG,OAAA;AAAA,IACH,WAAA,EAAaC,sCAAA,CAAkC,OAAA,CAAQ,WAAA,IAAeC,6BAAkB,CAAA;AAAA,IACxF,YAAA,EAAcC,4BAAuB,OAAO,CAAA;AAAA,IAC5C,SAAA,EAAW,QAAQ,SAAA,IAAaC,iCAAA;AAAA,IAChC;AAAA,GACF;AASA,EAAA,IAAI,CAAC,QAAQ,sBAAA,EAAwB;AACnC,IAAAC,+BAAA,EAAyB;AAAA,EAC3B;AAEA,EAAA,OAAOC,gBAAA,CAAYC,yBAAkB,aAAa,CAAA;AACpD;;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport {\n consoleIntegration,\n conversationIdIntegration,\n dedupeIntegration,\n functionToStringIntegration,\n getIntegrationsToSetup,\n GLOBAL_OBJ,\n inboundFiltersIntegration,\n initAndBind,\n linkedErrorsIntegration,\n requestDataIntegration,\n stackParserFromStackParserOptions,\n} from '@sentry/core';\nimport type { CloudflareClientOptions, CloudflareOptions } from './client';\nimport { CloudflareClient } from './client';\nimport { makeFlushLock } from './flush';\nimport { httpServerIntegration } from './integrations/httpServer';\nimport { fetchIntegration } from './integrations/fetch';\nimport { honoIntegration } from './integrations/hono';\nimport { INTEGRATION_NAME as SPOTLIGHT_INTEGRATION_NAME, spotlightIntegration } from './integrations/spotlight';\nimport { setupOpenTelemetryTracer } from './opentelemetry/tracer';\nimport { makeCloudflareTransport } from './transport';\nimport { defaultStackParser } from './vendor/stacktrace';\n\n/**\n * Instantiate the channel-subscriber factories the `@sentry/cloudflare/vite`\n * plugin registered on the global marker. The plugin splices a small snippet\n * into each instrumented module that `.set`s its factory here (keyed by export\n * name), so the marker holds one factory per package actually bundled.\n *\n * The marker is read directly instead of importing the factories, so a worker\n * built without the plugin — where the channels never fire — ships none of this\n * code.\n * TODO(v11): Use `@sentry/server-utils/orchestrion` once we move to `nodejs_compat` by default.\n */\nfunction getRegisteredChannelIntegrations(): Integration[] {\n const registered = GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.integrations;\n\n return registered ? [...registered.values()].map(factory => factory()) : [];\n}\n\n/** Get the default integrations for the Cloudflare SDK. */\nexport function getDefaultIntegrations(options: CloudflareOptions): Integration[] {\n // TODO(v11): Drop this transitional gating and let `requestDataIntegration` rely on the resolved\n // `dataCollection` defaults directly. Until then, preserve the historical Cloudflare behavior of not\n // attaching cookies unless the user explicitly opts in via `sendDefaultPii` or `dataCollection.cookies`.\n // eslint-disable-next-line typescript/no-deprecated\n const cookiesEnabled = options.sendDefaultPii || options.dataCollection?.cookies != null;\n return [\n // The Dedupe integration should not be used in workflows because we want to\n // capture all step failures, even if they are the same error.\n ...(options.enableDedupe === false ? [] : [dedupeIntegration()]),\n // TODO(v11): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`\n // eslint-disable-next-line typescript/no-deprecated\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n conversationIdIntegration(),\n linkedErrorsIntegration(),\n fetchIntegration(),\n // eslint-disable-next-line typescript/no-deprecated\n honoIntegration(),\n httpServerIntegration(),\n requestDataIntegration(cookiesEnabled ? undefined : { include: { cookies: false } }),\n consoleIntegration(),\n // The orchestrion diagnostics-channel subscribers (mysql, pg, …). The\n // `@sentry/cloudflare/vite` plugin injects the channels at build time and,\n // next to each, a snippet that registers the matching subscriber factory on\n // the global marker. Read from there instead of importing them so bundles\n // built without the plugin — where the channels would never fire — don't\n // ship the code.\n ...getRegisteredChannelIntegrations(),\n ];\n}\n\n/**\n * Initializes the cloudflare SDK.\n */\nexport function init(options: CloudflareOptions): CloudflareClient | undefined {\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrations(options);\n }\n\n const flushLock = options.ctx ? makeFlushLock(options.ctx) : undefined;\n delete options.ctx;\n\n const clientOptions: CloudflareClientOptions = {\n ...options,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeCloudflareTransport,\n flushLock,\n };\n\n if (options.spotlight && !clientOptions.integrations.some(({ name }) => name === SPOTLIGHT_INTEGRATION_NAME)) {\n clientOptions.integrations.push(\n spotlightIntegration({\n sidecarUrl: typeof options.spotlight === 'string' ? options.spotlight : undefined,\n }),\n );\n }\n\n /**\n * The Cloudflare SDK is not OpenTelemetry native, however, we set up some OpenTelemetry compatibility\n * via a custom trace provider.\n * This ensures that any spans emitted via `@opentelemetry/api` will be captured by Sentry.\n * HOWEVER, big caveat: This does not handle custom context handling, it will always work off the current scope.\n * This should be good enough for many, but not all integrations.\n */\n if (!options.skipOpenTelemetrySetup) {\n setupOpenTelemetryTracer();\n }\n\n return initAndBind(CloudflareClient, clientOptions) as CloudflareClient;\n}\n"],"names":["GLOBAL_OBJ","dedupeIntegration","inboundFiltersIntegration","functionToStringIntegration","conversationIdIntegration","linkedErrorsIntegration","fetchIntegration","honoIntegration","httpServerIntegration","requestDataIntegration","consoleIntegration","makeFlushLock","stackParserFromStackParserOptions","defaultStackParser","getIntegrationsToSetup","makeCloudflareTransport","SPOTLIGHT_INTEGRATION_NAME","spotlightIntegration","setupOpenTelemetryTracer","initAndBind","CloudflareClient"],"mappings":";;;;;;;;;;;;;AAoCA,SAAS,gCAAA,GAAkD;AACzD,EAAA,MAAM,UAAA,GAAaA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CAAA,CAAkC,OAAA,CAAQ,WAAA,IAAeC,6BAAkB,CAAA;AAAA,IACxF,YAAA,EAAcC,4BAAuB,OAAO,CAAA;AAAA,IAC5C,SAAA,EAAW,QAAQ,SAAA,IAAaC,iCAAA;AAAA,IAChC;AAAA,GACF;AAEA,EAAA,IAAI,OAAA,CAAQ,SAAA,IAAa,CAAC,aAAA,CAAc,YAAA,CAAa,IAAA,CAAK,CAAC,EAAE,IAAA,EAAK,KAAM,IAAA,KAASC,0BAA0B,CAAA,EAAG;AAC5G,IAAA,aAAA,CAAc,YAAA,CAAa,IAAA;AAAA,MACzBC,8BAAA,CAAqB;AAAA,QACnB,YAAY,OAAO,OAAA,CAAQ,SAAA,KAAc,QAAA,GAAW,QAAQ,SAAA,GAAY;AAAA,OACzE;AAAA,KACH;AAAA,EACF;AASA,EAAA,IAAI,CAAC,QAAQ,sBAAA,EAAwB;AACnC,IAAAC,+BAAA,EAAyB;AAAA,EAC3B;AAEA,EAAA,OAAOC,gBAAA,CAAYC,yBAAkB,aAAa,CAAA;AACpD;;;;;"}
@@ -2,17 +2,23 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const core = require('@sentry/core');
4
4
 
5
- function targetsCloudflareInternalTable(querySummary, allowlist) {
5
+ function targetsCloudflareInternalTable(querySummary, allowlist, queryText) {
6
6
  if (!querySummary) {
7
7
  return false;
8
8
  }
9
+ const indexedTable = queryText ? CREATE_INDEX_TABLE_RE.exec(queryText)?.groups?.["table"] : void 0;
10
+ if (indexedTable) {
11
+ return isCloudflareInternalTable(indexedTable, allowlist);
12
+ }
9
13
  const [, ...tables] = querySummary.split(" ");
10
- return tables.some((table) => {
11
- if (!table.toLowerCase().startsWith("cf_")) {
12
- return false;
13
- }
14
- return !allowlist?.length || !core.stringMatchesSomePattern(table, allowlist, true);
15
- });
14
+ return tables.some((table) => isCloudflareInternalTable(table, allowlist));
15
+ }
16
+ const CREATE_INDEX_TABLE_RE = /^\s*CREATE\s+(?:UNIQUE\s+)?INDEX(?:\s+IF\s+(?:NOT\s+)?EXISTS)?\s+[^\s(,;)]+\s+ON\s+(?<table>[^\s(,;)]+)/i;
17
+ function isCloudflareInternalTable(table, allowlist) {
18
+ if (!table.toLowerCase().startsWith("cf_")) {
19
+ return false;
20
+ }
21
+ return !allowlist?.length || !core.stringMatchesSomePattern(table, allowlist, true);
16
22
  }
17
23
 
18
24
  exports.targetsCloudflareInternalTable = targetsCloudflareInternalTable;
@@ -1 +1 @@
1
- {"version":3,"file":"internalSqlQuery.js","sources":["../../../src/utils/internalSqlQuery.ts"],"sourcesContent":["import { stringMatchesSomePattern } from '@sentry/core';\n\n/**\n * Cloudflare frameworks that build on Durable Objects (`agents`, `partyserver`, ...) manage their\n * own internal SQLite tables, all namespaced with a `cf_` prefix — e.g. `cf_agents_schedules`,\n * `cf_agent_state`, `cf_ai_chat_stream_chunks`. Queries against them (schedule polling, chat-stream\n * persistence, state bookkeeping) are framework implementation details that otherwise flood traces\n * with dozens of zero-signal `db.query` spans per request. The exact set of tables even varies\n * between framework versions, so we match the reserved prefix rather than an enumerated list.\n *\n * The `cf_` prefix is a reserved convention for framework-managed tables, so user tables should not\n * use it. In case a user table does collide with the prefix, the `durableObjectSqlSpanAllowlist`\n * option lets them opt those tables back into instrumentation.\n *\n * The check operates on the query summary produced by `getSqlQuerySummary` (`{operation} {table} ...`,\n * the same value used as the span name), so table targets are already isolated from the rest of the\n * query.\n */\nexport function targetsCloudflareInternalTable(\n querySummary: string | undefined,\n allowlist?: Array<string | RegExp>,\n): boolean {\n if (!querySummary) {\n return false;\n }\n\n const [, ...tables] = querySummary.split(' ');\n\n return tables.some(table => {\n if (!table.toLowerCase().startsWith('cf_')) {\n return false;\n }\n\n // A table on the allowlist is treated as a user table and stays instrumented, even though it\n // matches the reserved prefix.\n return !allowlist?.length || !stringMatchesSomePattern(table, allowlist, true);\n });\n}\n"],"names":["stringMatchesSomePattern"],"mappings":";;;;AAkBO,SAAS,8BAAA,CACd,cACA,SAAA,EACS;AACT,EAAA,IAAI,CAAC,YAAA,EAAc;AACjB,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,GAAG,GAAG,MAAM,CAAA,GAAI,YAAA,CAAa,MAAM,GAAG,CAAA;AAE5C,EAAA,OAAO,MAAA,CAAO,KAAK,CAAA,KAAA,KAAS;AAC1B,IAAA,IAAI,CAAC,KAAA,CAAM,WAAA,EAAY,CAAE,UAAA,CAAW,KAAK,CAAA,EAAG;AAC1C,MAAA,OAAO,KAAA;AAAA,IACT;AAIA,IAAA,OAAO,CAAC,SAAA,EAAW,MAAA,IAAU,CAACA,6BAAA,CAAyB,KAAA,EAAO,WAAW,IAAI,CAAA;AAAA,EAC/E,CAAC,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"internalSqlQuery.js","sources":["../../../src/utils/internalSqlQuery.ts"],"sourcesContent":["import { stringMatchesSomePattern } from '@sentry/core';\n\n/**\n * Cloudflare frameworks that build on Durable Objects (`agents`, `partyserver`, ...) manage their\n * own internal SQLite tables, all namespaced with a `cf_` prefix — e.g. `cf_agents_schedules`,\n * `cf_agent_state`, `cf_ai_chat_stream_chunks`. Queries against them (schedule polling, chat-stream\n * persistence, state bookkeeping) are framework implementation details that otherwise flood traces\n * with dozens of zero-signal `db.query` spans per request. The exact set of tables even varies\n * between framework versions, so we match the reserved prefix rather than an enumerated list.\n *\n * The `cf_` prefix is a reserved convention for framework-managed tables, so user tables should not\n * use it. In case a user table does collide with the prefix, the `durableObjectSqlSpanAllowlist`\n * option lets them opt those tables back into instrumentation.\n *\n * The check operates on the query summary produced by `getSqlQuerySummary` (`{operation} {table} ...`,\n * the same value used as the span name), so table targets are already isolated from the rest of the\n * query. The one exception is `CREATE INDEX`: its summary carries the index name, not the indexed\n * table (upstream OTel convention), so the `cf_` target only appears in the ON clause of the full\n * statement, which `queryText` is needed for.\n */\nexport function targetsCloudflareInternalTable(\n querySummary: string | undefined,\n allowlist?: Array<string | RegExp>,\n queryText?: string,\n): boolean {\n if (!querySummary) {\n return false;\n }\n\n const indexedTable = queryText ? CREATE_INDEX_TABLE_RE.exec(queryText)?.groups?.['table'] : undefined;\n if (indexedTable) {\n return isCloudflareInternalTable(indexedTable, allowlist);\n }\n\n const [, ...tables] = querySummary.split(' ');\n\n return tables.some(table => isCloudflareInternalTable(table, allowlist));\n}\n\n// `CREATE [UNIQUE] INDEX [IF NOT EXISTS] <name> ON <table>` — the IF EXISTS shape mirrors DDL_RE\n// in @sentry/core.\nconst CREATE_INDEX_TABLE_RE =\n /^\\s*CREATE\\s+(?:UNIQUE\\s+)?INDEX(?:\\s+IF\\s+(?:NOT\\s+)?EXISTS)?\\s+[^\\s(,;)]+\\s+ON\\s+(?<table>[^\\s(,;)]+)/i;\n\nfunction isCloudflareInternalTable(table: string, allowlist?: Array<string | RegExp>): boolean {\n if (!table.toLowerCase().startsWith('cf_')) {\n return false;\n }\n\n // A table on the allowlist is treated as a user table and stays instrumented, even though it\n // matches the reserved prefix.\n return !allowlist?.length || !stringMatchesSomePattern(table, allowlist, true);\n}\n"],"names":["stringMatchesSomePattern"],"mappings":";;;;AAoBO,SAAS,8BAAA,CACd,YAAA,EACA,SAAA,EACA,SAAA,EACS;AACT,EAAA,IAAI,CAAC,YAAA,EAAc;AACjB,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,YAAA,GAAe,YAAY,qBAAA,CAAsB,IAAA,CAAK,SAAS,CAAA,EAAG,MAAA,GAAS,OAAO,CAAA,GAAI,MAAA;AAC5F,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,OAAO,yBAAA,CAA0B,cAAc,SAAS,CAAA;AAAA,EAC1D;AAEA,EAAA,MAAM,GAAG,GAAG,MAAM,CAAA,GAAI,YAAA,CAAa,MAAM,GAAG,CAAA;AAE5C,EAAA,OAAO,OAAO,IAAA,CAAK,CAAA,KAAA,KAAS,yBAAA,CAA0B,KAAA,EAAO,SAAS,CAAC,CAAA;AACzE;AAIA,MAAM,qBAAA,GACJ,0GAAA;AAEF,SAAS,yBAAA,CAA0B,OAAe,SAAA,EAA6C;AAC7F,EAAA,IAAI,CAAC,KAAA,CAAM,WAAA,EAAY,CAAE,UAAA,CAAW,KAAK,CAAA,EAAG;AAC1C,IAAA,OAAO,KAAA;AAAA,EACT;AAIA,EAAA,OAAO,CAAC,SAAA,EAAW,MAAA,IAAU,CAACA,6BAAA,CAAyB,KAAA,EAAO,WAAW,IAAI,CAAA;AAC/E;;;;"}
@@ -0,0 +1,44 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const core = require('@sentry/core');
4
+
5
+ function targetsCloudflareInternalKey(key, allowlist) {
6
+ if (!key) {
7
+ return false;
8
+ }
9
+ const isFrameworkKey = key.startsWith("cf_") || key.startsWith("cf:") || key.startsWith("__ps_") || key.startsWith("/");
10
+ if (!isFrameworkKey) {
11
+ return false;
12
+ }
13
+ return !allowlist?.length || !core.stringMatchesSomePattern(key, allowlist, true);
14
+ }
15
+ function getStorageKeys(methodName, args) {
16
+ const [first] = args;
17
+ if (methodName === "get" || methodName === "delete") {
18
+ if (typeof first === "string") {
19
+ return [first];
20
+ }
21
+ if (Array.isArray(first)) {
22
+ return first.filter((k) => typeof k === "string");
23
+ }
24
+ return void 0;
25
+ }
26
+ if (methodName === "put") {
27
+ if (typeof first === "string") {
28
+ return [first];
29
+ }
30
+ if (first && typeof first === "object" && !Array.isArray(first)) {
31
+ return Object.keys(first);
32
+ }
33
+ return void 0;
34
+ }
35
+ if (methodName === "list") {
36
+ const prefix = first && typeof first === "object" ? first.prefix : void 0;
37
+ return typeof prefix === "string" ? [prefix] : void 0;
38
+ }
39
+ return void 0;
40
+ }
41
+
42
+ exports.getStorageKeys = getStorageKeys;
43
+ exports.targetsCloudflareInternalKey = targetsCloudflareInternalKey;
44
+ //# sourceMappingURL=internalStorageKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internalStorageKey.js","sources":["../../../src/utils/internalStorageKey.ts"],"sourcesContent":["import { stringMatchesSomePattern } from '@sentry/core';\n\n/**\n * Cloudflare frameworks that build on Durable Objects (`agents`, `partyserver`, ...) also manage\n * their own internal KV entries alongside their internal SQLite tables, namespaced with a reserved\n * prefix — e.g. `cf_agents_state`, `cf_agents_mcp_servers`, `__ps_name`. Reads/writes of these\n * (message persistence, MCP connection bookkeeping, name hydration) are framework implementation\n * details that otherwise flood traces with dozens of zero-signal `durable_object_storage_*` spans\n * per request, so we match the reserved prefixes rather than an enumerated list. This mirrors the\n * `cf_` convention used for internal SQL tables (see `targetsCloudflareInternalTable`).\n *\n * The prefixes are a reserved convention for framework-managed entries, so user keys should not use\n * them. In case a user key does collide, the `durableObjectStorageSpanAllowlist` option lets them\n * opt those keys back into instrumentation.\n */\nexport function targetsCloudflareInternalKey(key: string | undefined, allowlist?: Array<string | RegExp>): boolean {\n if (!key) {\n return false;\n }\n\n // Framework-managed KV namespaces:\n // - `cf_` — agents / ai-chat internal state (mirrors the internal SQL table convention)\n // - `cf:` — agents chat-recovery entries (`cf:chat-recovery:*`, `cf:chat:*`); the same reserved\n // `cf` namespace, but colon-separated instead of underscore-separated\n // - `__ps_` — partyserver internals (e.g. `__ps_name`)\n // - `/` — MCP OAuth client state (`/<clientName>/<serverId>/{token,client_info,state,...}`),\n // read on every MCP tool call. User keys on an Agent rarely use a leading slash; if one does,\n // the allowlist opts it back in.\n const isFrameworkKey =\n key.startsWith('cf_') || key.startsWith('cf:') || key.startsWith('__ps_') || key.startsWith('/');\n if (!isFrameworkKey) {\n return false;\n }\n\n // A key on the allowlist is treated as a user key and stays instrumented, even though it matches\n // a reserved prefix.\n return !allowlist?.length || !stringMatchesSomePattern(key, allowlist, true);\n}\n\n/**\n * Extracts the KV keys a Durable Object storage call targets, so the caller can decide whether the\n * operation only touches framework-internal entries. Returns `undefined` when the keys can't be\n * determined from the arguments (e.g. `list()` without a prefix), in which case the call is treated\n * as user work and stays instrumented.\n */\nexport function getStorageKeys(methodName: string, args: unknown[]): string[] | undefined {\n const [first] = args;\n\n if (methodName === 'get' || methodName === 'delete') {\n // get(key) / get(keys[]) / delete(key) / delete(keys[])\n if (typeof first === 'string') {\n return [first];\n }\n if (Array.isArray(first)) {\n return first.filter((k): k is string => typeof k === 'string');\n }\n return undefined;\n }\n\n if (methodName === 'put') {\n // put(key, value) or put({ key: value, ... })\n if (typeof first === 'string') {\n return [first];\n }\n if (first && typeof first === 'object' && !Array.isArray(first)) {\n return Object.keys(first);\n }\n return undefined;\n }\n\n if (methodName === 'list') {\n // list({ prefix })\n const prefix = first && typeof first === 'object' ? (first as { prefix?: unknown }).prefix : undefined;\n return typeof prefix === 'string' ? [prefix] : undefined;\n }\n\n return undefined;\n}\n"],"names":["stringMatchesSomePattern"],"mappings":";;;;AAeO,SAAS,4BAAA,CAA6B,KAAyB,SAAA,EAA6C;AACjH,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,OAAO,KAAA;AAAA,EACT;AAUA,EAAA,MAAM,cAAA,GACJ,GAAA,CAAI,UAAA,CAAW,KAAK,KAAK,GAAA,CAAI,UAAA,CAAW,KAAK,CAAA,IAAK,IAAI,UAAA,CAAW,OAAO,CAAA,IAAK,GAAA,CAAI,WAAW,GAAG,CAAA;AACjG,EAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,IAAA,OAAO,KAAA;AAAA,EACT;AAIA,EAAA,OAAO,CAAC,SAAA,EAAW,MAAA,IAAU,CAACA,6BAAA,CAAyB,GAAA,EAAK,WAAW,IAAI,CAAA;AAC7E;AAQO,SAAS,cAAA,CAAe,YAAoB,IAAA,EAAuC;AACxF,EAAA,MAAM,CAAC,KAAK,CAAA,GAAI,IAAA;AAEhB,EAAA,IAAI,UAAA,KAAe,KAAA,IAAS,UAAA,KAAe,QAAA,EAAU;AAEnD,IAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,MAAA,OAAO,CAAC,KAAK,CAAA;AAAA,IACf;AACA,IAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,MAAA,OAAO,MAAM,MAAA,CAAO,CAAC,CAAA,KAAmB,OAAO,MAAM,QAAQ,CAAA;AAAA,IAC/D;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,IAAI,eAAe,KAAA,EAAO;AAExB,IAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,MAAA,OAAO,CAAC,KAAK,CAAA;AAAA,IACf;AACA,IAAA,IAAI,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC/D,MAAA,OAAO,MAAA,CAAO,KAAK,KAAK,CAAA;AAAA,IAC1B;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,IAAI,eAAe,MAAA,EAAQ;AAEzB,IAAA,MAAM,SAAS,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,GAAY,MAA+B,MAAA,GAAS,MAAA;AAC7F,IAAA,OAAO,OAAO,MAAA,KAAW,QAAA,GAAW,CAAC,MAAM,CAAA,GAAI,MAAA;AAAA,EACjD;AAEA,EAAA,OAAO,MAAA;AACT;;;;;"}
@@ -0,0 +1,12 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const core = require('@sentry/core');
4
+
5
+ function withInvocationIsolationScope(callback) {
6
+ const isolationScope = core.getIsolationScope();
7
+ const newIsolationScope = isolationScope === core.getDefaultIsolationScope() ? isolationScope.clone() : isolationScope;
8
+ return core.withIsolationScope(newIsolationScope, () => callback(newIsolationScope));
9
+ }
10
+
11
+ exports.withInvocationIsolationScope = withInvocationIsolationScope;
12
+ //# sourceMappingURL=invocationScope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invocationScope.js","sources":["../../../src/utils/invocationScope.ts"],"sourcesContent":["import { getDefaultIsolationScope, getIsolationScope, type Scope, withIsolationScope } from '@sentry/core';\n\n/**\n * Runs `callback` on the isolation scope for the current invocation.\n *\n * An instrumented handler is either the entry point of an invocation or reentrant — reached from\n * another instrumented handler already serving the same invocation (a Durable Object method calling\n * its own `fetch`, an RPC method reaching a sibling method). Only the entry point may fork:\n *\n * - Forking at the entry point is mandatory. `setUser`/`setTag` write to the isolation scope, and a\n * Durable Object's isolation scope outlives the invocation that touched it, so without a fork one\n * invocation's user and tags reappear on the next invocation's events in the same isolate.\n * Forking clones, so request data set by an enclosing wrapper is still inherited.\n * - Forking again when reentrant would be wrong. Everything below the entry point is one logical\n * unit of work: a nested call must see what the caller set and be able to add to it, the way it\n * would if the SDK were not wrapping it at all.\n *\n * The AsyncLocalStorage strategy hands the default isolation scope back whenever no invocation is in\n * flight, and a forked one while inside `withIsolationScope`. Reference-comparing against the default\n * is therefore enough to tell the two cases apart. The stack fallback does not fork, so it reports the\n * default scope even inside an invocation; there the fork degrades to a no-op, which the stack strategy\n * tolerates. This matches the approach used by `patchEventHandler` in Nuxt.\n */\nexport function withInvocationIsolationScope<T>(callback: (scope: Scope) => T): T {\n const isolationScope = getIsolationScope();\n\n const newIsolationScope = isolationScope === getDefaultIsolationScope() ? isolationScope.clone() : isolationScope;\n\n return withIsolationScope(newIsolationScope, () => callback(newIsolationScope));\n}\n"],"names":["getIsolationScope","getDefaultIsolationScope","withIsolationScope"],"mappings":";;;;AAuBO,SAAS,6BAAgC,QAAA,EAAkC;AAChF,EAAA,MAAM,iBAAiBA,sBAAA,EAAkB;AAEzC,EAAA,MAAM,oBAAoB,cAAA,KAAmBC,6BAAA,EAAyB,GAAI,cAAA,CAAe,OAAM,GAAI,cAAA;AAEnG,EAAA,OAAOC,uBAAA,CAAmB,iBAAA,EAAmB,MAAM,QAAA,CAAS,iBAAiB,CAAC,CAAA;AAChF;;;;"}
@@ -16,6 +16,9 @@ function appendRpcMeta(args) {
16
16
  }
17
17
  return [...args, { [SENTRY_RPC_META_KEY]: traceData }];
18
18
  }
19
+ function hasRpcMeta(args) {
20
+ return args.length > 0 && isSentryRpcMeta(args[args.length - 1]);
21
+ }
19
22
  function extractRpcMeta(args) {
20
23
  if (args.length === 0) {
21
24
  return { args };
@@ -32,4 +35,5 @@ function extractRpcMeta(args) {
32
35
 
33
36
  exports.appendRpcMeta = appendRpcMeta;
34
37
  exports.extractRpcMeta = extractRpcMeta;
38
+ exports.hasRpcMeta = hasRpcMeta;
35
39
  //# sourceMappingURL=rpcMeta.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rpcMeta.js","sources":["../../../src/utils/rpcMeta.ts"],"sourcesContent":["import { getTraceData, isObjectLike, type SerializedTraceData } from '@sentry/core';\n\n/**\n * Key used to identify Sentry RPC metadata in a trailing argument.\n * This enables transparent trace propagation across Cloudflare Workers RPC\n * calls (Cap'n Proto), which have no native header/metadata support.\n */\nconst SENTRY_RPC_META_KEY = '__sentry_rpc_meta__';\n\ninterface SentryRpcMeta {\n __sentry_rpc_meta__: SerializedTraceData;\n}\n\nfunction isSentryRpcMeta(value: unknown): value is SentryRpcMeta {\n if (!isObjectLike(value) || !(SENTRY_RPC_META_KEY in value)) {\n return false;\n }\n return isObjectLike(value[SENTRY_RPC_META_KEY]);\n}\n\n/**\n * Appends Sentry RPC metadata to an args array for trace propagation.\n * If no active trace exists, returns the original args unchanged.\n */\nexport function appendRpcMeta(args: unknown[]): unknown[] {\n const traceData = getTraceData();\n\n if (!traceData['sentry-trace']) {\n return args;\n }\n\n return [...args, { [SENTRY_RPC_META_KEY]: traceData }];\n}\n\n/**\n * Extracts Sentry RPC metadata from the trailing argument of an args array.\n * Returns cleaned args (without meta) and the extracted trace data if found.\n */\nexport function extractRpcMeta<T extends unknown[]>(\n args: T,\n): {\n args: T;\n rpcMeta?: SerializedTraceData;\n} {\n if (args.length === 0) {\n return { args };\n }\n\n const last = args[args.length - 1];\n if (isSentryRpcMeta(last)) {\n return {\n args: args.slice(0, -1) as T,\n rpcMeta: last.__sentry_rpc_meta__,\n };\n }\n\n return { args };\n}\n"],"names":["isObjectLike","getTraceData"],"mappings":";;;;AAOA,MAAM,mBAAA,GAAsB,qBAAA;AAM5B,SAAS,gBAAgB,KAAA,EAAwC;AAC/D,EAAA,IAAI,CAACA,iBAAA,CAAa,KAAK,CAAA,IAAK,EAAE,uBAAuB,KAAA,CAAA,EAAQ;AAC3D,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAOA,iBAAA,CAAa,KAAA,CAAM,mBAAmB,CAAC,CAAA;AAChD;AAMO,SAAS,cAAc,IAAA,EAA4B;AACxD,EAAA,MAAM,YAAYC,iBAAA,EAAa;AAE/B,EAAA,IAAI,CAAC,SAAA,CAAU,cAAc,CAAA,EAAG;AAC9B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,CAAC,GAAG,IAAA,EAAM,EAAE,CAAC,mBAAmB,GAAG,WAAW,CAAA;AACvD;AAMO,SAAS,eACd,IAAA,EAIA;AACA,EAAA,IAAI,IAAA,CAAK,WAAW,CAAA,EAAG;AACrB,IAAA,OAAO,EAAE,IAAA,EAAK;AAAA,EAChB;AAEA,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,IAAA,CAAK,MAAA,GAAS,CAAC,CAAA;AACjC,EAAA,IAAI,eAAA,CAAgB,IAAI,CAAA,EAAG;AACzB,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,EAAE,CAAA;AAAA,MACtB,SAAS,IAAA,CAAK;AAAA,KAChB;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,IAAA,EAAK;AAChB;;;;;"}
1
+ {"version":3,"file":"rpcMeta.js","sources":["../../../src/utils/rpcMeta.ts"],"sourcesContent":["import { getTraceData, isObjectLike, type SerializedTraceData } from '@sentry/core';\n\n/**\n * Key used to identify Sentry RPC metadata in a trailing argument.\n * This enables transparent trace propagation across Cloudflare Workers RPC\n * calls (Cap'n Proto), which have no native header/metadata support.\n */\nconst SENTRY_RPC_META_KEY = '__sentry_rpc_meta__';\n\ninterface SentryRpcMeta {\n __sentry_rpc_meta__: SerializedTraceData;\n}\n\nfunction isSentryRpcMeta(value: unknown): value is SentryRpcMeta {\n if (!isObjectLike(value) || !(SENTRY_RPC_META_KEY in value)) {\n return false;\n }\n return isObjectLike(value[SENTRY_RPC_META_KEY]);\n}\n\n/**\n * Appends Sentry RPC metadata to an args array for trace propagation.\n * If no active trace exists, returns the original args unchanged.\n */\nexport function appendRpcMeta(args: unknown[]): unknown[] {\n const traceData = getTraceData();\n\n if (!traceData['sentry-trace']) {\n return args;\n }\n\n return [...args, { [SENTRY_RPC_META_KEY]: traceData }];\n}\n\n/**\n * Whether the trailing argument carries Sentry RPC metadata.\n *\n * Separate from {@link extractRpcMeta} because the RPC method wrappers run this check on every\n * call — including the instance's own internal method calls, which never carry metadata — and\n * must not allocate on that path.\n */\nexport function hasRpcMeta(args: unknown[]): boolean {\n return args.length > 0 && isSentryRpcMeta(args[args.length - 1]);\n}\n\n/**\n * Extracts Sentry RPC metadata from the trailing argument of an args array.\n * Returns cleaned args (without meta) and the extracted trace data if found.\n */\nexport function extractRpcMeta<T extends unknown[]>(\n args: T,\n): {\n args: T;\n rpcMeta?: SerializedTraceData;\n} {\n if (args.length === 0) {\n return { args };\n }\n\n const last = args[args.length - 1];\n if (isSentryRpcMeta(last)) {\n return {\n args: args.slice(0, -1) as T,\n rpcMeta: last.__sentry_rpc_meta__,\n };\n }\n\n return { args };\n}\n"],"names":["isObjectLike","getTraceData"],"mappings":";;;;AAOA,MAAM,mBAAA,GAAsB,qBAAA;AAM5B,SAAS,gBAAgB,KAAA,EAAwC;AAC/D,EAAA,IAAI,CAACA,iBAAA,CAAa,KAAK,CAAA,IAAK,EAAE,uBAAuB,KAAA,CAAA,EAAQ;AAC3D,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAOA,iBAAA,CAAa,KAAA,CAAM,mBAAmB,CAAC,CAAA;AAChD;AAMO,SAAS,cAAc,IAAA,EAA4B;AACxD,EAAA,MAAM,YAAYC,iBAAA,EAAa;AAE/B,EAAA,IAAI,CAAC,SAAA,CAAU,cAAc,CAAA,EAAG;AAC9B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,CAAC,GAAG,IAAA,EAAM,EAAE,CAAC,mBAAmB,GAAG,WAAW,CAAA;AACvD;AASO,SAAS,WAAW,IAAA,EAA0B;AACnD,EAAA,OAAO,IAAA,CAAK,SAAS,CAAA,IAAK,eAAA,CAAgB,KAAK,IAAA,CAAK,MAAA,GAAS,CAAC,CAAC,CAAA;AACjE;AAMO,SAAS,eACd,IAAA,EAIA;AACA,EAAA,IAAI,IAAA,CAAK,WAAW,CAAA,EAAG;AACrB,IAAA,OAAO,EAAE,IAAA,EAAK;AAAA,EAChB;AAEA,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,IAAA,CAAK,MAAA,GAAS,CAAC,CAAA;AACjC,EAAA,IAAI,eAAA,CAAgB,IAAI,CAAA,EAAG;AACzB,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,EAAE,CAAA;AAAA,MACtB,SAAS,IAAA,CAAK;AAAA,KAChB;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,IAAA,EAAK;AAChB;;;;;;"}
@@ -0,0 +1,114 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const node_fs = require('node:fs');
4
+ const moduleShape = require('./moduleShape.js');
5
+
6
+ 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"])
11
+ };
12
+ const MAX_DEPTH = 8;
13
+ 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;
22
+ }
23
+ function collectAgentCandidates(ast, configuredNames) {
24
+ const shape = moduleShape.shapeFromAst(ast);
25
+ const candidates = /* @__PURE__ */ new Set();
26
+ for (const configured of configuredNames) {
27
+ if (shape.classes.has(configured)) {
28
+ candidates.add(configured);
29
+ }
30
+ const local = shape.localExports.get(configured);
31
+ if (local && shape.classes.has(local)) {
32
+ candidates.add(local);
33
+ }
34
+ }
35
+ return candidates;
36
+ }
37
+ async function isAgentBinding(ctx, moduleId, name, depth, visited) {
38
+ if (depth > MAX_DEPTH) return false;
39
+ const key = `${moduleId} ${name}`;
40
+ if (visited.has(key)) return false;
41
+ visited.add(key);
42
+ const shape = await getModuleShape(ctx, moduleId);
43
+ if (!shape) return false;
44
+ if (shape.classes.has(name)) {
45
+ return extendsAgent(ctx, shape, moduleId, shape.classes.get(name), depth, visited);
46
+ }
47
+ const imported = shape.imports.get(name);
48
+ if (imported) {
49
+ return followImport(ctx, moduleId, imported.source, imported.imported, depth, visited);
50
+ }
51
+ if (name === moduleShape.DEFAULT_EXPORT) {
52
+ if (shape.defaultExportIsClass) {
53
+ return extendsAgent(ctx, shape, moduleId, shape.defaultExportSuper, depth, visited);
54
+ }
55
+ if (shape.defaultExportName) {
56
+ return isAgentBinding(ctx, moduleId, shape.defaultExportName, depth + 1, visited);
57
+ }
58
+ }
59
+ const localName = shape.localExports.get(name);
60
+ if (localName) {
61
+ return isAgentBinding(ctx, moduleId, localName, depth + 1, visited);
62
+ }
63
+ const reexport = shape.reexports.get(name);
64
+ if (reexport) {
65
+ return followImport(ctx, moduleId, reexport.source, reexport.imported, depth, visited);
66
+ }
67
+ for (const source of shape.starExports) {
68
+ if (await followImport(ctx, moduleId, source, name, depth, visited)) {
69
+ return true;
70
+ }
71
+ }
72
+ return false;
73
+ }
74
+ async function extendsAgent(ctx, shape, moduleId, superClass, depth, visited) {
75
+ if (!superClass) return false;
76
+ if (superClass.kind === "identifier") {
77
+ return isAgentBinding(ctx, moduleId, superClass.name, depth + 1, visited);
78
+ }
79
+ const source = shape.namespaces.get(superClass.object);
80
+ if (source) {
81
+ return followImport(ctx, moduleId, source, superClass.property, depth, visited);
82
+ }
83
+ return false;
84
+ }
85
+ async function followImport(ctx, importerId, source, importedName, depth, visited) {
86
+ if (AGENT_BASE_CLASSES[source]?.has(importedName)) return true;
87
+ if (!ctx.resolver.resolve) return false;
88
+ let resolved;
89
+ try {
90
+ resolved = await ctx.resolver.resolve(source, importerId);
91
+ } catch {
92
+ return false;
93
+ }
94
+ if (!resolved?.id) return false;
95
+ if (resolved.id.includes("/node_modules/") || resolved.id.includes("\\node_modules\\")) return false;
96
+ return isAgentBinding(ctx, resolved.id, importedName, depth + 1, visited);
97
+ }
98
+ async function getModuleShape(ctx, moduleId) {
99
+ if (ctx.modules.has(moduleId)) return ctx.modules.get(moduleId);
100
+ let shape;
101
+ try {
102
+ const code = ctx.resolver.readFile ? ctx.resolver.readFile(moduleId) : node_fs.readFileSync(moduleId.replace(/[?#].*$/, ""), "utf8");
103
+ if (typeof code === "string") {
104
+ shape = moduleShape.shapeFromSource(code);
105
+ }
106
+ } catch {
107
+ }
108
+ ctx.modules.set(moduleId, shape);
109
+ return shape;
110
+ }
111
+
112
+ exports.collectAgentCandidates = collectAgentCandidates;
113
+ exports.detectAgentClasses = detectAgentClasses;
114
+ //# sourceMappingURL=agentClass.js.map
@@ -0,0 +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 local class names in the entry that a configured class name could refer to — either declared\n * under that name directly, or aliased to it by an `export { Local as Configured }` specifier.\n *\n * Keeps detection (which reads and scans other modules) off classes that 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 for (const configured of configuredNames) {\n if (shape.classes.has(configured)) {\n candidates.add(configured);\n }\n const local = shape.localExports.get(configured);\n if (local && shape.classes.has(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,UAAA,EAAY;AAG7B,IAAA,IAAI,MAAM,eAAe,GAAA,EAAK,OAAA,EAAS,MAAM,CAAA,kBAAG,IAAI,GAAA,EAAK,CAAA,EAAG;AAC1D,MAAA,QAAA,CAAS,IAAI,IAAI,CAAA;AAAA,IACnB;AAAA,EACF;AACA,EAAA,OAAO,QAAA;AACT;AAQO,SAAS,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I,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,5 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
+ const node_path = require('node:path');
4
+ const agentClass = require('./agentClass.js');
3
5
  const instrumentFile = require('./instrumentFile.js');
4
6
  const transform = require('./transform.js');
5
7
  const wranglerConfig = require('./wranglerConfig.js');
@@ -8,7 +10,7 @@ function normalizePath(path) {
8
10
  return path.replace(/\\/g, "/");
9
11
  }
10
12
  const JS_EXTENSION_REGEX = /\.[cm]?[jt]sx?$/;
11
- function sentryCloudflareAutoInstrumentPlugin() {
13
+ function sentryCloudflareAutoInstrumentPlugin(options = {}) {
12
14
  let wranglerConfig$1;
13
15
  let entryFilePath;
14
16
  let optionsFn = instrumentFile.ENV_FALLBACK_OPTIONS_FN;
@@ -16,9 +18,11 @@ function sentryCloudflareAutoInstrumentPlugin() {
16
18
  return {
17
19
  name: "sentry-cloudflare-auto-instrument",
18
20
  configResolved(config) {
19
- const result = wranglerConfig.resolveWranglerConfig(config.root);
21
+ const result = wranglerConfig.resolveWranglerConfig(config.root, options.wranglerConfigPath);
20
22
  if (!result) {
21
- config.logger?.warn("[sentry] No parseable wrangler config found \u2014 auto-instrumentation disabled.");
23
+ config.logger?.warn(
24
+ 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."
25
+ );
22
26
  return;
23
27
  }
24
28
  wranglerConfig$1 = result.config;
@@ -34,7 +38,7 @@ function sentryCloudflareAutoInstrumentPlugin() {
34
38
  }
35
39
  }
36
40
  },
37
- transform(code, id) {
41
+ async transform(code, id) {
38
42
  if (!wranglerConfig$1 || !entryFilePath) return void 0;
39
43
  if (this.environment?.name === "client") return void 0;
40
44
  const normalizedId = normalizePath(id.replace(/[?#].*$/, ""));
@@ -60,8 +64,17 @@ function sentryCloudflareAutoInstrumentPlugin() {
60
64
  for (const className of wranglerConfig$1.workerEntrypoints) {
61
65
  classWrappers.set(className, "workerEntrypoint");
62
66
  }
67
+ const agentCandidates = agentClass.collectAgentCandidates(
68
+ ast,
69
+ [...classWrappers].filter(([, kind]) => kind === "durableObject").map(([name]) => name)
70
+ );
71
+ const agentClasses = agentCandidates.size > 0 ? await agentClass.detectAgentClasses(ast, normalizedId, agentCandidates, {
72
+ parse: (code2) => this.parse(code2),
73
+ resolve: this.resolve ? (source, importer) => this.resolve(source, importer) : void 0
74
+ }) : void 0;
63
75
  const result = transform.applyAutoInstrumentTransforms(code, ast, {
64
76
  classWrappers,
77
+ agentClasses,
65
78
  optionsFn,
66
79
  optionsImport
67
80
  });
@@ -1 +1 @@
1
- {"version":3,"file":"autoInstrument.js","sources":["../../../src/vite/autoInstrument.ts"],"sourcesContent":["import { 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\nexport function sentryCloudflareAutoInstrumentPlugin() {\n let wranglerConfig: WranglerConfig | undefined;\n let entryFilePath: string | undefined;\n\n let optionsFn = ENV_FALLBACK_OPTIONS_FN;\n let optionsImport: string | undefined;\n\n return {\n name: 'sentry-cloudflare-auto-instrument',\n\n configResolved(config: { root: string; logger?: { warn(msg: string): void } }): void {\n const result = resolveWranglerConfig(config.root);\n if (!result) {\n config.logger?.warn('[sentry] No parseable wrangler config found — auto-instrumentation disabled.');\n return;\n }\n\n wranglerConfig = result.config;\n if (wranglerConfig.main) {\n // `main` is already absolute (wrangler resolves it); just normalize\n // separators so the entry-module comparison holds on Windows.\n entryFilePath = normalizePath(wranglerConfig.main);\n }\n\n if (entryFilePath) {\n const instrumentFilePath = resolveInstrumentFile(entryFilePath);\n if (instrumentFilePath) {\n const built = buildOptionsImport(entryFilePath, instrumentFilePath);\n optionsFn = built.optionsFn;\n optionsImport = built.importStmt;\n }\n }\n },\n\n transform(\n this: { parse(code: string): ProgramBody; warn?(msg: string): void; environment?: { name?: string } },\n code: string,\n id: string,\n ): { code: string; map: unknown } | undefined {\n if (!wranglerConfig || !entryFilePath) 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 // Vite may append query/hash params to the module ID.\n const normalizedId = normalizePath(id.replace(/[?#].*$/, ''));\n if (normalizedId !== entryFilePath) {\n // Tolerate a differing JS-flavored extension (e.g. `.js` vs `.ts`).\n if (!JS_EXTENSION_REGEX.test(normalizedId) || !JS_EXTENSION_REGEX.test(entryFilePath)) return undefined;\n if (normalizedId.replace(JS_EXTENSION_REGEX, '') !== entryFilePath.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 // 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 optionsFn,\n optionsImport,\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 class(es) ${missing.join(', ')}: no matching exported class ` +\n 'declaration found in the worker entry (re-exports from other modules cannot be wrapped ' +\n 'automatically). Wrap them manually with the matching `instrument*WithSentry` helper.',\n );\n }\n\n return result ?? undefined;\n },\n };\n}\n"],"names":["wranglerConfig","ENV_FALLBACK_OPTIONS_FN","resolveWranglerConfig","resolveInstrumentFile","buildOptionsImport","applyAutoInstrumentTransforms"],"mappings":";;;;;;AAMA,SAAS,cA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AAM,OAAA,GAAU,CAAC,GAAG,aAAA,CAAc,IAAA,EAAM,CAAA,CAAE,MAAA,CAAO,CAAA,IAAA,KAAQ,CAAC,cAAA,CAAe,GAAA,CAAI,IAAI,CAAC,CAAA;AAClF,MAAA,IAAI,OAAA,CAAQ,SAAS,CAAA,EAAG;AACtB,QAAA,IAAA,CAAK,IAAA;AAAA,UACH,CAAA,6CAAA,EAAgD,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAC,CAAA,0MAAA;AAAA,SAGpE;AAAA,MACF;AAEA,MAAA,OAAO,MAAA,IAAU,MAAA;AAAA,IACnB;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"autoInstrument.js","sources":["../../../src/vite/autoInstrument.ts"],"sourcesContent":["import { basename } from 'node:path';\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\nexport function sentryCloudflareAutoInstrumentPlugin(options: { wranglerConfigPath?: string } = {}) {\n let wranglerConfig: WranglerConfig | undefined;\n let entryFilePath: string | undefined;\n\n let optionsFn = ENV_FALLBACK_OPTIONS_FN;\n let optionsImport: string | undefined;\n\n return {\n name: 'sentry-cloudflare-auto-instrument',\n\n configResolved(config: { root: string; logger?: { warn(msg: string): void } }): void {\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 if (wranglerConfig.main) {\n // `main` is already absolute (wrangler resolves it); just normalize\n // separators so the entry-module comparison holds on Windows.\n entryFilePath = normalizePath(wranglerConfig.main);\n }\n\n if (entryFilePath) {\n const instrumentFilePath = resolveInstrumentFile(entryFilePath);\n if (instrumentFilePath) {\n const built = buildOptionsImport(entryFilePath, instrumentFilePath);\n optionsFn = built.optionsFn;\n optionsImport = built.importStmt;\n }\n }\n },\n\n async transform(\n this: ModuleResolver & { warn?(msg: string): void; environment?: { name?: string } },\n code: string,\n id: string,\n ): Promise<{ code: string; map: unknown } | undefined> {\n if (!wranglerConfig || !entryFilePath) 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 // Vite may append query/hash params to the module ID.\n const normalizedId = normalizePath(id.replace(/[?#].*$/, ''));\n if (normalizedId !== entryFilePath) {\n // Tolerate a differing JS-flavored extension (e.g. `.js` vs `.ts`).\n if (!JS_EXTENSION_REGEX.test(normalizedId) || !JS_EXTENSION_REGEX.test(entryFilePath)) return undefined;\n if (normalizedId.replace(JS_EXTENSION_REGEX, '') !== entryFilePath.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 // 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 });\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 class(es) ${missing.join(', ')}: no matching exported class ` +\n 'declaration found in the worker entry (re-exports from other modules cannot be wrapped ' +\n 'automatically). Wrap them manually with the matching `instrument*WithSentry` helper.',\n );\n }\n\n return result ?? undefined;\n },\n };\n}\n"],"names":["wranglerConfig","ENV_FALLBACK_OPTIONS_FN","resolveWranglerConfig","basename","resolveInstrumentFile","buildOptionsImport","collectAgentCandid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+6,7 @@ const autoInstrument = require('./autoInstrument.js');
6
6
  function sentryCloudflareVitePlugin(options = {}) {
7
7
  return [
8
8
  ...options._experimental?.useDiagnosticsChannelInjection ? [vite.sentryOrchestrionPlugin({ injectChannelSubscribers: true })] : [],
9
- ...options._experimental?.autoInstrumentation ? [autoInstrument.sentryCloudflareAutoInstrumentPlugin()] : []
9
+ ...options._experimental?.autoInstrumentation ? [autoInstrument.sentryCloudflareAutoInstrumentPlugin({ wranglerConfigPath: options.wranglerConfigPath })] : []
10
10
  ];
11
11
  }
12
12
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/vite/index.ts"],"sourcesContent":["// Published ESM-only via the `@sentry/cloudflare/vite` subpath export:\n// `@sentry/server-utils/orchestrion/vite` exposes no `require` condition, so a\n// CJS entry here would fail at resolution time (ERR_PACKAGE_PATH_NOT_EXPORTED).\n// The CJS rollup variant still emits this file, but `package.json` doesn't\n// expose it — same setup as `@sentry/server-utils/orchestrion/vite` itself.\nimport { sentryOrchestrionPlugin } from '@sentry/server-utils/orchestrion/vite';\nimport { sentryCloudflareAutoInstrumentPlugin } from './autoInstrument';\n\n/**\n * Options for {@link sentryCloudflareVitePlugin}.\n */\nexport interface SentryCloudflareVitePluginOptions {\n /**\n * Experimental options that may change or be removed without notice.\n */\n _experimental?: {\n /**\n * Enables build-time automatic instrumentation of supported dependencies\n * (e.g. database clients like `mysql`) so the Sentry Cloudflare SDK can\n * trace them without monkey-patching, which wouldn't work in workerd anyway.\n *\n * When enabled, the plugin injects `diagnostics_channel.tracingChannel`\n * calls into the bundled packages and, next to each, a snippet that\n * registers the matching Sentry channel-subscriber factory on the global\n * marker, which the SDK picks up in `Sentry.withSentry()`. Both `vite build`\n * and `vite dev` are instrumented.\n *\n * @default false\n * @experimental May change or be removed in any release.\n */\n useDiagnosticsChannelInjection?: boolean;\n /**\n * Automatically wraps your Worker at build time so you don't have to edit\n * your entry: the plugin reads your wrangler config, wraps the default\n * export with `Sentry.withSentry()` (sourcing options from a co-located\n * `instrument.*` file, falling back to env), and wraps any configured\n * Durable Object class with `instrumentDurableObjectWithSentry`. Both\n * `vite build` and `vite dev` are instrumented.\n *\n * @default false\n * @experimental May change or be removed in any release.\n */\n autoInstrumentation?: boolean;\n };\n}\n\n/**\n * Sentry Vite plugin for Cloudflare Workers.\n *\n * Add this plugin to your Vite configuration to enable additional Sentry\n * instrumentation for Cloudflare Workers built with Vite. Configure the Sentry\n * SDK in your Worker as usual with `Sentry.withSentry()`.\n *\n * Currently, the only functionality is the experimental\n * `_experimental.useDiagnosticsChannelInjection` option, which traces supported\n * dependencies (such as database clients) without changing your application\n * code. Without it, the plugin is a no-op.\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { cloudflare } from '@cloudflare/vite-plugin';\n * import { sentryCloudflareVitePlugin } from '@sentry/cloudflare/vite';\n * import { defineConfig } from 'vite';\n *\n * export default defineConfig({\n * plugins: [\n * cloudflare(),\n * sentryCloudflareVitePlugin({\n * _experimental: {\n * useDiagnosticsChannelInjection: true,\n * },\n * }),\n * ],\n * });\n * ```\n */\nexport function sentryCloudflareVitePlugin(options: SentryCloudflareVitePluginOptions = {}) {\n return [\n ...(options._experimental?.useDiagnosticsChannelInjection\n ? [sentryOrchestrionPlugin({ injectChannelSubscribers: true })]\n : []),\n ...(options._experimental?.autoInstrumentation ? [sentryCloudflareAutoInstrumentPlugin()] : []),\n ];\n}\n"],"names":["sentryOrchestrionPlugin","sentryCloudflareAutoInstrumentPlugin"],"mappings":";;;;;AA6EO,SAAS,0BAAA,CAA2B,OAAA,GAA6C,EAAC,EAAG;AAC1F,EAAA,OAAO;AAAA,IACL,GAAI,OAAA,CAAQ,aAAA,EAAe,8BAAA,GACvB,CAACA,4BAAA,CAAwB,EAAE,wBAAA,EAA0B,IAAA,EAAM,CAAC,CAAA,GAC5D,EAAC;AAAA,IACL,GAAI,QAAQ,aAAA,EAAe,mBAAA,GAAsB,CAACC,mDAAA,EAAsC,IAAI;AAAC,GAC/F;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/vite/index.ts"],"sourcesContent":["// Published ESM-only via the `@sentry/cloudflare/vite` subpath export:\n// `@sentry/server-utils/orchestrion/vite` exposes no `require` condition, so a\n// CJS entry here would fail at resolution time (ERR_PACKAGE_PATH_NOT_EXPORTED).\n// The CJS rollup variant still emits this file, but `package.json` doesn't\n// expose it — same setup as `@sentry/server-utils/orchestrion/vite` itself.\nimport { sentryOrchestrionPlugin } from '@sentry/server-utils/orchestrion/vite';\nimport { sentryCloudflareAutoInstrumentPlugin } from './autoInstrument';\n\n/**\n * Options for {@link sentryCloudflareVitePlugin}.\n */\nexport interface SentryCloudflareVitePluginOptions {\n /**\n * Path to the wrangler config, relative to the Vite root (or absolute).\n * Set this when your config doesn't use a default name — e.g. when you\n * pass `configPath: './wrangler.agent.jsonc'` to `@cloudflare/vite-plugin`,\n * which the Sentry plugin cannot see. When set, only this file is read\n * (no default-name probing), and a warning is emitted if it is missing or\n * unparseable.\n *\n * @default undefined (probes `wrangler.json`, `wrangler.jsonc`, `wrangler.toml` at the Vite root)\n */\n wranglerConfigPath?: string;\n /**\n * Experimental options that may change or be removed without notice.\n */\n _experimental?: {\n /**\n * Enables build-time automatic instrumentation of supported dependencies\n * (e.g. database clients like `mysql`) so the Sentry Cloudflare SDK can\n * trace them without monkey-patching, which wouldn't work in workerd anyway.\n *\n * When enabled, the plugin injects `diagnostics_channel.tracingChannel`\n * calls into the bundled packages and, next to each, a snippet that\n * registers the matching Sentry channel-subscriber factory on the global\n * marker, which the SDK picks up in `Sentry.withSentry()`. Both `vite build`\n * and `vite dev` are instrumented.\n *\n * @default false\n * @experimental May change or be removed in any release.\n */\n useDiagnosticsChannelInjection?: boolean;\n /**\n * Automatically wraps your Worker at build time so you don't have to edit\n * your entry: the plugin reads your wrangler config, wraps the default\n * export with `Sentry.withSentry()` (sourcing options from a co-located\n * `instrument.*` file, falling back to env), and wraps any configured\n * Durable Object class with `instrumentDurableObjectWithSentry`. Both\n * `vite build` and `vite dev` are instrumented.\n *\n * @default false\n * @experimental May change or be removed in any release.\n */\n autoInstrumentation?: boolean;\n };\n}\n\n/**\n * Sentry Vite plugin for Cloudflare Workers.\n *\n * Add this plugin to your Vite configuration to enable additional Sentry\n * instrumentation for Cloudflare Workers built with Vite. Configure the Sentry\n * SDK in your Worker as usual with `Sentry.withSentry()`.\n *\n * Currently, the only functionality is the experimental\n * `_experimental.useDiagnosticsChannelInjection` option, which traces supported\n * dependencies (such as database clients) without changing your application\n * code. Without it, the plugin is a no-op.\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { cloudflare } from '@cloudflare/vite-plugin';\n * import { sentryCloudflareVitePlugin } from '@sentry/cloudflare/vite';\n * import { defineConfig } from 'vite';\n *\n * export default defineConfig({\n * plugins: [\n * cloudflare(),\n * sentryCloudflareVitePlugin({\n * _experimental: {\n * useDiagnosticsChannelInjection: true,\n * },\n * }),\n * ],\n * });\n * ```\n */\nexport function sentryCloudflareVitePlugin(options: SentryCloudflareVitePluginOptions = {}) {\n return [\n ...(options._experimental?.useDiagnosticsChannelInjection\n ? [sentryOrchestrionPlugin({ injectChannelSubscribers: true })]\n : []),\n ...(options._experimental?.autoInstrumentation\n ? [sentryCloudflareAutoInstrumentPlugin({ wranglerConfigPath: options.wranglerConfigPath })]\n : []),\n ];\n}\n"],"names":["sentryOrchestrionPlugin","sentryCloudflareAutoInstrumentPlugin"],"mappings":";;;;;AAwFO,SAAS,0BAAA,CAA2B,OAAA,GAA6C,EAAC,EAAG;AAC1F,EAAA,OAAO;AAAA,IACL,GAAI,OAAA,CAAQ,aAAA,EAAe,8BAAA,GACvB,CAACA,4BAAA,CAAwB,EAAE,wBAAA,EAA0B,IAAA,EAAM,CAAC,CAAA,GAC5D,EAAC;AAAA,IACL,GAAI,OAAA,CAAQ,aAAA,EAAe,mBAAA,GACvB,CAACC,mDAAA,CAAqC,EAAE,kBAAA,EAAoB,OAAA,CAAQ,kBAAA,EAAoB,CAAC,IACzF;AAAC,GACP;AACF;;;;"}