@sentry/nuxt 10.53.1 → 10.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/build/cjs/client/piniaIntegration.js +7 -19
  2. package/build/cjs/client/piniaIntegration.js.map +1 -1
  3. package/build/cjs/client/sdk.js +2 -9
  4. package/build/cjs/client/sdk.js.map +1 -1
  5. package/build/cjs/client/vueIntegration.js +3 -10
  6. package/build/cjs/client/vueIntegration.js.map +1 -1
  7. package/build/cjs/common/debug-build.js +0 -5
  8. package/build/cjs/common/debug-build.js.map +1 -1
  9. package/build/cjs/module.js +52 -107
  10. package/build/cjs/module.js.map +1 -1
  11. package/build/cjs/server/sdk.js +20 -60
  12. package/build/cjs/server/sdk.js.map +1 -1
  13. package/build/cjs/vendor/server-template.js +0 -6
  14. package/build/cjs/vendor/server-template.js.map +1 -1
  15. package/build/cjs/vite/addServerConfig.js +45 -144
  16. package/build/cjs/vite/addServerConfig.js.map +1 -1
  17. package/build/cjs/vite/databaseConfig.js +10 -32
  18. package/build/cjs/vite/databaseConfig.js.map +1 -1
  19. package/build/cjs/vite/middlewareConfig.js +11 -46
  20. package/build/cjs/vite/middlewareConfig.js.map +1 -1
  21. package/build/cjs/vite/sentryVitePlugin.js +7 -24
  22. package/build/cjs/vite/sentryVitePlugin.js.map +1 -1
  23. package/build/cjs/vite/sourceMaps.js +89 -248
  24. package/build/cjs/vite/sourceMaps.js.map +1 -1
  25. package/build/cjs/vite/storageConfig.js +4 -10
  26. package/build/cjs/vite/storageConfig.js.map +1 -1
  27. package/build/cjs/vite/utils.js +51 -143
  28. package/build/cjs/vite/utils.js.map +1 -1
  29. package/build/esm/client/piniaIntegration.js +7 -19
  30. package/build/esm/client/piniaIntegration.js.map +1 -1
  31. package/build/esm/client/sdk.js +2 -9
  32. package/build/esm/client/sdk.js.map +1 -1
  33. package/build/esm/client/vueIntegration.js +3 -10
  34. package/build/esm/client/vueIntegration.js.map +1 -1
  35. package/build/esm/common/debug-build.js +0 -5
  36. package/build/esm/common/debug-build.js.map +1 -1
  37. package/build/esm/module.js +52 -107
  38. package/build/esm/module.js.map +1 -1
  39. package/build/esm/package.json +1 -1
  40. package/build/esm/server/sdk.js +20 -60
  41. package/build/esm/server/sdk.js.map +1 -1
  42. package/build/esm/vendor/server-template.js +0 -6
  43. package/build/esm/vendor/server-template.js.map +1 -1
  44. package/build/esm/vite/addServerConfig.js +45 -144
  45. package/build/esm/vite/addServerConfig.js.map +1 -1
  46. package/build/esm/vite/databaseConfig.js +10 -32
  47. package/build/esm/vite/databaseConfig.js.map +1 -1
  48. package/build/esm/vite/middlewareConfig.js +11 -46
  49. package/build/esm/vite/middlewareConfig.js.map +1 -1
  50. package/build/esm/vite/sentryVitePlugin.js +7 -24
  51. package/build/esm/vite/sentryVitePlugin.js.map +1 -1
  52. package/build/esm/vite/sourceMaps.js +89 -248
  53. package/build/esm/vite/sourceMaps.js.map +1 -1
  54. package/build/esm/vite/storageConfig.js +4 -10
  55. package/build/esm/vite/storageConfig.js.map +1 -1
  56. package/build/esm/vite/utils.js +51 -143
  57. package/build/esm/vite/utils.js.map +1 -1
  58. package/build/module/module.d.mts +17 -0
  59. package/build/module/module.d.ts +17 -0
  60. package/build/module/module.json +1 -1
  61. package/build/module/module.mjs +6 -6
  62. package/build/types/common/types.d.ts +17 -0
  63. package/build/types/common/types.d.ts.map +1 -1
  64. package/build/types/vite/utils.d.ts +2 -1
  65. package/build/types/vite/utils.d.ts.map +1 -1
  66. package/package.json +8 -8
@@ -4,25 +4,19 @@ const kit = require('@nuxt/kit');
4
4
  const serverTemplate = require('../vendor/server-template.js');
5
5
 
