@sentry/solidstart 10.53.0 → 10.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/build/cjs/client/sdk.js +3 -20
  2. package/build/cjs/client/sdk.js.map +1 -1
  3. package/build/cjs/config/addInstrumentation.js +28 -91
  4. package/build/cjs/config/addInstrumentation.js.map +1 -1
  5. package/build/cjs/config/withSentry.js +28 -52
  6. package/build/cjs/config/withSentry.js.map +1 -1
  7. package/build/cjs/config/wrapServerEntryWithDynamicImport.js +52 -170
  8. package/build/cjs/config/wrapServerEntryWithDynamicImport.js.map +1 -1
  9. package/build/cjs/server/middleware.js +11 -22
  10. package/build/cjs/server/middleware.js.map +1 -1
  11. package/build/cjs/server/sdk.js +2 -7
  12. package/build/cjs/server/sdk.js.map +1 -1
  13. package/build/cjs/server/solidrouter.js +1 -20
  14. package/build/cjs/server/solidrouter.js.map +1 -1
  15. package/build/cjs/server/utils.js +6 -24
  16. package/build/cjs/server/utils.js.map +1 -1
  17. package/build/cjs/server/withServerActionInstrumentation.js +14 -31
  18. package/build/cjs/server/withServerActionInstrumentation.js.map +1 -1
  19. package/build/cjs/vite/buildInstrumentationFile.js +12 -22
  20. package/build/cjs/vite/buildInstrumentationFile.js.map +1 -1
  21. package/build/cjs/vite/sentrySolidStartVite.js +3 -15
  22. package/build/cjs/vite/sentrySolidStartVite.js.map +1 -1
  23. package/build/cjs/vite/sourceMaps.js +37 -89
  24. package/build/cjs/vite/sourceMaps.js.map +1 -1
  25. package/build/esm/client/sdk.js +3 -20
  26. package/build/esm/client/sdk.js.map +1 -1
  27. package/build/esm/config/addInstrumentation.js +28 -91
  28. package/build/esm/config/addInstrumentation.js.map +1 -1
  29. package/build/esm/config/withSentry.js +28 -52
  30. package/build/esm/config/withSentry.js.map +1 -1
  31. package/build/esm/config/wrapServerEntryWithDynamicImport.js +52 -170
  32. package/build/esm/config/wrapServerEntryWithDynamicImport.js.map +1 -1
  33. package/build/esm/package.json +1 -1
  34. package/build/esm/server/middleware.js +11 -22
  35. package/build/esm/server/middleware.js.map +1 -1
  36. package/build/esm/server/sdk.js +2 -7
  37. package/build/esm/server/sdk.js.map +1 -1
  38. package/build/esm/server/solidrouter.js +1 -20
  39. package/build/esm/server/solidrouter.js.map +1 -1
  40. package/build/esm/server/utils.js +6 -24
  41. package/build/esm/server/utils.js.map +1 -1
  42. package/build/esm/server/withServerActionInstrumentation.js +14 -31
  43. package/build/esm/server/withServerActionInstrumentation.js.map +1 -1
  44. package/build/esm/vite/buildInstrumentationFile.js +12 -22
  45. package/build/esm/vite/buildInstrumentationFile.js.map +1 -1
  46. package/build/esm/vite/sentrySolidStartVite.js +3 -15
  47. package/build/esm/vite/sentrySolidStartVite.js.map +1 -1
  48. package/build/esm/vite/sourceMaps.js +37 -89
  49. package/build/esm/vite/sourceMaps.js.map +1 -1
  50. package/build/types/config/withSentry.d.ts.map +1 -1
  51. package/package.json +4 -4
@@ -1,25 +1,9 @@
1
1
  import { consoleSandbox } from '@sentry/core';
2
2
 
3
- /** THIS FILE IS AN UTILITY FOR NITRO-BASED PACKAGES AND SHOULD BE KEPT IN SYNC IN NUXT, SOLIDSTART, ETC. */
4
-
5
- const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';
6
- const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';
7
- const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';
8
- const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';
9
-
10
- /**
11
- * A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first
12
- * by using a regular `import` and load the server after that.
13
- * This also works with serverless `handler` functions, as it re-exports the `handler`.
14
- *
15
- * @param config Configuration options for the Rollup Plugin
16
- * @param config.serverConfigFileName Name of the Sentry server config (without file extension). E.g. 'sentry.server.config'
17
- * @param config.serverEntrypointFileName The server entrypoint (with file extension). Usually, this is defined by the Nitro preset and is something like 'node-server.mjs'
18
- * @param config.resolvedServerConfigPath Resolved path of the Sentry server config (based on `src` directory)
19
- * @param config.entryPointWrappedFunctions Exported bindings of the server entry file, which are wrapped as async function. E.g. ['default', 'handler', 'server']
20
- * @param config.additionalImports Adds additional imports to the entry file. Can be e.g. 'import-in-the-middle/hook.mjs'
21
- * @param config.debug Whether debug logs are enabled in the build time environment
22
- */
3
+ const SENTRY_WRAPPED_ENTRY = "?sentry-query-wrapped-entry";
4
+ const SENTRY_WRAPPED_FUNCTIONS = "?sentry-query-wrapped-functions=";
5
+ const SENTRY_REEXPORTED_FUNCTIONS = "?sentry-query-reexported-functions=";
6
+ const QUERY_END_INDICATOR = "SENTRY-QUERY-END";
23
7
  function wrapServerEntryWithDynamicImport(config) {
24
8
  const {
25
9
  serverConfigFileName,
@@ -27,209 +11,107 @@ function wrapServerEntryWithDynamicImport(config) {
27
11
  resolvedServerConfigPath,
28
12
  entrypointWrappedFunctions,
29
13
  additionalImports,
30
- debug,
14
+ debug
31
15
  } = config;
32
-
33
- // In order to correctly import the server config file
34
- // and dynamically import the nitro runtime, we need to
35
- // mark the resolutionId with '\0raw' to fall into the
36
- // raw chunk group, c.f. https://github.com/nitrojs/nitro/commit/8b4a408231bdc222569a32ce109796a41eac4aa6#diff-e58102d2230f95ddeef2662957b48d847a6e891e354cfd0ae6e2e03ce848d1a2R142
37
- const resolutionIdPrefix = '\0raw';
38
-
16
+ const resolutionIdPrefix = "\0raw";
39
17
  return {
40
- name: 'sentry-wrap-server-entry-with-dynamic-import',
18
+ name: "sentry-wrap-server-entry-with-dynamic-import",
41
19
  async resolveId(source, importer, options) {
42
20
  if (source.includes(`/${serverConfigFileName}`)) {
43
21
  return { id: source, moduleSideEffects: true };
44
22
  }
45
-
46
23
  if (additionalImports?.includes(source)) {
47
- // When importing additional imports like "import-in-the-middle/hook.mjs" in the returned code of the `load()` function below:
48
- // By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it
49
- // By importing "import-in-the-middle/hook.mjs", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.
50
- // Prevents the error "Failed to register ESM hook Error: Cannot find module 'import-in-the-middle/hook.mjs'"
51
24
  return { id: source, moduleSideEffects: true, external: true };
52
25
  }
53
-
54
- if (
55
- options.isEntry &&
56
- source.includes(serverEntrypointFileName) &&
57
- source.includes('.mjs') &&
58
- !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)
59
- ) {
26
+ if (options.isEntry && source.includes(serverEntrypointFileName) && source.includes(".mjs") && !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {
60
27
  const resolution = await this.resolve(source, importer, options);
61
-
62
- // If it cannot be resolved or is external, just return it so that Rollup can display an error
63
28
  if (!resolution || resolution?.external) return resolution;
64
-
65
29
  const moduleInfo = await this.load(resolution);
66
-
67
30
  moduleInfo.moduleSideEffects = true;
68
-
69
- // The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix
70
- return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)
71
- ? resolution.id
72
- : `${resolutionIdPrefix}${resolution.id
73
- // Concatenates the query params to mark the file (also attaches names of re-exports - this is needed for serverless functions to re-export the handler)
74
- .concat(SENTRY_WRAPPED_ENTRY)
75
- .concat(
76
- constructWrappedFunctionExportQuery(moduleInfo.exportedBindings, entrypointWrappedFunctions, debug),
77
- )
78
- .concat(QUERY_END_INDICATOR)}`;
31
+ return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`) ? resolution.id : `${resolutionIdPrefix}${resolution.id.concat(SENTRY_WRAPPED_ENTRY).concat(
32
+ constructWrappedFunctionExportQuery(moduleInfo.exportedBindings, entrypointWrappedFunctions, debug)
33
+ ).concat(QUERY_END_INDICATOR)}`;
79
34
  }
80
35
  return null;
81
36
  },
82
37
  load(id) {
83
38
  if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {
84
39
  const entryId = removeSentryQueryFromPath(id).slice(resolutionIdPrefix.length);
85
-
86
- // Mostly useful for serverless `handler` functions
87
- const reExportedFunctions =
88
- id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)
89
- ? constructFunctionReExport(id, entryId)
90
- : '';
91
-
40
+ const reExportedFunctions = id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS) ? constructFunctionReExport(id, entryId) : "";
92
41
  return (
93
42
  // Regular `import` of the Sentry config
94
- `import ${JSON.stringify(resolvedServerConfigPath)};\n` +
95
- // Dynamic `import()` for the previous, actual entry point.
96
- // `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)
97
- `import(${JSON.stringify(entryId)});\n` +
98
- // By importing additional imports like "import-in-the-middle/hook.mjs", we can make sure this file wil be included, as not all node builders are including files imported with `module.register()`.
99
- `${additionalImports ? additionalImports.map(importPath => `import "${importPath}";\n`) : ''}` +
100
- `${reExportedFunctions}\n`
43
+ `import ${JSON.stringify(resolvedServerConfigPath)};
44
+ import(${JSON.stringify(entryId)});
45
+ ${additionalImports ? additionalImports.map((importPath) => `import "${importPath}";
46
+ `) : ""}${reExportedFunctions}
47
+ `
101
48
  );
102
49
  }
103
-
104
50
  return null;
105
- },
51
+ }
106
52
  };
