@sentry/react-router 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 (119) hide show
  1. package/build/cjs/client/createClientInstrumentation.js +104 -175
  2. package/build/cjs/client/createClientInstrumentation.js.map +1 -1
  3. package/build/cjs/client/hydratedRouter.js +27 -74
  4. package/build/cjs/client/hydratedRouter.js.map +1 -1
  5. package/build/cjs/client/sdk.js +5 -16
  6. package/build/cjs/client/sdk.js.map +1 -1
  7. package/build/cjs/client/sentryOnError.js +4 -27
  8. package/build/cjs/client/sentryOnError.js.map +1 -1
  9. package/build/cjs/client/tracingIntegration.js +4 -18
  10. package/build/cjs/client/tracingIntegration.js.map +1 -1
  11. package/build/cjs/client/utils.js +5 -17
  12. package/build/cjs/client/utils.js.map +1 -1
  13. package/build/cjs/cloudflare/index.js +2 -15
  14. package/build/cjs/cloudflare/index.js.map +1 -1
  15. package/build/cjs/common/debug-build.js +0 -5
  16. package/build/cjs/common/debug-build.js.map +1 -1
  17. package/build/cjs/common/utils.js +8 -33
  18. package/build/cjs/common/utils.js.map +1 -1
  19. package/build/cjs/server/createSentryHandleError.js +4 -13
  20. package/build/cjs/server/createSentryHandleError.js.map +1 -1
  21. package/build/cjs/server/createSentryHandleRequest.js +14 -49
  22. package/build/cjs/server/createSentryHandleRequest.js.map +1 -1
  23. package/build/cjs/server/createServerInstrumentation.js +76 -114
  24. package/build/cjs/server/createServerInstrumentation.js.map +1 -1
  25. package/build/cjs/server/getMetaTagTransformer.js +2 -8
  26. package/build/cjs/server/getMetaTagTransformer.js.map +1 -1
  27. package/build/cjs/server/instrumentation/reactRouter.js +21 -47
  28. package/build/cjs/server/instrumentation/reactRouter.js.map +1 -1
  29. package/build/cjs/server/instrumentation/util.js +5 -41
  30. package/build/cjs/server/instrumentation/util.js.map +1 -1
  31. package/build/cjs/server/integration/lowQualityTransactionsFilterIntegration.js +5 -12
  32. package/build/cjs/server/integration/lowQualityTransactionsFilterIntegration.js.map +1 -1
  33. package/build/cjs/server/integration/reactRouterServer.js +10 -42
  34. package/build/cjs/server/integration/reactRouterServer.js.map +1 -1
  35. package/build/cjs/server/sdk.js +6 -20
  36. package/build/cjs/server/sdk.js.map +1 -1
  37. package/build/cjs/server/serverBuild.js +6 -31
  38. package/build/cjs/server/serverBuild.js.map +1 -1
  39. package/build/cjs/server/serverGlobals.js +6 -26
  40. package/build/cjs/server/serverGlobals.js.map +1 -1
  41. package/build/cjs/server/wrapSentryHandleRequest.js +13 -53
  42. package/build/cjs/server/wrapSentryHandleRequest.js.map +1 -1
  43. package/build/cjs/server/wrapServerAction.js +12 -44
  44. package/build/cjs/server/wrapServerAction.js.map +1 -1
  45. package/build/cjs/server/wrapServerLoader.js +12 -44
  46. package/build/cjs/server/wrapServerLoader.js.map +1 -1
  47. package/build/cjs/vite/buildEnd/handleOnBuildEnd.js +38 -72
  48. package/build/cjs/vite/buildEnd/handleOnBuildEnd.js.map +1 -1
  49. package/build/cjs/vite/makeConfigInjectorPlugin.js +4 -12
  50. package/build/cjs/vite/makeConfigInjectorPlugin.js.map +1 -1
  51. package/build/cjs/vite/makeCustomSentryVitePlugins.js +10 -15
  52. package/build/cjs/vite/makeCustomSentryVitePlugins.js.map +1 -1
  53. package/build/cjs/vite/makeEnableSourceMapsPlugin.js +19 -51
  54. package/build/cjs/vite/makeEnableSourceMapsPlugin.js.map +1 -1
  55. package/build/cjs/vite/makeServerBuildCapturePlugin.js +4 -15
  56. package/build/cjs/vite/makeServerBuildCapturePlugin.js.map +1 -1
  57. package/build/cjs/vite/plugin.js +3 -16
  58. package/build/cjs/vite/plugin.js.map +1 -1
  59. package/build/esm/client/createClientInstrumentation.js +104 -175
  60. package/build/esm/client/createClientInstrumentation.js.map +1 -1
  61. package/build/esm/client/hydratedRouter.js +27 -74
  62. package/build/esm/client/hydratedRouter.js.map +1 -1
  63. package/build/esm/client/sdk.js +5 -16
  64. package/build/esm/client/sdk.js.map +1 -1
  65. package/build/esm/client/sentryOnError.js +4 -27
  66. package/build/esm/client/sentryOnError.js.map +1 -1
  67. package/build/esm/client/tracingIntegration.js +4 -18
  68. package/build/esm/client/tracingIntegration.js.map +1 -1
  69. package/build/esm/client/utils.js +5 -17
  70. package/build/esm/client/utils.js.map +1 -1
  71. package/build/esm/cloudflare/index.js +2 -15
  72. package/build/esm/cloudflare/index.js.map +1 -1
  73. package/build/esm/common/debug-build.js +0 -5
  74. package/build/esm/common/debug-build.js.map +1 -1
  75. package/build/esm/common/utils.js +8 -33
  76. package/build/esm/common/utils.js.map +1 -1
  77. package/build/esm/package.json +1 -1
  78. package/build/esm/server/createSentryHandleError.js +4 -13
  79. package/build/esm/server/createSentryHandleError.js.map +1 -1
  80. package/build/esm/server/createSentryHandleRequest.js +14 -49
  81. package/build/esm/server/createSentryHandleRequest.js.map +1 -1
  82. package/build/esm/server/createServerInstrumentation.js +76 -114
  83. package/build/esm/server/createServerInstrumentation.js.map +1 -1
  84. package/build/esm/server/getMetaTagTransformer.js +2 -8
  85. package/build/esm/server/getMetaTagTransformer.js.map +1 -1
  86. package/build/esm/server/instrumentation/reactRouter.js +21 -47
  87. package/build/esm/server/instrumentation/reactRouter.js.map +1 -1
  88. package/build/esm/server/instrumentation/util.js +5 -41
  89. package/build/esm/server/instrumentation/util.js.map +1 -1
  90. package/build/esm/server/integration/lowQualityTransactionsFilterIntegration.js +5 -12
  91. package/build/esm/server/integration/lowQualityTransactionsFilterIntegration.js.map +1 -1
  92. package/build/esm/server/integration/reactRouterServer.js +10 -42
  93. package/build/esm/server/integration/reactRouterServer.js.map +1 -1
  94. package/build/esm/server/sdk.js +6 -20
  95. package/build/esm/server/sdk.js.map +1 -1
  96. package/build/esm/server/serverBuild.js +6 -31
  97. package/build/esm/server/serverBuild.js.map +1 -1
  98. package/build/esm/server/serverGlobals.js +6 -26
  99. package/build/esm/server/serverGlobals.js.map +1 -1
  100. package/build/esm/server/wrapSentryHandleRequest.js +13 -53
  101. package/build/esm/server/wrapSentryHandleRequest.js.map +1 -1
  102. package/build/esm/server/wrapServerAction.js +12 -44
  103. package/build/esm/server/wrapServerAction.js.map +1 -1
  104. package/build/esm/server/wrapServerLoader.js +12 -44
  105. package/build/esm/server/wrapServerLoader.js.map +1 -1
  106. package/build/esm/vite/buildEnd/handleOnBuildEnd.js +38 -72
  107. package/build/esm/vite/buildEnd/handleOnBuildEnd.js.map +1 -1
  108. package/build/esm/vite/makeConfigInjectorPlugin.js +4 -12
  109. package/build/esm/vite/makeConfigInjectorPlugin.js.map +1 -1
  110. package/build/esm/vite/makeCustomSentryVitePlugins.js +10 -15
  111. package/build/esm/vite/makeCustomSentryVitePlugins.js.map +1 -1
  112. package/build/esm/vite/makeEnableSourceMapsPlugin.js +19 -51
  113. package/build/esm/vite/makeEnableSourceMapsPlugin.js.map +1 -1
  114. package/build/esm/vite/makeServerBuildCapturePlugin.js +4 -15
  115. package/build/esm/vite/makeServerBuildCapturePlugin.js.map +1 -1
  116. package/build/esm/vite/plugin.js +3 -16
  117. package/build/esm/vite/plugin.js.map +1 -1
  118. package/build/types/client/hydratedRouter.d.ts.map +1 -1
  119. package/package.json +5 -5
@@ -5,144 +5,110 @@ const SentryCli = require('@sentry/cli');
5
5
  const glob = require('glob');
6
6
 
