@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.
- package/build/cjs/client/createClientInstrumentation.js +104 -175
- package/build/cjs/client/createClientInstrumentation.js.map +1 -1
- package/build/cjs/client/hydratedRouter.js +27 -74
- package/build/cjs/client/hydratedRouter.js.map +1 -1
- package/build/cjs/client/sdk.js +5 -16
- package/build/cjs/client/sdk.js.map +1 -1
- package/build/cjs/client/sentryOnError.js +4 -27
- package/build/cjs/client/sentryOnError.js.map +1 -1
- package/build/cjs/client/tracingIntegration.js +4 -18
- package/build/cjs/client/tracingIntegration.js.map +1 -1
- package/build/cjs/client/utils.js +5 -17
- package/build/cjs/client/utils.js.map +1 -1
- package/build/cjs/cloudflare/index.js +2 -15
- package/build/cjs/cloudflare/index.js.map +1 -1
- package/build/cjs/common/debug-build.js +0 -5
- package/build/cjs/common/debug-build.js.map +1 -1
- package/build/cjs/common/utils.js +8 -33
- package/build/cjs/common/utils.js.map +1 -1
- package/build/cjs/server/createSentryHandleError.js +4 -13
- package/build/cjs/server/createSentryHandleError.js.map +1 -1
- package/build/cjs/server/createSentryHandleRequest.js +14 -49
- package/build/cjs/server/createSentryHandleRequest.js.map +1 -1
- package/build/cjs/server/createServerInstrumentation.js +76 -114
- package/build/cjs/server/createServerInstrumentation.js.map +1 -1
- package/build/cjs/server/getMetaTagTransformer.js +2 -8
- package/build/cjs/server/getMetaTagTransformer.js.map +1 -1
- package/build/cjs/server/instrumentation/reactRouter.js +21 -47
- package/build/cjs/server/instrumentation/reactRouter.js.map +1 -1
- package/build/cjs/server/instrumentation/util.js +5 -41
- package/build/cjs/server/instrumentation/util.js.map +1 -1
- package/build/cjs/server/integration/lowQualityTransactionsFilterIntegration.js +5 -12
- package/build/cjs/server/integration/lowQualityTransactionsFilterIntegration.js.map +1 -1
- package/build/cjs/server/integration/reactRouterServer.js +10 -42
- package/build/cjs/server/integration/reactRouterServer.js.map +1 -1
- package/build/cjs/server/sdk.js +6 -20
- package/build/cjs/server/sdk.js.map +1 -1
- package/build/cjs/server/serverBuild.js +6 -31
- package/build/cjs/server/serverBuild.js.map +1 -1
- package/build/cjs/server/serverGlobals.js +6 -26
- package/build/cjs/server/serverGlobals.js.map +1 -1
- package/build/cjs/server/wrapSentryHandleRequest.js +13 -53
- package/build/cjs/server/wrapSentryHandleRequest.js.map +1 -1
- package/build/cjs/server/wrapServerAction.js +12 -44
- package/build/cjs/server/wrapServerAction.js.map +1 -1
- package/build/cjs/server/wrapServerLoader.js +12 -44
- package/build/cjs/server/wrapServerLoader.js.map +1 -1
- package/build/cjs/vite/buildEnd/handleOnBuildEnd.js +38 -72
- package/build/cjs/vite/buildEnd/handleOnBuildEnd.js.map +1 -1
- package/build/cjs/vite/makeConfigInjectorPlugin.js +4 -12
- package/build/cjs/vite/makeConfigInjectorPlugin.js.map +1 -1
- package/build/cjs/vite/makeCustomSentryVitePlugins.js +10 -15
- package/build/cjs/vite/makeCustomSentryVitePlugins.js.map +1 -1
- package/build/cjs/vite/makeEnableSourceMapsPlugin.js +19 -51
- package/build/cjs/vite/makeEnableSourceMapsPlugin.js.map +1 -1
- package/build/cjs/vite/makeServerBuildCapturePlugin.js +4 -15
- package/build/cjs/vite/makeServerBuildCapturePlugin.js.map +1 -1
- package/build/cjs/vite/plugin.js +3 -16
- package/build/cjs/vite/plugin.js.map +1 -1
- package/build/esm/client/createClientInstrumentation.js +104 -175
- package/build/esm/client/createClientInstrumentation.js.map +1 -1
- package/build/esm/client/hydratedRouter.js +27 -74
- package/build/esm/client/hydratedRouter.js.map +1 -1
- package/build/esm/client/sdk.js +5 -16
- package/build/esm/client/sdk.js.map +1 -1
- package/build/esm/client/sentryOnError.js +4 -27
- package/build/esm/client/sentryOnError.js.map +1 -1
- package/build/esm/client/tracingIntegration.js +4 -18
- package/build/esm/client/tracingIntegration.js.map +1 -1
- package/build/esm/client/utils.js +5 -17
- package/build/esm/client/utils.js.map +1 -1
- package/build/esm/cloudflare/index.js +2 -15
- package/build/esm/cloudflare/index.js.map +1 -1
- package/build/esm/common/debug-build.js +0 -5
- package/build/esm/common/debug-build.js.map +1 -1
- package/build/esm/common/utils.js +8 -33
- package/build/esm/common/utils.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/server/createSentryHandleError.js +4 -13
- package/build/esm/server/createSentryHandleError.js.map +1 -1
- package/build/esm/server/createSentryHandleRequest.js +14 -49
- package/build/esm/server/createSentryHandleRequest.js.map +1 -1
- package/build/esm/server/createServerInstrumentation.js +76 -114
- package/build/esm/server/createServerInstrumentation.js.map +1 -1
- package/build/esm/server/getMetaTagTransformer.js +2 -8
- package/build/esm/server/getMetaTagTransformer.js.map +1 -1
- package/build/esm/server/instrumentation/reactRouter.js +21 -47
- package/build/esm/server/instrumentation/reactRouter.js.map +1 -1
- package/build/esm/server/instrumentation/util.js +5 -41
- package/build/esm/server/instrumentation/util.js.map +1 -1
- package/build/esm/server/integration/lowQualityTransactionsFilterIntegration.js +5 -12
- package/build/esm/server/integration/lowQualityTransactionsFilterIntegration.js.map +1 -1
- package/build/esm/server/integration/reactRouterServer.js +10 -42
- package/build/esm/server/integration/reactRouterServer.js.map +1 -1
- package/build/esm/server/sdk.js +6 -20
- package/build/esm/server/sdk.js.map +1 -1
- package/build/esm/server/serverBuild.js +6 -31
- package/build/esm/server/serverBuild.js.map +1 -1
- package/build/esm/server/serverGlobals.js +6 -26
- package/build/esm/server/serverGlobals.js.map +1 -1
- package/build/esm/server/wrapSentryHandleRequest.js +13 -53
- package/build/esm/server/wrapSentryHandleRequest.js.map +1 -1
- package/build/esm/server/wrapServerAction.js +12 -44
- package/build/esm/server/wrapServerAction.js.map +1 -1
- package/build/esm/server/wrapServerLoader.js +12 -44
- package/build/esm/server/wrapServerLoader.js.map +1 -1
- package/build/esm/vite/buildEnd/handleOnBuildEnd.js +38 -72
- package/build/esm/vite/buildEnd/handleOnBuildEnd.js.map +1 -1
- package/build/esm/vite/makeConfigInjectorPlugin.js +4 -12
- package/build/esm/vite/makeConfigInjectorPlugin.js.map +1 -1
- package/build/esm/vite/makeCustomSentryVitePlugins.js +10 -15
- package/build/esm/vite/makeCustomSentryVitePlugins.js.map +1 -1
- package/build/esm/vite/makeEnableSourceMapsPlugin.js +19 -51
- package/build/esm/vite/makeEnableSourceMapsPlugin.js.map +1 -1
- package/build/esm/vite/makeServerBuildCapturePlugin.js +4 -15
- package/build/esm/vite/makeServerBuildCapturePlugin.js.map +1 -1
- package/build/esm/vite/plugin.js +3 -16
- package/build/esm/vite/plugin.js.map +1 -1
- package/build/types/client/hydratedRouter.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -3,144 +3,110 @@ import SentryCli from '@sentry/cli';
|
|
|
3
3
|
import { glob } from 'glob';
|
|
4
4
|
|
|
5
5
|
function getSentryConfig(viteConfig) {
|
|
6
|
-
if (!viteConfig || typeof viteConfig !==
|
|
7
|
-
|
|
8
|
-
console.error('[Sentry] sentryConfig not found - it needs to be passed to vite.config.ts');
|
|
6
|
+
if (!viteConfig || typeof viteConfig !== "object" || !("sentryConfig" in viteConfig)) {
|
|
7
|
+
console.error("[Sentry] sentryConfig not found - it needs to be passed to vite.config.ts");
|
|
9
8
|
}
|
|
10
|
-
|
|
11
|
-
return (viteConfig ).sentryConfig;
|
|
9
|
+
return viteConfig.sentryConfig;
|
|
12
10
|
}
|
|
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
11
|
const sentryOnBuildEnd = async ({ reactRouterConfig, viteConfig }) => {
|
|
20
12
|
const sentryConfig = getSentryConfig(viteConfig);
|
|
21
|
-
|
|
22
|
-
// todo(v11): Remove deprecated sourceMapsUploadOptions support (no need for spread/pick anymore)
|
|
23
13
|
const {
|
|
24
|
-
sourceMapsUploadOptions,
|
|
14
|
+
sourceMapsUploadOptions,
|
|
15
|
+
// extract to exclude from rest config
|
|
25
16
|
...sentryConfigWithoutDeprecatedSourceMapOption
|
|
26
17
|
} = sentryConfig;
|
|
27
|
-
|
|
28
18
|
const unstableSentryVitePluginOptions = sentryConfig.unstable_sentryVitePluginOptions;
|
|
29
|
-
|
|
30
19
|
const {
|
|
31
20
|
authToken,
|
|
32
21
|
org,
|
|
33
22
|
project,
|
|
34
23
|
release,
|
|
35
24
|
sourcemaps = { disable: false },
|
|
36
|
-
debug = false
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
= {
|
|
25
|
+
debug = false
|
|
26
|
+
} = {
|
|
40
27
|
...unstableSentryVitePluginOptions,
|
|
41
|
-
...sentryConfigWithoutDeprecatedSourceMapOption,
|
|
28
|
+
...sentryConfigWithoutDeprecatedSourceMapOption,
|
|
29
|
+
// spread in the config without the deprecated sourceMapsUploadOptions
|
|
42
30
|
sourcemaps: {
|
|
43
31
|
...unstableSentryVitePluginOptions?.sourcemaps,
|
|
44
32
|
...sentryConfig.sourcemaps,
|
|
45
33
|
...sourceMapsUploadOptions,
|
|
46
34
|
// eslint-disable-next-line deprecation/deprecation
|
|
47
|
-
disable: sourceMapsUploadOptions?.enabled === false ? true : sentryConfig.sourcemaps?.disable
|
|
35
|
+
disable: sourceMapsUploadOptions?.enabled === false ? true : sentryConfig.sourcemaps?.disable
|
|
48
36
|
},
|
|
49
37
|
release: {
|
|
50
38
|
...unstableSentryVitePluginOptions?.release,
|
|
51
|
-
...sentryConfig.release
|
|
39
|
+
...sentryConfig.release
|
|
52
40
|
},
|
|
53
|
-
project: unstableSentryVitePluginOptions?.project
|
|
54
|
-
? Array.isArray(unstableSentryVitePluginOptions?.project)
|
|
55
|
-
? unstableSentryVitePluginOptions?.project[0]
|
|
56
|
-
: unstableSentryVitePluginOptions?.project
|
|
57
|
-
: sentryConfigWithoutDeprecatedSourceMapOption.project,
|
|
41
|
+
project: unstableSentryVitePluginOptions?.project ? Array.isArray(unstableSentryVitePluginOptions?.project) ? unstableSentryVitePluginOptions?.project[0] : unstableSentryVitePluginOptions?.project : sentryConfigWithoutDeprecatedSourceMapOption.project
|
|
58
42
|
};
|
|
59
|
-
|
|
60
43
|
const cliInstance = new SentryCli(null, {
|
|
61
44
|
authToken,
|
|
62
45
|
org,
|
|
63
46
|
...sentryConfig.unstable_sentryVitePluginOptions,
|
|
64
47
|
// 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
|
|
65
|
-
project: Array.isArray(project) ? project[0] : project
|
|
48
|
+
project: Array.isArray(project) ? project[0] : project
|
|
66
49
|
});
|
|
67
|
-
|
|
68
|
-
// check if release should be created
|
|
69
50
|
if (release?.name) {
|
|
70
51
|
try {
|
|
71
52
|
await cliInstance.releases.new(release.name);
|
|
72
53
|
} catch (error) {
|
|
73
|
-
|
|
74
|
-
console.error('[Sentry] Could not create release', error);
|
|
54
|
+
console.error("[Sentry] Could not create release", error);
|
|
75
55
|
}
|
|
76
56
|
}
|
|
77
|
-
|
|
78
57
|
if (!sourcemaps?.disable && viteConfig.build.sourcemap !== false) {
|
|
79
|
-
// inject debugIds
|
|
80
58
|
try {
|
|
81
59
|
await cliInstance.execute(
|
|
82
|
-
[
|
|
83
|
-
debug ?
|
|
60
|
+
["sourcemaps", "inject", reactRouterConfig.buildDirectory],
|
|
61
|
+
debug ? "rejectOnError" : false
|
|
84
62
|
);
|
|
85
63
|
} catch (error) {
|
|
86
|
-
|
|
87
|
-
console.error('[Sentry] Could not inject debug ids', error);
|
|
64
|
+
console.error("[Sentry] Could not inject debug ids", error);
|
|
88
65
|
}
|
|
89
|
-
|
|
90
|
-
// upload sourcemaps
|
|
91
66
|
try {
|
|
92
|
-
await cliInstance.releases.uploadSourceMaps(release?.name ||
|
|
67
|
+
await cliInstance.releases.uploadSourceMaps(release?.name || "undefined", {
|
|
93
68
|
include: [
|
|
94
69
|
{
|
|
95
|
-
paths: [reactRouterConfig.buildDirectory]
|
|
96
|
-
}
|
|
70
|
+
paths: [reactRouterConfig.buildDirectory]
|
|
71
|
+
}
|
|
97
72
|
],
|
|
98
|
-
live:
|
|
73
|
+
live: "rejectOnError"
|
|
99
74
|
});
|
|
100
75
|
} catch (error) {
|
|
101
|
-
|
|
102
|
-
console.error('[Sentry] Could not upload sourcemaps', error);
|
|
76
|
+
console.error("[Sentry] Could not upload sourcemaps", error);
|
|
103
77
|
}
|
|
104
78
|
}
|
|
105
|
-
// delete sourcemaps after upload
|
|
106
79
|
let updatedFilesToDeleteAfterUpload = await sourcemaps?.filesToDeleteAfterUpload;
|
|
107
|
-
|
|
108
|
-
// set a default value no option was set
|
|
109
|
-
if (typeof updatedFilesToDeleteAfterUpload === 'undefined') {
|
|
80
|
+
if (typeof updatedFilesToDeleteAfterUpload === "undefined") {
|
|
110
81
|
updatedFilesToDeleteAfterUpload = [`${reactRouterConfig.buildDirectory}/**/*.map`];
|
|
111
|
-
debug &&
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
);
|
|
82
|
+
debug && // eslint-disable-next-line no-console
|
|
83
|
+
console.info(
|
|
84
|
+
`[Sentry] Automatically setting \`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(
|
|
85
|
+
updatedFilesToDeleteAfterUpload
|
|
86
|
+
)}\` to delete generated source maps after they were uploaded to Sentry.`
|
|
87
|
+
);
|
|
118
88
|
}
|
|
119
89
|
if (updatedFilesToDeleteAfterUpload) {
|
|
120
90
|
try {
|
|
121
91
|
const filePathsToDelete = await glob(updatedFilesToDeleteAfterUpload, {
|
|
122
92
|
absolute: true,
|
|
123
|
-
nodir: true
|
|
93
|
+
nodir: true
|
|
124
94
|
});
|
|
125
95
|
if (debug) {
|
|
126
|
-
filePathsToDelete.forEach(filePathToDelete => {
|
|
127
|
-
// eslint-disable-next-line no-console
|
|
96
|
+
filePathsToDelete.forEach((filePathToDelete) => {
|
|
128
97
|
console.info(`Deleting asset after upload: ${filePathToDelete}`);
|
|
129
98
|
});
|
|
130
99
|
}
|
|
131
100
|
await Promise.all(
|
|
132
|
-
filePathsToDelete.map(
|
|
133
|
-
rm(filePathToDelete, { force: true }).catch((e) => {
|
|
134
|
-
|
|
135
|
-
debug
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}),
|
|
139
|
-
),
|
|
101
|
+
filePathsToDelete.map(
|
|
102
|
+
(filePathToDelete) => rm(filePathToDelete, { force: true }).catch((e) => {
|
|
103
|
+
debug && // eslint-disable-next-line no-console
|
|
104
|
+
console.debug(`An error occurred while attempting to delete asset: ${filePathToDelete}`, e);
|
|
105
|
+
})
|
|
106
|
+
)
|
|
140
107
|
);
|
|
141
108
|
} catch (error) {
|
|
142
|
-
|
|
143
|
-
console.error('Error deleting files after sourcemap upload:', error);
|
|
109
|
+
console.error("Error deleting files after sourcemap upload:", error);
|
|
144
110
|
}
|
|
145
111
|
}
|
|
146
112
|
};
|
|
@@ -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":[],"mappings":";;;;AASA,SAAS,
|
|
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":[],"mappings":"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"}
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates a Vite plugin that injects the Sentry options into the global Vite config.
|
|
3
|
-
* This ensures the sentryConfig is available to other components that need access to it,
|
|
4
|
-
* like the buildEnd hook.
|
|
5
|
-
*
|
|
6
|
-
* @param options - Configuration options for the Sentry Vite plugin
|
|
7
|
-
* @returns A Vite plugin that injects sentryConfig into the global config
|
|
8
|
-
*/
|
|
9
1
|
function makeConfigInjectorPlugin(options) {
|
|
10
2
|
return {
|
|
11
|
-
name:
|
|
12
|
-
enforce:
|
|
3
|
+
name: "sentry-react-router-config-injector",
|
|
4
|
+
enforce: "pre",
|
|
13
5
|
config(config) {
|
|
14
6
|
return {
|
|
15
7
|
...config,
|
|
16
|
-
sentryConfig: options
|
|
8
|
+
sentryConfig: options
|
|
17
9
|
};
|
|
18
|
-
}
|
|
10
|
+
}
|
|
19
11
|
};
|
|
20
12
|
}
|
|
21
13
|
|
|
@@ -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":"
|
|
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;;;;"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { sentryVitePlugin } from '@sentry/vite-plugin';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Create a custom subset of sentry's vite plugins
|
|
5
|
-
*/
|
|
6
3
|
async function makeCustomSentryVitePlugins(options) {
|
|
7
4
|
const {
|
|
8
5
|
debug,
|
|
@@ -14,9 +11,8 @@ async function makeCustomSentryVitePlugins(options) {
|
|
|
14
11
|
project,
|
|
15
12
|
telemetry,
|
|
16
13
|
reactComponentAnnotation,
|
|
17
|
-
release
|
|
14
|
+
release
|
|
18
15
|
} = options;
|
|
19
|
-
|
|
20
16
|
const sentryVitePlugins = sentryVitePlugin({
|
|
21
17
|
applicationKey,
|
|
22
18
|
authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,
|
|
@@ -27,27 +23,26 @@ async function makeCustomSentryVitePlugins(options) {
|
|
|
27
23
|
telemetry: telemetry ?? true,
|
|
28
24
|
_metaOptions: {
|
|
29
25
|
telemetry: {
|
|
30
|
-
metaFramework:
|
|
26
|
+
metaFramework: "react-router"
|
|
31
27
|
},
|
|
32
|
-
...unstable_sentryVitePluginOptions?._metaOptions
|
|
28
|
+
...unstable_sentryVitePluginOptions?._metaOptions
|
|
33
29
|
},
|
|
34
30
|
reactComponentAnnotation: {
|
|
35
|
-
enabled: reactComponentAnnotation?.enabled ??
|
|
36
|
-
ignoredComponents: reactComponentAnnotation?.ignoredComponents ??
|
|
37
|
-
...unstable_sentryVitePluginOptions?.reactComponentAnnotation
|
|
31
|
+
enabled: reactComponentAnnotation?.enabled ?? void 0,
|
|
32
|
+
ignoredComponents: reactComponentAnnotation?.ignoredComponents ?? void 0,
|
|
33
|
+
...unstable_sentryVitePluginOptions?.reactComponentAnnotation
|
|
38
34
|
},
|
|
39
35
|
release: {
|
|
40
36
|
...unstable_sentryVitePluginOptions?.release,
|
|
41
|
-
...release
|
|
37
|
+
...release
|
|
42
38
|
},
|
|
43
39
|
// will be handled in buildEnd hook
|
|
44
40
|
sourcemaps: {
|
|
45
41
|
disable: true,
|
|
46
|
-
...unstable_sentryVitePluginOptions?.sourcemaps
|
|
42
|
+
...unstable_sentryVitePluginOptions?.sourcemaps
|
|
47
43
|
},
|
|
48
|
-
...unstable_sentryVitePluginOptions
|
|
49
|
-
})
|
|
50
|
-
|
|
44
|
+
...unstable_sentryVitePluginOptions
|
|
45
|
+
});
|
|
51
46
|
return sentryVitePlugins;
|
|
52
47
|
}
|
|
53
48
|
|
|
@@ -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":[],"mappings":";;
|
|
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":[],"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,oBAAoB,gBAAA,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,79 +1,47 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A Sentry plugin for React Router to enable "hidden" source maps if they are unset.
|
|
3
|
-
*/
|
|
4
1
|
function makeEnableSourceMapsPlugin(options) {
|
|
5
2
|
return {
|
|
6
|
-
name:
|
|
7
|
-
apply:
|
|
8
|
-
enforce:
|
|
3
|
+
name: "sentry-react-router-update-source-map-setting",
|
|
4
|
+
apply: "build",
|
|
5
|
+
enforce: "post",
|
|
9
6
|
config(viteConfig) {
|
|
10
7
|
return {
|
|
11
8
|
...viteConfig,
|
|
12
9
|
build: {
|
|
13
10
|
...viteConfig.build,
|
|
14
|
-
sourcemap: getUpdatedSourceMapSettings(viteConfig, options)
|
|
15
|
-
}
|
|
11
|
+
sourcemap: getUpdatedSourceMapSettings(viteConfig, options)
|
|
12
|
+
}
|
|
16
13
|
};
|
|
17
|
-
}
|
|
14
|
+
}
|
|
18
15
|
};
|
|
19
16
|
}
|
|
20
|
-
|
|
21
|
-
/** There are 3 ways to set up source map generation
|
|
22
|
-
*
|
|
23
|
-
* 1. User explicitly disabled source maps
|
|
24
|
-
* - keep this setting (emit a warning that errors won't be unminified in Sentry)
|
|
25
|
-
* - we won't upload anything
|
|
26
|
-
*
|
|
27
|
-
* 2. Users enabled source map generation (true, 'hidden', 'inline').
|
|
28
|
-
* - keep this setting (don't do anything - like deletion - besides uploading)
|
|
29
|
-
*
|
|
30
|
-
* 3. Users didn't set source maps generation
|
|
31
|
-
* - we enable 'hidden' source maps generation
|
|
32
|
-
* - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)
|
|
33
|
-
*
|
|
34
|
-
* --> only exported for testing
|
|
35
|
-
*/
|
|
36
|
-
function getUpdatedSourceMapSettings(
|
|
37
|
-
viteConfig,
|
|
38
|
-
sentryPluginOptions,
|
|
39
|
-
) {
|
|
17
|
+
function getUpdatedSourceMapSettings(viteConfig, sentryPluginOptions) {
|
|
40
18
|
viteConfig.build = viteConfig.build || {};
|
|
41
|
-
|
|
42
19
|
const viteSourceMap = viteConfig?.build?.sourcemap;
|
|
43
20
|
let updatedSourceMapSetting = viteSourceMap;
|
|
44
|
-
|
|
45
|
-
const settingKey = 'vite.build.sourcemap';
|
|
21
|
+
const settingKey = "vite.build.sourcemap";
|
|
46
22
|
const debug = sentryPluginOptions?.debug;
|
|
47
|
-
|
|
48
23
|
if (viteSourceMap === false) {
|
|
49
24
|
updatedSourceMapSetting = viteSourceMap;
|
|
50
|
-
|
|
51
25
|
if (debug) {
|
|
52
|
-
// Longer debug message with more details
|
|
53
|
-
// eslint-disable-next-line no-console
|
|
54
26
|
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\`)
|
|
27
|
+
`[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
28
|
);
|
|
57
29
|
} else {
|
|
58
|
-
|
|
59
|
-
console.warn('[Sentry] Source map generation is disabled in your Vite configuration.');
|
|
30
|
+
console.warn("[Sentry] Source map generation is disabled in your Vite configuration.");
|
|
60
31
|
}
|
|
61
|
-
} else if (viteSourceMap && [
|
|
32
|
+
} else if (viteSourceMap && ["hidden", "inline", true].includes(viteSourceMap)) {
|
|
62
33
|
updatedSourceMapSetting = viteSourceMap;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`[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.`,
|
|
68
|
-
);
|
|
34
|
+
debug && // eslint-disable-next-line no-console
|
|
35
|
+
console.log(
|
|
36
|
+
`[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.`
|
|
37
|
+
);
|
|
69
38
|
} else {
|
|
70
|
-
updatedSourceMapSetting =
|
|
39
|
+
updatedSourceMapSetting = "hidden";
|
|
71
40
|
debug && // eslint-disable-next-line no-console
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
41
|
+
console.log(
|
|
42
|
+
`[Sentry] Enabled source map generation in the build options with \`${settingKey}: 'hidden'\`. The source maps will be deleted after they were uploaded to Sentry.`
|
|
43
|
+
);
|
|
75
44
|
}
|
|
76
|
-
|
|
77
45
|
return updatedSourceMapSetting;
|
|
78
46
|
}
|
|
79
47
|
|
|
@@ -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":"
|
|
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;;;;"}
|
|
@@ -1,39 +1,28 @@
|
|
|
1
1
|
import { GLOBAL_KEY } from '../server/serverBuild.js';
|
|
2
2
|
|
|
3
|
-
const SERVER_BUILD_MODULE_ID =
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A Sentry plugin for React Router to capture the server build for middleware name resolution.
|
|
7
|
-
*/
|
|
3
|
+
const SERVER_BUILD_MODULE_ID = "virtual:react-router/server-build";
|
|
8
4
|
function makeServerBuildCapturePlugin() {
|
|
9
5
|
let isSsrBuild = false;
|
|
10
|
-
|
|
11
6
|
return {
|
|
12
|
-
name:
|
|
13
|
-
enforce:
|
|
14
|
-
|
|
7
|
+
name: "sentry-react-router-server-build-capture",
|
|
8
|
+
enforce: "post",
|
|
15
9
|
configResolved(config) {
|
|
16
10
|
isSsrBuild = !!config.build.ssr;
|
|
17
11
|
},
|
|
18
|
-
|
|
19
12
|
transform(code, id) {
|
|
20
13
|
if (!isSsrBuild) {
|
|
21
14
|
return null;
|
|
22
15
|
}
|
|
23
|
-
|
|
24
16
|
if (!id.includes(SERVER_BUILD_MODULE_ID)) {
|
|
25
17
|
return null;
|
|
26
18
|
}
|
|
27
|
-
|
|
28
|
-
// `routes` is a module-scope export in the virtual:react-router/server-build module
|
|
29
19
|
const injectedCode = `${code}
|
|
30
20
|
if (typeof globalThis !== 'undefined' && typeof globalThis["${GLOBAL_KEY}"] === 'function') {
|
|
31
21
|
globalThis["${GLOBAL_KEY}"]({ routes });
|
|
32
22
|
}
|
|
33
23
|
`;
|
|
34
|
-
|
|
35
24
|
return { code: injectedCode, map: null };
|
|
36
|
-
}
|
|
25
|
+
}
|
|
37
26
|
};
|
|
38
27
|
}
|
|
39
28
|
|
|
@@ -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":[],"mappings":";;AAGA,MAAM,sBAAA,GAAyB,
|
|
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":[],"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,EAC4B,UAAU,CAAA;AAAA,cAAA,EACxD,UAAU,CAAA;AAAA;AAAA,CAAA;AAIpB,MAAA,OAAO,EAAE,IAAA,EAAM,YAAA,EAAc,GAAA,EAAK,IAAA,EAAK;AAAA,IACzC;AAAA,GACF;AACF;;;;"}
|
package/build/esm/vite/plugin.js
CHANGED
|
@@ -3,27 +3,14 @@ import { makeCustomSentryVitePlugins } from './makeCustomSentryVitePlugins.js';
|
|
|
3
3
|
import { makeEnableSourceMapsPlugin } from './makeEnableSourceMapsPlugin.js';
|
|
4
4
|
import { makeServerBuildCapturePlugin } from './makeServerBuildCapturePlugin.js';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* A Vite plugin for Sentry that handles source map uploads and bundle size optimizations.
|
|
8
|
-
*
|
|
9
|
-
* @param options - Configuration options for the Sentry Vite plugin
|
|
10
|
-
* @param viteConfig - The Vite user config object
|
|
11
|
-
* @returns An array of Vite plugins
|
|
12
|
-
*/
|
|
13
|
-
async function sentryReactRouter(
|
|
14
|
-
options = {},
|
|
15
|
-
viteConfig,
|
|
16
|
-
) {
|
|
6
|
+
async function sentryReactRouter(options = {}, viteConfig) {
|
|
17
7
|
const plugins = [];
|
|
18
|
-
|
|
19
8
|
plugins.push(makeConfigInjectorPlugin(options));
|
|
20
9
|
plugins.push(makeServerBuildCapturePlugin());
|
|
21
|
-
|
|
22
|
-
if (process.env.NODE_ENV !== 'development' && viteConfig.command === 'build' && viteConfig.mode !== 'development') {
|
|
10
|
+
if (process.env.NODE_ENV !== "development" && viteConfig.command === "build" && viteConfig.mode !== "development") {
|
|
23
11
|
plugins.push(makeEnableSourceMapsPlugin(options));
|
|
24
|
-
plugins.push(...
|
|
12
|
+
plugins.push(...await makeCustomSentryVitePlugins(options));
|
|
25
13
|
}
|
|
26
|
-
|
|
27
14
|
return plugins;
|
|
28
15
|
}
|
|
29
16
|
|
|
@@ -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":[],"mappings":";;;;;
|
|
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":[],"mappings":";;;;;AAcA,eAAsB,iBAAA,CACpB,OAAA,GAAyC,EAAC,EAC1C,UAAA,EACmB;AACnB,EAAA,MAAM,UAAoB,EAAC;AAE3B,EAAA,OAAA,CAAQ,IAAA,CAAK,wBAAA,CAAyB,OAAO,CAAC,CAAA;AAC9C,EAAA,OAAA,CAAQ,IAAA,CAAK,8BAA8B,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,CAAK,0BAAA,CAA2B,OAAO,CAAC,CAAA;AAChD,IAAA,OAAA,CAAQ,IAAA,CAAK,GAAI,MAAM,2BAAA,CAA4B,OAAO,CAAE,CAAA;AAAA,EAC9D;AAEA,EAAA,OAAO,OAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydratedRouter.d.ts","sourceRoot":"","sources":["../../../src/client/hydratedRouter.ts"],"names":[],"mappings":"AAwBA;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"hydratedRouter.d.ts","sourceRoot":"","sources":["../../../src/client/hydratedRouter.ts"],"names":[],"mappings":"AAwBA;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CA8E/C"}
|