6
6
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
7
- /**
8
- * Prepares the storage config export to be used in the runtime storage instrumentation.
9
- */
10
7
  function addStorageInstrumentation(nuxt, isLegacyNitro) {
11
8
  const moduleDirResolver = kit.createResolver((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite/storageConfig.js', document.baseURI).href)));
12
9
  const userStorageMounts = Object.keys(nuxt.options.nitro.storage || {});
13
-
14
- // Create a virtual module to pass this data to runtime
15
10
  serverTemplate.addServerTemplate({
16
- filename: '#sentry/storage-config.mjs',
11
+ filename: "#sentry/storage-config.mjs",
17
12
  getContents: () => {
18
13
  return `export const userStorageMounts = ${JSON.stringify(userStorageMounts)};`;
19
- },
14
+ }
20
15
  });
21
-
22
16
  if (isLegacyNitro) {
23
- kit.addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/storage-legacy.server'));
17
+ kit.addServerPlugin(moduleDirResolver.resolve("./runtime/plugins/storage-legacy.server"));
24
18
  } else {
25
- kit.addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/storage.server'));
19
+ kit.addServerPlugin(moduleDirResolver.resolve("./runtime/plugins/storage.server"));
26
20
  }
27
21
  }
28
22
 
@@ -1 +1 @@
1
- {"version":3,"file":"storageConfig.js","sources":["../../../src/vite/storageConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport type { Nuxt } from '@nuxt/schema';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Prepares the storage config export to be used in the runtime storage instrumentation.\n */\nexport function addStorageInstrumentation(nuxt: Nuxt, isLegacyNitro: boolean): void {\n const moduleDirResolver = createResolver(import.meta.url);\n const userStorageMounts = Object.keys(nuxt.options.nitro.storage || {});\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/storage-config.mjs',\n getContents: () => {\n return `export const userStorageMounts = ${JSON.stringify(userStorageMounts)};`;\n },\n });\n\n if (isLegacyNitro) {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/storage-legacy.server'));\n } else {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/storage.server'));\n }\n}\n"],"names":["createResolver","addServerTemplate","addServerPlugin"],"mappings":";;;;;;AAIA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,IAAI,EAAQ,aAAa,EAAiB;AACpF,EAAE,MAAM,iBAAA,GAAoBA,kBAAc,CAAC,uQAAe,CAAC;AAC3D,EAAE,MAAM,iBAAA,GAAoB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;;AAEzE;AACA,EAAEC,gCAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,4BAA4B;AAC1C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,iCAAiC,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AACrF,IAAI,CAAC;AACL,GAAG,CAAC;;AAEJ,EAAE,IAAI,aAAa,EAAE;AACrB,IAAIC,mBAAe,CAAC,iBAAiB,CAAC,OAAO,CAAC,yCAAyC,CAAC,CAAC;AACzF,EAAE,OAAO;AACT,IAAIA,mBAAe,CAAC,iBAAiB,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAClF,EAAE;AACF;;;;"}
1
+ {"version":3,"file":"storageConfig.js","sources":["../../../src/vite/storageConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport type { Nuxt } from '@nuxt/schema';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Prepares the storage config export to be used in the runtime storage instrumentation.\n */\nexport function addStorageInstrumentation(nuxt: Nuxt, isLegacyNitro: boolean): void {\n const moduleDirResolver = createResolver(import.meta.url);\n const userStorageMounts = Object.keys(nuxt.options.nitro.storage || {});\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/storage-config.mjs',\n getContents: () => {\n return `export const userStorageMounts = ${JSON.stringify(userStorageMounts)};`;\n },\n });\n\n if (isLegacyNitro) {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/storage-legacy.server'));\n } else {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/storage.server'));\n }\n}\n"],"names":["createResolver","addServerTemplate","addServerPlugin"],"mappings":";;;;;;AAOO,SAAS,yBAAA,CAA0B,MAAY,aAAA,EAA8B;AAClF,EAAA,MAAM,iBAAA,GAAoBA,kBAAA,CAAe,uQAAe,CAAA;AACxD,EAAA,MAAM,iBAAA,GAAoB,OAAO,IAAA,CAAK,IAAA,CAAK,QAAQ,KAAA,CAAM,OAAA,IAAW,EAAE,CAAA;AAGtE,EAAAC,gCAAA,CAAkB;AAAA,IAChB,QAAA,EAAU,4BAAA;AAAA,IACV,aAAa,MAAM;AACjB,MAAA,OAAO,CAAA,iCAAA,EAAoC,IAAA,CAAK,SAAA,CAAU,iBAAiB,CAAC,CAAA,CAAA,CAAA;AAAA,IAC9E;AAAA,GACD,CAAA;AAED,EAAA,IAAI,aAAA,EAAe;AACjB,IAAAC,mBAAA,CAAgB,iBAAA,CAAkB,OAAA,CAAQ,yCAAyC,CAAC,CAAA;AAAA,EACtF,CAAA,MAAO;AACL,IAAAA,mBAAA,CAAgB,iBAAA,CAAkB,OAAA,CAAQ,kCAAkC,CAAC,CAAA;AAAA,EAC/E;AACF;;;;"}
@@ -3,47 +3,34 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
3
  const core = require('@sentry/core');
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
+ const kit = require('@nuxt/kit');
6
7
 
7
- /**
8
- * Gets the major version of the installed nitro package.
9
- * Returns 2 as the default if nitro is not found or the version cannot be determined.
10
- */
11
8
  async function getNitroMajorVersion() {
12
9
  try {
13
10
  const { getPackageInfo } = await import('local-pkg');
14
- const info = await getPackageInfo('nitro');
11
+ const info = await getPackageInfo("nitro");
15
12
  if (info?.version) {
16
- const major = parseInt(info.version.split('.')[0] ?? '2', 10);
13
+ const major = parseInt(info.version.split(".")[0] ?? "2", 10);
17
14
  return isNaN(major) ? 2 : major;
18
15
  }
19
16
  } catch {
20
- // If local-pkg is unavailable or nitro is not found, default to v2
21
17
  }
22
18
  return 2;
23
19
  }
24
-
25
- /**
26
- * Find the default SDK init file for the given type (client or server).
27
- * The sentry.server.config file is prioritized over the instrument.server file.
28
- */
29
- function findDefaultSdkInitFile(type, nuxt) {
30
- const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];
20
+ async function findDefaultSdkInitFile(type, nuxt, options) {
21
+ const possibleFileExtensions = ["ts", "js", "mjs", "cjs", "mts", "cts"];
31
22
  const relativePaths = [];
32
-
33
- if (type === 'server') {
23
+ if (type === "server") {
34
24
  for (const ext of possibleFileExtensions) {
35
25
  relativePaths.push(`sentry.${type}.config.${ext}`);
36
- relativePaths.push(path.join('public', `instrument.${type}.${ext}`));
26
+ relativePaths.push(path.join("public", `instrument.${type}.${ext}`));
37
27
  }
38
28
  } else {
39
29
  for (const ext of possibleFileExtensions) {
40
30
  relativePaths.push(`sentry.${type}.config.${ext}`);
41
31
  }
42
32
  }
43
-
44
- // Get layers from highest priority to lowest
45
- const layers = [...(nuxt?.options._layers ?? [])].reverse();
46
-
33
+ const layers = [...nuxt?.options._layers ?? []].reverse();
47
34
  for (const layer of layers) {
48
35
  for (const relativePath of relativePaths) {
49
36
  const fullPath = path.resolve(layer.cwd, relativePath);
@@ -52,174 +39,95 @@ function findDefaultSdkInitFile(type, nuxt) {
52
39
  }
53
40
  }
54
41
  }
55
-
56
- // As a fallback, also check CWD (left for pure compatibility)
57
- const cwd = process.cwd();
42
+ const rootDir = options?.configDir ? await kit.resolvePath(options.configDir, { type: "dir" }) : process.cwd();
58
43
  for (const relativePath of relativePaths) {
59
- const fullPath = path.resolve(cwd, relativePath);
44
+ const fullPath = path.resolve(rootDir, relativePath);
60
45
  if (fs.existsSync(fullPath)) {
61
46
  return fullPath;
62
47
  }
63
48
  }
64
-
65
- return undefined;
49
+ return void 0;
66
50
  }
67
-
68
- /**
69
- * Extracts the filename from a node command with a path.
70
- */
71
51
  function getFilenameFromNodeStartCommand(nodeCommand) {
72
52
  const regex = /[^/\\]+\.[^/\\]+$/;
73
53
  const match = nodeCommand.match(regex);
74
54
  return match ? match[0] : null;
75
55
  }
76
-
77
- const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';
78
- const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';
79
- const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';
80
- const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';
81
-
82
- /**
83
- * Strips the Sentry query part from a path.
84
- * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path
85
- *
86
- * Only exported for testing.
87
- */
56
+ const SENTRY_WRAPPED_ENTRY = "?sentry-query-wrapped-entry";
57
+ const SENTRY_WRAPPED_FUNCTIONS = "?sentry-query-wrapped-functions=";
58
+ const SENTRY_REEXPORTED_FUNCTIONS = "?sentry-query-reexported-functions=";
59
+ const QUERY_END_INDICATOR = "SENTRY-QUERY-END";
88
60
  function removeSentryQueryFromPath(url) {
89
- // oxlint-disable-next-line sdk/no-regexp-constructor
90
61
  const regex = new RegExp(`\\${SENTRY_WRAPPED_ENTRY}.*?\\${QUERY_END_INDICATOR}`);
91
- return url.replace(regex, '');
62
+ return url.replace(regex, "");
92
63
  }
93
-
94
- /**
95
- * Extracts and sanitizes function re-export and function wrap query parameters from a query string.
96
- * If it is a default export, it is not considered for re-exporting.
97
- *
98
- * Only exported for testing.
99
- */
100
64
  function extractFunctionReexportQueryParameters(query) {
101
- // Regex matches the comma-separated params between the functions query
102
- // oxlint-disable-next-line sdk/no-regexp-constructor
103
65
  const wrapRegex = new RegExp(
104
- `\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR}|\\${SENTRY_REEXPORTED_FUNCTIONS})`,
66
+ `\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR}|\\${SENTRY_REEXPORTED_FUNCTIONS})`
105
67
  );
106
- // oxlint-disable-next-line sdk/no-regexp-constructor
107
68
  const reexportRegex = new RegExp(`\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR})`);
108
-
109
69
  const wrapMatch = query.match(wrapRegex);
110
70
  const reexportMatch = query.match(reexportRegex);
111
-
112
- const wrap =
113
- wrapMatch?.[1]
114
- ?.split(',')
115
- .filter(param => param !== '')
116
- // Sanitize, as code could be injected with another rollup plugin
117
- .map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')) || [];
118
-
119
- const reexport =
120
- reexportMatch?.[1]
121
- ?.split(',')
122
- .filter(param => param !== '' && param !== 'default')
123
- // Sanitize, as code could be injected with another rollup plugin
124
- .map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')) || [];
125
-
71
+ const wrap = wrapMatch?.[1]?.split(",").filter((param) => param !== "").map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) || [];
72
+ const reexport = reexportMatch?.[1]?.split(",").filter((param) => param !== "" && param !== "default").map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) || [];
126
73
  return { wrap, reexport };
127
74
  }
