@sentry/cloudflare 10.72.0 → 10.74.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 (66) hide show
  1. package/build/cjs/async.js +7 -1
  2. package/build/cjs/async.js.map +1 -1
  3. package/build/cjs/durableobject.js +8 -55
  4. package/build/cjs/durableobject.js.map +1 -1
  5. package/build/cjs/index.js +2 -0
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/cjs/instrument.js +4 -0
  8. package/build/cjs/instrument.js.map +1 -1
  9. package/build/cjs/instrumentations/instrumentDurableObjectHandlers.js +114 -0
  10. package/build/cjs/instrumentations/instrumentDurableObjectHandlers.js.map +1 -0
  11. package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js +4 -1
  12. package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  13. package/build/cjs/nodejs_compat/index.js +2 -0
  14. package/build/cjs/nodejs_compat/index.js.map +1 -1
  15. package/build/cjs/vite/agentClass.js +3 -2
  16. package/build/cjs/vite/agentClass.js.map +1 -1
  17. package/build/cjs/vite/autoInstrument.js +1 -1
  18. package/build/cjs/vite/autoInstrument.js.map +1 -1
  19. package/build/cjs/vite/transform.js +79 -16
  20. package/build/cjs/vite/transform.js.map +1 -1
  21. package/build/cjs/workflows.js +4 -1
  22. package/build/cjs/workflows.js.map +1 -1
  23. package/build/esm/async.js +8 -2
  24. package/build/esm/async.js.map +1 -1
  25. package/build/esm/durableobject.js +9 -56
  26. package/build/esm/durableobject.js.map +1 -1
  27. package/build/esm/index.js +1 -0
  28. package/build/esm/index.js.map +1 -1
  29. package/build/esm/instrument.js +4 -1
  30. package/build/esm/instrument.js.map +1 -1
  31. package/build/esm/instrumentations/instrumentDurableObjectHandlers.js +112 -0
  32. package/build/esm/instrumentations/instrumentDurableObjectHandlers.js.map +1 -0
  33. package/build/esm/instrumentations/instrumentWorkerEntrypoint.js +4 -1
  34. package/build/esm/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  35. package/build/esm/nodejs_compat/index.js +1 -0
  36. package/build/esm/nodejs_compat/index.js.map +1 -1
  37. package/build/esm/package.json +1 -1
  38. package/build/esm/vite/agentClass.js +3 -2
  39. package/build/esm/vite/agentClass.js.map +1 -1
  40. package/build/esm/vite/autoInstrument.js +1 -1
  41. package/build/esm/vite/autoInstrument.js.map +1 -1
  42. package/build/esm/vite/transform.js +79 -16
  43. package/build/esm/vite/transform.js.map +1 -1
  44. package/build/esm/workflows.js +4 -1
  45. package/build/esm/workflows.js.map +1 -1
  46. package/build/types/async.d.ts.map +1 -1
  47. package/build/types/durableobject.d.ts.map +1 -1
  48. package/build/types/index.d.ts +1 -0
  49. package/build/types/index.d.ts.map +1 -1
  50. package/build/types/instrument.d.ts +10 -0
  51. package/build/types/instrument.d.ts.map +1 -1
  52. package/build/types/instrumentations/instrumentDurableObjectHandlers.d.ts +28 -0
  53. package/build/types/instrumentations/instrumentDurableObjectHandlers.d.ts.map +1 -0
  54. package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts.map +1 -1
  55. package/build/types/vite/agentClass.d.ts +4 -3
  56. package/build/types/vite/agentClass.d.ts.map +1 -1
  57. package/build/types/vite/autoInstrument.d.ts.map +1 -1
  58. package/build/types/vite/transform.d.ts +5 -4
  59. package/build/types/vite/transform.d.ts.map +1 -1
  60. package/build/types/workflows.d.ts.map +1 -1
  61. package/build/types-ts3.8/index.d.ts +1 -0
  62. package/build/types-ts3.8/instrument.d.ts +10 -0
  63. package/build/types-ts3.8/instrumentations/instrumentDurableObjectHandlers.d.ts +28 -0
  64. package/build/types-ts3.8/vite/agentClass.d.ts +4 -3
  65. package/build/types-ts3.8/vite/transform.d.ts +5 -4
  66. package/package.json +3 -3
