@sentry/nuxt 8.35.0-alpha.0 → 8.35.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 (38) hide show
  1. package/README.md +39 -58
  2. package/build/cjs/module.js +39 -14
  3. package/build/cjs/module.js.map +1 -1
  4. package/build/cjs/server/sdk.js +30 -0
  5. package/build/cjs/server/sdk.js.map +1 -1
  6. package/build/cjs/vite/addServerConfig.js +98 -47
  7. package/build/cjs/vite/addServerConfig.js.map +1 -1
  8. package/build/cjs/vite/sourceMaps.js +208 -31
  9. package/build/cjs/vite/sourceMaps.js.map +1 -1
  10. package/build/cjs/vite/utils.js +63 -0
  11. package/build/cjs/vite/utils.js.map +1 -1
  12. package/build/esm/module.js +40 -15
  13. package/build/esm/module.js.map +1 -1
  14. package/build/esm/package.json +1 -1
  15. package/build/esm/server/sdk.js +33 -4
  16. package/build/esm/server/sdk.js.map +1 -1
  17. package/build/esm/vite/addServerConfig.js +98 -47
  18. package/build/esm/vite/addServerConfig.js.map +1 -1
  19. package/build/esm/vite/sourceMaps.js +206 -32
  20. package/build/esm/vite/sourceMaps.js.map +1 -1
  21. package/build/esm/vite/utils.js +58 -1
  22. package/build/esm/vite/utils.js.map +1 -1
  23. package/build/module/module.d.mts +9 -6
  24. package/build/module/module.d.ts +9 -6
  25. package/build/module/module.json +1 -1
  26. package/build/module/module.mjs +261 -79
  27. package/build/types/common/types.d.ts +9 -6
  28. package/build/types/common/types.d.ts.map +1 -1
  29. package/build/types/module.d.ts.map +1 -1
  30. package/build/types/server/sdk.d.ts +4 -0
  31. package/build/types/server/sdk.d.ts.map +1 -1
  32. package/build/types/vite/addServerConfig.d.ts +6 -4
  33. package/build/types/vite/addServerConfig.d.ts.map +1 -1
  34. package/build/types/vite/sourceMaps.d.ts +26 -1
  35. package/build/types/vite/sourceMaps.d.ts.map +1 -1
  36. package/build/types/vite/utils.d.ts +22 -0
  37. package/build/types/vite/utils.d.ts.map +1 -1
  38. package/package.json +8 -8
@@ -5,16 +5,60 @@ import * as fs from 'fs';
5
5
  import { sentryRollupPlugin } from '@sentry/rollup-plugin';
6
6
  import { sentryVitePlugin } from '@sentry/vite-plugin';
7
7
 