128
-
129
- /**
130
- * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.
131
- * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped
132
- * (e.g. serverless handlers) are wrapped by Sentry.
133
- */
134
- function constructWrappedFunctionExportQuery(
135
- exportedBindings,
136
- entrypointWrappedFunctions,
137
- debug,
138
- ) {
75
+ function constructWrappedFunctionExportQuery(exportedBindings, entrypointWrappedFunctions, debug) {
139
76
  const functionsToExport = {
140
77
  wrap: [],
141
- reexport: [],
78
+ reexport: []
142
79
  };
143
-
144
- // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`
145
- // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.
146
- Object.values(exportedBindings || {}).forEach(functions =>
147
- functions.forEach(fn => {
80
+ Object.values(exportedBindings || {}).forEach(
81
+ (functions) => functions.forEach((fn) => {
148
82
  if (entrypointWrappedFunctions.includes(fn)) {
149
83
  functionsToExport.wrap.push(fn);
150
84
  } else {
151
85
  functionsToExport.reexport.push(fn);
152
86
  }
153
- }),
87
+ })
154
88
  );
155
-
156
89
  if (debug && functionsToExport.wrap.length === 0) {
157
- core.consoleSandbox(() =>
158
- // eslint-disable-next-line no-console
159
- console.warn(
160
- "[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 Sentry's build options `sentry.experimental_entrypointWrappedFunctions` in `nuxt.config.ts`.",
161
- ),
90
+ core.consoleSandbox(
91
+ () => (
92
+ // eslint-disable-next-line no-console
93
+ console.warn(
94
+ "[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 Sentry's build options `sentry.experimental_entrypointWrappedFunctions` in `nuxt.config.ts`."
95
+ )
96
+ )
162
97
  );
163
98
  }
164
-
165
- const wrapQuery = functionsToExport.wrap.length
166
- ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`
167
- : '';
168
- const reexportQuery = functionsToExport.reexport.length
169
- ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`
170
- : '';
171
-
172
- return [wrapQuery, reexportQuery].join('');
99
+ const wrapQuery = functionsToExport.wrap.length ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(",")}` : "";
100
+ const reexportQuery = functionsToExport.reexport.length ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(",")}` : "";
101
+ return [wrapQuery, reexportQuery].join("");
173
102
  }
174
-
175
- /**
176
- * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)
177
- */
178
103
  function constructFunctionReExport(pathWithQuery, entryId) {
179
104
  const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);
180
-
181
- return wrapFunctions
182
- .reduce(
183
- (functionsCode, currFunctionName) =>
184
- functionsCode.concat(
185
- `async function ${currFunctionName}_sentryWrapped(...args) {\n` +
186
- ` const res = await import(${JSON.stringify(entryId)});\n` +
187
- ` return res.${currFunctionName}.call(this, ...args);\n` +
188
- '}\n' +
189
- `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\n`,
190
- ),
191
- '',
105
+ return wrapFunctions.reduce(
106
+ (functionsCode, currFunctionName) => functionsCode.concat(
107
+ `async function ${currFunctionName}_sentryWrapped(...args) {
108
+ const res = await import(${JSON.stringify(entryId)});
109
+ return res.${currFunctionName}.call(this, ...args);
110
+ }
111
+ export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };
112
+ `
113
+ ),
114
+ ""
115
+ ).concat(
116
+ reexportFunctions.reduce(
117
+ (functionsCode, currFunctionName) => functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),
118
+ ""
192
119
  )
193
- .concat(
194
- reexportFunctions.reduce(
195
- (functionsCode, currFunctionName) =>
196
- functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),
197
- '',
198
- ),
199
- );
120
+ );
200
121
  }