107
53
  }
108
-
109
- /**
110
- * Strips the Sentry query part from a path.
111
- * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path
112
- *
113
- * **Only exported for testing**
114
- */
115
54
  function removeSentryQueryFromPath(url) {
116
- // oxlint-disable-next-line sdk/no-regexp-constructor
117
55
  const regex = new RegExp(`\\${SENTRY_WRAPPED_ENTRY}.*?\\${QUERY_END_INDICATOR}`);
118
- return url.replace(regex, '');
56
+ return url.replace(regex, "");
119
57
  }
120
-
121
- /**
122
- * Extracts and sanitizes function re-export and function wrap query parameters from a query string.
123
- * If it is a default export, it is not considered for re-exporting.
124
- *
125
- * **Only exported for testing**
126
- */
127
58
  function extractFunctionReexportQueryParameters(query) {
128
- // Regex matches the comma-separated params between the functions query
129
- // oxlint-disable-next-line sdk/no-regexp-constructor
130
59
  const wrapRegex = new RegExp(
131
- `\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR}|\\${SENTRY_REEXPORTED_FUNCTIONS})`,
60
+ `\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR}|\\${SENTRY_REEXPORTED_FUNCTIONS})`
132
61
  );
133
- // oxlint-disable-next-line sdk/no-regexp-constructor
134
62
  const reexportRegex = new RegExp(`\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR})`);
135
-
136
63
  const wrapMatch = query.match(wrapRegex);
137
64
  const reexportMatch = query.match(reexportRegex);
138
-
139
- const wrap = wrapMatch?.[1]
140
- ? wrapMatch[1]
141
- .split(',')
142
- .filter(param => param !== '')
143
- // Sanitize, as code could be injected with another rollup plugin
144
- .map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
145
- : [];
146
-
147
- const reexport = reexportMatch?.[1]
148
- ? reexportMatch[1]
149
- .split(',')
150
- .filter(param => param !== '' && param !== 'default')
151
- // Sanitize, as code could be injected with another rollup plugin
152
- .map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
153
- : [];
154
-
65
+ const wrap = wrapMatch?.[1] ? wrapMatch[1].split(",").filter((param) => param !== "").map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) : [];
66
+ const reexport = reexportMatch?.[1] ? reexportMatch[1].split(",").filter((param) => param !== "" && param !== "default").map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) : [];
155
67
  return { wrap, reexport };
156
68
  }
157
-
158
- /**
159
- * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.
160
- * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped
161
- * (e.g. serverless handlers) are wrapped by Sentry.
162
- *
163
- * **Only exported for testing**
164
- */
165
- function constructWrappedFunctionExportQuery(
166
- exportedBindings,
167
- entrypointWrappedFunctions,
168
- debug,
169
- ) {
69
+ function constructWrappedFunctionExportQuery(exportedBindings, entrypointWrappedFunctions, debug) {
170
70
  const functionsToExport = {
171
71
  wrap: [],
172
- reexport: [],
72
+ reexport: []
173
73
  };
174
-
175
- // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`
176
- // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.
177
- Object.values(exportedBindings || {}).forEach(functions =>
178
- functions.forEach(fn => {
74
+ Object.values(exportedBindings || {}).forEach(
75
+ (functions) => functions.forEach((fn) => {
179
76
  if (entrypointWrappedFunctions.includes(fn)) {
180
77
  functionsToExport.wrap.push(fn);
181
78
  } else {
182
79
  functionsToExport.reexport.push(fn);
183
80
  }
184
- }),
81
+ })
185
82
  );
186
-
187
83
  if (debug && functionsToExport.wrap.length === 0) {
188
- consoleSandbox(() =>
189
- // eslint-disable-next-line no-console
190
- console.warn(
191
- '[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to `entrypointWrappedFunctions`.',
192
- ),
84
+ consoleSandbox(
85
+ () => (
86
+ // eslint-disable-next-line no-console
87
+ console.warn(
88
+ "[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to `entrypointWrappedFunctions`."
89
+ )
90
+ )
193
91
  );
194
92
  }
195
-
196
- const wrapQuery = functionsToExport.wrap.length
197
- ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`
198
- : '';
199
- const reexportQuery = functionsToExport.reexport.length
200
- ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`
201
- : '';
202
-
203
- return [wrapQuery, reexportQuery].join('');
93
+ const wrapQuery = functionsToExport.wrap.length ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(",")}` : "";
94
+ const reexportQuery = functionsToExport.reexport.length ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(",")}` : "";
95
+ return [wrapQuery, reexportQuery].join("");
204
96
  }
205
-
206
- /**
207
- * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)
208
- *
209
- * **Only exported for testing**
210
- */
211
97
  function constructFunctionReExport(pathWithQuery, entryId) {
212
98
  const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);
213
-
214
- return wrapFunctions
215
- .reduce(
216
- (functionsCode, currFunctionName) =>
217
- functionsCode.concat(
218
- `async function ${currFunctionName}_sentryWrapped(...args) {\n` +
219
- ` const res = await import(${JSON.stringify(entryId)});\n` +
220
- ` return res.${currFunctionName}.call(this, ...args);\n` +
221
- '}\n' +
222
- `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\n`,
223
- ),
224
- '',
99
+ return wrapFunctions.reduce(
100
+ (functionsCode, currFunctionName) => functionsCode.concat(
101
+ `async function ${currFunctionName}_sentryWrapped(...args) {
102
+ const res = await import(${JSON.stringify(entryId)});
103
+ return res.${currFunctionName}.call(this, ...args);
104
+ }
105
+ export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };
106
+ `
107
+ ),
108
+ ""
109
+ ).concat(
110
+ reexportFunctions.reduce(
111
+ (functionsCode, currFunctionName) => functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),
112
+ ""
225
113
  )
226
- .concat(
227
- reexportFunctions.reduce(
228
- (functionsCode, currFunctionName) =>
229
- functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),
230
- '',
231
- ),
232
- );
114
+ );
233
115
  }
234
116
 
235
117
  export { QUERY_END_INDICATOR, SENTRY_REEXPORTED_FUNCTIONS, SENTRY_WRAPPED_ENTRY, SENTRY_WRAPPED_FUNCTIONS, constructFunctionReExport, constructWrappedFunctionExportQuery, extractFunctionReexportQueryParameters, removeSentryQueryFromPath, wrapServerEntryWithDynamicImport };
