@sentry/react-router 9.3.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 (64) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +182 -0
  3. package/build/cjs/client/sdk.js +24 -0
  4. package/build/cjs/client/sdk.js.map +1 -0
  5. package/build/cjs/index.client.js +19 -0
  6. package/build/cjs/index.client.js.map +1 -0
  7. package/build/cjs/index.server.js +23 -0
  8. package/build/cjs/index.server.js.map +1 -0
  9. package/build/cjs/server/sdk.js +24 -0
  10. package/build/cjs/server/sdk.js.map +1 -0
  11. package/build/cjs/vite/buildEnd/handleOnBuildEnd.js +114 -0
  12. package/build/cjs/vite/buildEnd/handleOnBuildEnd.js.map +1 -0
  13. package/build/cjs/vite/makeCustomSentryVitePlugins.js +40 -0
  14. package/build/cjs/vite/makeCustomSentryVitePlugins.js.map +1 -0
  15. package/build/cjs/vite/makeEnableSourceMapsPlugin.js +87 -0
  16. package/build/cjs/vite/makeEnableSourceMapsPlugin.js.map +1 -0
  17. package/build/cjs/vite/plugin.js +28 -0
  18. package/build/cjs/vite/plugin.js.map +1 -0
  19. package/build/esm/client/sdk.js +22 -0
  20. package/build/esm/client/sdk.js.map +1 -0
  21. package/build/esm/index.client.js +3 -0
  22. package/build/esm/index.client.js.map +1 -0
  23. package/build/esm/index.server.js +5 -0
  24. package/build/esm/index.server.js.map +1 -0
  25. package/build/esm/package.json +1 -0
  26. package/build/esm/server/sdk.js +22 -0
  27. package/build/esm/server/sdk.js.map +1 -0
  28. package/build/esm/vite/buildEnd/handleOnBuildEnd.js +112 -0
  29. package/build/esm/vite/buildEnd/handleOnBuildEnd.js.map +1 -0
  30. package/build/esm/vite/makeCustomSentryVitePlugins.js +38 -0
  31. package/build/esm/vite/makeCustomSentryVitePlugins.js.map +1 -0
  32. package/build/esm/vite/makeEnableSourceMapsPlugin.js +84 -0
  33. package/build/esm/vite/makeEnableSourceMapsPlugin.js.map +1 -0
  34. package/build/esm/vite/plugin.js +26 -0
  35. package/build/esm/vite/plugin.js.map +1 -0
  36. package/build/types/client/index.d.ts +3 -0
  37. package/build/types/client/index.d.ts.map +1 -0
  38. package/build/types/client/sdk.d.ts +7 -0
  39. package/build/types/client/sdk.d.ts.map +1 -0
  40. package/build/types/common/debug-build.d.ts +7 -0
  41. package/build/types/common/debug-build.d.ts.map +1 -0
  42. package/build/types/index.client.d.ts +2 -0
  43. package/build/types/index.client.d.ts.map +1 -0
  44. package/build/types/index.server.d.ts +3 -0
  45. package/build/types/index.server.d.ts.map +1 -0
  46. package/build/types/index.types.d.ts +13 -0
  47. package/build/types/index.types.d.ts.map +1 -0
  48. package/build/types/server/index.d.ts +3 -0
  49. package/build/types/server/index.d.ts.map +1 -0
  50. package/build/types/server/sdk.d.ts +6 -0
  51. package/build/types/server/sdk.d.ts.map +1 -0
  52. package/build/types/vite/buildEnd/handleOnBuildEnd.d.ts +10 -0
  53. package/build/types/vite/buildEnd/handleOnBuildEnd.d.ts.map +1 -0
  54. package/build/types/vite/index.d.ts +4 -0
  55. package/build/types/vite/index.d.ts.map +1 -0
  56. package/build/types/vite/makeCustomSentryVitePlugins.d.ts +7 -0
  57. package/build/types/vite/makeCustomSentryVitePlugins.d.ts.map +1 -0
  58. package/build/types/vite/makeEnableSourceMapsPlugin.d.ts +23 -0
  59. package/build/types/vite/makeEnableSourceMapsPlugin.d.ts.map +1 -0
  60. package/build/types/vite/plugin.d.ts +12 -0
  61. package/build/types/vite/plugin.d.ts.map +1 -0
  62. package/build/types/vite/types.d.ts +141 -0
  63. package/build/types/vite/types.d.ts.map +1 -0
  64. package/package.json +78 -0
