@sentry/nuxt 11.0.0-beta.1 → 11.0.0-beta.2

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 (52) hide show
  1. package/build/cjs/common/devMode.js +16 -0
  2. package/build/cjs/common/devMode.js.map +1 -1
  3. package/build/cjs/module.js +32 -48
  4. package/build/cjs/module.js.map +1 -1
  5. package/build/cjs/server/sdk.js +15 -0
  6. package/build/cjs/server/sdk.js.map +1 -1
  7. package/build/cjs/vite/addServerConfig.js +77 -30
  8. package/build/cjs/vite/addServerConfig.js.map +1 -1
  9. package/build/cjs/vite/middlewareConfig.js +7 -6
  10. package/build/cjs/vite/middlewareConfig.js.map +1 -1
  11. package/build/cjs/vite/orchestrion.js +2 -1
  12. package/build/cjs/vite/orchestrion.js.map +1 -1
  13. package/build/cjs/vite/utils.js +15 -9
  14. package/build/cjs/vite/utils.js.map +1 -1
  15. package/build/esm/common/devMode.js +12 -1
  16. package/build/esm/common/devMode.js.map +1 -1
  17. package/build/esm/module.js +34 -50
  18. package/build/esm/module.js.map +1 -1
  19. package/build/esm/package.json +1 -1
  20. package/build/esm/server/sdk.js +17 -2
  21. package/build/esm/server/sdk.js.map +1 -1
  22. package/build/esm/vite/addServerConfig.js +78 -31
  23. package/build/esm/vite/addServerConfig.js.map +1 -1
  24. package/build/esm/vite/middlewareConfig.js +7 -6
  25. package/build/esm/vite/middlewareConfig.js.map +1 -1
  26. package/build/esm/vite/orchestrion.js +2 -1
  27. package/build/esm/vite/orchestrion.js.map +1 -1
  28. package/build/esm/vite/utils.js +15 -9
  29. package/build/esm/vite/utils.js.map +1 -1
  30. package/build/module/common/devMode.d.ts +12 -2
  31. package/build/module/common/types.d.ts +7 -0
  32. package/build/module/module.json +1 -1
  33. package/build/module/module.mjs +129 -89
  34. package/build/module/runtime/utils/instrumentDatabase.js +3 -2
  35. package/build/module/vite/addServerConfig.d.ts +10 -8
  36. package/build/module/vite/middlewareConfig.d.ts +2 -1
  37. package/build/module/vite/utils.d.ts +11 -3
  38. package/build/types/common/devMode.d.ts +12 -2
  39. package/build/types/common/devMode.d.ts.map +1 -1
  40. package/build/types/common/types.d.ts +7 -0
  41. package/build/types/common/types.d.ts.map +1 -1
  42. package/build/types/module.d.ts.map +1 -1
  43. package/build/types/runtime/utils/instrumentDatabase.d.ts.map +1 -1
  44. package/build/types/server/sdk.d.ts.map +1 -1
  45. package/build/types/vite/addServerConfig.d.ts +10 -8
  46. package/build/types/vite/addServerConfig.d.ts.map +1 -1
  47. package/build/types/vite/middlewareConfig.d.ts +2 -1
  48. package/build/types/vite/middlewareConfig.d.ts.map +1 -1
  49. package/build/types/vite/orchestrion.d.ts.map +1 -1
  50. package/build/types/vite/utils.d.ts +11 -3
  51. package/build/types/vite/utils.d.ts.map +1 -1
  52. package/package.json +9 -9
@@ -1,4 +1,4 @@
1
- import { resolvePath, createResolver, addTemplate, useNuxt, addServerPlugin, addServerImports, defineNuxtModule, addPluginTemplate, addPlugin, addVitePlugin } from '@nuxt/kit';
1
+ import { resolvePath, createResolver, addTemplate, addServerPlugin, useNuxt, addServerImports, defineNuxtModule, addPluginTemplate, addPlugin, addVitePlugin } from '@nuxt/kit';
2
2
  import { consoleSandbox, debug, warnOnRemovedBuildOptions } from '@sentry/core';
3
3
  import * as path from 'path';
4
4
  import { existsSync } from 'node:fs';
@@ -12,18 +12,25 @@ import { sentryVitePlugin } from '@sentry/bundler-plugins/vite';
12
12
  import { createSentryBuildPluginManager } from '@sentry/bundler-plugins/core';
13
13
 
14
14
  const NUXT_DEV_MODE_FLAG = "__SENTRY_NUXT_DEV_MODE__";
15
+ const NUXT_PRERENDER_FLAG = "__SENTRY_NUXT_PRERENDER__";
15
16
 