@@ -1 +1 @@
1
- {"version":3,"file":"wrapServerEntryWithDynamicImport.js","sources":["../../../src/config/wrapServerEntryWithDynamicImport.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport type { InputPluginOption } from 'rollup';\n\n/** THIS FILE IS AN UTILITY FOR NITRO-BASED PACKAGES AND SHOULD BE KEPT IN SYNC IN NUXT, SOLIDSTART, ETC. */\n\nexport const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';\nexport const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';\nexport const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';\nexport const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';\n\nexport type WrapServerEntryPluginOptions = {\n serverEntrypointFileName: string;\n serverConfigFileName: string;\n resolvedServerConfigPath: string;\n entrypointWrappedFunctions: string[];\n additionalImports?: string[];\n debug?: boolean;\n};\n\n/**\n * A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first\n * by using a regular `import` and load the server after that.\n * This also works with serverless `handler` functions, as it re-exports the `handler`.\n *\n * @param config Configuration options for the Rollup Plugin\n * @param config.serverConfigFileName Name of the Sentry server config (without file extension). E.g. 'sentry.server.config'\n * @param config.serverEntrypointFileName The server entrypoint (with file extension). Usually, this is defined by the Nitro preset and is something like 'node-server.mjs'\n * @param config.resolvedServerConfigPath Resolved path of the Sentry server config (based on `src` directory)\n * @param config.entryPointWrappedFunctions Exported bindings of the server entry file, which are wrapped as async function. E.g. ['default', 'handler', 'server']\n * @param config.additionalImports Adds additional imports to the entry file. Can be e.g. 'import-in-the-middle/hook.mjs'\n * @param config.debug Whether debug logs are enabled in the build time environment\n */\nexport function wrapServerEntryWithDynamicImport(config: WrapServerEntryPluginOptions): InputPluginOption {\n const {\n serverConfigFileName,\n serverEntrypointFileName,\n resolvedServerConfigPath,\n entrypointWrappedFunctions,\n additionalImports,\n debug,\n } = config;\n\n // In order to correctly import the server config file\n // and dynamically import the nitro runtime, we need to\n // mark the resolutionId with '\\0raw' to fall into the\n // raw chunk group, c.f. https://github.com/nitrojs/nitro/commit/8b4a408231bdc222569a32ce109796a41eac4aa6#diff-e58102d2230f95ddeef2662957b48d847a6e891e354cfd0ae6e2e03ce848d1a2R142\n const resolutionIdPrefix = '\\0raw';\n\n return {\n name: 'sentry-wrap-server-entry-with-dynamic-import',\n async resolveId(source, importer, options) {\n if (source.includes(`/${serverConfigFileName}`)) {\n return { id: source, moduleSideEffects: true };\n }\n\n if (additionalImports?.includes(source)) {\n // When importing additional imports like \"import-in-the-middle/hook.mjs\" in the returned code of the `load()` function below:\n // By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.\n // Prevents the error \"Failed to register ESM hook Error: Cannot find module 'import-in-the-middle/hook.mjs'\"\n return { id: source, moduleSideEffects: true, external: true };\n }\n\n if (\n options.isEntry &&\n source.includes(serverEntrypointFileName) &&\n source.includes('.mjs') &&\n !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ) {\n const resolution = await this.resolve(source, importer, options);\n\n // If it cannot be resolved or is external, just return it so that Rollup can display an error\n if (!resolution || resolution?.external) return resolution;\n\n const moduleInfo = await this.load(resolution);\n\n moduleInfo.moduleSideEffects = true;\n\n // The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix\n return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ? resolution.id\n : `${resolutionIdPrefix}${resolution.id\n // Concatenates the query params to mark the file (also attaches names of re-exports - this is needed for serverless functions to re-export the handler)\n .concat(SENTRY_WRAPPED_ENTRY)\n .concat(\n constructWrappedFunctionExportQuery(moduleInfo.exportedBindings, entrypointWrappedFunctions, debug),\n )\n .concat(QUERY_END_INDICATOR)}`;\n }\n return null;\n },\n load(id: string) {\n if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const entryId = removeSentryQueryFromPath(id).slice(resolutionIdPrefix.length);\n\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryId)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${JSON.stringify(resolvedServerConfigPath)};\\n` +\n // Dynamic `import()` for the previous, actual entry point.\n // `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)\n `import(${JSON.stringify(entryId)});\\n` +\n // By importing additional imports like \"import-in-the-middle/hook.mjs\", we can make sure this file wil be included, as not all node builders are including files imported with `module.register()`.\n `${additionalImports ? additionalImports.map(importPath => `import \"${importPath}\";\\n`) : ''}` +\n `${reExportedFunctions}\\n`\n );\n }\n\n return null;\n },\n };\n}\n\n/**\n * Strips the Sentry query part from a path.\n * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path\n *\n * **Only exported for testing**\n */\nexport function removeSentryQueryFromPath(url: string): string {\n // oxlint-disable-next-line sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_WRAPPED_ENTRY}.*?\\\\${QUERY_END_INDICATOR}`);\n return url.replace(regex, '');\n}\n\n/**\n * Extracts and sanitizes function re-export and function wrap query parameters from a query string.\n * If it is a default export, it is not considered for re-exporting.\n *\n * **Only exported for testing**\n */\nexport function extractFunctionReexportQueryParameters(query: string): { wrap: string[]; reexport: string[] } {\n // Regex matches the comma-separated params between the functions query\n // oxlint-disable-next-line sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // oxlint-disable-next-line sdk/no-regexp-constructor\n const reexportRegex = new RegExp(`\\\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR})`);\n\n const wrapMatch = query.match(wrapRegex);\n const reexportMatch = query.match(reexportRegex);\n\n const wrap = wrapMatch?.[1]\n ? wrapMatch[1]\n .split(',')\n .filter(param => param !== '')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n : [];\n\n const reexport = reexportMatch?.[1]\n ? reexportMatch[1]\n .split(',')\n .filter(param => param !== '' && param !== 'default')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n : [];\n\n return { wrap, reexport };\n}\n\n/**\n * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.\n * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped\n * (e.g. serverless handlers) are wrapped by Sentry.\n *\n * **Only exported for testing**\n */\nexport function constructWrappedFunctionExportQuery(\n exportedBindings: Record<string, string[]> | null,\n entrypointWrappedFunctions: string[],\n debug?: boolean,\n): string {\n const functionsToExport: { wrap: string[]; reexport: string[] } = {\n wrap: [],\n reexport: [],\n };\n\n // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`\n // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.\n Object.values(exportedBindings || {}).forEach(functions =>\n functions.forEach(fn => {\n if (entrypointWrappedFunctions.includes(fn)) {\n functionsToExport.wrap.push(fn);\n } else {\n functionsToExport.reexport.push(fn);\n }\n }),\n );\n\n if (debug && functionsToExport.wrap.length === 0) {\n consoleSandbox(() =>\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to `entrypointWrappedFunctions`.',\n ),\n );\n }\n\n const wrapQuery = functionsToExport.wrap.length\n ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`\n : '';\n const reexportQuery = functionsToExport.reexport.length\n ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`\n : '';\n\n return [wrapQuery, reexportQuery].join('');\n}\n\n/**\n * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)\n *\n * **Only exported for testing**\n */\nexport function constructFunctionReExport(pathWithQuery: string, entryId: string): string {\n const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);\n\n return wrapFunctions\n .reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(\n `async function ${currFunctionName}_sentryWrapped(...args) {\\n` +\n ` const res = await import(${JSON.stringify(entryId)});\\n` +\n ` return res.${currFunctionName}.call(this, ...args);\\n` +\n '}\\n' +\n `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\\n`,\n ),\n '',\n )\n .concat(\n reexportFunctions.reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),\n '',\n ),\n );\n}\n"],"names":[],"mappings":";;AAGA;;AAEO,MAAM,oBAAA,GAAuB;AAC7B,MAAM,wBAAA,GAA2B;AACjC,MAAM,2BAAA,GAA8B;AACpC,MAAM,mBAAA,GAAsB;;AAWnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,MAAM,EAAmD;AAC1G,EAAE,MAAM;AACR,IAAI,oBAAoB;AACxB,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,0BAA0B;AAC9B,IAAI,iBAAiB;AACrB,IAAI,KAAK;AACT,GAAE,GAAI,MAAM;;AAEZ;AACA;AACA;AACA;AACA,EAAE,MAAM,kBAAA,GAAqB,OAAO;;AAEpC,EAAE,OAAO;AACT,I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,IAAA,EAAA,aAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,GAAA,sCAAA,CAAA,aAAA,CAAA;;AAEA,EAAA,OAAA;AACA,KAAA,MAAA;AACA,MAAA,CAAA,aAAA,EAAA,gBAAA;AACA,QAAA,aAAA,CAAA,MAAA;AACA,UAAA,CAAA,eAAA,EAAA,gBAAA,CAAA,2BAAA,CAAA;AACA,YAAA,CAAA,2BAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,IAAA,CAAA;AACA,YAAA,CAAA,aAAA,EAAA,gBAAA,CAAA,uBAAA,CAAA;AACA,YAAA,KAAA;AACA,YAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,kBAAA,EAAA,gBAAA,CAAA,KAAA,CAAA;AACA,SAAA;AACA,MAAA,EAAA;AACA;AACA,KAAA,MAAA;AACA,MAAA,iBAAA,CAAA,MAAA;AACA,QAAA,CAAA,aAAA,EAAA,gBAAA;AACA,UAAA,aAAA,CAAA,MAAA,CAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,QAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA,QAAA,EAAA;AACA,OAAA;AACA,KAAA;AACA;;;;"}
1
+ {"version":3,"file":"wrapServerEntryWithDynamicImport.js","sources":["../../../src/config/wrapServerEntryWithDynamicImport.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport type { InputPluginOption } from 'rollup';\n\n/** THIS FILE IS AN UTILITY FOR NITRO-BASED PACKAGES AND SHOULD BE KEPT IN SYNC IN NUXT, SOLIDSTART, ETC. */\n\nexport const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';\nexport const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';\nexport const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';\nexport const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';\n\nexport type WrapServerEntryPluginOptions = {\n serverEntrypointFileName: string;\n serverConfigFileName: string;\n resolvedServerConfigPath: string;\n entrypointWrappedFunctions: string[];\n additionalImports?: string[];\n debug?: boolean;\n};\n\n/**\n * A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first\n * by using a regular `import` and load the server after that.\n * This also works with serverless `handler` functions, as it re-exports the `handler`.\n *\n * @param config Configuration options for the Rollup Plugin\n * @param config.serverConfigFileName Name of the Sentry server config (without file extension). E.g. 'sentry.server.config'\n * @param config.serverEntrypointFileName The server entrypoint (with file extension). Usually, this is defined by the Nitro preset and is something like 'node-server.mjs'\n * @param config.resolvedServerConfigPath Resolved path of the Sentry server config (based on `src` directory)\n * @param config.entryPointWrappedFunctions Exported bindings of the server entry file, which are wrapped as async function. E.g. ['default', 'handler', 'server']\n * @param config.additionalImports Adds additional imports to the entry file. Can be e.g. 'import-in-the-middle/hook.mjs'\n * @param config.debug Whether debug logs are enabled in the build time environment\n */\nexport function wrapServerEntryWithDynamicImport(config: WrapServerEntryPluginOptions): InputPluginOption {\n const {\n serverConfigFileName,\n serverEntrypointFileName,\n resolvedServerConfigPath,\n entrypointWrappedFunctions,\n additionalImports,\n debug,\n } = config;\n\n // In order to correctly import the server config file\n // and dynamically import the nitro runtime, we need to\n // mark the resolutionId with '\\0raw' to fall into the\n // raw chunk group, c.f. https://github.com/nitrojs/nitro/commit/8b4a408231bdc222569a32ce109796a41eac4aa6#diff-e58102d2230f95ddeef2662957b48d847a6e891e354cfd0ae6e2e03ce848d1a2R142\n const resolutionIdPrefix = '\\0raw';\n\n return {\n name: 'sentry-wrap-server-entry-with-dynamic-import',\n async resolveId(source, importer, options) {\n if (source.includes(`/${serverConfigFileName}`)) {\n return { id: source, moduleSideEffects: true };\n }\n\n if (additionalImports?.includes(source)) {\n // When importing additional imports like \"import-in-the-middle/hook.mjs\" in the returned code of the `load()` function below:\n // By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.\n // Prevents the error \"Failed to register ESM hook Error: Cannot find module 'import-in-the-middle/hook.mjs'\"\n return { id: source, moduleSideEffects: true, external: true };\n }\n\n if (\n options.isEntry &&\n source.includes(serverEntrypointFileName) &&\n source.includes('.mjs') &&\n !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ) {\n const resolution = await this.resolve(source, importer, options);\n\n // If it cannot be resolved or is external, just return it so that Rollup can display an error\n if (!resolution || resolution?.external) return resolution;\n\n const moduleInfo = await this.load(resolution);\n\n moduleInfo.moduleSideEffects = true;\n\n // The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix\n return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ? resolution.id\n : `${resolutionIdPrefix}${resolution.id\n // Concatenates the query params to mark the file (also attaches names of re-exports - this is needed for serverless functions to re-export the handler)\n .concat(SENTRY_WRAPPED_ENTRY)\n .concat(\n constructWrappedFunctionExportQuery(moduleInfo.exportedBindings, entrypointWrappedFunctions, debug),\n )\n .concat(QUERY_END_INDICATOR)}`;\n }\n return null;\n },\n load(id: string) {\n if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const entryId = removeSentryQueryFromPath(id).slice(resolutionIdPrefix.length);\n\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryId)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${JSON.stringify(resolvedServerConfigPath)};\\n` +\n // Dynamic `import()` for the previous, actual entry point.\n // `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)\n `import(${JSON.stringify(entryId)});\\n` +\n // By importing additional imports like \"import-in-the-middle/hook.mjs\", we can make sure this file wil be included, as not all node builders are including files imported with `module.register()`.\n `${additionalImports ? additionalImports.map(importPath => `import \"${importPath}\";\\n`) : ''}` +\n `${reExportedFunctions}\\n`\n );\n }\n\n return null;\n },\n };\n}\n\n/**\n * Strips the Sentry query part from a path.\n * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path\n *\n * **Only exported for testing**\n */\nexport function removeSentryQueryFromPath(url: string): string {\n // oxlint-disable-next-line sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_WRAPPED_ENTRY}.*?\\\\${QUERY_END_INDICATOR}`);\n return url.replace(regex, '');\n}\n\n/**\n * Extracts and sanitizes function re-export and function wrap query parameters from a query string.\n * If it is a default export, it is not considered for re-exporting.\n *\n * **Only exported for testing**\n */\nexport function extractFunctionReexportQueryParameters(query: string): { wrap: string[]; reexport: string[] } {\n // Regex matches the comma-separated params between the functions query\n // oxlint-disable-next-line sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // oxlint-disable-next-line sdk/no-regexp-constructor\n const reexportRegex = new RegExp(`\\\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR})`);\n\n const wrapMatch = query.match(wrapRegex);\n const reexportMatch = query.match(reexportRegex);\n\n const wrap = wrapMatch?.[1]\n ? wrapMatch[1]\n .split(',')\n .filter(param => param !== '')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n : [];\n\n const reexport = reexportMatch?.[1]\n ? reexportMatch[1]\n .split(',')\n .filter(param => param !== '' && param !== 'default')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n : [];\n\n return { wrap, reexport };\n}\n\n/**\n * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.\n * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped\n * (e.g. serverless handlers) are wrapped by Sentry.\n *\n * **Only exported for testing**\n */\nexport function constructWrappedFunctionExportQuery(\n exportedBindings: Record<string, string[]> | null,\n entrypointWrappedFunctions: string[],\n debug?: boolean,\n): string {\n const functionsToExport: { wrap: string[]; reexport: string[] } = {\n wrap: [],\n reexport: [],\n };\n\n // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`\n // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.\n Object.values(exportedBindings || {}).forEach(functions =>\n functions.forEach(fn => {\n if (entrypointWrappedFunctions.includes(fn)) {\n functionsToExport.wrap.push(fn);\n } else {\n functionsToExport.reexport.push(fn);\n }\n }),\n );\n\n if (debug && functionsToExport.wrap.length === 0) {\n consoleSandbox(() =>\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to `entrypointWrappedFunctions`.',\n ),\n );\n }\n\n const wrapQuery = functionsToExport.wrap.length\n ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`\n : '';\n const reexportQuery = functionsToExport.reexport.length\n ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`\n : '';\n\n return [wrapQuery, reexportQuery].join('');\n}\n\n/**\n * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)\n *\n * **Only exported for testing**\n */\nexport function constructFunctionReExport(pathWithQuery: string, entryId: string): string {\n const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);\n\n return wrapFunctions\n .reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(\n `async function ${currFunctionName}_sentryWrapped(...args) {\\n` +\n ` const res = await import(${JSON.stringify(entryId)});\\n` +\n ` return res.${currFunctionName}.call(this, ...args);\\n` +\n '}\\n' +\n `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\\n`,\n ),\n '',\n )\n .concat(\n reexportFunctions.reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),\n '',\n ),\n );\n}\n"],"names":[],"mappings":";;AAKO,MAAM,oBAAA,GAAuB;AAC7B,MAAM,wBAAA,GAA2B;AACjC,MAAM,2BAAA,GAA8B;AACpC,MAAM,mBAAA,GAAsB;AAwB5B,SAAS,iCAAiC,MAAA,EAAyD;AACxG,EAAA,MAAM;AAAA,IACJ,oBAAA;AAAA,IACA,wBAAA;AAAA,IACA,wBAAA;AAAA,IACA,0BAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA,GACF,GAAI,MAAA;AAMJ,EAAA,MAAM,kBAAA,GAAqB,OAAA;AAE3B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,8CAAA;AAAA,IACN,MAAM,SAAA,CAAU,MAAA,EAAQ,QAAA,EAAU,OAAA,EAAS;AACzC,MAAA,IAAI,MAAA,CAAO,QAAA,CAAS,CAAA,CAAA,EAAI,oBAAoB,EAAE,CAAA,EAAG;AAC/C,QAAA,OAAO,EAAE,EAAA,EAAI,MAAA,EAAQ,iBAAA,EAAmB,IAAA,EAAK;AAAA,MAC/C;AAEA,MAAA,IAAI,iBAAA,EAAmB,QAAA,CAAS,MAAM,CAAA,EAAG;AAKvC,QAAA,OAAO,EAAE,EAAA,EAAI,MAAA,EAAQ,iBAAA,EAAmB,IAAA,EAAM,UAAU,IAAA,EAAK;AAAA,MAC/D;AAEA,MAAA,IACE,QAAQ,OAAA,IACR,MAAA,CAAO,QAAA,CAAS,wBAAwB,KACxC,MAAA,CAAO,QAAA,CAAS,MAAM,CAAA,IACtB,CAAC,MAAA,CAAO,QAAA,CAAS,CAAA,IAAA,EAAO,oBAAoB,EAAE,CAAA,EAC9C;AACA,QAAA,MAAM,aAAa,MAAM,IAAA,C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,CAAA,GACrE,EAAA;AAEJ,EAAA,OAAO,CAAC,SAAA,EAAW,aAAa,CAAA,CAAE,KAAK,EAAE,CAAA;AAC3C;AAOO,SAAS,yBAAA,CAA0B,eAAuB,OAAA,EAAyB;AACxF,EAAA,MAAM,EAAE,IAAA,EAAM,aAAA,EAAe,UAAU,iBAAA,EAAkB,GAAI,uCAAuC,aAAa,CAAA;AAEjH,EAAA,OAAO,aAAA,CACJ,MAAA;AAAA,IACC,CAAC,aAAA,EAAe,gBAAA,KACd,aAAA,CAAc,MAAA;AAAA,MACZ,kBAAkB,gBAAgB,CAAA;AAAA,2BAAA,EACF,IAAA,CAAK,SAAA,CAAU,OAAO,CAAC,CAAA;AAAA,aAAA,EACrC,gBAAgB,CAAA;AAAA;AAAA,SAAA,EAEpB,gBAAgB,qBAAqB,gBAAgB,CAAA;AAAA;AAAA,KACrE;AAAA,IACF;AAAA,GACF,CACC,MAAA;AAAA,IACC,iBAAA,CAAkB,MAAA;AAAA,MAChB,CAAC,aAAA,EAAe,gBAAA,KACd,aAAA,CAAc,MAAA,CAAO,CAAA,SAAA,EAAY,gBAAgB,CAAA,QAAA,EAAW,IAAA,CAAK,SAAA,CAAU,OAAO,CAAC,CAAA,CAAA,CAAG,CAAA;AAAA,MACxF;AAAA;AACF,GACF;AACJ;;;;"}
@@ -1 +1 @@
1
- {"type":"module","version":"10.53.0"}
1
+ {"type":"module","version":"10.54.0"}
@@ -2,47 +2,36 @@ import { addNonEnumerableProperty, getTraceMetaTags } from '@sentry/core';
2
2
 