@@ -4,6 +4,7 @@ export { addEventProcessor, addBreadcrumb, addIntegration, captureException, cap
4
4
  export { withSentry } from './withSentry';
5
5
  export { defineCloudflareOptions } from './defineCloudflareOptions';
6
6
  export { instrumentAgentWithSentry, instrumentDurableObjectWithSentry } from './durableobject';
7
+ export { _INTERNAL_wrapUnlessInstrumented } from './instrument';
7
8
  export { sentryPagesPlugin } from './pages-plugin';
8
9
  export { wrapRequestHandler } from './request';
9
10
  export { CloudflareClient } from './client';
@@ -17,4 +17,14 @@ export declare function getInstrumented<T>(obj: T): T | undefined;
17
17
  * @param noMark - If true, skips storing the original→instrumented mapping.
18
18
  */
19
19
  export declare function ensureInstrumented<T>(original: T, instrumentFn: (original: T) => T, noMark?: boolean): T;
20
+ /**
21
+ * Applies `wrap` to `Class` unless `Class` is already an instrumented wrapper.
22
+ *
23
+ * Emitted by the Vite auto-instrumentation transform for classes the worker entry only re-exports:
24
+ * such a class may already be hand-wrapped with `instrument*WithSentry` in the module it comes
25
+ * from, which the build cannot see. Wrapping again would nest two proxies and instrument the same
26
+ * work twice, duplicated child spans, so the hand-wrapped class is returned as-is. Not part of the
27
+ * public API, hand-written wrapper calls are deliberately left untouched by this guard.
28
+ */
29
+ export declare function _INTERNAL_wrapUnlessInstrumented<C>(wrap: (optionsCallback: (env: never) => unknown, Class: C) => C, optionsCallback: (env: never) => unknown, Class: C): C;
20
30
  //# sourceMappingURL=instrument.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { DurableObject } from 'cloudflare:workers';
2
+ import { CloudflareOptions } from '../client';
3
+ /**
4
+ * The instrumented context of the Durable Object being wrapped.
5
+ *
6
+ * Kept as `any` for the same reason as in `durableobject.ts`: a concrete `DurableObjectState` here
7
+ * makes `tsc` relate its `SqlStorage` graph against the parameter union of `wrapMethodWithSentry`,
8
+ * which hangs the type build.
9
+ */
10
+ type InstrumentedDurableObjectContext = any;
11
+ /**
12
+ * Instruments the built-in Durable Object handler methods on a constructed instance.
13
+ *
14
+ * These are the methods that are available on a Durable Object
15
+ * ref: https://developers.cloudflare.com/durable-objects/api/base/
16
+ * - obj.alarm
17
+ * - obj.fetch
18
+ * - obj.webSocketError
19
+ * - obj.webSocketClose
20
+ * - obj.webSocketMessage
21
+ *
22
+ * Any other public methods on the Durable Object instance are RPC calls.
23
+ *
24
+ * @internal
25
+ */
26
+ export declare function instrumentDurableObjectHandlers<E, T extends DurableObject<E>>(obj: T, options: CloudflareOptions, context: InstrumentedDurableObjectContext): void;
27
+ export {};
28
+ //# sourceMappingURL=instrumentDurableObjectHandlers.d.ts.map
@@ -32,10 +32,11 @@ export interface ModuleResolver {
32
32
  */
33
33
  export declare function detectAgentClasses(ast: ProgramBody, entryId: string, candidates: Iterable<string>, resolver: ModuleResolver): Promise<Set<string>>;
34
34
  /**
35
- * The local class names in the entry that a configured class name could refer to — either declared
36
- * under that name directly, or aliased to it by an `export { Local as Configured }` specifier.
35
+ * The entry-module binding names a configured class name could refer to — a class declared under
36
+ * that name, an import of it from another module, a `export { X } from './x'` re-export, or the
37
+ * local binding an `export { Local as Configured }` specifier aliases.
37
38
  *
38
- * Keeps detection (which reads and scans other modules) off classes that no binding points at.
39
+ * Keeps detection (which reads and scans other modules) off names no binding points at.
39
40
  */
40
41
  export declare function collectAgentCandidates(ast: ProgramBody, configuredNames: Iterable<string>): Set<string>;
41
42
  //# sourceMappingURL=agentClass.d.ts.map
@@ -54,10 +54,11 @@ export interface TransformResult {
54
54
  * {@link TransformContext.classWrappers}, e.g. Durable Object classes with
55
55
  * `instrumentDurableObjectWithSentry`).
56
56
  *
57
- * Handles both `export class MyDO {}` and the specifier form
58
- * (`class MyDO {}` … `export { MyDO }` / `export { Foo as MyDO }`).
59
- * Re-exports from other modules (`export { MyDO } from './do'`) cannot be
60
- * wrapped here and are left alone — the plugin warns about them via
57
+ * Handles `export class MyDO {}`, the specifier form (`class MyDO {}` …
58
+ * `export { MyDO }` / `export { Foo as MyDO }`), and classes that live in
59
+ * another module (`import { MyDO } from './do'; export { MyDO }` or
60
+ * `export { MyDO } from './do'`). Only star re-exports (`export * from './do'`)
61
+ * are left alone — the plugin warns about those via
61
62
  * {@link TransformResult.wrappedClasses}.
62
63
  *
63
64
  * Exported (rather than inlined into the plugin) so it can be unit-tested with a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/cloudflare",
3
- "version": "10.72.0",
3
+ "version": "10.74.0",
4
4
  "description": "Official Sentry SDK for Cloudflare Workers and Pages",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/cloudflare",
@@ -70,8 +70,8 @@
70
70
  },
71
71
  "dependencies": {
72
72
  "@opentelemetry/api": "^1.9.1",
73
- "@sentry/core": "10.72.0",
74
- "@sentry/server-utils": "10.72.0",
73
+ "@sentry/core": "10.74.0",
74
+ "@sentry/server-utils": "10.74.0",
75
75
  "magic-string": "~0.30.21"
76
76
  },
77
77
  "peerDependencies": {