@sentry/tanstackstart-react 10.53.1 → 10.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/build/cjs/client/index.js +5 -26
  2. package/build/cjs/client/index.js.map +1 -1
  3. package/build/cjs/client/sdk.js +2 -9
  4. package/build/cjs/client/sdk.js.map +1 -1
  5. package/build/cjs/client/tunnelRoute.js +2 -13
  6. package/build/cjs/client/tunnelRoute.js.map +1 -1
  7. package/build/cjs/server/globalMiddleware.js +7 -21
  8. package/build/cjs/server/globalMiddleware.js.map +1 -1
  9. package/build/cjs/server/index.js +8 -29
  10. package/build/cjs/server/index.js.map +1 -1
  11. package/build/cjs/server/middleware.js +10 -66
  12. package/build/cjs/server/middleware.js.map +1 -1
  13. package/build/cjs/server/sdk.js +2 -7
  14. package/build/cjs/server/sdk.js.map +1 -1
  15. package/build/cjs/server/tunnelRoute.js +11 -31
  16. package/build/cjs/server/tunnelRoute.js.map +1 -1
  17. package/build/cjs/server/utils.js +5 -17
  18. package/build/cjs/server/utils.js.map +1 -1
  19. package/build/cjs/server/wrapFetchWithSentry.js +9 -38
  20. package/build/cjs/server/wrapFetchWithSentry.js.map +1 -1
  21. package/build/cjs/vite/autoInstrumentMiddleware.js +15 -97
  22. package/build/cjs/vite/autoInstrumentMiddleware.js.map +1 -1
  23. package/build/cjs/vite/sentryTanstackStart.js +3 -40
  24. package/build/cjs/vite/sentryTanstackStart.js.map +1 -1
  25. package/build/cjs/vite/sourceMaps.js +30 -76
  26. package/build/cjs/vite/sourceMaps.js.map +1 -1
  27. package/build/cjs/vite/tunnelRoute.js +30 -63
  28. package/build/cjs/vite/tunnelRoute.js.map +1 -1
  29. package/build/esm/client/index.js +5 -26
  30. package/build/esm/client/index.js.map +1 -1
  31. package/build/esm/client/sdk.js +2 -9
  32. package/build/esm/client/sdk.js.map +1 -1
  33. package/build/esm/client/tunnelRoute.js +2 -13
  34. package/build/esm/client/tunnelRoute.js.map +1 -1
  35. package/build/esm/package.json +1 -1
  36. package/build/esm/server/globalMiddleware.js +7 -21
  37. package/build/esm/server/globalMiddleware.js.map +1 -1
  38. package/build/esm/server/index.js +8 -29
  39. package/build/esm/server/index.js.map +1 -1
  40. package/build/esm/server/middleware.js +10 -66
  41. package/build/esm/server/middleware.js.map +1 -1
  42. package/build/esm/server/sdk.js +2 -7
  43. package/build/esm/server/sdk.js.map +1 -1
  44. package/build/esm/server/tunnelRoute.js +11 -31
  45. package/build/esm/server/tunnelRoute.js.map +1 -1
  46. package/build/esm/server/utils.js +5 -17
  47. package/build/esm/server/utils.js.map +1 -1
  48. package/build/esm/server/wrapFetchWithSentry.js +9 -38
  49. package/build/esm/server/wrapFetchWithSentry.js.map +1 -1
  50. package/build/esm/vite/autoInstrumentMiddleware.js +15 -97
  51. package/build/esm/vite/autoInstrumentMiddleware.js.map +1 -1
  52. package/build/esm/vite/sentryTanstackStart.js +3 -40
  53. package/build/esm/vite/sentryTanstackStart.js.map +1 -1
  54. package/build/esm/vite/sourceMaps.js +30 -76
  55. package/build/esm/vite/sourceMaps.js.map +1 -1
  56. package/build/esm/vite/tunnelRoute.js +30 -63
  57. package/build/esm/vite/tunnelRoute.js.map +1 -1
  58. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"autoInstrumentMiddleware.js","sources":["../../../src/vite/autoInstrumentMiddleware.ts"],"sourcesContent":["import type { Plugin } from 'vite';\n\ntype AutoInstrumentMiddlewareOptions = {\n enabled?: boolean;\n debug?: boolean;\n};\n\ntype WrapResult = {\n code: string;\n didWrap: boolean;\n skipped: string[];\n};\n\ntype FileTransformState = {\n code: string;\n needsImport: boolean;\n skippedMiddlewares: string[];\n};\n\n/**\n * Core function that wraps middleware arrays matching the given regex.\n */\nfunction wrapMiddlewareArrays(code: string, id: string, debug: boolean, regex: RegExp): WrapResult {\n const skipped: string[] = [];\n let didWrap = false;\n\n const transformed = code.replace(regex, (match: string, key: string, contents: string) => {\n const objContents = arrayToObjectShorthand(contents);\n if (objContents) {\n didWrap = true;\n if (debug) {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Auto-wrapping ${key} in ${id}`);\n }\n // Handle method call syntax like `.middleware([...])` vs object property syntax like `middleware: [...]`\n if (key.endsWith('(')) {\n return `${key}wrapMiddlewaresWithSentry(${objContents}))`;\n }\n return `${key}: wrapMiddlewaresWithSentry(${objContents})`;\n }\n // Track middlewares that couldn't be auto-wrapped\n // Skip if we matched whitespace only\n if (contents.trim()) {\n skipped.push(key);\n }\n return match;\n });\n\n return { code: transformed, didWrap, skipped };\n}\n\n/**\n * Wraps global middleware arrays (requestMiddleware, functionMiddleware) in createStart() files.\n */\nexport function wrapGlobalMiddleware(code: string, id: string, debug: boolean): WrapResult {\n return wrapMiddlewareArrays(code, id, debug, /(requestMiddleware|functionMiddleware)\\s*:\\s*\\[([^\\]]*)\\]/g);\n}\n\n/**\n * Wraps route middleware arrays in createFileRoute() files.\n */\nexport function wrapRouteMiddleware(code: string, id: string, debug: boolean): WrapResult {\n return wrapMiddlewareArrays(code, id, debug, /(middleware)\\s*:\\s*\\[([^\\]]*)\\]/g);\n}\n\n/**\n * Wraps middleware arrays in createServerFn().middleware([...]) calls.\n */\nexport function wrapServerFnMiddleware(code: string, id: string, debug: boolean): WrapResult {\n return wrapMiddlewareArrays(code, id, debug, /(\\.middleware\\s*\\()\\s*\\[([^\\]]*)\\]\\s*\\)/g);\n}\n\n/**\n * Applies a wrap function to the current state and returns the updated state.\n */\nfunction applyWrap(\n state: FileTransformState,\n wrapFn: (code: string, id: string, debug: boolean) => WrapResult,\n id: string,\n debug: boolean,\n): FileTransformState {\n const result = wrapFn(state.code, id, debug);\n return {\n code: result.code,\n needsImport: state.needsImport || result.didWrap,\n skippedMiddlewares: [...state.skippedMiddlewares, ...result.skipped],\n };\n}\n\n/**\n * A Vite plugin that automatically instruments TanStack Start middlewares:\n * - `requestMiddleware` and `functionMiddleware` arrays in `createStart()`\n * - `middleware` arrays in `createFileRoute()` route definitions\n */\nexport function makeAutoInstrumentMiddlewarePlugin(options: AutoInstrumentMiddlewareOptions = {}): Plugin {\n const { enabled = true, debug = false } = options;\n\n return {\n name: 'sentry-tanstack-middleware-auto-instrument',\n enforce: 'pre',\n\n transform(code, id) {\n if (!enabled) {\n return null;\n }\n\n // Skip if not a TS/JS file\n if (!/\\.(ts|tsx|js|jsx|mjs|mts)$/.test(id)) {\n return null;\n }\n\n // Detect file types that should be instrumented\n const isStartFile = id.includes('start') && code.includes('createStart(');\n const isRouteFile = code.includes('createFileRoute(') && /middleware\\s*:\\s*\\[/.test(code);\n const isServerFnFile = code.includes('createServerFn') && /\\.middleware\\s*\\(\\s*\\[/.test(code);\n\n if (!isStartFile && !isRouteFile && !isServerFnFile) {\n return null;\n }\n\n // Skip if the user already did some manual wrapping\n if (code.includes('wrapMiddlewaresWithSentry')) {\n return null;\n }\n\n let fileTransformState: FileTransformState = {\n code,\n needsImport: false,\n skippedMiddlewares: [],\n };\n\n // Wrap middlewares\n if (isStartFile) {\n fileTransformState = applyWrap(fileTransformState, wrapGlobalMiddleware, id, debug);\n }\n if (isRouteFile) {\n fileTransformState = applyWrap(fileTransformState, wrapRouteMiddleware, id, debug);\n }\n if (isServerFnFile) {\n fileTransformState = applyWrap(fileTransformState, wrapServerFnMiddleware, id, debug);\n }\n\n // Warn about middlewares that couldn't be auto-wrapped\n if (fileTransformState.skippedMiddlewares.length > 0) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Could not auto-instrument ${fileTransformState.skippedMiddlewares.join(' and ')} in ${id}. ` +\n 'To instrument these middlewares, use wrapMiddlewaresWithSentry() manually. ',\n );\n }\n\n // We didn't wrap any middlewares, so we don't need to import the wrapMiddlewaresWithSentry function\n if (!fileTransformState.needsImport) {\n return null;\n }\n\n return { code: addSentryImport(fileTransformState.code), map: null };\n },\n };\n}\n\n/**\n * Convert array contents to object shorthand syntax.\n * e.g., \"foo, bar, baz\" → \"{ foo, bar, baz }\"\n *\n * Returns null if contents contain non-identifier expressions (function calls, etc.)\n * which cannot be converted to object shorthand.\n */\nexport function arrayToObjectShorthand(contents: string): string | null {\n const items = contents\n .split(',')\n .map(s => s.trim())\n .filter(Boolean);\n\n // Only convert if all items are valid identifiers (no complex expressions)\n const allIdentifiers = items.every(item => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(item));\n if (!allIdentifiers || items.length === 0) {\n return null;\n }\n\n // Deduplicate to avoid invalid syntax like { foo, foo }\n const uniqueItems = [...new Set(items)];\n\n return `{ ${uniqueItems.join(', ')} }`;\n}\n\n/**\n * Adds the wrapMiddlewaresWithSentry import to the code.\n * Handles 'use client' and 'use server' directives by inserting the import after them.\n */\nexport function addSentryImport(code: string): string {\n const sentryImport = \"import { wrapMiddlewaresWithSentry } from '@sentry/tanstackstart-react';\\n\";\n\n // Don't add the import if it already exists\n if (code.includes(sentryImport.trimEnd())) {\n return code;\n }\n\n // Check for 'use server' or 'use client' directives, these need to be before any imports\n const directiveMatch = code.match(/^(['\"])use (client|server)\\1;?\\s*\\n?/);\n\n if (!directiveMatch) {\n return sentryImport + code;\n }\n\n const directive = directiveMatch[0];\n return directive + sentryImport + code.slice(directive.length);\n}\n"],"names":[],"mappings":"AAmBA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,IAAI,EAAU,EAAE,EAAU,KAAK,EAAW,KAAK,EAAsB;AACnG,EAAE,MAAM,OAAO,GAAa,EAAE;AAC9B,EAAE,IAAI,OAAA,GAAU,KAAK;;AAErB,EAAE,MAAM,WAAA,GAAc,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,EAAU,GAAG,EAAU,QAAQ,KAAa;AAC5F,IAAI,MAAM,WAAA,GAAc,sBAAsB,CAAC,QAAQ,CAAC;AACxD,IAAI,IAAI,WAAW,EAAE;AACrB,MAAM,OAAA,GAAU,IAAI;AACpB,MAAM,IAAI,KAAK,EAAE;AACjB;AACA,QAAQ,OAAO,CAAC,GAAG,CAAC,C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AAA;;AAEA;AACA,EAAA,MAAA,cAAA,GAAA,KAAA,CAAA,KAAA,CAAA,IAAA,IAAA,4BAAA,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA;AACA,EAAA,IAAA,CAAA,cAAA,IAAA,KAAA,CAAA,MAAA,KAAA,CAAA,EAAA;AACA,IAAA,OAAA,IAAA;AACA,EAAA;;AAEA;AACA,EAAA,MAAA,WAAA,GAAA,CAAA,GAAA,IAAA,GAAA,CAAA,KAAA,CAAA,CAAA;;AAEA,EAAA,OAAA,CAAA,EAAA,EAAA,WAAA,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA,EAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,eAAA,CAAA,IAAA,EAAA;AACA,EAAA,MAAA,YAAA,GAAA,4EAAA;;AAEA;AACA,EAAA,IAAA,IAAA,CAAA,QAAA,CAAA,YAAA,CAAA,OAAA,EAAA,CAAA,EAAA;AACA,IAAA,OAAA,IAAA;AACA,EAAA;;AAEA;AACA,EAAA,MAAA,cAAA,GAAA,IAAA,CAAA,KAAA,CAAA,sCAAA,CAAA;;AAEA,EAAA,IAAA,CAAA,cAAA,EAAA;AACA,IAAA,OAAA,YAAA,GAAA,IAAA;AACA,EAAA;;AAEA,EAAA,MAAA,SAAA,GAAA,cAAA,CAAA,CAAA,CAAA;AACA,EAAA,OAAA,SAAA,GAAA,YAAA,GAAA,IAAA,CAAA,KAAA,CAAA,SAAA,CAAA,MAAA,CAAA;AACA;;;;"}