3
3
  function addMetaTagToHead(html) {
4
4
  const metaTags = getTraceMetaTags();
5
-
6
5
  if (!metaTags) {
7
6
  return html;
8
7
  }
9
-
10
- const content = `<head>\n${metaTags}\n`;
11
- return html.replace('<head>', content);
8
+ const content = `<head>
9
+ ${metaTags}
10
+ `;
11
+ return html.replace("<head>", content);
12
12
  }
13
-
14
- /**
15
- * Returns an `onBeforeResponse` solid start middleware handler that adds tracing data as
16
- * <meta> tags to a page on pageload to enable distributed tracing.
17
- */
18
13
  function sentryBeforeResponseMiddleware() {
19
14
  return async function onBeforeResponse(event, response) {
20
15
  if (!response.body || response.__sentry_wrapped__) {
21
16
  return;
22
17
  }
23
-
24
- // Ensure we don't double-wrap, in case a user has added the middleware twice
25
- // e.g. once manually, once via the wizard
26
- addNonEnumerableProperty(response, '__sentry_wrapped__', true);
27
-
28
- const contentType = event.response.headers.get('content-type');
29
- const isPageloadRequest = contentType?.startsWith('text/html');
30
-
18
+ addNonEnumerableProperty(response, "__sentry_wrapped__", true);
19
+ const contentType = event.response.headers.get("content-type");
20
+ const isPageloadRequest = contentType?.startsWith("text/html");
31
21
  if (!isPageloadRequest) {
32
22
  return;
33
23
  }
34
-
35
- const body = response.body ;
24
+ const body = response.body;
36
25
  const decoder = new TextDecoder();
37
26
  response.body = new ReadableStream({
38
- start: async controller => {
27
+ start: async (controller) => {
39
28
  for await (const chunk of body) {
40
- const html = typeof chunk === 'string' ? chunk : decoder.decode(chunk, { stream: true });
29
+ const html = typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true });
41
30
  const modifiedHtml = addMetaTagToHead(html);
42
31
  controller.enqueue(new TextEncoder().encode(modifiedHtml));
43
32
  }
44
33
  controller.close();
45
- },
34
+ }
46
35
  });
