@sentry/cloudflare 10.67.0 → 10.69.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.
- package/build/cjs/client.js +5 -0
- package/build/cjs/client.js.map +1 -1
- package/build/cjs/defineCloudflareOptions.js +11 -0
- package/build/cjs/defineCloudflareOptions.js.map +1 -0
- package/build/cjs/durableobject.js +131 -96
- package/build/cjs/durableobject.js.map +1 -1
- package/build/cjs/index.js +6 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/instrumentations/agents/index.js +14 -0
- package/build/cjs/instrumentations/agents/index.js.map +1 -0
- package/build/cjs/instrumentations/agents/instrumentAgentCallableRpc.js +52 -0
- package/build/cjs/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -0
- package/build/cjs/instrumentations/agents/instrumentChatAgentConversation.js +31 -0
- package/build/cjs/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -0
- package/build/cjs/instrumentations/agents/types.js +32 -0
- package/build/cjs/instrumentations/agents/types.js.map +1 -0
- package/build/cjs/instrumentations/instrumentDurableObjectStorage.js +6 -0
- package/build/cjs/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
- package/build/cjs/instrumentations/instrumentSqlStorage.js +1 -1
- package/build/cjs/instrumentations/instrumentSqlStorage.js.map +1 -1
- package/build/cjs/integrations/spotlight.js +64 -0
- package/build/cjs/integrations/spotlight.js.map +1 -0
- package/build/cjs/integrations/tracing/vercelai.js.map +1 -1
- package/build/cjs/nodejs_compat/index.js +10 -4
- package/build/cjs/nodejs_compat/index.js.map +1 -1
- package/build/cjs/nodejs_compat/integrations/tracing/vercelai.js.map +1 -1
- package/build/cjs/options.js +14 -1
- package/build/cjs/options.js.map +1 -1
- package/build/cjs/sdk.js +20 -1
- package/build/cjs/sdk.js.map +1 -1
- package/build/cjs/utils/internalSqlQuery.js +13 -7
- package/build/cjs/utils/internalSqlQuery.js.map +1 -1
- package/build/cjs/utils/internalStorageKey.js +44 -0
- package/build/cjs/utils/internalStorageKey.js.map +1 -0
- package/build/cjs/vite/agentClass.js +114 -0
- package/build/cjs/vite/agentClass.js.map +1 -0
- package/build/cjs/vite/autoInstrument.js +94 -0
- package/build/cjs/vite/autoInstrument.js.map +1 -0
- package/build/cjs/vite/index.js +14 -0
- package/build/cjs/vite/index.js.map +1 -0
- package/build/cjs/vite/instrumentFile.js +31 -0
- package/build/cjs/vite/instrumentFile.js.map +1 -0
- package/build/cjs/vite/moduleShape.js +231 -0
- package/build/cjs/vite/moduleShape.js.map +1 -0
- package/build/cjs/vite/transform.js +149 -0
- package/build/cjs/vite/transform.js.map +1 -0
- package/build/cjs/vite/workerEntrypoint.js +66 -0
- package/build/cjs/vite/workerEntrypoint.js.map +1 -0
- package/build/cjs/vite/wranglerConfig.js +54 -0
- package/build/cjs/vite/wranglerConfig.js.map +1 -0
- package/build/esm/client.js +6 -1
- package/build/esm/client.js.map +1 -1
- package/build/esm/defineCloudflareOptions.js +9 -0
- package/build/esm/defineCloudflareOptions.js.map +1 -0
- package/build/esm/durableobject.js +129 -97
- package/build/esm/durableobject.js.map +1 -1
- package/build/esm/index.js +4 -2
- package/build/esm/index.js.map +1 -1
- package/build/esm/instrumentations/agents/index.js +12 -0
- package/build/esm/instrumentations/agents/index.js.map +1 -0
- package/build/esm/instrumentations/agents/instrumentAgentCallableRpc.js +50 -0
- package/build/esm/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -0
- package/build/esm/instrumentations/agents/instrumentChatAgentConversation.js +29 -0
- package/build/esm/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -0
- package/build/esm/instrumentations/agents/types.js +26 -0
- package/build/esm/instrumentations/agents/types.js.map +1 -0
- package/build/esm/instrumentations/instrumentDurableObjectStorage.js +7 -1
- package/build/esm/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
- package/build/esm/instrumentations/instrumentSqlStorage.js +1 -1
- package/build/esm/instrumentations/instrumentSqlStorage.js.map +1 -1
- package/build/esm/integrations/spotlight.js +61 -0
- package/build/esm/integrations/spotlight.js.map +1 -0
- package/build/esm/integrations/tracing/vercelai.js.map +1 -1
- package/build/esm/nodejs_compat/index.js +5 -3
- package/build/esm/nodejs_compat/index.js.map +1 -1
- package/build/esm/nodejs_compat/integrations/tracing/vercelai.js.map +1 -1
- package/build/esm/options.js +14 -1
- package/build/esm/options.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/sdk.js +21 -2
- package/build/esm/sdk.js.map +1 -1
- package/build/esm/utils/internalSqlQuery.js +13 -7
- package/build/esm/utils/internalSqlQuery.js.map +1 -1
- package/build/esm/utils/internalStorageKey.js +41 -0
- package/build/esm/utils/internalStorageKey.js.map +1 -0
- package/build/esm/utils/traceLinks.js +1 -1
- package/build/esm/vite/agentClass.js +111 -0
- package/build/esm/vite/agentClass.js.map +1 -0
- package/build/esm/vite/autoInstrument.js +92 -0
- package/build/esm/vite/autoInstrument.js.map +1 -0
- package/build/esm/vite/index.js +12 -0
- package/build/esm/vite/index.js.map +1 -0
- package/build/esm/vite/instrumentFile.js +27 -0
- package/build/esm/vite/instrumentFile.js.map +1 -0
- package/build/esm/vite/moduleShape.js +227 -0
- package/build/esm/vite/moduleShape.js.map +1 -0
- package/build/esm/vite/transform.js +147 -0
- package/build/esm/vite/transform.js.map +1 -0
- package/build/esm/vite/workerEntrypoint.js +64 -0
- package/build/esm/vite/workerEntrypoint.js.map +1 -0
- package/build/esm/vite/wranglerConfig.js +52 -0
- package/build/esm/vite/wranglerConfig.js.map +1 -0
- package/build/types/client.d.ts +37 -0
- package/build/types/client.d.ts.map +1 -1
- package/build/types/defineCloudflareOptions.d.ts +38 -0
- package/build/types/defineCloudflareOptions.d.ts.map +1 -0
- package/build/types/durableobject.d.ts +81 -0
- package/build/types/durableobject.d.ts.map +1 -1
- package/build/types/index.d.ts +4 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/instrumentations/agents/index.d.ts +24 -0
- package/build/types/instrumentations/agents/index.d.ts.map +1 -0
- package/build/types/instrumentations/agents/instrumentAgentCallableRpc.d.ts +11 -0
- package/build/types/instrumentations/agents/instrumentAgentCallableRpc.d.ts.map +1 -0
- package/build/types/instrumentations/agents/instrumentChatAgentConversation.d.ts +22 -0
- package/build/types/instrumentations/agents/instrumentChatAgentConversation.d.ts.map +1 -0
- package/build/types/instrumentations/agents/types.d.ts +49 -0
- package/build/types/instrumentations/agents/types.d.ts.map +1 -0
- package/build/types/instrumentations/instrumentDurableObjectStorage.d.ts.map +1 -1
- package/build/types/integrations/spotlight.d.ts +22 -0
- package/build/types/integrations/spotlight.d.ts.map +1 -0
- package/build/types/integrations/tracing/vercelai.d.ts.map +1 -1
- package/build/types/nodejs_compat/index.d.ts +1 -1
- package/build/types/nodejs_compat/index.d.ts.map +1 -1
- package/build/types/nodejs_compat/integrations/tracing/vercelai.d.ts +1 -8
- package/build/types/nodejs_compat/integrations/tracing/vercelai.d.ts.map +1 -1
- package/build/types/options.d.ts.map +1 -1
- package/build/types/sdk.d.ts.map +1 -1
- package/build/types/utils/internalSqlQuery.d.ts +4 -2
- package/build/types/utils/internalSqlQuery.d.ts.map +1 -1
- package/build/types/utils/internalStorageKey.d.ts +22 -0
- package/build/types/utils/internalStorageKey.d.ts.map +1 -0
- package/build/types/vite/agentClass.d.ts +41 -0
- package/build/types/vite/agentClass.d.ts.map +1 -0
- package/build/types/vite/autoInstrument.d.ts +22 -0
- package/build/types/vite/autoInstrument.d.ts.map +1 -0
- package/build/types/vite/index.d.ts +98 -0
- package/build/types/vite/index.d.ts.map +1 -0
- package/build/types/vite/instrumentFile.d.ts +22 -0
- package/build/types/vite/instrumentFile.d.ts.map +1 -0
- package/build/types/vite/moduleShape.d.ts +52 -0
- package/build/types/vite/moduleShape.d.ts.map +1 -0
- package/build/types/vite/transform.d.ts +65 -0
- package/build/types/vite/transform.d.ts.map +1 -0
- package/build/types/vite/workerEntrypoint.d.ts +12 -0
- package/build/types/vite/workerEntrypoint.d.ts.map +1 -0
- package/build/types/vite/wranglerConfig.d.ts +43 -0
- package/build/types/vite/wranglerConfig.d.ts.map +1 -0
- package/build/types-ts3.8/client.d.ts +37 -0
- package/build/types-ts3.8/defineCloudflareOptions.d.ts +38 -0
- package/build/types-ts3.8/durableobject.d.ts +81 -0
- package/build/types-ts3.8/index.d.ts +4 -2
- package/build/types-ts3.8/instrumentations/agents/index.d.ts +24 -0
- package/build/types-ts3.8/instrumentations/agents/instrumentAgentCallableRpc.d.ts +11 -0
- package/build/types-ts3.8/instrumentations/agents/instrumentChatAgentConversation.d.ts +22 -0
- package/build/types-ts3.8/instrumentations/agents/types.d.ts +49 -0
- package/build/types-ts3.8/integrations/spotlight.d.ts +22 -0
- package/build/types-ts3.8/nodejs_compat/index.d.ts +1 -1
- package/build/types-ts3.8/nodejs_compat/integrations/tracing/vercelai.d.ts +7 -14
- package/build/types-ts3.8/utils/internalSqlQuery.d.ts +4 -2
- package/build/types-ts3.8/utils/internalStorageKey.d.ts +22 -0
- package/build/types-ts3.8/vite/agentClass.d.ts +41 -0
- package/build/types-ts3.8/vite/autoInstrument.d.ts +22 -0
- package/build/types-ts3.8/vite/index.d.ts +98 -0
- package/build/types-ts3.8/vite/instrumentFile.d.ts +22 -0
- package/build/types-ts3.8/vite/moduleShape.d.ts +52 -0
- package/build/types-ts3.8/vite/transform.d.ts +65 -0
- package/build/types-ts3.8/vite/workerEntrypoint.d.ts +12 -0
- package/build/types-ts3.8/vite/wranglerConfig.d.ts +43 -0
- package/package.json +19 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nodejs_compat/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nodejs_compat/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -4,13 +4,7 @@
|
|
|
4
4
|
* The only difference is that it includes tracing channel support
|
|
5
5
|
* because the default Vercel AI integration needs `nodejs_als`, while this one uses `nodejs_compat`.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Enable or disable truncation of recorded input messages.
|
|
10
|
-
* Defaults to `true`.
|
|
11
|
-
*/
|
|
12
|
-
enableTruncation?: boolean;
|
|
13
|
-
}
|
|
7
|
+
import { type VercelAiOptions } from '@sentry/server-utils';
|
|
14
8
|
/**
|
|
15
9
|
* Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.
|
|
16
10
|
* This integration is not enabled by default, you need to manually add it.
|
|
@@ -40,5 +34,4 @@ interface VercelAiOptions {
|
|
|
40
34
|
export declare const vercelAIIntegration: (options?: VercelAiOptions | undefined) => import("@sentry/core").Integration & {
|
|
41
35
|
name: string;
|
|
42
36
|
};
|
|
43
|
-
export {};
|
|
44
37
|
//# sourceMappingURL=vercelai.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercelai.d.ts","sourceRoot":"","sources":["../../../../../src/nodejs_compat/integrations/tracing/vercelai.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"vercelai.d.ts","sourceRoot":"","sources":["../../../../../src/nodejs_compat/integrations/tracing/vercelai.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAyD,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAanH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,mBAAmB;;CAA0C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAyBlD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,iBAAiB,YAAK,EAAE,GAAG,EAAE,OAAO,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAyBlD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,iBAAiB,YAAK,EAAE,GAAG,EAAE,OAAO,GAAG,iBAAiB,CAgCpG"}
|
package/build/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAchD,OAAO,KAAK,EAA2B,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AA2B5C,2DAA2D;AAC3D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,WAAW,EAAE,CA8BhF;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAoC7E"}
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
*
|
|
13
13
|
* The check operates on the query summary produced by `getSqlQuerySummary` (`{operation} {table} ...`,
|
|
14
14
|
* the same value used as the span name), so table targets are already isolated from the rest of the
|
|
15
|
-
* query.
|
|
15
|
+
* query. The one exception is `CREATE INDEX`: its summary carries the index name, not the indexed
|
|
16
|
+
* table (upstream OTel convention), so the `cf_` target only appears in the ON clause of the full
|
|
17
|
+
* statement, which `queryText` is needed for.
|
|
16
18
|
*/
|
|
17
|
-
export declare function targetsCloudflareInternalTable(querySummary: string | undefined, allowlist?: Array<string | RegExp
|
|
19
|
+
export declare function targetsCloudflareInternalTable(querySummary: string | undefined, allowlist?: Array<string | RegExp>, queryText?: string): boolean;
|
|
18
20
|
//# sourceMappingURL=internalSqlQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalSqlQuery.d.ts","sourceRoot":"","sources":["../../../src/utils/internalSqlQuery.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"internalSqlQuery.d.ts","sourceRoot":"","sources":["../../../src/utils/internalSqlQuery.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,8BAA8B,CAC5C,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAClC,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAaT"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare frameworks that build on Durable Objects (`agents`, `partyserver`, ...) also manage
|
|
3
|
+
* their own internal KV entries alongside their internal SQLite tables, namespaced with a reserved
|
|
4
|
+
* prefix — e.g. `cf_agents_state`, `cf_agents_mcp_servers`, `__ps_name`. Reads/writes of these
|
|
5
|
+
* (message persistence, MCP connection bookkeeping, name hydration) are framework implementation
|
|
6
|
+
* details that otherwise flood traces with dozens of zero-signal `durable_object_storage_*` spans
|
|
7
|
+
* per request, so we match the reserved prefixes rather than an enumerated list. This mirrors the
|
|
8
|
+
* `cf_` convention used for internal SQL tables (see `targetsCloudflareInternalTable`).
|
|
9
|
+
*
|
|
10
|
+
* The prefixes are a reserved convention for framework-managed entries, so user keys should not use
|
|
11
|
+
* them. In case a user key does collide, the `durableObjectStorageSpanAllowlist` option lets them
|
|
12
|
+
* opt those keys back into instrumentation.
|
|
13
|
+
*/
|
|
14
|
+
export declare function targetsCloudflareInternalKey(key: string | undefined, allowlist?: Array<string | RegExp>): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Extracts the KV keys a Durable Object storage call targets, so the caller can decide whether the
|
|
17
|
+
* operation only touches framework-internal entries. Returns `undefined` when the keys can't be
|
|
18
|
+
* determined from the arguments (e.g. `list()` without a prefix), in which case the call is treated
|
|
19
|
+
* as user work and stays instrumented.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getStorageKeys(methodName: string, args: unknown[]): string[] | undefined;
|
|
22
|
+
//# sourceMappingURL=internalStorageKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internalStorageKey.d.ts","sourceRoot":"","sources":["../../../src/utils/internalStorageKey.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,OAAO,CAsBjH;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS,CAgCxF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ProgramBody } from './transform';
|
|
2
|
+
/**
|
|
3
|
+
* The subset of the Vite/Rollup plugin context needed to walk the module graph.
|
|
4
|
+
*
|
|
5
|
+
* `resolve` is optional: without it detection still works, but only for base-class chains declared
|
|
6
|
+
* inside the entry module itself. `readFile` is injectable for tests and defaults to reading disk.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately **no `load`**: awaiting the plugin context's `load()` from inside a `transform` hook
|
|
9
|
+
* deadlocks the build — the module cannot finish loading while its own transform is still pending
|
|
10
|
+
* (Rollup documents this hazard, and Vite's Rolldown pipeline is stricter still). Sibling modules
|
|
11
|
+
* are therefore read straight off disk; see {@link getModuleShape}.
|
|
12
|
+
*/
|
|
13
|
+
export interface ModuleResolver {
|
|
14
|
+
parse(code: string): ProgramBody;
|
|
15
|
+
resolve?(source: string, importer: string): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
} | null | undefined>;
|
|
18
|
+
readFile?(id: string): string | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Find which of `candidates` (top-level class names in the entry module) are Cloudflare
|
|
22
|
+
* [`agents`](https://www.npmjs.com/package/agents) Agents.
|
|
23
|
+
*
|
|
24
|
+
* An Agent is a Durable Object under the hood, so wrangler configures it as one and the transform
|
|
25
|
+
* would otherwise reach for `instrumentDurableObjectWithSentry`. Detecting the Agent base chain lets
|
|
26
|
+
* it pick `instrumentAgentWithSentry` instead, which adds the Agent-specific telemetry on top.
|
|
27
|
+
*
|
|
28
|
+
* Unlike `WorkerEntrypoint` detection, the chain is followed *across* modules: base classes commonly
|
|
29
|
+
* live in their own file (`import { MyBase } from './base'`), and there is no runtime fallback that
|
|
30
|
+
* would catch a missed one. Resolution stops at package boundaries — a base class imported from
|
|
31
|
+
* `node_modules` is only recognized when it is one of {@link AGENT_BASE_CLASSES}.
|
|
32
|
+
*/
|
|
33
|
+
export declare function detectAgentClasses(ast: ProgramBody, entryId: string, candidates: Iterable<string>, resolver: ModuleResolver): Promise<Set<string>>;
|
|
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.
|
|
37
|
+
*
|
|
38
|
+
* Keeps detection (which reads and scans other modules) off classes that no binding points at.
|
|
39
|
+
*/
|
|
40
|
+
export declare function collectAgentCandidates(ast: ProgramBody, configuredNames: Iterable<string>): Set<string>;
|
|
41
|
+
//# sourceMappingURL=agentClass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentClass.d.ts","sourceRoot":"","sources":["../../../src/vite/agentClass.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAuB/C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IACjC,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACvF,QAAQ,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC3C;AAOD;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC5B,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CActB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAevG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ModuleResolver } from './agentClass';
|
|
2
|
+
export declare function sentryCloudflareAutoInstrumentPlugin(options?: {
|
|
3
|
+
wranglerConfigPath?: string;
|
|
4
|
+
}): {
|
|
5
|
+
name: string;
|
|
6
|
+
configResolved(config: {
|
|
7
|
+
root: string;
|
|
8
|
+
logger?: {
|
|
9
|
+
warn(msg: string): void;
|
|
10
|
+
};
|
|
11
|
+
}): void;
|
|
12
|
+
transform(this: ModuleResolver & {
|
|
13
|
+
warn?(msg: string): void;
|
|
14
|
+
environment?: {
|
|
15
|
+
name?: string;
|
|
16
|
+
};
|
|
17
|
+
}, code: string, id: string): Promise<{
|
|
18
|
+
code: string;
|
|
19
|
+
map: unknown;
|
|
20
|
+
} | undefined>;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=autoInstrument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoInstrument.d.ts","sourceRoot":"","sources":["../../../src/vite/autoInstrument.ts"],"names":[],"mappings":"AACA,OAAO,EAA8C,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAgB/F,wBAAgB,oCAAoC,CAAC,OAAO,GAAE;IAAE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAO;;2BAUvE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,CAAA;KAAE,GAAG,IAAI;oBAkC5E,cAAc,GAAG;QAAE,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,WAAW,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,QAC9E,MAAM,MACR,MAAM,GACT,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC;EAiFzD"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for {@link sentryCloudflareVitePlugin}.
|
|
3
|
+
*/
|
|
4
|
+
export interface SentryCloudflareVitePluginOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Path to the wrangler config, relative to the Vite root (or absolute).
|
|
7
|
+
* Set this when your config doesn't use a default name — e.g. when you
|
|
8
|
+
* pass `configPath: './wrangler.agent.jsonc'` to `@cloudflare/vite-plugin`,
|
|
9
|
+
* which the Sentry plugin cannot see. When set, only this file is read
|
|
10
|
+
* (no default-name probing), and a warning is emitted if it is missing or
|
|
11
|
+
* unparseable.
|
|
12
|
+
*
|
|
13
|
+
* @default undefined (probes `wrangler.json`, `wrangler.jsonc`, `wrangler.toml` at the Vite root)
|
|
14
|
+
*/
|
|
15
|
+
wranglerConfigPath?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Experimental options that may change or be removed without notice.
|
|
18
|
+
*/
|
|
19
|
+
_experimental?: {
|
|
20
|
+
/**
|
|
21
|
+
* Enables build-time automatic instrumentation of supported dependencies
|
|
22
|
+
* (e.g. database clients like `mysql`) so the Sentry Cloudflare SDK can
|
|
23
|
+
* trace them without monkey-patching, which wouldn't work in workerd anyway.
|
|
24
|
+
*
|
|
25
|
+
* When enabled, the plugin injects `diagnostics_channel.tracingChannel`
|
|
26
|
+
* calls into the bundled packages and, next to each, a snippet that
|
|
27
|
+
* registers the matching Sentry channel-subscriber factory on the global
|
|
28
|
+
* marker, which the SDK picks up in `Sentry.withSentry()`. Both `vite build`
|
|
29
|
+
* and `vite dev` are instrumented.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
* @experimental May change or be removed in any release.
|
|
33
|
+
*/
|
|
34
|
+
useDiagnosticsChannelInjection?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Automatically wraps your Worker at build time so you don't have to edit
|
|
37
|
+
* your entry: the plugin reads your wrangler config, wraps the default
|
|
38
|
+
* export with `Sentry.withSentry()` (sourcing options from a co-located
|
|
39
|
+
* `instrument.*` file, falling back to env), and wraps any configured
|
|
40
|
+
* Durable Object class with `instrumentDurableObjectWithSentry`. Both
|
|
41
|
+
* `vite build` and `vite dev` are instrumented.
|
|
42
|
+
*
|
|
43
|
+
* @default false
|
|
44
|
+
* @experimental May change or be removed in any release.
|
|
45
|
+
*/
|
|
46
|
+
autoInstrumentation?: boolean;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sentry Vite plugin for Cloudflare Workers.
|
|
51
|
+
*
|
|
52
|
+
* Add this plugin to your Vite configuration to enable additional Sentry
|
|
53
|
+
* instrumentation for Cloudflare Workers built with Vite. Configure the Sentry
|
|
54
|
+
* SDK in your Worker as usual with `Sentry.withSentry()`.
|
|
55
|
+
*
|
|
56
|
+
* Currently, the only functionality is the experimental
|
|
57
|
+
* `_experimental.useDiagnosticsChannelInjection` option, which traces supported
|
|
58
|
+
* dependencies (such as database clients) without changing your application
|
|
59
|
+
* code. Without it, the plugin is a no-op.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* // vite.config.ts
|
|
64
|
+
* import { cloudflare } from '@cloudflare/vite-plugin';
|
|
65
|
+
* import { sentryCloudflareVitePlugin } from '@sentry/cloudflare/vite';
|
|
66
|
+
* import { defineConfig } from 'vite';
|
|
67
|
+
*
|
|
68
|
+
* export default defineConfig({
|
|
69
|
+
* plugins: [
|
|
70
|
+
* cloudflare(),
|
|
71
|
+
* sentryCloudflareVitePlugin({
|
|
72
|
+
* _experimental: {
|
|
73
|
+
* useDiagnosticsChannelInjection: true,
|
|
74
|
+
* },
|
|
75
|
+
* }),
|
|
76
|
+
* ],
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function sentryCloudflareVitePlugin(options?: SentryCloudflareVitePluginOptions): ({
|
|
81
|
+
name: string;
|
|
82
|
+
configResolved(config: {
|
|
83
|
+
root: string;
|
|
84
|
+
logger?: {
|
|
85
|
+
warn(msg: string): void;
|
|
86
|
+
};
|
|
87
|
+
}): void;
|
|
88
|
+
transform(this: import("./agentClass").ModuleResolver & {
|
|
89
|
+
warn?(msg: string): void;
|
|
90
|
+
environment?: {
|
|
91
|
+
name?: string;
|
|
92
|
+
};
|
|
93
|
+
}, code: string, id: string): Promise<{
|
|
94
|
+
code: string;
|
|
95
|
+
map: unknown;
|
|
96
|
+
} | undefined>;
|
|
97
|
+
} | import("vite").Plugin<any>)[];
|
|
98
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD;;;;;;;;;OASG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,aAAa,CAAC,EAAE;QACd;;;;;;;;;;;;;WAaG;QACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;QACzC;;;;;;;;;;WAUG;QACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;KAC/B,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,GAAE,iCAAsC;;;;cA5DlF,CAAC;;;;;YAiCgE,CAAC;mBAChD,CAAC;gBAAS,CAAA;;;;;;kCAmCnC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const ENV_FALLBACK_OPTIONS_FN = "() => undefined";
|
|
2
|
+
/**
|
|
3
|
+
* Locate the conventional `instrument.server.*` module sitting next to the
|
|
4
|
+
* worker entry file. Returns its absolute path, or `undefined` when absent.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveInstrumentFile(entryFilePath: string): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Build the `optionsFn` reference and `import` statement for the instrument
|
|
9
|
+
* module whose **default export** is the options callback
|
|
10
|
+
* `(env) => CloudflareOptions`.
|
|
11
|
+
*
|
|
12
|
+
* The import is emitted relative to `entryFilePath` because it is injected into
|
|
13
|
+
* the entry file's source. The file extension is kept: extensionless specifiers
|
|
14
|
+
* only resolve for extensions in Vite's default `resolve.extensions` (which
|
|
15
|
+
* excludes `.cjs`), and keeping it makes our probe order authoritative when
|
|
16
|
+
* several `instrument.server.*` files coexist.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildOptionsImport(entryFilePath: string, instrumentFilePath: string): {
|
|
19
|
+
optionsFn: string;
|
|
20
|
+
importStmt: string;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=instrumentFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentFile.d.ts","sourceRoot":"","sources":["../../../src/vite/instrumentFile.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AAWzD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO/E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,GACzB;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAQ3C"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ProgramBody } from './transform';
|
|
2
|
+
/** Binding name used for a module's default export. */
|
|
3
|
+
export declare const DEFAULT_EXPORT = "default";
|
|
4
|
+
/** A resolved superclass reference: a bare identifier or a `ns.Member` expression. */
|
|
5
|
+
export type SuperRef = {
|
|
6
|
+
kind: 'identifier';
|
|
7
|
+
name: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'member';
|
|
10
|
+
object: string;
|
|
11
|
+
property: string;
|
|
12
|
+
};
|
|
13
|
+
/** The declarations of a single module that binding resolution needs. */
|
|
14
|
+
export interface ModuleShape {
|
|
15
|
+
/** Top-level class names → their superclass reference (absent when the class has no `extends`). */
|
|
16
|
+
classes: Map<string, SuperRef | undefined>;
|
|
17
|
+
/** Local binding name → the import it came from (`imported` is `default` for a default import). */
|
|
18
|
+
imports: Map<string, {
|
|
19
|
+
source: string;
|
|
20
|
+
imported: string;
|
|
21
|
+
}>;
|
|
22
|
+
/** Local binding name → module specifier, for `import * as ns from '...'`. */
|
|
23
|
+
namespaces: Map<string, string>;
|
|
24
|
+
/** Exported name → the re-export it came from, for `export { x as y } from '...'`. */
|
|
25
|
+
reexports: Map<string, {
|
|
26
|
+
source: string;
|
|
27
|
+
imported: string;
|
|
28
|
+
}>;
|
|
29
|
+
/** Exported name → local binding name, for `export { x as y }` without a source. */
|
|
30
|
+
localExports: Map<string, string>;
|
|
31
|
+
/** Module specifiers of bare `export * from '...'` declarations. */
|
|
32
|
+
starExports: string[];
|
|
33
|
+
/** `export default <Identifier>` — the local name it refers to. */
|
|
34
|
+
defaultExportName?: string;
|
|
35
|
+
/** True when the module's default export is a class declaration/expression. */
|
|
36
|
+
defaultExportIsClass?: boolean;
|
|
37
|
+
/** Superclass of an anonymous `export default class extends X`. */
|
|
38
|
+
defaultExportSuper?: SuperRef;
|
|
39
|
+
}
|
|
40
|
+
/** Collect the shape of a module from its parsed AST — used for the already-parsed entry module. */
|
|
41
|
+
export declare function shapeFromAst(ast: ProgramBody): ModuleShape;
|
|
42
|
+
/**
|
|
43
|
+
* Extract the module shape from **unprocessed source**.
|
|
44
|
+
*
|
|
45
|
+
* Sibling modules are read straight from disk (the plugin context's `load()` would deadlock inside a
|
|
46
|
+
* transform hook), so they may still be TypeScript — which no JS parser will accept. Only
|
|
47
|
+
* import/export statements and `class X extends Y` headers matter here, and those are
|
|
48
|
+
* declaration-level syntax a scan can pick out reliably; class bodies, type annotations and generics
|
|
49
|
+
* are irrelevant and simply skipped.
|
|
50
|
+
*/
|
|
51
|
+
export declare function shapeFromSource(rawCode: string): ModuleShape;
|
|
52
|
+
//# sourceMappingURL=moduleShape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moduleShape.d.ts","sourceRoot":"","sources":["../../../src/vite/moduleShape.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,aAAa,CAAC;AAoDzD,uDAAuD;AACvD,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC,sFAAsF;AACtF,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnH,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,mGAAmG;IACnG,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;IAC3C,mGAAmG;IACnG,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D,8EAA8E;IAC9E,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,sFAAsF;IACtF,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D,oFAAoF;IACpF,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,oEAAoE;IACpE,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,QAAQ,CAAC;CAC/B;AAiBD,oGAAoG;AACpG,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,CAqC1D;AAiED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAgD5D"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import MagicString from 'magic-string';
|
|
2
|
+
export interface BaseNode {
|
|
3
|
+
type: string;
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ProgramBody {
|
|
8
|
+
body: BaseNode[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The kind of Sentry wrapper to apply to an exported class.
|
|
12
|
+
*
|
|
13
|
+
* `durableObject` and `workflow` are keyed by name from the wrangler config
|
|
14
|
+
* (`durable_objects.bindings`, `workflows`), since those class names are
|
|
15
|
+
* authoritative there. `workerEntrypoint` is different: a worker's own
|
|
16
|
+
* entrypoints aren't enumerated in its config, so they're detected structurally
|
|
17
|
+
* (a class extending `WorkerEntrypoint` from `cloudflare:workers`), with the
|
|
18
|
+
* config providing only a fallback for self-bound entrypoints whose base class
|
|
19
|
+
* lives in another module.
|
|
20
|
+
*/
|
|
21
|
+
export type ClassWrapperKind = 'durableObject' | 'agent' | 'workflow' | 'workerEntrypoint';
|
|
22
|
+
export interface TransformContext {
|
|
23
|
+
/**
|
|
24
|
+
* Exported class name → the kind of Sentry wrapper to apply. Populated from
|
|
25
|
+
* the wrangler config, so the transform can wrap by name without resolving
|
|
26
|
+
* each class's base type.
|
|
27
|
+
*/
|
|
28
|
+
classWrappers: Map<string, ClassWrapperKind>;
|
|
29
|
+
/**
|
|
30
|
+
* Local class names detected as `agents` Agents. An Agent is configured as a Durable Object in
|
|
31
|
+
* wrangler, so this upgrades those entries from `durableObject` to `agent`.
|
|
32
|
+
*/
|
|
33
|
+
agentClasses?: ReadonlySet<string>;
|
|
34
|
+
optionsFn: string;
|
|
35
|
+
/** Import statement prepended when `optionsFn` references a separate module. */
|
|
36
|
+
optionsImport?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface TransformResult {
|
|
39
|
+
code: string;
|
|
40
|
+
map: ReturnType<MagicString['generateMap']>;
|
|
41
|
+
/**
|
|
42
|
+
* The configured class names that were actually wrapped. Lets the plugin warn
|
|
43
|
+
* about configured classes it could not find, instead of silently leaving
|
|
44
|
+
* them uninstrumented.
|
|
45
|
+
*/
|
|
46
|
+
wrappedClasses: Set<string>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Rewrite the worker entry source to wrap its default export with `withSentry`
|
|
50
|
+
* and any configured class export with its matching Sentry wrapper (see
|
|
51
|
+
* {@link TransformContext.classWrappers}, e.g. Durable Object classes with
|
|
52
|
+
* `instrumentDurableObjectWithSentry`).
|
|
53
|
+
*
|
|
54
|
+
* Handles both `export class MyDO {}` and the specifier form
|
|
55
|
+
* (`class MyDO {}` … `export { MyDO }` / `export { Foo as MyDO }`).
|
|
56
|
+
* Re-exports from other modules (`export { MyDO } from './do'`) cannot be
|
|
57
|
+
* wrapped here and are left alone — the plugin warns about them via
|
|
58
|
+
* {@link TransformResult.wrappedClasses}.
|
|
59
|
+
*
|
|
60
|
+
* Exported (rather than inlined into the plugin) so it can be unit-tested with a
|
|
61
|
+
* plain AST and no Vite context. Returns `undefined` when nothing was wrapped and
|
|
62
|
+
* there are no already-manually-wrapped classes to report.
|
|
63
|
+
*/
|
|
64
|
+
export declare function applyAutoInstrumentTransforms(code: string, ast: ProgramBody, ctx: TransformContext): TransformResult | undefined;
|
|
65
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/vite/transform.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAC;AAOvC,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,EAAE,CAAC;CAClB;AAuDD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,OAAO,GAAG,UAAU,GAAG,kBAAkB,CAAC;AAc3F,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;IAC5C;;;;OAIG;IACH,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,gBAAgB,GACpB,eAAe,GAAG,SAAS,CA8C7B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ProgramBody } from './transform';
|
|
2
|
+
/**
|
|
3
|
+
* Find top-level classes that (transitively, within this module) extend
|
|
4
|
+
* `WorkerEntrypoint` imported from `cloudflare:workers`. esbuild has already
|
|
5
|
+
* stripped TypeScript by transform time, so a superclass is a plain identifier
|
|
6
|
+
* (`extends WorkerEntrypoint`) or member access (`extends cf.WorkerEntrypoint`).
|
|
7
|
+
*
|
|
8
|
+
* Only same-file base chains are resolvable here; a base class imported from
|
|
9
|
+
* another module is invisible and relies on the config self-binding fallback.
|
|
10
|
+
*/
|
|
11
|
+
export declare function detectWorkerEntrypointClasses(ast: ProgramBody): Set<string>;
|
|
12
|
+
//# sourceMappingURL=workerEntrypoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workerEntrypoint.d.ts","sourceRoot":"","sources":["../../../src/vite/workerEntrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,aAAa,CAAC;AA0CzD;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CA8B3E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The slice of the wrangler configuration the auto-instrument plugin cares
|
|
3
|
+
* about. `main` is an absolute path (wrangler resolves it against the config
|
|
4
|
+
* file's directory).
|
|
5
|
+
*/
|
|
6
|
+
export interface WranglerConfig {
|
|
7
|
+
main?: string;
|
|
8
|
+
durableObjects: Array<{
|
|
9
|
+
name: string;
|
|
10
|
+
className: string;
|
|
11
|
+
}>;
|
|
12
|
+
workflows: Array<{
|
|
13
|
+
name: string;
|
|
14
|
+
className: string;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Named `WorkerEntrypoint` exports this worker binds to itself via a service
|
|
18
|
+
* binding (`services[]` whose `service` is this worker's own `name`). Only
|
|
19
|
+
* self-bindings appear here: a service binding's `entrypoint` otherwise names
|
|
20
|
+
* an export on a *different* worker, which this build can't wrap.
|
|
21
|
+
*/
|
|
22
|
+
workerEntrypoints: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Locate and resolve the wrangler configuration via wrangler's own
|
|
26
|
+
* `unstable_readConfig` — the API `@cloudflare/vite-plugin` uses.
|
|
27
|
+
*
|
|
28
|
+
* We only locate the file (probing `wrangler.json`, `.jsonc`, `.toml` inside
|
|
29
|
+
* `root` with wrangler's own precedence, since it discovers from `cwd` rather
|
|
30
|
+
* than an arbitrary root); wrangler then parses it, flattens the active
|
|
31
|
+
* environment (honoring `CLOUDFLARE_ENV`), and resolves `main` to an absolute
|
|
32
|
+
* path. Durable Object and Workflow bindings are the active environment's,
|
|
33
|
+
* matching what the deployed Worker actually binds.
|
|
34
|
+
*
|
|
35
|
+
* Returns `undefined` when no config file is found or it can't be read/parsed
|
|
36
|
+
* (the caller warns and disables auto-instrumentation rather than failing the
|
|
37
|
+
* whole build).
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveWranglerConfig(root: string, explicitPath?: string): {
|
|
40
|
+
config: WranglerConfig;
|
|
41
|
+
configDir: string;
|
|
42
|
+
} | undefined;
|
|
43
|
+
//# sourceMappingURL=wranglerConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wranglerConfig.d.ts","sourceRoot":"","sources":["../../../src/vite/wranglerConfig.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtD;;;;;OAKG;IACH,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,GACpB;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CA2B3D"}
|
|
@@ -41,6 +41,8 @@ export declare class CloudflareClient extends ServerRuntimeClient {
|
|
|
41
41
|
* After calling dispose(), the client should not be used anymore.
|
|
42
42
|
*/
|
|
43
43
|
dispose(): void;
|
|
44
|
+
/** @inheritDoc */
|
|
45
|
+
protected _setupIntegrations(): void;
|
|
44
46
|
/**
|
|
45
47
|
* Resets the span completion promise and resolve function.
|
|
46
48
|
*/
|
|
@@ -132,6 +134,30 @@ interface BaseCloudflareOptions {
|
|
|
132
134
|
* ```
|
|
133
135
|
*/
|
|
134
136
|
durableObjectSqlSpanAllowlist?: Array<string | RegExp>;
|
|
137
|
+
/**
|
|
138
|
+
* KV keys that should stay instrumented even though they match a reserved prefix used by Durable
|
|
139
|
+
* Object frameworks (`agents`, `partyserver`, ...) for their internal storage entries.
|
|
140
|
+
*
|
|
141
|
+
* By default, KV reads/writes (`get`, `put`, `delete`, `list`) of `cf_`- or `__ps_`-prefixed keys
|
|
142
|
+
* are treated as framework noise and no `durable_object_storage_*` span is created for them,
|
|
143
|
+
* mirroring how `cf_`-prefixed SQL tables are handled (see {@link durableObjectSqlSpanAllowlist}).
|
|
144
|
+
* If one of your own keys happens to use such a prefix, add it here to opt it back into
|
|
145
|
+
* instrumentation. Strings must match exactly, while regular expressions give you prefix/pattern
|
|
146
|
+
* matching.
|
|
147
|
+
*
|
|
148
|
+
* @default []
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* export default Sentry.withSentry(
|
|
152
|
+
* (env) => ({
|
|
153
|
+
* dsn: env.SENTRY_DSN,
|
|
154
|
+
* durableObjectStorageSpanAllowlist: ['cf_my_key', /^cf_reports_/],
|
|
155
|
+
* }),
|
|
156
|
+
* handler,
|
|
157
|
+
* );
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
durableObjectStorageSpanAllowlist?: Array<string | RegExp>;
|
|
135
161
|
/**
|
|
136
162
|
* @deprecated Use `enableRpcTracePropagation` instead. This option will be removed in a future major version.
|
|
137
163
|
*
|
|
@@ -145,6 +171,17 @@ interface BaseCloudflareOptions {
|
|
|
145
171
|
* @default false
|
|
146
172
|
*/
|
|
147
173
|
instrumentPrototypeMethods?: boolean | string[];
|
|
174
|
+
/**
|
|
175
|
+
* If you use Spotlight by Sentry during development, use
|
|
176
|
+
* this option to forward captured Sentry events to Spotlight.
|
|
177
|
+
*
|
|
178
|
+
* Either set it to true, or provide a specific Spotlight Sidecar URL.
|
|
179
|
+
*
|
|
180
|
+
* More details: https://spotlightjs.com/
|
|
181
|
+
*
|
|
182
|
+
* IMPORTANT: Only set this option to `true` while developing, not in production!
|
|
183
|
+
*/
|
|
184
|
+
spotlight?: boolean | string;
|
|
148
185
|
}
|
|
149
186
|
/**
|
|
150
187
|
* Configuration options for the Sentry Cloudflare SDK
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { env as cloudflareEnv } from 'cloudflare:workers';
|
|
2
|
+
import { CloudflareOptions } from './client';
|
|
3
|
+
/**
|
|
4
|
+
* Define the Sentry options for a Cloudflare Worker in a dedicated module.
|
|
5
|
+
*
|
|
6
|
+
* This is the recommended way to configure the SDK when using the Vite plugin's
|
|
7
|
+
* auto-instrumentation: place an `instrument.server.{ts,js,mjs}` file next to
|
|
8
|
+
* the worker entry whose **default export** is the result of this function. The
|
|
9
|
+
* plugin picks it up automatically and hands it to `withSentry`.
|
|
10
|
+
*
|
|
11
|
+
* Unlike Node's `Sentry.init(...)`, the options cannot be applied at module
|
|
12
|
+
* load time on Cloudflare: the DSN and other settings typically come from the
|
|
13
|
+
* per-request `env`, which only exists inside the handler. Pass a callback to
|
|
14
|
+
* read from `env`, or a static object when no `env` access is needed — either
|
|
15
|
+
* way you get full type-checking and autocomplete on {@link CloudflareOptions}.
|
|
16
|
+
*
|
|
17
|
+
* At runtime this is a thin pass-through; it only normalizes a static object
|
|
18
|
+
* into a callback so the plugin always imports a `(env) => options` function.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* // src/instrument.server.ts
|
|
23
|
+
* import { defineCloudflareOptions } from '@sentry/cloudflare';
|
|
24
|
+
*
|
|
25
|
+
* export default defineCloudflareOptions((env) => ({
|
|
26
|
+
* dsn: env.SENTRY_DSN,
|
|
27
|
+
* tracesSampleRate: 1.0,
|
|
28
|
+
* }));
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* // Static options — no `env` access needed
|
|
34
|
+
* export default defineCloudflareOptions({ tracesSampleRate: 1.0 });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function defineCloudflareOptions<Env = typeof cloudflareEnv>(optionsOrCallback: CloudflareOptions | ((env: Env) => CloudflareOptions | undefined)): (env: Env) => CloudflareOptions | undefined;
|
|
38
|
+
//# sourceMappingURL=defineCloudflareOptions.d.ts.map
|