201
-
202
- /**
203
- * Sets up alias to work around OpenTelemetry's incomplete ESM imports.
204
- * https://github.com/getsentry/sentry-javascript/issues/15204
205
- *
206
- * OpenTelemetry's @opentelemetry/resources package has incomplete imports missing
207
- * the .js file extensions (like execAsync for machine-id detection). This causes module resolution
208
- * errors in certain Nuxt configurations, particularly when local Nuxt modules in Nuxt 4 are present.
209
- *
210
- * @see https://nuxt.com/docs/guide/concepts/esm#aliasing-libraries
211
- */
212
122
  function addOTelCommonJSImportAlias(nuxt, isNitroV3 = false) {
213
123
  if (!nuxt.options.dev || isNitroV3) {
214
124
  return;
215
125
  }
216
-
217
126
  if (!nuxt.options.alias) {
218
127
  nuxt.options.alias = {};
219
128
  }
220
-
221
- if (!nuxt.options.alias['@opentelemetry/resources']) {
222
- nuxt.options.alias['@opentelemetry/resources'] = '@opentelemetry/resources/build/src/index.js';
129
+ if (!nuxt.options.alias["@opentelemetry/resources"]) {
130
+ nuxt.options.alias["@opentelemetry/resources"] = "@opentelemetry/resources/build/src/index.js";
223
131
  }
224
132
  }
225
133
 
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/vite/utils.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n/**\n * Gets the major version of the installed nitro package.\n * Returns 2 as the default if nitro is not found or the version cannot be determined.\n */\nexport async function getNitroMajorVersion(): Promise<number> {\n try {\n const { getPackageInfo } = await import('local-pkg');\n const info = await getPackageInfo('nitro');\n if (info?.version) {\n const major = parseInt(info.version.split('.')[0] ?? '2', 10);\n return isNaN(major) ? 2 : major;\n }\n } catch {\n // If local-pkg is unavailable or nitro is not found, default to v2\n }\n return 2;\n}\n\n/**\n * Find the default SDK init file for the given type (client or server).\n * The sentry.server.config file is prioritized over the instrument.server file.\n */\nexport function findDefaultSdkInitFile(type: 'server' | 'client', nuxt?: Nuxt): string | undefined {\n const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];\n const relativePaths: string[] = [];\n\n if (type === 'server') {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n relativePaths.push(path.join('public', `instrument.${type}.${ext}`));\n }\n } else {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n }\n }\n\n // Get layers from highest priority to lowest\n const layers = [...(nuxt?.options._layers ?? [])].reverse();\n\n for (const layer of layers) {\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(layer.cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n }\n\n // As a fallback, also check CWD (left for pure compatibility)\n const cwd = process.cwd();\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n\n return undefined;\n}\n\n/**\n * Extracts the filename from a node command with a path.\n */\nexport function getFilenameFromNodeStartCommand(nodeCommand: string): string | null {\n const regex = /[^/\\\\]+\\.[^/\\\\]+$/;\n const match = nodeCommand.match(regex);\n return match ? match[0] : null;\n}\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\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 =\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 const reexport =\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 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 */\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 Sentry's build options `sentry.experimental_entrypointWrappedFunctions` in `nuxt.config.ts`.\",\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 */\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\n/**\n * Sets up alias to work around OpenTelemetry's incomplete ESM imports.\n * https://github.com/getsentry/sentry-javascript/issues/15204\n *\n * OpenTelemetry's @opentelemetry/resources package has incomplete imports missing\n * the .js file extensions (like execAsync for machine-id detection). This causes module resolution\n * errors in certain Nuxt configurations, particularly when local Nuxt modules in Nuxt 4 are present.\n *\n * @see https://nuxt.com/docs/guide/concepts/esm#aliasing-libraries\n */\nexport function addOTelCommonJSImportAlias(nuxt: Nuxt, isNitroV3 = false): void {\n if (!nuxt.options.dev || isNitroV3) {\n return;\n }\n\n if (!nuxt.options.alias) {\n nuxt.options.alias = {};\n }\n\n if (!nuxt.options.alias['@opentelemetry/resources']) {\n nuxt.options.alias['@opentelemetry/resources'] = '@opentelemetry/resources/build/src/index.js';\n }\n}\n"],"names":["consoleSandbox"],"mappings":";;;;;;AAKA;AACA;AACA;AACA;AACO,eAAe,oBAAoB,GAAoB;AAC9D,EAAE,IAAI;AACN,IAAI,MAAM,EAAE,cAAA,EAAe,GAAI,MAAM,OAAO,WAAW,CAAC;AACxD,IAAI,MAAM,IAAA,GAAO,MAAM,cAAc,CAAC,OAAO,CAAC;AAC9C,IAAI,IAAI,IAAI,EAAE,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AAA,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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,0BAAA,CAAA,IAAA,EAAA,SAAA,GAAA,KAAA,EAAA;AACA,EAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,GAAA,IAAA,SAAA,EAAA;AACA,IAAA;AACA,EAAA;;AAEA,EAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,KAAA,EAAA;AACA,IAAA,IAAA,CAAA,OAAA,CAAA,KAAA,GAAA,EAAA;AACA,EAAA;;AAEA,EAAA,IAAA,CAAA,IAAA,CAAA,OAAA,CAAA,KAAA,CAAA,0BAAA,CAAA,EAAA;AACA,IAAA,IAAA,CAAA,OAAA,CAAA,KAAA,CAAA,0BAAA,CAAA,GAAA,6CAAA;AACA,EAAA;AACA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/vite/utils.ts"],"sourcesContent":["import type { Nuxt } from '@nuxt/schema';\nimport { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { SentryNuxtModuleOptions } from '../common/types';\nimport { resolvePath } from '@nuxt/kit';\n\n/**\n * Gets the major version of the installed nitro package.\n * Returns 2 as the default if nitro is not found or the version cannot be determined.\n */\nexport async function getNitroMajorVersion(): Promise<number> {\n try {\n const { getPackageInfo } = await import('local-pkg');\n const info = await getPackageInfo('nitro');\n if (info?.version) {\n const major = parseInt(info.version.split('.')[0] ?? '2', 10);\n return isNaN(major) ? 2 : major;\n }\n } catch {\n // If local-pkg is unavailable or nitro is not found, default to v2\n }\n return 2;\n}\n\n/**\n * Find the default SDK init file for the given type (client or server).\n * The sentry.server.config file is prioritized over the instrument.server file.\n */\nexport async function findDefaultSdkInitFile(\n type: 'server' | 'client',\n nuxt?: Nuxt,\n options?: SentryNuxtModuleOptions,\n): Promise<string | undefined> {\n const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];\n const relativePaths: string[] = [];\n\n if (type === 'server') {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n relativePaths.push(path.join('public', `instrument.${type}.${ext}`));\n }\n } else {\n for (const ext of possibleFileExtensions) {\n relativePaths.push(`sentry.${type}.config.${ext}`);\n }\n }\n\n // Get layers from highest priority to lowest\n const layers = [...(nuxt?.options._layers ?? [])].reverse();\n\n for (const layer of layers) {\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(layer.cwd, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n }\n\n // As a fallback, also check CWD (left for pure compatibility)\n const rootDir = options?.configDir ? await resolvePath(options.configDir, { type: 'dir' }) : process.cwd();\n for (const relativePath of relativePaths) {\n const fullPath = path.resolve(rootDir, relativePath);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n\n return undefined;\n}\n\n/**\n * Extracts the filename from a node command with a path.\n */\nexport function getFilenameFromNodeStartCommand(nodeCommand: string): string | null {\n const regex = /[^/\\\\]+\\.[^/\\\\]+$/;\n const match = nodeCommand.match(regex);\n return match ? match[0] : null;\n}\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\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 =\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 const reexport =\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 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 */\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 Sentry's build options `sentry.experimental_entrypointWrappedFunctions` in `nuxt.config.ts`.\",\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 */\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\n/**\n * Sets up alias to work around OpenTelemetry's incomplete ESM imports.\n * https://github.com/getsentry/sentry-javascript/issues/15204\n *\n * OpenTelemetry's @opentelemetry/resources package has incomplete imports missing\n * the .js file extensions (like execAsync for machine-id detection). This causes module resolution\n * errors in certain Nuxt configurations, particularly when local Nuxt modules in Nuxt 4 are present.\n *\n * @see https://nuxt.com/docs/guide/concepts/esm#aliasing-libraries\n */\nexport function addOTelCommonJSImportAlias(nuxt: Nuxt, isNitroV3 = false): void {\n if (!nuxt.options.dev || isNitroV3) {\n return;\n }\n\n if (!nuxt.options.alias) {\n nuxt.options.alias = {};\n }\n\n if (!nuxt.options.alias['@opentelemetry/resources']) {\n nuxt.options.alias['@opentelemetry/resources'] = '@opentelemetry/resources/build/src/index.js';\n }\n}\n"],"names":["resolvePath","consoleSandbox"],"mappings":";;;;;;;AAWA,eAAsB,oBAAA,GAAwC;AAC5D,EAAA,IAAI;AACF,IAAA,MAAM,EAAE,cAAA,EAAe,GAAI,MAAM,OAAO,WAAW,CAAA;AACnD,IAAA,MAAM,IAAA,GAAO,MAAM,cAAA,CAAe,OAAO,CAAA;AACzC,IAAA,IAAI,MAAM,OAAA,EAAS;AACjB,MAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,IAAA,CAAK,OAAA,CAAQ,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,IAAK,GAAA,EAAK,EAAE,CAAA;AAC5D,MAAA,OAAO,KAAA,CAAM,KAAK,CAAA,GAAI,C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AAA,CAAG,CAAA;AAAA,MACxF;AAAA;AACF,GACF;AACJ;AAYO,SAAS,0BAAA,CAA2B,IAAA,EAAY,SAAA,GAAY,KAAA,EAAa;AAC9E,EAAA,IAAI,CAAC,IAAA,CAAK,OAAA,CAAQ,GAAA,IAAO,SAAA,EAAW;AAClC,IAAA;AAAA,EACF;AAEA,EAAA,IAAI,CAAC,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO;AACvB,IAAA,IAAA,CAAK,OAAA,CAAQ,QAAQ,EAAC;AAAA,EACxB;AAEA,EAAA,IAAI,CAAC,IAAA,CAAK,OAAA,CAAQ,KAAA,CAAM,0BAA0B,CAAA,EAAG;AACnD,IAAA,IAAA,CAAK,OAAA,CAAQ,KAAA,CAAM,0BAA0B,CAAA,GAAI,6CAAA;AAAA,EACnD;AACF;;;;;;;;;;;;;;;"}
@@ -1,36 +1,24 @@
1
1
  import { defineIntegration, consoleSandbox } from '@sentry/core';
2
2
  import { createSentryPiniaPlugin } from '@sentry/vue';
3
3
 
4
- const INTEGRATION_NAME = 'Pinia';
5
-
6
- const _piniaIntegration = ((
7
- // `unknown` here as well because usePinia declares this type: `export declare const usePinia: () => unknown;`
8
- pinia,
9
- options = {},
10
- ) => {
4
+ const INTEGRATION_NAME = "Pinia";
5
+ const _piniaIntegration = ((pinia, options = {}) => {
11
6
  return {
12
7
  name: INTEGRATION_NAME,
13
8
  setup() {
14
- if (!pinia || (typeof pinia === 'object' && !('use' in pinia))) {
9
+ if (!pinia || typeof pinia === "object" && !("use" in pinia)) {
15
10
  consoleSandbox(() => {
16
- // eslint-disable-next-line no-console
17
11
  console.warn(
18
12
  '[Sentry] The Pinia integration was added, but the passed parameter `pinia` has the wrong value. Make sure to enable Pinia by adding `"@pinia/nuxt"` to the Nuxt modules array and pass pinia to Sentry with `piniaIntegration(usePinia())`. Current value of `pinia`:',
19
- pinia,
13
+ pinia
20
14
  );
21
15
  });
22
16
  } else {
23
- (pinia ).use(createSentryPiniaPlugin(options));
17
+ pinia.use(createSentryPiniaPlugin(options));
24
18
  }
25
- },
19
+ }
26
20
  };
27
- }) ;
28
-
29
- /**
30
- * Monitor an existing Pinia store.
31
- *
32
- * This only works if "@pinia/nuxt" is added to the `modules` array.
33
- */
21
+ });
34
22
  const piniaIntegration = defineIntegration(_piniaIntegration);
35
23
 
36
24
  export { piniaIntegration };
@@ -1 +1 @@
1
- {"version":3,"file":"piniaIntegration.js","sources":["../../../src/client/piniaIntegration.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { consoleSandbox, defineIntegration } from '@sentry/core';\nimport { createSentryPiniaPlugin } from '@sentry/vue';\n\nconst INTEGRATION_NAME = 'Pinia';\n\ntype Pinia = { use: (plugin: ReturnType<typeof createSentryPiniaPlugin>) => void };\n\nconst _piniaIntegration = ((\n // `unknown` here as well because usePinia declares this type: `export declare const usePinia: () => unknown;`\n pinia: unknown | Pinia,\n options: Parameters<typeof createSentryPiniaPlugin>[0] = {},\n) => {\n return {\n name: INTEGRATION_NAME,\n setup() {\n if (!pinia || (typeof pinia === 'object' && !('use' in pinia))) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] The Pinia integration was added, but the passed parameter `pinia` has the wrong value. Make sure to enable Pinia by adding `\"@pinia/nuxt\"` to the Nuxt modules array and pass pinia to Sentry with `piniaIntegration(usePinia())`. Current value of `pinia`:',\n pinia,\n );\n });\n } else {\n (pinia as Pinia).use(createSentryPiniaPlugin(options));\n }\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Monitor an existing Pinia store.\n *\n * This only works if \"@pinia/nuxt\" is added to the `modules` array.\n */\nexport const piniaIntegration = defineIntegration(_piniaIntegration);\n"],"names":[],"mappings":";;;AAIA,MAAM,gBAAA,GAAmB,OAAO;;AAIhC,MAAM,iBAAA,IAAqB;AAC3B;AACA,EAAE,KAAK;AACP,EAAE,OAAO,GAAkD,EAAE;AAC7D,KAAK;AACL,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,GAAG;AACZ,MAAM,IAAI,CAAC,UAAU,OAAO,KAAA,KAAU,QAAA,IAAY,EAAE,KAAA,IAAS,KAAK,CAAC,CAAC,EAAE;AACtE,QAAQ,cAAc,CAAC,MAAM;AAC7B;AACA,UAAU,OAAO,CAAC,IAAI;AACtB,YAAY,uQAAuQ;AACnR,YAAY,KAAK;AACjB,WAAW;AACX,QAAQ,CAAC,CAAC;AACV,MAAM,OAAO;AACb,QAAQ,CAAC,KAAA,GAAgB,GAAG,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC9D,MAAM;AACN,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;MACa,gBAAA,GAAmB,iBAAiB,CAAC,iBAAiB;;;;"}
1
+ {"version":3,"file":"piniaIntegration.js","sources":["../../../src/client/piniaIntegration.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { consoleSandbox, defineIntegration } from '@sentry/core';\nimport { createSentryPiniaPlugin } from '@sentry/vue';\n\nconst INTEGRATION_NAME = 'Pinia';\n\ntype Pinia = { use: (plugin: ReturnType<typeof createSentryPiniaPlugin>) => void };\n\nconst _piniaIntegration = ((\n // `unknown` here as well because usePinia declares this type: `export declare const usePinia: () => unknown;`\n pinia: unknown | Pinia,\n options: Parameters<typeof createSentryPiniaPlugin>[0] = {},\n) => {\n return {\n name: INTEGRATION_NAME,\n setup() {\n if (!pinia || (typeof pinia === 'object' && !('use' in pinia))) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] The Pinia integration was added, but the passed parameter `pinia` has the wrong value. Make sure to enable Pinia by adding `\"@pinia/nuxt\"` to the Nuxt modules array and pass pinia to Sentry with `piniaIntegration(usePinia())`. Current value of `pinia`:',\n pinia,\n );\n });\n } else {\n (pinia as Pinia).use(createSentryPiniaPlugin(options));\n }\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Monitor an existing Pinia store.\n *\n * This only works if \"@pinia/nuxt\" is added to the `modules` array.\n */\nexport const piniaIntegration = defineIntegration(_piniaIntegration);\n"],"names":[],"mappings":";;;AAIA,MAAM,gBAAA,GAAmB,OAAA;AAIzB,MAAM,iBAAA,IAAqB,CAEzB,KAAA,EACA,OAAA,GAAyD,EAAC,KACvD;AACH,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,KAAA,GAAQ;AACN,MAAA,IAAI,CAAC,KAAA,IAAU,OAAO,UAAU,QAAA,IAAY,EAAE,SAAS,KAAA,CAAA,EAAS;AAC9D,QAAA,cAAA,CAAe,MAAM;AAEnB,UAAA,OAAA,CAAQ,IAAA;AAAA,YACN,uQAAA;AAAA,YACA;AAAA,WACF;AAAA,QACF,CAAC,CAAA;AAAA,MACH,CAAA,MAAO;AACL,QAAC,KAAA,CAAgB,GAAA,CAAI,uBAAA,CAAwB,OAAO,CAAC,CAAA;AAAA,MACvD;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAOO,MAAM,gBAAA,GAAmB,kBAAkB,iBAAiB;;;;"}
@@ -1,22 +1,15 @@
1
1
  import { getDefaultIntegrations, init as init$1 } from '@sentry/browser';
2
2
  import { applySdkMetadata, DEV_ENVIRONMENT, DEFAULT_ENVIRONMENT } from '@sentry/core';
3
3
 
4
- /**
5
- * Initializes the client-side of the Nuxt SDK
6
- *
7
- * @param options Configuration options for the SDK.
8
- */
9
4
  function init(options) {
10
5
  const envFallback = import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT;
11
6
  const sentryOptions = {
12
7
  /* BrowserTracing is added later with the Nuxt client plugin */
13
8
  defaultIntegrations: [...getDefaultIntegrations(options)],
14
9
  environment: options.environment ?? process.env.SENTRY_ENVIRONMENT ?? envFallback,
15
- ...options,
10
+ ...options
16
11
  };
17
-
18
- applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'vue']);
19
-
12
+ applySdkMetadata(sentryOptions, "nuxt", ["nuxt", "vue"]);
20
13
  return init$1(sentryOptions);
21
14
  }
22
15
 
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import { getDefaultIntegrations as getBrowserDefaultIntegrations, init as initBrowser } from '@sentry/browser';\nimport type { Client } from '@sentry/core';\nimport { applySdkMetadata, DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from '@sentry/core';\nimport type { SentryNuxtClientOptions } from '../common/types';\n\n/**\n * Initializes the client-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtClientOptions): Client | undefined {\n const envFallback = import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT;\n const sentryOptions = {\n /* BrowserTracing is added later with the Nuxt client plugin */\n defaultIntegrations: [...getBrowserDefaultIntegrations(options)],\n environment: options.environment ?? process.env.SENTRY_ENVIRONMENT ?? envFallback,\n ...options,\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'vue']);\n\n return initBrowser(sentryOptions);\n}\n"],"names":["getBrowserDefaultIntegrations","initBrowser"],"mappings":";;;AAKA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAA+C;AAC3E,EAAE,MAAM,WAAA,GAAc,MAAM,CAAC,IAAI,CAAC,GAAA,GAAM,eAAA,GAAkB,mBAAmB;AAC7E,EAAE,MAAM,gBAAgB;AACxB;AACA,IAAI,mBAAmB,EAAE,CAAC,GAAGA,sBAA6B,CAAC,OAAO,CAAC,CAAC;AACpE,IAAI,WAAW,EAAE,OAAO,CAAC,WAAA,IAAe,OAAO,CAAC,GAAG,CAAC,kBAAA,IAAsB,WAAW;AACrF,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;;AAE1D,EAAE,OAAOC,MAAW,CAAC,aAAa,CAAC;AACnC;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import { getDefaultIntegrations as getBrowserDefaultIntegrations, init as initBrowser } from '@sentry/browser';\nimport type { Client } from '@sentry/core';\nimport { applySdkMetadata, DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from '@sentry/core';\nimport type { SentryNuxtClientOptions } from '../common/types';\n\n/**\n * Initializes the client-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtClientOptions): Client | undefined {\n const envFallback = import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT;\n const sentryOptions = {\n /* BrowserTracing is added later with the Nuxt client plugin */\n defaultIntegrations: [...getBrowserDefaultIntegrations(options)],\n environment: options.environment ?? process.env.SENTRY_ENVIRONMENT ?? envFallback,\n ...options,\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'vue']);\n\n return initBrowser(sentryOptions);\n}\n"],"names":["getBrowserDefaultIntegrations","initBrowser"],"mappings":";;;AAUO,SAAS,KAAK,OAAA,EAAsD;AACzE,EAAA,MAAM,WAAA,GAAc,MAAA,CAAA,IAAA,CAAY,GAAA,GAAM,eAAA,GAAkB,mBAAA;AACxD,EAAA,MAAM,aAAA,GAAgB;AAAA;AAAA,IAEpB,mBAAA,EAAqB,CAAC,GAAGA,sBAAA,CAA8B,OAAO,CAAC,CAAA;AAAA,IAC/D,WAAA,EAAa,OAAA,CAAQ,WAAA,IAAe,OAAA,CAAQ,IAAI,kBAAA,IAAsB,WAAA;AAAA,IACtE,GAAG;AAAA,GACL;AAEA,EAAA,gBAAA,CAAiB,aAAA,EAAe,MAAA,EAAQ,CAAC,MAAA,EAAQ,KAAK,CAAC,CAAA;AAEvD,EAAA,OAAOC,OAAY,aAAa,CAAA;AAClC;;;;"}
@@ -1,19 +1,12 @@
1
1
  import { defineIntegration, GLOBAL_OBJ } from '@sentry/core';