16
- async function getNitroMajorVersion() {
17
+ async function getNitroMajorVersion(rootDir) {
17
18
  try {
18
19
  const { getPackageInfo } = await import('local-pkg');
19
- const info = await getPackageInfo("nitro");
20
- if (info?.version) {
21
- const major = parseInt(info.version.split(".")[0] ?? "2", 10);
22
- return isNaN(major) ? 2 : major;
20
+ const fromPackage = (dir) => ({ paths: [path.join(dir, "package.json")] });
21
+ let provider = await getPackageInfo("nuxt", fromPackage(rootDir));
22
+ if (provider?.packageJson.dependencies?.["@nuxt/nitro-server"]) {
23
+ provider = await getPackageInfo("@nuxt/nitro-server", fromPackage(provider.rootPath)) ?? provider;
23
24
  }
25
+ if (!provider?.packageJson.dependencies?.nitro) {
26
+ return 2;
27
+ }
28
+ const info = await getPackageInfo("nitro", fromPackage(provider.rootPath));
29
+ const major = parseInt(info?.version?.split(".")[0] ?? "", 10);
30
+ return isNaN(major) ? 3 : major;
24
31
  } catch {
32
+ return 2;
25
33
  }
26
- return 2;
27
34
  }
28
35
  async function findDefaultSdkInitFile(type, nuxt, options) {
29
36
  const possibleFileExtensions = ["ts", "js", "mjs", "cjs", "mts", "cts"];
@@ -47,8 +54,8 @@ async function findDefaultSdkInitFile(type, nuxt, options) {
47
54
  return void 0;
48
55
  }
49
56
  const SERVER_CONFIG_FILENAME = "sentry.server.config";
50
- function toImportSpecifier(fromDir, filePath) {
51
- return `./${path.relative(fromDir, filePath).split(/[\\/]/).join("/")}`;
57
+ function isCloudflarePreset(preset) {
58
+ return !!preset?.replace(/-/g, "_").startsWith("cloudflare");
52
59
  }
53
60
  function getFilenameFromNodeStartCommand(nodeCommand) {
54
61
  const regex = /[^/\\]+\.[^/\\]+$/;
@@ -150,31 +157,6 @@ function addOTelCommonJSImportAlias(nuxt, isNitroV3 = false) {
150
157
  }
151
158
  }
152
159
 
153
- const DEV_SERVER_CONFIG_PATH = `dev/${SERVER_CONFIG_FILENAME}.mjs`;
154
- function addDevServerConfigFile(nuxt, serverConfigFile) {
155
- const configPath = createResolver(nuxt.options.rootDir).resolve(serverConfigFile);
156
- const importSpecifier = toImportSpecifier(
157
- nuxt.options.rootDir,
158
- path.join(nuxt.options.buildDir, DEV_SERVER_CONFIG_PATH)
159
- );
160
- const failureMessage = `[Sentry] Could not load \`${path.basename(configPath)}\`, so Sentry is disabled during development. Node loads this file without a build step, so it supports neither path aliases (like #import) nor non-erasable TypeScript syntax (like enums).`;
161
- addTemplate({
162
- filename: DEV_SERVER_CONFIG_PATH,
163
- write: true,
164
- getContents: () => [
165
- "// Generated by @sentry/nuxt. Preload it to enable Sentry during development:",
166
- `// NODE_OPTIONS='--import ${importSpecifier}' nuxt dev`,
167
- // A static import would hoist above this assignment, and would make a broken config crash the dev server.
168
- `globalThis.${NUXT_DEV_MODE_FLAG} = true;`,
169
- "try {",
170
- ` await import(${JSON.stringify(pathToFileURL(configPath).href)});`,
171
- "} catch (error) {",
172
- ` console.warn(${JSON.stringify(failureMessage)}, error);`,
173
- "}",
174
- ""
175
- ].join("\n")
176
- });
177
- }
178
160
  const CONFIG_EXTENSIONS = [".ts", ".js", ".mjs", ".cjs", ".mts", ".cts"];
179
161
  function isServerConfigFile(sourcePath, resolvedPath) {
180
162
  if (sourcePath === resolvedPath) {
@@ -222,6 +204,78 @@ ${data}`;
222
204
  }
223
205
  });
224
206
  }
207
+ function addServerConfigPlugin(nuxt, serverConfigFile) {
208
+ const configPath = createResolver(nuxt.options.rootDir).resolve(serverConfigFile);
209
+ const runtimeFlagsTemplate = addTemplate({
210
+ filename: "sentry-runtime-flags.mjs",
211
+ write: true,
212
+ getContents: () => [
213
+ "// Generated by @sentry/nuxt. Sets runtime flags before the Sentry server config evaluates.",
214
+ `globalThis.${NUXT_DEV_MODE_FLAG} = import.meta.dev === true;`,
215
+ `globalThis.${NUXT_PRERENDER_FLAG} = import.meta.prerender === true;`,
216
+ ""
217
+ ].join("\n")
218
+ });
219
+ const configPluginTemplate = addTemplate({
220
+ filename: "sentry-server-config-plugin.mjs",
221
+ write: true,
222
+ getContents: () => `import ${JSON.stringify(runtimeFlagsTemplate.dst)};
223
+ import ${JSON.stringify(configPath)};
224
+ export default () => {};
225
+ `
226
+ });
227
+ addServerPlugin(configPluginTemplate.dst);
228
+ nuxt.options.nitro.moduleSideEffects = [
229
+ ...nuxt.options.nitro.moduleSideEffects ?? [],
230
+ configPath,
231
+ runtimeFlagsTemplate.dst
232
+ ];
233
+ nuxt.hook("nitro:config", (nitroConfig) => {
234
+ if (isCloudflarePreset(nitroConfig.preset)) {
235
+ nitroConfig.plugins = (nitroConfig.plugins ?? []).filter((plugin) => plugin !== configPluginTemplate.dst);
236
+ return;
237
+ }
238
+ const plugins = nitroConfig.plugins ?? [];
239
+ nitroConfig.plugins = [configPluginTemplate.dst, ...plugins.filter((plugin) => plugin !== configPluginTemplate.dst)];
240
+ const externals = nitroConfig.externals ?? (nitroConfig.externals = {});
241
+ const inline = externals.inline;
242
+ const existingInline = Array.isArray(inline) ? inline : inline ? [inline] : [];
243
+ externals.inline = [...existingInline, configPath, configPluginTemplate.dst, runtimeFlagsTemplate.dst];
244
+ });
245
+ nuxt.hook("nitro:init", (nitro) => {
246
+ if (nuxt.options._prepare || !isCloudflarePreset(nitro.options.preset)) {
247
+ return;
248
+ }
249
+ nitro.options.plugins = (nitro.options.plugins ?? []).filter((plugin) => plugin !== configPluginTemplate.dst);
250
+ consoleSandbox(() => {
251
+ console.warn(
252
+ `[Sentry] Found \`${basename(configPath)}\`, but the Nitro preset targets Cloudflare, where this file is not used. Set up the SDK with \`sentryCloudflareNitroPlugin\` instead: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/cloudflare-workers/`
253
+ );
254
+ });
255
+ });
256
+ }
257
+ function addServerConfigShimWithWarning(nitro) {
258
+ nitro.hooks.hook("close", async () => {
259
+ if (nitro.options.dev || nitro.options.preset === "nitro-prerender" || isCloudflarePreset(nitro.options.preset)) {
260
+ return;
261
+ }
262
+ const shimPath = createResolver(nitro.options.output.serverDir).resolve(`${SERVER_CONFIG_FILENAME}.mjs`);
263
+ const contents = [
264
+ "// Generated by @sentry/nuxt.",
265
+ "// The Sentry server config is bundled into the server build and initializes automatically.",
266
+ "// This file only keeps existing `node --import ./.output/server/sentry.server.config.mjs` commands working.",
267
+ "console.warn('[Sentry] The `--import` flag for the Sentry server config is no longer needed and should be removed.');",
268
+ ""
269
+ ].join("\n");
270
+ try {
271
+ await fs.promises.writeFile(shimPath, contents, "utf8");
272
+ } catch (error) {
273
+ consoleSandbox(() => {
274
+ console.warn(`[Sentry] Could not write the \`--import\` compatibility shim to ${shimPath}`, error);
275
+ });
276
+ }
277
+ });
278
+ }
225
279
  function addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions) {
226
280
  if (!nitro.options.rollupConfig) {
227
281
  nitro.options.rollupConfig = { output: {} };
@@ -234,6 +288,7 @@ function addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions
234
288
  nitro.options.rollupConfig.plugins.push(
235
289
  wrapEntryWithDynamicImport({
236
290
  resolvedSentryConfigPath: createResolver(nitro.options.rootDir).resolve(serverConfigFile),
291
+ // oxlint-disable-next-line typescript/no-deprecated -- supported until removal
237
292
  experimental_entrypointWrappedFunctions: moduleOptions.experimental_entrypointWrappedFunctions
238
293
  })
239
294
  );
@@ -362,7 +417,7 @@ function addMiddlewareImports() {
362
417
  }
363
418
  ]);