8
+ function findDefaultSdkInitFile(type) {
9
+ const possibleFileExtensions = ["ts", "js", "mjs", "cjs", "mts", "cts"];
10
+ const cwd = process.cwd();
11
+ const filePaths = [];
12
+ if (type === "server") {
13
+ for (const ext of possibleFileExtensions) {
14
+ filePaths.push(path.join(cwd, `sentry.${type}.config.${ext}`));
15
+ filePaths.push(path.join(cwd, "public", `instrument.${type}.${ext}`));
16
+ }
17
+ } else {
18
+ for (const ext of possibleFileExtensions) {
19
+ filePaths.push(path.join(cwd, `sentry.${type}.config.${ext}`));
20
+ }
21
+ }
22
+ return filePaths.find((filename) => fs.existsSync(filename));
23
+ }
24
+ const SENTRY_WRAPPED_ENTRY = "?sentry-query-wrapped-entry";
25
+ const SENTRY_FUNCTIONS_REEXPORT = "?sentry-query-functions-reexport=";
26
+ const QUERY_END_INDICATOR = "SENTRY-QUERY-END";
27
+ function removeSentryQueryFromPath(url) {
28
+ const regex = new RegExp(`\\${SENTRY_WRAPPED_ENTRY}.*?\\${QUERY_END_INDICATOR}`);
29
+ return url.replace(regex, "");
30
+ }
31
+ function extractFunctionReexportQueryParameters(query) {
32
+ const regex = new RegExp(`\\${SENTRY_FUNCTIONS_REEXPORT}(.*?)\\${QUERY_END_INDICATOR}`);
33
+ const match = query.match(regex);
34
+ return match && match[1] ? match[1].split(",").filter((param) => param !== "").map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) : [];
35
+ }
36
+ function constructFunctionReExport(pathWithQuery, entryId) {
37
+ const functionNames = extractFunctionReexportQueryParameters(pathWithQuery);
38
+ return functionNames.reduce(
39
+ (functionsCode, currFunctionName) => functionsCode.concat(
40
+ `async function reExport(...args) {
41
+ const res = await import(${JSON.stringify(entryId)});
42
+ return res.${currFunctionName}.call(this, ...args);
43
+ }
44
+ export { reExport as ${currFunctionName} };
45
+ `
46
+ ),
47
+ ""
48
+ );
49
+ }
50
+
51
+ const SERVER_CONFIG_FILENAME = "sentry.server.config";
8
52
  function addServerConfigToBuild(moduleOptions, nuxt, nitro, serverConfigFile) {
9
53
  nuxt.hook("vite:extendConfig", async (viteInlineConfig, _env) => {
10
54
  if (typeof viteInlineConfig?.build?.rollupOptions?.input === "object" && "server" in viteInlineConfig.build.rollupOptions.input) {
11
- viteInlineConfig.build.rollupOptions.input["sentry.server.config"] = createResolver(nuxt.options.srcDir).resolve(`/${serverConfigFile}`);
55
+ viteInlineConfig.build.rollupOptions.input[SERVER_CONFIG_FILENAME] = createResolver(nuxt.options.srcDir).resolve(`/${serverConfigFile}`);
12
56
  }
13
57
  nitro.hooks.hook("close", async () => {
14
58
  const buildDirResolver = createResolver(nitro.options.buildDir);
15
59
  const serverDirResolver = createResolver(nitro.options.output.serverDir);
16
- const source = buildDirResolver.resolve("dist/server/sentry.server.config.mjs");
17
- const destination = serverDirResolver.resolve("sentry.server.config.mjs");
60
+ const source = buildDirResolver.resolve(`dist/server/${SERVER_CONFIG_FILENAME}.mjs`);
61
+ const destination = serverDirResolver.resolve(`${SERVER_CONFIG_FILENAME}.mjs`);
18
62
  try {
19
63
  await fs.promises.access(source, fs.constants.F_OK);
20
64
  await fs.promises.copyFile(source, destination);
@@ -38,49 +82,74 @@ function addServerConfigToBuild(moduleOptions, nuxt, nitro, serverConfigFile) {
38
82
  });
39
83
  });
40
84
  }
41
- function addSentryTopImport(moduleOptions, nitro) {
42
- nitro.hooks.hook("close", () => {
43
- const presetsWithServerFile = ["netlify"];
44
- const entryFileName = typeof nitro.options.rollupConfig?.output.entryFileNames === "string" ? nitro.options.rollupConfig?.output.entryFileNames : presetsWithServerFile.includes(nitro.options.preset) ? "server.mjs" : "index.mjs";
45
- const serverDirResolver = createResolver(nitro.options.output.serverDir);
46
- const entryFilePath = serverDirResolver.resolve(entryFileName);
47
- try {
48
- fs.readFile(entryFilePath, "utf8", (err, data) => {
49
- const updatedContent = `import './sentry.server.config.mjs';
50
- ${data}`;
51
- fs.writeFile(entryFilePath, updatedContent, "utf8", () => {
52
- if (moduleOptions.debug) {
53
- consoleSandbox(() => {
54
- console.log(
55
- `[Sentry] Successfully added the Sentry import to the server entry file "\`${entryFilePath}\`"`
56
- );
57
- });
58
- }
59
- });
60
- });
61
- } catch (err) {
62
- if (moduleOptions.debug) {
63
- consoleSandbox(() => {
64
- console.warn(
65
- `[Sentry] An error occurred when trying to add the Sentry import to the server entry file "\`${entryFilePath}\`":`,
66
- err
67
- );
68
- });
85
+ function addDynamicImportEntryFileWrapper(nitro, serverConfigFile) {
86
+ if (!nitro.options.rollupConfig) {
87
+ nitro.options.rollupConfig = { output: {} };
88
+ }
89
+ if (nitro.options.rollupConfig?.plugins === null || nitro.options.rollupConfig?.plugins === void 0) {
90
+ nitro.options.rollupConfig.plugins = [];
91
+ } else if (!Array.isArray(nitro.options.rollupConfig.plugins)) {
92
+ nitro.options.rollupConfig.plugins = [nitro.options.rollupConfig.plugins];
93
+ }
94
+ nitro.options.rollupConfig.plugins.push(
95
+ // @ts-expect-error - This is the correct type, but it shows an error because of two different definitions
96
+ wrapEntryWithDynamicImport(createResolver(nitro.options.srcDir).resolve(`/${serverConfigFile}`))
97
+ );
98
+ }
99
+ function wrapEntryWithDynamicImport(resolvedSentryConfigPath) {
100
+ return {
101
+ name: "sentry-wrap-entry-with-dynamic-import",
102
+ async resolveId(source, importer, options) {
103
+ if (source.includes(`/${SERVER_CONFIG_FILENAME}`)) {
104
+ return { id: source, moduleSideEffects: true };
105
+ }
106
+ if (source === "import-in-the-middle/hook.mjs") {
107
+ return { id: source, moduleSideEffects: true, external: true };
108
+ }
109
+ if (options.isEntry && !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {
110
+ const resolution = await this.resolve(source, importer, options);
111
+ if (!resolution || resolution?.external)
112
+ return resolution;
113
+ const moduleInfo = await this.load(resolution);
114
+ moduleInfo.moduleSideEffects = true;
115
+ const exportedFunctions = moduleInfo.exportedBindings?.["."];
116
+ return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`) ? resolution.id : resolution.id.concat(SENTRY_WRAPPED_ENTRY).concat(exportedFunctions?.length ? SENTRY_FUNCTIONS_REEXPORT.concat(exportedFunctions.join(",")) : "").concat(QUERY_END_INDICATOR);
69
117
  }
118
+ return null;
119
+ },
120
+ load(id) {
121
+ if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {
122
+ const entryId = removeSentryQueryFromPath(id);
123
+ const reExportedFunctions = id.includes(SENTRY_FUNCTIONS_REEXPORT) ? constructFunctionReExport(id, entryId) : "";
124
+ return (
125
+ // Regular `import` of the Sentry config
126
+ `import ${JSON.stringify(resolvedSentryConfigPath)};
127
+ import(${JSON.stringify(entryId)});
128
+ import 'import-in-the-middle/hook.mjs';
129
+ ${reExportedFunctions}
130
+ `
131
+ );
132
+ }
133
+ return null;
70
134
  }
71
- });
135
+ };
72
136
  }
73
137
 
74
138
  function setupSourceMaps(moduleOptions, nuxt) {
75
139
  const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};
76
140
  const sourceMapsEnabled = sourceMapsUploadOptions.enabled ?? true;
77
- nuxt.hook("vite:extendConfig", async (viteInlineConfig, _env) => {
78
- if (sourceMapsEnabled && viteInlineConfig.mode !== "development") {
79
- viteInlineConfig.plugins = viteInlineConfig.plugins || [];
80
- viteInlineConfig.plugins.push(sentryVitePlugin(getPluginOptions(moduleOptions)));
81
- viteInlineConfig.build = viteInlineConfig.build || {};
82
- viteInlineConfig.build.sourcemap = true;
83
- logDebugInfo(moduleOptions, viteInlineConfig.build?.sourcemap);
141
+ nuxt.hook("modules:done", () => {
142
+ if (sourceMapsEnabled && !nuxt.options.dev) {
143
+ changeNuxtSourceMapSettings(nuxt, moduleOptions);
144
+ }
145
+ });
146
+ nuxt.hook("vite:extendConfig", async (viteConfig, _env) => {
147
+ if (sourceMapsEnabled && viteConfig.mode !== "development") {
148
+ const previousUserSourceMapSetting = changeViteSourceMapSettings(viteConfig, moduleOptions);
149
+ viteConfig.plugins = viteConfig.plugins || [];
150
+ viteConfig.plugins.push(
151
+ sentryVitePlugin(getPluginOptions(moduleOptions, previousUserSourceMapSetting === "unset"))
152
+ );
84
153
  }
85
154
  });
86
155
  nuxt.hook("nitro:config", (nitroConfig) => {
@@ -93,19 +162,25 @@ function setupSourceMaps(moduleOptions, nuxt) {
93
162
  } else if (!Array.isArray(nitroConfig.rollupConfig.plugins)) {
94
163
  nitroConfig.rollupConfig.plugins = [nitroConfig.rollupConfig.plugins];
95
164
  }
96
- nitroConfig.rollupConfig.plugins.push(sentryRollupPlugin(getPluginOptions(moduleOptions)));
97
- nitroConfig.rollupConfig.output = nitroConfig?.rollupConfig?.output || {};
98
- nitroConfig.rollupConfig.output.sourcemap = true;
99
- nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;
100
- logDebugInfo(moduleOptions, nitroConfig.rollupConfig.output?.sourcemap);
165
+ const previousUserSourceMapSetting = changeRollupSourceMapSettings(nitroConfig, moduleOptions);
166
+ nitroConfig.rollupConfig.plugins.push(
167
+ sentryRollupPlugin(getPluginOptions(moduleOptions, previousUserSourceMapSetting === "unset"))
168
+ );
101
169
  }
102
170
  });
103
171
  }
104
172
  function normalizePath(path) {
105
173
  return path.replace(/^(\.\.\/)+/, "./");
106
174
  }
107
- function getPluginOptions(moduleOptions) {
175
+ function getPluginOptions(moduleOptions, deleteFilesAfterUpload) {
108
176
  const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};
177
+ if (typeof sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload === "undefined" && deleteFilesAfterUpload) {
178
+ consoleSandbox(() => {
179
+ console.log(
180
+ '[Sentry] Setting `sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [".*/**/*.map"]` to delete generated source maps after they were uploaded to Sentry.'
181
+ );
182
+ });
183
+ }
109
184
  return {
110
185
  org: sourceMapsUploadOptions.org ?? process.env.SENTRY_ORG,
111
186
  project: sourceMapsUploadOptions.project ?? process.env.SENTRY_PROJECT,
@@ -120,43 +195,129 @@ function getPluginOptions(moduleOptions) {
120
195
  ...moduleOptions?.unstable_sentryBundlerPluginOptions,
121
196
  sourcemaps: {
122
197
  // The server/client files are in different places depending on the nitro preset (e.g. '.output/server' or '.netlify/functions-internal/server')
123
- // We cannot determine automatically how the build folder looks like (depends on the preset), so we have to accept that sourcemaps are uploaded multiple times (with the vitePlugin for Nuxt and the rollupPlugin for Nitro).
198
+ // We cannot determine automatically how the build folder looks like (depends on the preset), so we have to accept that source maps are uploaded multiple times (with the vitePlugin for Nuxt and the rollupPlugin for Nitro).
124
199
  // If we could know where the server/client assets are located, we could do something like this (based on the Nitro preset): isNitro ? ['./.output/server/**/*'] : ['./.output/public/**/*'],
125
200
  assets: sourceMapsUploadOptions.sourcemaps?.assets ?? void 0,
126
201
  ignore: sourceMapsUploadOptions.sourcemaps?.ignore ?? void 0,
127
- filesToDeleteAfterUpload: sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload ?? void 0,
202
+ filesToDeleteAfterUpload: sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload ? sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload : deleteFilesAfterUpload ? [".*/**/*.map"] : void 0,
128
203
  rewriteSources: (source) => normalizePath(source),
129
204
  ...moduleOptions?.unstable_sentryBundlerPluginOptions?.sourcemaps
130
205
  }
131
206
  };
132
207
  }
133
- function logDebugInfo(moduleOptions, sourceMapsPreviouslyEnabled) {
134
- if (moduleOptions.debug && !sourceMapsPreviouslyEnabled) {
135
- console.log("[Sentry]: Enabled source maps generation in the Vite build options.");
136
- const sourceMapsUploadOptions = moduleOptions.sourceMapsUploadOptions || {};
137
- if (!sourceMapsUploadOptions.sourcemaps?.filesToDeleteAfterUpload) {
138
- console.warn(
139
- "[Sentry] We recommend setting the `sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload` option to clean up source maps after uploading. Otherwise, source maps might be deployed to production, depending on your configuration"
140
- );
208
+ function changeNuxtSourceMapSettings(nuxt, sentryModuleOptions) {
209
+ nuxt.options = nuxt.options || {};
210
+ nuxt.options.sourcemap = nuxt.options.sourcemap ?? { server: void 0, client: void 0 };
211
+ let previousUserSourceMapSetting = {
212
+ client: void 0,
213
+ server: void 0
214
+ };
215
+ const nuxtSourceMap = nuxt.options.sourcemap;
216
+ if (typeof nuxtSourceMap === "string" || typeof nuxtSourceMap === "boolean" || typeof nuxtSourceMap === "undefined") {
217
+ switch (nuxtSourceMap) {
218
+ case false:
219
+ warnExplicitlyDisabledSourceMap("sourcemap");
220
+ previousUserSourceMapSetting = { client: "disabled", server: "disabled" };
221
+ break;
222
+ case "hidden":
223
+ case true:
224
+ logKeepSourceMapSetting(sentryModuleOptions, "sourcemap", nuxtSourceMap.toString());
225
+ previousUserSourceMapSetting = { client: "enabled", server: "enabled" };
226
+ break;
227
+ case void 0:
228
+ nuxt.options.sourcemap = { server: "hidden", client: "hidden" };
229
+ logSentryEnablesSourceMap("sourcemap.client", "hidden");
230
+ logSentryEnablesSourceMap("sourcemap.server", "hidden");
231
+ previousUserSourceMapSetting = { client: "unset", server: "unset" };
232
+ break;
233
+ }
234
+ } else {
235
+ if (nuxtSourceMap.client === false) {
236
+ warnExplicitlyDisabledSourceMap("sourcemap.client");
237
+ previousUserSourceMapSetting.client = "disabled";
238
+ } else if (["hidden", true].includes(nuxtSourceMap.client)) {
239
+ logKeepSourceMapSetting(sentryModuleOptions, "sourcemap.client", nuxtSourceMap.client.toString());
240
+ previousUserSourceMapSetting.client = "enabled";
241
+ } else {
242
+ nuxt.options.sourcemap.client = "hidden";
243
+ logSentryEnablesSourceMap("sourcemap.client", "hidden");
244
+ previousUserSourceMapSetting.client = "unset";
245
+ }
246
+ if (nuxtSourceMap.server === false) {
247
+ warnExplicitlyDisabledSourceMap("sourcemap.server");
248
+ previousUserSourceMapSetting.server = "disabled";
249
+ } else if (["hidden", true].includes(nuxtSourceMap.server)) {
250
+ logKeepSourceMapSetting(sentryModuleOptions, "sourcemap.server", nuxtSourceMap.server.toString());
251
+ previousUserSourceMapSetting.server = "enabled";
252
+ } else {
253
+ nuxt.options.sourcemap.server = "hidden";
254
+ logSentryEnablesSourceMap("sourcemap.server", "hidden");
255
+ previousUserSourceMapSetting.server = "unset";
141
256
  }
142
257
  }
258
+ return previousUserSourceMapSetting;
143
259
  }
144
-
145
- function findDefaultSdkInitFile(type) {
146
- const possibleFileExtensions = ["ts", "js", "mjs", "cjs", "mts", "cts"];
147
- const cwd = process.cwd();
148
- const filePaths = [];
149
- if (type === "server") {
150
- for (const ext of possibleFileExtensions) {
151
- filePaths.push(path.join(cwd, `sentry.${type}.config.${ext}`));
152
- filePaths.push(path.join(cwd, "public", `instrument.${type}.${ext}`));
153
- }
260
+ function changeViteSourceMapSettings(viteConfig, sentryModuleOptions) {
261
+ viteConfig.build = viteConfig.build || {};
262
+ const viteSourceMap = viteConfig.build.sourcemap;
263
+ let previousUserSourceMapSetting;
264
+ if (viteSourceMap === false) {
265
+ warnExplicitlyDisabledSourceMap("vite.build.sourcemap");
266
+ previousUserSourceMapSetting = "disabled";
267
+ } else if (viteSourceMap && ["hidden", "inline", true].includes(viteSourceMap)) {
268
+ logKeepSourceMapSetting(sentryModuleOptions, "vite.build.sourcemap", viteSourceMap.toString());
269
+ previousUserSourceMapSetting = "enabled";
154
270
  } else {
155
- for (const ext of possibleFileExtensions) {
156
- filePaths.push(path.join(cwd, `sentry.${type}.config.${ext}`));
157
- }
271
+ viteConfig.build.sourcemap = "hidden";
272
+ logSentryEnablesSourceMap("vite.build.sourcemap", "hidden");
273
+ previousUserSourceMapSetting = "unset";
158
274
  }
159
- return filePaths.find((filename) => fs.existsSync(filename));
275
+ return previousUserSourceMapSetting;
276
+ }
277
+ function changeRollupSourceMapSettings(nitroConfig, sentryModuleOptions) {
278
+ nitroConfig.rollupConfig = nitroConfig.rollupConfig || {};
279
+ nitroConfig.rollupConfig.output = nitroConfig.rollupConfig.output || { sourcemap: void 0 };
280
+ let previousUserSourceMapSetting;
281
+ const nitroSourceMap = nitroConfig.rollupConfig.output.sourcemap;
282
+ if (nitroSourceMap === false) {
283
+ warnExplicitlyDisabledSourceMap("nitro.rollupConfig.output.sourcemap");
284
+ previousUserSourceMapSetting = "disabled";
285
+ } else if (nitroSourceMap && ["hidden", "inline", true].includes(nitroSourceMap)) {
286
+ logKeepSourceMapSetting(sentryModuleOptions, "nitro.rollupConfig.output.sourcemap", nitroSourceMap.toString());
287
+ previousUserSourceMapSetting = "enabled";
288
+ } else {
289
+ nitroConfig.rollupConfig.output.sourcemap = "hidden";
290
+ logSentryEnablesSourceMap("nitro.rollupConfig.output.sourcemap", "hidden");
291
+ previousUserSourceMapSetting = "unset";
292
+ }
293
+ nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;
294
+ consoleSandbox(() => {
295
+ console.log(
296
+ "[Sentry] Disabled source map setting in the Nuxt config: `nitro.rollupConfig.output.sourcemapExcludeSources`. Source maps will include the actual code to be able to un-minify code snippets in Sentry."
297
+ );
298
+ });
299
+ return previousUserSourceMapSetting;
300
+ }
301
+ function logKeepSourceMapSetting(sentryNuxtModuleOptions, settingKey, settingValue) {
302
+ if (sentryNuxtModuleOptions.debug) {
303
+ consoleSandbox(() => {
304
+ console.log(
305
+ `[Sentry] We discovered \`${settingKey}\` is set to \`${settingValue}\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`
306
+ );
307
+ });
308
+ }
309
+ }
310
+ function warnExplicitlyDisabledSourceMap(settingKey) {
311
+ consoleSandbox(() => {
312
+ console.warn(
313
+ `[Sentry] Parts of source map generation are currently disabled in your Nuxt 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}\`.`
314
+ );
315
+ });
316
+ }
317
+ function logSentryEnablesSourceMap(settingKey, settingValue) {
318
+ consoleSandbox(() => {
319
+ console.log(`[Sentry] Enabled source map generation in the build options with \`${settingKey}: ${settingValue}\`.`);
320
+ });
160
321
  }
161
322
 
162
323
  const module = defineNuxtModule({
@@ -168,7 +329,12 @@ const module = defineNuxtModule({
168
329
  }
169
330
  },
170
331
  defaults: {},
171
- setup(moduleOptions, nuxt) {
332
+ setup(moduleOptionsParam, nuxt) {
333
+ const moduleOptions = {
334
+ ...moduleOptionsParam,
335
+ dynamicImportForServerEntry: moduleOptionsParam.dynamicImportForServerEntry !== false
336
+ // default: true
337
+ };
172
338
  const moduleDirResolver = createResolver(import.meta.url);
173
339
  const buildDirResolver = createResolver(nuxt.options.buildDir);
174
340
  const clientConfigFile = findDefaultSdkInitFile("client");
@@ -192,13 +358,15 @@ const module = defineNuxtModule({
192
358
  }
193
359
  const serverConfigFile = findDefaultSdkInitFile("server");
194
360
  if (serverConfigFile) {
195
- addPluginTemplate({
196
- mode: "server",
197
- filename: "sentry-server-config.mjs",
198
- getContents: () => `import "${buildDirResolver.resolve(`/${serverConfigFile}`)}"
361
+ if (moduleOptions.dynamicImportForServerEntry === false) {
362
+ addPluginTemplate({
363
+ mode: "server",
364
+ filename: "sentry-server-config.mjs",
365
+ getContents: () => `import "${buildDirResolver.resolve(`/${serverConfigFile}`)}"
199
366
  import { defineNuxtPlugin } from "#imports"
200
367
  export default defineNuxtPlugin(() => {})`
201
- });
368
+ });
369
+ }
202
370
  addServerPlugin(moduleDirResolver.resolve("./runtime/plugins/sentry.server"));
203
371
  }
204
372
  if (clientConfigFile || serverConfigFile) {
@@ -206,10 +374,15 @@ export default defineNuxtPlugin(() => {})`
206
374
  }
207
375
  nuxt.hooks.hook("nitro:init", (nitro) => {
208
376
  if (serverConfigFile && serverConfigFile.includes(".server.config")) {
209
- addServerConfigToBuild(moduleOptions, nuxt, nitro, serverConfigFile);
210
- if (moduleOptions.experimental_basicServerTracing) {
211
- addSentryTopImport(moduleOptions, nitro);
212
- } else {
377
+ if (nitro.options.dev) {
378
+ consoleSandbox(() => {
379
+ console.log(
380
+ "[Sentry] Your application is running in development mode. Note: @sentry/nuxt is in beta and may not work as expected on the server-side (Nitro). Errors are reported, but tracing does not work."
381
+ );
382
+ });
383
+ }
384
+ if (moduleOptions.dynamicImportForServerEntry === false) {
385
+ addServerConfigToBuild(moduleOptions, nuxt, nitro, serverConfigFile);
213
386
  if (moduleOptions.debug) {
214
387
  const serverDirResolver = createResolver(nitro.options.output.serverDir);
215
388
  const serverConfigPath = serverDirResolver.resolve("sentry.server.config.mjs");
@@ -220,6 +393,15 @@ export default defineNuxtPlugin(() => {})`
220
393
  );
221
394
  });
222
395
  }
396
+ } else {
397
+ addDynamicImportEntryFileWrapper(nitro, serverConfigFile);
398
+ if (moduleOptions.debug) {
399
+ consoleSandbox(() => {
400
+ console.log(
401
+ "[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes."
402
+ );
403
+ });
404
+ }
223
405
  }
224
406
  }
225
407
  });
@@ -90,16 +90,19 @@ export type SentryNuxtModuleOptions = {
90
90
  */
91
91
  debug?: boolean;
92
92
  /**
93
- * Enabling basic server tracing can be used for environments where modifying the node option `--import` is not possible.
94
- * However, enabling this option only supports limited tracing instrumentation. Only http traces will be collected (but no database-specific traces etc.).
93
+ * Wraps the server entry file with a dynamic `import()`. This will make it possible to preload Sentry and register
94
+ * necessary hooks before other code runs. (Node docs: https://nodejs.org/api/module.html#enabling)
95
95
  *
96
- * If this option is `true`, the Sentry SDK will import the Sentry server config at the top of the server entry file to load the SDK on the server.
96
+ * If this option is `false`, the Sentry SDK won't wrap the server entry file with `import()`. Not wrapping the
97
+ * server entry file will disable Sentry on the server-side. When you set this option to `false`, make sure
98
+ * to add the Sentry server config with the node `--import` CLI flag to enable Sentry on the server-side.
97
99
  *
98
- * **DO NOT** enable this option if you've already added the node option `--import` in your node start script. This would initialize Sentry twice on the server-side and leads to unexpected issues.
100
+ * **DO NOT** add the node CLI flag `--import` in your node start script, when `dynamicImportForServerEntry` is set to `true` (default).
101
+ * This would initialize Sentry twice on the server-side and this leads to unexpected issues.
99
102
  *
100
- * @default false
103
+ * @default true
101
104
  */
102
- experimental_basicServerTracing?: boolean;
105
+ dynamicImportForServerEntry?: boolean;
103
106
  /**
104
107
  * Options to be passed directly to the Sentry Rollup Plugin (`@sentry/rollup-plugin`) and Sentry Vite Plugin (`@sentry/vite-plugin`) that ship with the Sentry Nuxt SDK.
105
108
  * You can use this option to override any options the SDK passes to the Vite (for Nuxt) and Rollup (for Nitro) plugin.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAGnD,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC;AAC1F,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC;AAE3F,KAAK,iBAAiB,GAAG;IACvB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;;;;;;;;WASG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAEhC;;;;;;;WAOG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAEhC;;;;;;;WAOG;QACH,wBAAwB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;KACnD,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,iBAAiB,CAAC;IAE5C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;;;;;;;OASG;IACH,+BAA+B,CAAC,EAAE,OAAO,CAAC;IAE1C;;;;;OAKG;IACH,mCAAmC,CAAC,EAAE,yBAAyB,GAAG,uBAAuB,CAAC;CAC3F,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAGnD,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC;AAC1F,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC;AAE3F,KAAK,iBAAiB,GAAG;IACvB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;;;;;;;;WASG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAEhC;;;;;;;WAOG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAEhC;;;;;;;WAOG;QACH,wBAAwB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;KACnD,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,iBAAiB,CAAC;IAE5C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;;;;;;;;;;OAYG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IAEtC;;;;;OAKG;IACH,mCAAmC,CAAC,EAAE,yBAAyB,GAAG,uBAAuB,CAAC;CAC3F,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAK9D,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC;;AAEpD,wBAkFG"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAK9D,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC;;AAEpD,wBA2GG"}
@@ -13,4 +13,8 @@ export declare function init(options: SentryNuxtServerOptions): Client | undefin
13
13
  * Only exported for Testing purposes.
14
14
  */
15
15
  export declare function mergeRegisterEsmLoaderHooks(options: SentryNuxtServerOptions): SentryNuxtServerOptions['registerEsmLoaderHooks'];
16
+ /**
17
+ * Flushes pending Sentry events with a 2-second timeout and in a way that cannot create unhandled promise rejections.
18
+ */
19
+ export declare function flushSafelyWithTimeout(): Promise<void>;
16
20
  //# sourceMappingURL=sdk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/server/sdk.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,eAAe,CAAC;AAG5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,GAAG,SAAS,CAkCzE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAAC,wBAAwB,CAAC,CASnD"}
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/server/sdk.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAA+B,MAAM,eAAe,CAAC;AAGzE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,GAAG,SAAS,CAmCzE;AAiBD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAAC,wBAAwB,CAAC,CASnD;AAED;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ5D"}
@@ -9,9 +9,11 @@ import type { SentryNuxtModuleOptions } from '../common/types';
9
9
  */
10
10
  export declare function addServerConfigToBuild(moduleOptions: SentryNuxtModuleOptions, nuxt: Nuxt, nitro: Nitro, serverConfigFile: string): void;
11
11
  /**
12
- * Adds the Sentry server config import at the top of the server entry file to load the SDK on the server.
13
- * This is necessary for environments where modifying the node option `--import` is not possible.
14
- * However, only limited tracing instrumentation is supported when doing this.
12
+ * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)
13
+ * and adds the Sentry server config with the static `import` declaration.
14
+ *
15
+ * With this, the Sentry server config can be loaded before all other modules of the application (which is needed for import-in-the-middle).
16
+ * See: https://nodejs.org/api/module.html#enabling
15
17
  */
16
- export declare function addSentryTopImport(moduleOptions: SentryNuxtModuleOptions, nitro: Nitro): void;
18
+ export declare function addDynamicImportEntryFileWrapper(nitro: Nitro, serverConfigFile: string): void;
17
19
  //# sourceMappingURL=addServerConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addServerConfig.d.ts","sourceRoot":"","sources":["../../../src/vite/addServerConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,uBAAuB,EACtC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,MAAM,GACvB,IAAI,CA8CN;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,uBAAuB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAyC7F"}
1
+ {"version":3,"file":"addServerConfig.d.ts","sourceRoot":"","sources":["../../../src/vite/addServerConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAW/D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,uBAAuB,EACtC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,MAAM,GACvB,IAAI,CA8CN;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAgB7F"}
@@ -1,7 +1,12 @@
1
1
  import type { Nuxt } from '@nuxt/schema';
2
2
  import { type SentryRollupPluginOptions } from '@sentry/rollup-plugin';
3
3
  import { type SentryVitePluginOptions } from '@sentry/vite-plugin';
4
+ import type { OutputOptions } from 'rollup';
4
5
  import type { SentryNuxtModuleOptions } from '../common/types';
6
+ /**
7
+ * Whether the user enabled (true, 'hidden', 'inline') or disabled (false) source maps
8
+ */
9
+ export type UserSourceMapSetting = 'enabled' | 'disabled' | 'unset' | undefined;
5
10
  /**
6
11
  * Setup source maps for Sentry inside the Nuxt module during build time (in Vite for Nuxt and Rollup for Nitro).
7
12
  */
@@ -11,5 +16,25 @@ export declare function setupSourceMaps(moduleOptions: SentryNuxtModuleOptions,
11
16
  *
12
17
  * Only exported for Testing purposes.
13
18
  */
14
- export declare function getPluginOptions(moduleOptions: SentryNuxtModuleOptions): SentryVitePluginOptions | SentryRollupPluginOptions;
19
+ export declare function getPluginOptions(moduleOptions: SentryNuxtModuleOptions, deleteFilesAfterUpload: boolean): SentryVitePluginOptions | SentryRollupPluginOptions;
20
+ /** only exported for testing */
21
+ export declare function changeNuxtSourceMapSettings(nuxt: Nuxt, sentryModuleOptions: SentryNuxtModuleOptions): {
22
+ client: UserSourceMapSetting;
23
+ server: UserSourceMapSetting;
24
+ };
25
+ /** only exported for testing */
26
+ export declare function changeViteSourceMapSettings(viteConfig: {
27
+ build?: {
28
+ sourcemap?: boolean | 'inline' | 'hidden';
29
+ };
30
+ }, sentryModuleOptions: SentryNuxtModuleOptions): UserSourceMapSetting;
31
+ /** only exported for testing */
32
+ export declare function changeRollupSourceMapSettings(nitroConfig: {
33
+ rollupConfig?: {
34
+ output?: {
35
+ sourcemap?: OutputOptions['sourcemap'];
36
+ sourcemapExcludeSources?: OutputOptions['sourcemapExcludeSources'];
37
+ };
38
+ };
39
+ }, sentryModuleOptions: SentryNuxtModuleOptions): UserSourceMapSetting;
15
40
  //# sourceMappingURL=sourceMaps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sourceMaps.d.ts","sourceRoot":"","sources":["../../../src/vite/sourceMaps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,yBAAyB,EAAsB,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,KAAK,uBAAuB,EAAoB,MAAM,qBAAqB,CAAC;AAErF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;GAEG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CA0CxF;AASD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,uBAAuB,GACrC,uBAAuB,GAAG,yBAAyB,CA2BrD"}
1
+ {"version":3,"file":"sourceMaps.d.ts","sourceRoot":"","sources":["../../../src/vite/sourceMaps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,yBAAyB,EAAsB,MAAM,uBAAuB,CAAC;AAE3F,OAAO,EAAE,KAAK,uBAAuB,EAAoB,MAAM,qBAAqB,CAAC;AAErF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhF;;GAEG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CA2CxF;AASD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,uBAAuB,EACtC,sBAAsB,EAAE,OAAO,GAC9B,uBAAuB,GAAG,yBAAyB,CAwCrD;AAgBD,gCAAgC;AAChC,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,mBAAmB,EAAE,uBAAuB,GAC3C;IAAE,MAAM,EAAE,oBAAoB,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,CAyDhE;AAED,gCAAgC;AAChC,wBAAgB,2BAA2B,CACzC,UAAU,EAAE;IAAE,KAAK,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAA;KAAE,CAAA;CAAE,EACrE,mBAAmB,EAAE,uBAAuB,GAC3C,oBAAoB,CAmBtB;AAED,gCAAgC;AAChC,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE;IACX,YAAY,CAAC,EAAE;QACb,MAAM,CAAC,EAAE;YACP,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;YACvC,uBAAuB,CAAC,EAAE,aAAa,CAAC,yBAAyB,CAAC,CAAC;SACpE,CAAC;KACH,CAAC;CACH,EACD,mBAAmB,EAAE,uBAAuB,GAC3C,oBAAoB,CA6BtB"}
@@ -3,4 +3,26 @@
3
3
  * The sentry.server.config file is prioritized over the instrument.server file.
4
4
  */
5
5
  export declare function findDefaultSdkInitFile(type: 'server' | 'client'): string | undefined;
6
+ export declare const SENTRY_WRAPPED_ENTRY = "?sentry-query-wrapped-entry";
7
+ export declare const SENTRY_FUNCTIONS_REEXPORT = "?sentry-query-functions-reexport=";
8
+ export declare const QUERY_END_INDICATOR = "SENTRY-QUERY-END";
9
+ /**
10
+ * Strips the Sentry query part from a path.
11
+ * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path
12
+ *
13
+ * Only exported for testing.
14
+ */
15
+ export declare function removeSentryQueryFromPath(url: string): string;
16
+ /**
17
+ * Extracts and sanitizes function re-export query parameters from a query string.
18
+ * If it is a default export, it is not considered for re-exporting. This function is mostly relevant for re-exporting
19
+ * serverless `handler` functions.
20
+ *
21
+ * Only exported for testing.
22
+ */
23
+ export declare function extractFunctionReexportQueryParameters(query: string): string[];
24
+ /**
25
+ * Constructs a code snippet with function reexports (can be used in Rollup plugins)
26
+ */
27
+ export declare function constructFunctionReExport(pathWithQuery: string, entryId: string): string;
6
28
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/vite/utils.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAkBpF"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/vite/utils.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAkBpF;AAED,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAClE,eAAO,MAAM,yBAAyB,sCAAsC,CAAC;AAC7E,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7D;AAED;;;;;;GAMG;AACH,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAa9E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAcxF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/nuxt",
3
- "version": "8.35.0-alpha.0",
3
+ "version": "8.35.0",
4
4
  "description": "Official Sentry SDK for Nuxt (EXPERIMENTAL)",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/nuxt",
@@ -43,15 +43,15 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@nuxt/kit": "^3.13.2",
46
- "@sentry/browser": "8.35.0-alpha.0",
47
- "@sentry/core": "8.35.0-alpha.0",
48
- "@sentry/node": "8.35.0-alpha.0",
49
- "@sentry/opentelemetry": "8.35.0-alpha.0",
46
+ "@sentry/browser": "8.35.0",
47
+ "@sentry/core": "8.35.0",
48
+ "@sentry/node": "8.35.0",
49
+ "@sentry/opentelemetry": "8.35.0",
50
50
  "@sentry/rollup-plugin": "2.22.3",
51
- "@sentry/types": "8.35.0-alpha.0",
52
- "@sentry/utils": "8.35.0-alpha.0",
51
+ "@sentry/types": "8.35.0",
52
+ "@sentry/utils": "8.35.0",
53
53
  "@sentry/vite-plugin": "2.22.3",
54
- "@sentry/vue": "8.35.0-alpha.0"
54
+ "@sentry/vue": "8.35.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@nuxt/module-builder": "^0.8.4",