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