2
2
 
3
- // The vue integration is actually set up in the Sentry Client Module. There it is set up as soon as the nuxt app object is available.
4
- // However, we need to export the vueIntegration from the Client SDK. This means all this integration does is store away
5
- // its options for the Sentry Client Module to pick them up when initializing the actual vueIntegration.
6
-
7
- /**
8
- * Add additional error and span instrumentation specialized for Vue.
9
- */
10
3
  const vueIntegration = defineIntegration((options = {}) => {
11
4
  return {
12
5
  // NOTE: This name is different from the original vueIntegration's name.
13
- name: 'NuxtVueIntegration',
6
+ name: "NuxtVueIntegration",
14
7
  setup() {
15
- (GLOBAL_OBJ )._sentryNuxtVueIntegrationOptions = options;
16
- },
8
+ GLOBAL_OBJ._sentryNuxtVueIntegrationOptions = options;
9
+ }
17
10
  };
18
11
  });
19
12
 
@@ -1 +1 @@
1
- {"version":3,"file":"vueIntegration.js","sources":["../../../src/client/vueIntegration.ts"],"sourcesContent":["import { defineIntegration, GLOBAL_OBJ } from '@sentry/core';\nimport type { VueIntegrationOptions } from '@sentry/vue';\n\ntype Options = Omit<VueIntegrationOptions, 'app' | 'Vue'>;\n\n// Since the options object needs to cross the boundary between some builds (i.e. the nuxt module build and our client\n// SDK build) we cannot use a getter that is exported from here. Instead we'll pass the options object through a global\n// to the module.\nexport type GlobalObjWithIntegrationOptions = { _sentryNuxtVueIntegrationOptions?: Options };\n\n// The vue integration is actually set up in the Sentry Client Module. There it is set up as soon as the nuxt app object is available.\n// However, we need to export the vueIntegration from the Client SDK. This means all this integration does is store away\n// its options for the Sentry Client Module to pick them up when initializing the actual vueIntegration.\n\n/**\n * Add additional error and span instrumentation specialized for Vue.\n */\nexport const vueIntegration = defineIntegration((options: Options = {}) => {\n return {\n // NOTE: This name is different from the original vueIntegration's name.\n name: 'NuxtVueIntegration',\n setup() {\n (GLOBAL_OBJ as GlobalObjWithIntegrationOptions)._sentryNuxtVueIntegrationOptions = options;\n },\n };\n});\n"],"names":[],"mappings":";;AAUA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAM,cAAA,GAAiB,iBAAiB,CAAC,CAAC,OAAO,GAAY,EAAE,KAAK;AAC3E,EAAE,OAAO;AACT;AACA,IAAI,IAAI,EAAE,oBAAoB;AAC9B,IAAI,KAAK,GAAG;AACZ,MAAM,CAAC,UAAA,GAA+C,gCAAA,GAAmC,OAAO;AAChG,IAAI,CAAC;AACL,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"vueIntegration.js","sources":["../../../src/client/vueIntegration.ts"],"sourcesContent":["import { defineIntegration, GLOBAL_OBJ } from '@sentry/core';\nimport type { VueIntegrationOptions } from '@sentry/vue';\n\ntype Options = Omit<VueIntegrationOptions, 'app' | 'Vue'>;\n\n// Since the options object needs to cross the boundary between some builds (i.e. the nuxt module build and our client\n// SDK build) we cannot use a getter that is exported from here. Instead we'll pass the options object through a global\n// to the module.\nexport type GlobalObjWithIntegrationOptions = { _sentryNuxtVueIntegrationOptions?: Options };\n\n// The vue integration is actually set up in the Sentry Client Module. There it is set up as soon as the nuxt app object is available.\n// However, we need to export the vueIntegration from the Client SDK. This means all this integration does is store away\n// its options for the Sentry Client Module to pick them up when initializing the actual vueIntegration.\n\n/**\n * Add additional error and span instrumentation specialized for Vue.\n */\nexport const vueIntegration = defineIntegration((options: Options = {}) => {\n return {\n // NOTE: This name is different from the original vueIntegration's name.\n name: 'NuxtVueIntegration',\n setup() {\n (GLOBAL_OBJ as GlobalObjWithIntegrationOptions)._sentryNuxtVueIntegrationOptions = options;\n },\n };\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,cAAA,GAAiB,iBAAA,CAAkB,CAAC,OAAA,GAAmB,EAAC,KAAM;AACzE,EAAA,OAAO;AAAA;AAAA,IAEL,IAAA,EAAM,oBAAA;AAAA,IACN,KAAA,GAAQ;AACN,MAAC,WAA+C,gCAAA,GAAmC,OAAA;AAAA,IACrF;AAAA,GACF;AACF,CAAC;;;;"}
@@ -1,8 +1,3 @@
1
- /**
2
- * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
3
- *
4
- * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
5
- */
6
1
  const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
7
2
 
8
3
  export { DEBUG_BUILD };
@@ -1 +1 @@
1
- {"version":3,"file":"debug-build.js","sources":["../../../src/common/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"names":[],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,WAAA,IAAc,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA;;;;"}
1
+ {"version":3,"file":"debug-build.js","sources":["../../../src/common/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"names":[],"mappings":"AAOO,MAAM,WAAA,IAAc,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA;;;;"}