47
36
  };
48
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.js","sources":["../../../src/server/middleware.ts"],"sourcesContent":["import { addNonEnumerableProperty, getTraceMetaTags } from '@sentry/core';\nimport type { ResponseMiddleware } from '@solidjs/start/middleware';\nimport type { FetchEvent } from '@solidjs/start/server';\n\nexport type ResponseMiddlewareResponse = Parameters<ResponseMiddleware>[1] & {\n __sentry_wrapped__?: boolean;\n};\n\nfunction addMetaTagToHead(html: string): string {\n const metaTags = getTraceMetaTags();\n\n if (!metaTags) {\n return html;\n }\n\n const content = `<head>\\n${metaTags}\\n`;\n return html.replace('<head>', content);\n}\n\n/**\n * Returns an `onBeforeResponse` solid start middleware handler that adds tracing data as\n * <meta> tags to a page on pageload to enable distributed tracing.\n */\nexport function sentryBeforeResponseMiddleware() {\n return async function onBeforeResponse(event: FetchEvent, response: ResponseMiddlewareResponse) {\n if (!response.body || response.__sentry_wrapped__) {\n return;\n }\n\n // Ensure we don't double-wrap, in case a user has added the middleware twice\n // e.g. once manually, once via the wizard\n addNonEnumerableProperty(response, '__sentry_wrapped__', true);\n\n const contentType = event.response.headers.get('content-type');\n const isPageloadRequest = contentType?.startsWith('text/html');\n\n if (!isPageloadRequest) {\n return;\n }\n\n const body = response.body as NodeJS.ReadableStream;\n const decoder = new TextDecoder();\n response.body = new ReadableStream({\n start: async controller => {\n for await (const chunk of body) {\n const html = typeof chunk === 'string' ? chunk : decoder.decode(chunk, { stream: true });\n const modifiedHtml = addMetaTagToHead(html);\n controller.enqueue(new TextEncoder().encode(modifiedHtml));\n }\n controller.close();\n },\n });\n };\n}\n"],"names":[],"mappings":";;AAQA,SAAS,gBAAgB,CAAC,IAAI,EAAkB;AAChD,EAAE,MAAM,QAAA,GAAW,gBAAgB,EAAE;;AAErC,EAAE,IAAI,CAAC,QAAQ,EAAE;AACjB,IAAI,OAAO,IAAI;AACf,EAAE;;AAEF,EAAE,MAAM,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;AACzC,EAAE,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC;AACxC;;AAEA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,GAAG;AACjD,EAAE,OAAO,eAAe,gBAAgB,CAAC,KAAK,EAAc,QAAQ,EAA8B;AAClG,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,QAAQ,CAAC,kBAAkB,EAAE;AACvD,MAAM;AACN,IAAI;;AAEJ;AACA;AACA,IAAI,wBAAwB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,IAAI,CAAC;;AAElE,IAAI,MAAM,WAAA,GAAc,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;AAClE,IAAI,MAAM,oBAAoB,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC;;AAElE,IAAI,IAAI,CAAC,iBAAiB,EAAE;AAC5B,MAAM;AACN,IAAI;;AAEJ,IAAI,MAAM,IAAA,GAAO,QAAQ,CAAC,IAAA;AAC1B,IAAI,MAAM,OAAA,GAAU,IAAI,WAAW,EAAE;AACrC,IAAI,QAAQ,CAAC,IAAA,GAAO,IAAI,cAAc,CAAC;AACvC,MAAM,KAAK,EAAE,MAAM,UAAA,IAAc;AACjC,QAAQ,WAAW,MAAM,KAAA,IAAS,IAAI,EAAE;AACxC,UAAU,MAAM,OAAO,OAAO,UAAU,QAAA,GAAW,KAAA,GAAQ,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAA,EAAM,CAAC;AAClG,UAAU,MAAM,YAAA,GAAe,gBAAgB,CAAC,IAAI,CAAC;AACrD,UAAU,UAAU,CAAC,OAAO,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACpE,QAAQ;AACR,QAAQ,UAAU,CAAC,KAAK,EAAE;AAC1B,MAAM,CAAC;AACP,KAAK,CAAC;AACN,EAAE,CAAC;AACH;;;;"}
1
+ {"version":3,"file":"middleware.js","sources":["../../../src/server/middleware.ts"],"sourcesContent":["import { addNonEnumerableProperty, getTraceMetaTags } from '@sentry/core';\nimport type { ResponseMiddleware } from '@solidjs/start/middleware';\nimport type { FetchEvent } from '@solidjs/start/server';\n\nexport type ResponseMiddlewareResponse = Parameters<ResponseMiddleware>[1] & {\n __sentry_wrapped__?: boolean;\n};\n\nfunction addMetaTagToHead(html: string): string {\n const metaTags = getTraceMetaTags();\n\n if (!metaTags) {\n return html;\n }\n\n const content = `<head>\\n${metaTags}\\n`;\n return html.replace('<head>', content);\n}\n\n/**\n * Returns an `onBeforeResponse` solid start middleware handler that adds tracing data as\n * <meta> tags to a page on pageload to enable distributed tracing.\n */\nexport function sentryBeforeResponseMiddleware() {\n return async function onBeforeResponse(event: FetchEvent, response: ResponseMiddlewareResponse) {\n if (!response.body || response.__sentry_wrapped__) {\n return;\n }\n\n // Ensure we don't double-wrap, in case a user has added the middleware twice\n // e.g. once manually, once via the wizard\n addNonEnumerableProperty(response, '__sentry_wrapped__', true);\n\n const contentType = event.response.headers.get('content-type');\n const isPageloadRequest = contentType?.startsWith('text/html');\n\n if (!isPageloadRequest) {\n return;\n }\n\n const body = response.body as NodeJS.ReadableStream;\n const decoder = new TextDecoder();\n response.body = new ReadableStream({\n start: async controller => {\n for await (const chunk of body) {\n const html = typeof chunk === 'string' ? chunk : decoder.decode(chunk, { stream: true });\n const modifiedHtml = addMetaTagToHead(html);\n controller.enqueue(new TextEncoder().encode(modifiedHtml));\n }\n controller.close();\n },\n });\n };\n}\n"],"names":[],"mappings":";;AAQA,SAAS,iBAAiB,IAAA,EAAsB;AAC9C,EAAA,MAAM,WAAW,gBAAA,EAAiB;AAElC,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,OAAA,GAAU,CAAA;AAAA,EAAW,QAAQ;AAAA,CAAA;AACnC,EAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,QAAA,EAAU,OAAO,CAAA;AACvC;AAMO,SAAS,8BAAA,GAAiC;AAC/C,EAAA,OAAO,eAAe,gBAAA,CAAiB,KAAA,EAAmB,QAAA,EAAsC;AAC9F,IAAA,IAAI,CAAC,QAAA,CAAS,IAAA,IAAQ,QAAA,CAAS,kBAAA,EAAoB;AACjD,MAAA;AAAA,IACF;AAIA,IAAA,wBAAA,CAAyB,QAAA,EAAU,sBAAsB,IAAI,CAAA;AAE7D,IAAA,MAAM,WAAA,GAAc,KAAA,CAAM,QAAA,CAAS,OAAA,CAAQ,IAAI,cAAc,CAAA;AAC7D,IAAA,MAAM,iBAAA,GAAoB,WAAA,EAAa,UAAA,CAAW,WAAW,CAAA;AAE7D,IAAA,IAAI,CAAC,iBAAA,EAAmB;AACtB,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,OAAO,QAAA,CAAS,IAAA;AACtB,IAAA,MAAM,OAAA,GAAU,IAAI,WAAA,EAAY;AAChC,IAAA,QAAA,CAAS,IAAA,GAAO,IAAI,cAAA,CAAe;AAAA,MACjC,KAAA,EAAO,OAAM,UAAA,KAAc;AACzB,QAAA,WAAA,MAAiB,SAAS,IAAA,EAAM;AAC9B,UAAA,MAAM,IAAA,GAAO,OAAO,KAAA,KAAU,QAAA,GAAW,KAAA,GAAQ,OAAA,CAAQ,MAAA,CAAO,KAAA,EAAO,EAAE,MAAA,EAAQ,IAAA,EAAM,CAAA;AACvF,UAAA,MAAM,YAAA,GAAe,iBAAiB,IAAI,CAAA;AAC1C,UAAA,UAAA,CAAW,QAAQ,IAAI,WAAA,EAAY,CAAE,MAAA,CAAO,YAAY,CAAC,CAAA;AAAA,QAC3D;AACA,QAAA,UAAA,CAAW,KAAA,EAAM;AAAA,MACnB;AAAA,KACD,CAAA;AAAA,EACH,CAAA;AACF;;;;"}
@@ -2,17 +2,12 @@ import { applySdkMetadata } from '@sentry/core';
2
2
  import { init as init$1 } from '@sentry/node';
3
3
  import { filterLowQualityTransactions } from './utils.js';
4
4
 
5
- /**
6
- * Initializes the server side of the Solid Start SDK
7
- */
8
5
  function init(options) {
9
6
  const opts = {
10
- ...options,
7
+ ...options
11
8
  };
12
-
13
- applySdkMetadata(opts, 'solidstart', ['solidstart', 'node']);
9
+ applySdkMetadata(opts, "solidstart", ["solidstart", "node"]);
14
10
  filterLowQualityTransactions(opts);
15
-
16
11
  return init$1(opts);
17
12
  }
18
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import { applySdkMetadata } from '@sentry/core';\nimport type { NodeClient, NodeOptions } from '@sentry/node';\nimport { init as initNodeSdk } from '@sentry/node';\nimport { filterLowQualityTransactions } from './utils';\n\n/**\n * Initializes the server side of the Solid Start SDK\n */\nexport function init(options: NodeOptions): NodeClient | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'solidstart', ['solidstart', 'node']);\n filterLowQualityTransactions(opts);\n\n return initNodeSdk(opts);\n}\n"],"names":["initNodeSdk"],"mappings":";;;;AAKA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAuC;AACnE,EAAE,MAAM,OAAO;AACf,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAC9D,EAAE,4BAA4B,CAAC,IAAI,CAAC;;AAEpC,EAAE,OAAOA,MAAW,CAAC,IAAI,CAAC;AAC1B;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import { applySdkMetadata } from '@sentry/core';\nimport type { NodeClient, NodeOptions } from '@sentry/node';\nimport { init as initNodeSdk } from '@sentry/node';\nimport { filterLowQualityTransactions } from './utils';\n\n/**\n * Initializes the server side of the Solid Start SDK\n */\nexport function init(options: NodeOptions): NodeClient | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'solidstart', ['solidstart', 'node']);\n filterLowQualityTransactions(opts);\n\n return initNodeSdk(opts);\n}\n"],"names":["initNodeSdk"],"mappings":";;;;AAQO,SAAS,KAAK,OAAA,EAA8C;AACjE,EAAA,MAAM,IAAA,GAAO;AAAA,IACX,GAAG;AAAA,GACL;AAEA,EAAA,gBAAA,CAAiB,IAAA,EAAM,YAAA,EAAc,CAAC,YAAA,EAAc,MAAM,CAAC,CAAA;AAC3D,EAAA,4BAAA,CAA6B,IAAI,CAAA;AAEjC,EAAA,OAAOA,OAAY,IAAI,CAAA;AACzB;;;;"}
@@ -1,40 +1,21 @@
1
1
  import { splitProps, mergeProps } from 'solid-js';
