@sentry/cloudflare 10.67.0 → 10.68.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/defineCloudflareOptions.js +11 -0
- package/build/cjs/defineCloudflareOptions.js.map +1 -0
- package/build/cjs/index.js +3 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai.js.map +1 -1
- package/build/cjs/nodejs_compat/index.js +5 -2
- 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/sdk.js +12 -1
- package/build/cjs/sdk.js.map +1 -1
- package/build/cjs/vite/autoInstrument.js +81 -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/transform.js +144 -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/defineCloudflareOptions.js +9 -0
- package/build/esm/defineCloudflareOptions.js.map +1 -0
- package/build/esm/index.js +2 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai.js.map +1 -1
- package/build/esm/nodejs_compat/index.js +3 -2
- 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/package.json +1 -1
- package/build/esm/sdk.js +13 -2
- package/build/esm/sdk.js.map +1 -1
- package/build/esm/vite/autoInstrument.js +79 -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/transform.js +142 -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/defineCloudflareOptions.d.ts +38 -0
- package/build/types/defineCloudflareOptions.d.ts.map +1 -0
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- 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/sdk.d.ts.map +1 -1
- package/build/types/vite/autoInstrument.d.ts +21 -0
- package/build/types/vite/autoInstrument.d.ts.map +1 -0
- package/build/types/vite/index.d.ts +88 -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/transform.d.ts +60 -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/defineCloudflareOptions.d.ts +38 -0
- package/build/types-ts3.8/index.d.ts +2 -1
- 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/vite/autoInstrument.d.ts +21 -0
- package/build/types-ts3.8/vite/index.d.ts +88 -0
- package/build/types-ts3.8/vite/instrumentFile.d.ts +22 -0
- package/build/types-ts3.8/vite/transform.d.ts +60 -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
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
function detectWorkerEntrypointClasses(ast) {
|
|
2
|
+
const bases = collectWorkerEntrypointImports(ast);
|
|
3
|
+
if (bases.named.size === 0 && bases.namespaces.size === 0) {
|
|
4
|
+
return /* @__PURE__ */ new Set();
|
|
5
|
+
}
|
|
6
|
+
const classes = /* @__PURE__ */ new Map();
|
|
7
|
+
for (const node of ast.body) {
|
|
8
|
+
const classNode = asClassDeclaration(node);
|
|
9
|
+
if (classNode?.id?.name) classes.set(classNode.id.name, classNode);
|
|
10
|
+
}
|
|
11
|
+
const entrypoints = /* @__PURE__ */ new Set();
|
|
12
|
+
let changed = true;
|
|
13
|
+
while (changed) {
|
|
14
|
+
changed = false;
|
|
15
|
+
for (const [name, classNode] of classes) {
|
|
16
|
+
if (entrypoints.has(name)) continue;
|
|
17
|
+
if (extendsWorkerEntrypoint(classNode.superClass, bases, entrypoints)) {
|
|
18
|
+
entrypoints.add(name);
|
|
19
|
+
changed = true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return entrypoints;
|
|
24
|
+
}
|
|
25
|
+
function asClassDeclaration(node) {
|
|
26
|
+
if (node.type === "ClassDeclaration") return node;
|
|
27
|
+
if (node.type === "ExportNamedDeclaration") {
|
|
28
|
+
const decl = node.declaration;
|
|
29
|
+
if (decl?.type === "ClassDeclaration") return decl;
|
|
30
|
+
}
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
function collectWorkerEntrypointImports(ast) {
|
|
34
|
+
const named = /* @__PURE__ */ new Set();
|
|
35
|
+
const namespaces = /* @__PURE__ */ new Set();
|
|
36
|
+
for (const node of ast.body) {
|
|
37
|
+
if (node.type !== "ImportDeclaration") continue;
|
|
38
|
+
const importNode = node;
|
|
39
|
+
if (importNode.source?.value !== "cloudflare:workers") continue;
|
|
40
|
+
for (const specifier of importNode.specifiers ?? []) {
|
|
41
|
+
if (specifier.type === "ImportSpecifier" && specifier.imported?.name === "WorkerEntrypoint" && specifier.local?.name) {
|
|
42
|
+
named.add(specifier.local.name);
|
|
43
|
+
} else if (specifier.type === "ImportNamespaceSpecifier" && specifier.local?.name) {
|
|
44
|
+
namespaces.add(specifier.local.name);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return { named, namespaces };
|
|
49
|
+
}
|
|
50
|
+
function extendsWorkerEntrypoint(superClass, bases, detected) {
|
|
51
|
+
if (!superClass) return false;
|
|
52
|
+
if (superClass.type === "Identifier") {
|
|
53
|
+
const name = superClass.name;
|
|
54
|
+
return bases.named.has(name) || detected.has(name);
|
|
55
|
+
}
|
|
56
|
+
if (superClass.type === "MemberExpression") {
|
|
57
|
+
const member = superClass;
|
|
58
|
+
return member.object?.type === "Identifier" && !!member.object.name && bases.namespaces.has(member.object.name) && member.property?.name === "WorkerEntrypoint";
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { detectWorkerEntrypointClasses };
|
|
64
|
+
//# sourceMappingURL=workerEntrypoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workerEntrypoint.js","sources":["../../../src/vite/workerEntrypoint.ts"],"sourcesContent":["import type { BaseNode, ProgramBody } from './transform';\n\n// ---------------------------------------------------------------------------\n// Minimal ESTree node shapes for structural WorkerEntrypoint detection.\n// ---------------------------------------------------------------------------\n\ninterface IdentifierNode extends BaseNode {\n name: string;\n}\n\ninterface MemberExpressionNode extends BaseNode {\n object?: { type: string; name?: string };\n property?: { type: string; name?: string };\n}\n\ninterface ClassDeclarationNode extends BaseNode {\n id?: IdentifierNode | null;\n superClass?: BaseNode | null;\n}\n\ninterface ExportNamedDeclNode extends BaseNode {\n declaration?: BaseNode | null;\n}\n\ninterface ImportSpecifierNode {\n type: string;\n imported?: { type: string; name?: string };\n local?: { type: string; name?: string };\n}\n\ninterface ImportDeclarationNode extends BaseNode {\n source?: { value?: unknown };\n specifiers?: ImportSpecifierNode[];\n}\n\ninterface WorkerEntrypointBases {\n /** Local identifiers bound to the named `WorkerEntrypoint` import. */\n named: Set<string>;\n /** Local identifiers bound to a `* as ns` import of `cloudflare:workers`. */\n namespaces: Set<string>;\n}\n\n/**\n * Find top-level classes that (transitively, within this module) extend\n * `WorkerEntrypoint` imported from `cloudflare:workers`. esbuild has already\n * stripped TypeScript by transform time, so a superclass is a plain identifier\n * (`extends WorkerEntrypoint`) or member access (`extends cf.WorkerEntrypoint`).\n *\n * Only same-file base chains are resolvable here; a base class imported from\n * another module is invisible and relies on the config self-binding fallback.\n */\nexport function detectWorkerEntrypointClasses(ast: ProgramBody): Set<string> {\n const bases = collectWorkerEntrypointImports(ast);\n if (bases.named.size === 0 && bases.namespaces.size === 0) {\n return new Set<string>();\n }\n\n // Every top-level class, including the `export class Foo {}` form (where the\n // class is nested inside an ExportNamedDeclaration) so directly-exported\n // entrypoints are seen too.\n const classes = new Map<string, ClassDeclarationNode>();\n for (const node of ast.body) {\n const classNode = asClassDeclaration(node);\n if (classNode?.id?.name) classes.set(classNode.id.name, classNode);\n }\n\n const entrypoints = new Set<string>();\n // Iterate to a fixed point so an indirect chain (A extends B extends WE) is\n // fully resolved regardless of declaration order.\n let changed = true;\n while (changed) {\n changed = false;\n for (const [name, classNode] of classes) {\n if (entrypoints.has(name)) continue;\n if (extendsWorkerEntrypoint(classNode.superClass, bases, entrypoints)) {\n entrypoints.add(name);\n changed = true;\n }\n }\n }\n return entrypoints;\n}\n\n/** Unwrap `export class Foo {}` to its ClassDeclaration; pass bare classes through. */\nfunction asClassDeclaration(node: BaseNode): ClassDeclarationNode | undefined {\n if (node.type === 'ClassDeclaration') return node as ClassDeclarationNode;\n if (node.type === 'ExportNamedDeclaration') {\n const decl = (node as ExportNamedDeclNode).declaration;\n if (decl?.type === 'ClassDeclaration') return decl as ClassDeclarationNode;\n }\n return undefined;\n}\n\nfunction collectWorkerEntrypointImports(ast: ProgramBody): WorkerEntrypointBases {\n const named = new Set<string>();\n const namespaces = new Set<string>();\n for (const node of ast.body) {\n if (node.type !== 'ImportDeclaration') continue;\n const importNode = node as ImportDeclarationNode;\n if (importNode.source?.value !== 'cloudflare:workers') continue;\n for (const specifier of importNode.specifiers ?? []) {\n if (\n specifier.type === 'ImportSpecifier' &&\n specifier.imported?.name === 'WorkerEntrypoint' &&\n specifier.local?.name\n ) {\n named.add(specifier.local.name);\n } else if (specifier.type === 'ImportNamespaceSpecifier' && specifier.local?.name) {\n namespaces.add(specifier.local.name);\n }\n }\n }\n return { named, namespaces };\n}\n\n/**\n * Whether a superclass expression resolves to `WorkerEntrypoint` — either a bare\n * identifier from the named import (or an already-detected local subclass), or a\n * `ns.WorkerEntrypoint` member access off a namespace import.\n */\nfunction extendsWorkerEntrypoint(\n superClass: BaseNode | null | undefined,\n bases: WorkerEntrypointBases,\n detected: Set<string>,\n): boolean {\n if (!superClass) return false;\n if (superClass.type === 'Identifier') {\n const name = (superClass as IdentifierNode).name;\n return bases.named.has(name) || detected.has(name);\n }\n if (superClass.type === 'MemberExpression') {\n const member = superClass as MemberExpressionNode;\n return (\n member.object?.type === 'Identifier' &&\n !!member.object.name &&\n bases.namespaces.has(member.object.name) &&\n member.property?.name === 'WorkerEntrypoint'\n );\n }\n return false;\n}\n"],"names":[],"mappings":"AAmDO,SAAS,8BAA8B,GAAA,EAA+B;AAC3E,EAAA,MAAM,KAAA,GAAQ,+BAA+B,GAAG,CAAA;AAChD,EAAA,IAAI,MAAM,KAAA,CAAM,IAAA,KAAS,KAAK,KAAA,CAAM,UAAA,CAAW,SAAS,CAAA,EAAG;AACzD,IAAA,2BAAW,GAAA,EAAY;AAAA,EACzB;AAKA,EAAA,MAAM,OAAA,uBAAc,GA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IAAA,KAAS,kBAAA;AAAA,EAE9B;AACA,EAAA,OAAO,KAAA;AACT;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { resolve, dirname } from 'node:path';
|
|
3
|
+
import { unstable_readConfig } from 'wrangler';
|
|
4
|
+
|
|
5
|
+
function resolveWranglerConfig(root, explicitPath) {
|
|
6
|
+
const configPath = ["wrangler.json", "wrangler.jsonc", "wrangler.toml"].map((name) => resolve(root, name)).find(existsSync);
|
|
7
|
+
if (!configPath || !existsSync(configPath)) {
|
|
8
|
+
return void 0;
|
|
9
|
+
}
|
|
10
|
+
let raw;
|
|
11
|
+
try {
|
|
12
|
+
raw = unstable_readConfig({ config: configPath }, { hideWarnings: true });
|
|
13
|
+
} catch {
|
|
14
|
+
return void 0;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
config: {
|
|
18
|
+
main: raw.main,
|
|
19
|
+
durableObjects: collectClassBindings(raw.durable_objects?.bindings),
|
|
20
|
+
workflows: collectClassBindings(raw.workflows),
|
|
21
|
+
workerEntrypoints: collectSelfBoundEntrypoints(raw)
|
|
22
|
+
},
|
|
23
|
+
configDir: dirname(raw.configPath ?? configPath)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function collectSelfBoundEntrypoints(raw) {
|
|
27
|
+
if (!raw.name) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
const entrypoints = /* @__PURE__ */ new Set();
|
|
31
|
+
for (const binding of raw.services ?? []) {
|
|
32
|
+
if (binding?.service === raw.name && typeof binding.entrypoint === "string") {
|
|
33
|
+
entrypoints.add(binding.entrypoint);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return [...entrypoints];
|
|
37
|
+
}
|
|
38
|
+
function collectClassBindings(bindings) {
|
|
39
|
+
const result = [];
|
|
40
|
+
const seenClassNames = /* @__PURE__ */ new Set();
|
|
41
|
+
for (const binding of bindings ?? []) {
|
|
42
|
+
if (typeof binding?.class_name !== "string" || binding.script_name || seenClassNames.has(binding.class_name)) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
seenClassNames.add(binding.class_name);
|
|
46
|
+
result.push({ name: binding.name, className: binding.class_name });
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { resolveWranglerConfig };
|
|
52
|
+
//# sourceMappingURL=wranglerConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wranglerConfig.js","sources":["../../../src/vite/wranglerConfig.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport { type Unstable_Config, unstable_readConfig } from 'wrangler';\n\n/**\n * The slice of the wrangler configuration the auto-instrument plugin cares\n * about. `main` is an absolute path (wrangler resolves it against the config\n * file's directory).\n */\nexport interface WranglerConfig {\n main?: string;\n durableObjects: Array<{ name: string; className: string }>;\n workflows: Array<{ name: string; className: string }>;\n /**\n * Named `WorkerEntrypoint` exports this worker binds to itself via a service\n * binding (`services[]` whose `service` is this worker's own `name`). Only\n * self-bindings appear here: a service binding's `entrypoint` otherwise names\n * an export on a *different* worker, which this build can't wrap.\n */\n workerEntrypoints: string[];\n}\n\n/**\n * Locate and resolve the wrangler configuration via wrangler's own\n * `unstable_readConfig` — the API `@cloudflare/vite-plugin` uses.\n *\n * We only locate the file (probing `wrangler.json`, `.jsonc`, `.toml` inside\n * `root` with wrangler's own precedence, since it discovers from `cwd` rather\n * than an arbitrary root); wrangler then parses it, flattens the active\n * environment (honoring `CLOUDFLARE_ENV`), and resolves `main` to an absolute\n * path. Durable Object and Workflow bindings are the active environment's,\n * matching what the deployed Worker actually binds.\n *\n * Returns `undefined` when no config file is found or it can't be read/parsed\n * (the caller warns and disables auto-instrumentation rather than failing the\n * whole build).\n */\nexport function resolveWranglerConfig(\n root: string,\n explicitPath?: string,\n): { config: WranglerConfig; configDir: string } | undefined {\n const configPath = explicitPath\n ? resolve(root, explicitPath)\n : ['wrangler.json', 'wrangler.jsonc', 'wrangler.toml'].map(name => resolve(root, name)).find(existsSync);\n\n if (!configPath || !existsSync(configPath)) {\n return undefined;\n }\n\n let raw: Unstable_Config;\n try {\n // `hideWarnings` keeps wrangler's config diagnostics (e.g. missing DO\n // migrations) out of the Vite build output.\n raw = unstable_readConfig({ config: configPath }, { hideWarnings: true });\n } catch {\n return undefined;\n }\n\n return {\n config: {\n main: raw.main,\n durableObjects: collectClassBindings(raw.durable_objects?.bindings),\n workflows: collectClassBindings(raw.workflows),\n workerEntrypoints: collectSelfBoundEntrypoints(raw),\n },\n configDir: dirname(raw.configPath ?? configPath),\n };\n}\n\n/**\n * Collect named `WorkerEntrypoint` exports the worker binds to itself. A service\n * binding's `entrypoint` normally names an export on the *target* worker, so it\n * is only ours when `service` equals this worker's own `name`. Without a `name`\n * there is nothing to match against, so no entrypoints are derivable.\n */\nfunction collectSelfBoundEntrypoints(raw: Unstable_Config): string[] {\n if (!raw.name) {\n return [];\n }\n const entrypoints = new Set<string>();\n for (const binding of raw.services ?? []) {\n if (binding?.service === raw.name && typeof binding.entrypoint === 'string') {\n entrypoints.add(binding.entrypoint);\n }\n }\n return [...entrypoints];\n}\n\n/**\n * Map wrangler class bindings (Durable Objects, Workflows — same shape) to the\n * `{ name, className }` the transform needs, skipping duplicates and bindings\n * with a `script_name` (those reference a class exported by a *different*\n * worker, so there is nothing to wrap in this worker's entry file).\n */\nfunction collectClassBindings(\n bindings: ReadonlyArray<{ name: string; class_name?: string; script_name?: string }> | undefined,\n): Array<{ name: string; className: string }> {\n const result: Array<{ name: string; className: string }> = [];\n const seenClassNames = new Set<string>();\n for (const binding of bindings ?? []) {\n if (typeof binding?.class_name !== 'string' || binding.script_name || seenClassNames.has(binding.class_name)) {\n continue;\n }\n seenClassNames.add(binding.class_name);\n result.push({ name: binding.name, className: binding.class_name });\n }\n return result;\n}\n"],"names":[],"mappings":";;;;AAqCO,SAA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AU,CAAA;AAAA,IACpC;AAAA,EACF;AACA,EAAA,OAAO,CAAC,GAAG,WAAW,CAAA;AACxB;AAQA,SAAS,qBACP,QAAA,EAC4C;AAC5C,EAAA,MAAM,SAAqD,EAAC;AAC5D,EAAA,MAAM,cAAA,uBAAqB,GAAA,EAAY;AACvC,EAAA,KAAA,MAAW,OAAA,IAAW,QAAA,IAAY,EAAC,EAAG;AACpC,IAAA,IAAI,OAAO,OAAA,EAAS,UAAA,KAAe,QAAA,IAAY,OAAA,CAAQ,eAAe,cAAA,CAAe,GAAA,CAAI,OAAA,CAAQ,UAAU,CAAA,EAAG;AAC5G,MAAA;AAAA,IACF;AACA,IAAA,cAAA,CAAe,GAAA,CAAI,QAAQ,UAAU,CAAA;AACrC,IAAA,MAAA,CAAO,IAAA,CAAK,EAAE,IAAA,EAAM,OAAA,CAAQ,MAAM,SAAA,EAAW,OAAA,CAAQ,YAAY,CAAA;AAAA,EACnE;AACA,EAAA,OAAO,MAAA;AACT;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { env as cloudflareEnv } from 'cloudflare:workers';
|
|
2
|
+
import type { 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineCloudflareOptions.d.ts","sourceRoot":"","sources":["../../src/defineCloudflareOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,GAAG,OAAO,aAAa,EAChE,iBAAiB,EAAE,iBAAiB,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,iBAAiB,GAAG,SAAS,CAAC,GACnF,CAAC,GAAG,EAAE,GAAG,KAAK,iBAAiB,GAAG,SAAS,CAM7C"}
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export type { Breadcrumb, BreadcrumbHint, PolymorphicRequest, RequestEventData, SdkInfo, Event, EventHint, ErrorEvent, Exception, FeatureFlagsIntegration, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, Metric, ExclusiveEventHintOrCaptureContext, CaptureContext, } from '@sentry/core';
|
|
2
2
|
export type { CloudflareOptions } from './client';
|
|
3
|
-
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setAttribute, setAttributes, setUser, setConversationId, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, bindScopeToEmitter, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, instrumentLangChainEmbeddings, featureFlagsIntegration, growthbookIntegration, logger, metrics, withStreamedSpan, spanStreamingIntegration, instrumentLangGraph, instrumentCreateReactAgent, } from '@sentry/core';
|
|
3
|
+
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setAttribute, setAttributes, setUser, setConversationId, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, bindScopeToEmitter, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, instrumentLangChainEmbeddings, featureFlagsIntegration, growthbookIntegration, logger, metrics, withStreamedSpan, spanStreamingIntegration, instrumentStateGraph, instrumentLangGraph, instrumentCreateReactAgent, } from '@sentry/core';
|
|
4
4
|
export { withSentry } from './withSentry';
|
|
5
|
+
export { defineCloudflareOptions } from './defineCloudflareOptions';
|
|
5
6
|
export { instrumentDurableObjectWithSentry } from './durableobject';
|
|
6
7
|
export { sentryPagesPlugin } from './pages-plugin';
|
|
7
8
|
export { wrapRequestHandler } from './request';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,OAAO,EACP,aAAa,EACb,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,MAAM,EACN,kCAAkC,EAClC,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,KAAK,EACL,eAAe,EACf,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,SAAS,EACT,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,YAAY,EACZ,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,yBAAyB,EACzB,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,2BAA2B,EAE3B,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACn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qBAAqB,EACrB,8BAA8B,EAC9B,6BAA6B,EAC7B,uBAAuB,EACvB,qBAAqB,EACrB,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EAEpB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercelai.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/vercelai.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,UAAU,eAAe;IACvB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"vercelai.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/vercelai.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,UAAU,eAAe;IACvB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAM5B;AAYD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,mBAAmB;;CAA0C,CAAC"}
|
|
@@ -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"}
|
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;AA0B5C,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,CA4B7E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ProgramBody } from './transform';
|
|
2
|
+
export declare function sentryCloudflareAutoInstrumentPlugin(): {
|
|
3
|
+
name: string;
|
|
4
|
+
configResolved(config: {
|
|
5
|
+
root: string;
|
|
6
|
+
logger?: {
|
|
7
|
+
warn(msg: string): void;
|
|
8
|
+
};
|
|
9
|
+
}): void;
|
|
10
|
+
transform(this: {
|
|
11
|
+
parse(code: string): ProgramBody;
|
|
12
|
+
warn?(msg: string): void;
|
|
13
|
+
environment?: {
|
|
14
|
+
name?: string;
|
|
15
|
+
};
|
|
16
|
+
}, code: string, id: string): {
|
|
17
|
+
code: string;
|
|
18
|
+
map: unknown;
|
|
19
|
+
} | undefined;
|
|
20
|
+
};
|
|
21
|
+
//# 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,EAAwD,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAcrG,wBAAgB,oCAAoC;;2BAUzB;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,CAAA;KAAE,GAAG,IAAI;oBAyB5E;QAAE,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAAC,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,WAAW,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,QAC/F,MAAM,MACR,MAAM,GACT;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS;EA6DhD"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for {@link sentryCloudflareVitePlugin}.
|
|
3
|
+
*/
|
|
4
|
+
export interface SentryCloudflareVitePluginOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Experimental options that may change or be removed without notice.
|
|
7
|
+
*/
|
|
8
|
+
_experimental?: {
|
|
9
|
+
/**
|
|
10
|
+
* Enables build-time automatic instrumentation of supported dependencies
|
|
11
|
+
* (e.g. database clients like `mysql`) so the Sentry Cloudflare SDK can
|
|
12
|
+
* trace them without monkey-patching, which wouldn't work in workerd anyway.
|
|
13
|
+
*
|
|
14
|
+
* When enabled, the plugin injects `diagnostics_channel.tracingChannel`
|
|
15
|
+
* calls into the bundled packages and, next to each, a snippet that
|
|
16
|
+
* registers the matching Sentry channel-subscriber factory on the global
|
|
17
|
+
* marker, which the SDK picks up in `Sentry.withSentry()`. Both `vite build`
|
|
18
|
+
* and `vite dev` are instrumented.
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
* @experimental May change or be removed in any release.
|
|
22
|
+
*/
|
|
23
|
+
useDiagnosticsChannelInjection?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Automatically wraps your Worker at build time so you don't have to edit
|
|
26
|
+
* your entry: the plugin reads your wrangler config, wraps the default
|
|
27
|
+
* export with `Sentry.withSentry()` (sourcing options from a co-located
|
|
28
|
+
* `instrument.*` file, falling back to env), and wraps any configured
|
|
29
|
+
* Durable Object class with `instrumentDurableObjectWithSentry`. Both
|
|
30
|
+
* `vite build` and `vite dev` are instrumented.
|
|
31
|
+
*
|
|
32
|
+
* @default false
|
|
33
|
+
* @experimental May change or be removed in any release.
|
|
34
|
+
*/
|
|
35
|
+
autoInstrumentation?: boolean;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Sentry Vite plugin for Cloudflare Workers.
|
|
40
|
+
*
|
|
41
|
+
* Add this plugin to your Vite configuration to enable additional Sentry
|
|
42
|
+
* instrumentation for Cloudflare Workers built with Vite. Configure the Sentry
|
|
43
|
+
* SDK in your Worker as usual with `Sentry.withSentry()`.
|
|
44
|
+
*
|
|
45
|
+
* Currently, the only functionality is the experimental
|
|
46
|
+
* `_experimental.useDiagnosticsChannelInjection` option, which traces supported
|
|
47
|
+
* dependencies (such as database clients) without changing your application
|
|
48
|
+
* code. Without it, the plugin is a no-op.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* // vite.config.ts
|
|
53
|
+
* import { cloudflare } from '@cloudflare/vite-plugin';
|
|
54
|
+
* import { sentryCloudflareVitePlugin } from '@sentry/cloudflare/vite';
|
|
55
|
+
* import { defineConfig } from 'vite';
|
|
56
|
+
*
|
|
57
|
+
* export default defineConfig({
|
|
58
|
+
* plugins: [
|
|
59
|
+
* cloudflare(),
|
|
60
|
+
* sentryCloudflareVitePlugin({
|
|
61
|
+
* _experimental: {
|
|
62
|
+
* useDiagnosticsChannelInjection: true,
|
|
63
|
+
* },
|
|
64
|
+
* }),
|
|
65
|
+
* ],
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function sentryCloudflareVitePlugin(options?: SentryCloudflareVitePluginOptions): ({
|
|
70
|
+
name: string;
|
|
71
|
+
configResolved(config: {
|
|
72
|
+
root: string;
|
|
73
|
+
logger?: {
|
|
74
|
+
warn(msg: string): void;
|
|
75
|
+
};
|
|
76
|
+
}): void;
|
|
77
|
+
transform(this: {
|
|
78
|
+
parse(code: string): import("./transform").ProgramBody;
|
|
79
|
+
warn?(msg: string): void;
|
|
80
|
+
environment?: {
|
|
81
|
+
name?: string;
|
|
82
|
+
};
|
|
83
|
+
}, code: string, id: string): {
|
|
84
|
+
code: string;
|
|
85
|
+
map: unknown;
|
|
86
|
+
} | undefined;
|
|
87
|
+
} | import("vite").Plugin<any>)[];
|
|
88
|
+
//# 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;;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;;;;cAvDpC,CAAC;;;;;;YAoB7B,CAAA;mBAKf,CAAC;gBAAQ,CAAC;;;;;;kCAqCpB"}
|
|
@@ -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,60 @@
|
|
|
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' | '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
|
+
optionsFn: string;
|
|
30
|
+
/** Import statement prepended when `optionsFn` references a separate module. */
|
|
31
|
+
optionsImport?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface TransformResult {
|
|
34
|
+
code: string;
|
|
35
|
+
map: ReturnType<MagicString['generateMap']>;
|
|
36
|
+
/**
|
|
37
|
+
* The configured class names that were actually wrapped. Lets the plugin warn
|
|
38
|
+
* about configured classes it could not find, instead of silently leaving
|
|
39
|
+
* them uninstrumented.
|
|
40
|
+
*/
|
|
41
|
+
wrappedClasses: Set<string>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Rewrite the worker entry source to wrap its default export with `withSentry`
|
|
45
|
+
* and any configured class export with its matching Sentry wrapper (see
|
|
46
|
+
* {@link TransformContext.classWrappers}, e.g. Durable Object classes with
|
|
47
|
+
* `instrumentDurableObjectWithSentry`).
|
|
48
|
+
*
|
|
49
|
+
* Handles both `export class MyDO {}` and the specifier form
|
|
50
|
+
* (`class MyDO {}` … `export { MyDO }` / `export { Foo as MyDO }`).
|
|
51
|
+
* Re-exports from other modules (`export { MyDO } from './do'`) cannot be
|
|
52
|
+
* wrapped here and are left alone — the plugin warns about them via
|
|
53
|
+
* {@link TransformResult.wrappedClasses}.
|
|
54
|
+
*
|
|
55
|
+
* Exported (rather than inlined into the plugin) so it can be unit-tested with a
|
|
56
|
+
* plain AST and no Vite context. Returns `undefined` when nothing was wrapped and
|
|
57
|
+
* there are no already-manually-wrapped classes to report.
|
|
58
|
+
*/
|
|
59
|
+
export declare function applyAutoInstrumentTransforms(code: string, ast: ProgramBody, ctx: TransformContext): TransformResult | undefined;
|
|
60
|
+
//# 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,UAAU,GAAG,kBAAkB,CAAC;AAajF,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C,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,CA6C7B"}
|
|
@@ -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"}
|
|
@@ -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
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { Breadcrumb, BreadcrumbHint, PolymorphicRequest, RequestEventData, SdkInfo, Event, EventHint, ErrorEvent, Exception, FeatureFlagsIntegration, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, Metric, ExclusiveEventHintOrCaptureContext, CaptureContext, } from '@sentry/core';
|
|
2
2
|
export { CloudflareOptions } from './client';
|
|
3
|
-
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setAttribute, setAttributes, setUser, setConversationId, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, bindScopeToEmitter, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, instrumentLangChainEmbeddings, featureFlagsIntegration, growthbookIntegration, logger, metrics, withStreamedSpan, spanStreamingIntegration, instrumentLangGraph, instrumentCreateReactAgent, } from '@sentry/core';
|
|
3
|
+
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setAttribute, setAttributes, setUser, setConversationId, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, bindScopeToEmitter, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, instrumentLangChainEmbeddings, featureFlagsIntegration, growthbookIntegration, logger, metrics, withStreamedSpan, spanStreamingIntegration, instrumentStateGraph, instrumentLangGraph, instrumentCreateReactAgent, } from '@sentry/core';
|
|
4
4
|
export { withSentry } from './withSentry';
|
|
5
|
+
export { defineCloudflareOptions } from './defineCloudflareOptions';
|
|
5
6
|
export { instrumentDurableObjectWithSentry } from './durableobject';
|
|
6
7
|
export { sentryPagesPlugin } from './pages-plugin';
|
|
7
8
|
export { wrapRequestHandler } from './request';
|