364
419
  }
365
- function addMiddlewareInstrumentation(nitro) {
420
+ function addMiddlewareInstrumentation(nitro, isNitroV3) {
366
421
  nitro.hooks.hook("rollup:before", (nitro2, rollupConfig) => {
367
422
  if (!rollupConfig.plugins) {
368
423
  rollupConfig.plugins = [];
@@ -370,11 +425,12 @@ function addMiddlewareInstrumentation(nitro) {
370
425
  if (!Array.isArray(rollupConfig.plugins)) {
371
426
  rollupConfig.plugins = [rollupConfig.plugins];
372
427
  }
373
- rollupConfig.plugins.push(middlewareInstrumentationPlugin(nitro2));
428
+ rollupConfig.plugins.push(middlewareInstrumentationPlugin(nitro2, isNitroV3));
374
429
  });
375
430
  }
376
- function middlewareInstrumentationPlugin(nitro) {
431
+ function middlewareInstrumentationPlugin(nitro, isNitroV3) {
377
432
  const middlewareFiles = /* @__PURE__ */ new Set();
433
+ const wrapperModule = isNitroV3 ? "#imports/server" : "#imports";
378
434
  return {
379
435
  name: "sentry-nuxt-middleware-instrumentation",
380
436
  buildStart() {
@@ -388,7 +444,7 @@ function middlewareInstrumentationPlugin(nitro) {
388
444
  if (middlewareFiles.has(id)) {
389
445
  const fileName = path.basename(id);
390
446
  return {
391
- code: wrapMiddlewareCode(code, fileName),
447
+ code: wrapMiddlewareCode(code, fileName, wrapperModule),
392
448
  map: null
393
449
  };
394
450
  }
@@ -396,10 +452,10 @@ function middlewareInstrumentationPlugin(nitro) {
396
452
  }
397
453
  };
398
454
  }
399
- function wrapMiddlewareCode(originalCode, fileName) {
455
+ function wrapMiddlewareCode(originalCode, fileName, wrapperModule) {
400
456
  const cleanFileName = fileName.replace(/\.(ts|js|mjs|mts|cts)$/, "");
401
457
  return `
402
- import { wrapMiddlewareHandlerWithSentry } from '#imports';
458
+ import { wrapMiddlewareHandlerWithSentry } from '${wrapperModule}';
403
459
 
404
460
  function defineInstrumentedEventHandler(handlerOrObject) {
405
461
  return defineEventHandler(wrapMiddlewareHandlerWithSentry(handlerOrObject, '${cleanFileName}'));
@@ -429,7 +485,7 @@ function setupOrchestrion(nuxt, hasServerConfig, buildTimeInstrumentation) {
429
485
  if (nuxt.options?.dev) {
430
486
  return;
431
487
  }
432
- const isCloudflare = !!nitroConfig.preset?.replace(/-/g, "_").startsWith("cloudflare");
488
+ const isCloudflare = isCloudflarePreset(nitroConfig.preset);
433
489
  if (!hasServerConfig && !isCloudflare) {
434
490
  return;
435
491
  }
@@ -766,7 +822,9 @@ var module$1 = defineNuxtModule({
766
822
  }
767
823
  const moduleOptions = {
768
824
  ...moduleOptionsParam,
825
+ // oxlint-disable-next-line typescript/no-deprecated -- supported until removal
769
826
  autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,
827
+ // oxlint-disable-next-line typescript/no-deprecated -- supported until removal
770
828
  experimental_entrypointWrappedFunctions: moduleOptionsParam.experimental_entrypointWrappedFunctions || [
771
829
  "default",
772
830
  "handler",
@@ -800,11 +858,15 @@ var module$1 = defineNuxtModule({
800
858
  });
801
859
  }
802
860
  const serverConfigFile = await findDefaultSdkInitFile("server", nuxt, moduleOptions);
803
- const isNitroV3 = await getNitroMajorVersion() >= 3;
861
+ const isNitroV3 = await getNitroMajorVersion(nuxt.options.rootDir) >= 3;
804
862
  const nuxtMajor = parseInt(nuxt._version?.split(".")[0] ?? "3", 10);
805
863
  const isMinNuxtV4 = nuxtMajor >= 4;
806
864
  setupOrchestrion(nuxt, !!serverConfigFile, moduleOptions.buildTimeInstrumentation);
865
+ const usesDeprecatedInjectMode = moduleOptions.autoInjectServerSentry === "top-level-import" || moduleOptions.autoInjectServerSentry === "experimental_dynamic-import";
807
866
  if (serverConfigFile) {
867
+ if (!usesDeprecatedInjectMode) {
868
+ addServerConfigPlugin(nuxt, serverConfigFile);
869
+ }
808
870
  if (isNitroV3) {
809
871
  addServerPlugin(moduleDirResolver.resolve("./runtime/plugins/handler.server"));
810
872
  addServerPlugin(moduleDirResolver.resolve("./runtime/plugins/update-route-name.server"));
@@ -821,9 +883,6 @@ var module$1 = defineNuxtModule({
821
883
  addMiddlewareImports();
822
884
  addStorageInstrumentation(nuxt, !isNitroV3);
823
885
  addDatabaseInstrumentation(nuxt.options.nitro, !isNitroV3, moduleOptions);
824
- if (isNitroV3) {
825
- addDevServerConfigFile(nuxt, serverConfigFile);
826
- }
827
886
  }
828
887
  if (clientConfigFile || serverConfigFile) {
829
888
  setupSourceMaps(moduleOptions, nuxt, addVitePlugin);
@@ -867,56 +926,37 @@ var module$1 = defineNuxtModule({
867
926
  return;
868
927
  }
869
928
  if (serverConfigFile) {
870
- addMiddlewareInstrumentation(nitro);
871
- consoleSandbox(() => {
872
- const serverDir = nitro.options.output.serverDir;
873
- if (serverDir.includes(".netlify") || !!process.env.NETLIFY) {
874
- console.warn(
875
- "[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/"
876
- );
877
- }
878
- if (serverDir.includes(".vercel") || !!process.env.VERCEL) {
879
- console.warn(
880
- "[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/"
881
- );
882
- }
883
- });
884
- if (moduleOptions.autoInjectServerSentry !== "experimental_dynamic-import") {
885
- if (!(isNitroV3 && nitro.options.dev)) {
886
- addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);
887
- }
929
+ addMiddlewareInstrumentation(nitro, isNitroV3);
930
+ if (!usesDeprecatedInjectMode) {
931
+ addServerConfigShimWithWarning(nitro);
888
932
  if (moduleOptions.debug) {
889
- const serverDirResolver = createResolver(nitro.options.output.serverDir);
890
- const serverConfigPath = serverDirResolver.resolve("sentry.server.config.mjs");
891
- const serverConfigRelativePath = toImportSpecifier(nitro.options.rootDir, serverConfigPath);
892
- const devConfigRelativePath = isNitroV3 ? toImportSpecifier(nuxt.options.rootDir, path.join(nuxt.options.buildDir, DEV_SERVER_CONFIG_PATH)) : serverConfigRelativePath;
893
933
  consoleSandbox(() => {
894
934
  console.log(
895
- `[Sentry] Using \`${serverConfigFile}\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/.`
935
+ `[Sentry] Bundled \`${serverConfigFile}\` into the Nitro server build. The SDK initializes itself at server startup \u2014 no \`node --import\` preload needed.`
896
936
  );
897
- if (nitro.options.dev) {
898
- console.log(
899
- `[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \`NODE_OPTIONS='--import ${devConfigRelativePath}' nuxt dev\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \`nuxt prepare\` to regenerate it.`
900
- );
901
- } else {
902
- console.log(
903
- `[Sentry] When running your built application, preload Sentry via a command-line flag (\`node --import ${serverConfigRelativePath} [...]\`) or via an environment variable (\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\`).`
904
- );
905
- }
906
937
  });
907
938
  }
908
- }
909
- if (moduleOptions.autoInjectServerSentry === "top-level-import") {
910
- addSentryTopImport(moduleOptions, nitro);
911
- }
912
- if (moduleOptions.autoInjectServerSentry === "experimental_dynamic-import") {
913
- addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);
914
- if (moduleOptions.debug) {
915
- consoleSandbox(() => {
916
- console.log(
917
- "[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes."
918
- );
919
- });
939
+ } else {
940
+ consoleSandbox(() => {
941
+ console.warn(
942
+ `[Sentry] \`autoInjectServerSentry: '${moduleOptions.autoInjectServerSentry}'\` is deprecated and will be removed in a future major version. The Sentry server config is bundled into the Nitro server build by default now. Remove the option to use the default behavior.`
943
+ );
944
+ });
945
+ if (moduleOptions.autoInjectServerSentry === "top-level-import") {
946
+ if (!(isNitroV3 && nitro.options.dev)) {
947
+ addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);
948
+ }
949
+ addSentryTopImport(moduleOptions, nitro);
950
+ }
951
+ if (moduleOptions.autoInjectServerSentry === "experimental_dynamic-import") {
952
+ addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);
953
+ if (moduleOptions.debug) {
954
+ consoleSandbox(() => {
955
+ console.log(
956
+ "[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes."
957
+ );
958
+ });
959
+ }
920
960
  }
921
961
  }
922
962
  }
