@sentry/nuxt 10.64.0 → 10.66.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 (44) hide show
  1. package/build/esm/package.json +1 -1
  2. package/build/module/client/vueIntegration.d.ts +12 -0
  3. package/build/module/{module.d.mts → common/types.d.ts} +22 -11
  4. package/build/module/module.d.ts +4 -232
  5. package/build/module/module.json +2 -6
  6. package/build/module/module.mjs +3 -4
  7. package/build/module/runtime/hooks/captureErrorHook.js +7 -4
  8. package/build/module/runtime/hooks/updateRouteBeforeResponse.js +6 -3
  9. package/build/module/runtime/hooks/wrapMiddlewareHandler.js +5 -14
  10. package/build/module/runtime/plugins/database-legacy.server.js +8 -5
  11. package/build/module/runtime/plugins/database.server.js +8 -5
  12. package/build/module/runtime/plugins/handler-legacy.server.js +6 -3
  13. package/build/module/runtime/plugins/handler.server.js +6 -3
  14. package/build/module/runtime/plugins/index.d.ts +1 -1
  15. package/build/module/runtime/plugins/index.js +1 -1
  16. package/build/module/runtime/plugins/route-detector-legacy.server.js +8 -5
  17. package/build/module/runtime/plugins/route-detector.server.js +8 -5
  18. package/build/module/runtime/plugins/sentry-cloudflare.server.js +10 -7
  19. package/build/module/runtime/plugins/sentry.client.js +8 -5
  20. package/build/module/runtime/plugins/sentry.server.js +8 -5
  21. package/build/module/runtime/plugins/storage-legacy.server.js +8 -5
  22. package/build/module/runtime/plugins/storage.server.js +8 -5
  23. package/build/module/runtime/plugins/update-route-name-legacy.server.js +6 -3
  24. package/build/module/runtime/plugins/update-route-name.server.js +6 -3
  25. package/build/module/runtime/utils/database-span-data.js +3 -1
  26. package/build/module/runtime/utils/event-type-check.js +6 -4
  27. package/build/module/runtime/utils/instrumentDatabase.d.ts +1 -1
  28. package/build/module/runtime/utils/instrumentDatabase.js +6 -12
  29. package/build/module/runtime/utils/instrumentStorage.js +10 -21
  30. package/build/module/runtime/utils/patchEventHandler.js +5 -8
  31. package/build/module/runtime/utils/route-extraction.js +5 -2
  32. package/build/module/runtime/utils.js +7 -4
  33. package/build/module/vendor/server-template.d.ts +7 -0
  34. package/build/module/vite/addServerConfig.d.ts +22 -0
  35. package/build/module/vite/databaseConfig.d.ts +6 -0
  36. package/build/module/vite/middlewareConfig.d.ts +11 -0
  37. package/build/module/vite/sentryVitePlugin.d.ts +11 -0
  38. package/build/module/vite/sourceMaps.d.ts +66 -0
  39. package/build/module/vite/storageConfig.d.ts +5 -0
  40. package/build/module/vite/utils.d.ts +58 -0
  41. package/build/types/runtime/utils/instrumentStorage.d.ts.map +1 -1
  42. package/package.json +10 -12
  43. package/build/module/module.cjs +0 -5
  44. package/build/module/types.d.mts +0 -1