@@ -0,0 +1,5 @@
1
+ export * from '@sentry/node';
2
+ export { init } from './server/sdk.js';
3
+ export { sentryReactRouter } from './vite/plugin.js';
4
+ export { sentryOnBuildEnd } from './vite/buildEnd/handleOnBuildEnd.js';
5
+ //# sourceMappingURL=index.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.server.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1 @@
1
+ {"type":"module","version":"9.3.0"}
@@ -0,0 +1,22 @@
1
+ import { applySdkMetadata, setTag } from '@sentry/core';
2
+ import { init as init$1 } from '@sentry/node';
3
+
4
+ /**
5
+ * Initializes the server side of the React Router SDK
6
+ */
7
+ function init(options) {
8
+ const opts = {
9
+ ...options,
10
+ };
11
+
12
+ applySdkMetadata(opts, 'react-router', ['react-router', 'node']);
13
+
14
+ const client = init$1(opts);
15
+
16
+ setTag('runtime', 'node');
17
+
18
+ return client;
19
+ }
20
+
21
+ export { init };
22
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import { applySdkMetadata, setTag } from '@sentry/core';\nimport type { NodeClient, NodeOptions } from '@sentry/node';\nimport { init as initNodeSdk } from '@sentry/node';\n\n/**\n * Initializes the server side of the React Router SDK\n */\nexport function init(options: NodeOptions): NodeClient | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'react-router', ['react-router', 'node']);\n\n const client = initNodeSdk(opts);\n\n setTag('runtime', 'node');\n\n return client;\n}\n"],"names":["initNodeSdk"],"mappings":";;;AAIA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAuC;AACnE,EAAE,MAAM,OAAO;AACf,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,gBAAgB,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;;AAElE,EAAE,MAAM,MAAO,GAAEA,MAAW,CAAC,IAAI,CAAC;;AAElC,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC;;AAE3B,EAAE,OAAO,MAAM;AACf;;;;"}
@@ -0,0 +1,112 @@
1
+ import { rm } from 'node:fs/promises';
2
+ import SentryCli from '@sentry/cli';
3
+ import { glob } from 'glob';
4
+
5
+ function getSentryConfig(viteConfig) {
6
+ if (!viteConfig || typeof viteConfig !== 'object' || !('sentryConfig' in viteConfig)) {
7
+ // eslint-disable-next-line no-console
8
+ console.error('[Sentry] sentryConfig not found - it needs to be passed to vite.config.ts');
9
+ }
10
+
11
+ return (viteConfig ).sentryConfig;
12
+ }
13
+
14
+ /**
15
+ * A build end hook that handles Sentry release creation and source map uploads.
16
+ * It creates a new Sentry release if configured, uploads source maps to Sentry,
17
+ * and optionally deletes the source map files after upload.
18
+ */
19
+ const sentryOnBuildEnd = async ({ reactRouterConfig, viteConfig }) => {
20
+ const {
21
+ authToken,
22
+ org,
23
+ project,
24
+ release,
25
+ sourceMapsUploadOptions = { enabled: true },
26
+ debug = false,
27
+ } = getSentryConfig(viteConfig);
28
+
29
+ const cliInstance = new SentryCli(null, {
30
+ authToken,
31
+ org,
32
+ project,
33
+ });
34
+ // check if release should be created
35
+ if (release?.name) {
36
+ try {
37
+ await cliInstance.releases.new(release.name);
38
+ } catch (error) {
39
+ // eslint-disable-next-line no-console
40
+ console.error('[Sentry] Could not create release', error);
41
+ }
42
+ }
43
+
44
+ if (sourceMapsUploadOptions?.enabled ?? (viteConfig.build.sourcemap !== false)) {
45
+ // inject debugIds
46
+ try {
47
+ await cliInstance.execute(['sourcemaps', 'inject', reactRouterConfig.buildDirectory], debug);
48
+ } catch (error) {
49
+ // eslint-disable-next-line no-console
50
+ console.error('[Sentry] Could not inject debug ids', error);
51
+ }
52
+
53
+ // upload sourcemaps
54
+ try {
55
+ await cliInstance.releases.uploadSourceMaps(release?.name || 'undefined', {
56
+ include: [
57
+ {
58
+ paths: [reactRouterConfig.buildDirectory],
59
+ },
60
+ ],
61
+ });
62
+ } catch (error) {
63
+ // eslint-disable-next-line no-console
64
+ console.error('[Sentry] Could not upload sourcemaps', error);
65
+ }
66
+ }
67
+ // delete sourcemaps after upload
68
+ let updatedFilesToDeleteAfterUpload = sourceMapsUploadOptions?.filesToDeleteAfterUpload;
69
+ // set a default value no option was set
70
+ if (typeof sourceMapsUploadOptions?.filesToDeleteAfterUpload === 'undefined') {
71
+ updatedFilesToDeleteAfterUpload = [`${reactRouterConfig.buildDirectory}/**/*.map`];
72
+ if (debug) {
73
+ // eslint-disable-next-line no-console
74
+ console.info(
75
+ `[Sentry] Automatically setting \`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(
76
+ updatedFilesToDeleteAfterUpload,
77
+ )}\` to delete generated source maps after they were uploaded to Sentry.`,
78
+ );
79
+ }
80
+ }
81
+ if (updatedFilesToDeleteAfterUpload) {
82
+ try {
83
+ const filePathsToDelete = await glob(updatedFilesToDeleteAfterUpload, {
84
+ absolute: true,
85
+ nodir: true,
86
+ });
87
+ if (debug) {
88
+ filePathsToDelete.forEach(filePathToDelete => {
89
+ // eslint-disable-next-line no-console
90
+ console.info(`Deleting asset after upload: ${filePathToDelete}`);
91
+ });
92
+ }
93
+ await Promise.all(
94
+ filePathsToDelete.map(filePathToDelete =>
95
+ rm(filePathToDelete, { force: true }).catch((e) => {
96
+ if (debug) {
97
+ // This is allowed to fail - we just don't do anything
98
+ // eslint-disable-next-line no-console
99
+ console.debug(`An error occurred while attempting to delete asset: ${filePathToDelete}`, e);
100
+ }
101
+ }),
102
+ ),
103
+ );
104
+ } catch (error) {
105
+ // eslint-disable-next-line no-console
106
+ console.error('Error deleting files after sourcemap upload:', error);
107
+ }
108
+ }
109
+ };
110
+
111
+ export { sentryOnBuildEnd };
112
+ //# sourceMappingURL=handleOnBuildEnd.js.map
@@ -0,0 +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/dist/config';\nimport SentryCli from '@sentry/cli';\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 {\n authToken,\n org,\n project,\n release,\n sourceMapsUploadOptions = { enabled: true },\n debug = false,\n } = getSentryConfig(viteConfig);\n\n const cliInstance = new SentryCli(null, {\n authToken,\n org,\n project,\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 (sourceMapsUploadOptions?.enabled ?? (true && viteConfig.build.sourcemap !== false)) {\n // inject debugIds\n try {\n await cliInstance.execute(['sourcemaps', 'inject', reactRouterConfig.buildDirectory], debug);\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 });\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 = sourceMapsUploadOptions?.filesToDeleteAfterUpload;\n // set a default value no option was set\n if (typeof sourceMapsUploadOptions?.filesToDeleteAfterUpload === 'undefined') {\n updatedFilesToDeleteAfterUpload = [`${reactRouterConfig.buildDirectory}/**/*.map`];\n if (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 }\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 if (debug) {\n // This is allowed to fail - we just don't do anything\n // eslint-disable-next-line no-console\n console.debug(`An error occurred while attempting to delete asset: ${filePathToDelete}`, e);\n }\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":[],"mappings":"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"}
@@ -0,0 +1,38 @@
1
+ import { sentryVitePlugin } from '@sentry/vite-plugin';
2
+
3
+ /**
4
+ * Create a custom subset of sentry's vite plugins
5
+ */
6
+ async function makeCustomSentryVitePlugins(options) {
7
+ const { debug, unstable_sentryVitePluginOptions, bundleSizeOptimizations, authToken, org, project, telemetry } =
8
+ options;
9
+
10
+ const sentryVitePlugins = sentryVitePlugin({
11
+ authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,
12
+ bundleSizeOptimizations,
13
+ debug: debug ?? false,
14
+ org: org ?? process.env.SENTRY_ORG,
15
+ project: project ?? process.env.SENTRY_PROJECT,
16
+ telemetry: telemetry ?? true,
17
+ _metaOptions: {
18
+ telemetry: {
19
+ metaFramework: 'react-router',
20
+ },
21
+ },
22
+ // will be handled in buildEnd hook
23
+ sourcemaps: {
24
+ disable: true,
25
+ },
26
+ ...unstable_sentryVitePluginOptions,
27
+ }) ;
28
+
29
+ // only use a subset of the plugins as all upload and file deletion tasks will be handled in the buildEnd hook
30
+ return [
31
+ ...sentryVitePlugins.filter(plugin => {
32
+ return ['sentry-telemetry-plugin', 'sentry-vite-release-injection-plugin'].includes(plugin.name);
33
+ }),
34
+ ];
35
+ }
36
+
37
+ export { makeCustomSentryVitePlugins };
38
+ //# sourceMappingURL=makeCustomSentryVitePlugins.js.map
@@ -0,0 +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 { debug, unstable_sentryVitePluginOptions, bundleSizeOptimizations, authToken, org, project, telemetry } =\n options;\n\n const sentryVitePlugins = sentryVitePlugin({\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 },\n // will be handled in buildEnd hook\n sourcemaps: {\n disable: true,\n },\n ...unstable_sentryVitePluginOptions,\n }) as Plugin[];\n\n // only use a subset of the plugins as all upload and file deletion tasks will be handled in the buildEnd hook\n return [\n ...sentryVitePlugins.filter(plugin => {\n return ['sentry-telemetry-plugin', 'sentry-vite-release-injection-plugin'].includes(plugin.name);\n }),\n ];\n}\n"],"names":[],"mappings":";;AAIA;AACA;AACA;AACO,eAAe,2BAA2B,CAAC,OAAO,EAAoD;AAC7G,EAAE,MAAM,EAAE,KAAK,EAAE,gCAAgC,EAAE,uBAAuB,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,WAAY;AACjH,IAAI,OAAO;;AAEX,EAAE,MAAM,iBAAA,GAAoB,gBAAgB,CAAC;AAC7C,IAAI,SAAS,EAAE,SAAU,IAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB;AACzD,IAAI,uBAAuB;AAC3B,IAAI,KAAK,EAAE,KAAM,IAAG,KAAK;AACzB,IAAI,GAAG,EAAE,GAAI,IAAG,OAAO,CAAC,GAAG,CAAC,UAAU;AACtC,IAAI,OAAO,EAAE,OAAQ,IAAG,OAAO,CAAC,GAAG,CAAC,cAAc;AAClD,IAAI,SAAS,EAAE,SAAU,IAAG,IAAI;AAChC,IAAI,YAAY,EAAE;AAClB,MAAM,SAAS,EAAE;AACjB,QAAQ,aAAa,EAAE,cAAc;AACrC,OAAO;AACP,KAAK;AACL;AACA,IAAI,UAAU,EAAE;AAChB,MAAM,OAAO,EAAE,IAAI;AACnB,KAAK;AACL,IAAI,GAAG,gCAAgC;AACvC,GAAG,CAAE;;AAEL;AACA,EAAE,OAAO;AACT,IAAI,GAAG,iBAAiB,CAAC,MAAM,CAAC,UAAU;AAC1C,MAAM,OAAO,CAAC,yBAAyB,EAAE,sCAAsC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;AACtG,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
@@ -0,0 +1,84 @@
1
+ import { consoleSandbox } from '@sentry/core';
2
+
3
+ /**
4
+ * A Sentry plugin for React Router to enable "hidden" source maps if they are unset.
5
+ */
6
+ function makeEnableSourceMapsPlugin(options) {
7
+ return {
8
+ name: 'sentry-react-router-update-source-map-setting',
9
+ apply: 'build',
10
+ enforce: 'post',
11
+ config(viteConfig) {
12
+ return {
13
+ ...viteConfig,
14
+ build: {
15
+ ...viteConfig.build,
16
+ sourcemap: getUpdatedSourceMapSettings(viteConfig, options),
17
+ },
18
+ };
19
+ },
20
+ };
21
+ }
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
+ ) {
42
+ viteConfig.build = viteConfig.build || {};
43
+
44
+ const viteSourceMap = viteConfig?.build?.sourcemap;
45
+ let updatedSourceMapSetting = viteSourceMap;
46
+
47
+ const settingKey = 'vite.build.sourcemap';
48
+
49
+ if (viteSourceMap === false) {
50
+ updatedSourceMapSetting = viteSourceMap;
51
+
52
+ consoleSandbox(() => {
53
+ // eslint-disable-next-line no-console
54
+ console.warn(
55
+ `[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\`).`,
56
+ );
57
+ });
58
+ } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {
59
+ updatedSourceMapSetting = viteSourceMap;
60
+
61
+ if (sentryPluginOptions?.debug) {
62
+ consoleSandbox(() => {
63
+ // eslint-disable-next-line no-console
64
+ console.log(
65
+ `[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.`,
66
+ );
67
+ });
68
+ }
69
+ } else {
70
+ updatedSourceMapSetting = 'hidden';
71
+
72
+ consoleSandbox(() => {
73
+ // 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
+ );
77
+ });
78
+ }
79
+
80
+ return updatedSourceMapSetting;
81
+ }
82
+
83
+ export { getUpdatedSourceMapSettings, makeEnableSourceMapsPlugin };
84
+ //# sourceMappingURL=makeEnableSourceMapsPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeEnableSourceMapsPlugin.js","sources":["../../../src/vite/makeEnableSourceMapsPlugin.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport 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\n if (viteSourceMap === false) {\n updatedSourceMapSetting = viteSourceMap;\n\n consoleSandbox(() => {\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 });\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n updatedSourceMapSetting = viteSourceMap;\n\n if (sentryPluginOptions?.debug) {\n consoleSandbox(() => {\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 });\n }\n } else {\n updatedSourceMapSetting = 'hidden';\n\n consoleSandbox(() => {\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\n return updatedSourceMapSetting;\n}\n"],"names":[],"mappings":";;AAIA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,OAAO,EAAyC;AAC3F,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,+CAA+C;AACzD,IAAI,KAAK,EAAE,OAAO;AAClB,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,MAAM,CAAC,UAAU,EAAE;AACvB,MAAM,OAAO;AACb,QAAQ,GAAG,UAAU;AACrB,QAAQ,KAAK,EAAE;AACf,UAAU,GAAG,UAAU,CAAC,KAAK;AAC7B,UAAU,SAAS,EAAE,2BAA2B,CAAC,UAAU,EAAE,OAAO,CAAC;AACrE,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,2BAA2B;AAC3C,EAAE,UAAU;AACZ,EAAE,mBAAmB;AACrB,EAAiC;AACjC,EAAE,UAAU,CAAC,KAAM,GAAE,UAAU,CAAC,KAAA,IAAS,EAAE;;AAE3C,EAAE,MAAM,aAAc,GAAE,UAAU,EAAE,KAAK,EAAE,SAAS;AACpD,EAAE,IAAI,uBAAwB,GAAE,aAAa;;AAE7C,EAAE,MAAM,UAAW,GAAE,sBAAsB;;AAE3C,EAAE,IAAI,aAAc,KAAI,KAAK,EAAE;AAC/B,IAAI,uBAAA,GAA0B,aAAa;;AAE3C,IAAI,cAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,IAAI;AAClB,QAAQ,CAAC,mFAAmF,EAAE,UAAU,CAAC,2QAA2Q,EAAE,UAAU,CAAC,wCAAwC,CAAC;AAC1a,OAAO;AACP,KAAK,CAAC;AACN,SAAS,IAAI,aAAc,IAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;AAClF,IAAI,uBAAA,GAA0B,aAAa;;AAE3C,IAAI,IAAI,mBAAmB,EAAE,KAAK,EAAE;AACpC,MAAM,cAAc,CAAC,MAAM;AAC3B;AACA,QAAQ,OAAO,CAAC,GAAG;AACnB,UAAU,CAAC,yBAAyB,EAAE,UAAU,CAAC,eAAe,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,4GAA4G,CAAC;AACxM,SAAS;AACT,OAAO,CAAC;AACR;AACA,SAAS;AACT,IAAI,uBAAA,GAA0B,QAAQ;;AAEtC,IAAI,cAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,CAAC,mEAAmE,EAAE,UAAU,CAAC,kFAAkF,CAAC;AAC5K,OAAO;AACP,KAAK,CAAC;AACN;;AAEA,EAAE,OAAO,uBAAuB;AAChC;;;;"}
@@ -0,0 +1,26 @@
1
+ import { makeCustomSentryVitePlugins } from './makeCustomSentryVitePlugins.js';
2
+ import { makeEnableSourceMapsPlugin } from './makeEnableSourceMapsPlugin.js';
3
+
4
+ /**
5
+ * A Vite plugin for Sentry that handles source map uploads and bundle size optimizations.
6
+ *
7
+ * @param options - Configuration options for the Sentry Vite plugin
8
+ * @param viteConfig - The Vite user config object
9
+ * @returns An array of Vite plugins
10
+ */
11
+ async function sentryReactRouter(
12
+ options = {},
13
+ config,
14
+ ) {
15
+ const plugins = [];
16
+
17
+ if (process.env.NODE_ENV !== 'development' && config.command === 'build' && config.mode !== 'development') {
18
+ plugins.push(makeEnableSourceMapsPlugin(options));
19
+ plugins.push(...(await makeCustomSentryVitePlugins(options)));
20
+ }
21
+
22
+ return plugins;
23
+ }
24
+
25
+ export { sentryReactRouter };
26
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["../../../src/vite/plugin.ts"],"sourcesContent":["import type { ConfigEnv } from 'vite';\nimport { type Plugin } from 'vite';\nimport { makeCustomSentryVitePlugins } from './makeCustomSentryVitePlugins';\nimport { makeEnableSourceMapsPlugin } from './makeEnableSourceMapsPlugin';\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 config: ConfigEnv,\n): Promise<Plugin[]> {\n const plugins: Plugin[] = [];\n\n if (process.env.NODE_ENV !== 'development' && config.command === 'build' && config.mode !== 'development') {\n plugins.push(makeEnableSourceMapsPlugin(options));\n plugins.push(...(await makeCustomSentryVitePlugins(options)));\n }\n\n return plugins;\n}\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,iBAAiB;AACvC,EAAE,OAAO,GAAkC,EAAE;AAC7C,EAAE,MAAM;AACR,EAAqB;AACrB,EAAE,MAAM,OAAO,GAAa,EAAE;;AAE9B,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAA,KAAa,aAAc,IAAG,MAAM,CAAC,OAAA,KAAY,OAAQ,IAAG,MAAM,CAAC,IAAA,KAAS,aAAa,EAAE;AAC7G,IAAI,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;AACrD,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,MAAM,2BAA2B,CAAC,OAAO,CAAC,CAAC,CAAC;AACjE;;AAEA,EAAE,OAAO,OAAO;AAChB;;;;"}
@@ -0,0 +1,3 @@
1
+ export * from '@sentry/browser';
2
+ export { init } from './sdk';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { BrowserOptions } from '@sentry/browser';
2
+ import type { Client } from '@sentry/core';
3
+ /**
4
+ * Initializes the client side of the React Router SDK.
5
+ */
6
+ export declare function init(options: BrowserOptions): Client | undefined;
7
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/client/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAYhE"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
3
+ *
4
+ * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
5
+ */
6
+ export declare const DEBUG_BUILD: boolean;
7
+ //# sourceMappingURL=debug-build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-build.d.ts","sourceRoot":"","sources":["../../../src/common/debug-build.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,WAAW,SAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './client';
2
+ //# sourceMappingURL=index.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../src/index.client.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './server';
2
+ export * from './vite';
3
+ //# sourceMappingURL=index.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../src/index.server.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,13 @@
1
+ export * from './client';
2
+ export * from './server';
3
+ export * from './vite';
4
+ import type { Integration, Options, StackParser } from '@sentry/core';
5
+ import type * as clientSdk from './client';
6
+ import type * as serverSdk from './server';
7
+ /** Initializes Sentry React Router SDK */
8
+ export declare function init(options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions): void;
9
+ export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
10
+ export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
11
+ export declare const defaultStackParser: StackParser;
12
+ export declare const getDefaultIntegrations: (options: Options) => Integration[];
13
+ //# sourceMappingURL=index.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../../src/index.types.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AAEvB,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,KAAK,SAAS,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,KAAK,SAAS,MAAM,UAAU,CAAC;AAE3C,0CAA0C;AAC1C,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC,cAAc,GAAG,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC;AAExG,MAAM,CAAC,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,SAAS,CAAC,uBAAuB,CAAC;AACvF,MAAM,CAAC,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,SAAS,CAAC,uBAAuB,CAAC;AACvF,MAAM,CAAC,OAAO,CAAC,MAAM,kBAAkB,EAAE,WAAW,CAAC;AACrD,MAAM,CAAC,OAAO,CAAC,MAAM,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,WAAW,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from '@sentry/node';
2
+ export { init } from './sdk';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { NodeClient, NodeOptions } from '@sentry/node';
2
+ /**
3
+ * Initializes the server side of the React Router SDK
4
+ */
5
+ export declare function init(options: NodeOptions): NodeClient | undefined;
6
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/server/sdk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG5D;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS,CAYjE"}
@@ -0,0 +1,10 @@
1
+ import type { Config } from '@react-router/dev/dist/config';
2
+ type BuildEndHook = NonNullable<Config['buildEnd']>;
3
+ /**
4
+ * A build end hook that handles Sentry release creation and source map uploads.
5
+ * It creates a new Sentry release if configured, uploads source maps to Sentry,
6
+ * and optionally deletes the source map files after upload.
7
+ */
8
+ export declare const sentryOnBuildEnd: BuildEndHook;
9
+ export {};
10
+ //# sourceMappingURL=handleOnBuildEnd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleOnBuildEnd.d.ts","sourceRoot":"","sources":["../../../../src/vite/buildEnd/handleOnBuildEnd.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAK5D,KAAK,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;AAWpD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,YA0F9B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { sentryReactRouter } from './plugin';
2
+ export { sentryOnBuildEnd } from './buildEnd/handleOnBuildEnd';
3
+ export type { SentryReactRouterBuildOptions } from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,YAAY,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type Plugin } from 'vite';
2
+ import type { SentryReactRouterBuildOptions } from './types';
3
+ /**
4
+ * Create a custom subset of sentry's vite plugins
5
+ */
6
+ export declare function makeCustomSentryVitePlugins(options: SentryReactRouterBuildOptions): Promise<Plugin[]>;
7
+ //# sourceMappingURL=makeCustomSentryVitePlugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeCustomSentryVitePlugins.d.ts","sourceRoot":"","sources":["../../../src/vite/makeCustomSentryVitePlugins.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAE7D;;GAEG;AACH,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA6B3G"}
@@ -0,0 +1,23 @@
1
+ import type { Plugin, UserConfig } from 'vite';
2
+ import type { SentryReactRouterBuildOptions } from './types';
3
+ /**
4
+ * A Sentry plugin for React Router to enable "hidden" source maps if they are unset.
5
+ */
6
+ export declare function makeEnableSourceMapsPlugin(options: SentryReactRouterBuildOptions): Plugin;
7
+ /** There are 3 ways to set up source map generation
8
+ *
9
+ * 1. User explicitly disabled source maps
10
+ * - keep this setting (emit a warning that errors won't be unminified in Sentry)
11
+ * - we won't upload anything
12
+ *
13
+ * 2. Users enabled source map generation (true, 'hidden', 'inline').
14
+ * - keep this setting (don't do anything - like deletion - besides uploading)
15
+ *
16
+ * 3. Users didn't set source maps generation
17
+ * - we enable 'hidden' source maps generation
18
+ * - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)
19
+ *
20
+ * --> only exported for testing
21
+ */
22
+ export declare function getUpdatedSourceMapSettings(viteConfig: UserConfig, sentryPluginOptions?: SentryReactRouterBuildOptions): boolean | 'inline' | 'hidden';
23
+ //# sourceMappingURL=makeEnableSourceMapsPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeEnableSourceMapsPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/makeEnableSourceMapsPlugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAE7D;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,6BAA6B,GAAG,MAAM,CAezF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,UAAU,EACtB,mBAAmB,CAAC,EAAE,6BAA6B,GAClD,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAwC/B"}
@@ -0,0 +1,12 @@
1
+ import type { ConfigEnv } from 'vite';
2
+ import { type Plugin } from 'vite';
3
+ import type { SentryReactRouterBuildOptions } from './types';
4
+ /**
5
+ * A Vite plugin for Sentry that handles source map uploads and bundle size optimizations.
6
+ *
7
+ * @param options - Configuration options for the Sentry Vite plugin
8
+ * @param viteConfig - The Vite user config object
9
+ * @returns An array of Vite plugins
10
+ */
11
+ export declare function sentryReactRouter(options: SentryReactRouterBuildOptions | undefined, config: ConfigEnv): Promise<Plugin[]>;
12
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,2CAAoC,EAC3C,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,MAAM,EAAE,CAAC,CASnB"}