@@ -1,7 +1,8 @@
1
1
  import { DB_SYSTEM_NAME, DB_NAMESPACE, SENTRY_OP, DB_QUERY_SUMMARY, DB_QUERY_TEXT } from '@sentry/conventions/attributes';
2
2
  import { DB_QUERY } from '@sentry/conventions/op';
3
3
  import { debug, startSpan, getClient, hasSpanStreamingEnabled, DB_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, captureException, addBreadcrumb } from '@sentry/core';
4
- import { _INTERNAL_getSqlQuerySummary, _INTERNAL_sanitizeSqlQuery, flushIfServerless } from '@sentry/core/server';
4
+ import { flushIfServerless } from '@sentry/core/server';
5
+ import { getSqlQuerySummary, sanitizeSqlQuery } from '@sentry/server-utils';
5
6
  import { getDatabaseSpanData } from './database-span-data.js';
6
7
 
7
8
  const patchedStatement = /* @__PURE__ */ new WeakSet();
@@ -143,7 +144,7 @@ function createBreadcrumb(query) {
143
144
  });
144
145
  }
145
146
  function createStartSpanOptions(query, data) {
146
- const querySummary = query ? _INTERNAL_getSqlQuerySummary(_INTERNAL_sanitizeSqlQuery(query)) : void 0;
147
+ const querySummary = query ? getSqlQuerySummary(sanitizeSqlQuery(query)) : void 0;
147
148
  const client = getClient();
148
149
  const name = client && hasSpanStreamingEnabled(client) ? querySummary || data[DB_NAMESPACE] || DB_SPAN_NAME_FALLBACK : query;
149
150
  return {
@@ -2,14 +2,6 @@ import type { Nuxt } from '@nuxt/schema';
2
2
  import type { Nitro } from 'nitropack';
3
3
  import type { InputPluginOption } from 'rollup';
4
4
  import type { SentryNuxtModuleOptions } from '../common/types';
5
- /** Path of the generated dev-mode config file, relative to the Nuxt build directory. */
6
- export declare const DEV_SERVER_CONFIG_PATH = "dev/sentry.server.config.mjs";
7
- /**
8
- * Writes the file users preload with `node --import` to enable Sentry in `nuxt dev` (for Nuxt 5 with Nitro 3).
9
- *
10
- * In dev-mode, Nitro v3 has no server bundle to emit into, so Node loads the server config file as it is written.
11
- */
12
- export declare function addDevServerConfigFile(nuxt: Nuxt, serverConfigFile: string): void;
13
5
  /**
14
6
  * Adds the `sentry.server.config.ts` file as `sentry.server.config.mjs` to the `.output` directory to be able to reference this file in the node --import option.
15
7
  *
@@ -22,6 +14,16 @@ export declare function addServerConfigToBuild(moduleOptions: SentryNuxtModuleOp
22
14
  * However, only limited tracing instrumentation is supported when doing this.
23
15
  */
24
16
  export declare function addSentryTopImport(moduleOptions: SentryNuxtModuleOptions, nitro: Nitro): void;
17
+ /**
18
+ * Registers a Nitro plugin that statically imports the Sentry server config, so the SDK initializes
19
+ * at server startup without a `node --import` preload.
20
+ */
21
+ export declare function addServerConfigPlugin(nuxt: Nuxt, serverConfigFile: string): void;
22
+ /**
23
+ * Writes a shim to the former `--import` config path, so existing `node --import` start commands
24
+ * keep working now that the config is bundled into the server build.
25
+ */
26
+ export declare function addServerConfigShimWithWarning(nitro: Nitro): void;
25
27
  /**
26
28
  * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)
27
29
  * and adds the Sentry server config with the static `import` declaration.
@@ -7,5 +7,6 @@ export declare function addMiddlewareImports(): void;
7
7
  * Adds middleware instrumentation to the Nitro build.
8
8
  *
9
9
  * @param nitro Nitro instance
10
+ * @param isNitroV3 Whether the app builds with Nitro v3 (Nuxt 5)
10
11
  */
11
- export declare function addMiddlewareInstrumentation(nitro: Nitro): void;
12
+ export declare function addMiddlewareInstrumentation(nitro: Nitro, isNitroV3: boolean): void;
@@ -1,15 +1,23 @@
1
1
  import type { Nuxt } from '@nuxt/schema';
2
2
  import type { SentryNuxtModuleOptions } from '../common/types';
3
3
  /**
4
- * Gets the major version of the installed nitro package.
5
- * Returns 2 as the default if nitro is not found or the version cannot be determined.
4
+ * Gets the major version of the Nitro package used by the app's Nuxt installation.
5
+ * Returns 2 as the default if the version cannot be determined.
6
+ *
7
+ * Nitro v2 is published as `nitropack`, v3 as `nitro`. Resolving `nitro` directly is
8
+ * unreliable: module resolution walks up the directory tree, so in a monorepo an
9
+ * unrelated `nitro` v3 above the app wins even when the app's Nuxt uses `nitropack` v2.
10
+ * Instead, follow the dependency chain Nuxt itself imports Nitro through:
11
+ * `nuxt` -> (`@nuxt/nitro-server` ->) `nitro` | `nitropack`.
6
12
  */
7
- export declare function getNitroMajorVersion(): Promise<number>;
13
+ export declare function getNitroMajorVersion(rootDir: string): Promise<number>;
8
14
  /**
9
15
  * Find the default SDK init file for the given type (client or server).
10
16
  */
11
17
  export declare function findDefaultSdkInitFile(type: 'server' | 'client', nuxt?: Nuxt, options?: SentryNuxtModuleOptions): Promise<string | undefined>;
12
18
  export declare const SERVER_CONFIG_FILENAME = "sentry.server.config";
19
+ /** Whether a resolved Nitro preset targets Cloudflare (workerd). Nitro normalizes preset names, so any `cloudflare*` spelling matches. */
20
+ export declare function isCloudflarePreset(preset: string | undefined): boolean;
13
21
  /** Builds the value for `node --import`. Node reads it as a URL, so it needs forward slashes on Windows too. */
14
22
  export declare function toImportSpecifier(fromDir: string, filePath: string): string;
15
23
  /**
@@ -1,5 +1,15 @@
1
- /** Global flag set by the generated `<buildDir>/dev/sentry.server.config.mjs`. */
1
+ /** Global flag set by the generated runtime-flags module before the Sentry server config evaluates. */
2
2
  export declare const NUXT_DEV_MODE_FLAG = "__SENTRY_NUXT_DEV_MODE__";
3
- /** Whether the SDK was preloaded by the generated `nuxt dev` server config file. */
3
+ /** Global flag set by the generated runtime-flags module during a prerender build. */
4
+ export declare const NUXT_PRERENDER_FLAG = "__SENTRY_NUXT_PRERENDER__";
5
+ /** Global flag set by the Nuxt server SDK after a successful `init`, to guard against a second init. */
6
+ export declare const NUXT_SERVER_INITIALIZED_FLAG = "__SENTRY_NUXT_SERVER_INITIALIZED__";
7
+ /** Whether the server runs in `nuxt dev`. */
4
8
  export declare function isNuxtDevRuntime(): boolean;
9
+ /** Whether the server bundle is executed by the Nitro prerenderer at build time. */
10
+ export declare function isNuxtPrerenderRuntime(): boolean;
11
+ /** Whether a Nuxt server SDK `init` already ran in this process. */
12
+ export declare function isNuxtServerInitialized(): boolean;
13
+ /** Records that the Nuxt server SDK initialized in this process. */
14
+ export declare function markNuxtServerInitialized(): void;
5
15
  //# sourceMappingURL=devMode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"devMode.d.ts","sourceRoot":"","sources":["../../../src/common/devMode.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D,oFAAoF;AACpF,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C"}
1
+ {"version":3,"file":"devMode.d.ts","sourceRoot":"","sources":["../../../src/common/devMode.ts"],"names":[],"mappings":"AAEA,uGAAuG;AACvG,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D,sFAAsF;AACtF,eAAO,MAAM,mBAAmB,8BAA8B,CAAC;AAE/D,wGAAwG;AACxG,eAAO,MAAM,4BAA4B,uCAAuC,CAAC;AAEjF,6CAA6C;AAC7C,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED,oFAAoF;AACpF,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED,oEAAoE;AACpE,wBAAgB,uBAAuB,IAAI,OAAO,CAEjD;AAED,oEAAoE;AACpE,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD"}
@@ -51,6 +51,10 @@ export type SentryNuxtModuleOptions = BuildTimeOptionsBase & {
51
51
  * If `"experimental_dynamic-import"` is enabled, the Sentry SDK wraps the server entry file with `import()`.
52
52
  *
53
53
  * @default undefined
54
+ *
55
+ * @deprecated The Sentry server config is bundled into the Nitro server build by default now and
56
+ * initializes itself at server startup — no `node --import` preload and no inject mode needed.
57
+ * Remove this option to use the default behavior. It will be removed in a future major version.
54
58
  */
55
59
  autoInjectServerSentry?: 'top-level-import' | 'experimental_dynamic-import';
56
60
  /**
@@ -80,6 +84,9 @@ export type SentryNuxtModuleOptions = BuildTimeOptionsBase & {
80
84
  * Any wrapped export is expected to be an async function.
81
85
  *
82
86
  * @default ['default', 'handler', 'server']
87
+ *
88
+ * @deprecated Only used with the deprecated `autoInjectServerSentry: 'experimental_dynamic-import'`
89
+ * mode. It will be removed in a future major version together with that mode.
83
90
  */
84
91
  experimental_entrypointWrappedFunctions?: string[];
85
92
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAInD,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,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG;IACrE;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,GAAG;IAC3D;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,sBAAsB,CAAC,EAAE,kBAAkB,GAAG,6BAA6B,CAAC;IAE5E;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;OAUG;IACH,uCAAuC,CAAC,EAAE,MAAM,EAAE,CAAC;CACpD,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAInD,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,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG;IACrE;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,GAAG;IAC3D;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,sBAAsB,CAAC,EAAE,kBAAkB,GAAG,6BAA6B,CAAC;IAE5E;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;OAaG;IACH,uCAAuC,CAAC,EAAE,MAAM,EAAE,CAAC;CACpD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAoB9D,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAe9D,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentDatabase.d.ts","sourceRoot":"","sources":["../../../../src/runtime/utils/instrumentDatabase.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAqB,MAAM,KAAK,CAAC;AACvD,OAAO,EAAE,KAAK,wBAAwB,EAA8C,MAAM,sBAAsB,CAAC;AAiBjH;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,EACvC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,GACvD,IAAI,CAqBN"}
1
+ {"version":3,"file":"instrumentDatabase.d.ts","sourceRoot":"","sources":["../../../../src/runtime/utils/instrumentDatabase.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,QAAQ,EAAqB,MAAM,KAAK,CAAC;AACvD,OAAO,EAAE,KAAK,wBAAwB,EAA8C,MAAM,sBAAsB,CAAC;AAiBjH;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,EACvC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,GACvD,IAAI,CAqBN"}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/server/sdk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAS,cAAc,EAAE,MAAM,cAAc,CAAC;AAKlE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,GAAG,SAAS,CAsBzE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,uBAAuB,GAAG,cAAc,CA0B7F;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,uBAAuB,GAAG,cAAc,CAY3F"}
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/server/sdk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAS,cAAc,EAAE,MAAM,cAAc,CAAC;AAkBlE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,GAAG,SAAS,CA8CzE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,uBAAuB,GAAG,cAAc,CA0B7F;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,uBAAuB,GAAG,cAAc,CAY3F"}
@@ -2,14 +2,6 @@ import type { Nuxt } from '@nuxt/schema';
2
2
  import type { Nitro } from 'nitropack';
3
3
  import type { InputPluginOption } from 'rollup';
4
4
  import type { SentryNuxtModuleOptions } from '../common/types';
5
- /** Path of the generated dev-mode config file, relative to the Nuxt build directory. */
6
- export declare const DEV_SERVER_CONFIG_PATH = "dev/sentry.server.config.mjs";
7
- /**
8
- * Writes the file users preload with `node --import` to enable Sentry in `nuxt dev` (for Nuxt 5 with Nitro 3).
9
- *
10
- * In dev-mode, Nitro v3 has no server bundle to emit into, so Node loads the server config file as it is written.
11
- */
12
- export declare function addDevServerConfigFile(nuxt: Nuxt, serverConfigFile: string): void;
13
5
  /**
14
6
  * Adds the `sentry.server.config.ts` file as `sentry.server.config.mjs` to the `.output` directory to be able to reference this file in the node --import option.
15
7
  *
@@ -22,6 +14,16 @@ export declare function addServerConfigToBuild(moduleOptions: SentryNuxtModuleOp
22
14
  * However, only limited tracing instrumentation is supported when doing this.
23
15
  */
24
16
  export declare function addSentryTopImport(moduleOptions: SentryNuxtModuleOptions, nitro: Nitro): void;
17
+ /**
18
+ * Registers a Nitro plugin that statically imports the Sentry server config, so the SDK initializes
19
+ * at server startup without a `node --import` preload.
20
+ */
21
+ export declare function addServerConfigPlugin(nuxt: Nuxt, serverConfigFile: string): void;
22
+ /**
23
+ * Writes a shim to the former `--import` config path, so existing `node --import` start commands
24
+ * keep working now that the config is bundled into the server build.
25
+ */
26
+ export declare function addServerConfigShimWithWarning(nitro: Nitro): void;
25
27
  /**
26
28
  * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)
27
29
  * and adds the Sentry server config with the static `import` declaration.
@@ -1 +1 @@
1
- {"version":3,"file":"addServerConfig.d.ts","sourceRoot":"","sources":["../../../src/vite/addServerConfig.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAe/D,wFAAwF;AACxF,eAAO,MAAM,sBAAsB,iCAAsC,CAAC;AAE1E;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CA4BjF;AAWD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,uBAAuB,EACtC,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,MAAM,GACvB,IAAI,CAWN;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,uBAAuB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CA0C7F;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,IAAI,CAAC,uBAAuB,EAAE,yCAAyC,CAAC,GACrF,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,yCAAyC,CAAC,CAAC,GACnF,IAAI,CAkBN;AAyCD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,wBAAwB,EACxB,uCAAuC,EACvC,KAAK,GACN,EAAE;IACD,wBAAwB,EAAE,MAAM,CAAC;IACjC,uCAAuC,EAAE,MAAM,EAAE,CAAC;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,iBAAiB,CAwFpB"}
1
+ {"version":3,"file":"addServerConfig.d.ts","sourceRoot":"","sources":["../../../src/vite/addServerConfig.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAyB/D;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,uBAAuB,EACtC,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,MAAM,GACvB,IAAI,CAWN;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,uBAAuB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CA0C7F;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAsEhF;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAyBjE;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,IAAI,CAAC,uBAAuB,EAAE,yCAAyC,CAAC,GACrF,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,yCAAyC,CAAC,CAAC,GACnF,IAAI,CAmBN;AAyCD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,wBAAwB,EACxB,uCAAuC,EACvC,KAAK,GACN,EAAE;IACD,wBAAwB,EAAE,MAAM,CAAC;IACjC,uCAAuC,EAAE,MAAM,EAAE,CAAC;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,iBAAiB,CAwFpB"}
@@ -7,6 +7,7 @@ export declare function addMiddlewareImports(): void;
7
7
  * Adds middleware instrumentation to the Nitro build.
8
8
  *
9
9
  * @param nitro Nitro instance
10
+ * @param isNitroV3 Whether the app builds with Nitro v3 (Nuxt 5)
10
11
  */
11
- export declare function addMiddlewareInstrumentation(nitro: Nitro): void;
12
+ export declare function addMiddlewareInstrumentation(nitro: Nitro, isNitroV3: boolean): void;
12
13
  //# sourceMappingURL=middlewareConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"middlewareConfig.d.ts","sourceRoot":"","sources":["../../../src/vite/middlewareConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAI7C;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAO3C;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAY/D"}
1
+ {"version":3,"file":"middlewareConfig.d.ts","sourceRoot":"","sources":["../../../src/vite/middlewareConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAI7C;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAO3C;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI,CAYnF"}
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrion.d.ts","sourceRoot":"","sources":["../../../src/vite/orchestrion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AASzC;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,wBAAwB,CAAC,EAAE,OAAO,GAAG,IAAI,CAwC/G"}
1
+ {"version":3,"file":"orchestrion.d.ts","sourceRoot":"","sources":["../../../src/vite/orchestrion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAUzC;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,wBAAwB,CAAC,EAAE,OAAO,GAAG,IAAI,CAuC/G"}
@@ -1,15 +1,23 @@
1
1
  import type { Nuxt } from '@nuxt/schema';
2
2
  import type { SentryNuxtModuleOptions } from '../common/types';
3
3
  /**
4
- * Gets the major version of the installed nitro package.
5
- * Returns 2 as the default if nitro is not found or the version cannot be determined.
4
+ * Gets the major version of the Nitro package used by the app's Nuxt installation.
5
+ * Returns 2 as the default if the version cannot be determined.
6
+ *
7
+ * Nitro v2 is published as `nitropack`, v3 as `nitro`. Resolving `nitro` directly is
8
+ * unreliable: module resolution walks up the directory tree, so in a monorepo an
9
+ * unrelated `nitro` v3 above the app wins even when the app's Nuxt uses `nitropack` v2.
10
+ * Instead, follow the dependency chain Nuxt itself imports Nitro through:
11
+ * `nuxt` -> (`@nuxt/nitro-server` ->) `nitro` | `nitropack`.
6
12
  */
7
- export declare function getNitroMajorVersion(): Promise<number>;
13
+ export declare function getNitroMajorVersion(rootDir: string): Promise<number>;
8
14
  /**
9
15
  * Find the default SDK init file for the given type (client or server).
10
16
  */
11
17
  export declare function findDefaultSdkInitFile(type: 'server' | 'client', nuxt?: Nuxt, options?: SentryNuxtModuleOptions): Promise<string | undefined>;
12
18
  export declare const SERVER_CONFIG_FILENAME = "sentry.server.config";
19
+ /** Whether a resolved Nitro preset targets Cloudflare (workerd). Nitro normalizes preset names, so any `cloudflare*` spelling matches. */
20
+ export declare function isCloudflarePreset(preset: string | undefined): boolean;
13
21
  /** Builds the value for `node --import`. Node reads it as a URL, so it needs forward slashes on Windows too. */
14
22
  export declare function toImportSpecifier(fromDir: string, filePath: string): string;
15
23
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/vite/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAKzC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAG/D;;;GAGG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAY5D;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,QAAQ,GAAG,QAAQ,EACzB,IAAI,CAAC,EAAE,IAAI,EACX,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA0B7B;AAED,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAE7D,gHAAgH;AAChH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIlF;AAED,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAClE,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAC3E,eAAO,MAAM,2BAA2B,wCAAwC,CAAC;AACjF,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7D;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CA2B5G;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CACjD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EACjD,0BAA0B,EAAE,MAAM,EAAE,EACpC,KAAK,CAAC,EAAE,OAAO,GACd,MAAM,CAmCR;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAsBxF;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAgBlG;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,UAAQ,GAAG,IAAI,CAY9E"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/vite/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAKzC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAG/D;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA2B3E;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,QAAQ,GAAG,QAAQ,EACzB,IAAI,CAAC,EAAE,IAAI,EACX,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA0B7B;AAED,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAE7D,0IAA0I;AAC1I,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEtE;AAED,gHAAgH;AAChH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIlF;AAED,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAClE,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAC3E,eAAO,MAAM,2BAA2B,wCAAwC,CAAC;AACjF,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7D;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CA2B5G;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CACjD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EACjD,0BAA0B,EAAE,MAAM,EAAE,EACpC,KAAK,CAAC,EAAE,OAAO,GACd,MAAM,CAmCR;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAsBxF;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAgBlG;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,UAAQ,GAAG,IAAI,CAY9E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/nuxt",
3
- "version": "11.0.0-beta.1",
3
+ "version": "11.0.0-beta.2",
4
4
  "description": "Official Sentry SDK for Nuxt",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/nuxt",
@@ -54,15 +54,15 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@nuxt/kit": "^4.5.2",
57
- "@sentry/browser": "11.0.0-beta.1",
58
- "@sentry/cloudflare": "11.0.0-beta.1",
57
+ "@sentry/browser": "11.0.0-beta.2",
58
+ "@sentry/cloudflare": "11.0.0-beta.2",
59
59
  "@sentry/conventions": "^0.20.0",
60
- "@sentry/core": "11.0.0-beta.1",
61
- "@sentry/node": "11.0.0-beta.1",
62
- "@sentry/bundler-plugins": "11.0.0-beta.1",
63
- "@sentry/server-runtime-injection": "11.0.0-beta.1",
64
- "@sentry/server-utils": "11.0.0-beta.1",
65
- "@sentry/vue": "11.0.0-beta.1",
60
+ "@sentry/core": "11.0.0-beta.2",
61
+ "@sentry/node": "11.0.0-beta.2",
62
+ "@sentry/bundler-plugins": "11.0.0-beta.2",
63
+ "@sentry/server-runtime-injection": "11.0.0-beta.2",
64
+ "@sentry/server-utils": "11.0.0-beta.2",
65
+ "@sentry/vue": "11.0.0-beta.2",
66
66
  "local-pkg": "^1.1.2"
67
67
  },
68
68
  "devDependencies": {