@sentry/nuxt 8.36.0-beta.0 → 8.37.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/index.js +2 -0
- package/build/cjs/client/index.js.map +1 -1
- package/build/cjs/client/piniaIntegration.js +40 -0
- package/build/cjs/client/piniaIntegration.js.map +1 -0
- package/build/cjs/client/sdk.js.map +1 -1
- package/build/cjs/index.client.js +2 -0
- package/build/cjs/index.client.js.map +1 -1
- package/build/cjs/module.js +3 -2
- package/build/cjs/module.js.map +1 -1
- package/build/cjs/runtime/plugins/sentry.client.js +5 -24
- package/build/cjs/runtime/plugins/sentry.client.js.map +1 -1
- package/build/cjs/runtime/plugins/sentry.server.js.map +1 -1
- package/build/cjs/runtime/utils.js.map +1 -1
- package/build/cjs/server/sdk.js.map +1 -1
- package/build/cjs/vite/addServerConfig.js +23 -12
- package/build/cjs/vite/addServerConfig.js.map +1 -1
- package/build/cjs/vite/sourceMaps.js.map +1 -1
- package/build/cjs/vite/utils.js +100 -28
- package/build/cjs/vite/utils.js.map +1 -1
- package/build/esm/client/index.js +1 -0
- package/build/esm/client/index.js.map +1 -1
- package/build/esm/client/piniaIntegration.js +38 -0
- package/build/esm/client/piniaIntegration.js.map +1 -0
- package/build/esm/client/sdk.js.map +1 -1
- package/build/esm/index.client.js +1 -0
- package/build/esm/index.client.js.map +1 -1
- package/build/esm/module.js +2 -1
- package/build/esm/module.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/runtime/plugins/sentry.client.js +3 -22
- package/build/esm/runtime/plugins/sentry.client.js.map +1 -1
- package/build/esm/runtime/plugins/sentry.server.js.map +1 -1
- package/build/esm/runtime/utils.js.map +1 -1
- package/build/esm/server/sdk.js.map +1 -1
- package/build/esm/vite/addServerConfig.js +24 -13
- package/build/esm/vite/addServerConfig.js.map +1 -1
- package/build/esm/vite/sourceMaps.js.map +1 -1
- package/build/esm/vite/utils.js +98 -28
- package/build/esm/vite/utils.js.map +1 -1
- package/build/module/module.d.mts +12 -0
- package/build/module/module.d.ts +12 -0
- package/build/module/module.json +1 -1
- package/build/module/module.mjs +65 -19
- package/build/module/runtime/plugins/sentry.client.js +5 -21
- package/build/types/client/index.d.ts +1 -0
- package/build/types/client/index.d.ts.map +1 -1
- package/build/types/client/piniaIntegration.d.ts +12 -0
- package/build/types/client/piniaIntegration.d.ts.map +1 -0
- package/build/types/common/types.d.ts +14 -12
- package/build/types/common/types.d.ts.map +1 -1
- package/build/types/index.types.d.ts.map +1 -1
- package/build/types/module.d.ts.map +1 -1
- package/build/types/runtime/plugins/sentry.client.d.ts.map +1 -1
- package/build/types/vite/addServerConfig.d.ts +1 -1
- package/build/types/vite/addServerConfig.d.ts.map +1 -1
- package/build/types/vite/utils.d.ts +15 -6
- package/build/types/vite/utils.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/vite/utils.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n\n/**\n * Find the default SDK init file for the given type (client or server).\n * The sentry.server.config file is prioritized over the instrument.server file.\n */\nexport function findDefaultSdkInitFile(type: 'server' | 'client'): string | undefined {\n const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];\n const cwd = process.cwd();\n\n const filePaths: string[] = [];\n if (type === 'server') {\n for (const ext of possibleFileExtensions) {\n // order is important here - we want to prioritize the server.config file\n filePaths.push(path.join(cwd, `sentry.${type}.config.${ext}`));\n filePaths.push(path.join(cwd, 'public', `instrument.${type}.${ext}`));\n }\n } else {\n for (const ext of possibleFileExtensions) {\n filePaths.push(path.join(cwd, `sentry.${type}.config.${ext}`));\n }\n }\n\n return filePaths.find(filename => fs.existsSync(filename));\n}\n\nexport const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';\nexport const SENTRY_FUNCTIONS_REEXPORT = '?sentry-query-functions-reexport=';\nexport const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';\n\n/**\n * Strips the Sentry query part from a path.\n * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path\n *\n * Only exported for testing.\n */\nexport function removeSentryQueryFromPath(url: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_WRAPPED_ENTRY}.*?\\\\${QUERY_END_INDICATOR}`);\n return url.replace(regex, '');\n}\n\n/**\n * Extracts and sanitizes function re-export query parameters from a query string.\n * If it is a default export, it is not considered for re-exporting. This function is mostly relevant for re-exporting\n * serverless `handler` functions.\n *\n * Only exported for testing.\n */\nexport function extractFunctionReexportQueryParameters(query: string): string[] {\n // Regex matches the comma-separated params between the functions query\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_FUNCTIONS_REEXPORT}(.*?)\\\\${QUERY_END_INDICATOR}`);\n const match = query.match(regex);\n\n return match && match[1]\n ? match[1]\n .split(',')\n .filter(param => param !== '')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n : [];\n}\n\n/**\n * Constructs a code snippet with function reexports (can be used in Rollup plugins)\n */\nexport function constructFunctionReExport(pathWithQuery: string, entryId: string): string {\n const functionNames = extractFunctionReexportQueryParameters(pathWithQuery);\n\n return functionNames.reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(\n 'async function reExport(...args) {\\n' +\n ` const res = await import(${JSON.stringify(entryId)});\\n` +\n ` return res.${currFunctionName}.call(this, ...args);\\n` +\n '}\\n' +\n `export { reExport as ${currFunctionName} };\\n`,\n ),\n '',\n );\n}\n"],"names":[],"mappings":";;;AAGA;AACA;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,IAAI,EAA2C;AACtF,EAAE,MAAM,sBAAA,GAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,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src/vite/utils.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { consoleSandbox, flatten } from '@sentry/utils';\n\n/**\n * Find the default SDK init file for the given type (client or server).\n * The sentry.server.config file is prioritized over the instrument.server file.\n */\nexport function findDefaultSdkInitFile(type: 'server' | 'client'): string | undefined {\n const possibleFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];\n const cwd = process.cwd();\n\n const filePaths: string[] = [];\n if (type === 'server') {\n for (const ext of possibleFileExtensions) {\n // order is important here - we want to prioritize the server.config file\n filePaths.push(path.join(cwd, `sentry.${type}.config.${ext}`));\n filePaths.push(path.join(cwd, 'public', `instrument.${type}.${ext}`));\n }\n } else {\n for (const ext of possibleFileExtensions) {\n filePaths.push(path.join(cwd, `sentry.${type}.config.${ext}`));\n }\n }\n\n return filePaths.find(filename => fs.existsSync(filename));\n}\n\nexport const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';\nexport const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';\nexport const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';\nexport const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';\n\n/**\n * Strips the Sentry query part from a path.\n * Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path\n *\n * Only exported for testing.\n */\nexport function removeSentryQueryFromPath(url: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const regex = new RegExp(`\\\\${SENTRY_WRAPPED_ENTRY}.*?\\\\${QUERY_END_INDICATOR}`);\n return url.replace(regex, '');\n}\n\n/**\n * Extracts and sanitizes function re-export and function wrap query parameters from a query string.\n * If it is a default export, it is not considered for re-exporting.\n *\n * Only exported for testing.\n */\nexport function extractFunctionReexportQueryParameters(query: string): { wrap: string[]; reexport: string[] } {\n // Regex matches the comma-separated params between the functions query\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const wrapRegex = new RegExp(\n `\\\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR}|\\\\${SENTRY_REEXPORTED_FUNCTIONS})`,\n );\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n const reexportRegex = new RegExp(`\\\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\\\${QUERY_END_INDICATOR})`);\n\n const wrapMatch = query.match(wrapRegex);\n const reexportMatch = query.match(reexportRegex);\n\n const wrap =\n wrapMatch && wrapMatch[1]\n ? wrapMatch[1]\n .split(',')\n .filter(param => param !== '')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n : [];\n\n const reexport =\n reexportMatch && reexportMatch[1]\n ? reexportMatch[1]\n .split(',')\n .filter(param => param !== '' && param !== 'default')\n // Sanitize, as code could be injected with another rollup plugin\n .map((str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n : [];\n\n return { wrap, reexport };\n}\n\n/**\n * Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.\n * It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped\n * (e.g. serverless handlers) are wrapped by Sentry.\n */\nexport function constructWrappedFunctionExportQuery(\n exportedBindings: Record<string, string[]> | null,\n entrypointWrappedFunctions: string[],\n debug?: boolean,\n): string {\n // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`\n // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.\n const functionsToExport = flatten(Object.values(exportedBindings || {})).reduce(\n (functions, currFunctionName) => {\n if (entrypointWrappedFunctions.includes(currFunctionName)) {\n functions.wrap.push(currFunctionName);\n } else {\n functions.reexport.push(currFunctionName);\n }\n return functions;\n },\n { wrap: [], reexport: [] } as { wrap: string[]; reexport: string[] },\n );\n\n if (debug && functionsToExport.wrap.length === 0) {\n consoleSandbox(() =>\n // eslint-disable-next-line no-console\n console.warn(\n \"[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to Sentry's build options `sentry.entrypointWrappedFunctions` in `nuxt.config.ts`.\",\n ),\n );\n }\n\n const wrapQuery = functionsToExport.wrap.length\n ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`\n : '';\n const reexportQuery = functionsToExport.reexport.length\n ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`\n : '';\n\n return [wrapQuery, reexportQuery].join('');\n}\n\n/**\n * Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)\n */\nexport function constructFunctionReExport(pathWithQuery: string, entryId: string): string {\n const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);\n\n return wrapFunctions\n .reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(\n `async function ${currFunctionName}_sentryWrapped(...args) {\\n` +\n ` const res = await import(${JSON.stringify(entryId)});\\n` +\n ` return res.${currFunctionName}.call(this, ...args);\\n` +\n '}\\n' +\n `export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\\n`,\n ),\n '',\n )\n .concat(\n reexportFunctions.reduce(\n (functionsCode, currFunctionName) =>\n functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),\n '',\n ),\n );\n}\n"],"names":[],"mappings":";;;;AAIA;AACA;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,IAAI,EAA2C;AACtF,EAAE,MAAM,sBAAA,GAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;AACzE,EAAE,MAAM,GAAI,GAAE,OAAO,CAAC,GAAG,EAAE;;AAE3B,EAAE,MAAM,SAAS,GAAa,EAAE;AAChC,EAAE,IAAI,IAAK,KAAI,QAAQ,EAAE;AACzB,IAAI,KAAK,MA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BAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,IAAA,CAAA;AACA,YAAA,CAAA,aAAA,EAAA,gBAAA,CAAA,uBAAA,CAAA;AACA,YAAA,KAAA;AACA,YAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,kBAAA,EAAA,gBAAA,CAAA,KAAA,CAAA;AACA,SAAA;AACA,MAAA,EAAA;AACA;AACA,KAAA,MAAA;AACA,MAAA,iBAAA,CAAA,MAAA;AACA,QAAA,CAAA,aAAA,EAAA,gBAAA;AACA,UAAA,aAAA,CAAA,MAAA,CAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,QAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA,QAAA,EAAA;AACA,OAAA;AACA,KAAA;AACA;;;;"}
|
|
@@ -101,6 +101,18 @@ type SentryNuxtModuleOptions = {
|
|
|
101
101
|
* @default true
|
|
102
102
|
*/
|
|
103
103
|
dynamicImportForServerEntry?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* By default—unless you configure `dynamicImportForServerEntry: false`—the SDK will try to wrap your Nitro server entrypoint
|
|
106
|
+
* with a dynamic `import()` to ensure all dependencies can be properly instrumented. Any previous exports from the entrypoint are still exported.
|
|
107
|
+
* Most exports of the server entrypoint are serverless functions and those are wrapped by Sentry. Other exports stay as-is.
|
|
108
|
+
*
|
|
109
|
+
* By default, the SDK will wrap the default export as well as a `handler` or `server` export from the entrypoint.
|
|
110
|
+
* 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.
|
|
111
|
+
* Any wrapped export is expected to be an async function.
|
|
112
|
+
*
|
|
113
|
+
* @default ['default', 'handler', 'server']
|
|
114
|
+
*/
|
|
115
|
+
entrypointWrappedFunctions?: string[];
|
|
104
116
|
/**
|
|
105
117
|
* 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.
|
|
106
118
|
* You can use this option to override any options the SDK passes to the Vite (for Nuxt) and Rollup (for Nitro) plugin.
|
package/build/module/module.d.ts
CHANGED
|
@@ -101,6 +101,18 @@ type SentryNuxtModuleOptions = {
|
|
|
101
101
|
* @default true
|
|
102
102
|
*/
|
|
103
103
|
dynamicImportForServerEntry?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* By default—unless you configure `dynamicImportForServerEntry: false`—the SDK will try to wrap your Nitro server entrypoint
|
|
106
|
+
* with a dynamic `import()` to ensure all dependencies can be properly instrumented. Any previous exports from the entrypoint are still exported.
|
|
107
|
+
* Most exports of the server entrypoint are serverless functions and those are wrapped by Sentry. Other exports stay as-is.
|
|
108
|
+
*
|
|
109
|
+
* By default, the SDK will wrap the default export as well as a `handler` or `server` export from the entrypoint.
|
|
110
|
+
* 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.
|
|
111
|
+
* Any wrapped export is expected to be an async function.
|
|
112
|
+
*
|
|
113
|
+
* @default ['default', 'handler', 'server']
|
|
114
|
+
*/
|
|
115
|
+
entrypointWrappedFunctions?: string[];
|
|
104
116
|
/**
|
|
105
117
|
* 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.
|
|
106
118
|
* You can use this option to override any options the SDK passes to the Vite (for Nuxt) and Rollup (for Nitro) plugin.
|
package/build/module/module.json
CHANGED
package/build/module/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
2
|
import { createResolver, defineNuxtModule, addPluginTemplate, addPlugin, addServerPlugin } from '@nuxt/kit';
|
|
3
|
-
import { consoleSandbox } from '@sentry/utils';
|
|
3
|
+
import { flatten, consoleSandbox } from '@sentry/utils';
|
|
4
4
|
import * as fs from 'fs';
|
|
5
5
|
import { sentryRollupPlugin } from '@sentry/rollup-plugin';
|
|
6
6
|
import { sentryVitePlugin } from '@sentry/vite-plugin';
|
|
@@ -22,29 +22,67 @@ function findDefaultSdkInitFile(type) {
|
|
|
22
22
|
return filePaths.find((filename) => fs.existsSync(filename));
|
|
23
23
|
}
|
|
24
24
|
const SENTRY_WRAPPED_ENTRY = "?sentry-query-wrapped-entry";
|
|
25
|
-
const
|
|
25
|
+
const SENTRY_WRAPPED_FUNCTIONS = "?sentry-query-wrapped-functions=";
|
|
26
|
+
const SENTRY_REEXPORTED_FUNCTIONS = "?sentry-query-reexported-functions=";
|
|
26
27
|
const QUERY_END_INDICATOR = "SENTRY-QUERY-END";
|
|
27
28
|
function removeSentryQueryFromPath(url) {
|
|
28
29
|
const regex = new RegExp(`\\${SENTRY_WRAPPED_ENTRY}.*?\\${QUERY_END_INDICATOR}`);
|
|
29
30
|
return url.replace(regex, "");
|
|
30
31
|
}
|
|
31
32
|
function extractFunctionReexportQueryParameters(query) {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const wrapRegex = new RegExp(
|
|
34
|
+
`\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR}|\\${SENTRY_REEXPORTED_FUNCTIONS})`
|
|
35
|
+
);
|
|
36
|
+
const reexportRegex = new RegExp(`\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR})`);
|
|
37
|
+
const wrapMatch = query.match(wrapRegex);
|
|
38
|
+
const reexportMatch = query.match(reexportRegex);
|
|
39
|
+
const wrap = wrapMatch && wrapMatch[1] ? wrapMatch[1].split(",").filter((param) => param !== "").map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) : [];
|
|
40
|
+
const reexport = reexportMatch && reexportMatch[1] ? reexportMatch[1].split(",").filter((param) => param !== "" && param !== "default").map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) : [];
|
|
41
|
+
return { wrap, reexport };
|
|
42
|
+
}
|
|
43
|
+
function constructWrappedFunctionExportQuery(exportedBindings, entrypointWrappedFunctions, debug) {
|
|
44
|
+
const functionsToExport = flatten(Object.values(exportedBindings || {})).reduce(
|
|
45
|
+
(functions, currFunctionName) => {
|
|
46
|
+
if (entrypointWrappedFunctions.includes(currFunctionName)) {
|
|
47
|
+
functions.wrap.push(currFunctionName);
|
|
48
|
+
} else {
|
|
49
|
+
functions.reexport.push(currFunctionName);
|
|
50
|
+
}
|
|
51
|
+
return functions;
|
|
52
|
+
},
|
|
53
|
+
{ wrap: [], reexport: [] }
|
|
54
|
+
);
|
|
55
|
+
if (debug && functionsToExport.wrap.length === 0) {
|
|
56
|
+
consoleSandbox(
|
|
57
|
+
() => (
|
|
58
|
+
// eslint-disable-next-line no-console
|
|
59
|
+
console.warn(
|
|
60
|
+
"[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to Sentry's build options `sentry.entrypointWrappedFunctions` in `nuxt.config.ts`."
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
const wrapQuery = functionsToExport.wrap.length ? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(",")}` : "";
|
|
66
|
+
const reexportQuery = functionsToExport.reexport.length ? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(",")}` : "";
|
|
67
|
+
return [wrapQuery, reexportQuery].join("");
|
|
35
68
|
}
|
|
36
69
|
function constructFunctionReExport(pathWithQuery, entryId) {
|
|
37
|
-
const
|
|
38
|
-
return
|
|
70
|
+
const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);
|
|
71
|
+
return wrapFunctions.reduce(
|
|
39
72
|
(functionsCode, currFunctionName) => functionsCode.concat(
|
|
40
|
-
`async function
|
|
73
|
+
`async function ${currFunctionName}_sentryWrapped(...args) {
|
|
41
74
|
const res = await import(${JSON.stringify(entryId)});
|
|
42
75
|
return res.${currFunctionName}.call(this, ...args);
|
|
43
76
|
}
|
|
44
|
-
export {
|
|
77
|
+
export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };
|
|
45
78
|
`
|
|
46
79
|
),
|
|
47
80
|
""
|
|
81
|
+
).concat(
|
|
82
|
+
reexportFunctions.reduce(
|
|
83
|
+
(functionsCode, currFunctionName) => functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),
|
|
84
|
+
""
|
|
85
|
+
)
|
|
48
86
|
);
|
|
49
87
|
}
|
|
50
88
|
|
|
@@ -82,7 +120,7 @@ function addServerConfigToBuild(moduleOptions, nuxt, nitro, serverConfigFile) {
|
|
|
82
120
|
});
|
|
83
121
|
});
|
|
84
122
|
}
|
|
85
|
-
function addDynamicImportEntryFileWrapper(nitro, serverConfigFile) {
|
|
123
|
+
function addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions) {
|
|
86
124
|
if (!nitro.options.rollupConfig) {
|
|
87
125
|
nitro.options.rollupConfig = { output: {} };
|
|
88
126
|
}
|
|
@@ -92,11 +130,17 @@ function addDynamicImportEntryFileWrapper(nitro, serverConfigFile) {
|
|
|
92
130
|
nitro.options.rollupConfig.plugins = [nitro.options.rollupConfig.plugins];
|
|
93
131
|
}
|
|
94
132
|
nitro.options.rollupConfig.plugins.push(
|
|
95
|
-
|
|
96
|
-
|
|
133
|
+
wrapEntryWithDynamicImport({
|
|
134
|
+
resolvedSentryConfigPath: createResolver(nitro.options.srcDir).resolve(`/${serverConfigFile}`),
|
|
135
|
+
entrypointWrappedFunctions: moduleOptions.entrypointWrappedFunctions
|
|
136
|
+
})
|
|
97
137
|
);
|
|
98
138
|
}
|
|
99
|
-
function wrapEntryWithDynamicImport(
|
|
139
|
+
function wrapEntryWithDynamicImport({
|
|
140
|
+
resolvedSentryConfigPath,
|
|
141
|
+
entrypointWrappedFunctions,
|
|
142
|
+
debug
|
|
143
|
+
}) {
|
|
100
144
|
return {
|
|
101
145
|
name: "sentry-wrap-entry-with-dynamic-import",
|
|
102
146
|
async resolveId(source, importer, options) {
|
|
@@ -106,21 +150,22 @@ function wrapEntryWithDynamicImport(resolvedSentryConfigPath) {
|
|
|
106
150
|
if (source === "import-in-the-middle/hook.mjs") {
|
|
107
151
|
return { id: source, moduleSideEffects: true, external: true };
|
|
108
152
|
}
|
|
109
|
-
if (options.isEntry && !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {
|
|
153
|
+
if (options.isEntry && source.includes(".mjs") && !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {
|
|
110
154
|
const resolution = await this.resolve(source, importer, options);
|
|
111
155
|
if (!resolution || resolution?.external)
|
|
112
156
|
return resolution;
|
|
113
157
|
const moduleInfo = await this.load(resolution);
|
|
114
158
|
moduleInfo.moduleSideEffects = true;
|
|
115
|
-
|
|
116
|
-
|
|
159
|
+
return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`) ? resolution.id : resolution.id.concat(SENTRY_WRAPPED_ENTRY).concat(
|
|
160
|
+
constructWrappedFunctionExportQuery(moduleInfo.exportedBindings, entrypointWrappedFunctions, debug)
|
|
161
|
+
).concat(QUERY_END_INDICATOR);
|
|
117
162
|
}
|
|
118
163
|
return null;
|
|
119
164
|
},
|
|
120
165
|
load(id) {
|
|
121
166
|
if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {
|
|
122
167
|
const entryId = removeSentryQueryFromPath(id);
|
|
123
|
-
const reExportedFunctions = id.includes(
|
|
168
|
+
const reExportedFunctions = id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS) ? constructFunctionReExport(id, entryId) : "";
|
|
124
169
|
return (
|
|
125
170
|
// Regular `import` of the Sentry config
|
|
126
171
|
`import ${JSON.stringify(resolvedSentryConfigPath)};
|
|
@@ -332,8 +377,9 @@ const module = defineNuxtModule({
|
|
|
332
377
|
setup(moduleOptionsParam, nuxt) {
|
|
333
378
|
const moduleOptions = {
|
|
334
379
|
...moduleOptionsParam,
|
|
335
|
-
dynamicImportForServerEntry: moduleOptionsParam.dynamicImportForServerEntry !== false
|
|
380
|
+
dynamicImportForServerEntry: moduleOptionsParam.dynamicImportForServerEntry !== false,
|
|
336
381
|
// default: true
|
|
382
|
+
entrypointWrappedFunctions: moduleOptionsParam.entrypointWrappedFunctions || ["default", "handler", "server"]
|
|
337
383
|
};
|
|
338
384
|
const moduleDirResolver = createResolver(import.meta.url);
|
|
339
385
|
const buildDirResolver = createResolver(nuxt.options.buildDir);
|
|
@@ -394,7 +440,7 @@ export default defineNuxtPlugin(() => {})`
|
|
|
394
440
|
});
|
|
395
441
|
}
|
|
396
442
|
} else {
|
|
397
|
-
addDynamicImportEntryFileWrapper(nitro, serverConfigFile);
|
|
443
|
+
addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);
|
|
398
444
|
if (moduleOptions.debug) {
|
|
399
445
|
consoleSandbox(() => {
|
|
400
446
|
console.log(
|
|
@@ -1,39 +1,23 @@
|
|
|
1
1
|
import { getClient } from "@sentry/core";
|
|
2
|
-
import {
|
|
3
|
-
import { browserTracingIntegration, createSentryPiniaPlugin, vueIntegration } from "@sentry/vue";
|
|
2
|
+
import { browserTracingIntegration, vueIntegration } from "@sentry/vue";
|
|
4
3
|
import { defineNuxtPlugin } from "nuxt/app";
|
|
5
4
|
import { reportNuxtError } from "../utils.js";
|
|
6
5
|
export default defineNuxtPlugin({
|
|
7
6
|
name: "sentry-client-integrations",
|
|
8
7
|
dependsOn: ["sentry-client-config"],
|
|
9
8
|
async setup(nuxtApp) {
|
|
10
|
-
const sentryClient = getClient();
|
|
11
|
-
const clientOptions = sentryClient && sentryClient.getOptions();
|
|
12
9
|
if (typeof __SENTRY_TRACING__ === "undefined" || __SENTRY_TRACING__) {
|
|
10
|
+
const sentryClient = getClient();
|
|
13
11
|
if (sentryClient && "$router" in nuxtApp) {
|
|
14
12
|
sentryClient.addIntegration(
|
|
15
13
|
browserTracingIntegration({ router: nuxtApp.$router, routeLabel: "path" })
|
|
16
14
|
);
|
|
17
15
|
}
|
|
18
16
|
}
|
|
19
|
-
if (clientOptions && "trackPinia" in clientOptions && clientOptions.trackPinia) {
|
|
20
|
-
if ("$pinia" in nuxtApp) {
|
|
21
|
-
nuxtApp.$pinia.use(
|
|
22
|
-
// `trackPinia` is an object with custom options or `true` (pass `undefined` to use default options)
|
|
23
|
-
createSentryPiniaPlugin(clientOptions.trackPinia === true ? void 0 : clientOptions.trackPinia)
|
|
24
|
-
);
|
|
25
|
-
} else {
|
|
26
|
-
clientOptions.debug && consoleSandbox(() => {
|
|
27
|
-
console.warn(
|
|
28
|
-
'[Sentry] You set `trackPinia`, but the Pinia module was not found. Make sure to add `"@pinia/nuxt"` to your modules array.'
|
|
29
|
-
);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
17
|
nuxtApp.hook("app:created", (vueApp) => {
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
|
|
18
|
+
const sentryClient = getClient();
|
|
19
|
+
if (sentryClient) {
|
|
20
|
+
sentryClient.addIntegration(vueIntegration({ app: vueApp, attachErrorHandler: false }));
|
|
37
21
|
}
|
|
38
22
|
});
|
|
39
23
|
nuxtApp.hook("app:error", (error) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Monitor an existing Pinia store.
|
|
3
|
+
*
|
|
4
|
+
* This only works if "@pinia/nuxt" is added to the `modules` array.
|
|
5
|
+
*/
|
|
6
|
+
export declare const piniaIntegration: (pinia: unknown, options?: {
|
|
7
|
+
attachPiniaState?: boolean | undefined;
|
|
8
|
+
addBreadcrumbs?: boolean | undefined;
|
|
9
|
+
actionTransformer?: ((action: any) => any) | undefined;
|
|
10
|
+
stateTransformer?: ((state: any) => any) | undefined;
|
|
11
|
+
} | undefined) => import("@sentry/types").Integration;
|
|
12
|
+
//# sourceMappingURL=piniaIntegration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piniaIntegration.d.ts","sourceRoot":"","sources":["../../../src/client/piniaIntegration.ts"],"names":[],"mappings":"AAiCA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;qDAAuC,CAAC"}
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import type { init as initNode } from '@sentry/node';
|
|
2
2
|
import type { SentryRollupPluginOptions } from '@sentry/rollup-plugin';
|
|
3
3
|
import type { SentryVitePluginOptions } from '@sentry/vite-plugin';
|
|
4
|
-
import type {
|
|
5
|
-
export type SentryNuxtClientOptions = Omit<Parameters<typeof initVue>[0] & object, 'app'
|
|
6
|
-
/**
|
|
7
|
-
* Control if an existing Pinia store should be monitored.
|
|
8
|
-
* Set this to `true` to track with default options or provide your custom Pinia plugin options.
|
|
9
|
-
*
|
|
10
|
-
* This only works if "@pinia/nuxt" is added to the `modules` array.
|
|
11
|
-
*
|
|
12
|
-
* @default false
|
|
13
|
-
*/
|
|
14
|
-
trackPinia?: true | Parameters<typeof createSentryPiniaPlugin>[0];
|
|
15
|
-
};
|
|
4
|
+
import type { init as initVue } from '@sentry/vue';
|
|
5
|
+
export type SentryNuxtClientOptions = Omit<Parameters<typeof initVue>[0] & object, 'app'>;
|
|
16
6
|
export type SentryNuxtServerOptions = Omit<Parameters<typeof initNode>[0] & object, 'app'>;
|
|
17
7
|
type SourceMapsOptions = {
|
|
18
8
|
/**
|
|
@@ -113,6 +103,18 @@ export type SentryNuxtModuleOptions = {
|
|
|
113
103
|
* @default true
|
|
114
104
|
*/
|
|
115
105
|
dynamicImportForServerEntry?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* By default—unless you configure `dynamicImportForServerEntry: false`—the SDK will try to wrap your Nitro server entrypoint
|
|
108
|
+
* with a dynamic `import()` to ensure all dependencies can be properly instrumented. Any previous exports from the entrypoint are still exported.
|
|
109
|
+
* Most exports of the server entrypoint are serverless functions and those are wrapped by Sentry. Other exports stay as-is.
|
|
110
|
+
*
|
|
111
|
+
* By default, the SDK will wrap the default export as well as a `handler` or `server` export from the entrypoint.
|
|
112
|
+
* 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.
|
|
113
|
+
* Any wrapped export is expected to be an async function.
|
|
114
|
+
*
|
|
115
|
+
* @default ['default', 'handler', 'server']
|
|
116
|
+
*/
|
|
117
|
+
entrypointWrappedFunctions?: string[];
|
|
116
118
|
/**
|
|
117
119
|
* 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.
|
|
118
120
|
* You can use this option to override any options the SDK passes to the Vite (for Nuxt) and Rollup (for Nitro) plugin.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MA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;;;;OAYG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IAEtC;;;;;;;;;;OAUG;IACH,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtC;;;;;OAKG;IACH,mCAAmC,CAAC,EAAE,yBAAyB,GAAG,uBAAuB,CAAC;CAC3F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../../src/index.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAIjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAG/B,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,uBAAuB,GAAG,SAAS,CAAC,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AACrH,MAAM,CAAC,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,SAAS,CAAC,uBAAuB,CAAC;AACvF,MAAM,CAAC,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,SAAS,CAAC,uBAAuB,CAAC;AACvF,MAAM,CAAC,OAAO,CAAC,MAAM,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,WAAW,EAAE,CAAC;AACjF,MAAM,CAAC,OAAO,CAAC,MAAM,kBAAkB,EAAE,WAAW,CAAC;AACrD,MAAM,CAAC,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,SAAS,CAAC,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../../src/index.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAIjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAG/B,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,uBAAuB,GAAG,SAAS,CAAC,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AACrH,MAAM,CAAC,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,SAAS,CAAC,uBAAuB,CAAC;AACvF,MAAM,CAAC,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,SAAS,CAAC,uBAAuB,CAAC;AACvF,MAAM,CAAC,OAAO,CAAC,MAAM,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,WAAW,EAAE,CAAC;AACjF,MAAM,CAAC,OAAO,CAAC,MAAM,kBAAkB,EAAE,WAAW,CAAC;AACrD,MAAM,CAAC,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,SAAS,CAAC,aAAa,CAAC;AAEnE,MAAM,CAAC,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,SAAS,CAAC,OAAO,GAAG,OAAO,SAAS,CAAC,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAK9D,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC;;AAEpD,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAK9D,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC;;AAEpD,wBA4GG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.client.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"sentry.client.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"names":[],"mappings":";AAgCA,wBAmCG"}
|
|
@@ -15,5 +15,5 @@ export declare function addServerConfigToBuild(moduleOptions: SentryNuxtModuleOp
|
|
|
15
15
|
* With this, the Sentry server config can be loaded before all other modules of the application (which is needed for import-in-the-middle).
|
|
16
16
|
* See: https://nodejs.org/api/module.html#enabling
|
|
17
17
|
*/
|
|
18
|
-
export declare function addDynamicImportEntryFileWrapper(nitro: Nitro, serverConfigFile: string): void;
|
|
18
|
+
export declare function addDynamicImportEntryFileWrapper(nitro: Nitro, serverConfigFile: string, moduleOptions: Omit<SentryNuxtModuleOptions, 'entrypointWrappedFunctions'> & Required<Pick<SentryNuxtModuleOptions, 'entrypointWrappedFunctions'>>): void;
|
|
19
19
|
//# sourceMappingURL=addServerConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addServerConfig.d.ts","sourceRoot":"","sources":["../../../src/vite/addServerConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"addServerConfig.d.ts","sourceRoot":"","sources":["../../../src/vite/addServerConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAa/D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,uBAAuB,EACtC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,MAAM,GACvB,IAAI,CA8CN;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,IAAI,CAAC,uBAAuB,EAAE,4BAA4B,CAAC,GACxE,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,4BAA4B,CAAC,CAAC,GACtE,IAAI,CAkBN"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function findDefaultSdkInitFile(type: 'server' | 'client'): string | undefined;
|
|
6
6
|
export declare const SENTRY_WRAPPED_ENTRY = "?sentry-query-wrapped-entry";
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const SENTRY_WRAPPED_FUNCTIONS = "?sentry-query-wrapped-functions=";
|
|
8
|
+
export declare const SENTRY_REEXPORTED_FUNCTIONS = "?sentry-query-reexported-functions=";
|
|
8
9
|
export declare const QUERY_END_INDICATOR = "SENTRY-QUERY-END";
|
|
9
10
|
/**
|
|
10
11
|
* Strips the Sentry query part from a path.
|
|
@@ -14,15 +15,23 @@ export declare const QUERY_END_INDICATOR = "SENTRY-QUERY-END";
|
|
|
14
15
|
*/
|
|
15
16
|
export declare function removeSentryQueryFromPath(url: string): string;
|
|
16
17
|
/**
|
|
17
|
-
* Extracts and sanitizes function re-export query parameters from a query string.
|
|
18
|
-
* If it is a default export, it is not considered for re-exporting.
|
|
19
|
-
* serverless `handler` functions.
|
|
18
|
+
* Extracts and sanitizes function re-export and function wrap query parameters from a query string.
|
|
19
|
+
* If it is a default export, it is not considered for re-exporting.
|
|
20
20
|
*
|
|
21
21
|
* Only exported for testing.
|
|
22
22
|
*/
|
|
23
|
-
export declare function extractFunctionReexportQueryParameters(query: string):
|
|
23
|
+
export declare function extractFunctionReexportQueryParameters(query: string): {
|
|
24
|
+
wrap: string[];
|
|
25
|
+
reexport: string[];
|
|
26
|
+
};
|
|
24
27
|
/**
|
|
25
|
-
*
|
|
28
|
+
* Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.
|
|
29
|
+
* It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped
|
|
30
|
+
* (e.g. serverless handlers) are wrapped by Sentry.
|
|
31
|
+
*/
|
|
32
|
+
export declare function constructWrappedFunctionExportQuery(exportedBindings: Record<string, string[]> | null, entrypointWrappedFunctions: string[], debug?: boolean): string;
|
|
33
|
+
/**
|
|
34
|
+
* Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)
|
|
26
35
|
*/
|
|
27
36
|
export declare function constructFunctionReExport(pathWithQuery: string, entryId: string): string;
|
|
28
37
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/vite/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/vite/utils.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAkBpF;AAED,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAClE,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAC3E,eAAO,MAAM,2BAA2B,wCAAwC,CAAC;AACjF,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7D;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CA+B5G;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CACjD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EACjD,0BAA0B,EAAE,MAAM,EAAE,EACpC,KAAK,CAAC,EAAE,OAAO,GACd,MAAM,CAgCR;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAsBxF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/nuxt",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.37.0",
|
|
4
4
|
"description": "Official Sentry SDK for Nuxt (EXPERIMENTAL)",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/nuxt",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@nuxt/kit": "^3.13.2",
|
|
46
|
-
"@sentry/browser": "8.
|
|
47
|
-
"@sentry/core": "8.
|
|
48
|
-
"@sentry/node": "8.
|
|
49
|
-
"@sentry/opentelemetry": "8.
|
|
46
|
+
"@sentry/browser": "8.37.0",
|
|
47
|
+
"@sentry/core": "8.37.0",
|
|
48
|
+
"@sentry/node": "8.37.0",
|
|
49
|
+
"@sentry/opentelemetry": "8.37.0",
|
|
50
50
|
"@sentry/rollup-plugin": "2.22.6",
|
|
51
|
-
"@sentry/types": "8.
|
|
52
|
-
"@sentry/utils": "8.
|
|
51
|
+
"@sentry/types": "8.37.0",
|
|
52
|
+
"@sentry/utils": "8.37.0",
|
|
53
53
|
"@sentry/vite-plugin": "2.22.6",
|
|
54
|
-
"@sentry/vue": "8.
|
|
54
|
+
"@sentry/vue": "8.37.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@nuxt/module-builder": "^0.8.4",
|