@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.
- package/build/cjs/client/piniaIntegration.js +7 -19
- package/build/cjs/client/piniaIntegration.js.map +1 -1
- package/build/cjs/client/sdk.js +2 -9
- package/build/cjs/client/sdk.js.map +1 -1
- package/build/cjs/client/vueIntegration.js +3 -10
- package/build/cjs/client/vueIntegration.js.map +1 -1
- package/build/cjs/common/debug-build.js +0 -5
- package/build/cjs/common/debug-build.js.map +1 -1
- package/build/cjs/module.js +52 -107
- package/build/cjs/module.js.map +1 -1
- package/build/cjs/server/sdk.js +20 -60
- package/build/cjs/server/sdk.js.map +1 -1
- package/build/cjs/vendor/server-template.js +0 -6
- package/build/cjs/vendor/server-template.js.map +1 -1
- package/build/cjs/vite/addServerConfig.js +45 -144
- package/build/cjs/vite/addServerConfig.js.map +1 -1
- package/build/cjs/vite/databaseConfig.js +10 -32
- package/build/cjs/vite/databaseConfig.js.map +1 -1
- package/build/cjs/vite/middlewareConfig.js +11 -46
- package/build/cjs/vite/middlewareConfig.js.map +1 -1
- package/build/cjs/vite/sentryVitePlugin.js +7 -24
- package/build/cjs/vite/sentryVitePlugin.js.map +1 -1
- package/build/cjs/vite/sourceMaps.js +89 -248
- package/build/cjs/vite/sourceMaps.js.map +1 -1
- package/build/cjs/vite/storageConfig.js +4 -10
- package/build/cjs/vite/storageConfig.js.map +1 -1
- package/build/cjs/vite/utils.js +51 -143
- package/build/cjs/vite/utils.js.map +1 -1
- package/build/esm/client/piniaIntegration.js +7 -19
- package/build/esm/client/piniaIntegration.js.map +1 -1
- package/build/esm/client/sdk.js +2 -9
- package/build/esm/client/sdk.js.map +1 -1
- package/build/esm/client/vueIntegration.js +3 -10
- package/build/esm/client/vueIntegration.js.map +1 -1
- package/build/esm/common/debug-build.js +0 -5
- package/build/esm/common/debug-build.js.map +1 -1
- package/build/esm/module.js +52 -107
- package/build/esm/module.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/server/sdk.js +20 -60
- package/build/esm/server/sdk.js.map +1 -1
- package/build/esm/vendor/server-template.js +0 -6
- package/build/esm/vendor/server-template.js.map +1 -1
- package/build/esm/vite/addServerConfig.js +45 -144
- package/build/esm/vite/addServerConfig.js.map +1 -1
- package/build/esm/vite/databaseConfig.js +10 -32
- package/build/esm/vite/databaseConfig.js.map +1 -1
- package/build/esm/vite/middlewareConfig.js +11 -46
- package/build/esm/vite/middlewareConfig.js.map +1 -1
- package/build/esm/vite/sentryVitePlugin.js +7 -24
- package/build/esm/vite/sentryVitePlugin.js.map +1 -1
- package/build/esm/vite/sourceMaps.js +89 -248
- package/build/esm/vite/sourceMaps.js.map +1 -1
- package/build/esm/vite/storageConfig.js +4 -10
- package/build/esm/vite/storageConfig.js.map +1 -1
- package/build/esm/vite/utils.js +51 -143
- package/build/esm/vite/utils.js.map +1 -1
- package/build/module/module.d.mts +17 -0
- package/build/module/module.d.ts +17 -0
- package/build/module/module.json +1 -1
- package/build/module/module.mjs +6 -6
- package/build/types/common/types.d.ts +17 -0
- package/build/types/common/types.d.ts.map +1 -1
- package/build/types/vite/utils.d.ts +2 -1
- package/build/types/vite/utils.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -3,36 +3,24 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3
3
|
const core = require('@sentry/core');
|
|
4
4
|
const vue = require('@sentry/vue');
|
|
5
5
|
|
|
6
|
-
const INTEGRATION_NAME =
|
|
7
|
-
|
|
8
|
-
const _piniaIntegration = ((
|
|
9
|
-
// `unknown` here as well because usePinia declares this type: `export declare const usePinia: () => unknown;`
|
|
10
|
-
pinia,
|
|
11
|
-
options = {},
|
|
12
|
-
) => {
|
|
6
|
+
const INTEGRATION_NAME = "Pinia";
|
|
7
|
+
const _piniaIntegration = ((pinia, options = {}) => {
|
|
13
8
|
return {
|
|
14
9
|
name: INTEGRATION_NAME,
|
|
15
10
|
setup() {
|
|
16
|
-
if (!pinia ||
|
|
11
|
+
if (!pinia || typeof pinia === "object" && !("use" in pinia)) {
|
|
17
12
|
core.consoleSandbox(() => {
|
|
18
|
-
// eslint-disable-next-line no-console
|
|
19
13
|
console.warn(
|
|
20
14
|
'[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`:',
|
|
21
|
-
pinia
|
|
15
|
+
pinia
|
|
22
16
|
);
|
|
23
17
|
});
|
|
24
18
|
} else {
|
|
25
|
-
|
|
19
|
+
pinia.use(vue.createSentryPiniaPlugin(options));
|
|
26
20
|
}
|
|
27
|
-
}
|
|
21
|
+
}
|
|
28
22
|
};
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Monitor an existing Pinia store.
|
|
33
|
-
*
|
|
34
|
-
* This only works if "@pinia/nuxt" is added to the `modules` array.
|
|
35
|
-
*/
|
|
23
|
+
});
|
|
36
24
|
const piniaIntegration = core.defineIntegration(_piniaIntegration);
|
|
37
25
|
|
|
38
26
|
exports.piniaIntegration = 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":["consoleSandbox","createSentryPiniaPlugin","defineIntegration"],"mappings":";;;;;AAIA,MAAM,gBAAA,GAAmB,
|
|
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":["consoleSandbox","createSentryPiniaPlugin","defineIntegration"],"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,QAAAA,mBAAA,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,CAAIC,2BAAA,CAAwB,OAAO,CAAC,CAAA;AAAA,MACvD;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAOO,MAAM,gBAAA,GAAmBC,uBAAkB,iBAAiB;;;;"}
|
package/build/cjs/client/sdk.js
CHANGED
|
@@ -3,22 +3,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3
3
|
const browser = require('@sentry/browser');
|
|
4
4
|
const core = require('@sentry/core');
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Initializes the client-side of the Nuxt SDK
|
|
8
|
-
*
|
|
9
|
-
* @param options Configuration options for the SDK.
|
|
10
|
-
*/
|
|
11
6
|
function init(options) {
|
|
12
7
|
const envFallback = undefined ? core.DEV_ENVIRONMENT : core.DEFAULT_ENVIRONMENT;
|
|
13
8
|
const sentryOptions = {
|
|
14
9
|
/* BrowserTracing is added later with the Nuxt client plugin */
|
|
15
10
|
defaultIntegrations: [...browser.getDefaultIntegrations(options)],
|
|
16
11
|
environment: options.environment ?? process.env.SENTRY_ENVIRONMENT ?? envFallback,
|
|
17
|
-
...options
|
|
12
|
+
...options
|
|
18
13
|
};
|
|
19
|
-
|
|
20
|
-
core.applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'vue']);
|
|
21
|
-
|
|
14
|
+
core.applySdkMetadata(sentryOptions, "nuxt", ["nuxt", "vue"]);
|
|
22
15
|
return browser.init(sentryOptions);
|
|
23
16
|
}
|
|
24
17
|
|
|
@@ -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":["DEV_ENVIRONMENT","DEFAULT_ENVIRONMENT","getBrowserDefaultIntegrations","applySdkMetadata","initBrowser"],"mappings":";;;;;
|
|
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":["DEV_ENVIRONMENT","DEFAULT_ENVIRONMENT","getBrowserDefaultIntegrations","applySdkMetadata","initBrowser"],"mappings":";;;;;AAUO,SAAS,KAAK,OAAA,EAAsD;AACzE,EAAA,MAAM,WAAA,GAAc,SAAY,GAAMA,oBAAA,GAAkBC,wBAAA;AACxD,EAAA,MAAM,aAAA,GAAgB;AAAA;AAAA,IAEpB,mBAAA,EAAqB,CAAC,GAAGC,8BAAA,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,EAAAC,qBAAA,CAAiB,aAAA,EAAe,MAAA,EAAQ,CAAC,MAAA,EAAQ,KAAK,CAAC,CAAA;AAEvD,EAAA,OAAOC,aAAY,aAAa,CAAA;AAClC;;;;"}
|
|
@@ -2,20 +2,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
|
|
3
3
|
const core = require('@sentry/core');
|
|
4
4
|
|
|
5
|
-
// 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.
|
|
6
|
-
// However, we need to export the vueIntegration from the Client SDK. This means all this integration does is store away
|
|
7
|
-
// its options for the Sentry Client Module to pick them up when initializing the actual vueIntegration.
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Add additional error and span instrumentation specialized for Vue.
|
|
11
|
-
*/
|
|
12
5
|
const vueIntegration = core.defineIntegration((options = {}) => {
|
|
13
6
|
return {
|
|
14
7
|
// NOTE: This name is different from the original vueIntegration's name.
|
|
15
|
-
name:
|
|
8
|
+
name: "NuxtVueIntegration",
|
|
16
9
|
setup() {
|
|
17
|
-
|
|
18
|
-
}
|
|
10
|
+
core.GLOBAL_OBJ._sentryNuxtVueIntegrationOptions = options;
|
|
11
|
+
}
|
|
19
12
|
};
|
|
20
13
|
});
|
|
21
14
|
|
|
@@ -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":["defineIntegration","GLOBAL_OBJ"],"mappings":";;;;
|
|
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":["defineIntegration","GLOBAL_OBJ"],"mappings":";;;;AAiBO,MAAM,cAAA,GAAiBA,sBAAA,CAAkB,CAAC,OAAA,GAAmB,EAAC,KAAM;AACzE,EAAA,OAAO;AAAA;AAAA,IAEL,IAAA,EAAM,oBAAA;AAAA,IACN,KAAA,GAAQ;AACN,MAACC,gBAA+C,gCAAA,GAAmC,OAAA;AAAA,IACrF;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* 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.
|
|
5
|
-
*
|
|
6
|
-
* ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
|
|
7
|
-
*/
|
|
8
3
|
const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
|
|
9
4
|
|
|
10
5
|
exports.DEBUG_BUILD = 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":";;
|
|
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;;;;"}
|
package/build/cjs/module.js
CHANGED
|
@@ -11,40 +11,34 @@ const utils = require('./vite/utils.js');
|
|
|
11
11
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
12
12
|
const module$1 = kit.defineNuxtModule({
|
|
13
13
|
meta: {
|
|
14
|
-
name:
|
|
15
|
-
configKey:
|
|
14
|
+
name: "@sentry/nuxt/module",
|
|
15
|
+
configKey: "sentry",
|
|
16
16
|
compatibility: {
|
|
17
|
-
nuxt:
|
|
18
|
-
}
|
|
17
|
+
nuxt: ">=3.7.0"
|
|
18
|
+
}
|
|
19
19
|
},
|
|
20
20
|
defaults: {},
|
|
21
21
|
async setup(moduleOptionsParam, nuxt) {
|
|
22
22
|
if (moduleOptionsParam?.enabled === false) {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
const moduleOptions = {
|
|
27
26
|
...moduleOptionsParam,
|
|
28
27
|
autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,
|
|
29
28
|
experimental_entrypointWrappedFunctions: moduleOptionsParam.experimental_entrypointWrappedFunctions || [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
]
|
|
29
|
+
"default",
|
|
30
|
+
"handler",
|
|
31
|
+
"server"
|
|
32
|
+
]
|
|
34
33
|
};
|
|
35
|
-
|
|
36
34
|
const moduleDirResolver = kit.createResolver((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('module.js', document.baseURI).href)));
|
|
37
35
|
const buildDirResolver = kit.createResolver(nuxt.options.buildDir);
|
|
38
|
-
|
|
39
|
-
const clientConfigFile = utils.findDefaultSdkInitFile('client', nuxt);
|
|
40
|
-
|
|
36
|
+
const clientConfigFile = await utils.findDefaultSdkInitFile("client", nuxt, moduleOptions);
|
|
41
37
|
if (clientConfigFile) {
|
|
42
|
-
// Inject the client-side Sentry config file with a side effect import
|
|
43
38
|
kit.addPluginTemplate({
|
|
44
|
-
mode:
|
|
45
|
-
filename:
|
|
39
|
+
mode: "client",
|
|
40
|
+
filename: "sentry-client-config.mjs",
|
|
46
41
|
order: 0,
|
|
47
|
-
|
|
48
42
|
// Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)
|
|
49
43
|
// Makes it possible to call useRuntimeConfig() in the user-defined sentry config file
|
|
50
44
|
getContents: () => `
|
|
@@ -55,91 +49,64 @@ const module$1 = kit.defineNuxtModule({
|
|
|
55
49
|
async setup() {
|
|
56
50
|
await import("${buildDirResolver.resolve(`/${clientConfigFile}`)}")
|
|
57
51
|
}
|
|
58
|
-
})
|
|
52
|
+
});`
|
|
59
53
|
});
|
|
60
|
-
|
|
61
|
-
// Add the plugin which loads client integrations etc. -
|
|
62
|
-
// this must run after the sentry-client-config plugin has run, and the client is initialized!
|
|
63
54
|
kit.addPlugin({
|
|
64
|
-
src: moduleDirResolver.resolve(
|
|
65
|
-
mode:
|
|
66
|
-
order: 1
|
|
55
|
+
src: moduleDirResolver.resolve("./runtime/plugins/sentry.client"),
|
|
56
|
+
mode: "client",
|
|
57
|
+
order: 1
|
|
67
58
|
});
|
|
68
59
|
}
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const nuxtMajor = parseInt((nuxt )._version?.split('.')[0] ?? '3', 10);
|
|
60
|
+
const serverConfigFile = await utils.findDefaultSdkInitFile("server", nuxt, moduleOptions);
|
|
61
|
+
const isNitroV3 = await utils.getNitroMajorVersion() >= 3;
|
|
62
|
+
const nuxtMajor = parseInt(nuxt._version?.split(".")[0] ?? "3", 10);
|
|
73
63
|
const isMinNuxtV4 = nuxtMajor >= 4;
|
|
74
|
-
|
|
75
64
|
if (serverConfigFile) {
|
|
76
65
|
if (isNitroV3) {
|
|
77
|
-
kit.addServerPlugin(moduleDirResolver.resolve(
|
|
78
|
-
kit.addServerPlugin(moduleDirResolver.resolve(
|
|
66
|
+
kit.addServerPlugin(moduleDirResolver.resolve("./runtime/plugins/handler.server"));
|
|
67
|
+
kit.addServerPlugin(moduleDirResolver.resolve("./runtime/plugins/update-route-name.server"));
|
|
79
68
|
} else {
|
|
80
|
-
kit.addServerPlugin(moduleDirResolver.resolve(
|
|
81
|
-
kit.addServerPlugin(moduleDirResolver.resolve(
|
|
69
|
+
kit.addServerPlugin(moduleDirResolver.resolve("./runtime/plugins/handler-legacy.server"));
|
|
70
|
+
kit.addServerPlugin(moduleDirResolver.resolve("./runtime/plugins/update-route-name-legacy.server"));
|
|
82
71
|
}
|
|
83
|
-
|
|
84
|
-
kit.addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));
|
|
85
|
-
|
|
72
|
+
kit.addServerPlugin(moduleDirResolver.resolve("./runtime/plugins/sentry.server"));
|
|
86
73
|
if (isMinNuxtV4) {
|
|
87
|
-
kit.addPlugin({ src: moduleDirResolver.resolve(
|
|
74
|
+
kit.addPlugin({ src: moduleDirResolver.resolve("./runtime/plugins/route-detector.server"), mode: "server" });
|
|
88
75
|
} else {
|
|
89
|
-
kit.addPlugin({ src: moduleDirResolver.resolve(
|
|
76
|
+
kit.addPlugin({ src: moduleDirResolver.resolve("./runtime/plugins/route-detector-legacy.server"), mode: "server" });
|
|
90
77
|
}
|
|
91
|
-
|
|
92
|
-
// Preps the middleware instrumentation module.
|
|
93
78
|
middlewareConfig.addMiddlewareImports();
|
|
94
79
|
storageConfig.addStorageInstrumentation(nuxt, !isNitroV3);
|
|
95
80
|
databaseConfig.addDatabaseInstrumentation(nuxt.options.nitro, !isNitroV3, moduleOptions);
|
|
96
81
|
}
|
|
97
|
-
|
|
98
82
|
if (clientConfigFile || serverConfigFile) {
|
|
99
83
|
sourceMaps.setupSourceMaps(moduleOptions, nuxt, kit.addVitePlugin);
|
|
100
84
|
}
|
|
101
|
-
|
|
102
85
|
utils.addOTelCommonJSImportAlias(nuxt, isNitroV3);
|
|
103
|
-
|
|
104
86
|
let pagesData = [];
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
.filter(page => {
|
|
110
|
-
// Check for dynamic parameter (e.g., :userId or [userId])
|
|
111
|
-
return page.path.includes(':') || page?.file?.includes('[');
|
|
112
|
-
});
|
|
87
|
+
nuxt.hooks.hook("pages:extend", (pages) => {
|
|
88
|
+
pagesData = pages.map((page) => ({ file: page.file, path: page.path })).filter((page) => {
|
|
89
|
+
return page.path.includes(":") || page?.file?.includes("[");
|
|
90
|
+
});
|
|
113
91
|
});
|
|
114
|
-
|
|
115
92
|
if (isMinNuxtV4) {
|
|
116
|
-
const pagesDataVirtualModuleId =
|
|
117
|
-
|
|
118
|
-
// Vite virtual plugin (for the Vite SSR build, where addPlugin mode:'server' plugins are bundled)
|
|
93
|
+
const pagesDataVirtualModuleId = "#sentry/nuxt-pages-data.mjs";
|
|
119
94
|
kit.addVitePlugin({
|
|
120
|
-
name:
|
|
121
|
-
resolveId: id =>
|
|
122
|
-
load: id =>
|
|
123
|
-
id === `\0${pagesDataVirtualModuleId}` ? `export default ${JSON.stringify(pagesData, null, 2)};` : undefined,
|
|
95
|
+
name: "sentry-nuxt-pages-data-virtual",
|
|
96
|
+
resolveId: (id) => id === pagesDataVirtualModuleId ? `\0${pagesDataVirtualModuleId}` : null,
|
|
97
|
+
load: (id) => id === `\0${pagesDataVirtualModuleId}` ? `export default ${JSON.stringify(pagesData, null, 2)};` : void 0
|
|
124
98
|
});
|
|
125
99
|
} else {
|
|
126
|
-
// Nuxt v3: register as a build template (accessible via #build/)
|
|
127
100
|
kit.addTemplate({
|
|
128
|
-
filename:
|
|
129
|
-
getContents: () => `export default ${JSON.stringify(pagesData, null, 2)}
|
|
101
|
+
filename: "sentry--nuxt-pages-data.mjs",
|
|
102
|
+
getContents: () => `export default ${JSON.stringify(pagesData, null, 2)};`
|
|
130
103
|
});
|
|
131
104
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
nuxt.hook('prepare:types', options => {
|
|
135
|
-
const tsConfig = options.tsConfig ;
|
|
136
|
-
|
|
105
|
+
nuxt.hook("prepare:types", (options) => {
|
|
106
|
+
const tsConfig = options.tsConfig;
|
|
137
107
|
if (!tsConfig.include) {
|
|
138
108
|
tsConfig.include = [];
|
|
139
109
|
}
|
|
140
|
-
|
|
141
|
-
// Add type references for useRuntimeConfig in root files for nuxt v4
|
|
142
|
-
// Should be relative to `root/.nuxt`
|
|
143
110
|
if (clientConfigFile) {
|
|
144
111
|
const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);
|
|
145
112
|
tsConfig.include.push(relativePath);
|
|
@@ -149,87 +116,65 @@ const module$1 = kit.defineNuxtModule({
|
|
|
149
116
|
tsConfig.include.push(relativePath);
|
|
150
117
|
}
|
|
151
118
|
});
|
|
152
|
-
|
|
153
|
-
nuxt.hooks.hook('nitro:init', nitro => {
|
|
119
|
+
nuxt.hooks.hook("nitro:init", (nitro) => {
|
|
154
120
|
if (nuxt.options?._prepare) {
|
|
155
121
|
return;
|
|
156
122
|
}
|
|
157
|
-
|
|
158
123
|
if (serverConfigFile) {
|
|
159
124
|
middlewareConfig.addMiddlewareInstrumentation(nitro);
|
|
160
125
|
}
|
|
161
|
-
|
|
162
|
-
if (serverConfigFile?.includes('.server.config')) {
|
|
126
|
+
if (serverConfigFile?.includes(".server.config")) {
|
|
163
127
|
core.consoleSandbox(() => {
|
|
164
128
|
const serverDir = nitro.options.output.serverDir;
|
|
165
|
-
|
|
166
|
-
// Netlify env: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata
|
|
167
|
-
if (serverDir.includes('.netlify') || !!process.env.NETLIFY) {
|
|
168
|
-
// eslint-disable-next-line no-console
|
|
129
|
+
if (serverDir.includes(".netlify") || !!process.env.NETLIFY) {
|
|
169
130
|
console.warn(
|
|
170
|
-
|
|
131
|
+
"[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/"
|
|
171
132
|
);
|
|
172
133
|
}
|
|
173
|
-
|
|
174
|
-
// Vercel env: https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL
|
|
175
|
-
if (serverDir.includes('.vercel') || !!process.env.VERCEL) {
|
|
176
|
-
// eslint-disable-next-line no-console
|
|
134
|
+
if (serverDir.includes(".vercel") || !!process.env.VERCEL) {
|
|
177
135
|
console.warn(
|
|
178
|
-
|
|
136
|
+
"[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/"
|
|
179
137
|
);
|
|
180
138
|
}
|
|
181
139
|
});
|
|
182
|
-
|
|
183
|
-
if (moduleOptions.autoInjectServerSentry !== 'experimental_dynamic-import') {
|
|
140
|
+
if (moduleOptions.autoInjectServerSentry !== "experimental_dynamic-import") {
|
|
184
141
|
addServerConfig.addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);
|
|
185
|
-
|
|
186
142
|
if (moduleOptions.debug) {
|
|
187
143
|
const serverDirResolver = kit.createResolver(nitro.options.output.serverDir);
|
|
188
|
-
const serverConfigPath = serverDirResolver.resolve(
|
|
189
|
-
|
|
190
|
-
// For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs
|
|
144
|
+
const serverConfigPath = serverDirResolver.resolve("sentry.server.config.mjs");
|
|
191
145
|
const serverConfigRelativePath = `.${path.sep}${path.relative(nitro.options.rootDir, serverConfigPath)}`;
|
|
192
|
-
|
|
193
146
|
core.consoleSandbox(() => {
|
|
194
|
-
// eslint-disable-next-line no-console
|
|
195
147
|
console.log(
|
|
196
|
-
`[Sentry] Using \`${serverConfigFile}\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install
|
|
148
|
+
`[Sentry] Using \`${serverConfigFile}\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/.`
|
|
197
149
|
);
|
|
198
|
-
|
|
199
150
|
if (nitro.options.dev) {
|
|
200
|
-
// eslint-disable-next-line no-console
|
|
201
151
|
console.log(
|
|
202
|
-
`[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \`NODE_OPTIONS='--import ${serverConfigRelativePath}' nuxt dev\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \`nuxt dev\` to regenerate it
|
|
152
|
+
`[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \`NODE_OPTIONS='--import ${serverConfigRelativePath}' nuxt dev\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \`nuxt dev\` to regenerate it.`
|
|
203
153
|
);
|
|
204
154
|
} else {
|
|
205
|
-
// eslint-disable-next-line no-console
|
|
206
155
|
console.log(
|
|
207
|
-
`[Sentry] When running your built application, preload Sentry via a command-line flag (\`node --import ${serverConfigRelativePath} [...]\`) or via an environment variable (\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\`)
|
|
156
|
+
`[Sentry] When running your built application, preload Sentry via a command-line flag (\`node --import ${serverConfigRelativePath} [...]\`) or via an environment variable (\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\`).`
|
|
208
157
|
);
|
|
209
158
|
}
|
|
210
159
|
});
|
|
211
160
|
}
|
|
212
161
|
}
|
|
213
|
-
|
|
214
|
-
if (moduleOptions.autoInjectServerSentry === 'top-level-import') {
|
|
162
|
+
if (moduleOptions.autoInjectServerSentry === "top-level-import") {
|
|
215
163
|
addServerConfig.addSentryTopImport(moduleOptions, nitro);
|
|
216
164
|
}
|
|
217
|
-
|
|
218
|
-
if (moduleOptions.autoInjectServerSentry === 'experimental_dynamic-import') {
|
|
165
|
+
if (moduleOptions.autoInjectServerSentry === "experimental_dynamic-import") {
|
|
219
166
|
addServerConfig.addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);
|
|
220
|
-
|
|
221
167
|
if (moduleOptions.debug) {
|
|
222
168
|
core.consoleSandbox(() => {
|
|
223
|
-
// eslint-disable-next-line no-console
|
|
224
169
|
console.log(
|
|
225
|
-
|
|
170
|
+
"[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes."
|
|
226
171
|
);
|
|
227
172
|
});
|
|
228
173
|
}
|
|
229
174
|
}
|
|
230
175
|
}
|
|
231
176
|
});
|
|
232
|
-
}
|
|
177
|
+
}
|
|
233
178
|
});
|
|
234
179
|
|
|
235
180
|
module.exports = module$1;
|
package/build/cjs/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import {\n addPlugin,\n addPluginTemplate,\n addServerPlugin,\n addTemplate,\n addVitePlugin,\n createResolver,\n defineNuxtModule,\n} from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport * as path from 'path';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { addDynamicImportEntryFileWrapper, addSentryTopImport, addServerConfigToBuild } from './vite/addServerConfig';\nimport { addDatabaseInstrumentation } from './vite/databaseConfig';\nimport { addMiddlewareImports, addMiddlewareInstrumentation } from './vite/middlewareConfig';\nimport { setupSourceMaps } from './vite/sourceMaps';\nimport { addStorageInstrumentation } from './vite/storageConfig';\nimport { addOTelCommonJSImportAlias, findDefaultSdkInitFile, getNitroMajorVersion } from './vite/utils';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\ntype NuxtPageSubset = { file?: string; path: string };\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '>=3.7.0',\n },\n },\n defaults: {},\n async setup(moduleOptionsParam, nuxt) {\n if (moduleOptionsParam?.enabled === false) {\n return;\n }\n\n const moduleOptions = {\n ...moduleOptionsParam,\n autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,\n experimental_entrypointWrappedFunctions: moduleOptionsParam.experimental_entrypointWrappedFunctions || [\n 'default',\n 'handler',\n 'server',\n ],\n };\n\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client', nuxt);\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n order: 0,\n\n // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)\n // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file\n getContents: () => `\n import { defineNuxtPlugin } from \"#imports\";\n\n export default defineNuxtPlugin({\n name: 'sentry-client-config',\n async setup() {\n await import(\"${buildDirResolver.resolve(`/${clientConfigFile}`)}\")\n }\n });`,\n });\n\n // Add the plugin which loads client integrations etc. -\n // this must run after the sentry-client-config plugin has run, and the client is initialized!\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'),\n mode: 'client',\n order: 1,\n });\n }\n\n const serverConfigFile = findDefaultSdkInitFile('server', nuxt);\n const isNitroV3 = (await getNitroMajorVersion()) >= 3;\n const nuxtMajor = parseInt((nuxt as unknown as { _version: string })._version?.split('.')[0] ?? '3', 10);\n const isMinNuxtV4 = nuxtMajor >= 4;\n\n if (serverConfigFile) {\n if (isNitroV3) {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/handler.server'));\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/update-route-name.server'));\n } else {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/handler-legacy.server'));\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/update-route-name-legacy.server'));\n }\n\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));\n\n if (isMinNuxtV4) {\n addPlugin({ src: moduleDirResolver.resolve('./runtime/plugins/route-detector.server'), mode: 'server' });\n } else {\n addPlugin({ src: moduleDirResolver.resolve('./runtime/plugins/route-detector-legacy.server'), mode: 'server' });\n }\n\n // Preps the middleware instrumentation module.\n addMiddlewareImports();\n addStorageInstrumentation(nuxt, !isNitroV3);\n addDatabaseInstrumentation(nuxt.options.nitro, !isNitroV3, moduleOptions);\n }\n\n if (clientConfigFile || serverConfigFile) {\n setupSourceMaps(moduleOptions, nuxt, addVitePlugin);\n }\n\n addOTelCommonJSImportAlias(nuxt, isNitroV3);\n\n let pagesData: NuxtPageSubset[] = [];\n\n nuxt.hooks.hook('pages:extend', pages => {\n pagesData = pages\n .map(page => ({ file: page.file, path: page.path }))\n .filter(page => {\n // Check for dynamic parameter (e.g., :userId or [userId])\n return page.path.includes(':') || page?.file?.includes('[');\n });\n });\n\n if (isMinNuxtV4) {\n const pagesDataVirtualModuleId = '#sentry/nuxt-pages-data.mjs';\n\n // Vite virtual plugin (for the Vite SSR build, where addPlugin mode:'server' plugins are bundled)\n addVitePlugin({\n name: 'sentry-nuxt-pages-data-virtual',\n resolveId: id => (id === pagesDataVirtualModuleId ? `\\0${pagesDataVirtualModuleId}` : null),\n load: id =>\n id === `\\0${pagesDataVirtualModuleId}` ? `export default ${JSON.stringify(pagesData, null, 2)};` : undefined,\n });\n } else {\n // Nuxt v3: register as a build template (accessible via #build/)\n addTemplate({\n filename: 'sentry--nuxt-pages-data.mjs',\n getContents: () => `export default ${JSON.stringify(pagesData, null, 2)};`,\n });\n }\n\n // Add the sentry config file to the include array\n nuxt.hook('prepare:types', options => {\n const tsConfig = options.tsConfig as { include?: string[] };\n\n if (!tsConfig.include) {\n tsConfig.include = [];\n }\n\n // Add type references for useRuntimeConfig in root files for nuxt v4\n // Should be relative to `root/.nuxt`\n if (clientConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\n }\n if (serverConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, serverConfigFile);\n tsConfig.include.push(relativePath);\n }\n });\n\n nuxt.hooks.hook('nitro:init', nitro => {\n if (nuxt.options?._prepare) {\n return;\n }\n\n if (serverConfigFile) {\n addMiddlewareInstrumentation(nitro);\n }\n\n if (serverConfigFile?.includes('.server.config')) {\n consoleSandbox(() => {\n const serverDir = nitro.options.output.serverDir;\n\n // Netlify env: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n if (serverDir.includes('.netlify') || !!process.env.NETLIFY) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n\n // Vercel env: https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL\n if (serverDir.includes('.vercel') || !!process.env.VERCEL) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n });\n\n if (moduleOptions.autoInjectServerSentry !== 'experimental_dynamic-import') {\n addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);\n\n if (moduleOptions.debug) {\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const serverConfigPath = serverDirResolver.resolve('sentry.server.config.mjs');\n\n // For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs\n const serverConfigRelativePath = `.${path.sep}${path.relative(nitro.options.rootDir, serverConfigPath)}`;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Using \\`${serverConfigFile}\\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/.`,\n );\n\n if (nitro.options.dev) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \\`NODE_OPTIONS='--import ${serverConfigRelativePath}' nuxt dev\\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \\`nuxt dev\\` to regenerate it.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] When running your built application, preload Sentry via a command-line flag (\\`node --import ${serverConfigRelativePath} [...]\\`) or via an environment variable (\\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\\`).`,\n );\n }\n });\n }\n }\n\n if (moduleOptions.autoInjectServerSentry === 'top-level-import') {\n addSentryTopImport(moduleOptions, nitro);\n }\n\n if (moduleOptions.autoInjectServerSentry === 'experimental_dynamic-import') {\n addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);\n\n if (moduleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes.',\n );\n });\n }\n }\n }\n });\n },\n});\n"],"names":["defineNuxtModule","createResolver","findDefaultSdkInitFile","addPluginTemplate","addPlugin","getNitroMajorVersion","addServerPlugin","addMiddlewareImports","addStorageInstrumentation","addDatabaseInstrumentation","setupSourceMaps","addVitePlugin","addOTelCommonJSImportAlias","addTemplate","addMiddlewareInstrumentation","consoleSandbox","addServerConfigToBuild","addSentryTopImport","addDynamicImportEntryFileWrapper"],"mappings":";;;;;;;;;;;AAsBA,iBAAeA,oBAAgB,CAAgB;AAC/C,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,aAAa,EAAE;AACnB,MAAM,IAAI,EAAE,SAAS;AACrB,KAAK;AACL,GAAG;AACH,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,MAAM,KAAK,CAAC,kBAAkB,EAAE,IAAI,EAAE;AACxC,IAAI,IAAI,kBAAkB,EAAE,OAAA,KAAY,KAAK,EAAE;AAC/C,MAAM;AACN,IAAI;;AAEJ,IAAI,MAAM,gBAAgB;AAC1B,MAAM,GAAG,kBAAkB;AAC3B,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,sBAAsB;AACvE,MAAM,uCAAuC,EAAE,kBAAkB,CAAC,2CAA2C;AAC7G,QAAQ,SAAS;AACjB,QAAQ,SAAS;AACjB,QAAQ,QAAQ;AAChB,OAAO;AACP,KAAK;;AAEL,IAAI,MAAM,iBAAA,GAAoBC,kBAAc,CAAC,2PAAe,CAAC;AAC7D,IAAI,MAAM,gBAAA,GAAmBA,kBAAc,CAAC,IAAI,CAAC,OAAO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CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import {\n addPlugin,\n addPluginTemplate,\n addServerPlugin,\n addTemplate,\n addVitePlugin,\n createResolver,\n defineNuxtModule,\n} from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport * as path from 'path';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { addDynamicImportEntryFileWrapper, addSentryTopImport, addServerConfigToBuild } from './vite/addServerConfig';\nimport { addDatabaseInstrumentation } from './vite/databaseConfig';\nimport { addMiddlewareImports, addMiddlewareInstrumentation } from './vite/middlewareConfig';\nimport { setupSourceMaps } from './vite/sourceMaps';\nimport { addStorageInstrumentation } from './vite/storageConfig';\nimport { addOTelCommonJSImportAlias, findDefaultSdkInitFile, getNitroMajorVersion } from './vite/utils';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\ntype NuxtPageSubset = { file?: string; path: string };\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '>=3.7.0',\n },\n },\n defaults: {},\n async setup(moduleOptionsParam, nuxt) {\n if (moduleOptionsParam?.enabled === false) {\n return;\n }\n\n const moduleOptions = {\n ...moduleOptionsParam,\n autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,\n experimental_entrypointWrappedFunctions: moduleOptionsParam.experimental_entrypointWrappedFunctions || [\n 'default',\n 'handler',\n 'server',\n ],\n };\n\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = await findDefaultSdkInitFile('client', nuxt, moduleOptions);\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n order: 0,\n\n // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)\n // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file\n getContents: () => `\n import { defineNuxtPlugin } from \"#imports\";\n\n export default defineNuxtPlugin({\n name: 'sentry-client-config',\n async setup() {\n await import(\"${buildDirResolver.resolve(`/${clientConfigFile}`)}\")\n }\n });`,\n });\n\n // Add the plugin which loads client integrations etc. -\n // this must run after the sentry-client-config plugin has run, and the client is initialized!\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'),\n mode: 'client',\n order: 1,\n });\n }\n\n const serverConfigFile = await findDefaultSdkInitFile('server', nuxt, moduleOptions);\n const isNitroV3 = (await getNitroMajorVersion()) >= 3;\n const nuxtMajor = parseInt((nuxt as unknown as { _version: string })._version?.split('.')[0] ?? '3', 10);\n const isMinNuxtV4 = nuxtMajor >= 4;\n\n if (serverConfigFile) {\n if (isNitroV3) {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/handler.server'));\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/update-route-name.server'));\n } else {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/handler-legacy.server'));\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/update-route-name-legacy.server'));\n }\n\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));\n\n if (isMinNuxtV4) {\n addPlugin({ src: moduleDirResolver.resolve('./runtime/plugins/route-detector.server'), mode: 'server' });\n } else {\n addPlugin({ src: moduleDirResolver.resolve('./runtime/plugins/route-detector-legacy.server'), mode: 'server' });\n }\n\n // Preps the middleware instrumentation module.\n addMiddlewareImports();\n addStorageInstrumentation(nuxt, !isNitroV3);\n addDatabaseInstrumentation(nuxt.options.nitro, !isNitroV3, moduleOptions);\n }\n\n if (clientConfigFile || serverConfigFile) {\n setupSourceMaps(moduleOptions, nuxt, addVitePlugin);\n }\n\n addOTelCommonJSImportAlias(nuxt, isNitroV3);\n\n let pagesData: NuxtPageSubset[] = [];\n\n nuxt.hooks.hook('pages:extend', pages => {\n pagesData = pages\n .map(page => ({ file: page.file, path: page.path }))\n .filter(page => {\n // Check for dynamic parameter (e.g., :userId or [userId])\n return page.path.includes(':') || page?.file?.includes('[');\n });\n });\n\n if (isMinNuxtV4) {\n const pagesDataVirtualModuleId = '#sentry/nuxt-pages-data.mjs';\n\n // Vite virtual plugin (for the Vite SSR build, where addPlugin mode:'server' plugins are bundled)\n addVitePlugin({\n name: 'sentry-nuxt-pages-data-virtual',\n resolveId: id => (id === pagesDataVirtualModuleId ? `\\0${pagesDataVirtualModuleId}` : null),\n load: id =>\n id === `\\0${pagesDataVirtualModuleId}` ? `export default ${JSON.stringify(pagesData, null, 2)};` : undefined,\n });\n } else {\n // Nuxt v3: register as a build template (accessible via #build/)\n addTemplate({\n filename: 'sentry--nuxt-pages-data.mjs',\n getContents: () => `export default ${JSON.stringify(pagesData, null, 2)};`,\n });\n }\n\n // Add the sentry config file to the include array\n nuxt.hook('prepare:types', options => {\n const tsConfig = options.tsConfig as { include?: string[] };\n\n if (!tsConfig.include) {\n tsConfig.include = [];\n }\n\n // Add type references for useRuntimeConfig in root files for nuxt v4\n // Should be relative to `root/.nuxt`\n if (clientConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\n }\n if (serverConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, serverConfigFile);\n tsConfig.include.push(relativePath);\n }\n });\n\n nuxt.hooks.hook('nitro:init', nitro => {\n if (nuxt.options?._prepare) {\n return;\n }\n\n if (serverConfigFile) {\n addMiddlewareInstrumentation(nitro);\n }\n\n if (serverConfigFile?.includes('.server.config')) {\n consoleSandbox(() => {\n const serverDir = nitro.options.output.serverDir;\n\n // Netlify env: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n if (serverDir.includes('.netlify') || !!process.env.NETLIFY) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n\n // Vercel env: https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL\n if (serverDir.includes('.vercel') || !!process.env.VERCEL) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n });\n\n if (moduleOptions.autoInjectServerSentry !== 'experimental_dynamic-import') {\n addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);\n\n if (moduleOptions.debug) {\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const serverConfigPath = serverDirResolver.resolve('sentry.server.config.mjs');\n\n // For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs\n const serverConfigRelativePath = `.${path.sep}${path.relative(nitro.options.rootDir, serverConfigPath)}`;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Using \\`${serverConfigFile}\\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/.`,\n );\n\n if (nitro.options.dev) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \\`NODE_OPTIONS='--import ${serverConfigRelativePath}' nuxt dev\\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \\`nuxt dev\\` to regenerate it.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] When running your built application, preload Sentry via a command-line flag (\\`node --import ${serverConfigRelativePath} [...]\\`) or via an environment variable (\\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\\`).`,\n );\n }\n });\n }\n }\n\n if (moduleOptions.autoInjectServerSentry === 'top-level-import') {\n addSentryTopImport(moduleOptions, nitro);\n }\n\n if (moduleOptions.autoInjectServerSentry === 'experimental_dynamic-import') {\n addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);\n\n if (moduleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes.',\n );\n });\n }\n }\n }\n });\n },\n});\n"],"names":["defineNuxtModule","createResolver","findDefaultSdkInitFile","addPluginTemplate","addPlugin","getNitroMajorVersion","addServerPlugin","addMiddlewareImports","addStorageInstrumentation","addDatabaseInstrumentation","setupSourceMaps","addVitePlugin","addOTelCommonJSImportAlias","addTemplate","addMiddlewareInstrumentation","consoleSandbox","addServerConfigToBuild","addSentryTopImport","addDynamicImportEntryFileWrapper"],"mappings":";;;;;;;;;;;AAsBA,iBAAeA,oBAAA,CAAgC;AAAA,EAC7C,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,qBAAA;AAAA,IACN,SAAA,EAAW,QAAA;AAAA,IACX,aAAA,EAAe;AAAA,MACb,IAAA,EAAM;AAAA;AACR,GACF;AAAA,EACA,UAAU,EAAC;AAAA,EACX,MAAM,KAAA,CAAM,kBAAA,EAAoB,IAAA,EAAM;AACpC,IAAA,IAAI,kBAAA,EAAoB,YAAY,KAAA,EAAO;AACzC,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,aAAA,GAAgB;AAAA,MACpB,GAAG,kBAAA;AAAA,MACH,wBAAwB,kBAAA,CAAmB,sBAAA;AAAA,MAC3C,uCAAA,EAAyC,mBAAmB,uCAAA,IAA2C;AAAA,QACrG,SAAA;AAAA,QACA,SAAA;AAAA,QACA;AAAA;AACF,KACF;AAEA,IAAA,MAAM,iBAAA,GAAoBC,kBAAA,CAAe,2PAAe,CAAA;AACxD,IAAA,MAAM,gBAAA,GAAmBA,kBAAA,CAAe,IAAA,CAAK,OAAA,CAAQ,Q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