2
2
  import { createComponent } from 'solid-js/web';
3
3
 
4
- // We use @sentry/solid/solidrouter on the client.
5
- // On the server, we have to create matching components
6
- // in structure to avoid hydration errors.
7
-
8
- /** Pass-through component in case user didn't specify a root **/
9
4
  function SentryDefaultRoot(props) {
10
5
  return props.children;
11
6
  }
12
-
13
- /**
14
- * On the client, router hooks are used in the router's root render prop.
15
- * This creates a matching structure that's purely pass-through to avoid hydration errors.
16
- */
17
7
  function withSentryRouterRoot(Root) {
18
8
  const SentryRouterRoot = (props) => {
19
9
  return createComponent(Root, props);
20
10
  };
21
-
22
11
  return SentryRouterRoot;
23
12
  }
24
-
25
- /**
26
- * On the client, router hooks are used to start navigation spans.
27
- * This creates a matching structure that's purely pass-through to avoid hydration errors.
28
- */
29
13
  function withSentryRouterRouting(Router) {
30
14
  const SentryRouter = (props) => {
31
- const [local, others] = splitProps(props, ['root']);
32
- // We need to wrap root here in case the user passed in their own root
15
+ const [local, others] = splitProps(props, ["root"]);
33
16
  const Root = withSentryRouterRoot(local.root ? local.root : SentryDefaultRoot);
34
-
35
17
  return createComponent(Router, mergeProps({ root: Root }, others));
36
18
  };
37
-
38
19
  return SentryRouter;
39
20
  }
