@sentry/tanstackstart-react 10.57.0 → 10.59.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.
@@ -6,8 +6,16 @@ const sdk = require('./sdk.js');
6
6
  function wrapMiddlewaresWithSentry(middlewares) {
7
7
  return Object.values(middlewares);
8
8
  }
9
- const sentryGlobalRequestMiddleware = { "~types": void 0, options: {} };
10
- const sentryGlobalFunctionMiddleware = { "~types": void 0, options: {} };
9
+ const sentryGlobalRequestMiddleware = {
10
+ "~types": void 0,
11
+ _types: void 0,
12
+ options: {}
13
+ };
14
+ const sentryGlobalFunctionMiddleware = {
15
+ "~types": void 0,
16
+ _types: void 0,
17
+ options: {}
18
+ };
11
19
  function createSentryTunnelRoute(_options) {
12
20
  return {
13
21
  handlers: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/client/index.ts"],"sourcesContent":["// import/export got a false positive, and affects most of our index barrel files\n// can be removed once following issue is fixed: https://github.com/import-js/eslint-plugin-import/issues/703\n/* eslint-disable import/export */\nimport type { TanStackMiddlewareBase } from '../common/types';\nimport type { CreateSentryTunnelRouteOptions } from '../server/tunnelRoute';\n\nexport * from '@sentry/react';\n\nexport { init } from './sdk';\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent build errors.\n */\nexport function wrapMiddlewaresWithSentry<T extends TanStackMiddlewareBase>(middlewares: Record<string, T>): T[] {\n return Object.values(middlewares);\n}\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent rendering errors.\n */\nexport const sentryGlobalRequestMiddleware: TanStackMiddlewareBase = { '~types': undefined, options: {} };\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent rendering errors.\n */\nexport const sentryGlobalFunctionMiddleware: TanStackMiddlewareBase = { '~types': undefined, options: {} };\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent rendering errors.\n */\nexport function createSentryTunnelRoute(_options: CreateSentryTunnelRouteOptions): {\n handlers: {\n POST: () => Promise<Response>;\n };\n} {\n return {\n handlers: {\n POST: async () => new Response(null, { status: 500 }),\n },\n };\n}\n"],"names":[],"mappings":";;;;;AAcO,SAAS,0BAA4D,WAAA,EAAqC;AAC/G,EAAA,OAAO,MAAA,CAAO,OAAO,WAAW,CAAA;AAClC;AAMO,MAAM,gCAAwD,EAAE,QAAA,EAAU,MAAA,EAAW,OAAA,EAAS,EAAC;AAM/F,MAAM,iCAAyD,EAAE,QAAA,EAAU,MAAA,EAAW,OAAA,EAAS,EAAC;AAMhG,SAAS,wBAAwB,QAAA,EAItC;AACA,EAAA,OAAO;AAAA,IACL,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,YAAY,IAAI,QAAA,CAAS,MAAM,EAAE,MAAA,EAAQ,KAAK;AAAA;AACtD,GACF;AACF;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/client/index.ts"],"sourcesContent":["// import/export got a false positive, and affects most of our index barrel files\n// can be removed once following issue is fixed: https://github.com/import-js/eslint-plugin-import/issues/703\n/* eslint-disable import/export */\nimport type {\n SentryGlobalFunctionMiddleware,\n SentryGlobalRequestMiddleware,\n TanStackMiddlewareBase,\n} from '../common/types';\nimport type { CreateSentryTunnelRouteOptions } from '../server/tunnelRoute';\n\nexport * from '@sentry/react';\n\nexport { init } from './sdk';\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent build errors.\n */\nexport function wrapMiddlewaresWithSentry<T extends TanStackMiddlewareBase>(middlewares: Record<string, T>): T[] {\n return Object.values(middlewares);\n}\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent rendering errors.\n */\nexport const sentryGlobalRequestMiddleware: SentryGlobalRequestMiddleware = {\n '~types': undefined as unknown as SentryGlobalRequestMiddleware['~types'],\n _types: undefined as unknown as SentryGlobalRequestMiddleware['_types'],\n options: {},\n};\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent rendering errors.\n */\nexport const sentryGlobalFunctionMiddleware: SentryGlobalFunctionMiddleware = {\n '~types': undefined as unknown as SentryGlobalFunctionMiddleware['~types'],\n _types: undefined as unknown as SentryGlobalFunctionMiddleware['_types'],\n options: {},\n};\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent rendering errors.\n */\nexport function createSentryTunnelRoute(_options: CreateSentryTunnelRouteOptions): {\n handlers: {\n POST: () => Promise<Response>;\n };\n} {\n return {\n handlers: {\n POST: async () => new Response(null, { status: 500 }),\n },\n };\n}\n"],"names":[],"mappings":";;;;;AAkBO,SAAS,0BAA4D,WAAA,EAAqC;AAC/G,EAAA,OAAO,MAAA,CAAO,OAAO,WAAW,CAAA;AAClC;AAMO,MAAM,6BAAA,GAA+D;AAAA,EAC1E,QAAA,EAAU,MAAA;AAAA,EACV,MAAA,EAAQ,MAAA;AAAA,EACR,SAAS;AACX;AAMO,MAAM,8BAAA,GAAiE;AAAA,EAC5E,QAAA,EAAU,MAAA;AAAA,EACV,MAAA,EAAQ,MAAA;AAAA,EACR,SAAS;AACX;AAMO,SAAS,wBAAwB,QAAA,EAItC;AACA,EAAA,OAAO;AAAA,IACL,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,YAAY,IAAI,QAAA,CAAS,MAAM,EAAE,MAAA,EAAQ,KAAK;AAAA;AACtD,GACF;AACF;;;;;;;;;;;;;;;;;;"}
@@ -46,14 +46,18 @@ function createSentryFunctionMiddlewareHandler(mechanismType) {
46
46
  };
47
47
  }
48
48
  const sentryGlobalRequestMiddleware = {
49
+ // `~types`/`_types` only exist on the type level in TanStack Start middlewares and hold no runtime value
49
50
  "~types": void 0,
51
+ _types: void 0,
50
52
  options: {
51
53
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
54
  server: createSentryMiddlewareHandler("auto.middleware.tanstackstart.request")
53
55
  }
54
56
  };
55
57
  const sentryGlobalFunctionMiddleware = {
58
+ // `~types`/`_types` only exist on the type level in TanStack Start middlewares and hold no runtime value
56
59
  "~types": void 0,
60
+ _types: void 0,
57
61
  options: {
58
62
  server: createSentryFunctionMiddlewareHandler("auto.middleware.tanstackstart.server_function")
59
63
  // eslint-disable-line @typescript-eslint/no-explicit-any
@@ -1 +1 @@
1
- {"version":3,"file":"globalMiddleware.js","sources":["../../../src/server/globalMiddleware.ts"],"sourcesContent":["import {\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n addNonEnumerableProperty,\n captureException,\n getActiveSpan,\n spanToJSON,\n updateSpanName,\n} from '@sentry/core';\nimport type { TanStackMiddlewareBase } from '../common/types';\nimport { SENTRY_INTERNAL } from './middleware';\n\ntype ServerFnMeta = {\n id?: string;\n name?: string;\n filename?: string;\n};\n\nfunction createSentryMiddlewareHandler(mechanismType: string) {\n return async function sentryMiddlewareHandler({ next }: { next: () => Promise<unknown> }): Promise<unknown> {\n try {\n return await next();\n } catch (e) {\n captureException(e, {\n mechanism: { type: mechanismType, handled: false },\n });\n throw e;\n }\n };\n}\n\nfunction createSentryFunctionMiddlewareHandler(mechanismType: string) {\n return async function sentryFunctionMiddlewareHandler({\n next,\n serverFnMeta,\n }: {\n next: () => Promise<unknown>;\n serverFnMeta?: ServerFnMeta;\n }): Promise<unknown> {\n const activeSpan = getActiveSpan();\n const spanData = activeSpan ? spanToJSON(activeSpan) : undefined;\n if (activeSpan && spanData?.op === 'function.tanstackstart') {\n if (serverFnMeta?.name) {\n const method = spanData.description?.split(' ')[0] || 'GET';\n updateSpanName(activeSpan, `${method} /_serverFn/${serverFnMeta.name}`);\n activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n }\n if (serverFnMeta?.id) {\n activeSpan.setAttribute('tanstackstart.function.id', serverFnMeta.id);\n }\n if (serverFnMeta?.filename) {\n activeSpan.setAttribute('tanstackstart.function.filename', serverFnMeta.filename);\n }\n }\n\n try {\n return await next();\n } catch (e) {\n captureException(e, {\n mechanism: { type: mechanismType, handled: false },\n });\n throw e;\n }\n };\n}\n\n/**\n * Global request middleware that captures errors from API route requests.\n * Should be added as the first entry in the `requestMiddleware` array of `createStart()`.\n */\nexport const sentryGlobalRequestMiddleware: TanStackMiddlewareBase = {\n '~types': undefined,\n\n options: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n server: createSentryMiddlewareHandler('auto.middleware.tanstackstart.request') as (...args: any[]) => any,\n },\n};\n\n/**\n * Global function middleware that captures errors from server function invocations.\n * Should be added as the first entry in the `functionMiddleware` array of `createStart()`.\n */\nexport const sentryGlobalFunctionMiddleware: TanStackMiddlewareBase = {\n '~types': undefined,\n\n options: {\n server: createSentryFunctionMiddlewareHandler('auto.middleware.tanstackstart.server_function') as (\n ...args: any[] // eslint-disable-line @typescript-eslint/no-explicit-any\n ) => any, // eslint-disable-line @typescript-eslint/no-explicit-any\n },\n};\n\n// Mark as internal so the Vite auto-instrumentation plugin skips these middleware\naddNonEnumerableProperty(sentryGlobalRequestMiddleware, SENTRY_INTERNAL, true);\naddNonEnumerableProperty(sentryGlobalFunctionMiddleware, SENTRY_INTERNAL, true);\n"],"names":["captureException","getActiveSpan","spanToJSON","updateSpanName","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","addNonEnumerableProperty","SENTRY_INTERNAL"],"mappings":";;;;;AAiBA,SAAS,8BAA8B,aAAA,EAAuB;AAC5D,EAAA,OAAO,eAAe,uBAAA,CAAwB,EAAE,IAAA,EAAK,EAAuD;AAC1G,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,IAAA,EAAK;AAAA,IACpB,SAAS,CAAA,EAAG;AACV,MAAAA,qBAAA,CAAiB,CAAA,EAAG;AAAA,QAClB,SAAA,EAAW,EAAE,IAAA,EAAM,aAAA,EAAe,SAAS,KAAA;AAAM,OAClD,CAAA;AACD,MAAA,MAAM,CAAA;AAAA,IACR;AAAA,EACF,CAAA;AACF;AAEA,SAAS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,8BAA8B,uCAAuC;AAAA;AAEjF;AAMO,MAAM,8BAAA,GAAyD;AAAA,EACpE,QAAA,EAAU,MAAA;AAAA,EAEV,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,sCAAsC,+CAA+C;AAAA;AAAA;AAIjG;AAGAK,6BAAA,CAAyB,6BAAA,EAA+BC,4BAAiB,IAAI,CAAA;AAC7ED,6BAAA,CAAyB,8BAAA,EAAgCC,4BAAiB,IAAI,CAAA;;;;;"}
1
+ {"version":3,"file":"globalMiddleware.js","sources":["../../../src/server/globalMiddleware.ts"],"sourcesContent":["import {\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n addNonEnumerableProperty,\n captureException,\n getActiveSpan,\n spanToJSON,\n updateSpanName,\n} from '@sentry/core';\nimport type { SentryGlobalFunctionMiddleware, SentryGlobalRequestMiddleware } from '../common/types';\nimport { SENTRY_INTERNAL } from './middleware';\n\ntype ServerFnMeta = {\n id?: string;\n name?: string;\n filename?: string;\n};\n\nfunction createSentryMiddlewareHandler(mechanismType: string) {\n return async function sentryMiddlewareHandler({ next }: { next: () => Promise<unknown> }): Promise<unknown> {\n try {\n return await next();\n } catch (e) {\n captureException(e, {\n mechanism: { type: mechanismType, handled: false },\n });\n throw e;\n }\n };\n}\n\nfunction createSentryFunctionMiddlewareHandler(mechanismType: string) {\n return async function sentryFunctionMiddlewareHandler({\n next,\n serverFnMeta,\n }: {\n next: () => Promise<unknown>;\n serverFnMeta?: ServerFnMeta;\n }): Promise<unknown> {\n const activeSpan = getActiveSpan();\n const spanData = activeSpan ? spanToJSON(activeSpan) : undefined;\n if (activeSpan && spanData?.op === 'function.tanstackstart') {\n if (serverFnMeta?.name) {\n const method = spanData.description?.split(' ')[0] || 'GET';\n updateSpanName(activeSpan, `${method} /_serverFn/${serverFnMeta.name}`);\n activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n }\n if (serverFnMeta?.id) {\n activeSpan.setAttribute('tanstackstart.function.id', serverFnMeta.id);\n }\n if (serverFnMeta?.filename) {\n activeSpan.setAttribute('tanstackstart.function.filename', serverFnMeta.filename);\n }\n }\n\n try {\n return await next();\n } catch (e) {\n captureException(e, {\n mechanism: { type: mechanismType, handled: false },\n });\n throw e;\n }\n };\n}\n\n/**\n * Global request middleware that captures errors from API route requests.\n * Should be added as the first entry in the `requestMiddleware` array of `createStart()`.\n */\nexport const sentryGlobalRequestMiddleware: SentryGlobalRequestMiddleware = {\n // `~types`/`_types` only exist on the type level in TanStack Start middlewares and hold no runtime value\n '~types': undefined as unknown as SentryGlobalRequestMiddleware['~types'],\n _types: undefined as unknown as SentryGlobalRequestMiddleware['_types'],\n\n options: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n server: createSentryMiddlewareHandler('auto.middleware.tanstackstart.request') as (...args: any[]) => any,\n },\n};\n\n/**\n * Global function middleware that captures errors from server function invocations.\n * Should be added as the first entry in the `functionMiddleware` array of `createStart()`.\n */\nexport const sentryGlobalFunctionMiddleware: SentryGlobalFunctionMiddleware = {\n // `~types`/`_types` only exist on the type level in TanStack Start middlewares and hold no runtime value\n '~types': undefined as unknown as SentryGlobalFunctionMiddleware['~types'],\n _types: undefined as unknown as SentryGlobalFunctionMiddleware['_types'],\n\n options: {\n server: createSentryFunctionMiddlewareHandler('auto.middleware.tanstackstart.server_function') as (\n ...args: any[] // eslint-disable-line @typescript-eslint/no-explicit-any\n ) => any, // eslint-disable-line @typescript-eslint/no-explicit-any\n },\n};\n\n// Mark as internal so the Vite auto-instrumentation plugin skips these middleware\naddNonEnumerableProperty(sentryGlobalRequestMiddleware, SENTRY_INTERNAL, true);\naddNonEnumerableProperty(sentryGlobalFunctionMiddleware, SENTRY_INTERNAL, true);\n"],"names":["captureException","getActiveSpan","spanToJSON","updateSpanName","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","addNonEnumerableProperty","SENTRY_INTERNAL"],"mappings":";;;;;AAiBA,SAAS,8BAA8B,aAAA,EAAuB;AAC5D,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AAA,EAAK;AAAA,IACpB,SAAS,CAAA,EAAG;AACV,MAAAJ,qBAAA,CAAiB,CAAA,EAAG;AAAA,QAClB,SAAA,EAAW,EAAE,IAAA,EAAM,aAAA,EAAe,SAAS,KAAA;AAAM,OAClD,CAAA;AACD,MAAA,MAAM,CAAA;AAAA,IACR;AAAA,EACF,CAAA;AACF;AAMO,MAAM,6BAAA,GAA+D;AAAA;AAAA,EAE1E,QAAA,EAAU,MAAA;AAAA,EACV,MAAA,EAAQ,MAAA;AAAA,EAER,OAAA,EAAS;AAAA;AAAA,IAEP,MAAA,EAAQ,8BAA8B,uCAAuC;AAAA;AAEjF;AAMO,MAAM,8BAAA,GAAiE;AAAA;AAAA,EAE5E,QAAA,EAAU,MAAA;AAAA,EACV,MAAA,EAAQ,MAAA;AAAA,EAER,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,sCAAsC,+CAA+C;AAAA;AAAA;AAIjG;AAGAK,6BAAA,CAAyB,6BAAA,EAA+BC,4BAAiB,IAAI,CAAA;AAC7ED,6BAAA,CAAyB,8BAAA,EAAgCC,4BAAiB,IAAI,CAAA;;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const semanticConventions = require('@opentelemetry/semantic-conventions');
3
+ const attributes = require('@sentry/conventions/attributes');
4
4
  const core = require('@sentry/core');
5
5
 
6
6
  function patternToRegex(pattern) {
@@ -32,12 +32,12 @@ function updateSpanWithRouteParametrization(method, pathname, patterns) {
32
32
  }
33
33
  const rootSpan = core.getRootSpan(activeSpan);
34
34
  const rootSpanData = core.spanToJSON(rootSpan).data;
35
- if (rootSpanData?.[semanticConventions.ATTR_HTTP_ROUTE]) {
35
+ if (rootSpanData?.[attributes.HTTP_ROUTE]) {
36
36
  return;
37
37
  }
38
38
  const transactionName = `${method} ${matchedPattern}`;
39
39
  core.updateSpanName(rootSpan, transactionName);
40
- rootSpan.setAttribute(semanticConventions.ATTR_HTTP_ROUTE, matchedPattern);
40
+ rootSpan.setAttribute(attributes.HTTP_ROUTE, matchedPattern);
41
41
  rootSpan.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, "route");
42
42
  core.getCurrentScope().setTransactionName(transactionName);
43
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"routeParametrization.js","sources":["../../../src/server/routeParametrization.ts"],"sourcesContent":["import { ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';\nimport {\n escapeStringForRegex,\n getActiveSpan,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n updateSpanName,\n} from '@sentry/core';\n\nfunction patternToRegex(pattern: string): RegExp {\n const segments = pattern\n .split('/')\n .map(segment => {\n if (segment.startsWith('$')) {\n return '[^/]+';\n }\n return escapeStringForRegex(segment);\n })\n .join('/');\n return new RegExp(`^${segments}$`);\n}\n\n/**\n * Matches a URL pathname against a list of TanStack Start route patterns.\n * Patterns use `$param` syntax for dynamic segments (e.g., `/users/$id`).\n *\n * Patterns are expected to be pre-sorted by specificity (more segments first, static before dynamic).\n */\nexport function matchUrlToRoutePattern(pathname: string, patterns: string[]): string | undefined {\n const normalizedPathname = pathname.length > 1 ? pathname.replace(/\\/$/, '') : pathname;\n for (const pattern of patterns) {\n if (patternToRegex(pattern).test(normalizedPathname)) {\n return pattern;\n }\n }\n return undefined;\n}\n\n/**\n * Updates the active root span with a parametrized route name.\n */\nexport function updateSpanWithRouteParametrization(method: string, pathname: string, patterns: string[]): void {\n const matchedPattern = matchUrlToRoutePattern(pathname, patterns);\n if (!matchedPattern) {\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n\n const rootSpan = getRootSpan(activeSpan);\n const rootSpanData = spanToJSON(rootSpan).data;\n if (rootSpanData?.[ATTR_HTTP_ROUTE]) {\n return;\n }\n\n const transactionName = `${method} ${matchedPattern}`;\n updateSpanName(rootSpan, transactionName);\n rootSpan.setAttribute(ATTR_HTTP_ROUTE, matchedPattern);\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n getCurrentScope().setTransactionName(transactionName);\n}\n"],"names":["escapeStringForRegex","getActiveSpan","getRootSpan","spanToJSON","ATTR_HTTP_ROUTE","updateSpanName","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","getCurrentScope"],"mappings":";;;;;AAWA,SAAS,eAAe,OAAA,EAAyB;AAC/C,EAAA,MAAM,WAAW,OAAA,CACd,KAAA,CAAM,GAAG,CAAA,CACT,IAAI,CAAA,OAAA,KAAW;AACd,IAAA,IAAI,OAAA,CAAQ,UAAA,CAAW,GAAG,CAAA,EAAG;AAC3B,MAAA,OAAO,OAAA;AAAA,IACT;AACA,IAAA,OAAOA,0BAAqB,OAAO,CAAA;AAAA,EACrC,CAAC,CAAA,CACA,IAAA,CAAK,GAAG,CAAA;AACX,EAAA,OAAO,IAAI,MAAA,CAAO,CAAA,CAAA,EAAI,QAAQ,CAAA,CAAA,CAAG,CAAA;AACnC;AAQO,SAAS,sBAAA,CAAuB,UAAkB,QAAA,EAAwC;AAC/F,EAAA,MAAM,kBAAA,GAAqB,SAAS,MAAA,GAAS,CAAA,GAAI,SAAS,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA,GAAI,QAAA;AAC/E,EAAA,KAAA,MAAW,WAAW,QAAA,EAAU;AAC9B,IAAA,IAAI,cAAA,CAAe,OAAO,CAAA,CAAE,IAAA,CAAK,kBAAkB,CAAA,EAAG;AACpD,MAAA,OAAO,OAAA;AAAA,IACT;AAAA,EACF;AACA,EAAA,OAAO,MAAA;AACT;AAKO,SAAS,kCAAA,CAAmC,MAAA,EAAgB,QAAA,EAAkB,QAAA,EAA0B;AAC7G,EAAA,MAAM,cAAA,GAAiB,sBAAA,CAAuB,QAAA,EAAU,QAAQ,CAAA;AAChE,EAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,aAAaC,kBAAA,EAAc;AACjC,EAAA,IAAI,CAAC,UAAA,EAAY;AACf,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,QAAA,GAAWC,iBAAY,UAAU,CAAA;AACvC,EAAA,MAAM,YAAA,GAAeC,eAAA,CAAW,QAAQ,CAAA,CAAE,IAAA;AAC1C,EAAA,IAAI,YAAA,GAAeC,mCAAe,CAAA,EAAG;AACnC,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,eAAA,GAAkB,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,cAAc,CAAA,CAAA;AACnD,EAAAC,mBAAA,CAAe,UAAU,eAAe,CAAA;AACxC,EAAA,QAAA,CAAS,YAAA,CAAaD,qCAAiB,cAAc,CAAA;AACrD,EAAA,QAAA,CAAS,YAAA,CAAaE,uCAAkC,OAAO,CAAA;AAC/D,EAAAC,oBAAA,EAAgB,CAAE,mBAAmB,eAAe,CAAA;AACtD;;;;;"}
1
+ {"version":3,"file":"routeParametrization.js","sources":["../../../src/server/routeParametrization.ts"],"sourcesContent":["import { HTTP_ROUTE } from '@sentry/conventions/attributes';\nimport {\n escapeStringForRegex,\n getActiveSpan,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n updateSpanName,\n} from '@sentry/core';\n\nfunction patternToRegex(pattern: string): RegExp {\n const segments = pattern\n .split('/')\n .map(segment => {\n if (segment.startsWith('$')) {\n return '[^/]+';\n }\n return escapeStringForRegex(segment);\n })\n .join('/');\n return new RegExp(`^${segments}$`);\n}\n\n/**\n * Matches a URL pathname against a list of TanStack Start route patterns.\n * Patterns use `$param` syntax for dynamic segments (e.g., `/users/$id`).\n *\n * Patterns are expected to be pre-sorted by specificity (more segments first, static before dynamic).\n */\nexport function matchUrlToRoutePattern(pathname: string, patterns: string[]): string | undefined {\n const normalizedPathname = pathname.length > 1 ? pathname.replace(/\\/$/, '') : pathname;\n for (const pattern of patterns) {\n if (patternToRegex(pattern).test(normalizedPathname)) {\n return pattern;\n }\n }\n return undefined;\n}\n\n/**\n * Updates the active root span with a parametrized route name.\n */\nexport function updateSpanWithRouteParametrization(method: string, pathname: string, patterns: string[]): void {\n const matchedPattern = matchUrlToRoutePattern(pathname, patterns);\n if (!matchedPattern) {\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n\n const rootSpan = getRootSpan(activeSpan);\n const rootSpanData = spanToJSON(rootSpan).data;\n if (rootSpanData?.[HTTP_ROUTE]) {\n return;\n }\n\n const transactionName = `${method} ${matchedPattern}`;\n updateSpanName(rootSpan, transactionName);\n rootSpan.setAttribute(HTTP_ROUTE, matchedPattern);\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n getCurrentScope().setTransactionName(transactionName);\n}\n"],"names":["escapeStringForRegex","getActiveSpan","getRootSpan","spanToJSON","HTTP_ROUTE","updateSpanName","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","getCurrentScope"],"mappings":";;;;;AAWA,SAAS,eAAe,OAAA,EAAyB;AAC/C,EAAA,MAAM,WAAW,OAAA,CACd,KAAA,CAAM,GAAG,CAAA,CACT,IAAI,CAAA,OAAA,KAAW;AACd,IAAA,IAAI,OAAA,CAAQ,UAAA,CAAW,GAAG,CAAA,EAAG;AAC3B,MAAA,OAAO,OAAA;AAAA,IACT;AACA,IAAA,OAAOA,0BAAqB,OAAO,CAAA;AAAA,EACrC,CAAC,CAAA,CACA,IAAA,CAAK,GAAG,CAAA;AACX,EAAA,OAAO,IAAI,MAAA,CAAO,CAAA,CAAA,EAAI,QAAQ,CAAA,CAAA,CAAG,CAAA;AACnC;AAQO,SAAS,sBAAA,CAAuB,UAAkB,QAAA,EAAwC;AAC/F,EAAA,MAAM,kBAAA,GAAqB,SAAS,MAAA,GAAS,CAAA,GAAI,SAAS,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA,GAAI,QAAA;AAC/E,EAAA,KAAA,MAAW,WAAW,QAAA,EAAU;AAC9B,IAAA,IAAI,cAAA,CAAe,OAAO,CAAA,CAAE,IAAA,CAAK,kBAAkB,CAAA,EAAG;AACpD,MAAA,OAAO,OAAA;AAAA,IACT;AAAA,EACF;AACA,EAAA,OAAO,MAAA;AACT;AAKO,SAAS,kCAAA,CAAmC,MAAA,EAAgB,QAAA,EAAkB,QAAA,EAA0B;AAC7G,EAAA,MAAM,cAAA,GAAiB,sBAAA,CAAuB,QAAA,EAAU,QAAQ,CAAA;AAChE,EAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,aAAaC,kBAAA,EAAc;AACjC,EAAA,IAAI,CAAC,UAAA,EAAY;AACf,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,QAAA,GAAWC,iBAAY,UAAU,CAAA;AACvC,EAAA,MAAM,YAAA,GAAeC,eAAA,CAAW,QAAQ,CAAA,CAAE,IAAA;AAC1C,EAAA,IAAI,YAAA,GAAeC,qBAAU,CAAA,EAAG;AAC9B,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,eAAA,GAAkB,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,cAAc,CAAA,CAAA;AACnD,EAAAC,mBAAA,CAAe,UAAU,eAAe,CAAA;AACxC,EAAA,QAAA,CAAS,YAAA,CAAaD,uBAAY,cAAc,CAAA;AAChD,EAAA,QAAA,CAAS,YAAA,CAAaE,uCAAkC,OAAO,CAAA;AAC/D,EAAAC,oBAAA,EAAgB,CAAE,mBAAmB,eAAe,CAAA;AACtD;;;;;"}
@@ -4,8 +4,16 @@ export { init } from './sdk.js';
4
4
  function wrapMiddlewaresWithSentry(middlewares) {
5
5
  return Object.values(middlewares);
6
6
  }
7
- const sentryGlobalRequestMiddleware = { "~types": void 0, options: {} };
8
- const sentryGlobalFunctionMiddleware = { "~types": void 0, options: {} };
7
+ const sentryGlobalRequestMiddleware = {
8
+ "~types": void 0,
9
+ _types: void 0,
10
+ options: {}
11
+ };
12
+ const sentryGlobalFunctionMiddleware = {
13
+ "~types": void 0,
14
+ _types: void 0,
15
+ options: {}
16
+ };
9
17
  function createSentryTunnelRoute(_options) {
10
18
  return {
11
19
  handlers: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/client/index.ts"],"sourcesContent":["// import/export got a false positive, and affects most of our index barrel files\n// can be removed once following issue is fixed: https://github.com/import-js/eslint-plugin-import/issues/703\n/* eslint-disable import/export */\nimport type { TanStackMiddlewareBase } from '../common/types';\nimport type { CreateSentryTunnelRouteOptions } from '../server/tunnelRoute';\n\nexport * from '@sentry/react';\n\nexport { init } from './sdk';\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent build errors.\n */\nexport function wrapMiddlewaresWithSentry<T extends TanStackMiddlewareBase>(middlewares: Record<string, T>): T[] {\n return Object.values(middlewares);\n}\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent rendering errors.\n */\nexport const sentryGlobalRequestMiddleware: TanStackMiddlewareBase = { '~types': undefined, options: {} };\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent rendering errors.\n */\nexport const sentryGlobalFunctionMiddleware: TanStackMiddlewareBase = { '~types': undefined, options: {} };\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent rendering errors.\n */\nexport function createSentryTunnelRoute(_options: CreateSentryTunnelRouteOptions): {\n handlers: {\n POST: () => Promise<Response>;\n };\n} {\n return {\n handlers: {\n POST: async () => new Response(null, { status: 500 }),\n },\n };\n}\n"],"names":[],"mappings":";;;AAcO,SAAS,0BAA4D,WAAA,EAAqC;AAC/G,EAAA,OAAO,MAAA,CAAO,OAAO,WAAW,CAAA;AAClC;AAMO,MAAM,gCAAwD,EAAE,QAAA,EAAU,MAAA,EAAW,OAAA,EAAS,EAAC;AAM/F,MAAM,iCAAyD,EAAE,QAAA,EAAU,MAAA,EAAW,OAAA,EAAS,EAAC;AAMhG,SAAS,wBAAwB,QAAA,EAItC;AACA,EAAA,OAAO;AAAA,IACL,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,YAAY,IAAI,QAAA,CAAS,MAAM,EAAE,MAAA,EAAQ,KAAK;AAAA;AACtD,GACF;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/client/index.ts"],"sourcesContent":["// import/export got a false positive, and affects most of our index barrel files\n// can be removed once following issue is fixed: https://github.com/import-js/eslint-plugin-import/issues/703\n/* eslint-disable import/export */\nimport type {\n SentryGlobalFunctionMiddleware,\n SentryGlobalRequestMiddleware,\n TanStackMiddlewareBase,\n} from '../common/types';\nimport type { CreateSentryTunnelRouteOptions } from '../server/tunnelRoute';\n\nexport * from '@sentry/react';\n\nexport { init } from './sdk';\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent build errors.\n */\nexport function wrapMiddlewaresWithSentry<T extends TanStackMiddlewareBase>(middlewares: Record<string, T>): T[] {\n return Object.values(middlewares);\n}\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent rendering errors.\n */\nexport const sentryGlobalRequestMiddleware: SentryGlobalRequestMiddleware = {\n '~types': undefined as unknown as SentryGlobalRequestMiddleware['~types'],\n _types: undefined as unknown as SentryGlobalRequestMiddleware['_types'],\n options: {},\n};\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent rendering errors.\n */\nexport const sentryGlobalFunctionMiddleware: SentryGlobalFunctionMiddleware = {\n '~types': undefined as unknown as SentryGlobalFunctionMiddleware['~types'],\n _types: undefined as unknown as SentryGlobalFunctionMiddleware['_types'],\n options: {},\n};\n\n/**\n * No-op stub for client-side builds.\n * The actual implementation is server-only, but this stub is needed to prevent rendering errors.\n */\nexport function createSentryTunnelRoute(_options: CreateSentryTunnelRouteOptions): {\n handlers: {\n POST: () => Promise<Response>;\n };\n} {\n return {\n handlers: {\n POST: async () => new Response(null, { status: 500 }),\n },\n };\n}\n"],"names":[],"mappings":";;;AAkBO,SAAS,0BAA4D,WAAA,EAAqC;AAC/G,EAAA,OAAO,MAAA,CAAO,OAAO,WAAW,CAAA;AAClC;AAMO,MAAM,6BAAA,GAA+D;AAAA,EAC1E,QAAA,EAAU,MAAA;AAAA,EACV,MAAA,EAAQ,MAAA;AAAA,EACR,SAAS;AACX;AAMO,MAAM,8BAAA,GAAiE;AAAA,EAC5E,QAAA,EAAU,MAAA;AAAA,EACV,MAAA,EAAQ,MAAA;AAAA,EACR,SAAS;AACX;AAMO,SAAS,wBAAwB,QAAA,EAItC;AACA,EAAA,OAAO;AAAA,IACL,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,YAAY,IAAI,QAAA,CAAS,MAAM,EAAE,MAAA,EAAQ,KAAK;AAAA;AACtD,GACF;AACF;;;;"}
@@ -1 +1 @@
1
- {"type":"module","version":"10.57.0","sideEffects":false}
1
+ {"type":"module","version":"10.59.0","sideEffects":false}
@@ -44,14 +44,18 @@ function createSentryFunctionMiddlewareHandler(mechanismType) {
44
44
  };
45
45
  }
46
46
  const sentryGlobalRequestMiddleware = {
47
+ // `~types`/`_types` only exist on the type level in TanStack Start middlewares and hold no runtime value
47
48
  "~types": void 0,
49
+ _types: void 0,
48
50
  options: {
49
51
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
52
  server: createSentryMiddlewareHandler("auto.middleware.tanstackstart.request")
51
53
  }
52
54
  };
53
55
  const sentryGlobalFunctionMiddleware = {
56
+ // `~types`/`_types` only exist on the type level in TanStack Start middlewares and hold no runtime value
54
57
  "~types": void 0,
58
+ _types: void 0,
55
59
  options: {
56
60
  server: createSentryFunctionMiddlewareHandler("auto.middleware.tanstackstart.server_function")
57
61
  // eslint-disable-line @typescript-eslint/no-explicit-any
@@ -1 +1 @@
1
- {"version":3,"file":"globalMiddleware.js","sources":["../../../src/server/globalMiddleware.ts"],"sourcesContent":["import {\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n addNonEnumerableProperty,\n captureException,\n getActiveSpan,\n spanToJSON,\n updateSpanName,\n} from '@sentry/core';\nimport type { TanStackMiddlewareBase } from '../common/types';\nimport { SENTRY_INTERNAL } from './middleware';\n\ntype ServerFnMeta = {\n id?: string;\n name?: string;\n filename?: string;\n};\n\nfunction createSentryMiddlewareHandler(mechanismType: string) {\n return async function sentryMiddlewareHandler({ next }: { next: () => Promise<unknown> }): Promise<unknown> {\n try {\n return await next();\n } catch (e) {\n captureException(e, {\n mechanism: { type: mechanismType, handled: false },\n });\n throw e;\n }\n };\n}\n\nfunction createSentryFunctionMiddlewareHandler(mechanismType: string) {\n return async function sentryFunctionMiddlewareHandler({\n next,\n serverFnMeta,\n }: {\n next: () => Promise<unknown>;\n serverFnMeta?: ServerFnMeta;\n }): Promise<unknown> {\n const activeSpan = getActiveSpan();\n const spanData = activeSpan ? spanToJSON(activeSpan) : undefined;\n if (activeSpan && spanData?.op === 'function.tanstackstart') {\n if (serverFnMeta?.name) {\n const method = spanData.description?.split(' ')[0] || 'GET';\n updateSpanName(activeSpan, `${method} /_serverFn/${serverFnMeta.name}`);\n activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n }\n if (serverFnMeta?.id) {\n activeSpan.setAttribute('tanstackstart.function.id', serverFnMeta.id);\n }\n if (serverFnMeta?.filename) {\n activeSpan.setAttribute('tanstackstart.function.filename', serverFnMeta.filename);\n }\n }\n\n try {\n return await next();\n } catch (e) {\n captureException(e, {\n mechanism: { type: mechanismType, handled: false },\n });\n throw e;\n }\n };\n}\n\n/**\n * Global request middleware that captures errors from API route requests.\n * Should be added as the first entry in the `requestMiddleware` array of `createStart()`.\n */\nexport const sentryGlobalRequestMiddleware: TanStackMiddlewareBase = {\n '~types': undefined,\n\n options: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n server: createSentryMiddlewareHandler('auto.middleware.tanstackstart.request') as (...args: any[]) => any,\n },\n};\n\n/**\n * Global function middleware that captures errors from server function invocations.\n * Should be added as the first entry in the `functionMiddleware` array of `createStart()`.\n */\nexport const sentryGlobalFunctionMiddleware: TanStackMiddlewareBase = {\n '~types': undefined,\n\n options: {\n server: createSentryFunctionMiddlewareHandler('auto.middleware.tanstackstart.server_function') as (\n ...args: any[] // eslint-disable-line @typescript-eslint/no-explicit-any\n ) => any, // eslint-disable-line @typescript-eslint/no-explicit-any\n },\n};\n\n// Mark as internal so the Vite auto-instrumentation plugin skips these middleware\naddNonEnumerableProperty(sentryGlobalRequestMiddleware, SENTRY_INTERNAL, true);\naddNonEnumerableProperty(sentryGlobalFunctionMiddleware, SENTRY_INTERNAL, true);\n"],"names":[],"mappings":";;;AAiBA,SAAS,8BAA8B,aAAA,EAAuB;AAC5D,EAAA,OAAO,eAAe,uBAAA,CAAwB,EAAE,IAAA,EAAK,EAAuD;AAC1G,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,IAAA,EAAK;AAAA,IACpB,SAAS,CAAA,EAAG;AACV,MAAA,gBAAA,CAAiB,CAAA,EAAG;AAAA,QAClB,SAAA,EAAW,EAAE,IAAA,EAAM,aAAA,EAAe,SAAS,KAAA;AAAM,OAClD,CAAA;AACD,MAAA,MAAM,CAAA;AAAA,IACR;AAAA,EACF,CAAA;AACF;AAEA,SAAS,sCAAsC,aAAA,EAAuB;AACpE,EAAA,OAAO,eAAe,+BAAA,CAAgC;AAAA,IACpD,IAAA;AAAA,IACA;AAAA,GACF,EAGqB;AACnB,IAAA,MAAM,aAAa,aAAA,EAAc;AACjC,IAAA,MAAM,QAAA,GAAW,UAAA,GAAa,UAAA,CAAW,UAAU,CAAA,GAAI,MAAA;AACvD,IAAA,IAAI,UAAA,IAAc,QAAA,EAAU,EAAA,KAAO,wBAAA,EAA0B;AAC3D,MAAA,IAAI,cAAc,IAAA,EAAM;AACtB,QAAA,MAAM,SAAS,QAAA,CAAS,WAAA,EAAa,MAAM,GAAG,CAAA,CAAE,CAAC,CAAA,IAAK,KAAA;AACtD,QAAA,cAAA,CAAe,YAAY,CAAA,EAAG,MAAM,CAAA,YAAA,EAAe,YAAA,CAAa,IAAI,CAAA,CAAE,CAAA;AACtE,QAAA,UAAA,CAAW,YAAA,CAAa,kCAAkC,OAAO,CAAA;AAAA,MACnE;AACA,MAAA,IAAI,cAAc,EAAA,EAAI;AACpB,QAAA,UAAA,CAAW,YAAA,CAAa,2BAAA,EAA6B,YAAA,CAAa,EAAE,CAAA;AAAA,MACtE;AACA,MAAA,IAAI,cAAc,QAAA,EAAU;AAC1B,QAAA,UAAA,CAAW,YAAA,CAAa,iCAAA,EAAmC,YAAA,CAAa,QAAQ,CAAA;AAAA,MAClF;AAAA,IACF;AAEA,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,IAAA,EAAK;AAAA,IACpB,SAAS,CAAA,EAAG;AACV,MAAA,gBAAA,CAAiB,CAAA,EAAG;AAAA,QAClB,SAAA,EAAW,EAAE,IAAA,EAAM,aAAA,EAAe,SAAS,KAAA;AAAM,OAClD,CAAA;AACD,MAAA,MAAM,CAAA;AAAA,IACR;AAAA,EACF,CAAA;AACF;AAMO,MAAM,6BAAA,GAAwD;AAAA,EACnE,QAAA,EAAU,MAAA;AAAA,EAEV,OAAA,EAAS;AAAA;AAAA,IAEP,MAAA,EAAQ,8BAA8B,uCAAuC;AAAA;AAEjF;AAMO,MAAM,8BAAA,GAAyD;AAAA,EACpE,QAAA,EAAU,MAAA;AAAA,EAEV,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,sCAAsC,+CAA+C;AAAA;AAAA;AAIjG;AAGA,wBAAA,CAAyB,6BAAA,EAA+B,iBAAiB,IAAI,CAAA;AAC7E,wBAAA,CAAyB,8BAAA,EAAgC,iBAAiB,IAAI,CAAA;;;;"}
1
+ {"version":3,"file":"globalMiddleware.js","sources":["../../../src/server/globalMiddleware.ts"],"sourcesContent":["import {\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n addNonEnumerableProperty,\n captureException,\n getActiveSpan,\n spanToJSON,\n updateSpanName,\n} from '@sentry/core';\nimport type { SentryGlobalFunctionMiddleware, SentryGlobalRequestMiddleware } from '../common/types';\nimport { SENTRY_INTERNAL } from './middleware';\n\ntype ServerFnMeta = {\n id?: string;\n name?: string;\n filename?: string;\n};\n\nfunction createSentryMiddlewareHandler(mechanismType: string) {\n return async function sentryMiddlewareHandler({ next }: { next: () => Promise<unknown> }): Promise<unknown> {\n try {\n return await next();\n } catch (e) {\n captureException(e, {\n mechanism: { type: mechanismType, handled: false },\n });\n throw e;\n }\n };\n}\n\nfunction createSentryFunctionMiddlewareHandler(mechanismType: string) {\n return async function sentryFunctionMiddlewareHandler({\n next,\n serverFnMeta,\n }: {\n next: () => Promise<unknown>;\n serverFnMeta?: ServerFnMeta;\n }): Promise<unknown> {\n const activeSpan = getActiveSpan();\n const spanData = activeSpan ? spanToJSON(activeSpan) : undefined;\n if (activeSpan && spanData?.op === 'function.tanstackstart') {\n if (serverFnMeta?.name) {\n const method = spanData.description?.split(' ')[0] || 'GET';\n updateSpanName(activeSpan, `${method} /_serverFn/${serverFnMeta.name}`);\n activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n }\n if (serverFnMeta?.id) {\n activeSpan.setAttribute('tanstackstart.function.id', serverFnMeta.id);\n }\n if (serverFnMeta?.filename) {\n activeSpan.setAttribute('tanstackstart.function.filename', serverFnMeta.filename);\n }\n }\n\n try {\n return await next();\n } catch (e) {\n captureException(e, {\n mechanism: { type: mechanismType, handled: false },\n });\n throw e;\n }\n };\n}\n\n/**\n * Global request middleware that captures errors from API route requests.\n * Should be added as the first entry in the `requestMiddleware` array of `createStart()`.\n */\nexport const sentryGlobalRequestMiddleware: SentryGlobalRequestMiddleware = {\n // `~types`/`_types` only exist on the type level in TanStack Start middlewares and hold no runtime value\n '~types': undefined as unknown as SentryGlobalRequestMiddleware['~types'],\n _types: undefined as unknown as SentryGlobalRequestMiddleware['_types'],\n\n options: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n server: createSentryMiddlewareHandler('auto.middleware.tanstackstart.request') as (...args: any[]) => any,\n },\n};\n\n/**\n * Global function middleware that captures errors from server function invocations.\n * Should be added as the first entry in the `functionMiddleware` array of `createStart()`.\n */\nexport const sentryGlobalFunctionMiddleware: SentryGlobalFunctionMiddleware = {\n // `~types`/`_types` only exist on the type level in TanStack Start middlewares and hold no runtime value\n '~types': undefined as unknown as SentryGlobalFunctionMiddleware['~types'],\n _types: undefined as unknown as SentryGlobalFunctionMiddleware['_types'],\n\n options: {\n server: createSentryFunctionMiddlewareHandler('auto.middleware.tanstackstart.server_function') as (\n ...args: any[] // eslint-disable-line @typescript-eslint/no-explicit-any\n ) => any, // eslint-disable-line @typescript-eslint/no-explicit-any\n },\n};\n\n// Mark as internal so the Vite auto-instrumentation plugin skips these middleware\naddNonEnumerableProperty(sentryGlobalRequestMiddleware, SENTRY_INTERNAL, true);\naddNonEnumerableProperty(sentryGlobalFunctionMiddleware, SENTRY_INTERNAL, true);\n"],"names":[],"mappings":";;;AAiBA,SAAS,8BAA8B,aAAA,EAAuB;AAC5D,EAAA,OAAO,eAAe,uBAAA,CAAwB,EAAE,IAAA,EAAK,EAAuD;AAC1G,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,IAAA,EAAK;AAAA,IACpB,SAAS,CAAA,EAAG;AACV,MAAA,gBAAA,CAAiB,CAAA,EAAG;AAAA,QAClB,SAAA,EAAW,EAAE,IAAA,EAAM,aAAA,EAAe,SAAS,KAAA;AAAM,OAClD,CAAA;AACD,MAAA,MAAM,CAAA;AAAA,IACR;AAAA,EACF,CAAA;AACF;AAEA,SAAS,sCAAsC,aAAA,EAAuB;AACpE,EAAA,OAAO,eAAe,+BAAA,CAAgC;AAAA,IACpD,IAAA;AAAA,IACA;AAAA,GACF,EAGqB;AACnB,IAAA,MAAM,aAAa,aAAA,EAAc;AACjC,IAAA,MAAM,QAAA,GAAW,UAAA,GAAa,UAAA,CAAW,UAAU,CAAA,GAA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;AAAA;AAAA;AAIjG;AAGA,wBAAA,CAAyB,6BAAA,EAA+B,iBAAiB,IAAI,CAAA;AAC7E,wBAAA,CAAyB,8BAAA,EAAgC,iBAAiB,IAAI,CAAA;;;;"}
@@ -1,4 +1,4 @@
1
- import { ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';
1
+ import { HTTP_ROUTE } from '@sentry/conventions/attributes';
2
2
  import { getActiveSpan, getRootSpan, spanToJSON, updateSpanName, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, getCurrentScope, escapeStringForRegex } from '@sentry/core';
3
3
 
4
4
  function patternToRegex(pattern) {
@@ -30,12 +30,12 @@ function updateSpanWithRouteParametrization(method, pathname, patterns) {
30
30
  }
31
31
  const rootSpan = getRootSpan(activeSpan);
32
32
  const rootSpanData = spanToJSON(rootSpan).data;
33
- if (rootSpanData?.[ATTR_HTTP_ROUTE]) {
33
+ if (rootSpanData?.[HTTP_ROUTE]) {
34
34
  return;
35
35
  }
36
36
  const transactionName = `${method} ${matchedPattern}`;
37
37
  updateSpanName(rootSpan, transactionName);
38
- rootSpan.setAttribute(ATTR_HTTP_ROUTE, matchedPattern);
38
+ rootSpan.setAttribute(HTTP_ROUTE, matchedPattern);
39
39
  rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, "route");
40
40
  getCurrentScope().setTransactionName(transactionName);
41
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"routeParametrization.js","sources":["../../../src/server/routeParametrization.ts"],"sourcesContent":["import { ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';\nimport {\n escapeStringForRegex,\n getActiveSpan,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n updateSpanName,\n} from '@sentry/core';\n\nfunction patternToRegex(pattern: string): RegExp {\n const segments = pattern\n .split('/')\n .map(segment => {\n if (segment.startsWith('$')) {\n return '[^/]+';\n }\n return escapeStringForRegex(segment);\n })\n .join('/');\n return new RegExp(`^${segments}$`);\n}\n\n/**\n * Matches a URL pathname against a list of TanStack Start route patterns.\n * Patterns use `$param` syntax for dynamic segments (e.g., `/users/$id`).\n *\n * Patterns are expected to be pre-sorted by specificity (more segments first, static before dynamic).\n */\nexport function matchUrlToRoutePattern(pathname: string, patterns: string[]): string | undefined {\n const normalizedPathname = pathname.length > 1 ? pathname.replace(/\\/$/, '') : pathname;\n for (const pattern of patterns) {\n if (patternToRegex(pattern).test(normalizedPathname)) {\n return pattern;\n }\n }\n return undefined;\n}\n\n/**\n * Updates the active root span with a parametrized route name.\n */\nexport function updateSpanWithRouteParametrization(method: string, pathname: string, patterns: string[]): void {\n const matchedPattern = matchUrlToRoutePattern(pathname, patterns);\n if (!matchedPattern) {\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n\n const rootSpan = getRootSpan(activeSpan);\n const rootSpanData = spanToJSON(rootSpan).data;\n if (rootSpanData?.[ATTR_HTTP_ROUTE]) {\n return;\n }\n\n const transactionName = `${method} ${matchedPattern}`;\n updateSpanName(rootSpan, transactionName);\n rootSpan.setAttribute(ATTR_HTTP_ROUTE, matchedPattern);\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n getCurrentScope().setTransactionName(transactionName);\n}\n"],"names":[],"mappings":";;;AAWA,SAAS,eAAe,OAAA,EAAyB;AAC/C,EAAA,MAAM,WAAW,OAAA,CACd,KAAA,CAAM,GAAG,CAAA,CACT,IAAI,CAAA,OAAA,KAAW;AACd,IAAA,IAAI,OAAA,CAAQ,UAAA,CAAW,GAAG,CAAA,EAAG;AAC3B,MAAA,OAAO,OAAA;AAAA,IACT;AACA,IAAA,OAAO,qBAAqB,OAAO,CAAA;AAAA,EACrC,CAAC,CAAA,CACA,IAAA,CAAK,GAAG,CAAA;AACX,EAAA,OAAO,IAAI,MAAA,CAAO,CAAA,CAAA,EAAI,QAAQ,CAAA,CAAA,CAAG,CAAA;AAC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TE } from '@sentry/conventions/attributes';\nimport {\n escapeStringForRegex,\n getActiveSpan,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n updateSpanName,\n} from '@sentry/core';\n\nfunction patternToRegex(pattern: string): RegExp {\n const segments = pattern\n .split('/')\n .map(segment => {\n if (segment.startsWith('$')) {\n return '[^/]+';\n }\n return escapeStringForRegex(segment);\n })\n .join('/');\n return new RegExp(`^${segments}$`);\n}\n\n/**\n * Matches a URL pathname against a list of TanStack Start route patterns.\n * Patterns use `$param` syntax for dynamic segments (e.g., `/users/$id`).\n *\n * Patterns are expected to be pre-sorted by specificity (more segments first, static before dynamic).\n */\nexport function matchUrlToRoutePattern(pathname: string, patterns: string[]): string | undefined {\n const normalizedPathname = pathname.length > 1 ? pathname.replace(/\\/$/, '') : pathname;\n for (const pattern of patterns) {\n if (patternToRegex(pattern).test(normalizedPathname)) {\n return pattern;\n }\n }\n return undefined;\n}\n\n/**\n * Updates the active root span with a parametrized route name.\n */\nexport function updateSpanWithRouteParametrization(method: string, pathname: string, patterns: string[]): void {\n const matchedPattern = matchUrlToRoutePattern(pathname, patterns);\n if (!matchedPattern) {\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n\n const rootSpan = getRootSpan(activeSpan);\n const rootSpanData = spanToJSON(rootSpan).data;\n if (rootSpanData?.[HTTP_ROUTE]) {\n return;\n }\n\n const transactionName = `${method} ${matchedPattern}`;\n updateSpanName(rootSpan, transactionName);\n rootSpan.setAttribute(HTTP_ROUTE, matchedPattern);\n rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n getCurrentScope().setTransactionName(transactionName);\n}\n"],"names":[],"mappings":";;;AAWA,SAAS,eAAe,OAAA,EAAyB;AAC/C,EAAA,MAAM,WAAW,OAAA,CACd,KAAA,CAAM,GAAG,CAAA,CACT,IAAI,CAAA,OAAA,KAAW;AACd,IAAA,IAA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AA;AACxC,EAAA,QAAA,CAAS,YAAA,CAAa,YAAY,cAAc,CAAA;AAChD,EAAA,QAAA,CAAS,YAAA,CAAa,kCAAkC,OAAO,CAAA;AAC/D,EAAA,eAAA,EAAgB,CAAE,mBAAmB,eAAe,CAAA;AACtD;;;;"}
@@ -1,4 +1,4 @@
1
- import type { TanStackMiddlewareBase } from '../common/types';
1
+ import type { SentryGlobalFunctionMiddleware, SentryGlobalRequestMiddleware, TanStackMiddlewareBase } from '../common/types';
2
2
  import type { CreateSentryTunnelRouteOptions } from '../server/tunnelRoute';
3
3
  export * from '@sentry/react';
4
4
  export { init } from './sdk';
@@ -11,12 +11,12 @@ export declare function wrapMiddlewaresWithSentry<T extends TanStackMiddlewareBa
11
11
  * No-op stub for client-side builds.
12
12
  * The actual implementation is server-only, but this stub is needed to prevent rendering errors.
13
13
  */
14
- export declare const sentryGlobalRequestMiddleware: TanStackMiddlewareBase;
14
+ export declare const sentryGlobalRequestMiddleware: SentryGlobalRequestMiddleware;
15
15
  /**
16
16
  * No-op stub for client-side builds.
17
17
  * The actual implementation is server-only, but this stub is needed to prevent rendering errors.
18
18
  */
19
- export declare const sentryGlobalFunctionMiddleware: TanStackMiddlewareBase;
19
+ export declare const sentryGlobalFunctionMiddleware: SentryGlobalFunctionMiddleware;
20
20
  /**
21
21
  * No-op stub for client-side builds.
22
22
  * The actual implementation is server-only, but this stub is needed to prevent rendering errors.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAE5E,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,sBAAsB,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAE/G;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,sBAA6D,CAAC;AAE1G;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,sBAA6D,CAAC;AAE3G;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,8BAA8B,GAAG;IACjF,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;KAC/B,CAAC;CACH,CAMA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,8BAA8B,EAC9B,6BAA6B,EAC7B,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAE5E,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,sBAAsB,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAE/G;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,6BAI3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,8BAI5C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,8BAA8B,GAAG;IACjF,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;KAC/B,CAAC;CACH,CAMA"}
@@ -1,2 +1,2 @@
1
- export type { TanStackMiddlewareBase, MiddlewareWrapperOptions } from './types';
1
+ export type { TanStackMiddlewareBase, MiddlewareWrapperOptions, SentryGlobalFunctionMiddleware, SentryGlobalRequestMiddleware, } from './types';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,wBAAwB,EACxB,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,SAAS,CAAC"}
@@ -1,5 +1,70 @@
1
1
  export type TanStackMiddlewareBase = {
2
- '~types': any;
2
+ '~types': unknown;
3
+ options: {
4
+ server?: (...args: any[]) => any;
5
+ };
6
+ };
7
+ /**
8
+ * Structurally mirrors TanStack Start's `RequestMiddlewareTypes` for a middleware that contributes
9
+ * nothing to the middleware chain. The context-related fields are deliberately typed as `undefined`
10
+ * rather than `any`: TanStack Start merges middleware context types through these fields, so an
11
+ * `any` here would turn the inferred `context` of every subsequent middleware and handler into `any`.
12
+ */
13
+ type SentryRequestMiddlewareTypes = {
14
+ type: 'request';
15
+ middlewares: undefined;
16
+ allInput: undefined;
17
+ allOutput: undefined;
18
+ serverContext: undefined;
19
+ allServerContext: undefined;
20
+ };
21
+ /**
22
+ * Structurally mirrors TanStack Start's `FunctionMiddlewareTypes` for a middleware that contributes
23
+ * nothing to the middleware chain (see `SentryRequestMiddlewareTypes`).
24
+ */
25
+ type SentryFunctionMiddlewareTypes = {
26
+ type: 'function';
27
+ middlewares: undefined;
28
+ input: undefined;
29
+ allInput: undefined;
30
+ output: undefined;
31
+ allOutput: undefined;
32
+ clientContext: undefined;
33
+ allClientContextBeforeNext: undefined;
34
+ allClientContextAfterNext: undefined;
35
+ serverContext: undefined;
36
+ serverSendContext: undefined;
37
+ allServerSendContext: undefined;
38
+ allServerContext: undefined;
39
+ clientSendContext: undefined;
40
+ allClientSendContext: undefined;
41
+ validator: undefined;
42
+ inputValidator: undefined;
43
+ };
44
+ /**
45
+ * Type of the `sentryGlobalRequestMiddleware` export.
46
+ *
47
+ * Declares the middleware type information under both `~types` (TanStack Start >=1.143) and
48
+ * `_types` (older versions) so the middleware satisfies `AnyRequestMiddleware` across the
49
+ * supported version range.
50
+ */
51
+ export type SentryGlobalRequestMiddleware = {
52
+ '~types': SentryRequestMiddlewareTypes;
53
+ _types: SentryRequestMiddlewareTypes;
54
+ options: {
55
+ server?: (...args: any[]) => any;
56
+ };
57
+ };
58
+ /**
59
+ * Type of the `sentryGlobalFunctionMiddleware` export.
60
+ *
61
+ * Declares the middleware type information under both `~types` (TanStack Start >=1.143) and
62
+ * `_types` (older versions) so the middleware satisfies `AnyFunctionMiddleware` across the
63
+ * supported version range.
64
+ */
65
+ export type SentryGlobalFunctionMiddleware = {
66
+ '~types': SentryFunctionMiddlewareTypes;
67
+ _types: SentryFunctionMiddlewareTypes;
3
68
  options: {
4
69
  server?: (...args: any[]) => any;
5
70
  };
@@ -7,4 +72,5 @@ export type TanStackMiddlewareBase = {
7
72
  export type MiddlewareWrapperOptions = {
8
73
  name: string;
9
74
  };
75
+ export {};
10
76
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IAEnC,QAAQ,EAAE,GAAG,CAAC;IAEd,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;KAAE,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,OAAO,CAAC;IAElB,OAAO,EAAE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EAAE,6BAA6B,CAAC;IACxC,MAAM,EAAE,6BAA6B,CAAC;IAEtC,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;KAAE,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
@@ -1,12 +1,12 @@
1
- import type { TanStackMiddlewareBase } from '../common/types';
1
+ import type { SentryGlobalFunctionMiddleware, SentryGlobalRequestMiddleware } from '../common/types';
2
2
  /**
3
3
  * Global request middleware that captures errors from API route requests.
4
4
  * Should be added as the first entry in the `requestMiddleware` array of `createStart()`.
5
5
  */
6
- export declare const sentryGlobalRequestMiddleware: TanStackMiddlewareBase;
6
+ export declare const sentryGlobalRequestMiddleware: SentryGlobalRequestMiddleware;
7
7
  /**
8
8
  * Global function middleware that captures errors from server function invocations.
9
9
  * Should be added as the first entry in the `functionMiddleware` array of `createStart()`.
10
10
  */
11
- export declare const sentryGlobalFunctionMiddleware: TanStackMiddlewareBase;
11
+ export declare const sentryGlobalFunctionMiddleware: SentryGlobalFunctionMiddleware;
12
12
  //# sourceMappingURL=globalMiddleware.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"globalMiddleware.d.ts","sourceRoot":"","sources":["../../../src/server/globalMiddleware.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAyD9D;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,sBAO3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,sBAQ5C,CAAC"}
1
+ {"version":3,"file":"globalMiddleware.d.ts","sourceRoot":"","sources":["../../../src/server/globalMiddleware.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,8BAA8B,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAyDrG;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,6BAS3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,8BAU5C,CAAC"}
@@ -1,4 +1,4 @@
1
- import { TanStackMiddlewareBase } from '../common/types';
1
+ import { SentryGlobalFunctionMiddleware, SentryGlobalRequestMiddleware, TanStackMiddlewareBase } from '../common/types';
2
2
  import { CreateSentryTunnelRouteOptions } from '../server/tunnelRoute';
3
3
  export * from '@sentry/react';
4
4
  export { init } from './sdk';
@@ -11,12 +11,12 @@ export declare function wrapMiddlewaresWithSentry<T extends TanStackMiddlewareBa
11
11
  * No-op stub for client-side builds.
12
12
  * The actual implementation is server-only, but this stub is needed to prevent rendering errors.
13
13
  */
14
- export declare const sentryGlobalRequestMiddleware: TanStackMiddlewareBase;
14
+ export declare const sentryGlobalRequestMiddleware: SentryGlobalRequestMiddleware;
15
15
  /**
16
16
  * No-op stub for client-side builds.
17
17
  * The actual implementation is server-only, but this stub is needed to prevent rendering errors.
18
18
  */
19
- export declare const sentryGlobalFunctionMiddleware: TanStackMiddlewareBase;
19
+ export declare const sentryGlobalFunctionMiddleware: SentryGlobalFunctionMiddleware;
20
20
  /**
21
21
  * No-op stub for client-side builds.
22
22
  * The actual implementation is server-only, but this stub is needed to prevent rendering errors.
@@ -1,2 +1,2 @@
1
- export { TanStackMiddlewareBase, MiddlewareWrapperOptions } from './types';
1
+ export { TanStackMiddlewareBase, MiddlewareWrapperOptions, SentryGlobalFunctionMiddleware, SentryGlobalRequestMiddleware, } from './types';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,70 @@
1
1
  export type TanStackMiddlewareBase = {
2
- '~types': any;
2
+ '~types': unknown;
3
+ options: {
4
+ server?: (...args: any[]) => any;
5
+ };
6
+ };
7
+ /**
8
+ * Structurally mirrors TanStack Start's `RequestMiddlewareTypes` for a middleware that contributes
9
+ * nothing to the middleware chain. The context-related fields are deliberately typed as `undefined`
10
+ * rather than `any`: TanStack Start merges middleware context types through these fields, so an
11
+ * `any` here would turn the inferred `context` of every subsequent middleware and handler into `any`.
12
+ */
13
+ type SentryRequestMiddlewareTypes = {
14
+ type: 'request';
15
+ middlewares: undefined;
16
+ allInput: undefined;
17
+ allOutput: undefined;
18
+ serverContext: undefined;
19
+ allServerContext: undefined;
20
+ };
21
+ /**
22
+ * Structurally mirrors TanStack Start's `FunctionMiddlewareTypes` for a middleware that contributes
23
+ * nothing to the middleware chain (see `SentryRequestMiddlewareTypes`).
24
+ */
25
+ type SentryFunctionMiddlewareTypes = {
26
+ type: 'function';
27
+ middlewares: undefined;
28
+ input: undefined;
29
+ allInput: undefined;
30
+ output: undefined;
31
+ allOutput: undefined;
32
+ clientContext: undefined;
33
+ allClientContextBeforeNext: undefined;
34
+ allClientContextAfterNext: undefined;
35
+ serverContext: undefined;
36
+ serverSendContext: undefined;
37
+ allServerSendContext: undefined;
38
+ allServerContext: undefined;
39
+ clientSendContext: undefined;
40
+ allClientSendContext: undefined;
41
+ validator: undefined;
42
+ inputValidator: undefined;
43
+ };
44
+ /**
45
+ * Type of the `sentryGlobalRequestMiddleware` export.
46
+ *
47
+ * Declares the middleware type information under both `~types` (TanStack Start >=1.143) and
48
+ * `_types` (older versions) so the middleware satisfies `AnyRequestMiddleware` across the
49
+ * supported version range.
50
+ */
51
+ export type SentryGlobalRequestMiddleware = {
52
+ '~types': SentryRequestMiddlewareTypes;
53
+ _types: SentryRequestMiddlewareTypes;
54
+ options: {
55
+ server?: (...args: any[]) => any;
56
+ };
57
+ };
58
+ /**
59
+ * Type of the `sentryGlobalFunctionMiddleware` export.
60
+ *
61
+ * Declares the middleware type information under both `~types` (TanStack Start >=1.143) and
62
+ * `_types` (older versions) so the middleware satisfies `AnyFunctionMiddleware` across the
63
+ * supported version range.
64
+ */
65
+ export type SentryGlobalFunctionMiddleware = {
66
+ '~types': SentryFunctionMiddlewareTypes;
67
+ _types: SentryFunctionMiddlewareTypes;
3
68
  options: {
4
69
  server?: (...args: any[]) => any;
5
70
  };
@@ -7,4 +72,5 @@ export type TanStackMiddlewareBase = {
7
72
  export type MiddlewareWrapperOptions = {
8
73
  name: string;
9
74
  };
75
+ export {};
10
76
  //# sourceMappingURL=types.d.ts.map
@@ -1,12 +1,12 @@
1
- import { TanStackMiddlewareBase } from '../common/types';
1
+ import { SentryGlobalFunctionMiddleware, SentryGlobalRequestMiddleware } from '../common/types';
2
2
  /**
3
3
  * Global request middleware that captures errors from API route requests.
4
4
  * Should be added as the first entry in the `requestMiddleware` array of `createStart()`.
5
5
  */
6
- export declare const sentryGlobalRequestMiddleware: TanStackMiddlewareBase;
6
+ export declare const sentryGlobalRequestMiddleware: SentryGlobalRequestMiddleware;
7
7
  /**
8
8
  * Global function middleware that captures errors from server function invocations.
9
9
  * Should be added as the first entry in the `functionMiddleware` array of `createStart()`.
10
10
  */
11
- export declare const sentryGlobalFunctionMiddleware: TanStackMiddlewareBase;
11
+ export declare const sentryGlobalFunctionMiddleware: SentryGlobalFunctionMiddleware;
12
12
  //# sourceMappingURL=globalMiddleware.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/tanstackstart-react",
3
- "version": "10.57.0",
3
+ "version": "10.59.0",
4
4
  "description": "Official Sentry SDK for TanStack Start React",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/tanstackstart-react",
@@ -64,15 +64,15 @@
64
64
  },
65
65
  "dependencies": {
66
66
  "@opentelemetry/api": "^1.9.1",
67
- "@opentelemetry/semantic-conventions": "^1.40.0",
68
- "@sentry-internal/browser-utils": "10.57.0",
69
- "@sentry/core": "10.57.0",
70
- "@sentry/node": "10.57.0",
71
- "@sentry/react": "10.57.0",
67
+ "@sentry/browser-utils": "10.59.0",
68
+ "@sentry/conventions": "^0.12.0",
69
+ "@sentry/core": "10.59.0",
70
+ "@sentry/node": "10.59.0",
71
+ "@sentry/react": "10.59.0",
72
72
  "@sentry/vite-plugin": "^5.3.0"
73
73
  },
74
74
  "devDependencies": {
75
- "vite": "^5.4.11"
75
+ "vite": "^6.4.3"
76
76
  },
77
77
  "scripts": {
78
78
  "build": "run-p build:transpile build:types",