1
+ {"version":3,"file":"autoInstrumentMiddleware.js","sources":["../../../src/vite/autoInstrumentMiddleware.ts"],"sourcesContent":["import type { Plugin } from 'vite';\n\ntype AutoInstrumentMiddlewareOptions = {\n enabled?: boolean;\n debug?: boolean;\n};\n\ntype WrapResult = {\n code: string;\n didWrap: boolean;\n skipped: string[];\n};\n\ntype FileTransformState = {\n code: string;\n needsImport: boolean;\n skippedMiddlewares: string[];\n};\n\n/**\n * Core function that wraps middleware arrays matching the given regex.\n */\nfunction wrapMiddlewareArrays(code: string, id: string, debug: boolean, regex: RegExp): WrapResult {\n const skipped: string[] = [];\n let didWrap = false;\n\n const transformed = code.replace(regex, (match: string, key: string, contents: string) => {\n const objContents = arrayToObjectShorthand(contents);\n if (objContents) {\n didWrap = true;\n if (debug) {\n // eslint-disable-next-line no-console\n console.log(`[Sentry] Auto-wrapping ${key} in ${id}`);\n }\n // Handle method call syntax like `.middleware([...])` vs object property syntax like `middleware: [...]`\n if (key.endsWith('(')) {\n return `${key}wrapMiddlewaresWithSentry(${objContents}))`;\n }\n return `${key}: wrapMiddlewaresWithSentry(${objContents})`;\n }\n // Track middlewares that couldn't be auto-wrapped\n // Skip if we matched whitespace only\n if (contents.trim()) {\n skipped.push(key);\n }\n return match;\n });\n\n return { code: transformed, didWrap, skipped };\n}\n\n/**\n * Wraps global middleware arrays (requestMiddleware, functionMiddleware) in createStart() files.\n */\nexport function wrapGlobalMiddleware(code: string, id: string, debug: boolean): WrapResult {\n return wrapMiddlewareArrays(code, id, debug, /(requestMiddleware|functionMiddleware)\\s*:\\s*\\[([^\\]]*)\\]/g);\n}\n\n/**\n * Wraps route middleware arrays in createFileRoute() files.\n */\nexport function wrapRouteMiddleware(code: string, id: string, debug: boolean): WrapResult {\n return wrapMiddlewareArrays(code, id, debug, /(middleware)\\s*:\\s*\\[([^\\]]*)\\]/g);\n}\n\n/**\n * Wraps middleware arrays in createServerFn().middleware([...]) calls.\n */\nexport function wrapServerFnMiddleware(code: string, id: string, debug: boolean): WrapResult {\n return wrapMiddlewareArrays(code, id, debug, /(\\.middleware\\s*\\()\\s*\\[([^\\]]*)\\]\\s*\\)/g);\n}\n\n/**\n * Applies a wrap function to the current state and returns the updated state.\n */\nfunction applyWrap(\n state: FileTransformState,\n wrapFn: (code: string, id: string, debug: boolean) => WrapResult,\n id: string,\n debug: boolean,\n): FileTransformState {\n const result = wrapFn(state.code, id, debug);\n return {\n code: result.code,\n needsImport: state.needsImport || result.didWrap,\n skippedMiddlewares: [...state.skippedMiddlewares, ...result.skipped],\n };\n}\n\n/**\n * A Vite plugin that automatically instruments TanStack Start middlewares:\n * - `requestMiddleware` and `functionMiddleware` arrays in `createStart()`\n * - `middleware` arrays in `createFileRoute()` route definitions\n */\nexport function makeAutoInstrumentMiddlewarePlugin(options: AutoInstrumentMiddlewareOptions = {}): Plugin {\n const { enabled = true, debug = false } = options;\n\n return {\n name: 'sentry-tanstack-middleware-auto-instrument',\n enforce: 'pre',\n\n transform(code, id) {\n if (!enabled) {\n return null;\n }\n\n // Skip if not a TS/JS file\n if (!/\\.(ts|tsx|js|jsx|mjs|mts)$/.test(id)) {\n return null;\n }\n\n // Detect file types that should be instrumented\n const isStartFile = id.includes('start') && code.includes('createStart(');\n const isRouteFile = code.includes('createFileRoute(') && /middleware\\s*:\\s*\\[/.test(code);\n const isServerFnFile = code.includes('createServerFn') && /\\.middleware\\s*\\(\\s*\\[/.test(code);\n\n if (!isStartFile && !isRouteFile && !isServerFnFile) {\n return null;\n }\n\n // Skip if the user already did some manual wrapping\n if (code.includes('wrapMiddlewaresWithSentry')) {\n return null;\n }\n\n let fileTransformState: FileTransformState = {\n code,\n needsImport: false,\n skippedMiddlewares: [],\n };\n\n // Wrap middlewares\n if (isStartFile) {\n fileTransformState = applyWrap(fileTransformState, wrapGlobalMiddleware, id, debug);\n }\n if (isRouteFile) {\n fileTransformState = applyWrap(fileTransformState, wrapRouteMiddleware, id, debug);\n }\n if (isServerFnFile) {\n fileTransformState = applyWrap(fileTransformState, wrapServerFnMiddleware, id, debug);\n }\n\n // Warn about middlewares that couldn't be auto-wrapped\n if (fileTransformState.skippedMiddlewares.length > 0) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Could not auto-instrument ${fileTransformState.skippedMiddlewares.join(' and ')} in ${id}. ` +\n 'To instrument these middlewares, use wrapMiddlewaresWithSentry() manually. ',\n );\n }\n\n // We didn't wrap any middlewares, so we don't need to import the wrapMiddlewaresWithSentry function\n if (!fileTransformState.needsImport) {\n return null;\n }\n\n return { code: addSentryImport(fileTransformState.code), map: null };\n },\n };\n}\n\n/**\n * Convert array contents to object shorthand syntax.\n * e.g., \"foo, bar, baz\" → \"{ foo, bar, baz }\"\n *\n * Returns null if contents contain non-identifier expressions (function calls, etc.)\n * which cannot be converted to object shorthand.\n */\nexport function arrayToObjectShorthand(contents: string): string | null {\n const items = contents\n .split(',')\n .map(s => s.trim())\n .filter(Boolean);\n\n // Only convert if all items are valid identifiers (no complex expressions)\n const allIdentifiers = items.every(item => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(item));\n if (!allIdentifiers || items.length === 0) {\n return null;\n }\n\n // Deduplicate to avoid invalid syntax like { foo, foo }\n const uniqueItems = [...new Set(items)];\n\n return `{ ${uniqueItems.join(', ')} }`;\n}\n\n/**\n * Adds the wrapMiddlewaresWithSentry import to the code.\n * Handles 'use client' and 'use server' directives by inserting the import after them.\n */\nexport function addSentryImport(code: string): string {\n const sentryImport = \"import { wrapMiddlewaresWithSentry } from '@sentry/tanstackstart-react';\\n\";\n\n // Don't add the import if it already exists\n if (code.includes(sentryImport.trimEnd())) {\n return code;\n }\n\n // Check for 'use server' or 'use client' directives, these need to be before any imports\n const directiveMatch = code.match(/^(['\"])use (client|server)\\1;?\\s*\\n?/);\n\n if (!directiveMatch) {\n return sentryImport + code;\n }\n\n const directive = directiveMatch[0];\n return directive + sentryImport + code.slice(directive.length);\n}\n"],"names":[],"mappings":"AAsBA,SAAS,oBAAA,CAAqB,IAAA,EAAc,EAAA,EAAY,KAAA,EAAgB,KAAA,EAA2B;AACjG,EAAA,MAAM,UAAoB,EAAC;AAC3B,EAAA,IAAI,OAAA,GAAU,KAAA;AAEd,EAAA,MAAM,cAAc,IAAA,CAAK,OAAA,CAAQ,OAAO,CAAC,KAAA,EAAe,KAAa,QAAA,KAAqB;AACxF,IAAA,MAAM,WAAA,GAAc,uBAAuB,QAAQ,CAAA;AACnD,IAAA,IAAI,WAAA,EAAa;AACf,MAAA,OAAA,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IAAA;AAAA,EACT;AAGA,EAAA,MAAM,cAAc,CAAC,GAAG,IAAI,GAAA,CAAI,KAAK,CAAC,CAAA;AAEtC,EAAA,OAAO,CAAA,EAAA,EAAK,WAAA,CAAY,IAAA,CAAK,IAAI,CAAC,CAAA,EAAA,CAAA;AACpC;AAMO,SAAS,gBAAgB,IAAA,EAAsB;AACpD,EAAA,MAAM,YAAA,GAAe,4EAAA;AAGrB,EAAA,IAAI,IAAA,CAAK,QAAA,CAAS,YAAA,CAAa,OAAA,EAAS,CAAA,EAAG;AACzC,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,MAAM,cAAA,GAAiB,IAAA,CAAK,KAAA,CAAM,sCAAsC,CAAA;AAExE,EAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,IAAA,OAAO,YAAA,GAAe,IAAA;AAAA,EACxB;AAEA,EAAA,MAAM,SAAA,GAAY,eAAe,CAAC,CAAA;AAClC,EAAA,OAAO,SAAA,GAAY,YAAA,GAAe,IAAA,CAAK,KAAA,CAAM,UAAU,MAAM,CAAA;AAC/D;;;;"}
@@ -2,59 +2,22 @@ import { makeAutoInstrumentMiddlewarePlugin } from './autoInstrumentMiddleware.j
2
2
  import { makeAddSentryVitePlugin, makeEnableSourceMapsVitePlugin } from './sourceMaps.js';