7
7
  function getSentryConfig(viteConfig) {
8
- if (!viteConfig || typeof viteConfig !== 'object' || !('sentryConfig' in viteConfig)) {
9
- // eslint-disable-next-line no-console
10
- console.error('[Sentry] sentryConfig not found - it needs to be passed to vite.config.ts');
8
+ if (!viteConfig || typeof viteConfig !== "object" || !("sentryConfig" in viteConfig)) {
9
+ console.error("[Sentry] sentryConfig not found - it needs to be passed to vite.config.ts");
11
10
  }
12
-
13
- return (viteConfig ).sentryConfig;
11
+ return viteConfig.sentryConfig;
14
12
  }
15
-
16
- /**
17
- * A build end hook that handles Sentry release creation and source map uploads.
18
- * It creates a new Sentry release if configured, uploads source maps to Sentry,
19
- * and optionally deletes the source map files after upload.
20
- */
21
13
  const sentryOnBuildEnd = async ({ reactRouterConfig, viteConfig }) => {
22
14
  const sentryConfig = getSentryConfig(viteConfig);
23
-
24
- // todo(v11): Remove deprecated sourceMapsUploadOptions support (no need for spread/pick anymore)
25
15
  const {
26
- sourceMapsUploadOptions, // extract to exclude from rest config
16
+ sourceMapsUploadOptions,
17
+ // extract to exclude from rest config
27
18
  ...sentryConfigWithoutDeprecatedSourceMapOption
28
19
  } = sentryConfig;
29
-
30
20
  const unstableSentryVitePluginOptions = sentryConfig.unstable_sentryVitePluginOptions;
31
-
32
21
  const {
33
22
  authToken,
34
23
  org,
35
24
  project,
36
25
  release,
37
26
  sourcemaps = { disable: false },
38
- debug = false,
39
- }
40
-
41
- = {
27
+ debug = false
28
+ } = {
42
29
  ...unstableSentryVitePluginOptions,
43
- ...sentryConfigWithoutDeprecatedSourceMapOption, // spread in the config without the deprecated sourceMapsUploadOptions
30
+ ...sentryConfigWithoutDeprecatedSourceMapOption,
31
+ // spread in the config without the deprecated sourceMapsUploadOptions
44
32
  sourcemaps: {
45
33
  ...unstableSentryVitePluginOptions?.sourcemaps,
46
34
  ...sentryConfig.sourcemaps,
47
35
  ...sourceMapsUploadOptions,
48
36
  // eslint-disable-next-line deprecation/deprecation
49
- disable: sourceMapsUploadOptions?.enabled === false ? true : sentryConfig.sourcemaps?.disable,
37
+ disable: sourceMapsUploadOptions?.enabled === false ? true : sentryConfig.sourcemaps?.disable
50
38
  },
51
39
  release: {
52
40
  ...unstableSentryVitePluginOptions?.release,
53
- ...sentryConfig.release,
41
+ ...sentryConfig.release
54
42
  },
55
- project: unstableSentryVitePluginOptions?.project
56
- ? Array.isArray(unstableSentryVitePluginOptions?.project)
57
- ? unstableSentryVitePluginOptions?.project[0]
58
- : unstableSentryVitePluginOptions?.project
59
- : sentryConfigWithoutDeprecatedSourceMapOption.project,
43
+ project: unstableSentryVitePluginOptions?.project ? Array.isArray(unstableSentryVitePluginOptions?.project) ? unstableSentryVitePluginOptions?.project[0] : unstableSentryVitePluginOptions?.project : sentryConfigWithoutDeprecatedSourceMapOption.project
60
44
  };
61
-
62
45
  const cliInstance = new SentryCli.default(null, {
63
46
  authToken,
64
47
  org,
65
48
  ...sentryConfig.unstable_sentryVitePluginOptions,
66
49
  // same handling as in bundler plugins: https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/05084f214c763a05137d863ff5a05ef38254f68d/packages/bundler-plugin-core/src/build-plugin-manager.ts#L102-L103
67
- project: Array.isArray(project) ? project[0] : project,
50
+ project: Array.isArray(project) ? project[0] : project
68
51
  });
69
-
70
- // check if release should be created
71
52
  if (release?.name) {
72
53
  try {
73
54
  await cliInstance.releases.new(release.name);
74
55
  } catch (error) {
75
- // eslint-disable-next-line no-console
76
- console.error('[Sentry] Could not create release', error);
56
+ console.error("[Sentry] Could not create release", error);
77
57
  }
78
58
  }
79
-
80
59
  if (!sourcemaps?.disable && viteConfig.build.sourcemap !== false) {
81
- // inject debugIds
82
60
  try {
83
61
  await cliInstance.execute(
84
- ['sourcemaps', 'inject', reactRouterConfig.buildDirectory],
85
- debug ? 'rejectOnError' : false,
62
+ ["sourcemaps", "inject", reactRouterConfig.buildDirectory],
63
+ debug ? "rejectOnError" : false
86
64
  );
87
65
  } catch (error) {
88
- // eslint-disable-next-line no-console
89
- console.error('[Sentry] Could not inject debug ids', error);
66
+ console.error("[Sentry] Could not inject debug ids", error);
90
67
  }
91
-
92
- // upload sourcemaps
93
68
  try {
94
- await cliInstance.releases.uploadSourceMaps(release?.name || 'undefined', {
69
+ await cliInstance.releases.uploadSourceMaps(release?.name || "undefined", {
95
70
  include: [
96
71
  {
97
- paths: [reactRouterConfig.buildDirectory],
98
- },
72
+ paths: [reactRouterConfig.buildDirectory]
73
+ }
99
74
  ],
100
- live: 'rejectOnError',
75
+ live: "rejectOnError"
101
76
  });
102
77
  } catch (error) {
103
- // eslint-disable-next-line no-console
104
- console.error('[Sentry] Could not upload sourcemaps', error);
78
+ console.error("[Sentry] Could not upload sourcemaps", error);
105
79
  }
106
80
  }
107
- // delete sourcemaps after upload
108
81
  let updatedFilesToDeleteAfterUpload = await sourcemaps?.filesToDeleteAfterUpload;
109
-
110
- // set a default value no option was set
111
- if (typeof updatedFilesToDeleteAfterUpload === 'undefined') {
82
+ if (typeof updatedFilesToDeleteAfterUpload === "undefined") {
112
83
  updatedFilesToDeleteAfterUpload = [`${reactRouterConfig.buildDirectory}/**/*.map`];
113
- debug &&
114
- // eslint-disable-next-line no-console
115
- console.info(
116
- `[Sentry] Automatically setting \`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(
117
- updatedFilesToDeleteAfterUpload,
118
- )}\` to delete generated source maps after they were uploaded to Sentry.`,
119
- );
84
+ debug && // eslint-disable-next-line no-console
85
+ console.info(
86
+ `[Sentry] Automatically setting \`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(
87
+ updatedFilesToDeleteAfterUpload
88
+ )}\` to delete generated source maps after they were uploaded to Sentry.`
89
+ );
120
90
  }
121
91
  if (updatedFilesToDeleteAfterUpload) {
122
92
  try {
123
93
  const filePathsToDelete = await glob.glob(updatedFilesToDeleteAfterUpload, {
124
94
  absolute: true,
125
- nodir: true,
95
+ nodir: true
126
96
  });
127
97
  if (debug) {
128
- filePathsToDelete.forEach(filePathToDelete => {
129
- // eslint-disable-next-line no-console
98
+ filePathsToDelete.forEach((filePathToDelete) => {
130
99
  console.info(`Deleting asset after upload: ${filePathToDelete}`);
131
100
  });
132
101
  }
133
102
  await Promise.all(
134
- filePathsToDelete.map(filePathToDelete =>
135
- promises.rm(filePathToDelete, { force: true }).catch((e) => {
136
- // This is allowed to fail - we just don't do anything
137
- debug &&
138
- // eslint-disable-next-line no-console
139
- console.debug(`An error occurred while attempting to delete asset: ${filePathToDelete}`, e);
140
- }),
141
- ),
103
+ filePathsToDelete.map(
104
+ (filePathToDelete) => promises.rm(filePathToDelete, { force: true }).catch((e) => {
105
+ debug && // eslint-disable-next-line no-console
106
+ console.debug(`An error occurred while attempting to delete asset: ${filePathToDelete}`, e);
107
+ })
108
+ )
142
109
  );
143
110
  } catch (error) {
144
- // eslint-disable-next-line no-console
145
- console.error('Error deleting files after sourcemap upload:', error);
111
+ console.error("Error deleting files after sourcemap upload:", error);
146
112
  }
147
113
  }
148
114
  };
@@ -1 +1 @@
1
- {"version":3,"file":"handleOnBuildEnd.js","sources":["../../../../src/vite/buildEnd/handleOnBuildEnd.ts"],"sourcesContent":["import { rm } from 'node:fs/promises';\nimport type { Config } from '@react-router/dev/config';\nimport SentryCli from '@sentry/cli';\nimport type { SentryVitePluginOptions } from '@sentry/vite-plugin';\nimport { glob } from 'glob';\nimport type { SentryReactRouterBuildOptions } from '../types';\n\ntype BuildEndHook = NonNullable<Config['buildEnd']>;\n\nfunction getSentryConfig(viteConfig: unknown): SentryReactRouterBuildOptions {\n if (!viteConfig || typeof viteConfig !== 'object' || !('sentryConfig' in viteConfig)) {\n // eslint-disable-next-line no-console\n console.error('[Sentry] sentryConfig not found - it needs to be passed to vite.config.ts');\n }\n\n return (viteConfig as { sentryConfig: SentryReactRouterBuildOptions }).sentryConfig;\n}\n\n/**\n * A build end hook that handles Sentry release creation and source map uploads.\n * It creates a new Sentry release if configured, uploads source maps to Sentry,\n * and optionally deletes the source map files after upload.\n */\nexport const sentryOnBuildEnd: BuildEndHook = async ({ reactRouterConfig, viteConfig }) => {\n const sentryConfig = getSentryConfig(viteConfig);\n\n // todo(v11): Remove deprecated sourceMapsUploadOptions support (no need for spread/pick anymore)\n const {\n sourceMapsUploadOptions, // extract to exclude from rest config\n ...sentryConfigWithoutDeprecatedSourceMapOption\n } = sentryConfig;\n\n const unstableSentryVitePluginOptions = sentryConfig.unstable_sentryVitePluginOptions;\n\n const {\n authToken,\n org,\n project,\n release,\n sourcemaps = { disable: false },\n debug = false,\n }: Omit<SentryReactRouterBuildOptions, 'sourcemaps' | 'sourceMapsUploadOptions'> &\n // Pick 'sourcemaps' from Vite plugin options as the types allow more (e.g. Promise values for `deleteFilesAfterUpload`)\n Pick<SentryVitePluginOptions, 'sourcemaps'> = {\n ...unstableSentryVitePluginOptions,\n ...sentryConfigWithoutDeprecatedSourceMapOption, // spread in the config without the deprecated sourceMapsUploadOptions\n sourcemaps: {\n ...unstableSentryVitePluginOptions?.sourcemaps,\n ...sentryConfig.sourcemaps,\n ...sourceMapsUploadOptions,\n // eslint-disable-next-line deprecation/deprecation\n disable: sourceMapsUploadOptions?.enabled === false ? true : sentryConfig.sourcemaps?.disable,\n },\n release: {\n ...unstableSentryVitePluginOptions?.release,\n ...sentryConfig.release,\n },\n project: unstableSentryVitePluginOptions?.project\n ? Array.isArray(unstableSentryVitePluginOptions?.project)\n ? unstableSentryVitePluginOptions?.project[0]\n : unstableSentryVitePluginOptions?.project\n : sentryConfigWithoutDeprecatedSourceMapOption.project,\n };\n\n const cliInstance = new SentryCli(null, {\n authToken,\n org,\n ...sentryConfig.unstable_sentryVitePluginOptions,\n // same handling as in bundler plugins: https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/05084f214c763a05137d863ff5a05ef38254f68d/packages/bundler-plugin-core/src/build-plugin-manager.ts#L102-L103\n project: Array.isArray(project) ? project[0] : project,\n });\n\n // check if release should be created\n if (release?.name) {\n try {\n await cliInstance.releases.new(release.name);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('[Sentry] Could not create release', error);\n }\n }\n\n if (!sourcemaps?.disable && viteConfig.build.sourcemap !== false) {\n // inject debugIds\n try {\n await cliInstance.execute(\n ['sourcemaps', 'inject', reactRouterConfig.buildDirectory],\n debug ? 'rejectOnError' : false,\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('[Sentry] Could not inject debug ids', error);\n }\n\n // upload sourcemaps\n try {\n await cliInstance.releases.uploadSourceMaps(release?.name || 'undefined', {\n include: [\n {\n paths: [reactRouterConfig.buildDirectory],\n },\n ],\n live: 'rejectOnError',\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('[Sentry] Could not upload sourcemaps', error);\n }\n }\n // delete sourcemaps after upload\n let updatedFilesToDeleteAfterUpload = await sourcemaps?.filesToDeleteAfterUpload;\n\n // set a default value no option was set\n if (typeof updatedFilesToDeleteAfterUpload === 'undefined') {\n updatedFilesToDeleteAfterUpload = [`${reactRouterConfig.buildDirectory}/**/*.map`];\n debug &&\n // eslint-disable-next-line no-console\n console.info(\n `[Sentry] Automatically setting \\`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(\n updatedFilesToDeleteAfterUpload,\n )}\\` to delete generated source maps after they were uploaded to Sentry.`,\n );\n }\n if (updatedFilesToDeleteAfterUpload) {\n try {\n const filePathsToDelete = await glob(updatedFilesToDeleteAfterUpload, {\n absolute: true,\n nodir: true,\n });\n if (debug) {\n filePathsToDelete.forEach(filePathToDelete => {\n // eslint-disable-next-line no-console\n console.info(`Deleting asset after upload: ${filePathToDelete}`);\n });\n }\n await Promise.all(\n filePathsToDelete.map(filePathToDelete =>\n rm(filePathToDelete, { force: true }).catch((e: unknown) => {\n // This is allowed to fail - we just don't do anything\n debug &&\n // eslint-disable-next-line no-console\n console.debug(`An error occurred while attempting to delete asset: ${filePathToDelete}`, e);\n }),\n ),\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error deleting files after sourcemap upload:', error);\n }\n }\n};\n"],"names":["SentryCli","glob","rm"],"mappings":";;;;;;AASA,SAAS,eAAe,CAAC,UAAU,EAA0C;AAC7E,EAAE,IAAI,CAAC,UAAA,IAAc,OAAO,UAAA,KAAe,QAAA,IAAY,EAAE,cAAA,IAAkB,UAAU,CAAC,EAAE;AACxF;AACA,IAAI,OAAO,CAAC,KAAK,CAAC,2EAA2E,CAAC;AAC9F,EAAE;;AAEF,EAAE,OAAO,CAAC,UAAA,GAA+D,YAAY;AACrF;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,gBAAgB,GAAiB,OAAO,EAAE,iBAAiB,EAAE,UAAA,EAAY,KAAK;AAC3F,EAAE,MAAM,YAAA,GAAe,eAAe,CAAC,UAAU,CAAC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C,EAAA,iBAAA,CAAA,cAAA,CAAA,SAAA,CAAA,CAAA;AACA,IAAA,KAAA;AACA;AACA,MAAA,OAAA,CAAA,IAAA;AACA,QAAA,CAAA,mFAAA,EAAA,IAAA,CAAA,SAAA;AACA,UAAA,+BAAA;AACA,SAAA,CAAA,sEAAA,CAAA;AACA,OAAA;AACA,EAAA;AACA,EAAA,IAAA,+BAAA,EAAA;AACA,IAAA,IAAA;AACA,MAAA,MAAA,iBAAA,GAAA,MAAAC,SAAA,CAAA,+BAAA,EAAA;AACA,QAAA,QAAA,EAAA,IAAA;AACA,QAAA,KAAA,EAAA,IAAA;AACA,OAAA,CAAA;AACA,MAAA,IAAA,KAAA,EAAA;AACA,QAAA,iBAAA,CAAA,OAAA,CAAA,gBAAA,IAAA;AACA;AACA,UAAA,OAAA,CAAA,IAAA,CAAA,CAAA,6BAAA,EAAA,gBAAA,CAAA,CAAA,CAAA;AACA,QAAA,CAAA,CAAA;AACA,MAAA;AACA,MAAA,MAAA,OAAA,CAAA,GAAA;AACA,QAAA,iBAAA,CAAA,GAAA,CAAA,gBAAA;AACA,UAAAC,WAAA,CAAA,gBAAA,EAAA,EAAA,KAAA,EAAA,IAAA,EAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,KAAA;AACA;AACA,YAAA,KAAA;AACA;AACA,cAAA,OAAA,CAAA,KAAA,CAAA,CAAA,oDAAA,EAAA,gBAAA,CAAA,CAAA,EAAA,CAAA,CAAA;AACA,UAAA,CAAA,CAAA;AACA,SAAA;AACA,OAAA;AACA,IAAA,CAAA,CAAA,OAAA,KAAA,EAAA;AACA;AACA,MAAA,OAAA,CAAA,KAAA,CAAA,8CAAA,EAAA,KAAA,CAAA;AACA,IAAA;AACA,EAAA;AACA;;;;"}
1
+ {"version":3,"file":"handleOnBuildEnd.js","sources":["../../../../src/vite/buildEnd/handleOnBuildEnd.ts"],"sourcesContent":["import { rm } from 'node:fs/promises';\nimport type { Config } from '@react-router/dev/config';\nimport SentryCli from '@sentry/cli';\nimport type { SentryVitePluginOptions } from '@sentry/vite-plugin';\nimport { glob } from 'glob';\nimport type { SentryReactRouterBuildOptions } from '../types';\n\ntype BuildEndHook = NonNullable<Config['buildEnd']>;\n\nfunction getSentryConfig(viteConfig: unknown): SentryReactRouterBuildOptions {\n if (!viteConfig || typeof viteConfig !== 'object' || !('sentryConfig' in viteConfig)) {\n // eslint-disable-next-line no-console\n console.error('[Sentry] sentryConfig not found - it needs to be passed to vite.config.ts');\n }\n\n return (viteConfig as { sentryConfig: SentryReactRouterBuildOptions }).sentryConfig;\n}\n\n/**\n * A build end hook that handles Sentry release creation and source map uploads.\n * It creates a new Sentry release if configured, uploads source maps to Sentry,\n * and optionally deletes the source map files after upload.\n */\nexport const sentryOnBuildEnd: BuildEndHook = async ({ reactRouterConfig, viteConfig }) => {\n const sentryConfig = getSentryConfig(viteConfig);\n\n // todo(v11): Remove deprecated sourceMapsUploadOptions support (no need for spread/pick anymore)\n const {\n sourceMapsUploadOptions, // extract to exclude from rest config\n ...sentryConfigWithoutDeprecatedSourceMapOption\n } = sentryConfig;\n\n const unstableSentryVitePluginOptions = sentryConfig.unstable_sentryVitePluginOptions;\n\n const {\n authToken,\n org,\n project,\n release,\n sourcemaps = { disable: false },\n debug = false,\n }: Omit<SentryReactRouterBuildOptions, 'sourcemaps' | 'sourceMapsUploadOptions'> &\n // Pick 'sourcemaps' from Vite plugin options as the types allow more (e.g. Promise values for `deleteFilesAfterUpload`)\n Pick<SentryVitePluginOptions, 'sourcemaps'> = {\n ...unstableSentryVitePluginOptions,\n ...sentryConfigWithoutDeprecatedSourceMapOption, // spread in the config without the deprecated sourceMapsUploadOptions\n sourcemaps: {\n ...unstableSentryVitePluginOptions?.sourcemaps,\n ...sentryConfig.sourcemaps,\n ...sourceMapsUploadOptions,\n // eslint-disable-next-line deprecation/deprecation\n disable: sourceMapsUploadOptions?.enabled === false ? true : sentryConfig.sourcemaps?.disable,\n },\n release: {\n ...unstableSentryVitePluginOptions?.release,\n ...sentryConfig.release,\n },\n project: unstableSentryVitePluginOptions?.project\n ? Array.isArray(unstableSentryVitePluginOptions?.project)\n ? unstableSentryVitePluginOptions?.project[0]\n : unstableSentryVitePluginOptions?.project\n : sentryConfigWithoutDeprecatedSourceMapOption.project,\n };\n\n const cliInstance = new SentryCli(null, {\n authToken,\n org,\n ...sentryConfig.unstable_sentryVitePluginOptions,\n // same handling as in bundler plugins: https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/05084f214c763a05137d863ff5a05ef38254f68d/packages/bundler-plugin-core/src/build-plugin-manager.ts#L102-L103\n project: Array.isArray(project) ? project[0] : project,\n });\n\n // check if release should be created\n if (release?.name) {\n try {\n await cliInstance.releases.new(release.name);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('[Sentry] Could not create release', error);\n }\n }\n\n if (!sourcemaps?.disable && viteConfig.build.sourcemap !== false) {\n // inject debugIds\n try {\n await cliInstance.execute(\n ['sourcemaps', 'inject', reactRouterConfig.buildDirectory],\n debug ? 'rejectOnError' : false,\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('[Sentry] Could not inject debug ids', error);\n }\n\n // upload sourcemaps\n try {\n await cliInstance.releases.uploadSourceMaps(release?.name || 'undefined', {\n include: [\n {\n paths: [reactRouterConfig.buildDirectory],\n },\n ],\n live: 'rejectOnError',\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('[Sentry] Could not upload sourcemaps', error);\n }\n }\n // delete sourcemaps after upload\n let updatedFilesToDeleteAfterUpload = await sourcemaps?.filesToDeleteAfterUpload;\n\n // set a default value no option was set\n if (typeof updatedFilesToDeleteAfterUpload === 'undefined') {\n updatedFilesToDeleteAfterUpload = [`${reactRouterConfig.buildDirectory}/**/*.map`];\n debug &&\n // eslint-disable-next-line no-console\n console.info(\n `[Sentry] Automatically setting \\`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(\n updatedFilesToDeleteAfterUpload,\n )}\\` to delete generated source maps after they were uploaded to Sentry.`,\n );\n }\n if (updatedFilesToDeleteAfterUpload) {\n try {\n const filePathsToDelete = await glob(updatedFilesToDeleteAfterUpload, {\n absolute: true,\n nodir: true,\n });\n if (debug) {\n filePathsToDelete.forEach(filePathToDelete => {\n // eslint-disable-next-line no-console\n console.info(`Deleting asset after upload: ${filePathToDelete}`);\n });\n }\n await Promise.all(\n filePathsToDelete.map(filePathToDelete =>\n rm(filePathToDelete, { force: true }).catch((e: unknown) => {\n // This is allowed to fail - we just don't do anything\n debug &&\n // eslint-disable-next-line no-console\n console.debug(`An error occurred while attempting to delete asset: ${filePathToDelete}`, e);\n }),\n ),\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error deleting files after sourcemap upload:', error);\n }\n }\n};\n"],"names":["SentryCli","glob","rm"],"mappings":";;;;;;AASA,SAAS,gBAAgB,UAAA,EAAoD;AAC3E,EAAA,IAAI,CAAC,UAAA,IAAc,OAAO,eAAe,QAAA,IAAY,EAAE,kBAAkB,UAAA,CAAA,EAAa;AAEpF,IAAA,OAAA,CAAQ,MAAM,2EAA2E,CAAA;AAAA,EAC3F;AAEA,EAAA,OAAQ,UAAA,CAA+D,YAAA;AACzE;AAOO,MAAM,gBAAA,GAAiC,OAAO,EAAE,iBAAA,EAAmB,YAAW,KAAM;AACzF,EAAA,MAAM,YAAA,GAAe,gBAAgB,UAAU,CAAA;AAG/C,EAAA,MAAM;AAAA,IACJ,uBAAA;AAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,YAAA;AAEJ,EAAA,MAAM,kCAAkC,YAAA,CAAa,gCAAA;AAErD,EAAA,MAAM;AAAA,IACJ,SAAA;AAAA,IACA,GAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA,GAAa,EAAE,OAAA,EAAS,KAAA,EAAM;AAAA,IAC9B,KAAA,GAAQ;AAAA,GACV,GAEgD;AAAA,IAC9C,GAAG,+BAAA;AAAA,IACH,GAAG,4CAAA;AAAA;AAAA,IACH,U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AM,OAAA,CAAQ,GAAA;AAAA,QACZ,iBAAA,CAAkB,GAAA;AAAA,UAAI,CAAA,gBAAA,KACpBC,WAAA,CAAG,gBAAA,EAAkB,EAAE,KAAA,EAAO,MAAM,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA,KAAe;AAE1D,YAAA,KAAA;AAAA,YAEE,OAAA,CAAQ,KAAA,CAAM,CAAA,oDAAA,EAAuD,gBAAgB,IAAI,CAAC,CAAA;AAAA,UAC9F,CAAC;AAAA;AACH,OACF;AAAA,IACF,SAAS,KAAA,EAAO;AAEd,MAAA,OAAA,CAAQ,KAAA,CAAM,gDAAgD,KAAK,CAAA;AAAA,IACrE;AAAA,EACF;AACF;;;;"}
@@ -1,23 +1,15 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- /**
4
- * Creates a Vite plugin that injects the Sentry options into the global Vite config.
5
- * This ensures the sentryConfig is available to other components that need access to it,
6
- * like the buildEnd hook.
7
- *
8
- * @param options - Configuration options for the Sentry Vite plugin
9
- * @returns A Vite plugin that injects sentryConfig into the global config
10
- */
11
3
  function makeConfigInjectorPlugin(options) {
12
4
  return {
13
- name: 'sentry-react-router-config-injector',
14
- enforce: 'pre',
5
+ name: "sentry-react-router-config-injector",
6
+ enforce: "pre",
15
7
  config(config) {
16
8
  return {
17
9
  ...config,
18
- sentryConfig: options,
10
+ sentryConfig: options
19
11
  };
20
- },
12
+ }
21
13
  };
22
14
  }
23
15
 
@@ -1 +1 @@
1
- {"version":3,"file":"makeConfigInjectorPlugin.js","sources":["../../../src/vite/makeConfigInjectorPlugin.ts"],"sourcesContent":["import { type Plugin } from 'vite';\nimport type { SentryReactRouterBuildOptions } from './types';\n\n/**\n * Creates a Vite plugin that injects the Sentry options into the global Vite config.\n * This ensures the sentryConfig is available to other components that need access to it,\n * like the buildEnd hook.\n *\n * @param options - Configuration options for the Sentry Vite plugin\n * @returns A Vite plugin that injects sentryConfig into the global config\n */\nexport function makeConfigInjectorPlugin(options: SentryReactRouterBuildOptions): Plugin {\n return {\n name: 'sentry-react-router-config-injector',\n enforce: 'pre',\n config(config) {\n return {\n ...config,\n sentryConfig: options,\n };\n },\n };\n}\n"],"names":[],"mappings":";;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,CAAC,OAAO,EAAyC;AACzF,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,qCAAqC;AAC/C,IAAI,OAAO,EAAE,KAAK;AAClB,IAAI,MAAM,CAAC,MAAM,EAAE;AACnB,MAAM,OAAO;AACb,QAAQ,GAAG,MAAM;AACjB,QAAQ,YAAY,EAAE,OAAO;AAC7B,OAAO;AACP,IAAI,CAAC;AACL,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"makeConfigInjectorPlugin.js","sources":["../../../src/vite/makeConfigInjectorPlugin.ts"],"sourcesContent":["import { type Plugin } from 'vite';\nimport type { SentryReactRouterBuildOptions } from './types';\n\n/**\n * Creates a Vite plugin that injects the Sentry options into the global Vite config.\n * This ensures the sentryConfig is available to other components that need access to it,\n * like the buildEnd hook.\n *\n * @param options - Configuration options for the Sentry Vite plugin\n * @returns A Vite plugin that injects sentryConfig into the global config\n */\nexport function makeConfigInjectorPlugin(options: SentryReactRouterBuildOptions): Plugin {\n return {\n name: 'sentry-react-router-config-injector',\n enforce: 'pre',\n config(config) {\n return {\n ...config,\n sentryConfig: options,\n };\n },\n };\n}\n"],"names":[],"mappings":";;AAWO,SAAS,yBAAyB,OAAA,EAAgD;AACvF,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,qCAAA;AAAA,IACN,OAAA,EAAS,KAAA;AAAA,IACT,OAAO,MAAA,EAAQ;AACb,MAAA,OAAO;AAAA,QACL,GAAG,MAAA;AAAA,QACH,YAAA,EAAc;AAAA,OAChB;AAAA,IACF;AAAA,GACF;AACF;;;;"}
@@ -2,9 +2,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const vitePlugin = require('@sentry/vite-plugin');
4
4
 
5
- /**
6
- * Create a custom subset of sentry's vite plugins
7
- */
8
5
  async function makeCustomSentryVitePlugins(options) {
9
6
  const {
10
7
  debug,
@@ -16,9 +13,8 @@ async function makeCustomSentryVitePlugins(options) {
16
13
  project,
17
14
  telemetry,
18
15
  reactComponentAnnotation,
19
- release,
16
+ release
20
17
  } = options;
21
-
22
18
  const sentryVitePlugins = vitePlugin.sentryVitePlugin({
23
19
  applicationKey,
24
20
  authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,
@@ -29,27 +25,26 @@ async function makeCustomSentryVitePlugins(options) {
29
25
  telemetry: telemetry ?? true,
30
26
  _metaOptions: {
31
27
  telemetry: {
32
- metaFramework: 'react-router',
28
+ metaFramework: "react-router"
33
29
  },
34
- ...unstable_sentryVitePluginOptions?._metaOptions,
30
+ ...unstable_sentryVitePluginOptions?._metaOptions
35
31
  },
36
32
  reactComponentAnnotation: {
37
- enabled: reactComponentAnnotation?.enabled ?? undefined,
38
- ignoredComponents: reactComponentAnnotation?.ignoredComponents ?? undefined,
39
- ...unstable_sentryVitePluginOptions?.reactComponentAnnotation,
33
+ enabled: reactComponentAnnotation?.enabled ?? void 0,
34
+ ignoredComponents: reactComponentAnnotation?.ignoredComponents ?? void 0,
35
+ ...unstable_sentryVitePluginOptions?.reactComponentAnnotation
40
36
  },
41
37
  release: {
42
38
  ...unstable_sentryVitePluginOptions?.release,
43
- ...release,
39
+ ...release
44
40
  },
45
41
  // will be handled in buildEnd hook
46
42
  sourcemaps: {
47
43
  disable: true,
48
- ...unstable_sentryVitePluginOptions?.sourcemaps,
44
+ ...unstable_sentryVitePluginOptions?.sourcemaps
49
45
  },
50
- ...unstable_sentryVitePluginOptions,
51
- }) ;
52
-
46
+ ...unstable_sentryVitePluginOptions
47
+ });
53
48
  return sentryVitePlugins;
54
49
  }
55
50
 
@@ -1 +1 @@
1
- {"version":3,"file":"makeCustomSentryVitePlugins.js","sources":["../../../src/vite/makeCustomSentryVitePlugins.ts"],"sourcesContent":["import { sentryVitePlugin } from '@sentry/vite-plugin';\nimport { type Plugin } from 'vite';\nimport type { SentryReactRouterBuildOptions } from './types';\n\n/**\n * Create a custom subset of sentry's vite plugins\n */\nexport async function makeCustomSentryVitePlugins(options: SentryReactRouterBuildOptions): Promise<Plugin[]> {\n const {\n debug,\n unstable_sentryVitePluginOptions,\n bundleSizeOptimizations,\n applicationKey,\n authToken,\n org,\n project,\n telemetry,\n reactComponentAnnotation,\n release,\n } = options;\n\n const sentryVitePlugins = sentryVitePlugin({\n applicationKey,\n authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,\n bundleSizeOptimizations,\n debug: debug ?? false,\n org: org ?? process.env.SENTRY_ORG,\n project: project ?? process.env.SENTRY_PROJECT,\n telemetry: telemetry ?? true,\n _metaOptions: {\n telemetry: {\n metaFramework: 'react-router',\n },\n ...unstable_sentryVitePluginOptions?._metaOptions,\n },\n reactComponentAnnotation: {\n enabled: reactComponentAnnotation?.enabled ?? undefined,\n ignoredComponents: reactComponentAnnotation?.ignoredComponents ?? undefined,\n ...unstable_sentryVitePluginOptions?.reactComponentAnnotation,\n },\n release: {\n ...unstable_sentryVitePluginOptions?.release,\n ...release,\n },\n // will be handled in buildEnd hook\n sourcemaps: {\n disable: true,\n ...unstable_sentryVitePluginOptions?.sourcemaps,\n },\n ...unstable_sentryVitePluginOptions,\n }) as Plugin[];\n\n return sentryVitePlugins;\n}\n"],"names":["sentryVitePlugin"],"mappings":";;;;AAIA;AACA;AACA;AACO,eAAe,2BAA2B,CAAC,OAAO,EAAoD;AAC7G,EAAE,MAAM;AACR,IAAI,KAAK;AACT,IAAI,gCAAgC;AACpC,IAAI,uBAAuB;AAC3B,IAAI,cAAc;AAClB,IAAI,SAAS;AACb,IAAI,GAAG;AACP,IAAI,OAAO;AACX,IAAI,SAAS;AACb,IAAI,wBAAwB;AAC5B,IAAI,OAAO;AACX,GAAE,GAAI,OAAO;;AAEb,EAAE,MAAM,iBAAA,GAAoBA,2BAAgB,CAAC;AAC7C,IAAI,cAAc;AAClB,IAAI,SAAS,EAAE,SAAA,IAAa,OAAO,CAAC,GAAG,CAAC,iBAAiB;AACzD,IAAI,uBAAuB;AAC3B,IAAI,KAAK,EAAE,KAAA,IAAS,KAAK;AACzB,IAAI,GAAG,EAAE,GAAA,IAAO,OAAO,CAAC,GAAG,CAAC,UAAU;AACtC,IAAI,OAAO,EAAE,OAAA,IAAW,OAAO,CAAC,GAAG,CAAC,cAAc;AAClD,IAAI,SAAS,EAAE,SAAA,IAAa,IAAI;AAChC,IAAI,YAAY,EAAE;AAClB,MAAM,SAAS,EAAE;AACjB,QAAQ,aAAa,EAAE,cAAc;AACrC,OAAO;AACP,MAAM,GAAG,gCAAgC,EAAE,YAAY;AACvD,KAAK;AACL,IAAI,wBAAwB,EAAE;AAC9B,MAAM,OAAO,EAAE,wBAAwB,EAAE,OAAA,IAAW,SAAS;AAC7D,MAAM,iBAAiB,EAAE,wBAAwB,EAAE,iBAAA,IAAqB,SAAS;AACjF,MAAM,GAAG,gCAAgC,EAAE,wBAAwB;AACnE,KAAK;AACL,IAAI,OAAO,EAAE;AACb,MAAM,GAAG,gCAAgC,EAAE,OAAO;AAClD,MAAM,GAAG,OAAO;AAChB,KAAK;AACL;AACA,IAAI,UAAU,EAAE;AAChB,MAAM,OAAO,EAAE,IAAI;AACnB,MAAM,GAAG,gCAAgC,EAAE,UAAU;AACrD,KAAK;AACL,IAAI,GAAG,gCAAgC;AACvC,GAAG,CAAA;;AAEH,EAAE,OAAO,iBAAiB;AAC1B;;;;"}
1
+ {"version":3,"file":"makeCustomSentryVitePlugins.js","sources":["../../../src/vite/makeCustomSentryVitePlugins.ts"],"sourcesContent":["import { sentryVitePlugin } from '@sentry/vite-plugin';\nimport { type Plugin } from 'vite';\nimport type { SentryReactRouterBuildOptions } from './types';\n\n/**\n * Create a custom subset of sentry's vite plugins\n */\nexport async function makeCustomSentryVitePlugins(options: SentryReactRouterBuildOptions): Promise<Plugin[]> {\n const {\n debug,\n unstable_sentryVitePluginOptions,\n bundleSizeOptimizations,\n applicationKey,\n authToken,\n org,\n project,\n telemetry,\n reactComponentAnnotation,\n release,\n } = options;\n\n const sentryVitePlugins = sentryVitePlugin({\n applicationKey,\n authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,\n bundleSizeOptimizations,\n debug: debug ?? false,\n org: org ?? process.env.SENTRY_ORG,\n project: project ?? process.env.SENTRY_PROJECT,\n telemetry: telemetry ?? true,\n _metaOptions: {\n telemetry: {\n metaFramework: 'react-router',\n },\n ...unstable_sentryVitePluginOptions?._metaOptions,\n },\n reactComponentAnnotation: {\n enabled: reactComponentAnnotation?.enabled ?? undefined,\n ignoredComponents: reactComponentAnnotation?.ignoredComponents ?? undefined,\n ...unstable_sentryVitePluginOptions?.reactComponentAnnotation,\n },\n release: {\n ...unstable_sentryVitePluginOptions?.release,\n ...release,\n },\n // will be handled in buildEnd hook\n sourcemaps: {\n disable: true,\n ...unstable_sentryVitePluginOptions?.sourcemaps,\n },\n ...unstable_sentryVitePluginOptions,\n }) as Plugin[];\n\n return sentryVitePlugins;\n}\n"],"names":["sentryVitePlugin"],"mappings":";;;;AAOA,eAAsB,4BAA4B,OAAA,EAA2D;AAC3G,EAAA,MAAM;AAAA,IACJ,KAAA;AAAA,IACA,gCAAA;AAAA,IACA,uBAAA;AAAA,IACA,cAAA;AAAA,IACA,SAAA;AAAA,IACA,GAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,wBAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AAEJ,EAAA,MAAM,oBAAoBA,2BAAA,CAAiB;AAAA,IACzC,cAAA;AAAA,IACA,SAAA,EAAW,SAAA,IAAa,OAAA,CAAQ,GAAA,CAAI,iBAAA;AAAA,IACpC,uBAAA;AAAA,IACA,OAAO,KAAA,IAAS,KAAA;AAAA,IAChB,GAAA,EAAK,GAAA,IAAO,OAAA,CAAQ,GAAA,CAAI,UAAA;AAAA,IACxB,OAAA,EAAS,OAAA,IAAW,OAAA,CAAQ,GAAA,CAAI,cAAA;AAAA,IAChC,WAAW,SAAA,IAAa,IAAA;AAAA,IACxB,YAAA,EAAc;AAAA,MACZ,SAAA,EAAW;AAAA,QACT,aAAA,EAAe;AAAA,OACjB;AAAA,MACA,GAAG,gCAAA,EAAkC;AAAA,KACvC;AAAA,IACA,wBAAA,EAA0B;AAAA,MACxB,OAAA,EAAS,0BAA0B,OAAA,IAAW,MAAA;AAAA,MAC9C,iBAAA,EAAmB,0BAA0B,iBAAA,IAAqB,MAAA;AAAA,MAClE,GAAG,gCAAA,EAAkC;AAAA,KACvC;AAAA,IACA,OAAA,EAAS;AAAA,MACP,GAAG,gCAAA,EAAkC,OAAA;AAAA,MACrC,GAAG;AAAA,KACL;AAAA;AAAA,IAEA,UAAA,EAAY;AAAA,MACV,OAAA,EAAS,IAAA;AAAA,MACT,GAAG,gCAAA,EAAkC;AAAA,KACvC;AAAA,IACA,GAAG;AAAA,GACJ,CAAA;AAED,EAAA,OAAO,iBAAA;AACT;;;;"}
@@ -1,81 +1,49 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- /**
4
- * A Sentry plugin for React Router to enable "hidden" source maps if they are unset.
5
- */
6
3
  function makeEnableSourceMapsPlugin(options) {
7
4
  return {
8
- name: 'sentry-react-router-update-source-map-setting',
9
- apply: 'build',
10
- enforce: 'post',
5
+ name: "sentry-react-router-update-source-map-setting",
6
+ apply: "build",
7
+ enforce: "post",
11
8
  config(viteConfig) {
12
9
  return {
13
10
  ...viteConfig,
14
11
  build: {
15
12
  ...viteConfig.build,
16
- sourcemap: getUpdatedSourceMapSettings(viteConfig, options),
17
- },
13
+ sourcemap: getUpdatedSourceMapSettings(viteConfig, options)
14
+ }
18
15
  };
19
- },
16
+ }
20
17
  };
21
18
  }
22
-
23
- /** There are 3 ways to set up source map generation
24
- *
25
- * 1. User explicitly disabled source maps
26
- * - keep this setting (emit a warning that errors won't be unminified in Sentry)
27
- * - we won't upload anything
28
- *
29
- * 2. Users enabled source map generation (true, 'hidden', 'inline').
30
- * - keep this setting (don't do anything - like deletion - besides uploading)
31
- *
32
- * 3. Users didn't set source maps generation
33
- * - we enable 'hidden' source maps generation
34
- * - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)
35
- *
36
- * --> only exported for testing
37
- */
38
- function getUpdatedSourceMapSettings(
39
- viteConfig,
40
- sentryPluginOptions,
41
- ) {
19
+ function getUpdatedSourceMapSettings(viteConfig, sentryPluginOptions) {
42
20
  viteConfig.build = viteConfig.build || {};
43
-
44
21
  const viteSourceMap = viteConfig?.build?.sourcemap;
45
22
  let updatedSourceMapSetting = viteSourceMap;
46
-
47
- const settingKey = 'vite.build.sourcemap';
23
+ const settingKey = "vite.build.sourcemap";
48
24
  const debug = sentryPluginOptions?.debug;
49
-
50
25
  if (viteSourceMap === false) {
51
26
  updatedSourceMapSetting = viteSourceMap;
52
-
53
27
  if (debug) {
54
- // Longer debug message with more details
55
- // eslint-disable-next-line no-console
56
28
  console.warn(
57
- `[Sentry] Source map generation is currently disabled in your Vite configuration (\`${settingKey}: false \`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \`${settingKey}\` (e.g. by setting them to \`hidden\`).`,
29
+ `[Sentry] Source map generation is currently disabled in your Vite configuration (\`${settingKey}: false \`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \`${settingKey}\` (e.g. by setting them to \`hidden\`).`
58
30
  );
59
31
  } else {
60
- // eslint-disable-next-line no-console
61
- console.warn('[Sentry] Source map generation is disabled in your Vite configuration.');
32
+ console.warn("[Sentry] Source map generation is disabled in your Vite configuration.");
62
33
  }
63
- } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {
34
+ } else if (viteSourceMap && ["hidden", "inline", true].includes(viteSourceMap)) {
64
35
  updatedSourceMapSetting = viteSourceMap;
65
-
66
- debug &&
67
- // eslint-disable-next-line no-console
68
- console.log(
69
- `[Sentry] We discovered \`${settingKey}\` is set to \`${viteSourceMap.toString()}\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,
70
- );
36
+ debug && // eslint-disable-next-line no-console
37
+ console.log(
38
+ `[Sentry] We discovered \`${settingKey}\` is set to \`${viteSourceMap.toString()}\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`
39
+ );
71
40
  } else {
72
- updatedSourceMapSetting = 'hidden';
41
+ updatedSourceMapSetting = "hidden";
73
42
  debug && // eslint-disable-next-line no-console
74
- console.log(
75
- `[Sentry] Enabled source map generation in the build options with \`${settingKey}: 'hidden'\`. The source maps will be deleted after they were uploaded to Sentry.`,
76
- );
43
+ console.log(
44
+ `[Sentry] Enabled source map generation in the build options with \`${settingKey}: 'hidden'\`. The source maps will be deleted after they were uploaded to Sentry.`
45
+ );
77
46
  }
78
-
79
47
  return updatedSourceMapSetting;
80
48
  }
81
49
 
@@ -1 +1 @@
1
- {"version":3,"file":"makeEnableSourceMapsPlugin.js","sources":["../../../src/vite/makeEnableSourceMapsPlugin.ts"],"sourcesContent":["import type { Plugin, UserConfig } from 'vite';\nimport type { SentryReactRouterBuildOptions } from './types';\n\n/**\n * A Sentry plugin for React Router to enable \"hidden\" source maps if they are unset.\n */\nexport function makeEnableSourceMapsPlugin(options: SentryReactRouterBuildOptions): Plugin {\n return {\n name: 'sentry-react-router-update-source-map-setting',\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/** There are 3 ways to set up source map generation\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?: SentryReactRouterBuildOptions,\n): boolean | 'inline' | 'hidden' {\n viteConfig.build = viteConfig.build || {};\n\n const viteSourceMap = viteConfig?.build?.sourcemap;\n let updatedSourceMapSetting = viteSourceMap;\n\n const settingKey = 'vite.build.sourcemap';\n const debug = sentryPluginOptions?.debug;\n\n if (viteSourceMap === false) {\n updatedSourceMapSetting = viteSourceMap;\n\n if (debug) {\n // Longer debug message with more details\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation is currently disabled in your Vite configuration (\\`${settingKey}: false \\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \\`${settingKey}\\` (e.g. by setting them to \\`hidden\\`).`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Source map generation is disabled in your Vite configuration.');\n }\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n updatedSourceMapSetting = viteSourceMap;\n\n debug &&\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${viteSourceMap.toString()}\\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,\n );\n } else {\n updatedSourceMapSetting = 'hidden';\n debug && // 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 updatedSourceMapSetting;\n}\n"],"names":[],"mappings":";;AAGA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,OAAO,EAAyC;AAC3F,EAAE,OAAO;AACT,IAA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aAAa;;AAE3C,IAAI,KAAA;AACJ;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,CAAC,yBAAyB,EAAE,UAAU,CAAC,eAAe,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,4GAA4G,CAAC;AACtM,OAAO;AACP,EAAE,OAAO;AACT,IAAI,uBAAA,GAA0B,QAAQ;AACtC,IAAI,KAAA;AACJ,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,CAAC,mEAAmE,EAAE,UAAU,CAAC,kFAAkF,CAAC;AAC5K,OAAO;AACP,EAAE;;AAEF,EAAE,OAAO,uBAAuB;AAChC;;;;;"}
1
+ {"version":3,"file":"makeEnableSourceMapsPlugin.js","sources":["../../../src/vite/makeEnableSourceMapsPlugin.ts"],"sourcesContent":["import type { Plugin, UserConfig } from 'vite';\nimport type { SentryReactRouterBuildOptions } from './types';\n\n/**\n * A Sentry plugin for React Router to enable \"hidden\" source maps if they are unset.\n */\nexport function makeEnableSourceMapsPlugin(options: SentryReactRouterBuildOptions): Plugin {\n return {\n name: 'sentry-react-router-update-source-map-setting',\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/** There are 3 ways to set up source map generation\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?: SentryReactRouterBuildOptions,\n): boolean | 'inline' | 'hidden' {\n viteConfig.build = viteConfig.build || {};\n\n const viteSourceMap = viteConfig?.build?.sourcemap;\n let updatedSourceMapSetting = viteSourceMap;\n\n const settingKey = 'vite.build.sourcemap';\n const debug = sentryPluginOptions?.debug;\n\n if (viteSourceMap === false) {\n updatedSourceMapSetting = viteSourceMap;\n\n if (debug) {\n // Longer debug message with more details\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation is currently disabled in your Vite configuration (\\`${settingKey}: false \\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \\`${settingKey}\\` (e.g. by setting them to \\`hidden\\`).`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Source map generation is disabled in your Vite configuration.');\n }\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n updatedSourceMapSetting = viteSourceMap;\n\n debug &&\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${viteSourceMap.toString()}\\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,\n );\n } else {\n updatedSourceMapSetting = 'hidden';\n debug && // 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 updatedSourceMapSetting;\n}\n"],"names":[],"mappings":";;AAMO,SAAS,2BAA2B,OAAA,EAAgD;AACzF,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,+CAAA;AAAA,IACN,KAAA,EAAO,OAAA;AAAA,IACP,OAAA,EAAS,MAAA;AAAA,IACT,OAAO,UAAA,EAAY;AACjB,MAAA,OAAO;AAAA,QACL,GAAG,UAAA;AAAA,QACH,KAAA,EAAO;AAAA,UACL,GAAG,UAAA,CAAW,KAAA;AAAA,UACd,SAAA,EAAW,2BAAA,CAA4B,UAAA,EAAY,OAAO;AAAA;AAC5D,OACF;AAAA,IACF;AAAA,GACF;AACF;AAiBO,SAAS,2BAAA,CACd,YACA,mBAAA,EAC+B;AAC/B,EAAA,UAAA,CAAW,KAAA,GAAQ,UAAA,CAAW,KAAA,IAAS,EAAC;AAExC,EAAA,MAAM,aAAA,GAAgB,YAAY,KAAA,EAAO,SAAA;AACzC,EAAA,IAAI,uBAAA,GAA0B,aAAA;AAE9B,EAAA,MAAM,UAAA,GAAa,sBAAA;AACnB,EAAA,MAAM,QAAQ,mBAAA,EAAqB,KAAA;AAEnC,EAAA,IAAI,kBAAkB,KAAA,EAAO;AAC3B,IAAA,uBAAA,GAA0B,aAAA;AAE1B,IAAA,IAAI,KAAA,EAAO;AAGT,MAAA,OAAA,CAAQ,IAAA;AAAA,QACN,CAAA,mFAAA,EAAsF,UAAU,CAAA,2QAAA,EAA8Q,UAAU,CAAA,wCAAA;AAAA,OAC1X;AAAA,IACF,CAAA,MAAO;AAEL,MAAA,OAAA,CAAQ,KAAK,wEAAwE,CAAA;AAAA,IACvF;AAAA,EACF,CAAA,MAAA,IAAW,iBAAiB,CAAC,QAAA,EAAU,UAAU,IAAI,CAAA,CAAE,QAAA,CAAS,aAAa,CAAA,EAAG;AAC9E,IAAA,uBAAA,GAA0B,aAAA;AAE1B,IAAA,KAAA;AAAA,IAEE,OAAA,CAAQ,GAAA;AAAA,MACN,CAAA,yBAAA,EAA4B,UAAU,CAAA,eAAA,EAAkB,aAAA,CAAc,UAAU,CAAA,4GAAA;AAAA,KAClF;AAAA,EACJ,CAAA,MAAO;AACL,IAAA,uBAAA,GAA0B,QAAA;AAC1B,IAAA,KAAA;AAAA,IACE,OAAA,CAAQ,GAAA;AAAA,MACN,sEAAsE,UAAU,CAAA,kFAAA;AAAA,KAClF;AAAA,EACJ;AAEA,EAAA,OAAO,uBAAA;AACT;;;;;"}
@@ -2,40 +2,29 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const serverBuild = require('../server/serverBuild.js');
4
4
 
5
- const SERVER_BUILD_MODULE_ID = 'virtual:react-router/server-build';
6
-
7
- /**
8
- * A Sentry plugin for React Router to capture the server build for middleware name resolution.
9
- */
5
+ const SERVER_BUILD_MODULE_ID = "virtual:react-router/server-build";
10
6
  function makeServerBuildCapturePlugin() {
11
7
  let isSsrBuild = false;
12
-
13
8
  return {
14
- name: 'sentry-react-router-server-build-capture',
15
- enforce: 'post',
16
-
9
+ name: "sentry-react-router-server-build-capture",
10
+ enforce: "post",
17
11
  configResolved(config) {
18
12
  isSsrBuild = !!config.build.ssr;
19
13
  },
20
-
21
14
  transform(code, id) {
22
15
  if (!isSsrBuild) {
23
16
  return null;
24
17
  }
25
-
26
18
  if (!id.includes(SERVER_BUILD_MODULE_ID)) {
27
19
  return null;
28
20
  }
29
-
30
- // `routes` is a module-scope export in the virtual:react-router/server-build module
31
21
  const injectedCode = `${code}
32
22
  if (typeof globalThis !== 'undefined' && typeof globalThis["${serverBuild.GLOBAL_KEY}"] === 'function') {
33
23
  globalThis["${serverBuild.GLOBAL_KEY}"]({ routes });
34
24
  }
35
25
  `;
36
-
37
26
  return { code: injectedCode, map: null };
38
- },
27
+ }
39
28
  };
40
29
  }
41
30
 
@@ -1 +1 @@
1
- {"version":3,"file":"makeServerBuildCapturePlugin.js","sources":["../../../src/vite/makeServerBuildCapturePlugin.ts"],"sourcesContent":["import { type Plugin } from 'vite';\nimport { GLOBAL_KEY } from '../server/serverBuild';\n\nconst SERVER_BUILD_MODULE_ID = 'virtual:react-router/server-build';\n\n/**\n * A Sentry plugin for React Router to capture the server build for middleware name resolution.\n */\nexport function makeServerBuildCapturePlugin(): Plugin {\n let isSsrBuild = false;\n\n return {\n name: 'sentry-react-router-server-build-capture',\n enforce: 'post',\n\n configResolved(config) {\n isSsrBuild = !!config.build.ssr;\n },\n\n transform(code, id) {\n if (!isSsrBuild) {\n return null;\n }\n\n if (!id.includes(SERVER_BUILD_MODULE_ID)) {\n return null;\n }\n\n // `routes` is a module-scope export in the virtual:react-router/server-build module\n const injectedCode = `${code}\nif (typeof globalThis !== 'undefined' && typeof globalThis[\"${GLOBAL_KEY}\"] === 'function') {\n globalThis[\"${GLOBAL_KEY}\"]({ routes });\n}\n`;\n\n return { code: injectedCode, map: null };\n },\n };\n}\n"],"names":["GLOBAL_KEY"],"mappings":";;;;AAGA,MAAM,sBAAA,GAAyB,mCAAmC;;AAElE;AACA;AACA;AACO,SAAS,4BAA4B,GAAW;AACvD,EAAE,IAAI,UAAA,GAAa,KAAK;;AAExB,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,0CAA0C;AACpD,IAAI,OAAO,EAAE,MAAM;;AAEnB,IAAI,cAAc,CAAC,MAAM,EAAE;AAC3B,MAAM,UAAA,GAAa,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG;AACrC,IAAI,CAAC;;AAEL,IAAI,SAAS,CAAC,IAAI,EAAE,EAAE,EAAE;AACxB,MAAM,IAAI,CAAC,UAAU,EAAE;AACvB,QAAQ,OAAO,IAAI;AACnB,MAAM;;AAEN,MAAM,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE;AAChD,QAAQ,OAAO,IAAI;AACnB,MAAM;;AAEN;AACA,MAAM,MAAM,YAAA,GAAe,CAAC,EAAA,IAAA;AACA,4DAAA,EAAAA,sBAAA,CAAA;AACA,cAAA,EAAAA,sBAAA,CAAA;AACA;AACA,CAAA;;AAEA,MAAA,OAAA,EAAA,IAAA,EAAA,YAAA,EAAA,GAAA,EAAA,IAAA,EAAA;AACA,IAAA,CAAA;AACA,GAAA;AACA;;;;"}
1
+ {"version":3,"file":"makeServerBuildCapturePlugin.js","sources":["../../../src/vite/makeServerBuildCapturePlugin.ts"],"sourcesContent":["import { type Plugin } from 'vite';\nimport { GLOBAL_KEY } from '../server/serverBuild';\n\nconst SERVER_BUILD_MODULE_ID = 'virtual:react-router/server-build';\n\n/**\n * A Sentry plugin for React Router to capture the server build for middleware name resolution.\n */\nexport function makeServerBuildCapturePlugin(): Plugin {\n let isSsrBuild = false;\n\n return {\n name: 'sentry-react-router-server-build-capture',\n enforce: 'post',\n\n configResolved(config) {\n isSsrBuild = !!config.build.ssr;\n },\n\n transform(code, id) {\n if (!isSsrBuild) {\n return null;\n }\n\n if (!id.includes(SERVER_BUILD_MODULE_ID)) {\n return null;\n }\n\n // `routes` is a module-scope export in the virtual:react-router/server-build module\n const injectedCode = `${code}\nif (typeof globalThis !== 'undefined' && typeof globalThis[\"${GLOBAL_KEY}\"] === 'function') {\n globalThis[\"${GLOBAL_KEY}\"]({ routes });\n}\n`;\n\n return { code: injectedCode, map: null };\n },\n };\n}\n"],"names":["GLOBAL_KEY"],"mappings":";;;;AAGA,MAAM,sBAAA,GAAyB,mCAAA;AAKxB,SAAS,4BAAA,GAAuC;AACrD,EAAA,IAAI,UAAA,GAAa,KAAA;AAEjB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,0CAAA;AAAA,IACN,OAAA,EAAS,MAAA;AAAA,IAET,eAAe,MAAA,EAAQ;AACrB,MAAA,UAAA,GAAa,CAAC,CAAC,MAAA,CAAO,KAAA,CAAM,GAAA;AAAA,IAC9B,CAAA;AAAA,IAEA,SAAA,CAAU,MAAM,EAAA,EAAI;AAClB,MAAA,IAAI,CAAC,UAAA,EAAY;AACf,QAAA,OAAO,IAAA;AAAA,MACT;AAEA,MAAA,IAAI,CAAC,EAAA,CAAG,QAAA,CAAS,sBAAsB,CAAA,EAAG;AACxC,QAAA,OAAO,IAAA;AAAA,MACT;AAGA,MAAA,MAAM,YAAA,GAAe,GAAG,IAAI;AAAA,4DAAA,EAC4BA,sBAAU,CAAA;AAAA,cAAA,EACxDA,sBAAU,CAAA;AAAA;AAAA,CAAA;AAIpB,MAAA,OAAO,EAAE,IAAA,EAAM,YAAA,EAAc,GAAA,EAAK,IAAA,EAAK;AAAA,IACzC;AAAA,GACF;AACF;;;;"}
@@ -5,27 +5,14 @@ const makeCustomSentryVitePlugins = require('./makeCustomSentryVitePlugins.js');
5
5
  const makeEnableSourceMapsPlugin = require('./makeEnableSourceMapsPlugin.js');
6
6
  const makeServerBuildCapturePlugin = require('./makeServerBuildCapturePlugin.js');
7
7
 
8
- /**
9
- * A Vite plugin for Sentry that handles source map uploads and bundle size optimizations.
10
- *
11
- * @param options - Configuration options for the Sentry Vite plugin
12
- * @param viteConfig - The Vite user config object
13
- * @returns An array of Vite plugins
14
- */
15
- async function sentryReactRouter(
16
- options = {},
17
- viteConfig,
18
- ) {
8
+ async function sentryReactRouter(options = {}, viteConfig) {
19
9
  const plugins = [];
20
-
21
10
  plugins.push(makeConfigInjectorPlugin.makeConfigInjectorPlugin(options));
22
11
  plugins.push(makeServerBuildCapturePlugin.makeServerBuildCapturePlugin());
23
-
24
- if (process.env.NODE_ENV !== 'development' && viteConfig.command === 'build' && viteConfig.mode !== 'development') {
12
+ if (process.env.NODE_ENV !== "development" && viteConfig.command === "build" && viteConfig.mode !== "development") {
25
13
  plugins.push(makeEnableSourceMapsPlugin.makeEnableSourceMapsPlugin(options));
26
- plugins.push(...(await makeCustomSentryVitePlugins.makeCustomSentryVitePlugins(options)));
14
+ plugins.push(...await makeCustomSentryVitePlugins.makeCustomSentryVitePlugins(options));
27
15
  }
28
-
29
16
  return plugins;
30
17
  }
31
18
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["../../../src/vite/plugin.ts"],"sourcesContent":["import type { ConfigEnv, Plugin } from 'vite';\nimport { makeConfigInjectorPlugin } from './makeConfigInjectorPlugin';\nimport { makeCustomSentryVitePlugins } from './makeCustomSentryVitePlugins';\nimport { makeEnableSourceMapsPlugin } from './makeEnableSourceMapsPlugin';\nimport { makeServerBuildCapturePlugin } from './makeServerBuildCapturePlugin';\nimport type { SentryReactRouterBuildOptions } from './types';\n\n/**\n * A Vite plugin for Sentry that handles source map uploads and bundle size optimizations.\n *\n * @param options - Configuration options for the Sentry Vite plugin\n * @param viteConfig - The Vite user config object\n * @returns An array of Vite plugins\n */\nexport async function sentryReactRouter(\n options: SentryReactRouterBuildOptions = {},\n viteConfig: ConfigEnv,\n): Promise<Plugin[]> {\n const plugins: Plugin[] = [];\n\n plugins.push(makeConfigInjectorPlugin(options));\n plugins.push(makeServerBuildCapturePlugin());\n\n if (process.env.NODE_ENV !== 'development' && viteConfig.command === 'build' && viteConfig.mode !== 'development') {\n plugins.push(makeEnableSourceMapsPlugin(options));\n plugins.push(...(await makeCustomSentryVitePlugins(options)));\n }\n\n return plugins;\n}\n"],"names":["makeConfigInjectorPlugin","makeServerBuildCapturePlugin","makeEnableSourceMapsPlugin","makeCustomSentryVitePlugins"],"mappings":";;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,iBAAiB;AACvC,EAAE,OAAO,GAAkC,EAAE;AAC7C,EAAE,UAAU;AACZ,EAAqB;AACrB,EAAE,MAAM,OAAO,GAAa,EAAE;;AAE9B,EAAE,OAAO,CAAC,IAAI,CAACA,iDAAwB,CAAC,OAAO,CAAC,CAAC;AACjD,EAAE,OAAO,CAAC,IAAI,CAACC,yDAA4B,EAAE,CAAC;;AAE9C,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAA,KAAa,aAAA,IAAiB,UAAU,CAAC,OAAA,KAAY,OAAA,IAAW,UAAU,CAAC,IAAA,KAAS,aAAa,EAAE;AACrH,IAAI,OAAO,CAAC,IAAI,CAACC,qDAA0B,CAAC,OAAO,CAAC,CAAC;AACrD,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,MAAMC,uDAA2B,CAAC,OAAO,CAAC,CAAC,CAAC;AACjE,EAAE;;AAEF,EAAE,OAAO,OAAO;AAChB;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["../../../src/vite/plugin.ts"],"sourcesContent":["import type { ConfigEnv, Plugin } from 'vite';\nimport { makeConfigInjectorPlugin } from './makeConfigInjectorPlugin';\nimport { makeCustomSentryVitePlugins } from './makeCustomSentryVitePlugins';\nimport { makeEnableSourceMapsPlugin } from './makeEnableSourceMapsPlugin';\nimport { makeServerBuildCapturePlugin } from './makeServerBuildCapturePlugin';\nimport type { SentryReactRouterBuildOptions } from './types';\n\n/**\n * A Vite plugin for Sentry that handles source map uploads and bundle size optimizations.\n *\n * @param options - Configuration options for the Sentry Vite plugin\n * @param viteConfig - The Vite user config object\n * @returns An array of Vite plugins\n */\nexport async function sentryReactRouter(\n options: SentryReactRouterBuildOptions = {},\n viteConfig: ConfigEnv,\n): Promise<Plugin[]> {\n const plugins: Plugin[] = [];\n\n plugins.push(makeConfigInjectorPlugin(options));\n plugins.push(makeServerBuildCapturePlugin());\n\n if (process.env.NODE_ENV !== 'development' && viteConfig.command === 'build' && viteConfig.mode !== 'development') {\n plugins.push(makeEnableSourceMapsPlugin(options));\n plugins.push(...(await makeCustomSentryVitePlugins(options)));\n }\n\n return plugins;\n}\n"],"names":["makeConfigInjectorPlugin","makeServerBuildCapturePlugin","makeEnableSourceMapsPlugin","makeCustomSentryVitePlugins"],"mappings":";;;;;;;AAcA,eAAsB,iBAAA,CACpB,OAAA,GAAyC,EAAC,EAC1C,UAAA,EACmB;AACnB,EAAA,MAAM,UAAoB,EAAC;AAE3B,EAAA,OAAA,CAAQ,IAAA,CAAKA,iDAAA,CAAyB,OAAO,CAAC,CAAA;AAC9C,EAAA,OAAA,CAAQ,IAAA,CAAKC,2DAA8B,CAAA;AAE3C,EAAA,IAAI,OAAA,CAAQ,IAAI,QAAA,KAAa,aAAA,IAAiB,WAAW,OAAA,KAAY,OAAA,IAAW,UAAA,CAAW,IAAA,KAAS,aAAA,EAAe;AACjH,IAAA,OAAA,CAAQ,IAAA,CAAKC,qDAAA,CAA2B,OAAO,CAAC,CAAA;AAChD,IAAA,OAAA,CAAQ,IAAA,CAAK,GAAI,MAAMC,uDAAA,CAA4B,OAAO,CAAE,CAAA;AAAA,EAC9D;AAEA,EAAA,OAAO,OAAA;AACT;;;;"}