40
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"solidrouter.js","sources":["../../../src/server/solidrouter.ts"],"sourcesContent":["import type { HashRouter, MemoryRouter, Router as BaseRouter, RouteSectionProps, StaticRouter } from '@solidjs/router';\nimport type { Component, JSX, ParentProps } from 'solid-js';\nimport { mergeProps, splitProps } from 'solid-js';\nimport { createComponent } from 'solid-js/web';\n\n// We use @sentry/solid/solidrouter on the client.\n// On the server, we have to create matching components\n// in structure to avoid hydration errors.\n\n/** Pass-through component in case user didn't specify a root **/\nfunction SentryDefaultRoot(props: ParentProps): JSX.Element {\n return props.children;\n}\n\n/**\n * On the client, router hooks are used in the router's root render prop.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nfunction withSentryRouterRoot(Root: Component<RouteSectionProps>): Component<RouteSectionProps> {\n const SentryRouterRoot = (props: RouteSectionProps): JSX.Element => {\n return createComponent(Root, props);\n };\n\n return SentryRouterRoot;\n}\n\nexport type RouterType = typeof BaseRouter | typeof HashRouter | typeof MemoryRouter | typeof StaticRouter;\n\n/**\n * On the client, router hooks are used to start navigation spans.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nexport function withSentryRouterRouting(Router: RouterType): RouterType {\n const SentryRouter = (props: Parameters<RouterType>[0]): JSX.Element => {\n const [local, others] = splitProps(props, ['root']);\n // We need to wrap root here in case the user passed in their own root\n const Root = withSentryRouterRoot(local.root ? local.root : SentryDefaultRoot);\n\n return createComponent(Router, mergeProps({ root: Root }, others));\n };\n\n return SentryRouter;\n}\n"],"names":[],"mappings":";;;AAKA;AACA;AACA;;AAEA;AACA,SAAS,iBAAiB,CAAC,KAAK,EAA4B;AAC5D,EAAE,OAAO,KAAK,CAAC,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,IAAI,EAA8D;AAChG,EAAE,MAAM,gBAAA,GAAmB,CAAC,KAAK,KAAqC;AACtE,IAAI,OAAO,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC;AACvC,EAAE,CAAC;;AAEH,EAAE,OAAO,gBAAgB;AACzB;;AAIA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,MAAM,EAA0B;AACxE,EAAE,MAAM,YAAA,GAAe,CAAC,KAAK,KAA6C;AAC1E,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,CAAA,GAAI,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC;AACvD;AACA,IAAI,MAAM,IAAA,GAAO,oBAAoB,CAAC,KAAK,CAAC,IAAA,GAAO,KAAK,CAAC,IAAA,GAAO,iBAAiB,CAAC;;AAElF,IAAI,OAAO,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE,IAAA,EAAM,EAAE,MAAM,CAAC,CAAC;AACtE,EAAE,CAAC;;AAEH,EAAE,OAAO,YAAY;AACrB;;;;"}
1
+ {"version":3,"file":"solidrouter.js","sources":["../../../src/server/solidrouter.ts"],"sourcesContent":["import type { HashRouter, MemoryRouter, Router as BaseRouter, RouteSectionProps, StaticRouter } from '@solidjs/router';\nimport type { Component, JSX, ParentProps } from 'solid-js';\nimport { mergeProps, splitProps } from 'solid-js';\nimport { createComponent } from 'solid-js/web';\n\n// We use @sentry/solid/solidrouter on the client.\n// On the server, we have to create matching components\n// in structure to avoid hydration errors.\n\n/** Pass-through component in case user didn't specify a root **/\nfunction SentryDefaultRoot(props: ParentProps): JSX.Element {\n return props.children;\n}\n\n/**\n * On the client, router hooks are used in the router's root render prop.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nfunction withSentryRouterRoot(Root: Component<RouteSectionProps>): Component<RouteSectionProps> {\n const SentryRouterRoot = (props: RouteSectionProps): JSX.Element => {\n return createComponent(Root, props);\n };\n\n return SentryRouterRoot;\n}\n\nexport type RouterType = typeof BaseRouter | typeof HashRouter | typeof MemoryRouter | typeof StaticRouter;\n\n/**\n * On the client, router hooks are used to start navigation spans.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nexport function withSentryRouterRouting(Router: RouterType): RouterType {\n const SentryRouter = (props: Parameters<RouterType>[0]): JSX.Element => {\n const [local, others] = splitProps(props, ['root']);\n // We need to wrap root here in case the user passed in their own root\n const Root = withSentryRouterRoot(local.root ? local.root : SentryDefaultRoot);\n\n return createComponent(Router, mergeProps({ root: Root }, others));\n };\n\n return SentryRouter;\n}\n"],"names":[],"mappings":";;;AAUA,SAAS,kBAAkB,KAAA,EAAiC;AAC1D,EAAA,OAAO,KAAA,CAAM,QAAA;AACf;AAMA,SAAS,qBAAqB,IAAA,EAAkE;AAC9F,EAAA,MAAM,gBAAA,GAAmB,CAAC,KAAA,KAA0C;AAClE,IAAA,OAAO,eAAA,CAAgB,MAAM,KAAK,CAAA;AAAA,EACpC,CAAA;AAEA,EAAA,OAAO,gBAAA;AACT;AAQO,SAAS,wBAAwB,MAAA,EAAgC;AACtE,EAAA,MAAM,YAAA,GAAe,CAAC,KAAA,KAAkD;AACtE,IAAA,MAAM,CAAC,OAAO,MAAM,CAAA,GAAI,WAAW,KAAA,EAAO,CAAC,MAAM,CAAC,CAAA;AAElD,IAAA,MAAM,OAAO,oBAAA,CAAqB,KAAA,CAAM,IAAA,GAAO,KAAA,CAAM,OAAO,iBAAiB,CAAA;AAE7E,IAAA,OAAO,eAAA,CAAgB,QAAQ,UAAA,CAAW,EAAE,MAAM,IAAA,EAAK,EAAG,MAAM,CAAC,CAAA;AAAA,EACnE,CAAA;AAEA,EAAA,OAAO,YAAA;AACT;;;;"}
@@ -1,47 +1,29 @@
1
1
  import { debug } from '@sentry/core';
2
2
  import { getGlobalScope } from '@sentry/node';
3
3
 