3
3
  import { makeTunnelRoutePlugin } from './tunnelRoute.js';
4
4
 
5
- /**
6
- * Build-time options for the Sentry TanStack Start SDK.
7
- */
8
-
9
- /**
10
- * Vite plugins for the Sentry TanStack Start SDK.
11
- *
12
- * @example
13
- * ```typescript
14
- * // vite.config.ts
15
- * import { defineConfig } from 'vite';
16
- * import { sentryTanstackStart } from '@sentry/tanstackstart-react/vite';
17
- * import { tanstackStart } from '@tanstack/react-start/plugin/vite';
18
- *
19
- * export default defineConfig({
20
- * plugins: [
21
- * tanstackStart(),
22
- * sentryTanstackStart({
23
- * org: 'your-org',
24
- * project: 'your-project',
25
- * }),
26
- * ],
27
- * });
28
- * ```
29
- *
30
- * @param options - Options to configure the Sentry Vite plugins
31
- * @returns An array of Vite plugins
32
- */
33
5
  function sentryTanstackStart(options = {}) {
34
- const tunnelRoutePlugin = options.tunnelRoute ? makeTunnelRoutePlugin(options.tunnelRoute, options.debug) : undefined;
35
-
36
- // only add build-time plugins in production builds
37
- if (process.env.NODE_ENV === 'development') {
6
+ const tunnelRoutePlugin = options.tunnelRoute ? makeTunnelRoutePlugin(options.tunnelRoute, options.debug) : void 0;
7
+ if (process.env.NODE_ENV === "development") {
38
8
  return tunnelRoutePlugin ? [tunnelRoutePlugin] : [];
39
9
  }
40
-
41
10
  const plugins = [...makeAddSentryVitePlugin(options)];
42
-
43
11
  if (tunnelRoutePlugin) {
44
12
  plugins.push(tunnelRoutePlugin);
45
13
  }
46
-
47
- // middleware auto-instrumentation
48
14
  if (options.autoInstrumentMiddleware !== false) {
49
15
  plugins.push(makeAutoInstrumentMiddlewarePlugin({ enabled: true, debug: options.debug }));
50
16
  }
51
-
52
- // source maps
53
- const sourceMapsDisabled = options.sourcemaps?.disable === true || options.sourcemaps?.disable === 'disable-upload';
17
+ const sourceMapsDisabled = options.sourcemaps?.disable === true || options.sourcemaps?.disable === "disable-upload";
54
18
  if (!sourceMapsDisabled) {
55
19
  plugins.push(...makeEnableSourceMapsVitePlugin(options));
56
20
  }
57
-
58
21
  return plugins;
59
22
  }
60
23
 
@@ -1 +1 @@
1
- {"version":3,"file":"sentryTanstackStart.js","sources":["../../../src/vite/sentryTanstackStart.ts"],"sourcesContent":["import type { BuildTimeOptionsBase } from '@sentry/core';\nimport type { Plugin } from 'vite';\nimport { makeAutoInstrumentMiddlewarePlugin } from './autoInstrumentMiddleware';\nimport { makeAddSentryVitePlugin, makeEnableSourceMapsVitePlugin } from './sourceMaps';\nimport type { TunnelRouteOptions } from './tunnelRoute';\nimport { makeTunnelRoutePlugin } from './tunnelRoute';\n\n/**\n * Build-time options for the Sentry TanStack Start SDK.\n */\nexport interface SentryTanstackStartOptions extends BuildTimeOptionsBase {\n /**\n * If this flag is `true`, the Sentry plugins will automatically instrument TanStack Start middlewares.\n *\n * This wraps global middlewares (`requestMiddleware` and `functionMiddleware`) in `createStart()` with Sentry\n * instrumentation to capture performance data.\n *\n * Set to `false` to disable automatic middleware instrumentation if you prefer to wrap middlewares manually\n * using `wrapMiddlewaresWithSentry`.\n *\n * @default true\n */\n autoInstrumentMiddleware?: boolean;\n\n /**\n * Configures a framework-managed same-origin tunnel route for Sentry envelopes.\n *\n * This creates a TanStack Start server route backed by `createSentryTunnelRoute()` and applies the resulting path\n * as the default `tunnel` option on the client.\n *\n * You can pass:\n * - `true` to generate an opaque route path per dev session or production build.\n * - `'/custom-path'` to use a fixed static route path.\n * - `{ allowedDsns, path }` for full control. If `allowedDsns` is omitted or empty, the tunnel route derives the DSN\n * from the active server Sentry client at runtime.\n *\n * If you also pass `tunnel` to `Sentry.init()`, that explicit runtime option wins and a warning is emitted because\n * the managed tunnel route is being bypassed.\n */\n tunnelRoute?: TunnelRouteOptions;\n}\n\n/**\n * Vite plugins for the Sentry TanStack Start SDK.\n *\n * @example\n * ```typescript\n * // vite.config.ts\n * import { defineConfig } from 'vite';\n * import { sentryTanstackStart } from '@sentry/tanstackstart-react/vite';\n * import { tanstackStart } from '@tanstack/react-start/plugin/vite';\n *\n * export default defineConfig({\n * plugins: [\n * tanstackStart(),\n * sentryTanstackStart({\n * org: 'your-org',\n * project: 'your-project',\n * }),\n * ],\n * });\n * ```\n *\n * @param options - Options to configure the Sentry Vite plugins\n * @returns An array of Vite plugins\n */\nexport function sentryTanstackStart(options: SentryTanstackStartOptions = {}): Plugin[] {\n const tunnelRoutePlugin = options.tunnelRoute ? makeTunnelRoutePlugin(options.tunnelRoute, options.debug) : undefined;\n\n // only add build-time plugins in production builds\n if (process.env.NODE_ENV === 'development') {\n return tunnelRoutePlugin ? [tunnelRoutePlugin] : [];\n }\n\n const plugins: Plugin[] = [...makeAddSentryVitePlugin(options)];\n\n if (tunnelRoutePlugin) {\n plugins.push(tunnelRoutePlugin);\n }\n\n // middleware auto-instrumentation\n if (options.autoInstrumentMiddleware !== false) {\n plugins.push(makeAutoInstrumentMiddlewarePlugin({ enabled: true, debug: options.debug }));\n }\n\n // source maps\n const sourceMapsDisabled = options.sourcemaps?.disable === true || options.sourcemaps?.disable === 'disable-upload';\n if (!sourceMapsDisabled) {\n plugins.push(...makeEnableSourceMapsVitePlugin(options));\n }\n\n return plugins;\n}\n"],"names":[],"mappings":";;;;AAOA;AACA;AACA;;AAiCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,OAAO,GAA+B,EAAE,EAAY;AACxF,EAAE,MAAM,iBAAA,GAAoB,OAAO,CAAC,WAAA,GAAc,qBAAqB,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAA,GAAI,SAAS;;AAEvH;AACA,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAA,KAAa,aAAa,EAAE;AAC9C,IAAI,OAAO,oBAAoB,CAAC,iBAAiB,CAAA,GAAI,EAAE;AACvD,EAAE;;AAEF,EAAE,MAAM,OAAO,GAAa,CAAC,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;;AAEjE,EAAE,IAAI,iBAAiB,EAAE;AACzB,IAAI,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC;AACnC,EAAE;;AAEF;AACA,EAAE,IAAI,OAAO,CAAC,wBAAA,KAA6B,KAAK,EAAE;AAClD,IAAI,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KAAA,EAAO,CAAC,CAAC;AAC7F,EAAE;;AAEF;AACA,EAAE,MAAM,kBAAA,GAAqB,OAAO,CAAC,UAAU,EAAE,OAAA,KAAY,IAAA,IAAQ,OAAO,CAAC,UAAU,EAAE,OAAA,KAAY,gBAAgB;AACrH,EAAE,IAAI,CAAC,kBAAkB,EAAE;AAC3B,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,8BAA8B,CAAC,OAAO,CAAC,CAAC;AAC5D,EAAE;;AAEF,EAAE,OAAO,OAAO;AAChB;;;;"}
1
+ {"version":3,"file":"sentryTanstackStart.js","sources":["../../../src/vite/sentryTanstackStart.ts"],"sourcesContent":["import type { BuildTimeOptionsBase } from '@sentry/core';\nimport type { Plugin } from 'vite';\nimport { makeAutoInstrumentMiddlewarePlugin } from './autoInstrumentMiddleware';\nimport { makeAddSentryVitePlugin, makeEnableSourceMapsVitePlugin } from './sourceMaps';\nimport type { TunnelRouteOptions } from './tunnelRoute';\nimport { makeTunnelRoutePlugin } from './tunnelRoute';\n\n/**\n * Build-time options for the Sentry TanStack Start SDK.\n */\nexport interface SentryTanstackStartOptions extends BuildTimeOptionsBase {\n /**\n * If this flag is `true`, the Sentry plugins will automatically instrument TanStack Start middlewares.\n *\n * This wraps global middlewares (`requestMiddleware` and `functionMiddleware`) in `createStart()` with Sentry\n * instrumentation to capture performance data.\n *\n * Set to `false` to disable automatic middleware instrumentation if you prefer to wrap middlewares manually\n * using `wrapMiddlewaresWithSentry`.\n *\n * @default true\n */\n autoInstrumentMiddleware?: boolean;\n\n /**\n * Configures a framework-managed same-origin tunnel route for Sentry envelopes.\n *\n * This creates a TanStack Start server route backed by `createSentryTunnelRoute()` and applies the resulting path\n * as the default `tunnel` option on the client.\n *\n * You can pass:\n * - `true` to generate an opaque route path per dev session or production build.\n * - `'/custom-path'` to use a fixed static route path.\n * - `{ allowedDsns, path }` for full control. If `allowedDsns` is omitted or empty, the tunnel route derives the DSN\n * from the active server Sentry client at runtime.\n *\n * If you also pass `tunnel` to `Sentry.init()`, that explicit runtime option wins and a warning is emitted because\n * the managed tunnel route is being bypassed.\n */\n tunnelRoute?: TunnelRouteOptions;\n}\n\n/**\n * Vite plugins for the Sentry TanStack Start SDK.\n *\n * @example\n * ```typescript\n * // vite.config.ts\n * import { defineConfig } from 'vite';\n * import { sentryTanstackStart } from '@sentry/tanstackstart-react/vite';\n * import { tanstackStart } from '@tanstack/react-start/plugin/vite';\n *\n * export default defineConfig({\n * plugins: [\n * tanstackStart(),\n * sentryTanstackStart({\n * org: 'your-org',\n * project: 'your-project',\n * }),\n * ],\n * });\n * ```\n *\n * @param options - Options to configure the Sentry Vite plugins\n * @returns An array of Vite plugins\n */\nexport function sentryTanstackStart(options: SentryTanstackStartOptions = {}): Plugin[] {\n const tunnelRoutePlugin = options.tunnelRoute ? makeTunnelRoutePlugin(options.tunnelRoute, options.debug) : undefined;\n\n // only add build-time plugins in production builds\n if (process.env.NODE_ENV === 'development') {\n return tunnelRoutePlugin ? [tunnelRoutePlugin] : [];\n }\n\n const plugins: Plugin[] = [...makeAddSentryVitePlugin(options)];\n\n if (tunnelRoutePlugin) {\n plugins.push(tunnelRoutePlugin);\n }\n\n // middleware auto-instrumentation\n if (options.autoInstrumentMiddleware !== false) {\n plugins.push(makeAutoInstrumentMiddlewarePlugin({ enabled: true, debug: options.debug }));\n }\n\n // source maps\n const sourceMapsDisabled = options.sourcemaps?.disable === true || options.sourcemaps?.disable === 'disable-upload';\n if (!sourceMapsDisabled) {\n plugins.push(...makeEnableSourceMapsVitePlugin(options));\n }\n\n return plugins;\n}\n"],"names":[],"mappings":";;;;AAkEO,SAAS,mBAAA,CAAoB,OAAA,GAAsC,EAAC,EAAa;AACtF,EAAA,MAAM,iBAAA,GAAoB,QAAQ,WAAA,GAAc,qBAAA,CAAsB,QAAQ,WAAA,EAAa,OAAA,CAAQ,KAAK,CAAA,GAAI,MAAA;AAG5G,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,aAAA,EAAe;AAC1C,IAAA,OAAO,iBAAA,GAAoB,CAAC,iBAAiB,CAAA,GAAI,EAAC;AAAA,EACpD;AAEA,EAAA,MAAM,OAAA,GAAoB,CAAC,GAAG,uBAAA,CAAwB,OAAO,CAAC,CAAA;AAE9D,EAAA,IAAI,iBAAA,EAAmB;AACrB,IAAA,OAAA,CAAQ,KAAK,iBAAiB,CAAA;AAAA,EAChC;AAGA,EAAA,IAAI,OAAA,CAAQ,6BAA6B,KAAA,EAAO;AAC9C,IAAA,OAAA,CAAQ,IAAA,CAAK,mCAAmC,EAAE,OAAA,EAAS,MAAM,KAAA,EAAO,OAAA,CAAQ,KAAA,EAAO,CAAC,CAAA;AAAA,EAC1F;AAGA,EAAA,MAAM,qBAAqB,OAAA,CAAQ,UAAA,EAAY,YAAY,IAAA,IAAQ,OAAA,CAAQ,YAAY,OAAA,KAAY,gBAAA;AACnG,EAAA,IAAI,CAAC,kBAAA,EAAoB;AACvB,IAAA,OAAA,CAAQ,IAAA,CAAK,GAAG,8BAAA,CAA+B,OAAO,CAAC,CAAA;AAAA,EACzD;AAEA,EAAA,OAAO,OAAA;AACT;;;;"}
@@ -1,8 +1,5 @@
1
1
  import { sentryVitePlugin } from '@sentry/vite-plugin';
2
2
 
3
- /**
4
- * A Sentry plugin for adding the @sentry/vite-plugin to automatically upload source maps to Sentry.
5
- */
6
3
  function makeAddSentryVitePlugin(options) {
7
4
  const {
8
5
  applicationKey,
@@ -17,41 +14,34 @@ function makeAddSentryVitePlugin(options) {
17
14
  sentryUrl,
18
15
  silent,
19
16
  sourcemaps,
20
- telemetry,
17
+ telemetry
21
18
  } = options;
22
-
23
- // defer resolving the filesToDeleteAfterUpload until we got access to the Vite config
24
19
  let resolveFilesToDeleteAfterUpload;
25
- const filesToDeleteAfterUploadPromise = new Promise(resolve => {
20
+ const filesToDeleteAfterUploadPromise = new Promise((resolve) => {
26
21
  resolveFilesToDeleteAfterUpload = resolve;
27
22
  });
28
-
29
23
  const configPlugin = {
30
- name: 'sentry-tanstackstart-files-to-delete-after-upload-plugin',
31
- apply: 'build',
32
- enforce: 'post',
24
+ name: "sentry-tanstackstart-files-to-delete-after-upload-plugin",
25
+ apply: "build",
26
+ enforce: "post",
33
27
  config(config) {
34
28
  const userFilesToDelete = sourcemaps?.filesToDeleteAfterUpload;
35
-
36
- // Only auto-delete source maps if the user didn't configure sourcemaps at all
37
- if (typeof userFilesToDelete === 'undefined' && typeof config.build?.sourcemap === 'undefined') {
29
+ if (typeof userFilesToDelete === "undefined" && typeof config.build?.sourcemap === "undefined") {
38
30
  if (debug) {
39
- // eslint-disable-next-line no-console
40
31
  console.log(
41
- '[Sentry] Automatically setting `sourcemaps.filesToDeleteAfterUpload: ["./**/*.map"]` to delete generated source maps after they were uploaded to Sentry.',
32
+ '[Sentry] Automatically setting `sourcemaps.filesToDeleteAfterUpload: ["./**/*.map"]` to delete generated source maps after they were uploaded to Sentry.'
42
33
  );
43
34
  }
44
- resolveFilesToDeleteAfterUpload?.(['./**/*.map']);
35
+ resolveFilesToDeleteAfterUpload?.(["./**/*.map"]);
45
36
  } else {
46
37
  resolveFilesToDeleteAfterUpload?.(userFilesToDelete);
47
38
  }
48
- },
39
+ }
49
40
  };
50
-
51
41
  const sentryPlugins = sentryVitePlugin({
52
42
  applicationKey,
53
43
  authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,
54
- bundleSizeOptimizations: bundleSizeOptimizations ?? undefined,
44
+ bundleSizeOptimizations: bundleSizeOptimizations ?? void 0,
55
45
  debug: debug ?? false,
56
46
  errorHandler,
57
47
  headers,
@@ -65,101 +55,65 @@ function makeAddSentryVitePlugin(options) {
65
55
  ignore: sourcemaps?.ignore,
66
56
  // BuildTimeOptionsBase types can lag behind bundler plugin options in some local setups.
67
57
  // Keep runtime support while staying resilient to type version skew.
68
- rewriteSources: (sourcemaps )?.rewriteSources ,
69
- filesToDeleteAfterUpload: filesToDeleteAfterUploadPromise,
58
+ rewriteSources: sourcemaps?.rewriteSources,
59
+ filesToDeleteAfterUpload: filesToDeleteAfterUploadPromise
70
60
  },
71
61
  telemetry: telemetry ?? true,
72
62
  url: sentryUrl,
73
63
  _metaOptions: {
74
64
  telemetry: {
75
- metaFramework: 'tanstackstart-react',
76
- },
77
- },
65
+ metaFramework: "tanstackstart-react"
66
+ }
67
+ }
78
68
  });
79
-
80
69
  return [configPlugin, ...sentryPlugins];
81
70
  }
82
-
83
- /**
84
- * A Sentry plugin for TanStack Start React to enable "hidden" source maps if they are unset.
85
- */
86
71
  function makeEnableSourceMapsVitePlugin(options) {
87
72
  return [
88
73
  {
89
- name: 'sentry-tanstackstart-react-source-maps',
90
- apply: 'build',
91
- enforce: 'post',
74
+ name: "sentry-tanstackstart-react-source-maps",
75
+ apply: "build",
76
+ enforce: "post",
92
77
  config(viteConfig) {
93
78
  return {
94
79
  ...viteConfig,
95
80
  build: {
96
81
  ...viteConfig.build,
97
- sourcemap: getUpdatedSourceMapSettings(viteConfig, options),
98
- },
82
+ sourcemap: getUpdatedSourceMapSettings(viteConfig, options)
83
+ }
99
84
  };
100
- },
101
- },
85
+ }
86
+ }
102
87
  ];