@@ -1 +1 @@
1
- {"type":"module","version":"10.64.0"}
1
+ {"type":"module","version":"10.66.0"}
@@ -0,0 +1,12 @@
1
+ import type { VueIntegrationOptions } from '@sentry/vue';
2
+ type Options = Omit<VueIntegrationOptions, 'app' | 'Vue'>;
3
+ export type GlobalObjWithIntegrationOptions = {
4
+ _sentryNuxtVueIntegrationOptions?: Options;
5
+ };
6
+ /**
7
+ * Add additional error and span instrumentation specialized for Vue.
8
+ */
9
+ export declare const vueIntegration: (options?: Options | undefined) => import("@sentry/core").Integration & {
10
+ name: string;
11
+ };
12
+ export {};
@@ -1,8 +1,23 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
- import { BuildTimeOptionsBase } from '@sentry/core';
3
- import { SentryRollupPluginOptions } from '@sentry/rollup-plugin';
4
- import { SentryVitePluginOptions } from '@sentry/vite-plugin';
5
-
1
+ import type { BuildTimeOptionsBase } from '@sentry/core';
2
+ import type { init as initNode } from '@sentry/node';
3
+ import type { SentryRollupPluginOptions } from '@sentry/rollup-plugin';
4
+ import type { SentryVitePluginOptions } from '@sentry/vite-plugin';
5
+ import type { init as initVue } from '@sentry/vue';
6
+ export type SentryNuxtClientOptions = Omit<Parameters<typeof initVue>[0] & object, 'app'>;
7
+ export type SentryNuxtServerOptions = Parameters<typeof initNode>[0] & {
8
+ /**
9
+ * Enables the Sentry error handler for the Nitro error hook.
10
+ *
11
+ * When enabled, exceptions are automatically sent to Sentry with additional data such as the transaction name and Nitro error context.
12
+ * It's recommended to keep this enabled unless you need to implement a custom error handler.
13
+ *
14
+ * If you need a custom implementation, disable this option and refer to the default handler as a reference:
15
+ * https://github.com/getsentry/sentry-javascript/blob/da8ba8d77a28b43da5014acc8dd98906d2180cc1/packages/nuxt/src/runtime/plugins/sentry.server.ts#L20-L46
16
+ *
17
+ * @default true
18
+ */
19
+ enableNitroErrorHandler?: boolean;
20
+ };
6
21
  type SourceMapsOptions = {
7
22
  /**
8
23
  * Suppresses all logs.
@@ -144,7 +159,7 @@ type SourceMapsOptions = {
144
159
  /**
145
160
  * Build options for the Sentry module. These options are used during build-time by the Sentry SDK.
146
161
  */
147
- type SentryNuxtModuleOptions = BuildTimeOptionsBase & {
162
+ export type SentryNuxtModuleOptions = BuildTimeOptionsBase & {
148
163
  /**
149
164
  * Enable the Sentry Nuxt Module.
150
165
  *
@@ -225,8 +240,4 @@ type SentryNuxtModuleOptions = BuildTimeOptionsBase & {
225
240
  */
226
241
  unstable_sentryBundlerPluginOptions?: SentryRollupPluginOptions & SentryVitePluginOptions;
227
242
  };
228
-
229
- type ModuleOptions = SentryNuxtModuleOptions;
230
- declare const _default: _nuxt_schema.NuxtModule<SentryNuxtModuleOptions, SentryNuxtModuleOptions, false>;
231
-
232
- export { type ModuleOptions, _default as default };
243
+ export {};
@@ -1,232 +1,4 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
- import { BuildTimeOptionsBase } from '@sentry/core';
3
- import { SentryRollupPluginOptions } from '@sentry/rollup-plugin';
4
- import { SentryVitePluginOptions } from '@sentry/vite-plugin';
5
-
6
- type SourceMapsOptions = {
7
- /**
8
- * Suppresses all logs.
9
- *
10
- * @default false
11
- * @deprecated Use option `silent` instead of `sourceMapsUploadOptions.silent`
12
- */
13
- silent?: boolean;
14
- /**
15
- * When an error occurs during release creation or sourcemaps upload, the plugin will call this function.
16
- *
17
- * By default, the plugin will simply throw an error, thereby stopping the bundling process.
18
- * If an `errorHandler` callback is provided, compilation will continue, unless an error is
19
- * thrown in the provided callback.
20
- *
21
- * To allow compilation to continue but still emit a warning, set this option to the following:
22
- *
23
- * ```js
24
- * (err) => {
25
- * console.warn(err);
26
- * }
27
- * ```
28
- *
29
- * @deprecated Use option `errorHandler` instead of `sourceMapsUploadOptions.errorHandler`
30
- */
31
- errorHandler?: (err: Error) => void;
32
- /**
33
- * Options related to managing the Sentry releases for a build.
34
- *
35
- * More info: https://docs.sentry.io/product/releases/
36
- *
37
- * @deprecated Use option `release` instead of `sourceMapsUploadOptions.release`
38
- */
39
- release?: {
40
- /**
41
- * Unique identifier for the release you want to create.
42
- *
43
- * This value can also be specified via the `SENTRY_RELEASE` environment variable.
44
- *
45
- * Defaults to automatically detecting a value for your environment.
46
- * This includes values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA.
47
- * (the latter requires access to git CLI and for the root directory to be a valid repository)
48
- *
49
- * If you didn't provide a value and the plugin can't automatically detect one, no release will be created.
50
- *
51
- * @deprecated Use `release.name` instead of `sourceMapsUploadOptions.release.name`
52
- */
53
- name?: string;
54
- };
55
- /**
56
- * If this flag is `true`, and an auth token is detected, the Sentry SDK will
57
- * automatically generate and upload source maps to Sentry during a production build.
58
- *
59
- * @default true
60
- * @deprecated Use option `sourcemaps.disable` instead of `sourceMapsUploadOptions.enabled`
61
- */
62
- enabled?: boolean;
63
- /**
64
- * The auth token to use when uploading source maps to Sentry.
65
- *
66
- * Instead of specifying this option, you can also set the `SENTRY_AUTH_TOKEN` environment variable.
67
- *
68
- * To create an auth token, follow this guide:
69
- * @see https://docs.sentry.io/product/accounts/auth-tokens/#organization-auth-tokens
70
- * @deprecated Use option `authToken` instead of `sourceMapsUploadOptions.authToken`
71
- */
72
- authToken?: string;
73
- /**
74
- * The organization slug of your Sentry organization.
75
- * Instead of specifying this option, you can also set the `SENTRY_ORG` environment variable.
76
- * @deprecated Use option `org` instead of `sourceMapsUploadOptions.org`
77
- */
78
- org?: string;
79
- /**
80
- * The URL of your Sentry instance if you're using self-hosted Sentry.
81
- *
82
- * @default https://sentry.io by default the plugin will point towards the Sentry SaaS URL
83
- * @deprecated Use `sentryUrl` instead of `sourceMapsUploadOptions.url`
84
- */
85
- url?: string;
86
- /**
87
- * The project slug of your Sentry project.
88
- * Instead of specifying this option, you can also set the `SENTRY_PROJECT` environment variable.
89
- *
90
- * @deprecated Use option `project` instead of `sourceMapsUploadOptions.project`
91
- */
92
- project?: string;
93
- /**
94
- * If this flag is `true`, the Sentry plugin will collect some telemetry data and send it to Sentry.
95
- * It will not collect any sensitive or user-specific data.
96
- *
97
- * @default true
98
- * @deprecated Use option `telemetry` instead of `sourceMapsUploadOptions.telemetry`
99
- */
100
- telemetry?: boolean;
101
- /**
102
- * Options related to sourcemaps
103
- *
104
- * @deprecated Use option `sourcemaps` instead of `sourceMapsUploadOptions.sourcemaps`
105
- */
106
- sourcemaps?: {
107
- /**
108
- * A glob or an array of globs that specify the build artifacts and source maps that will be uploaded to Sentry.
109
- *
110
- * If this option is not specified, sensible defaults based on your adapter and nuxt.config.js
111
- * setup will be used. Use this option to override these defaults, for instance if you have a
112
- * customized build setup that diverges from Nuxt's defaults.
113
- *
114
- * The globbing patterns must follow the implementation of the `glob` package.
115
- * @see https://www.npmjs.com/package/glob#glob-primer
116
- *
117
- * @deprecated Use option `sourcemaps.assets` instead of `sourceMapsUploadOptions.sourcemaps.assets`
118
- */
119
- assets?: string | Array<string>;
120
- /**
121
- * A glob or an array of globs that specifies which build artifacts should not be uploaded to Sentry.
122
- *
123
- * @default [] - By default no files are ignored. Thus, all files matching the `assets` glob
124
- * or the default value for `assets` are uploaded.
125
- *
126
- * The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
127
- *
128
- * @deprecated Use option `sourcemaps.ignore` instead of `sourceMapsUploadOptions.sourcemaps.ignore`
129
- */
130
- ignore?: string | Array<string>;
131
- /**
132
- * A glob or an array of globs that specifies the build artifacts that should be deleted after the artifact
133
- * upload to Sentry has been completed.
134
- *
135
- * @default [] - By default no files are deleted.
136
- *
137
- * The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
138
- *
139
- * @deprecated Use option `sourcemaps.filesToDeleteAfterUpload` instead of `sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload`
140
- */
141
- filesToDeleteAfterUpload?: string | Array<string>;
142
- };
143
- };
144
- /**
145
- * Build options for the Sentry module. These options are used during build-time by the Sentry SDK.
146
- */
147
- type SentryNuxtModuleOptions = BuildTimeOptionsBase & {
148
- /**
149
- * Enable the Sentry Nuxt Module.
150
- *
151
- * @default true
152
- */
153
- enabled?: boolean;
154
- /**
155
- * Options for the Sentry Vite plugin to customize the source maps upload process.
156
- *
157
- * These options are always read from the `sentry` module options in the `nuxt.config.(js|ts).
158
- * Do not define them in the `sentry.client.config.(js|ts)` or `sentry.server.config.(js|ts)` files.
159
- *
160
- * @deprecated This option was deprecated as it adds unnecessary nesting.
161
- * Put the options one level higher to the root-level of the `sentry` module options.
162
- */
163
- sourceMapsUploadOptions?: SourceMapsOptions;
164
- /**
165
- *
166
- * Enables (partial) server tracing by automatically injecting Sentry for environments where modifying the node option `--import` is not possible.
167
- *
168
- * **DO NOT** add the node CLI flag `--import` in your node start script, when auto-injecting Sentry.
169
- * This would initialize Sentry twice on the server-side and this leads to unexpected issues.
170
- *
171
- * ---
172
- *
173
- * **"top-level-import"**
174
- *
175
- * Enabling basic server tracing with top-level import can be used for environments where modifying the node option `--import` is not possible.
176
- * However, enabling this option only supports limited tracing instrumentation. Only http traces will be collected (but no database-specific traces etc.).
177
- *
178
- * If `"top-level-import"` is enabled, the Sentry SDK will import the Sentry server config at the top of the server entry file to load the SDK on the server.
179
- *
180
- * ---
181
- * **"experimental_dynamic-import"**
182
- *
183
- * Wraps the server entry file with a dynamic `import()`. This will make it possible to preload Sentry and register
184
- * necessary hooks before other code runs. (Node docs: https://nodejs.org/api/module.html#enabling)
185
- *
186
- * If `"experimental_dynamic-import"` is enabled, the Sentry SDK wraps the server entry file with `import()`.
187
- *
188
- * @default undefined
189
- */
190
- autoInjectServerSentry?: 'top-level-import' | 'experimental_dynamic-import';
191
- /**
192
- * Provide the resolved path to a custom Sentry client config file.
193
- *
194
- * If not provided, the default location (`<projectRoot>/sentry.(client|server).config.(js|ts)`) will be used to look up the config file.
195
- * If there is no file at the default location either, the SDK won't be initialized.
196
- *
197
- * Resolves the full path to a file or directory, respecting Nuxt alias and extensions options.
198
- * @example
199
- *
200
- * ```ts
201
- * sentry: {
202
- * configDir: '~/sentry-config',
203
- * // Sentry will search for `<rootDir>/<srcDir>/sentry-config/sentry.(client|server).config.(js|ts)` files.
204
- * }
205
- * ```
206
- */
207
- configDir?: string;
208
- /**
209
- * When `autoInjectServerSentry` is set to `"experimental_dynamic-import"`, the SDK will wrap your Nitro server entrypoint
210
- * with a dynamic `import()` to ensure all dependencies can be properly instrumented. Any previous exports from the entrypoint are still exported.
211
- * Most exports of the server entrypoint are serverless functions and those are wrapped by Sentry. Other exports stay as-is.
212
- *
213
- * By default, the SDK will wrap the default export as well as a `handler` or `server` export from the entrypoint.
214
- * If your server has a different main export that is used to run the server, you can overwrite this by providing an array of export names to wrap.
215
- * Any wrapped export is expected to be an async function.
216
- *
217
- * @default ['default', 'handler', 'server']
218
- */
219
- experimental_entrypointWrappedFunctions?: string[];
220
- /**
221
- * Options to be passed directly to the Sentry Rollup Plugin (`@sentry/rollup-plugin`) and Sentry Vite Plugin (`@sentry/vite-plugin`) that ship with the Sentry Nuxt SDK.
222
- * You can use this option to override any options the SDK passes to the Vite (for Nuxt) and Rollup (for Nitro) plugin.
223
- *
224
- * Please note that this option is unstable and may change in a breaking way in any release.
225
- */
226
- unstable_sentryBundlerPluginOptions?: SentryRollupPluginOptions & SentryVitePluginOptions;
227
- };
228
-
229
- type ModuleOptions = SentryNuxtModuleOptions;
230
- declare const _default: _nuxt_schema.NuxtModule<SentryNuxtModuleOptions, SentryNuxtModuleOptions, false>;
231
-
232
- export { type ModuleOptions, _default as default };
1
+ import type { SentryNuxtModuleOptions } from './common/types';
2
+ export type ModuleOptions = SentryNuxtModuleOptions;
3
+ declare const _default: import("@nuxt/schema").NuxtModule<SentryNuxtModuleOptions, SentryNuxtModuleOptions, false>;
4
+ export default _default;
@@ -4,9 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.7.0"
6
6
  },
7
- "version": "10.64.0",
8
- "builder": {
9
- "@nuxt/module-builder": "0.8.4",
10
- "unbuild": "2.0.0"
11
- }
12
- }
7
+ "version": "10.66.0"
8
+ }
@@ -233,8 +233,7 @@ function wrapEntryWithDynamicImport({
233
233
  }
234
234
  if (options.isEntry && source.includes(".mjs") && !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {
235
235
  const resolution = await this.resolve(source, importer, options);
236
- if (!resolution || resolution?.external)
237
- return resolution;
236
+ if (!resolution || resolution?.external) return resolution;
238
237
  const moduleInfo = await this.load(resolution);
239
238
  moduleInfo.moduleSideEffects = true;
240
239
  return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`) ? resolution.id : `${resolutionIdPrefix}${resolution.id.concat(SENTRY_WRAPPED_ENTRY).concat(
@@ -647,7 +646,7 @@ function addStorageInstrumentation(nuxt, isLegacyNitro) {
647
646
  }
648
647
  }
649
648
 
650
- const module = defineNuxtModule({
649
+ var module$1 = defineNuxtModule({
651
650
  meta: {
652
651
  name: "@sentry/nuxt/module",
653
652
  configKey: "sentry",
@@ -815,4 +814,4 @@ const module = defineNuxtModule({
815
814
  }
816
815
  });
817
816
 
818
- export { module as default };
817
+ export { module$1 as default };
@@ -1,7 +1,8 @@
1
- import { captureException, flushIfServerless, getClient, getCurrentScope } from "@sentry/core";
2
- import { H3Error } from "h3";
3
- import { extractErrorContext } from "../utils.js";
4
- export async function sentryCaptureErrorHook(error, errorContext) {
1
+ import { getClient, getCurrentScope, captureException, flushIfServerless } from '@sentry/core';
2
+ import { H3Error } from 'h3';
3
+ import { extractErrorContext } from '../utils.js';
4
+
5
+ async function sentryCaptureErrorHook(error, errorContext) {
5
6
  const sentryClient = getClient();
6
7
  const sentryClientOptions = sentryClient?.getOptions();
7
8
  if (sentryClientOptions && "enableNitroErrorHandler" in sentryClientOptions && sentryClientOptions.enableNitroErrorHandler === false) {
@@ -29,3 +30,5 @@ export async function sentryCaptureErrorHook(error, errorContext) {
29
30
  });
30
31
  await flushIfServerless();
31
32
  }
33
+
34
+ export { sentryCaptureErrorHook };
@@ -1,9 +1,10 @@
1
- import { debug, getActiveSpan, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from "@sentry/core";
1
+ import { getActiveSpan, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, isObjectLike, debug } from '@sentry/core';
2
+
2
3
  function getMatchedRoutePath(event) {
3
4
  const matchedRoute = event.context.matchedRoute;
4
5
  return matchedRoute?.path ?? matchedRoute?.route;
5
6
  }
6
- export function updateRouteBeforeResponse(event) {
7
+ function updateRouteBeforeResponse(event) {
7
8
  if (!event.context.matchedRoute) {
8
9
  return;
9
10
  }
@@ -26,7 +27,7 @@ export function updateRouteBeforeResponse(event) {
26
27
  "http.route": matchedRoutePath
27
28
  });
28
29
  const params = event.context?.params;
29
- if (params && typeof params === "object") {
30
+ if (isObjectLike(params)) {
30
31
  Object.entries(params).forEach(([key, value]) => {
31
32
  rootSpan.setAttributes({
32
33
  [`url.path.parameter.${key}`]: String(value),
@@ -37,3 +38,5 @@ export function updateRouteBeforeResponse(event) {
37
38
  debug.log(`Updated transaction name for parametrized route: ${matchedRoutePath}`);
38
39
  }
39
40
  }
41
+
42
+ export { updateRouteBeforeResponse };
@@ -1,17 +1,6 @@
1
- import {
2
- captureException,
3
- debug,
4
- flushIfServerless,
5
- getClient,
6
- httpHeadersToSpanAttributes,
7
- SEMANTIC_ATTRIBUTE_SENTRY_OP,
8
- SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
9
- SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
10
- SPAN_STATUS_ERROR,
11
- SPAN_STATUS_OK,
12
- startSpan
13
- } from "@sentry/core";
14
- export function wrapMiddlewareHandlerWithSentry(handler, fileName) {
1
+ import { debug, httpHeadersToSpanAttributes, getClient, startSpan, SPAN_STATUS_OK, SPAN_STATUS_ERROR, captureException, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, flushIfServerless, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core';
2
+
3
+ function wrapMiddlewareHandlerWithSentry(handler, fileName) {
15
4
  if (!isEventHandlerObject(handler)) {
16
5
  return wrapEventHandler(handler, fileName);
17
6
  }
@@ -112,3 +101,5 @@ function getSpanAttributes(event, middlewareName, hookName, index) {
112
101
  function isEventHandlerObject(handler) {
113
102
  return typeof handler !== "function";
114
103
  }
104
+
105
+ export { wrapMiddlewareHandlerWithSentry };
@@ -1,6 +1,9 @@
1
- import { useDatabase } from "nitropack/runtime";
2
- import { databaseConfig } from "#sentry/database-config.mjs";
3
- import { createDatabasePlugin } from "../utils/instrumentDatabase.js";
4
- export default () => {
1
+ import { useDatabase } from 'nitropack/runtime';
2
+ import { databaseConfig } from '#sentry/database-config.mjs';
3
+ import { createDatabasePlugin } from '../utils/instrumentDatabase.js';
4
+
5
+ var databaseLegacy_server = (() => {
5
6
  createDatabasePlugin(useDatabase, databaseConfig);
6
- };
7
+ });
8
+
9
+ export { databaseLegacy_server as default };
@@ -1,6 +1,9 @@
1
- import { useDatabase } from "nitro/database";
2
- import { databaseConfig } from "#sentry/database-config.mjs";
3
- import { createDatabasePlugin } from "../utils/instrumentDatabase.js";
4
- export default () => {
1
+ import { useDatabase } from 'nitro/database';
2
+ import { databaseConfig } from '#sentry/database-config.mjs';
3
+ import { createDatabasePlugin } from '../utils/instrumentDatabase.js';
4
+
5
+ var database_server = (() => {
5
6
  createDatabasePlugin(useDatabase, databaseConfig);
6
- };
7
+ });
8
+
9
+ export { database_server as default };
@@ -1,4 +1,7 @@
1
- import { patchEventHandler } from "../utils/patchEventHandler.js";
2
- export default (nitroApp) => {
1
+ import { patchEventHandler } from '../utils/patchEventHandler.js';
2
+
3
+ var handlerLegacy_server = ((nitroApp) => {
3
4
  nitroApp.h3App.handler = patchEventHandler(nitroApp.h3App.handler);
4
- };
5
+ });
6
+
7
+ export { handlerLegacy_server as default };
@@ -1,6 +1,9 @@
1
- import { patchEventHandler } from "../utils/patchEventHandler.js";
2
- export default (nitroApp) => {
1
+ import { patchEventHandler } from '../utils/patchEventHandler.js';
2
+
3
+ var handler_server = ((nitroApp) => {
3
4
  if (nitroApp?.h3?.handler) {
4
5
  nitroApp.h3.handler = patchEventHandler(nitroApp.h3.handler);
5
6
  }
6
- };
7
+ });
8
+
9
+ export { handler_server as default };
@@ -1 +1 @@
1
- export { sentryCloudflareNitroPlugin } from './sentry-cloudflare.server.js';
1
+ export { sentryCloudflareNitroPlugin } from './sentry-cloudflare.server';
@@ -1 +1 @@
1
- export { sentryCloudflareNitroPlugin } from "./sentry-cloudflare.server.js";
1
+ export { sentryCloudflareNitroPlugin } from './sentry-cloudflare.server.js';
@@ -1,11 +1,12 @@
1
- import { debug, getActiveSpan, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from "@sentry/core";
2
- import { defineNuxtPlugin } from "nuxt/app";
3
- import { extractParametrizedRouteFromContext } from "../utils/route-extraction.js";
4
- export default defineNuxtPlugin((nuxtApp) => {
1
+ import { debug, getActiveSpan, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
2
+ import { defineNuxtPlugin } from 'nuxt/app';
3
+ import { extractParametrizedRouteFromContext } from '../utils/route-extraction.js';
4
+
5
+ var routeDetectorLegacy_server = defineNuxtPlugin((nuxtApp) => {
5
6
  nuxtApp.hooks.hook("app:rendered", async (renderContext) => {
6
7
  let buildTimePagesData;
7
8
  try {
8
- const { default: importedPagesData } = await import("#build/sentry--nuxt-pages-data.mjs");
9
+ const { default: importedPagesData } = await import('#build/sentry--nuxt-pages-data.mjs');
9
10
  buildTimePagesData = importedPagesData || [];
10
11
  debug.log("Imported build-time pages data:", buildTimePagesData);
11
12
  } catch (error) {
@@ -35,3 +36,5 @@ export default defineNuxtPlugin((nuxtApp) => {
35
36
  }
36
37
  });
37
38
  });
39
+
40
+ export { routeDetectorLegacy_server as default };
@@ -1,11 +1,12 @@
1
- import { debug, getActiveSpan, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from "@sentry/core";
2
- import { defineNuxtPlugin } from "nuxt/app";
3
- import { extractParametrizedRouteFromContext } from "../utils/route-extraction.js";
4
- export default defineNuxtPlugin((nuxtApp) => {
1
+ import { debug, getActiveSpan, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
2
+ import { defineNuxtPlugin } from 'nuxt/app';
3
+ import { extractParametrizedRouteFromContext } from '../utils/route-extraction.js';
4
+
5
+ var routeDetector_server = defineNuxtPlugin((nuxtApp) => {
5
6
  nuxtApp.hooks.hook("app:rendered", async (renderContext) => {
6
7
  let buildTimePagesData;
7
8
  try {
8
- const { default: importedPagesData } = await import("#sentry/nuxt-pages-data.mjs");
9
+ const { default: importedPagesData } = await import('#sentry/nuxt-pages-data.mjs');
9
10
  buildTimePagesData = importedPagesData || [];
10
11
  debug.log("Imported build-time pages data:", buildTimePagesData);
11
12
  } catch (error) {
@@ -35,3 +36,5 @@ export default defineNuxtPlugin((nuxtApp) => {
35
36
  }
36
37
  });
37
38
  });
39
+
40
+ export { routeDetector_server as default };
@@ -1,10 +1,11 @@
1
- import { setAsyncLocalStorageAsyncContextStrategy, wrapRequestHandler } from "@sentry/cloudflare";
2
- import { debug, getDefaultIsolationScope, getIsolationScope, getTraceData } from "@sentry/core";
3
- import { sentryCaptureErrorHook } from "../hooks/captureErrorHook.js";
4
- import { updateRouteBeforeResponse } from "../hooks/updateRouteBeforeResponse.js";
5
- import { addSentryTracingMetaTags } from "../utils.js";
6
- import { getCfProperties, getCloudflareProperties, hasCfProperty, isEventType } from "../utils/event-type-check.js";
7
- export const sentryCloudflareNitroPlugin = (optionsOrFn) => (nitroApp) => {
1
+ import { setAsyncLocalStorageAsyncContextStrategy, wrapRequestHandler } from '@sentry/cloudflare';
2
+ import { debug, getIsolationScope, getDefaultIsolationScope, getTraceData } from '@sentry/core';
3
+ import { sentryCaptureErrorHook } from '../hooks/captureErrorHook.js';
4
+ import { updateRouteBeforeResponse } from '../hooks/updateRouteBeforeResponse.js';
5
+ import { addSentryTracingMetaTags } from '../utils.js';
6
+ import { isEventType, getCfProperties, getCloudflareProperties, hasCfProperty } from '../utils/event-type-check.js';
7
+
8
+ const sentryCloudflareNitroPlugin = (optionsOrFn) => (nitroApp) => {
8
9
  const traceDataMap = /* @__PURE__ */ new WeakMap();
9
10
  nitroApp.localFetch = new Proxy(nitroApp.localFetch, {
10
11
  async apply(handlerTarget, handlerThisArg, handlerArgs) {
@@ -61,3 +62,5 @@ export const sentryCloudflareNitroPlugin = (optionsOrFn) => (nitroApp) => {
61
62
  });
62
63
  nitroApp.hooks.hook("error", sentryCaptureErrorHook);
63
64
  };
65
+
66
+ export { sentryCloudflareNitroPlugin };
@@ -1,8 +1,9 @@
1
- import { getClient, GLOBAL_OBJ } from "@sentry/core";
2
- import { browserTracingIntegration, vueIntegration } from "@sentry/vue";
3
- import { defineNuxtPlugin, isNuxtError } from "nuxt/app";
4
- import { reportNuxtError } from "../utils.js";
5
- export default defineNuxtPlugin({
1
+ import { getClient, GLOBAL_OBJ } from '@sentry/core';
2
+ import { browserTracingIntegration, vueIntegration } from '@sentry/vue';
3
+ import { defineNuxtPlugin, isNuxtError } from 'nuxt/app';
4
+ import { reportNuxtError } from '../utils.js';
5
+
6
+ var sentry_client = defineNuxtPlugin({
6
7
  name: "sentry-client-integrations",
7
8
  dependsOn: ["sentry-client-config"],
8
9
  async setup(nuxtApp) {
@@ -40,3 +41,5 @@ export default defineNuxtPlugin({
40
41
  });
41
42
  }
42
43
  });
44
+
45
+ export { sentry_client as default };
@@ -1,7 +1,8 @@
1
- import { debug } from "@sentry/core";
2
- import { sentryCaptureErrorHook } from "../hooks/captureErrorHook.js";
3
- import { addSentryTracingMetaTags } from "../utils.js";
4
- export default (nitroApp) => {
1
+ import { debug } from '@sentry/core';
2
+ import { sentryCaptureErrorHook } from '../hooks/captureErrorHook.js';
3
+ import { addSentryTracingMetaTags } from '../utils.js';
4
+
5
+ var sentry_server = ((nitroApp) => {
5
6
  nitroApp.hooks.hook("error", sentryCaptureErrorHook);
6
7
  nitroApp.hooks.hook("render:html", (html, { event }) => {
7
8
  const nodeResHeadersH3v1 = event.node?.res?.getHeaders() || {};
@@ -23,4 +24,6 @@ export default (nitroApp) => {
23
24
  );
24
25
  }
25
26
  });
26
- };
27
+ });
28
+
29
+ export { sentry_server as default };
@@ -1,6 +1,9 @@
1
- import { useStorage } from "nitropack/runtime";
2
- import { userStorageMounts } from "#sentry/storage-config.mjs";
3
- import { createStoragePlugin } from "../utils/instrumentStorage.js";
4
- export default async (_nitroApp) => {
1
+ import { useStorage } from 'nitropack/runtime';
2
+ import { userStorageMounts } from '#sentry/storage-config.mjs';
3
+ import { createStoragePlugin } from '../utils/instrumentStorage.js';
4
+
5
+ var storageLegacy_server = (async (_nitroApp) => {
5
6
  await createStoragePlugin(useStorage, userStorageMounts);
6
- };
7
+ });
8
+
9
+ export { storageLegacy_server as default };
@@ -1,6 +1,9 @@
1
- import { useStorage } from "nitro/storage";
2
- import { userStorageMounts } from "#sentry/storage-config.mjs";
3
- import { createStoragePlugin } from "../utils/instrumentStorage.js";
4
- export default async (_nitroApp) => {
1
+ import { useStorage } from 'nitro/storage';
2
+ import { userStorageMounts } from '#sentry/storage-config.mjs';
3
+ import { createStoragePlugin } from '../utils/instrumentStorage.js';
4
+
5
+ var storage_server = (async (_nitroApp) => {
5
6
  await createStoragePlugin(useStorage, userStorageMounts);
6
- };
7
+ });
8
+
9
+ export { storage_server as default };
@@ -1,4 +1,7 @@
1
- import { updateRouteBeforeResponse } from "../hooks/updateRouteBeforeResponse.js";
2
- export default (nitroApp) => {
1
+ import { updateRouteBeforeResponse } from '../hooks/updateRouteBeforeResponse.js';
2
+
3
+ var updateRouteNameLegacy_server = ((nitroApp) => {
3
4
  nitroApp.hooks.hook("beforeResponse", updateRouteBeforeResponse);
4
- };
5
+ });
6
+
7
+ export { updateRouteNameLegacy_server as default };
@@ -1,4 +1,7 @@
1
- import { updateRouteBeforeResponse } from "../hooks/updateRouteBeforeResponse.js";
2
- export default (nitroApp) => {
1
+ import { updateRouteBeforeResponse } from '../hooks/updateRouteBeforeResponse.js';
2
+
3
+ var updateRouteName_server = ((nitroApp) => {
3
4
  nitroApp.hooks.hook("response", (_response, event) => updateRouteBeforeResponse(event));
4
- };
5
+ });
6
+
7
+ export { updateRouteName_server as default };
@@ -1,4 +1,4 @@
1
- export function getDatabaseSpanData(config) {
1
+ function getDatabaseSpanData(config) {
2
2
  try {
3
3
  if (!config?.connector) {
4
4
  return {
@@ -27,3 +27,5 @@ export function getDatabaseSpanData(config) {
27
27
  return {};
28
28
  }
29
29
  }
30
+
31
+ export { getDatabaseSpanData };
@@ -2,14 +2,14 @@ function hasCloudflareProperty(context) {
2
2
  return context !== null && typeof context === "object" && // context.cloudflare properties
3
3
  "cloudflare" in context && typeof context.cloudflare === "object" && context.cloudflare !== null && "context" in context.cloudflare;
4
4
  }
5
- export function hasCfProperty(context) {
5
+ function hasCfProperty(context) {
6
6
  return context !== null && typeof context === "object" && // context.cf properties
7
7
  "cf" in context && typeof context.cf === "object" && context.cf !== null;
8
8
  }
9
9
  function hasCfAndCloudflare(context) {
10
10
  return hasCfProperty(context) && hasCloudflareProperty(context);
11
11
  }
12
- export function isEventType(event) {
12
+ function isEventType(event) {
13
13
  if (event === null || typeof event !== "object") return false;
14
14
  return (
15
15
  // basic properties
@@ -18,15 +18,17 @@ export function isEventType(event) {
18
18
  (hasCfAndCloudflare(event.context) || "_platform" in event.context && hasCfAndCloudflare(event.context._platform))
19
19
  );
20
20
  }
21
- export function getCfProperties(event) {
21
+ function getCfProperties(event) {
22
22
  if ("cf" in event.context) {
23
23
  return event.context.cf;
24
24
  }
25
25
  return event.context._platform.cf;
26
26
  }
27
- export function getCloudflareProperties(event) {
27
+ function getCloudflareProperties(event) {
28
28
  if ("cloudflare" in event.context) {
29
29
  return event.context.cloudflare;
30
30
  }
31
31
  return event.context._platform.cloudflare;
32
32
  }
33
+
34
+ export { getCfProperties, getCloudflareProperties, hasCfProperty, isEventType };
@@ -1,5 +1,5 @@
1
1
  import type { Database } from 'db0';
2
- import { type DatabaseConnectionConfig } from './database-span-data.js';
2
+ import { type DatabaseConnectionConfig } from './database-span-data';
3
3
  /**
4
4
  * Creates the Nitro database plugin setup by instrumenting the configured database instances.
5
5
  *
@@ -1,17 +1,9 @@
1
- import {
2
- addBreadcrumb,
3
- captureException,
4
- debug,
5
- flushIfServerless,
6
- SEMANTIC_ATTRIBUTE_SENTRY_OP,
7
- SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
8
- SPAN_STATUS_ERROR,
9
- startSpan
10
- } from "@sentry/core";
11
- import { getDatabaseSpanData } from "./database-span-data.js";
1
+ import { debug, startSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, captureException, flushIfServerless, addBreadcrumb } from '@sentry/core';
2
+ import { getDatabaseSpanData } from './database-span-data.js';
3
+
12
4
  const patchedStatement = /* @__PURE__ */ new WeakSet();
13
5
  const SENTRY_ORIGIN = "auto.db.nuxt";
14
- export function createDatabasePlugin(useDatabase, databaseConfig) {
6
+ function createDatabasePlugin(useDatabase, databaseConfig) {
15
7
  try {
16
8
  const databaseInstances = Object.keys(databaseConfig);
17
9
  debug.log("[Nitro Database Plugin]: Instrumenting databases...");
@@ -145,3 +137,5 @@ function createStartSpanOptions(query, data) {
145
137
  }
146
138
  };
147
139
  }
140
+
141
+ export { createDatabasePlugin };
@@ -1,17 +1,7 @@
1
- import {
2
- captureException,
3
- debug,
4
- flushIfServerless,
5
- SEMANTIC_ATTRIBUTE_CACHE_HIT,
6
- SEMANTIC_ATTRIBUTE_CACHE_KEY,
7
- SEMANTIC_ATTRIBUTE_SENTRY_OP,
8
- SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
9
- SPAN_STATUS_ERROR,
10
- SPAN_STATUS_OK,
11
- startSpan
12
- } from "@sentry/core";
1
+ import { debug, startSpan, SPAN_STATUS_OK, SEMANTIC_ATTRIBUTE_CACHE_HIT, SPAN_STATUS_ERROR, captureException, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, flushIfServerless, SEMANTIC_ATTRIBUTE_CACHE_KEY, SEMANTIC_ATTRIBUTE_SENTRY_OP, isObjectLike } from '@sentry/core';
2
+
13
3
  const CACHE_HIT_METHODS = /* @__PURE__ */ new Set(["hasItem", "getItem", "getItemRaw"]);
14
- export async function createStoragePlugin(useStorage, userStorageMounts) {
4
+ async function createStoragePlugin(useStorage, userStorageMounts) {
15
5
  const storage = useStorage();
16
6
  const userMounts = new Set(userStorageMounts.map((m) => `${m}:`));
17
7
  debug.log("[storage] Starting to instrument storage drivers...");
@@ -99,9 +89,6 @@ function wrapStorageMount(storage) {
99
89
  function normalizeMethodName(methodName) {
100
90
  return methodName.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
101
91
  }
102
- function isEmptyValue(value) {
103
- return value === null || value === void 0;
104
- }
105
92
  function createSpanStartOptions(methodName, driver, mountBase, args) {
106
93
  const keys = getCacheKeys(args?.[0], mountBase);
107
94
  const attributes = {
@@ -127,15 +114,15 @@ function normalizeKey(key, prefix) {
127
114
  if (typeof key === "string") {
128
115
  return `${prefix}${key}`;
129
116
  }
130
- if (typeof key === "object" && key !== null && "key" in key) {
117
+ if (isObjectLike(key) && "key" in key) {
131
118
  return `${prefix}${key.key}`;
132
119
  }
133
- return `${prefix}${isEmptyValue(key) ? "" : String(key)}`;
120
+ return `${prefix}${key == null ? "" : String(key)}`;
134
121
  }
135
122
  const CACHED_FN_HANDLERS_RE = /^nitro:(functions|handlers):/i;
136
123
  function isCacheHit(key, value) {
137
124
  try {
138
- const isEmpty = isEmptyValue(value);
125
+ const isEmpty = value == null;
139
126
  if (isEmpty || typeof key !== "string" || !CACHED_FN_HANDLERS_RE.test(key)) {
140
127
  return !isEmpty;
141
128
  }
@@ -145,13 +132,13 @@ function isCacheHit(key, value) {
145
132
  }
146
133
  }
147
134
  function validateCacheEntry(key, entry) {
148
- if (isEmptyValue(entry.value)) {
135
+ if (entry.value == null) {
149
136
  return false;
150
137
  }
151
138
  if (Date.now() > (entry.expires || 0)) {
152
139
  return false;
153
140
  }
154
- if (isResponseCacheEntry(key, entry)) {
141
+ if (isResponseCacheEntry(key)) {
155
142
  if ((entry.value.status ?? 0) >= 400) {
156
143
  return false;
157
144
  }
@@ -167,3 +154,5 @@ function validateCacheEntry(key, entry) {
167
154
  function isResponseCacheEntry(key, _) {
168
155
  return key.startsWith("nitro:handlers:");
169
156
  }
157
+
158
+ export { createStoragePlugin };
@@ -1,11 +1,6 @@
1
- import {
2
- debug,
3
- flushIfServerless,
4
- getDefaultIsolationScope,
5
- getIsolationScope,
6
- withIsolationScope
7
- } from "@sentry/core";
8
- export function patchEventHandler(handler) {
1
+ import { getIsolationScope, getDefaultIsolationScope, debug, withIsolationScope, flushIfServerless } from '@sentry/core';
2
+
3
+ function patchEventHandler(handler) {
9
4
  return new Proxy(handler, {
10
5
  async apply(handlerTarget, handlerThisArg, handlerArgs) {
11
6
  const isolationScope = getIsolationScope();
@@ -23,3 +18,5 @@ export function patchEventHandler(handler) {
23
18
  }
24
19
  });
25
20
  }
21
+
22
+ export { patchEventHandler };
@@ -1,6 +1,7 @@
1
- import { debug } from "@sentry/core";
1
+ import { debug } from '@sentry/core';
2
+
2
3
  const extractionResultCache = /* @__PURE__ */ new Map();
3
- export function extractParametrizedRouteFromContext(ssrContextModules, requestedUrl, buildTimePagesData = []) {
4
+ function extractParametrizedRouteFromContext(ssrContextModules, requestedUrl, buildTimePagesData = []) {
4
5
  if (!ssrContextModules || !requestedUrl) {
5
6
  return null;
6
7
  }
@@ -35,3 +36,5 @@ export function extractParametrizedRouteFromContext(ssrContextModules, requested
35
36
  extractionResultCache.set(cacheKey, null);
36
37
  return null;
37
38
  }
39
+
40
+ export { extractParametrizedRouteFromContext };
@@ -1,5 +1,6 @@
1
- import { captureException, debug, getClient, getTraceMetaTags } from "@sentry/core";
2
- export function extractErrorContext(errorContext) {
1
+ import { getClient, captureException, getTraceMetaTags, debug } from '@sentry/core';
2
+
3
+ function extractErrorContext(errorContext) {
3
4
  const ctx = {};
4
5
  if (!errorContext) {
5
6
  return ctx;
@@ -13,7 +14,7 @@ export function extractErrorContext(errorContext) {
13
14
  }
14
15
  return ctx;
15
16
  }
16
- export function addSentryTracingMetaTags(head, traceData) {
17
+ function addSentryTracingMetaTags(head, traceData) {
17
18
  const metaTags = getTraceMetaTags(traceData);
18
19
  if (head.some((tag) => tag.includes("meta") && tag.includes("sentry-trace"))) {
19
20
  debug.warn(
@@ -26,7 +27,7 @@ export function addSentryTracingMetaTags(head, traceData) {
26
27
  head.push(metaTags);
27
28
  }
28
29
  }
29
- export function reportNuxtError(options) {
30
+ function reportNuxtError(options) {
30
31
  const { error, instance, info } = options;
31
32
  const metadata = {
32
33
  info
@@ -46,3 +47,5 @@ export function reportNuxtError(options) {
46
47
  });
47
48
  });
48
49
  }
50
+
51
+ export { addSentryTracingMetaTags, extractErrorContext, reportNuxtError };
@@ -0,0 +1,7 @@
1
+ import type { NuxtTemplate } from '@nuxt/schema';
2
+ /**
3
+ * Adds a virtual file that can be used within the Nuxt Nitro server build.
4
+ * Available in NuxtKit v4, so we are porting it here.
5
+ * https://github.com/nuxt/nuxt/blob/d6df732eec1a3bd442bdb325b0335beb7e10cd64/packages/kit/src/template.ts#L55-L62
6
+ */
7
+ export declare function addServerTemplate(template: NuxtTemplate): NuxtTemplate;
@@ -0,0 +1,22 @@
1
+ import type { Nitro } from 'nitropack';
2
+ import type { SentryNuxtModuleOptions } from '../common/types';
3
+ /**
4
+ * 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.
5
+ *
6
+ * By adding a Rollup plugin to the Nitro Rollup options, the Sentry server config is transpiled and emitted to the server build.
7
+ */
8
+ export declare function addServerConfigToBuild(moduleOptions: SentryNuxtModuleOptions, nitro: Nitro, serverConfigFile: string): void;
9
+ /**
10
+ * Adds the Sentry server config import at the top of the server entry file to load the SDK on the server.
11
+ * This is necessary for environments where modifying the node option `--import` is not possible.
12
+ * However, only limited tracing instrumentation is supported when doing this.
13
+ */
14
+ export declare function addSentryTopImport(moduleOptions: SentryNuxtModuleOptions, nitro: Nitro): void;
15
+ /**
16
+ * This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)
17
+ * and adds the Sentry server config with the static `import` declaration.
18
+ *
19
+ * With this, the Sentry server config can be loaded before all other modules of the application (which is needed for import-in-the-middle).
20
+ * See: https://nodejs.org/api/module.html#enabling
21
+ */
22
+ export declare function addDynamicImportEntryFileWrapper(nitro: Nitro, serverConfigFile: string, moduleOptions: Omit<SentryNuxtModuleOptions, 'experimental_entrypointWrappedFunctions'> & Required<Pick<SentryNuxtModuleOptions, 'experimental_entrypointWrappedFunctions'>>): void;
@@ -0,0 +1,6 @@
1
+ import type { NitroConfig } from 'nitropack/types';
2
+ import type { SentryNuxtModuleOptions } from '../common/types';
3
+ /**
4
+ * Sets up the database instrumentation.
5
+ */
6
+ export declare function addDatabaseInstrumentation(nitro: NitroConfig, isLegacyNitro: boolean, moduleOptions?: SentryNuxtModuleOptions): void;
@@ -0,0 +1,11 @@
1
+ import type { Nitro } from 'nitropack/types';
2
+ /**
3
+ * Adds a server import for the middleware instrumentation.
4
+ */
5
+ export declare function addMiddlewareImports(): void;
6
+ /**
7
+ * Adds middleware instrumentation to the Nitro build.
8
+ *
9
+ * @param nitro Nitro instance
10
+ */
11
+ export declare function addMiddlewareInstrumentation(nitro: Nitro): void;
@@ -0,0 +1,11 @@
1
+ import type { Nuxt } from '@nuxt/schema';
2
+ import type { Plugin } from 'vite';
3
+ import type { SentryNuxtModuleOptions } from '../common/types';
4
+ /**
5
+ * Creates a Vite plugin that adds the Sentry Vite plugin and validates source map settings.
6
+ */
7
+ export declare function validateSourceMapsOptionsPlugin(options: {
8
+ nuxt: Nuxt;
9
+ moduleOptions: SentryNuxtModuleOptions;
10
+ sourceMapsEnabled: boolean;
11
+ }): Plugin;
@@ -0,0 +1,66 @@
1
+ import type { Nuxt } from '@nuxt/schema';
2
+ import { type SentryRollupPluginOptions } from '@sentry/rollup-plugin';
3
+ import { type SentryVitePluginOptions } from '@sentry/vite-plugin';
4
+ import type { NitroConfig } from 'nitropack';
5
+ import type { Plugin } from 'vite';
6
+ import type { SentryNuxtModuleOptions } from '../common/types';
7
+ /**
8
+ * Whether the user enabled (true, 'hidden', 'inline') or disabled (false) source maps
9
+ */
10
+ export type UserSourceMapSetting = 'enabled' | 'disabled' | 'unset' | undefined;
11
+ /** A valid source map setting */
12
+ export type SourceMapSetting = boolean | 'hidden' | 'inline';
13
+ /**
14
+ * Setup source maps for Sentry inside the Nuxt module during build time (in Vite for Nuxt and Rollup for Nitro).
15
+ */
16
+ export declare function setupSourceMaps(moduleOptions: SentryNuxtModuleOptions, nuxt: Nuxt, addVitePlugin: (plugin: Plugin[], options?: {
17
+ dev?: boolean;
18
+ build?: boolean;
19
+ }) => void): void;
20
+ /**
21
+ * Generates source maps upload options for the Sentry Vite and Rollup plugin.
22
+ *
23
+ * Only exported for Testing purposes.
24
+ */
25
+ export declare function getPluginOptions(moduleOptions: SentryNuxtModuleOptions, shouldDeleteFilesFallback?: {
26
+ client: boolean;
27
+ server: boolean;
28
+ }): SentryVitePluginOptions | SentryRollupPluginOptions;
29
+ /** only exported for tests */
30
+ export declare function extractNuxtSourceMapSetting(nuxt: {
31
+ options: {
32
+ sourcemap?: SourceMapSetting | {
33
+ server?: SourceMapSetting;
34
+ client?: SourceMapSetting;
35
+ };
36
+ };
37
+ }, runtime: 'client' | 'server' | undefined): SourceMapSetting | undefined;
38
+ /** only exported for testing */
39
+ export declare function changeNuxtSourceMapSettings(nuxt: Nuxt, sentryModuleOptions: SentryNuxtModuleOptions): {
40
+ client: UserSourceMapSetting;
41
+ server: UserSourceMapSetting;
42
+ };
43
+ /** Logs warnings about potentially conflicting source map settings.
44
+ * Configures `sourcemapExcludeSources` in Nitro to make source maps usable in Sentry.
45
+ *
46
+ * only exported for testing
47
+ */
48
+ export declare function validateNitroSourceMapSettings(nuxt: {
49
+ options: {
50
+ sourcemap?: SourceMapSetting | {
51
+ server?: SourceMapSetting;
52
+ };
53
+ };
54
+ }, nitroConfig: NitroConfig, sentryModuleOptions: SentryNuxtModuleOptions): void;
55
+ /**
56
+ * Validates that source map settings are consistent between Nuxt and Vite/Nitro configurations.
57
+ * Logs a warning if conflicting settings are detected.
58
+ *
59
+ * @internal Only exported for testing.
60
+ */
61
+ export declare function validateDifferentSourceMapSettings({ nuxtSettingKey, nuxtSettingValue, otherSettingKey, otherSettingValue, }: {
62
+ nuxtSettingKey: string;
63
+ nuxtSettingValue?: SourceMapSetting;
64
+ otherSettingKey: string;
65
+ otherSettingValue?: SourceMapSetting;
66
+ }): void;
@@ -0,0 +1,5 @@
1
+ import type { Nuxt } from '@nuxt/schema';
2
+ /**
3
+ * Prepares the storage config export to be used in the runtime storage instrumentation.
4
+ */
5
+ export declare function addStorageInstrumentation(nuxt: Nuxt, isLegacyNitro: boolean): void;
@@ -0,0 +1,58 @@
1
+ import type { Nuxt } from '@nuxt/schema';
2
+ import type { SentryNuxtModuleOptions } from '../common/types';
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.
6
+ */
7
+ export declare function getNitroMajorVersion(): Promise<number>;
8
+ /**
9
+ * Find the default SDK init file for the given type (client or server).
10
+ * The sentry.server.config file is prioritized over the instrument.server file.
11
+ */
12
+ export declare function findDefaultSdkInitFile(type: 'server' | 'client', nuxt?: Nuxt, options?: SentryNuxtModuleOptions): Promise<string | undefined>;
13
+ /**
14
+ * Extracts the filename from a node command with a path.
15
+ */
16
+ export declare function getFilenameFromNodeStartCommand(nodeCommand: string): string | null;
17
+ export declare const SENTRY_WRAPPED_ENTRY = "?sentry-query-wrapped-entry";
18
+ export declare const SENTRY_WRAPPED_FUNCTIONS = "?sentry-query-wrapped-functions=";
19
+ export declare const SENTRY_REEXPORTED_FUNCTIONS = "?sentry-query-reexported-functions=";
20
+ export declare const QUERY_END_INDICATOR = "SENTRY-QUERY-END";
21
+ /**
22
+ * Strips the Sentry query part from a path.
23
+ * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path
24
+ *
25
+ * Only exported for testing.
26
+ */
27
+ export declare function removeSentryQueryFromPath(url: string): string;
28
+ /**
29
+ * Extracts and sanitizes function re-export and function wrap query parameters from a query string.
30
+ * If it is a default export, it is not considered for re-exporting.
31
+ *
32
+ * Only exported for testing.
33
+ */
34
+ export declare function extractFunctionReexportQueryParameters(query: string): {
35
+ wrap: string[];
36
+ reexport: string[];
37
+ };
38
+ /**
39
+ * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.
40
+ * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped
41
+ * (e.g. serverless handlers) are wrapped by Sentry.
42
+ */
43
+ export declare function constructWrappedFunctionExportQuery(exportedBindings: Record<string, string[]> | null, entrypointWrappedFunctions: string[], debug?: boolean): string;
44
+ /**
45
+ * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)
46
+ */
47
+ export declare function constructFunctionReExport(pathWithQuery: string, entryId: string): string;
48
+ /**
49
+ * Sets up alias to work around OpenTelemetry's incomplete ESM imports.
50
+ * https://github.com/getsentry/sentry-javascript/issues/15204
51
+ *
52
+ * OpenTelemetry's @opentelemetry/resources package has incomplete imports missing
53
+ * the .js file extensions (like execAsync for machine-id detection). This causes module resolution
54
+ * errors in certain Nuxt configurations, particularly when local Nuxt modules in Nuxt 4 are present.
55
+ *
56
+ * @see https://nuxt.com/docs/guide/concepts/esm#aliasing-libraries
57
+ */
58
+ export declare function addOTelCommonJSImportAlias(nuxt: Nuxt, isNitroV3?: boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentStorage.d.ts","sourceRoot":"","sources":["../../../../src/runtime/utils/instrumentStorage.ts"],"names":[],"mappings":"AAwDA;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B/G"}
1
+ {"version":3,"file":"instrumentStorage.d.ts","sourceRoot":"","sources":["../../../../src/runtime/utils/instrumentStorage.ts"],"names":[],"mappings":"AAyDA;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B/G"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/nuxt",
3
- "version": "10.64.0",
3
+ "version": "10.66.0",
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",
@@ -33,8 +33,7 @@
33
33
  },
34
34
  "./module": {
35
35
  "types": "./build/module/types.d.ts",
36
- "import": "./build/module/module.mjs",
37
- "require": "./build/module/module.cjs"
36
+ "import": "./build/module/module.mjs"
38
37
  },
39
38
  "./module/plugins": {
40
39
  "types": "./build/module/runtime/plugins/index.d.ts",
@@ -55,18 +54,17 @@
55
54
  },
56
55
  "dependencies": {
57
56
  "@nuxt/kit": "^3.13.2",
58
- "@sentry/browser": "10.64.0",
59
- "@sentry/cloudflare": "10.64.0",
60
- "@sentry/core": "10.64.0",
61
- "@sentry/node": "10.64.0",
62
- "@sentry/node-core": "10.64.0",
57
+ "@sentry/browser": "10.66.0",
58
+ "@sentry/cloudflare": "10.66.0",
59
+ "@sentry/core": "10.66.0",
60
+ "@sentry/node": "10.66.0",
61
+ "@sentry/node-core": "10.66.0",
63
62
  "@sentry/rollup-plugin": "^5.3.0",
64
63
  "@sentry/vite-plugin": "^5.3.0",
65
- "@sentry/vue": "10.64.0",
64
+ "@sentry/vue": "10.66.0",
66
65
  "local-pkg": "^1.1.2"
67
66
  },
68
67
  "devDependencies": {
69
- "@nuxt/module-builder": "^0.8.4",
70
68
  "@nuxt/nitro-server": "^3.21.6",
71
69
  "nitro": "^3.0.260311-beta",
72
70
  "nuxi": "^3.25.1",
@@ -76,7 +74,7 @@
76
74
  "scripts": {
77
75
  "build": "run-s build:types build:transpile",
78
76
  "build:dev": "yarn build",
79
- "build:nuxt-module": "bash ./generate-build-stubs.bash && nuxt-module-build build --outDir build/module",
77
+ "build:nuxt-module": "rollup -c rollup.module.config.mjs && tsc -p tsconfig.module.json && node scripts/build-module-meta.mjs",
80
78
  "build:transpile": "rollup -c rollup.npm.config.mjs && yarn build:nuxt-module",
81
79
  "build:types": "tsc -p tsconfig.types.json",
82
80
  "build:watch": "run-p build:transpile:watch",
@@ -87,7 +85,7 @@
87
85
  "clean": "rimraf build coverage sentry-nuxt-*.tgz",
88
86
  "lint:fix": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --fix --type-aware",
89
87
  "lint": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --type-aware",
90
- "lint:es-compatibility": "es-check es2020 ./build/cjs/*.js && es-check es2020 ./build/esm/*.js --module && es-check es2020 ./build/module/*.cjs && es-check es2020 ./build/module/*.mjs --module",
88
+ "lint:es-compatibility": "es-check es2020 ./build/cjs/*.js && es-check es2020 ./build/esm/*.js --module && es-check es2020 ./build/module/*.mjs --module",
91
89
  "test": "yarn test:unit",
92
90
  "test:unit": "vitest run",
93
91
  "test:watch": "vitest --watch",
@@ -1,5 +0,0 @@
1
- module.exports = function(...args) {
2
- return import('./module.mjs').then(m => m.default.call(this, ...args))
3
- }
4
- const _meta = module.exports.meta = require('./module.json')
5
- module.exports.getMeta = () => Promise.resolve(_meta)
@@ -1 +0,0 @@
1
- export { type ModuleOptions, default } from './module.js'