@sentry/solidstart 8.51.0 → 8.52.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/config/addInstrumentation.js +185 -0
- package/build/cjs/config/addInstrumentation.js.map +1 -0
- package/build/cjs/config/withSentry.js +76 -0
- package/build/cjs/config/withSentry.js.map +1 -0
- package/build/cjs/config/wrapServerEntryWithDynamicImport.js +248 -0
- package/build/cjs/config/wrapServerEntryWithDynamicImport.js.map +1 -0
- package/build/cjs/index.server.js +3 -0
- package/build/cjs/index.server.js.map +1 -1
- package/build/cjs/vite/buildInstrumentationFile.js +58 -0
- package/build/cjs/vite/buildInstrumentationFile.js.map +1 -0
- package/build/cjs/vite/sentrySolidStartVite.js +38 -0
- package/build/cjs/vite/sentrySolidStartVite.js.map +1 -1
- package/build/esm/config/addInstrumentation.js +179 -0
- package/build/esm/config/addInstrumentation.js.map +1 -0
- package/build/esm/config/withSentry.js +71 -0
- package/build/esm/config/withSentry.js.map +1 -0
- package/build/esm/config/wrapServerEntryWithDynamicImport.js +238 -0
- package/build/esm/config/wrapServerEntryWithDynamicImport.js.map +1 -0
- package/build/esm/index.server.js +2 -1
- package/build/esm/index.server.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/vite/buildInstrumentationFile.js +56 -0
- package/build/esm/vite/buildInstrumentationFile.js.map +1 -0
- package/build/esm/vite/sentrySolidStartVite.js +38 -1
- package/build/esm/vite/sentrySolidStartVite.js.map +1 -1
- package/build/types/config/addInstrumentation.d.ts +36 -0
- package/build/types/config/addInstrumentation.d.ts.map +1 -0
- package/build/types/config/index.d.ts +2 -0
- package/build/types/config/index.d.ts.map +1 -0
- package/build/types/config/types.d.ts +13 -0
- package/build/types/config/types.d.ts.map +1 -0
- package/build/types/config/utils.d.ts +26 -0
- package/build/types/config/utils.d.ts.map +1 -0
- package/build/types/config/withSentry.d.ts +13 -0
- package/build/types/config/withSentry.d.ts.map +1 -0
- package/build/types/config/wrapServerEntryWithDynamicImport.d.ts +60 -0
- package/build/types/config/wrapServerEntryWithDynamicImport.d.ts.map +1 -0
- package/build/types/index.server.d.ts +1 -0
- package/build/types/index.server.d.ts.map +1 -1
- package/build/types/index.types.d.ts +1 -0
- package/build/types/index.types.d.ts.map +1 -1
- package/build/types/vite/buildInstrumentationFile.d.ts +8 -0
- package/build/types/vite/buildInstrumentationFile.d.ts.map +1 -0
- package/build/types/vite/sentrySolidStartVite.d.ts +22 -1
- package/build/types/vite/sentrySolidStartVite.d.ts.map +1 -1
- package/build/types/vite/types.d.ts +52 -1
- package/build/types/vite/types.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { consoleSandbox } from '@sentry/core';
|
|
2
|
+
|
|
3
|
+
/** THIS FILE IS AN UTILITY FOR NITRO-BASED PACKAGES AND SHOULD BE KEPT IN SYNC IN NUXT, SOLIDSTART, ETC. */
|
|
4
|
+
|
|
5
|
+
const SENTRY_WRAPPED_ENTRY = '?sentry-query-wrapped-entry';
|
|
6
|
+
const SENTRY_WRAPPED_FUNCTIONS = '?sentry-query-wrapped-functions=';
|
|
7
|
+
const SENTRY_REEXPORTED_FUNCTIONS = '?sentry-query-reexported-functions=';
|
|
8
|
+
const QUERY_END_INDICATOR = 'SENTRY-QUERY-END';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first
|
|
12
|
+
* by using a regular `import` and load the server after that.
|
|
13
|
+
* This also works with serverless `handler` functions, as it re-exports the `handler`.
|
|
14
|
+
*
|
|
15
|
+
* @param config Configuration options for the Rollup Plugin
|
|
16
|
+
* @param config.serverConfigFileName Name of the Sentry server config (without file extension). E.g. 'sentry.server.config'
|
|
17
|
+
* @param config.serverEntrypointFileName The server entrypoint (with file extension). Usually, this is defined by the Nitro preset and is something like 'node-server.mjs'
|
|
18
|
+
* @param config.resolvedServerConfigPath Resolved path of the Sentry server config (based on `src` directory)
|
|
19
|
+
* @param config.entryPointWrappedFunctions Exported bindings of the server entry file, which are wrapped as async function. E.g. ['default', 'handler', 'server']
|
|
20
|
+
* @param config.additionalImports Adds additional imports to the entry file. Can be e.g. 'import-in-the-middle/hook.mjs'
|
|
21
|
+
* @param config.debug Whether debug logs are enabled in the build time environment
|
|
22
|
+
*/
|
|
23
|
+
function wrapServerEntryWithDynamicImport(config) {
|
|
24
|
+
const {
|
|
25
|
+
serverConfigFileName,
|
|
26
|
+
serverEntrypointFileName,
|
|
27
|
+
resolvedServerConfigPath,
|
|
28
|
+
entrypointWrappedFunctions,
|
|
29
|
+
additionalImports,
|
|
30
|
+
debug,
|
|
31
|
+
} = config;
|
|
32
|
+
|
|
33
|
+
// In order to correctly import the server config file
|
|
34
|
+
// and dynamically import the nitro runtime, we need to
|
|
35
|
+
// mark the resolutionId with '\0raw' to fall into the
|
|
36
|
+
// raw chunk group, c.f. https://github.com/nitrojs/nitro/commit/8b4a408231bdc222569a32ce109796a41eac4aa6#diff-e58102d2230f95ddeef2662957b48d847a6e891e354cfd0ae6e2e03ce848d1a2R142
|
|
37
|
+
const resolutionIdPrefix = '\0raw';
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
name: 'sentry-wrap-server-entry-with-dynamic-import',
|
|
41
|
+
async resolveId(source, importer, options) {
|
|
42
|
+
if (source.includes(`/${serverConfigFileName}`)) {
|
|
43
|
+
return { id: source, moduleSideEffects: true };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (additionalImports && additionalImports.includes(source)) {
|
|
47
|
+
// When importing additional imports like "import-in-the-middle/hook.mjs" in the returned code of the `load()` function below:
|
|
48
|
+
// By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it
|
|
49
|
+
// By importing "import-in-the-middle/hook.mjs", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.
|
|
50
|
+
// Prevents the error "Failed to register ESM hook Error: Cannot find module 'import-in-the-middle/hook.mjs'"
|
|
51
|
+
return { id: source, moduleSideEffects: true, external: true };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (
|
|
55
|
+
options.isEntry &&
|
|
56
|
+
source.includes(serverEntrypointFileName) &&
|
|
57
|
+
source.includes('.mjs') &&
|
|
58
|
+
!source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)
|
|
59
|
+
) {
|
|
60
|
+
const resolution = await this.resolve(source, importer, options);
|
|
61
|
+
|
|
62
|
+
// If it cannot be resolved or is external, just return it so that Rollup can display an error
|
|
63
|
+
if (!resolution || (resolution && resolution.external)) return resolution;
|
|
64
|
+
|
|
65
|
+
const moduleInfo = await this.load(resolution);
|
|
66
|
+
|
|
67
|
+
moduleInfo.moduleSideEffects = true;
|
|
68
|
+
|
|
69
|
+
// The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix
|
|
70
|
+
return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)
|
|
71
|
+
? resolution.id
|
|
72
|
+
: `${resolutionIdPrefix}${resolution.id
|
|
73
|
+
// Concatenates the query params to mark the file (also attaches names of re-exports - this is needed for serverless functions to re-export the handler)
|
|
74
|
+
.concat(SENTRY_WRAPPED_ENTRY)
|
|
75
|
+
.concat(
|
|
76
|
+
constructWrappedFunctionExportQuery(moduleInfo.exportedBindings, entrypointWrappedFunctions, debug),
|
|
77
|
+
)
|
|
78
|
+
.concat(QUERY_END_INDICATOR)}`;
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
},
|
|
82
|
+
load(id) {
|
|
83
|
+
if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {
|
|
84
|
+
const entryId = removeSentryQueryFromPath(id).slice(resolutionIdPrefix.length);
|
|
85
|
+
|
|
86
|
+
// Mostly useful for serverless `handler` functions
|
|
87
|
+
const reExportedFunctions =
|
|
88
|
+
id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)
|
|
89
|
+
? constructFunctionReExport(id, entryId)
|
|
90
|
+
: '';
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
// Regular `import` of the Sentry config
|
|
94
|
+
`import ${JSON.stringify(resolvedServerConfigPath)};\n` +
|
|
95
|
+
// Dynamic `import()` for the previous, actual entry point.
|
|
96
|
+
// `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)
|
|
97
|
+
`import(${JSON.stringify(entryId)});\n` +
|
|
98
|
+
// By importing additional imports like "import-in-the-middle/hook.mjs", we can make sure this file wil be included, as not all node builders are including files imported with `module.register()`.
|
|
99
|
+
`${additionalImports ? additionalImports.map(importPath => `import "${importPath}";\n`) : ''}` +
|
|
100
|
+
`${reExportedFunctions}\n`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return null;
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Strips the Sentry query part from a path.
|
|
111
|
+
* Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path
|
|
112
|
+
*
|
|
113
|
+
* **Only exported for testing**
|
|
114
|
+
*/
|
|
115
|
+
function removeSentryQueryFromPath(url) {
|
|
116
|
+
// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor
|
|
117
|
+
const regex = new RegExp(`\\${SENTRY_WRAPPED_ENTRY}.*?\\${QUERY_END_INDICATOR}`);
|
|
118
|
+
return url.replace(regex, '');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Extracts and sanitizes function re-export and function wrap query parameters from a query string.
|
|
123
|
+
* If it is a default export, it is not considered for re-exporting.
|
|
124
|
+
*
|
|
125
|
+
* **Only exported for testing**
|
|
126
|
+
*/
|
|
127
|
+
function extractFunctionReexportQueryParameters(query) {
|
|
128
|
+
// Regex matches the comma-separated params between the functions query
|
|
129
|
+
// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor
|
|
130
|
+
const wrapRegex = new RegExp(
|
|
131
|
+
`\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR}|\\${SENTRY_REEXPORTED_FUNCTIONS})`,
|
|
132
|
+
);
|
|
133
|
+
// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor
|
|
134
|
+
const reexportRegex = new RegExp(`\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR})`);
|
|
135
|
+
|
|
136
|
+
const wrapMatch = query.match(wrapRegex);
|
|
137
|
+
const reexportMatch = query.match(reexportRegex);
|
|
138
|
+
|
|
139
|
+
const wrap =
|
|
140
|
+
wrapMatch && wrapMatch[1]
|
|
141
|
+
? wrapMatch[1]
|
|
142
|
+
.split(',')
|
|
143
|
+
.filter(param => param !== '')
|
|
144
|
+
// Sanitize, as code could be injected with another rollup plugin
|
|
145
|
+
.map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
|
|
146
|
+
: [];
|
|
147
|
+
|
|
148
|
+
const reexport =
|
|
149
|
+
reexportMatch && reexportMatch[1]
|
|
150
|
+
? reexportMatch[1]
|
|
151
|
+
.split(',')
|
|
152
|
+
.filter(param => param !== '' && param !== 'default')
|
|
153
|
+
// Sanitize, as code could be injected with another rollup plugin
|
|
154
|
+
.map((str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
|
|
155
|
+
: [];
|
|
156
|
+
|
|
157
|
+
return { wrap, reexport };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.
|
|
162
|
+
* It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped
|
|
163
|
+
* (e.g. serverless handlers) are wrapped by Sentry.
|
|
164
|
+
*
|
|
165
|
+
* **Only exported for testing**
|
|
166
|
+
*/
|
|
167
|
+
function constructWrappedFunctionExportQuery(
|
|
168
|
+
exportedBindings,
|
|
169
|
+
entrypointWrappedFunctions,
|
|
170
|
+
debug,
|
|
171
|
+
) {
|
|
172
|
+
const functionsToExport = {
|
|
173
|
+
wrap: [],
|
|
174
|
+
reexport: [],
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`
|
|
178
|
+
// The key `.` refers to exports within the current file, while other keys show from where exports were imported first.
|
|
179
|
+
Object.values(exportedBindings || {}).forEach(functions =>
|
|
180
|
+
functions.forEach(fn => {
|
|
181
|
+
if (entrypointWrappedFunctions.includes(fn)) {
|
|
182
|
+
functionsToExport.wrap.push(fn);
|
|
183
|
+
} else {
|
|
184
|
+
functionsToExport.reexport.push(fn);
|
|
185
|
+
}
|
|
186
|
+
}),
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
if (debug && functionsToExport.wrap.length === 0) {
|
|
190
|
+
consoleSandbox(() =>
|
|
191
|
+
// eslint-disable-next-line no-console
|
|
192
|
+
console.warn(
|
|
193
|
+
'[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 `entrypointWrappedFunctions`.',
|
|
194
|
+
),
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const wrapQuery = functionsToExport.wrap.length
|
|
199
|
+
? `${SENTRY_WRAPPED_FUNCTIONS}${functionsToExport.wrap.join(',')}`
|
|
200
|
+
: '';
|
|
201
|
+
const reexportQuery = functionsToExport.reexport.length
|
|
202
|
+
? `${SENTRY_REEXPORTED_FUNCTIONS}${functionsToExport.reexport.join(',')}`
|
|
203
|
+
: '';
|
|
204
|
+
|
|
205
|
+
return [wrapQuery, reexportQuery].join('');
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)
|
|
210
|
+
*
|
|
211
|
+
* **Only exported for testing**
|
|
212
|
+
*/
|
|
213
|
+
function constructFunctionReExport(pathWithQuery, entryId) {
|
|
214
|
+
const { wrap: wrapFunctions, reexport: reexportFunctions } = extractFunctionReexportQueryParameters(pathWithQuery);
|
|
215
|
+
|
|
216
|
+
return wrapFunctions
|
|
217
|
+
.reduce(
|
|
218
|
+
(functionsCode, currFunctionName) =>
|
|
219
|
+
functionsCode.concat(
|
|
220
|
+
`async function ${currFunctionName}_sentryWrapped(...args) {\n` +
|
|
221
|
+
` const res = await import(${JSON.stringify(entryId)});\n` +
|
|
222
|
+
` return res.${currFunctionName}.call(this, ...args);\n` +
|
|
223
|
+
'}\n' +
|
|
224
|
+
`export { ${currFunctionName}_sentryWrapped as ${currFunctionName} };\n`,
|
|
225
|
+
),
|
|
226
|
+
'',
|
|
227
|
+
)
|
|
228
|
+
.concat(
|
|
229
|
+
reexportFunctions.reduce(
|
|
230
|
+
(functionsCode, currFunctionName) =>
|
|
231
|
+
functionsCode.concat(`export { ${currFunctionName} } from ${JSON.stringify(entryId)};`),
|
|
232
|
+
'',
|
|
233
|
+
),
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export { QUERY_END_INDICATOR, SENTRY_REEXPORTED_FUNCTIONS, SENTRY_WRAPPED_ENTRY, SENTRY_WRAPPED_FUNCTIONS, constructFunctionReExport, constructWrappedFunctionExportQuery, extractFunctionReexportQueryParameters, removeSentryQueryFromPath, wrapServerEntryWithDynamicImport };
|
|
238
|
+
//# sourceMappingURL=wrapServerEntryWithDynamicImport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapServerEntryWithDynamicImport.js","sources":["../../../src/config/wrapServerEntryWithDynamicImport.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport type { InputPluginOption } from 'rollup';\n\n/** THIS FILE IS AN UTILITY FOR NITRO-BASED PACKAGES AND SHOULD BE KEPT IN SYNC IN NUXT, SOLIDSTART, ETC. */\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\nexport type WrapServerEntryPluginOptions = {\n serverEntrypointFileName: string;\n serverConfigFileName: string;\n resolvedServerConfigPath: string;\n entrypointWrappedFunctions: string[];\n additionalImports?: string[];\n debug?: boolean;\n};\n\n/**\n * A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first\n * by using a regular `import` and load the server after that.\n * This also works with serverless `handler` functions, as it re-exports the `handler`.\n *\n * @param config Configuration options for the Rollup Plugin\n * @param config.serverConfigFileName Name of the Sentry server config (without file extension). E.g. 'sentry.server.config'\n * @param config.serverEntrypointFileName The server entrypoint (with file extension). Usually, this is defined by the Nitro preset and is something like 'node-server.mjs'\n * @param config.resolvedServerConfigPath Resolved path of the Sentry server config (based on `src` directory)\n * @param config.entryPointWrappedFunctions Exported bindings of the server entry file, which are wrapped as async function. E.g. ['default', 'handler', 'server']\n * @param config.additionalImports Adds additional imports to the entry file. Can be e.g. 'import-in-the-middle/hook.mjs'\n * @param config.debug Whether debug logs are enabled in the build time environment\n */\nexport function wrapServerEntryWithDynamicImport(config: WrapServerEntryPluginOptions): InputPluginOption {\n const {\n serverConfigFileName,\n serverEntrypointFileName,\n resolvedServerConfigPath,\n entrypointWrappedFunctions,\n additionalImports,\n debug,\n } = config;\n\n // In order to correctly import the server config file\n // and dynamically import the nitro runtime, we need to\n // mark the resolutionId with '\\0raw' to fall into the\n // raw chunk group, c.f. https://github.com/nitrojs/nitro/commit/8b4a408231bdc222569a32ce109796a41eac4aa6#diff-e58102d2230f95ddeef2662957b48d847a6e891e354cfd0ae6e2e03ce848d1a2R142\n const resolutionIdPrefix = '\\0raw';\n\n return {\n name: 'sentry-wrap-server-entry-with-dynamic-import',\n async resolveId(source, importer, options) {\n if (source.includes(`/${serverConfigFileName}`)) {\n return { id: source, moduleSideEffects: true };\n }\n\n if (additionalImports && additionalImports.includes(source)) {\n // When importing additional imports like \"import-in-the-middle/hook.mjs\" in the returned code of the `load()` function below:\n // By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it\n // By importing \"import-in-the-middle/hook.mjs\", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.\n // Prevents the error \"Failed to register ESM hook Error: Cannot find module 'import-in-the-middle/hook.mjs'\"\n return { id: source, moduleSideEffects: true, external: true };\n }\n\n if (\n options.isEntry &&\n source.includes(serverEntrypointFileName) &&\n source.includes('.mjs') &&\n !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ) {\n const resolution = await this.resolve(source, importer, options);\n\n // If it cannot be resolved or is external, just return it so that Rollup can display an error\n if (!resolution || (resolution && resolution.external)) return resolution;\n\n const moduleInfo = await this.load(resolution);\n\n moduleInfo.moduleSideEffects = true;\n\n // The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix\n return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)\n ? resolution.id\n : `${resolutionIdPrefix}${resolution.id\n // Concatenates the query params to mark the file (also attaches names of re-exports - this is needed for serverless functions to re-export the handler)\n .concat(SENTRY_WRAPPED_ENTRY)\n .concat(\n constructWrappedFunctionExportQuery(moduleInfo.exportedBindings, entrypointWrappedFunctions, debug),\n )\n .concat(QUERY_END_INDICATOR)}`;\n }\n return null;\n },\n load(id: string) {\n if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {\n const entryId = removeSentryQueryFromPath(id).slice(resolutionIdPrefix.length);\n\n // Mostly useful for serverless `handler` functions\n const reExportedFunctions =\n id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)\n ? constructFunctionReExport(id, entryId)\n : '';\n\n return (\n // Regular `import` of the Sentry config\n `import ${JSON.stringify(resolvedServerConfigPath)};\\n` +\n // Dynamic `import()` for the previous, actual entry point.\n // `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)\n `import(${JSON.stringify(entryId)});\\n` +\n // By importing additional imports like \"import-in-the-middle/hook.mjs\", we can make sure this file wil be included, as not all node builders are including files imported with `module.register()`.\n `${additionalImports ? additionalImports.map(importPath => `import \"${importPath}\";\\n`) : ''}` +\n `${reExportedFunctions}\\n`\n );\n }\n\n return null;\n },\n };\n}\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 *\n * **Only exported for testing**\n */\nexport function constructWrappedFunctionExportQuery(\n exportedBindings: Record<string, string[]> | null,\n entrypointWrappedFunctions: string[],\n debug?: boolean,\n): string {\n const functionsToExport: { wrap: string[]; reexport: string[] } = {\n wrap: [],\n reexport: [],\n };\n\n // `exportedBindings` can look like this: `{ '.': [ 'handler' ] }` or `{ '.': [], './firebase-gen-1.mjs': [ 'server' ] }`\n // The key `.` refers to exports within the current file, while other keys show from where exports were imported first.\n Object.values(exportedBindings || {}).forEach(functions =>\n functions.forEach(fn => {\n if (entrypointWrappedFunctions.includes(fn)) {\n functionsToExport.wrap.push(fn);\n } else {\n functionsToExport.reexport.push(fn);\n }\n }),\n );\n\n if (debug && functionsToExport.wrap.length === 0) {\n consoleSandbox(() =>\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] No functions found to wrap. In case the server needs to export async functions other than `handler` or `server`, consider adding the name(s) to `entrypointWrappedFunctions`.',\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 *\n * **Only exported for testing**\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":";;AAGA;;AAEO,MAAM,oBAAqB,GAAE;AAC7B,MAAM,wBAAyB,GAAE;AACjC,MAAM,2BAA4B,GAAE;AACpC,MAAM,mBAAoB,GAAE;;AAWnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,MAAM,EAAmD;AAC1G,EAAE,MAAM;AACR,IAAI,oBAAoB;AACxB,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,0BAA0B;AAC9B,IAAI,iBAAiB;AACrB,IAAI,KAAK;AACT,GAAE,GAAI,MAAM;;AAEZ;AACA;AACA;AACA;AACA,EAAE,MAAM,kBAAmB,GAAE,OAAO;;AAEpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,8CAA8C;AACxD,IAAI,MAAM,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC/C,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAA,CAAA,EAAA;AACA,QAAA,OAAA,EAAA,EAAA,EAAA,MAAA,EAAA,iB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CAAA;AACA,YAAA,CAAA,2BAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,IAAA,CAAA;AACA,YAAA,CAAA,aAAA,EAAA,gBAAA,CAAA,uBAAA,CAAA;AACA,YAAA,KAAA;AACA,YAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,kBAAA,EAAA,gBAAA,CAAA,KAAA,CAAA;AACA,SAAA;AACA,MAAA,EAAA;AACA;AACA,KAAA,MAAA;AACA,MAAA,iBAAA,CAAA,MAAA;AACA,QAAA,CAAA,aAAA,EAAA,gBAAA;AACA,UAAA,aAAA,CAAA,MAAA,CAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,QAAA,EAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA,QAAA,EAAA;AACA,OAAA;AACA,KAAA;AACA;;;;"}
|
|
@@ -4,5 +4,6 @@ export { withSentryErrorBoundary } from '@sentry/solid';
|
|
|
4
4
|
export { init } from './server/sdk.js';
|
|
5
5
|
export { withServerActionInstrumentation } from './server/withServerActionInstrumentation.js';
|
|
6
6
|
export { sentryBeforeResponseMiddleware } from './server/middleware.js';
|
|
7
|
-
export { sentrySolidStartVite } from './vite/sentrySolidStartVite.js';
|
|
7
|
+
export { addSentryPluginToVite, sentrySolidStartVite } from './vite/sentrySolidStartVite.js';
|
|
8
|
+
export { withSentry } from './config/withSentry.js';
|
|
8
9
|
//# sourceMappingURL=index.server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.server.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/build/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"8.
|
|
1
|
+
{"type":"module","version":"8.52.0"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { consoleSandbox } from '@sentry/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A Sentry plugin for SolidStart to build the server
|
|
7
|
+
* `instrument.server.ts` file.
|
|
8
|
+
*/
|
|
9
|
+
function makeBuildInstrumentationFilePlugin(options = {}) {
|
|
10
|
+
return {
|
|
11
|
+
name: 'sentry-solidstart-build-instrumentation-file',
|
|
12
|
+
apply: 'build',
|
|
13
|
+
enforce: 'post',
|
|
14
|
+
async config(config, { command }) {
|
|
15
|
+
const instrumentationFilePath = options.instrumentation || './src/instrument.server.ts';
|
|
16
|
+
const router = (config ).router;
|
|
17
|
+
const build = config.build || {};
|
|
18
|
+
const rollupOptions = build.rollupOptions || {};
|
|
19
|
+
const input = [...((rollupOptions.input || []) )];
|
|
20
|
+
|
|
21
|
+
// plugin runs for client, server and sever-fns, we only want to run it for the server once.
|
|
22
|
+
if (command !== 'build' || router.target !== 'server' || router.name === 'server-fns') {
|
|
23
|
+
return config;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
await fs.promises.access(instrumentationFilePath, fs.constants.F_OK);
|
|
28
|
+
} catch (error) {
|
|
29
|
+
consoleSandbox(() => {
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
console.warn(
|
|
32
|
+
`[Sentry SolidStart Plugin] Could not access \`${instrumentationFilePath}\`, please make sure it exists.`,
|
|
33
|
+
error,
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
return config;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
input.push(path.resolve(router.root, instrumentationFilePath));
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
...config,
|
|
43
|
+
build: {
|
|
44
|
+
...build,
|
|
45
|
+
rollupOptions: {
|
|
46
|
+
...rollupOptions,
|
|
47
|
+
input,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { makeBuildInstrumentationFilePlugin };
|
|
56
|
+
//# sourceMappingURL=buildInstrumentationFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildInstrumentationFile.js","sources":["../../../src/vite/buildInstrumentationFile.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { consoleSandbox } from '@sentry/core';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * A Sentry plugin for SolidStart to build the server\n * `instrument.server.ts` file.\n */\nexport function makeBuildInstrumentationFilePlugin(options: SentrySolidStartPluginOptions = {}): Plugin {\n return {\n name: 'sentry-solidstart-build-instrumentation-file',\n apply: 'build',\n enforce: 'post',\n async config(config: UserConfig, { command }) {\n const instrumentationFilePath = options.instrumentation || './src/instrument.server.ts';\n const router = (config as UserConfig & { router: { target: string; name: string; root: string } }).router;\n const build = config.build || {};\n const rollupOptions = build.rollupOptions || {};\n const input = [...((rollupOptions.input || []) as string[])];\n\n // plugin runs for client, server and sever-fns, we only want to run it for the server once.\n if (command !== 'build' || router.target !== 'server' || router.name === 'server-fns') {\n return config;\n }\n\n try {\n await fs.promises.access(instrumentationFilePath, fs.constants.F_OK);\n } catch (error) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry SolidStart Plugin] Could not access \\`${instrumentationFilePath}\\`, please make sure it exists.`,\n error,\n );\n });\n return config;\n }\n\n input.push(path.resolve(router.root, instrumentationFilePath));\n\n return {\n ...config,\n build: {\n ...build,\n rollupOptions: {\n ...rollupOptions,\n input,\n },\n },\n };\n },\n };\n}\n"],"names":[],"mappings":";;;;AAMA;AACA;AACA;AACA;AACO,SAAS,kCAAkC,CAAC,OAAO,GAAkC,EAAE,EAAU;AACxG,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,8CAA8C;AACxD,IAAI,KAAK,EAAE,OAAO;AAClB,I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ACL,GAAG;AACH;;;;"}
|
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
import { _nullishCoalesce, _optionalChain } from '@sentry/core';
|
|
2
|
+
import { makeBuildInstrumentationFilePlugin } from './buildInstrumentationFile.js';
|
|
2
3
|
import { makeSourceMapsVitePlugin } from './sourceMaps.js';
|
|
3
4
|
|
|
5
|
+
// todo(v9): Don't export to users anymore and remove deprecation (and eslint warning silencing) when it's not exported anymore
|
|
4
6
|
/**
|
|
5
7
|
* Various Sentry vite plugins to be used for SolidStart.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated This plugin will be removed in v9. Instead, use `withSentry` to wrap your SolidStart config. Example:
|
|
10
|
+
* ```
|
|
11
|
+
* export default defineConfig(
|
|
12
|
+
* withSentry(
|
|
13
|
+
* {
|
|
14
|
+
* // SolidStart config...
|
|
15
|
+
* },
|
|
16
|
+
* {
|
|
17
|
+
* // Sentry config
|
|
18
|
+
* org: process.env.SENTRY_ORG,
|
|
19
|
+
* project: process.env.SENTRY_PROJECT,
|
|
20
|
+
* authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
21
|
+
* },
|
|
22
|
+
* ),
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
6
25
|
*/
|
|
7
26
|
const sentrySolidStartVite = (options = {}) => {
|
|
8
27
|
const sentryPlugins = [];
|
|
9
28
|
|
|
29
|
+
if (options.autoInjectServerSentry !== 'experimental_dynamic-import') {
|
|
30
|
+
sentryPlugins.push(makeBuildInstrumentationFilePlugin(options));
|
|
31
|
+
}
|
|
32
|
+
|
|
10
33
|
if (process.env.NODE_ENV !== 'development') {
|
|
11
34
|
if (_nullishCoalesce(_optionalChain([options, 'access', _ => _.sourceMapsUploadOptions, 'optionalAccess', _2 => _2.enabled]), () => ( true))) {
|
|
12
35
|
sentryPlugins.push(...makeSourceMapsVitePlugin(options));
|
|
@@ -16,5 +39,19 @@ const sentrySolidStartVite = (options = {}) => {
|
|
|
16
39
|
return sentryPlugins;
|
|
17
40
|
};
|
|
18
41
|
|
|
19
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Helper to add the Sentry SolidStart vite plugin to a vite config.
|
|
44
|
+
*/
|
|
45
|
+
const addSentryPluginToVite = (config = {}, options) => {
|
|
46
|
+
const plugins = Array.isArray(config.plugins) ? [...config.plugins] : [];
|
|
47
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
48
|
+
plugins.unshift(sentrySolidStartVite(options));
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
...config,
|
|
52
|
+
plugins,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { addSentryPluginToVite, sentrySolidStartVite };
|
|
20
57
|
//# sourceMappingURL=sentrySolidStartVite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentrySolidStartVite.js","sources":["../../../src/vite/sentrySolidStartVite.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nimport { makeSourceMapsVitePlugin } from './sourceMaps';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * Various Sentry vite plugins to be used for SolidStart.\n */\nexport const sentrySolidStartVite = (options: SentrySolidStartPluginOptions = {}): Plugin[] => {\n const sentryPlugins: Plugin[] = [];\n\n if (process.env.NODE_ENV !== 'development') {\n if (options.sourceMapsUploadOptions?.enabled ?? true) {\n sentryPlugins.push(...makeSourceMapsVitePlugin(options));\n }\n }\n\n return sentryPlugins;\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sentrySolidStartVite.js","sources":["../../../src/vite/sentrySolidStartVite.ts"],"sourcesContent":["import type { Plugin, UserConfig } from 'vite';\nimport { makeBuildInstrumentationFilePlugin } from './buildInstrumentationFile';\nimport { makeSourceMapsVitePlugin } from './sourceMaps';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n// todo(v9): Don't export to users anymore and remove deprecation (and eslint warning silencing) when it's not exported anymore\n/**\n * Various Sentry vite plugins to be used for SolidStart.\n *\n * @deprecated This plugin will be removed in v9. Instead, use `withSentry` to wrap your SolidStart config. Example:\n * ```\n * export default defineConfig(\n * withSentry(\n * {\n * // SolidStart config...\n * },\n * {\n * // Sentry config\n * org: process.env.SENTRY_ORG,\n * project: process.env.SENTRY_PROJECT,\n * authToken: process.env.SENTRY_AUTH_TOKEN,\n * },\n * ),\n * );\n * ```\n */\nexport const sentrySolidStartVite = (options: SentrySolidStartPluginOptions = {}): Plugin[] => {\n const sentryPlugins: Plugin[] = [];\n\n if (options.autoInjectServerSentry !== 'experimental_dynamic-import') {\n sentryPlugins.push(makeBuildInstrumentationFilePlugin(options));\n }\n\n if (process.env.NODE_ENV !== 'development') {\n if (options.sourceMapsUploadOptions?.enabled ?? true) {\n sentryPlugins.push(...makeSourceMapsVitePlugin(options));\n }\n }\n\n return sentryPlugins;\n};\n\n/**\n * Helper to add the Sentry SolidStart vite plugin to a vite config.\n */\nexport const addSentryPluginToVite = (config: UserConfig = {}, options: SentrySolidStartPluginOptions): UserConfig => {\n const plugins = Array.isArray(config.plugins) ? [...config.plugins] : [];\n // eslint-disable-next-line deprecation/deprecation\n plugins.unshift(sentrySolidStartVite(options));\n\n return {\n ...config,\n plugins,\n };\n};\n"],"names":[],"mappings":";;;;AAKA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,C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CAAA,CAAM,CAAC,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAI,CAAE,CAAA;EAC1E,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;EACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAC,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,oBAAoB,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAC,CAAC;;EAE9C,CAAO,CAAA,CAAA,CAAA,CAAA,EAAA;IACL,GAAG,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA;IACT,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;EACR,CAAA;AACH,CAAA;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Nitro } from 'nitropack';
|
|
2
|
+
import type { SentrySolidStartPluginOptions } from '../vite/types';
|
|
3
|
+
import type { RollupConfig } from './types';
|
|
4
|
+
export declare const staticHostPresets: string[];
|
|
5
|
+
export declare const serverFilePresets: string[];
|
|
6
|
+
/**
|
|
7
|
+
* Adds the built `instrument.server.js` file to the output directory.
|
|
8
|
+
*
|
|
9
|
+
* As Sentry also imports the release injection file, this needs to be copied over manually as well.
|
|
10
|
+
* TODO: The mechanism of manually copying those files could maybe be improved
|
|
11
|
+
*
|
|
12
|
+
* This will no-op if no `instrument.server.js` file was found in the
|
|
13
|
+
* build directory.
|
|
14
|
+
*/
|
|
15
|
+
export declare function addInstrumentationFileToBuild(nitro: Nitro): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Adds an `instrument.server.mjs` import to the top of the server entry file.
|
|
18
|
+
*
|
|
19
|
+
* This is meant as an escape hatch and should only be used in environments where
|
|
20
|
+
* it's not possible to `--import` the file instead as it comes with a limited
|
|
21
|
+
* tracing experience, only collecting http traces.
|
|
22
|
+
*/
|
|
23
|
+
export declare function addSentryTopImport(nitro: Nitro): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* This function modifies the Rollup configuration to include a plugin that wraps the entry file with a dynamic import (`import()`)
|
|
26
|
+
* and adds the Sentry server config with the static `import` declaration.
|
|
27
|
+
*
|
|
28
|
+
* With this, the Sentry server config can be loaded before all other modules of the application (which is needed for import-in-the-middle).
|
|
29
|
+
* See: https://nodejs.org/api/module.html#enabling
|
|
30
|
+
*/
|
|
31
|
+
export declare function addDynamicImportEntryFileWrapper({ nitro, rollupConfig, sentryPluginOptions, }: {
|
|
32
|
+
nitro: Nitro;
|
|
33
|
+
rollupConfig: RollupConfig;
|
|
34
|
+
sentryPluginOptions: Omit<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'> & Required<Pick<SentrySolidStartPluginOptions, 'experimental_entrypointWrappedFunctions'>>;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
//# sourceMappingURL=addInstrumentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addInstrumentation.d.ts","sourceRoot":"","sources":["../../../src/config/addInstrumentation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,eAAO,MAAM,iBAAiB,UAAmB,CAAC;AAElD,eAAO,MAAM,iBAAiB,UAAc,CAAC;AAE7C;;;;;;;;GAQG;AACH,wBAAsB,6BAA6B,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CA4D/E;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CpE;AAED;;;;;;GAMG;AACH,wBAAsB,gCAAgC,CAAC,EACrD,KAAK,EACL,YAAY,EACZ,mBAAmB,GACpB,EAAE;IACD,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,YAAY,CAAC;IAC3B,mBAAmB,EAAE,IAAI,CAAC,6BAA6B,EAAE,yCAAyC,CAAC,GACjG,QAAQ,CAAC,IAAI,CAAC,6BAA6B,EAAE,yCAAyC,CAAC,CAAC,CAAC;CAC5F,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { defineConfig } from '@solidjs/start/config';
|
|
2
|
+
import type { Nitro } from 'nitropack';
|
|
3
|
+
export type RollupConfig = {
|
|
4
|
+
plugins: unknown[];
|
|
5
|
+
};
|
|
6
|
+
export type SolidStartInlineConfig = Parameters<typeof defineConfig>[0];
|
|
7
|
+
export type SolidStartInlineServerConfig = {
|
|
8
|
+
hooks?: {
|
|
9
|
+
close?: () => unknown;
|
|
10
|
+
'rollup:before'?: (nitro: Nitro) => unknown;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGvC,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAExE,MAAM,MAAM,4BAA4B,GAAG;IACzC,KAAK,CAAC,EAAE;QACN,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;QACtB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;KAC7C,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const SENTRY_WRAPPED_ENTRY = "?sentry-query-wrapped-entry";
|
|
2
|
+
export declare const SENTRY_WRAPPED_FUNCTIONS = "?sentry-query-wrapped-functions=";
|
|
3
|
+
export declare const SENTRY_REEXPORTED_FUNCTIONS = "?sentry-query-reexported-functions=";
|
|
4
|
+
export declare const QUERY_END_INDICATOR = "SENTRY-QUERY-END";
|
|
5
|
+
/**
|
|
6
|
+
* Strips the Sentry query part from a path.
|
|
7
|
+
* Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path
|
|
8
|
+
*
|
|
9
|
+
* Only exported for testing.
|
|
10
|
+
*/
|
|
11
|
+
export declare function removeSentryQueryFromPath(url: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Extracts and sanitizes function re-export and function wrap query parameters from a query string.
|
|
14
|
+
* If it is a default export, it is not considered for re-exporting.
|
|
15
|
+
*
|
|
16
|
+
* Only exported for testing.
|
|
17
|
+
*/
|
|
18
|
+
export declare function extractFunctionReexportQueryParameters(query: string): {
|
|
19
|
+
wrap: string[];
|
|
20
|
+
reexport: string[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)
|
|
24
|
+
*/
|
|
25
|
+
export declare function constructFunctionReExport(pathWithQuery: string, entryId: string): string;
|
|
26
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/config/utils.ts"],"names":[],"mappings":"AAAA,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;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAsBxF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SentrySolidStartPluginOptions } from '../vite/types';
|
|
2
|
+
import type { SolidStartInlineConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Modifies the passed in Solid Start configuration with build-time enhancements such as
|
|
5
|
+
* building the `instrument.server.ts` file into the appropriate build folder based on
|
|
6
|
+
* build preset.
|
|
7
|
+
*
|
|
8
|
+
* @param solidStartConfig A Solid Start configuration object, as usually passed to `defineConfig` in `app.config.ts|js`
|
|
9
|
+
* @param sentrySolidStartPluginOptions Options to configure the plugin
|
|
10
|
+
* @returns The modified config to be exported and passed back into `defineConfig`
|
|
11
|
+
*/
|
|
12
|
+
export declare function withSentry(solidStartConfig: import("@solidjs/start/config").SolidStartInlineConfig | undefined, sentrySolidStartPluginOptions: SentrySolidStartPluginOptions): SolidStartInlineConfig;
|
|
13
|
+
//# sourceMappingURL=withSentry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withSentry.d.ts","sourceRoot":"","sources":["../../../src/config/withSentry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AAMnE,OAAO,KAAK,EAAgB,sBAAsB,EAAgC,MAAM,SAAS,CAAC;AAUlG;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,gBAAgB,oEAA6B,EAC7C,6BAA6B,EAAE,6BAA6B,GAC3D,sBAAsB,CA4CxB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { InputPluginOption } from 'rollup';
|
|
2
|
+
/** THIS FILE IS AN UTILITY FOR NITRO-BASED PACKAGES AND SHOULD BE KEPT IN SYNC IN NUXT, SOLIDSTART, ETC. */
|
|
3
|
+
export declare const SENTRY_WRAPPED_ENTRY = "?sentry-query-wrapped-entry";
|
|
4
|
+
export declare const SENTRY_WRAPPED_FUNCTIONS = "?sentry-query-wrapped-functions=";
|
|
5
|
+
export declare const SENTRY_REEXPORTED_FUNCTIONS = "?sentry-query-reexported-functions=";
|
|
6
|
+
export declare const QUERY_END_INDICATOR = "SENTRY-QUERY-END";
|
|
7
|
+
export type WrapServerEntryPluginOptions = {
|
|
8
|
+
serverEntrypointFileName: string;
|
|
9
|
+
serverConfigFileName: string;
|
|
10
|
+
resolvedServerConfigPath: string;
|
|
11
|
+
entrypointWrappedFunctions: string[];
|
|
12
|
+
additionalImports?: string[];
|
|
13
|
+
debug?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A Rollup plugin which wraps the server entry with a dynamic `import()`. This makes it possible to initialize Sentry first
|
|
17
|
+
* by using a regular `import` and load the server after that.
|
|
18
|
+
* This also works with serverless `handler` functions, as it re-exports the `handler`.
|
|
19
|
+
*
|
|
20
|
+
* @param config Configuration options for the Rollup Plugin
|
|
21
|
+
* @param config.serverConfigFileName Name of the Sentry server config (without file extension). E.g. 'sentry.server.config'
|
|
22
|
+
* @param config.serverEntrypointFileName The server entrypoint (with file extension). Usually, this is defined by the Nitro preset and is something like 'node-server.mjs'
|
|
23
|
+
* @param config.resolvedServerConfigPath Resolved path of the Sentry server config (based on `src` directory)
|
|
24
|
+
* @param config.entryPointWrappedFunctions Exported bindings of the server entry file, which are wrapped as async function. E.g. ['default', 'handler', 'server']
|
|
25
|
+
* @param config.additionalImports Adds additional imports to the entry file. Can be e.g. 'import-in-the-middle/hook.mjs'
|
|
26
|
+
* @param config.debug Whether debug logs are enabled in the build time environment
|
|
27
|
+
*/
|
|
28
|
+
export declare function wrapServerEntryWithDynamicImport(config: WrapServerEntryPluginOptions): InputPluginOption;
|
|
29
|
+
/**
|
|
30
|
+
* Strips the Sentry query part from a path.
|
|
31
|
+
* Example: example/path?sentry-query-wrapped-entry?sentry-query-functions-reexport=foo,SENTRY-QUERY-END -> /example/path
|
|
32
|
+
*
|
|
33
|
+
* **Only exported for testing**
|
|
34
|
+
*/
|
|
35
|
+
export declare function removeSentryQueryFromPath(url: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Extracts and sanitizes function re-export and function wrap query parameters from a query string.
|
|
38
|
+
* If it is a default export, it is not considered for re-exporting.
|
|
39
|
+
*
|
|
40
|
+
* **Only exported for testing**
|
|
41
|
+
*/
|
|
42
|
+
export declare function extractFunctionReexportQueryParameters(query: string): {
|
|
43
|
+
wrap: string[];
|
|
44
|
+
reexport: string[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Constructs a comma-separated string with all functions that need to be re-exported later from the server entry.
|
|
48
|
+
* It uses Rollup's `exportedBindings` to determine the functions to re-export. Functions which should be wrapped
|
|
49
|
+
* (e.g. serverless handlers) are wrapped by Sentry.
|
|
50
|
+
*
|
|
51
|
+
* **Only exported for testing**
|
|
52
|
+
*/
|
|
53
|
+
export declare function constructWrappedFunctionExportQuery(exportedBindings: Record<string, string[]> | null, entrypointWrappedFunctions: string[], debug?: boolean): string;
|
|
54
|
+
/**
|
|
55
|
+
* Constructs a code snippet with function reexports (can be used in Rollup plugins as a return value for `load()`)
|
|
56
|
+
*
|
|
57
|
+
* **Only exported for testing**
|
|
58
|
+
*/
|
|
59
|
+
export declare function constructFunctionReExport(pathWithQuery: string, entryId: string): string;
|
|
60
|
+
//# sourceMappingURL=wrapServerEntryWithDynamicImport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapServerEntryWithDynamicImport.d.ts","sourceRoot":"","sources":["../../../src/config/wrapServerEntryWithDynamicImport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhD,4GAA4G;AAE5G,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAClE,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAC3E,eAAO,MAAM,2BAA2B,wCAAwC,CAAC;AACjF,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD,MAAM,MAAM,4BAA4B,GAAG;IACzC,wBAAwB,EAAE,MAAM,CAAC;IACjC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wBAAwB,EAAE,MAAM,CAAC;IACjC,0BAA0B,EAAE,MAAM,EAAE,CAAC;IACrC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,4BAA4B,GAAG,iBAAiB,CAoFxG;AAED;;;;;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;;;;;;GAMG;AACH,wBAAgB,mCAAmC,CACjD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EACjD,0BAA0B,EAAE,MAAM,EAAE,EACpC,KAAK,CAAC,EAAE,OAAO,GACd,MAAM,CAmCR;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAsBxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../src/index.server.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../src/index.server.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
|