103
88
  }
104
-
105
- /** There are 3 ways to set up source map generation (https://github.com/getsentry/sentry-javascript/issues/13993)
106
- *
107
- * 1. User explicitly disabled source maps
108
- * - keep this setting (emit a warning that errors won't be unminified in Sentry)
109
- * - We won't upload anything
110
- *
111
- * 2. Users enabled source map generation (true, 'hidden', 'inline').
112
- * - keep this setting (don't do anything - like deletion - besides uploading)
113
- *
114
- * 3. Users didn't set source maps generation
115
- * - we enable 'hidden' source maps generation
116
- * - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)
117
- *
118
- * --> only exported for testing
119
- */
120
- function getUpdatedSourceMapSettings(
121
- viteConfig,
122
- sentryPluginOptions,
123
- ) {
89
+ function getUpdatedSourceMapSettings(viteConfig, sentryPluginOptions) {
124
90
  viteConfig.build = viteConfig.build || {};
125
-
126
91
  const viteUserSourceMapSetting = viteConfig.build?.sourcemap;
127
- const settingKey = 'vite.build.sourcemap';
92
+ const settingKey = "vite.build.sourcemap";
128
93
  const debug = sentryPluginOptions?.debug;
129
-
130
- // Respect user source map setting if it is explicitly set
131
94
  if (viteUserSourceMapSetting === false) {
132
95
  if (debug) {
133
- // eslint-disable-next-line no-console
134
96
  console.warn(
135
- `[Sentry] Source map generation is currently disabled in your TanStack Start configuration (\`${settingKey}: false\`). Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified.`,
97
+ `[Sentry] Source map generation is currently disabled in your TanStack Start configuration (\`${settingKey}: false\`). Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified.`
136
98
  );
137
99
  } else {
138
- // eslint-disable-next-line no-console
139
- console.warn('[Sentry] Source map generation is disabled in your TanStack Start configuration.');
100
+ console.warn("[Sentry] Source map generation is disabled in your TanStack Start configuration.");
140
101
  }
141
-
142
102
  return viteUserSourceMapSetting;
143
- } else if (viteUserSourceMapSetting && ['hidden', 'inline', true].includes(viteUserSourceMapSetting)) {
103
+ } else if (viteUserSourceMapSetting && ["hidden", "inline", true].includes(viteUserSourceMapSetting)) {
144
104
  if (debug) {
145
- // eslint-disable-next-line no-console
146
105
  console.log(
147
- `[Sentry] We discovered \`${settingKey}\` is set to \`${viteUserSourceMapSetting.toString()}\`. Sentry will keep this source map setting.`,
106
+ `[Sentry] We discovered \`${settingKey}\` is set to \`${viteUserSourceMapSetting.toString()}\`. Sentry will keep this source map setting.`
148
107
  );
149
108
  }
150
-
151
109
  return viteUserSourceMapSetting;
152
110
  }
153
-
154
- // If the user did not specify a source map setting, we enable 'hidden' by default
155
111
  if (debug) {
156
- // eslint-disable-next-line no-console
157
112
  console.log(
158
- `[Sentry] Enabled source map generation in the build options with \`${settingKey}: 'hidden'\`. The source maps will be deleted after they were uploaded to Sentry.`,
113
+ `[Sentry] Enabled source map generation in the build options with \`${settingKey}: 'hidden'\`. The source maps will be deleted after they were uploaded to Sentry.`
159
114
  );
160
115
  }
161
-
162
- return 'hidden';
116
+ return "hidden";
163
117
  }
164
118
 
165
119
  export { getUpdatedSourceMapSettings, makeAddSentryVitePlugin, makeEnableSourceMapsVitePlugin };
@@ -1 +1 @@
1
- {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import type { BuildTimeOptionsBase } from '@sentry/core';\nimport { sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { Plugin, UserConfig } from 'vite';\n\ntype FilesToDeleteAfterUpload = string | string[] | undefined;\n\n/**\n * A Sentry plugin for adding the @sentry/vite-plugin to automatically upload source maps to Sentry.\n */\nexport function makeAddSentryVitePlugin(options: BuildTimeOptionsBase): Plugin[] {\n const {\n applicationKey,\n authToken,\n bundleSizeOptimizations,\n debug,\n errorHandler,\n headers,\n org,\n project,\n release,\n sentryUrl,\n silent,\n sourcemaps,\n telemetry,\n } = options;\n\n // defer resolving the filesToDeleteAfterUpload until we got access to the Vite config\n let resolveFilesToDeleteAfterUpload: ((value: FilesToDeleteAfterUpload) => void) | undefined;\n const filesToDeleteAfterUploadPromise = new Promise<FilesToDeleteAfterUpload>(resolve => {\n resolveFilesToDeleteAfterUpload = resolve;\n });\n\n const configPlugin: Plugin = {\n name: 'sentry-tanstackstart-files-to-delete-after-upload-plugin',\n apply: 'build',\n enforce: 'post',\n config(config) {\n const userFilesToDelete = sourcemaps?.filesToDeleteAfterUpload;\n\n // Only auto-delete source maps if the user didn't configure sourcemaps at all\n if (typeof userFilesToDelete === 'undefined' && typeof config.build?.sourcemap === 'undefined') {\n if (debug) {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Automatically setting `sourcemaps.filesToDeleteAfterUpload: [\"./**/*.map\"]` to delete generated source maps after they were uploaded to Sentry.',\n );\n }\n resolveFilesToDeleteAfterUpload?.(['./**/*.map']);\n } else {\n resolveFilesToDeleteAfterUpload?.(userFilesToDelete);\n }\n },\n };\n\n const sentryPlugins = sentryVitePlugin({\n applicationKey,\n authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,\n bundleSizeOptimizations: bundleSizeOptimizations ?? undefined,\n debug: debug ?? false,\n errorHandler,\n headers,\n org: org ?? process.env.SENTRY_ORG,\n project: project ?? process.env.SENTRY_PROJECT,\n release,\n silent,\n sourcemaps: {\n assets: sourcemaps?.assets,\n disable: sourcemaps?.disable,\n ignore: sourcemaps?.ignore,\n // BuildTimeOptionsBase types can lag behind bundler plugin options in some local setups.\n // Keep runtime support while staying resilient to type version skew.\n rewriteSources: (sourcemaps as unknown as { rewriteSources?: unknown } | undefined)?.rewriteSources as never,\n filesToDeleteAfterUpload: filesToDeleteAfterUploadPromise,\n },\n telemetry: telemetry ?? true,\n url: sentryUrl,\n _metaOptions: {\n telemetry: {\n metaFramework: 'tanstackstart-react',\n },\n },\n });\n\n return [configPlugin, ...sentryPlugins];\n}\n\n/**\n * A Sentry plugin for TanStack Start React to enable \"hidden\" source maps if they are unset.\n */\nexport function makeEnableSourceMapsVitePlugin(options: BuildTimeOptionsBase): Plugin[] {\n return [\n {\n name: 'sentry-tanstackstart-react-source-maps',\n apply: 'build',\n enforce: 'post',\n config(viteConfig) {\n return {\n ...viteConfig,\n build: {\n ...viteConfig.build,\n sourcemap: getUpdatedSourceMapSettings(viteConfig, options),\n },\n };\n },\n },\n ];\n}\n\n/** There are 3 ways to set up source map generation (https://github.com/getsentry/sentry-javascript/issues/13993)\n *\n * 1. User explicitly disabled source maps\n * - keep this setting (emit a warning that errors won't be unminified in Sentry)\n * - We won't upload anything\n *\n * 2. Users enabled source map generation (true, 'hidden', 'inline').\n * - keep this setting (don't do anything - like deletion - besides uploading)\n *\n * 3. Users didn't set source maps generation\n * - we enable 'hidden' source maps generation\n * - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)\n *\n * --> only exported for testing\n */\nexport function getUpdatedSourceMapSettings(\n viteConfig: UserConfig,\n sentryPluginOptions?: BuildTimeOptionsBase,\n): boolean | 'inline' | 'hidden' {\n viteConfig.build = viteConfig.build || {};\n\n const viteUserSourceMapSetting = viteConfig.build?.sourcemap;\n const settingKey = 'vite.build.sourcemap';\n const debug = sentryPluginOptions?.debug;\n\n // Respect user source map setting if it is explicitly set\n if (viteUserSourceMapSetting === false) {\n if (debug) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation is currently disabled in your TanStack Start configuration (\\`${settingKey}: false\\`). Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Source map generation is disabled in your TanStack Start configuration.');\n }\n\n return viteUserSourceMapSetting;\n } else if (viteUserSourceMapSetting && ['hidden', 'inline', true].includes(viteUserSourceMapSetting)) {\n if (debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${viteUserSourceMapSetting.toString()}\\`. Sentry will keep this source map setting.`,\n );\n }\n\n return viteUserSourceMapSetting;\n }\n\n // If the user did not specify a source map setting, we enable 'hidden' by default\n if (debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Enabled source map generation in the build options with \\`${settingKey}: 'hidden'\\`. The source maps will be deleted after they were uploaded to Sentry.`,\n );\n }\n\n return 'hidden';\n}\n"],"names":[],"mappings":";;AAMA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,OAAO,EAAkC;AACjF,EAAE,MAAM;AACR,IAAI,cAAc;AAClB,IAAI,SAAS;AACb,IAAI,uBAAuB;AAC3B,IAAI,KAAK;AACT,IAAI,YAAY;AAChB,IAAI,OAAO;AACX,IAAI,GAAG;AACP,IAAI,OAAO;AACX,IAAI,OAAO;AACX,IAAI,SAAS;AACb,IAAI,MAAM;AACV,IAAI,UAAU;AACd,IAAI,SAAS;AACb,GAAE,GAAI,OAAO;;AAEb;AACA,EAAE,IAAI,+BAA+B;AACrC,EAAE,MAAM,+BAAA,GAAkC,IAAI,OAAO,CAA2B,WAAW;AAC3F,IAAI,+BAAA,GAAkC,OAAO;AAC7C,EAAE,CAAC,CAAC;;AAEJ,EAAE,MAAM,YAAY,GAAW;AAC/B,IAAI,IAAI,EAAE,0DAA0D;AACpE,IAAI,KAAK,EAAE,OAAO;AAClB,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,MAAM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G,IAAI;;AAEJ,IAAI,OAAO,wBAAwB;AACnC,EAAE,OAAO,IAAI,wBAAA,IAA4B,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAAE;AACxG,IAAI,IAAI,KAAK,EAAE;AACf;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,CAAC,yBAAyB,EAAE,UAAU,CAAC,eAAe,EAAE,wBAAwB,CAAC,QAAQ,EAAE,CAAC,6CAA6C,CAAC;AAClJ,OAAO;AACP,IAAI;;AAEJ,IAAI,OAAO,wBAAwB;AACnC,EAAE;;AAEF;AACA,EAAE,IAAI,KAAK,EAAE;AACb;AACA,IAAI,OAAO,CAAC,GAAG;AACf,MAAM,CAAC,mEAAmE,EAAE,UAAU,CAAC,iFAAiF,CAAC;AACzK,KAAK;AACL,EAAE;;AAEF,EAAE,OAAO,QAAQ;AACjB;;;;"}
1
+ {"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import type { BuildTimeOptionsBase } from '@sentry/core';\nimport { sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { Plugin, UserConfig } from 'vite';\n\ntype FilesToDeleteAfterUpload = string | string[] | undefined;\n\n/**\n * A Sentry plugin for adding the @sentry/vite-plugin to automatically upload source maps to Sentry.\n */\nexport function makeAddSentryVitePlugin(options: BuildTimeOptionsBase): Plugin[] {\n const {\n applicationKey,\n authToken,\n bundleSizeOptimizations,\n debug,\n errorHandler,\n headers,\n org,\n project,\n release,\n sentryUrl,\n silent,\n sourcemaps,\n telemetry,\n } = options;\n\n // defer resolving the filesToDeleteAfterUpload until we got access to the Vite config\n let resolveFilesToDeleteAfterUpload: ((value: FilesToDeleteAfterUpload) => void) | undefined;\n const filesToDeleteAfterUploadPromise = new Promise<FilesToDeleteAfterUpload>(resolve => {\n resolveFilesToDeleteAfterUpload = resolve;\n });\n\n const configPlugin: Plugin = {\n name: 'sentry-tanstackstart-files-to-delete-after-upload-plugin',\n apply: 'build',\n enforce: 'post',\n config(config) {\n const userFilesToDelete = sourcemaps?.filesToDeleteAfterUpload;\n\n // Only auto-delete source maps if the user didn't configure sourcemaps at all\n if (typeof userFilesToDelete === 'undefined' && typeof config.build?.sourcemap === 'undefined') {\n if (debug) {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Automatically setting `sourcemaps.filesToDeleteAfterUpload: [\"./**/*.map\"]` to delete generated source maps after they were uploaded to Sentry.',\n );\n }\n resolveFilesToDeleteAfterUpload?.(['./**/*.map']);\n } else {\n resolveFilesToDeleteAfterUpload?.(userFilesToDelete);\n }\n },\n };\n\n const sentryPlugins = sentryVitePlugin({\n applicationKey,\n authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,\n bundleSizeOptimizations: bundleSizeOptimizations ?? undefined,\n debug: debug ?? false,\n errorHandler,\n headers,\n org: org ?? process.env.SENTRY_ORG,\n project: project ?? process.env.SENTRY_PROJECT,\n release,\n silent,\n sourcemaps: {\n assets: sourcemaps?.assets,\n disable: sourcemaps?.disable,\n ignore: sourcemaps?.ignore,\n // BuildTimeOptionsBase types can lag behind bundler plugin options in some local setups.\n // Keep runtime support while staying resilient to type version skew.\n rewriteSources: (sourcemaps as unknown as { rewriteSources?: unknown } | undefined)?.rewriteSources as never,\n filesToDeleteAfterUpload: filesToDeleteAfterUploadPromise,\n },\n telemetry: telemetry ?? true,\n url: sentryUrl,\n _metaOptions: {\n telemetry: {\n metaFramework: 'tanstackstart-react',\n },\n },\n });\n\n return [configPlugin, ...sentryPlugins];\n}\n\n/**\n * A Sentry plugin for TanStack Start React to enable \"hidden\" source maps if they are unset.\n */\nexport function makeEnableSourceMapsVitePlugin(options: BuildTimeOptionsBase): Plugin[] {\n return [\n {\n name: 'sentry-tanstackstart-react-source-maps',\n apply: 'build',\n enforce: 'post',\n config(viteConfig) {\n return {\n ...viteConfig,\n build: {\n ...viteConfig.build,\n sourcemap: getUpdatedSourceMapSettings(viteConfig, options),\n },\n };\n },\n },\n ];\n}\n\n/** There are 3 ways to set up source map generation (https://github.com/getsentry/sentry-javascript/issues/13993)\n *\n * 1. User explicitly disabled source maps\n * - keep this setting (emit a warning that errors won't be unminified in Sentry)\n * - We won't upload anything\n *\n * 2. Users enabled source map generation (true, 'hidden', 'inline').\n * - keep this setting (don't do anything - like deletion - besides uploading)\n *\n * 3. Users didn't set source maps generation\n * - we enable 'hidden' source maps generation\n * - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)\n *\n * --> only exported for testing\n */\nexport function getUpdatedSourceMapSettings(\n viteConfig: UserConfig,\n sentryPluginOptions?: BuildTimeOptionsBase,\n): boolean | 'inline' | 'hidden' {\n viteConfig.build = viteConfig.build || {};\n\n const viteUserSourceMapSetting = viteConfig.build?.sourcemap;\n const settingKey = 'vite.build.sourcemap';\n const debug = sentryPluginOptions?.debug;\n\n // Respect user source map setting if it is explicitly set\n if (viteUserSourceMapSetting === false) {\n if (debug) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation is currently disabled in your TanStack Start configuration (\\`${settingKey}: false\\`). Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Source map generation is disabled in your TanStack Start configuration.');\n }\n\n return viteUserSourceMapSetting;\n } else if (viteUserSourceMapSetting && ['hidden', 'inline', true].includes(viteUserSourceMapSetting)) {\n if (debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${viteUserSourceMapSetting.toString()}\\`. Sentry will keep this source map setting.`,\n );\n }\n\n return viteUserSourceMapSetting;\n }\n\n // If the user did not specify a source map setting, we enable 'hidden' by default\n if (debug) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Enabled source map generation in the build options with \\`${settingKey}: 'hidden'\\`. The source maps will be deleted after they were uploaded to Sentry.`,\n );\n }\n\n return 'hidden';\n}\n"],"names":[],"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qB,KAAA;AAGnC,EAAA,IAAI,6BAA6B,KAAA,EAAO;AACtC,IAAA,IAAI,KAAA,EAAO;AAET,MAAA,OAAA,CAAQ,IAAA;AAAA,QACN,gGAAgG,UAAU,CAAA,kIAAA;AAAA,OAC5G;AAAA,IACF,CAAA,MAAO;AAEL,MAAA,OAAA,CAAQ,KAAK,kFAAkF,CAAA;AAAA,IACjG;AAEA,IAAA,OAAO,wBAAA;AAAA,EACT,CAAA,MAAA,IAAW,4BAA4B,CAAC,QAAA,EAAU,UAAU,IAAI,CAAA,CAAE,QAAA,CAAS,wBAAwB,CAAA,EAAG;AACpG,IAAA,IAAI,KAAA,EAAO;AAET,MAAA,OAAA,CAAQ,GAAA;AAAA,QACN,CAAA,yBAAA,EAA4B,UAAU,CAAA,eAAA,EAAkB,wBAAA,CAAyB,UAAU,CAAA,6CAAA;AAAA,OAC7F;AAAA,IACF;AAEA,IAAA,OAAO,wBAAA;AAAA,EACT;AAGA,EAAA,IAAI,KAAA,EAAO;AAET,IAAA,OAAA,CAAQ,GAAA;AAAA,MACN,sEAAsE,UAAU,CAAA,iFAAA;AAAA,KAClF;AAAA,EACF;AAEA,EAAA,OAAO,QAAA;AACT;;;;"}
@@ -1,112 +1,87 @@
1
- const MANAGED_TUNNEL_ROUTE_IMPORT = 'SentryManagedTunnelRouteImport';
2
- const MANAGED_TUNNEL_ROUTE_NAME = 'SentryManagedTunnelRoute';
3
- const MANAGED_TUNNEL_ROUTE_PATH_ENV_KEY = '__SENTRY_INTERNAL_TANSTACKSTART_TUNNEL_ROUTE__';
4
-
5
- const VIRTUAL_TUNNEL_ROUTE_ID = 'virtual:sentry-tanstackstart-react/tunnel-route';
1
+ const MANAGED_TUNNEL_ROUTE_IMPORT = "SentryManagedTunnelRouteImport";
2
+ const MANAGED_TUNNEL_ROUTE_NAME = "SentryManagedTunnelRoute";
3
+ const MANAGED_TUNNEL_ROUTE_PATH_ENV_KEY = "__SENTRY_INTERNAL_TANSTACKSTART_TUNNEL_ROUTE__";
4
+ const VIRTUAL_TUNNEL_ROUTE_ID = "virtual:sentry-tanstackstart-react/tunnel-route";
6
5
  const RESOLVED_VIRTUAL_TUNNEL_ROUTE_ID = `\0${VIRTUAL_TUNNEL_ROUTE_ID}`;
7
-
8
6
  function generateRandomTunnelRoute() {
9
- const randomPath = Array.from({ length: 8 }, () => Math.floor(Math.random() * 36).toString(36)).join('');
10
-
7
+ const randomPath = Array.from({ length: 8 }, () => Math.floor(Math.random() * 36).toString(36)).join("");
11
8
  return `/${randomPath}`;
12
9
  }
13
-
14
10
  function resolveTunnelRoute(tunnel) {
15
- if (typeof tunnel === 'string') {
11
+ if (typeof tunnel === "string") {
16
12
  return tunnel;
17
13
  }
18
-
19
14
  if (process.env[MANAGED_TUNNEL_ROUTE_PATH_ENV_KEY]) {
20
15
  return process.env[MANAGED_TUNNEL_ROUTE_PATH_ENV_KEY];
21
16
  }
22
-
23
17
  const resolvedTunnelRoute = generateRandomTunnelRoute();
24
18
  process.env[MANAGED_TUNNEL_ROUTE_PATH_ENV_KEY] = resolvedTunnelRoute;
25
19
  return resolvedTunnelRoute;
26
20
  }
27
-
28
21
  function validateStaticPath(path) {
29
- if (!path.startsWith('/') || path.includes('?') || path.includes('#')) {
22
+ if (!path.startsWith("/") || path.includes("?") || path.includes("#")) {
30
23
  throw new Error(
31
- '[@sentry/tanstackstart-react] `tunnelRoute` static paths must start with `/` and must not contain query or hash segments.',
24
+ "[@sentry/tanstackstart-react] `tunnelRoute` static paths must start with `/` and must not contain query or hash segments."
32
25
  );
33
26
  }
34
27
  }
35
-
36
28
  function normalizeTunnelRouteOptions(options) {
37
29
  if (options === true) {
38
- return { resolvedPath: resolveTunnelRoute(true), allowedDsns: undefined };
30
+ return { resolvedPath: resolveTunnelRoute(true), allowedDsns: void 0 };
39
31
  }
40
-
41
- if (typeof options === 'string') {
32
+ if (typeof options === "string") {
42
33
  validateStaticPath(options);
43
34
  return {
44
35
  resolvedPath: resolveTunnelRoute(options),
45
- allowedDsns: undefined,
36
+ allowedDsns: void 0
46
37
  };
47
38
  }
48
-
49
- const allowedDsns = options.allowedDsns && options.allowedDsns.length > 0 ? options.allowedDsns : undefined;
39
+ const allowedDsns = options.allowedDsns && options.allowedDsns.length > 0 ? options.allowedDsns : void 0;
50
40
  const path = options.path;
51
-
52
41
  if (path) {
53
42
  validateStaticPath(path);
54
43
  }
55
-
56
44
  return { resolvedPath: resolveTunnelRoute(path || true), allowedDsns };
57
45
  }
58
-
59
- // `routeTree.gen.ts` quote style follows `tsr.config.json#quoteStyle` (`single` | `double`),
60
- // so we check both forms for each route-identifying key.
61
- const ROUTE_CONFLICT_KEYS = ['fullPath', 'path', 'id'] ;
62
-
46
+ const ROUTE_CONFLICT_KEYS = ["fullPath", "path", "id"];
63
47
  function hasRouteConflict(source, resolvedTunnelRoute) {
64
48
  const literals = [`'${resolvedTunnelRoute}'`, `"${resolvedTunnelRoute}"`];
65
- return ROUTE_CONFLICT_KEYS.some(key => literals.some(literal => source.includes(`${key}: ${literal}`)));
49
+ return ROUTE_CONFLICT_KEYS.some((key) => literals.some((literal) => source.includes(`${key}: ${literal}`)));
66
50
  }
67
-
68
51
  function injectAfterLastImport(source, statement) {
69
52
  const importMatches = [...source.matchAll(/^import .+$/gm)];
70
53
  const lastImport = importMatches.at(-1);
71
-
72
- if (lastImport?.index === undefined) {
54
+ if (lastImport?.index === void 0) {
73
55
  throw new Error(
74
- '[@sentry/tanstackstart-react] Failed to inject the managed tunnel route because `routeTree.gen.ts` imports could not be located.',
56
+ "[@sentry/tanstackstart-react] Failed to inject the managed tunnel route because `routeTree.gen.ts` imports could not be located."
75
57
  );
76
58
  }
77
-
78
59
  const insertIndex = lastImport.index + lastImport[0].length;
79
- return `${source.slice(0, insertIndex)}\n${statement}${source.slice(insertIndex)}`;
60
+ return `${source.slice(0, insertIndex)}
61
+ ${statement}${source.slice(insertIndex)}`;
80
62
  }
81
-
82
63
  function injectManagedTunnelRoute(source, resolvedTunnelRoute) {
83
64
  if (source.includes(VIRTUAL_TUNNEL_ROUTE_ID)) {
84
65
  return source;
85
66
  }
86
-
87
67
  if (hasRouteConflict(source, resolvedTunnelRoute)) {
88
68
  throw new Error(
89
- `[@sentry/tanstackstart-react] Cannot register managed tunnel route "${resolvedTunnelRoute}" because an existing TanStack Start route already uses that path.`,
69
+ `[@sentry/tanstackstart-react] Cannot register managed tunnel route "${resolvedTunnelRoute}" because an existing TanStack Start route already uses that path.`
90
70
  );
91
71
  }
92
-
93
72
  const serializedTunnelRoute = JSON.stringify(resolvedTunnelRoute);
94
-
95
73
  let transformedSource = injectAfterLastImport(
96
74
  source,
97
- `import { Route as ${MANAGED_TUNNEL_ROUTE_IMPORT} } from '${VIRTUAL_TUNNEL_ROUTE_ID}'`,
75
+ `import { Route as ${MANAGED_TUNNEL_ROUTE_IMPORT} } from '${VIRTUAL_TUNNEL_ROUTE_ID}'`
98
76
  );
99
-
100
77
  const rootRouteChildrenMatch = transformedSource.match(
101
- /const rootRouteChildren(?:\s*:\s*RootRouteChildren)?\s*=\s*\{/,
78
+ /const rootRouteChildren(?:\s*:\s*RootRouteChildren)?\s*=\s*\{/
102
79
  );
103
-
104
- if (rootRouteChildrenMatch?.index === undefined) {
80
+ if (rootRouteChildrenMatch?.index === void 0) {
105
81
  throw new Error(
106
- '[@sentry/tanstackstart-react] Failed to inject the managed tunnel route because the generated TanStack route tree did not contain `rootRouteChildren`.',
82
+ "[@sentry/tanstackstart-react] Failed to inject the managed tunnel route because the generated TanStack route tree did not contain `rootRouteChildren`."
107
83
  );
108
84
  }
109
-
110
85
  const injectedRootRouteChildrenDeclaration = `const ${MANAGED_TUNNEL_ROUTE_NAME} = ${MANAGED_TUNNEL_ROUTE_IMPORT}.update({
111
86
  id: ${serializedTunnelRoute},
112
87
  path: ${serializedTunnelRoute},
@@ -116,31 +91,25 @@ function injectManagedTunnelRoute(source, resolvedTunnelRoute) {
116
91
  ${rootRouteChildrenMatch[0]}
117
92
  ${MANAGED_TUNNEL_ROUTE_NAME}: ${MANAGED_TUNNEL_ROUTE_NAME},
118
93
  `;
119
-
120
94
  transformedSource = `${transformedSource.slice(0, rootRouteChildrenMatch.index)}${injectedRootRouteChildrenDeclaration}${transformedSource.slice(rootRouteChildrenMatch.index + rootRouteChildrenMatch[0].length)}`;
121
-
122
95
  return transformedSource;
123
96
  }
124
-
125
97
  function makeTunnelRoutePlugin(options, debug) {
126
98
  const normalized = normalizeTunnelRouteOptions(options);
127
99
  const resolvedTunnelRoute = normalized.resolvedPath;
128
100
  const serializedTunnelRoute = JSON.stringify(resolvedTunnelRoute);
129
- const serializedAllowedDsns = normalized.allowedDsns ? JSON.stringify(normalized.allowedDsns) : undefined;
130
-
101
+ const serializedAllowedDsns = normalized.allowedDsns ? JSON.stringify(normalized.allowedDsns) : void 0;
131
102
  if (debug) {
132
- // eslint-disable-next-line no-console
133
103
  console.log(`[@sentry/tanstackstart-react] Registered tunnel route: ${resolvedTunnelRoute}`);
134
104
  }
135
-
136
105
  return {
137
- name: 'sentry-tanstackstart-tunnel-route',
138
- enforce: 'pre',
106
+ name: "sentry-tanstackstart-tunnel-route",
107
+ enforce: "pre",
139
108
  config() {
140
109
  return {
141
110
  define: {
142
- __SENTRY_TANSTACKSTART_TUNNEL_ROUTE__: serializedTunnelRoute,
143
- },
111
+ __SENTRY_TANSTACKSTART_TUNNEL_ROUTE__: serializedTunnelRoute
112
+ }
144
113
  };
145
114
  },
146
115
  resolveId(source) {
@@ -150,7 +119,6 @@ function makeTunnelRoutePlugin(options, debug) {
150
119
  if (id !== RESOLVED_VIRTUAL_TUNNEL_ROUTE_ID) {
151
120
  return null;
152
121
  }
153
-
154
122
  return `import { createFileRoute } from '@tanstack/react-router';
155
123
 
156
124
  export const Route = createFileRoute(${serializedTunnelRoute})({
@@ -166,12 +134,11 @@ export const Route = createFileRoute(${serializedTunnelRoute})({
166
134
  `;
167
135
  },
168
136
  transform(source, id) {
169
- if (!id.endsWith('/routeTree.gen.ts') && !id.endsWith('\\routeTree.gen.ts')) {
137
+ if (!id.endsWith("/routeTree.gen.ts") && !id.endsWith("\\routeTree.gen.ts")) {
170
138
  return null;
171
139
  }
172
-
173
140
  return injectManagedTunnelRoute(source, resolvedTunnelRoute);
174
- },
141
+ }
175
142
  };
176
143
  }
177
144