4
- /**
5
- * Determines if a thrown "error" is a redirect Response which Solid Start users can throw to redirect to another route.
6
- * see: https://docs.solidjs.com/solid-router/reference/data-apis/response-helpers#redirect
7
- * @param error the potential redirect error
8
- */
9
4
  function isRedirect(error) {
10
5
  if (error == null || !(error instanceof Response)) {
11
6
  return false;
12
7
  }
13
-
14
- const hasValidLocation = typeof error.headers.get('location') === 'string';
8
+ const hasValidLocation = typeof error.headers.get("location") === "string";
15
9
  const hasValidStatus = error.status >= 300 && error.status <= 308;
16
10
  return hasValidLocation && hasValidStatus;
17
11
  }
18
-
19
- /**
20
- * Filter function for low quality transactions
21
- *
22
- * Exported only for tests
23
- */
24
12
  function lowQualityTransactionsFilter(options) {
25
13
  return Object.assign(
26
- (event => {
27
- if (event.type !== 'transaction') {
14
+ ((event) => {
15
+ if (event.type !== "transaction") {
28
16
  return event;
29
17
  }
30
- // Filter out transactions for build assets
31
18
  if (event.transaction?.match(/^GET \/_build\//)) {
32
- options.debug && debug.log('SolidStartLowQualityTransactionsFilter filtered transaction', event.transaction);
19
+ options.debug && debug.log("SolidStartLowQualityTransactionsFilter filtered transaction", event.transaction);
33
20
  return null;
34
21
  }
35
22
  return event;
36
- }) ,
37
- { id: 'SolidStartLowQualityTransactionsFilter' },
23
+ }),
24
+ { id: "SolidStartLowQualityTransactionsFilter" }
38
25
  );
39
26
  }
40
-
41
- /**
42
- * Adds an event processor to filter out low quality transactions,
43
- * e.g. to filter out transactions for build assets
44
- */
45
27
  function filterLowQualityTransactions(options) {
46
28
  getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));
47
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/server/utils.ts"],"sourcesContent":["import type { EventProcessor, Options } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { getGlobalScope } from '@sentry/node';\n\n/**\n * Determines if a thrown \"error\" is a redirect Response which Solid Start users can throw to redirect to another route.\n * see: https://docs.solidjs.com/solid-router/reference/data-apis/response-helpers#redirect\n * @param error the potential redirect error\n */\nexport function isRedirect(error: unknown): boolean {\n if (error == null || !(error instanceof Response)) {\n return false;\n }\n\n const hasValidLocation = typeof error.headers.get('location') === 'string';\n const hasValidStatus = error.status >= 300 && error.status <= 308;\n return hasValidLocation && hasValidStatus;\n}\n\n/**\n * Filter function for low quality transactions\n *\n * Exported only for tests\n */\nexport function lowQualityTransactionsFilter(options: Options): EventProcessor {\n return Object.assign(\n (event => {\n if (event.type !== 'transaction') {\n return event;\n }\n // Filter out transactions for build assets\n if (event.transaction?.match(/^GET \\/_build\\//)) {\n options.debug && debug.log('SolidStartLowQualityTransactionsFilter filtered transaction', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'SolidStartLowQualityTransactionsFilter' },\n );\n}\n\n/**\n * Adds an event processor to filter out low quality transactions,\n * e.g. to filter out transactions for build assets\n */\nexport function filterLowQualityTransactions(options: Options): void {\n getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));\n}\n"],"names":[],"mappings":";;;AAIA;AACA;AACA;AACA;AACA;AACO,SAAS,UAAU,CAAC,KAAK,EAAoB;AACpD,EAAE,IAAI,KAAA,IAAS,IAAA,IAAQ,EAAE,KAAA,YAAiB,QAAQ,CAAC,EAAE;AACrD,IAAI,OAAO,KAAK;AAChB,EAAE;;AAEF,EAAE,MAAM,gBAAA,GAAmB,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAA,KAAM,QAAQ;AAC5E,EAAE,MAAM,cAAA,GAAiB,KAAK,CAAC,MAAA,IAAU,GAAA,IAAO,KAAK,CAAC,MAAA,IAAU,GAAG;AACnE,EAAE,OAAO,gBAAA,IAAoB,cAAc;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,CAAC,OAAO,EAA2B;AAC/E,EAAE,OAAO,MAAM,CAAC,MAAM;AACtB,KAAK,SAAS;AACd,MAAM,IAAI,KAAK,CAAC,IAAA,KAAS,aAAa,EAAE;AACxC,QAAQ,OAAO,KAAK;AACpB,MAAM;AACN;AACA,MAAM,IAAI,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,EAAE;AACvD,QAAQ,OAAO,CAAC,KAAA,IAAS,KAAK,CAAC,GAAG,CAAC,6DAA6D,EAAE,KAAK,CAAC,WAAW,CAAC;AACpH,QAAQ,OAAO,IAAI;AACnB,MAAM;AACN,MAAM,OAAO,KAAK;AAClB,IAAI,CAAC;AACL,IAAI,EAAE,EAAE,EAAE,wCAAA,EAA0C;AACpD,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,CAAC,OAAO,EAAiB;AACrE,EAAE,cAAc,EAAE,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;AAC3E;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/server/utils.ts"],"sourcesContent":["import type { EventProcessor, Options } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { getGlobalScope } from '@sentry/node';\n\n/**\n * Determines if a thrown \"error\" is a redirect Response which Solid Start users can throw to redirect to another route.\n * see: https://docs.solidjs.com/solid-router/reference/data-apis/response-helpers#redirect\n * @param error the potential redirect error\n */\nexport function isRedirect(error: unknown): boolean {\n if (error == null || !(error instanceof Response)) {\n return false;\n }\n\n const hasValidLocation = typeof error.headers.get('location') === 'string';\n const hasValidStatus = error.status >= 300 && error.status <= 308;\n return hasValidLocation && hasValidStatus;\n}\n\n/**\n * Filter function for low quality transactions\n *\n * Exported only for tests\n */\nexport function lowQualityTransactionsFilter(options: Options): EventProcessor {\n return Object.assign(\n (event => {\n if (event.type !== 'transaction') {\n return event;\n }\n // Filter out transactions for build assets\n if (event.transaction?.match(/^GET \\/_build\\//)) {\n options.debug && debug.log('SolidStartLowQualityTransactionsFilter filtered transaction', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'SolidStartLowQualityTransactionsFilter' },\n );\n}\n\n/**\n * Adds an event processor to filter out low quality transactions,\n * e.g. to filter out transactions for build assets\n */\nexport function filterLowQualityTransactions(options: Options): void {\n getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));\n}\n"],"names":[],"mappings":";;;AASO,SAAS,WAAW,KAAA,EAAyB;AAClD,EAAA,IAAI,KAAA,IAAS,IAAA,IAAQ,EAAE,KAAA,YAAiB,QAAA,CAAA,EAAW;AACjD,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,mBAAmB,OAAO,KAAA,CAAM,OAAA,CAAQ,GAAA,CAAI,UAAU,CAAA,KAAM,QAAA;AAClE,EAAA,MAAM,cAAA,GAAiB,KAAA,CAAM,MAAA,IAAU,GAAA,IAAO,MAAM,MAAA,IAAU,GAAA;AAC9D,EAAA,OAAO,gBAAA,IAAoB,cAAA;AAC7B;AAOO,SAAS,6BAA6B,OAAA,EAAkC;AAC7E,EAAA,OAAO,MAAA,CAAO,MAAA;AAAA,KACX,CAAA,KAAA,KAAS;AACR,MAAA,IAAI,KAAA,CAAM,SAAS,aAAA,EAAe;AAChC,QAAA,OAAO,KAAA;AAAA,MACT;AAEA,MAAA,IAAI,KAAA,CAAM,WAAA,EAAa,KAAA,CAAM,iBAAiB,CAAA,EAAG;AAC/C,QAAA,OAAA,CAAQ,KAAA,IAAS,KAAA,CAAM,GAAA,CAAI,6DAAA,EAA+D,MAAM,WAAW,CAAA;AAC3G,QAAA,OAAO,IAAA;AAAA,MACT;AACA,MAAA,OAAO,KAAA;AAAA,IACT,CAAA;AAAA,IACA,EAAE,IAAI,wCAAA;AAAyC,GACjD;AACF;AAMO,SAAS,6BAA6B,OAAA,EAAwB;AACnE,EAAA,cAAA,EAAe,CAAE,iBAAA,CAAkB,4BAAA,CAA6B,OAAO,CAAC,CAAA;AAC1E;;;;"}