@sentry/solidstart 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/sdk.js +3 -20
- package/build/cjs/client/sdk.js.map +1 -1
- package/build/cjs/config/addInstrumentation.js +28 -91
- package/build/cjs/config/addInstrumentation.js.map +1 -1
- package/build/cjs/config/withSentry.js +28 -52
- package/build/cjs/config/withSentry.js.map +1 -1
- package/build/cjs/config/wrapServerEntryWithDynamicImport.js +52 -170
- package/build/cjs/config/wrapServerEntryWithDynamicImport.js.map +1 -1
- package/build/cjs/server/middleware.js +11 -22
- package/build/cjs/server/middleware.js.map +1 -1
- package/build/cjs/server/sdk.js +2 -7
- package/build/cjs/server/sdk.js.map +1 -1
- package/build/cjs/server/solidrouter.js +1 -20
- package/build/cjs/server/solidrouter.js.map +1 -1
- package/build/cjs/server/utils.js +6 -24
- package/build/cjs/server/utils.js.map +1 -1
- package/build/cjs/server/withServerActionInstrumentation.js +14 -31
- package/build/cjs/server/withServerActionInstrumentation.js.map +1 -1
- package/build/cjs/vite/buildInstrumentationFile.js +12 -22
- package/build/cjs/vite/buildInstrumentationFile.js.map +1 -1
- package/build/cjs/vite/sentrySolidStartVite.js +3 -15
- package/build/cjs/vite/sentrySolidStartVite.js.map +1 -1
- package/build/cjs/vite/sourceMaps.js +37 -89
- package/build/cjs/vite/sourceMaps.js.map +1 -1
- package/build/esm/client/sdk.js +3 -20
- package/build/esm/client/sdk.js.map +1 -1
- package/build/esm/config/addInstrumentation.js +28 -91
- package/build/esm/config/addInstrumentation.js.map +1 -1
- package/build/esm/config/withSentry.js +28 -52
- package/build/esm/config/withSentry.js.map +1 -1
- package/build/esm/config/wrapServerEntryWithDynamicImport.js +52 -170
- package/build/esm/config/wrapServerEntryWithDynamicImport.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/server/middleware.js +11 -22
- package/build/esm/server/middleware.js.map +1 -1
- package/build/esm/server/sdk.js +2 -7
- package/build/esm/server/sdk.js.map +1 -1
- package/build/esm/server/solidrouter.js +1 -20
- package/build/esm/server/solidrouter.js.map +1 -1
- package/build/esm/server/utils.js +6 -24
- package/build/esm/server/utils.js.map +1 -1
- package/build/esm/server/withServerActionInstrumentation.js +14 -31
- package/build/esm/server/withServerActionInstrumentation.js.map +1 -1
- package/build/esm/vite/buildInstrumentationFile.js +12 -22
- package/build/esm/vite/buildInstrumentationFile.js.map +1 -1
- package/build/esm/vite/sentrySolidStartVite.js +3 -15
- package/build/esm/vite/sentrySolidStartVite.js.map +1 -1
- package/build/esm/vite/sourceMaps.js +37 -89
- package/build/esm/vite/sourceMaps.js.map +1 -1
- package/build/types/config/withSentry.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -2,56 +2,39 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, handleCallbackErrors, SPAN_STATUS_ERR
|
|
|
2
2
|
import { getActiveSpan, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startSpan, captureException } from '@sentry/node';
|
|
3
3
|
import { isRedirect } from './utils.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
* Wraps a server action (functions that use the 'use server' directive)
|
|
7
|
-
* function body with Sentry Error and Performance instrumentation.
|
|
8
|
-
*/
|
|
9
|
-
async function withServerActionInstrumentation(
|
|
10
|
-
serverActionName,
|
|
11
|
-
callback,
|
|
12
|
-
) {
|
|
5
|
+
async function withServerActionInstrumentation(serverActionName, callback) {
|
|
13
6
|
const activeSpan = getActiveSpan();
|
|
14
|
-
|
|
15
7
|
if (activeSpan) {
|
|
16
8
|
const spanData = spanToJSON(activeSpan).data;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// if the target is `/_server`, otherwise we'd overwrite pageloads on routes that use
|
|
21
|
-
// server actions (which are more meaningful, e.g. a request to `GET /users/5` is more
|
|
22
|
-
// meaningful than overwriting it with `GET doSomeFunctionCall`).
|
|
23
|
-
if (spanData && !spanData['http.route'] && spanData['http.target'] === '/_server') {
|
|
24
|
-
activeSpan.setAttribute('http.route', serverActionName);
|
|
25
|
-
activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'component');
|
|
9
|
+
if (spanData && !spanData["http.route"] && spanData["http.target"] === "/_server") {
|
|
10
|
+
activeSpan.setAttribute("http.route", serverActionName);
|
|
11
|
+
activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, "component");
|
|
26
12
|
}
|
|
27
13
|
}
|
|
28
|
-
|
|
29
14
|
try {
|
|
30
15
|
return await startSpan(
|
|
31
16
|
{
|
|
32
|
-
op:
|
|
17
|
+
op: "function.server_action",
|
|
33
18
|
name: serverActionName,
|
|
34
19
|
attributes: {
|
|
35
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:
|
|
36
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]:
|
|
37
|
-
}
|
|
20
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.solidstart",
|
|
21
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "component"
|
|
22
|
+
}
|
|
38
23
|
},
|
|
39
|
-
async span => {
|
|
40
|
-
|
|
41
|
-
const result = await handleCallbackErrors(callback, error => {
|
|
24
|
+
async (span) => {
|
|
25
|
+
const result = await handleCallbackErrors(callback, (error) => {
|
|
42
26
|
if (!isRedirect(error)) {
|
|
43
|
-
span.setStatus({ code: SPAN_STATUS_ERROR, message:
|
|
27
|
+
span.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" });
|
|
44
28
|
captureException(error, {
|
|
45
29
|
mechanism: {
|
|
46
30
|
handled: false,
|
|
47
|
-
type:
|
|
48
|
-
}
|
|
31
|
+
type: "auto.function.solidstart"
|
|
32
|
+
}
|
|
49
33
|
});
|
|
50
34
|
}
|
|
51
35
|
});
|
|
52
|
-
|
|
53
36
|
return result;
|
|
54
|
-
}
|
|
37
|
+
}
|
|
55
38
|
);
|
|
56
39
|
} finally {
|
|
57
40
|
await flushIfServerless();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withServerActionInstrumentation.js","sources":["../../../src/server/withServerActionInstrumentation.ts"],"sourcesContent":["import {\n flushIfServerless,\n handleCallbackErrors,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n} from '@sentry/core';\nimport { captureException, getActiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, startSpan } from '@sentry/node';\nimport { isRedirect } from './utils';\n\n/**\n * Wraps a server action (functions that use the 'use server' directive)\n * function body with Sentry Error and Performance instrumentation.\n */\nexport async function withServerActionInstrumentation<A extends (...args: unknown[]) => unknown>(\n serverActionName: string,\n callback: A,\n): Promise<ReturnType<A>> {\n const activeSpan = getActiveSpan();\n\n if (activeSpan) {\n const spanData = spanToJSON(activeSpan).data;\n\n // In solid start, server function calls are made to `/_server` which doesn't tell us\n // a lot. We rewrite the span's route to be that of the sever action name but only\n // if the target is `/_server`, otherwise we'd overwrite pageloads on routes that use\n // server actions (which are more meaningful, e.g. a request to `GET /users/5` is more\n // meaningful than overwriting it with `GET doSomeFunctionCall`).\n if (spanData && !spanData['http.route'] && spanData['http.target'] === '/_server') {\n activeSpan.setAttribute('http.route', serverActionName);\n activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'component');\n }\n }\n\n try {\n return await startSpan(\n {\n op: 'function.server_action',\n name: serverActionName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n },\n },\n async span => {\n // oxlint-disable-next-line typescript/await-thenable -- callback may be async at runtime\n const result = await handleCallbackErrors(callback, error => {\n if (!isRedirect(error)) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n captureException(error, {\n mechanism: {\n handled: false,\n type: 'auto.function.solidstart',\n },\n });\n }\n });\n\n return result;\n },\n );\n } finally {\n await flushIfServerless();\n }\n}\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"withServerActionInstrumentation.js","sources":["../../../src/server/withServerActionInstrumentation.ts"],"sourcesContent":["import {\n flushIfServerless,\n handleCallbackErrors,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n} from '@sentry/core';\nimport { captureException, getActiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, startSpan } from '@sentry/node';\nimport { isRedirect } from './utils';\n\n/**\n * Wraps a server action (functions that use the 'use server' directive)\n * function body with Sentry Error and Performance instrumentation.\n */\nexport async function withServerActionInstrumentation<A extends (...args: unknown[]) => unknown>(\n serverActionName: string,\n callback: A,\n): Promise<ReturnType<A>> {\n const activeSpan = getActiveSpan();\n\n if (activeSpan) {\n const spanData = spanToJSON(activeSpan).data;\n\n // In solid start, server function calls are made to `/_server` which doesn't tell us\n // a lot. We rewrite the span's route to be that of the sever action name but only\n // if the target is `/_server`, otherwise we'd overwrite pageloads on routes that use\n // server actions (which are more meaningful, e.g. a request to `GET /users/5` is more\n // meaningful than overwriting it with `GET doSomeFunctionCall`).\n if (spanData && !spanData['http.route'] && spanData['http.target'] === '/_server') {\n activeSpan.setAttribute('http.route', serverActionName);\n activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'component');\n }\n }\n\n try {\n return await startSpan(\n {\n op: 'function.server_action',\n name: serverActionName,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n },\n },\n async span => {\n // oxlint-disable-next-line typescript/await-thenable -- callback may be async at runtime\n const result = await handleCallbackErrors(callback, error => {\n if (!isRedirect(error)) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n captureException(error, {\n mechanism: {\n handled: false,\n type: 'auto.function.solidstart',\n },\n });\n }\n });\n\n return result;\n },\n );\n } finally {\n await flushIfServerless();\n }\n}\n"],"names":[],"mappings":";;;;AAaA,eAAsB,+BAAA,CACpB,kBACA,QAAA,EACwB;AACxB,EAAA,MAAM,aAAa,aAAA,EAAc;AAEjC,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,MAAM,QAAA,GAAW,UAAA,CAAW,UAAU,CAAA,CAAE,IAAA;AAOxC,IAAA,IAAI,QAAA,IAAY,CAAC,QAAA,CAAS,YAAY,KAAK,QAAA,CAAS,aAAa,MAAM,UAAA,EAAY;AACjF,MAAA,UAAA,CAAW,YAAA,CAAa,cAAc,gBAAgB,CAAA;AACtD,MAAA,UAAA,CAAW,YAAA,CAAa,kCAAkC,WAAW,CAAA;AAAA,IACvE;AAAA,EACF;AAEA,EAAA,IAAI;AACF,IAAA,OAAO,MAAM,SAAA;AAAA,MACX;AAAA,QACE,EAAA,EAAI,wBAAA;AAAA,QACJ,IAAA,EAAM,gBAAA;AAAA,QACN,UAAA,EAAY;AAAA,UACV,CAAC,gCAAgC,GAAG,0BAAA;AAAA,UACpC,CAAC,gCAAgC,GAAG;AAAA;AACtC,OACF;AAAA,MACA,OAAM,IAAA,KAAQ;AAEZ,QAAA,MAAM,MAAA,GAAS,MAAM,oBAAA,CAAqB,QAAA,EAAU,CAAA,KAAA,KAAS;AAC3D,UAAA,IAAI,CAAC,UAAA,CAAW,KAAK,CAAA,EAAG;AACtB,YAAA,IAAA,CAAK,UAAU,EAAE,IAAA,EAAM,iBAAA,EAAmB,OAAA,EAAS,kBAAkB,CAAA;AACrE,YAAA,gBAAA,CAAiB,KAAA,EAAO;AAAA,cACtB,SAAA,EAAW;AAAA,gBACT,OAAA,EAAS,KAAA;AAAA,gBACT,IAAA,EAAM;AAAA;AACR,aACD,CAAA;AAAA,UACH;AAAA,QACF,CAAC,CAAA;AAED,QAAA,OAAO,MAAA;AAAA,MACT;AAAA,KACF;AAAA,EACF,CAAA,SAAE;AACA,IAAA,MAAM,iBAAA,EAAkB;AAAA,EAC1B;AACF;;;;"}
|
|
@@ -2,53 +2,43 @@ import { consoleSandbox } from '@sentry/core';
|
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* A Sentry plugin for SolidStart to build the server
|
|
7
|
-
* `instrument.server.ts` file.
|
|
8
|
-
*/
|
|
9
5
|
function makeBuildInstrumentationFilePlugin(options = {}) {
|
|
10
6
|
return {
|
|
11
|
-
name:
|
|
12
|
-
apply:
|
|
13
|
-
enforce:
|
|
7
|
+
name: "sentry-solidstart-build-instrumentation-file",
|
|
8
|
+
apply: "build",
|
|
9
|
+
enforce: "post",
|
|
14
10
|
async config(config, { command }) {
|
|
15
|
-
const instrumentationFilePath = options.instrumentation ||
|
|
16
|
-
const router =
|
|
11
|
+
const instrumentationFilePath = options.instrumentation || "./src/instrument.server.ts";
|
|
12
|
+
const router = config.router;
|
|
17
13
|
const build = config.build || {};
|
|
18
14
|
const rollupOptions = build.rollupOptions || {};
|
|
19
|
-
const 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') {
|
|
15
|
+
const input = [...rollupOptions.input || []];
|
|
16
|
+
if (command !== "build" || router.target !== "server" || router.name === "server-fns") {
|
|
23
17
|
return config;
|
|
24
18
|
}
|
|
25
|
-
|
|
26
19
|
try {
|
|
27
20
|
await fs.promises.access(instrumentationFilePath, fs.constants.F_OK);
|
|
28
21
|
} catch (error) {
|
|
29
22
|
consoleSandbox(() => {
|
|
30
|
-
// eslint-disable-next-line no-console
|
|
31
23
|
console.warn(
|
|
32
24
|
`[Sentry SolidStart Plugin] Could not access \`${instrumentationFilePath}\`, please make sure it exists.`,
|
|
33
|
-
error
|
|
25
|
+
error
|
|
34
26
|
);
|
|
35
27
|
});
|
|
36
28
|
return config;
|
|
37
29
|
}
|
|
38
|
-
|
|
39
30
|
input.push(path.resolve(router.root, instrumentationFilePath));
|
|
40
|
-
|
|
41
31
|
return {
|
|
42
32
|
...config,
|
|
43
33
|
build: {
|
|
44
34
|
...build,
|
|
45
35
|
rollupOptions: {
|
|
46
36
|
...rollupOptions,
|
|
47
|
-
input
|
|
48
|
-
}
|
|
49
|
-
}
|
|
37
|
+
input
|
|
38
|
+
}
|
|
39
|
+
}
|
|
50
40
|
};
|
|
51
|
-
}
|
|
41
|
+
}
|
|
52
42
|
};
|
|
53
43
|
}
|
|
54
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildInstrumentationFile.js","sources":["../../../src/vite/buildInstrumentationFile.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport * as path from 'path';\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":";;;;
|
|
1
|
+
{"version":3,"file":"buildInstrumentationFile.js","sources":["../../../src/vite/buildInstrumentationFile.ts"],"sourcesContent":["import { consoleSandbox } from '@sentry/core';\nimport * as fs from 'fs';\nimport * as path from 'path';\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":";;;;AAUO,SAAS,kCAAA,CAAmC,OAAA,GAAyC,EAAC,EAAW;AACtG,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,8CAAA;AAAA,IACN,KAAA,EAAO,OAAA;AAAA,IACP,OAAA,EAAS,MAAA;AAAA,IACT,MAAM,MAAA,CAAO,MAAA,EAAoB,EAAE,SAAQ,EAAG;AAC5C,MAAA,MAAM,uBAAA,GAA0B,QAAQ,eAAA,IAAmB,4BAAA;AAC3D,MAAA,MAAM,SAAU,MAAA,CAAmF,MAAA;AACnG,MAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,KAAA,IAAS,EAAC;AAC/B,MAAA,MAAM,aAAA,GAAgB,KAAA,CAAM,aAAA,IAAiB,EAAC;AAC9C,MAAA,MAAM,QAAQ,CAAC,GAAK,aAAA,CAAc,KAAA,IAAS,EAAgB,CAAA;AAG3D,MAAA,IAAI,YAAY,OAAA,IAAW,MAAA,CAAO,WAAW,QAAA,IAAY,MAAA,CAAO,SAAS,YAAA,EAAc;AACrF,QAAA,OAAO,MAAA;AAAA,MACT;AAEA,MAAA,IAAI;AACF,QAAA,MAAM,GAAG,QAAA,CAAS,MAAA,CAAO,uBAAA,EAAyB,EAAA,CAAG,UAAU,IAAI,CAAA;AAAA,MACrE,SAAS,KAAA,EAAO;AACd,QAAA,cAAA,CAAe,MAAM;AAEnB,UAAA,OAAA,CAAQ,IAAA;AAAA,YACN,iDAAiD,uBAAuB,CAAA,+BAAA,CAAA;AAAA,YACxE;AAAA,WACF;AAAA,QACF,CAAC,CAAA;AACD,QAAA,OAAO,MAAA;AAAA,MACT;AAEA,MAAA,KAAA,CAAM,KAAK,IAAA,CAAK,OAAA,CAAQ,MAAA,CAAO,IAAA,EAAM,uBAAuB,CAAC,CAAA;AAE7D,MAAA,OAAO;AAAA,QACL,GAAG,MAAA;AAAA,QACH,KAAA,EAAO;AAAA,UACL,GAAG,KAAA;AAAA,UACH,aAAA,EAAe;AAAA,YACb,GAAG,aAAA;AAAA,YACH;AAAA;AACF;AACF,OACF;AAAA,IACF;AAAA,GACF;AACF;;;;"}
|
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
import { makeBuildInstrumentationFilePlugin } from './buildInstrumentationFile.js';
|
|
2
2
|
import { makeAddSentryVitePlugin, makeEnableSourceMapsVitePlugin } from './sourceMaps.js';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Various Sentry vite plugins to be used for SolidStart.
|
|
6
|
-
*/
|
|
7
4
|
const sentrySolidStartVite = (options = {}, viteConfig) => {
|
|
8
5
|
const sentryPlugins = [];
|
|
9
|
-
|
|
10
|
-
if (options.autoInjectServerSentry !== 'experimental_dynamic-import') {
|
|
6
|
+
if (options.autoInjectServerSentry !== "experimental_dynamic-import") {
|
|
11
7
|
sentryPlugins.push(makeBuildInstrumentationFilePlugin(options));
|
|
12
8
|
}
|
|
13
|
-
|
|
14
|
-
if (process.env.NODE_ENV !== 'development') {
|
|
9
|
+
if (process.env.NODE_ENV !== "development") {
|
|
15
10
|
if (options.sourceMapsUploadOptions?.enabled ?? true) {
|
|
16
11
|
const sourceMapsPlugin = makeAddSentryVitePlugin(options, viteConfig);
|
|
17
12
|
const enableSourceMapsPlugin = makeEnableSourceMapsVitePlugin(options);
|
|
18
|
-
|
|
19
13
|
sentryPlugins.push(...sourceMapsPlugin, ...enableSourceMapsPlugin);
|
|
20
14
|
}
|
|
21
15
|
}
|
|
22
|
-
|
|
23
16
|
return sentryPlugins;
|
|
24
17
|
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Helper to add the Sentry SolidStart vite plugin to a vite config.
|
|
28
|
-
*/
|
|
29
18
|
const addSentryPluginToVite = (config = {}, options) => {
|
|
30
19
|
const plugins = Array.isArray(config.plugins) ? [...config.plugins] : [];
|
|
31
20
|
plugins.unshift(sentrySolidStartVite(options, config));
|
|
32
|
-
|
|
33
21
|
return {
|
|
34
22
|
...config,
|
|
35
|
-
plugins
|
|
23
|
+
plugins
|
|
36
24
|
};
|
|
37
25
|
};
|
|
38
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentrySolidStartVite.js","sources":["../../../src/vite/sentrySolidStartVite.ts"],"sourcesContent":["import type { Plugin, UserConfig } from 'vite';\nimport { makeBuildInstrumentationFilePlugin } from './buildInstrumentationFile';\nimport { makeAddSentryVitePlugin, makeEnableSourceMapsVitePlugin } 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 = {}, viteConfig: UserConfig): 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 const sourceMapsPlugin = makeAddSentryVitePlugin(options, viteConfig);\n const enableSourceMapsPlugin = makeEnableSourceMapsVitePlugin(options);\n\n sentryPlugins.push(...sourceMapsPlugin, ...enableSourceMapsPlugin);\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 plugins.unshift(sentrySolidStartVite(options, config));\n\n return {\n ...config,\n plugins,\n };\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 { makeAddSentryVitePlugin, makeEnableSourceMapsVitePlugin } 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 = {}, viteConfig: UserConfig): 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 const sourceMapsPlugin = makeAddSentryVitePlugin(options, viteConfig);\n const enableSourceMapsPlugin = makeEnableSourceMapsVitePlugin(options);\n\n sentryPlugins.push(...sourceMapsPlugin, ...enableSourceMapsPlugin);\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 plugins.unshift(sentrySolidStartVite(options, config));\n\n return {\n ...config,\n plugins,\n };\n};\n"],"names":[],"mappings":";;;AAQO,MAAM,oBAAA,GAAuB,CAAC,OAAA,GAAyC,IAAI,UAAA,KAAqC;AACrH,EAAA,MAAM,gBAA0B,EAAC;AAEjC,EAAA,IAAI,OAAA,CAAQ,2BAA2B,6BAAA,EAA+B;AACpE,IAAA,aAAA,CAAc,IAAA,CAAK,kCAAA,CAAmC,OAAO,CAAC,CAAA;AAAA,EAChE;AAEA,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,aAAA,EAAe;AAC1C,IAAA,IAAI,OAAA,CAAQ,uBAAA,EAAyB,OAAA,IAAW,IAAA,EAAM;AACpD,MAAA,MAAM,gBAAA,GAAmB,uBAAA,CAAwB,OAAA,EAAS,UAAU,CAAA;AACpE,MAAA,MAAM,sBAAA,GAAyB,+BAA+B,OAAO,CAAA;AAErE,MAAA,aAAA,CAAc,IAAA,CAAK,GAAG,gBAAA,EAAkB,GAAG,sBAAsB,CAAA;AAAA,IACnE;AAAA,EACF;AAEA,EAAA,OAAO,aAAA;AACT;AAKO,MAAM,qBAAA,GAAwB,CAAC,MAAA,GAAqB,IAAI,OAAA,KAAuD;AACpH,EAAA,MAAM,OAAA,GAAU,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO,OAAO,CAAA,GAAI,CAAC,GAAG,MAAA,CAAO,OAAO,CAAA,GAAI,EAAC;AACvE,EAAA,OAAA,CAAQ,OAAA,CAAQ,oBAAA,CAAqB,OAAA,EAAS,MAAM,CAAC,CAAA;AAErD,EAAA,OAAO;AAAA,IACL,GAAG,MAAA;AAAA,IACH;AAAA,GACF;AACF;;;;"}
|
|
@@ -1,32 +1,18 @@
|
|
|
1
1
|
import { sentryVitePlugin } from '@sentry/vite-plugin';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* A Sentry plugin for adding the @sentry/vite-plugin to automatically upload source maps to Sentry.
|
|
5
|
-
*/
|
|
6
3
|
function makeAddSentryVitePlugin(options, viteConfig) {
|
|
7
4
|
const { authToken, debug, org, project, sourceMapsUploadOptions } = options;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// For .output, .vercel, .netlify etc.
|
|
19
|
-
updatedFilesToDeleteAfterUpload = ['.*/**/*.map'];
|
|
20
|
-
|
|
21
|
-
debug &&
|
|
22
|
-
// eslint-disable-next-line no-console
|
|
23
|
-
console.log(
|
|
24
|
-
`[Sentry] Automatically setting \`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(
|
|
25
|
-
updatedFilesToDeleteAfterUpload,
|
|
26
|
-
)}\` to delete generated source maps after they were uploaded to Sentry.`,
|
|
27
|
-
);
|
|
5
|
+
let updatedFilesToDeleteAfterUpload = void 0;
|
|
6
|
+
if (typeof sourceMapsUploadOptions?.filesToDeleteAfterUpload === "undefined" && typeof sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload === "undefined" && // Only if source maps were previously not set, we update the "filesToDeleteAfterUpload" (as we override the setting with "hidden")
|
|
7
|
+
typeof viteConfig.build?.sourcemap === "undefined") {
|
|
8
|
+
updatedFilesToDeleteAfterUpload = [".*/**/*.map"];
|
|
9
|
+
debug && // eslint-disable-next-line no-console
|
|
10
|
+
console.log(
|
|
11
|
+
`[Sentry] Automatically setting \`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(
|
|
12
|
+
updatedFilesToDeleteAfterUpload
|
|
13
|
+
)}\` to delete generated source maps after they were uploaded to Sentry.`
|
|
14
|
+
);
|
|
28
15
|
}
|
|
29
|
-
|
|
30
16
|
return [
|
|
31
17
|
...sentryVitePlugin({
|
|
32
18
|
authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,
|
|
@@ -35,103 +21,65 @@ function makeAddSentryVitePlugin(options, viteConfig) {
|
|
|
35
21
|
org: org ?? process.env.SENTRY_ORG,
|
|
36
22
|
project: project ?? process.env.SENTRY_PROJECT,
|
|
37
23
|
sourcemaps: {
|
|
38
|
-
filesToDeleteAfterUpload:
|
|
39
|
-
|
|
40
|
-
sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload) ??
|
|
41
|
-
updatedFilesToDeleteAfterUpload,
|
|
42
|
-
...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps,
|
|
24
|
+
filesToDeleteAfterUpload: (sourceMapsUploadOptions?.filesToDeleteAfterUpload || sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload) ?? updatedFilesToDeleteAfterUpload,
|
|
25
|
+
...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps
|
|
43
26
|
},
|
|
44
27
|
telemetry: sourceMapsUploadOptions?.telemetry ?? true,
|
|
45
28
|
_metaOptions: {
|
|
46
29
|
telemetry: {
|
|
47
|
-
metaFramework:
|
|
48
|
-
}
|
|
30
|
+
metaFramework: "solidstart"
|
|
31
|
+
}
|
|
49
32
|
},
|
|
50
|
-
...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions
|
|
51
|
-
})
|
|
33
|
+
...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions
|
|
34
|
+
})
|
|
52
35
|
];
|
|
53
36
|
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* A Sentry plugin for SolidStart to enable "hidden" source maps if they are unset.
|
|
57
|
-
*/
|
|
58
37
|
function makeEnableSourceMapsVitePlugin(options) {
|
|
59
38
|
return [
|
|
60
39
|
{
|
|
61
|
-
name:
|
|
62
|
-
apply:
|
|
63
|
-
enforce:
|
|
40
|
+
name: "sentry-solidstart-update-source-map-setting",
|
|
41
|
+
apply: "build",
|
|
42
|
+
enforce: "post",
|
|
64
43
|
config(viteConfig) {
|
|
65
44
|
return {
|
|
66
45
|
...viteConfig,
|
|
67
46
|
build: {
|
|
68
47
|
...viteConfig.build,
|
|
69
|
-
sourcemap: getUpdatedSourceMapSettings(viteConfig, options)
|
|
70
|
-
}
|
|
48
|
+
sourcemap: getUpdatedSourceMapSettings(viteConfig, options)
|
|
49
|
+
}
|
|
71
50
|
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
74
53
|
];
|
|
75
54
|
}
|
|
76
|
-
|
|
77
|
-
/** There are 3 ways to set up source map generation (https://github.com/getsentry/sentry-javascript/issues/13993)
|
|
78
|
-
*
|
|
79
|
-
* 1. User explicitly disabled source maps
|
|
80
|
-
* - keep this setting (emit a warning that errors won't be unminified in Sentry)
|
|
81
|
-
* - We won't upload anything
|
|
82
|
-
*
|
|
83
|
-
* 2. Users enabled source map generation (true, 'hidden', 'inline').
|
|
84
|
-
* - keep this setting (don't do anything - like deletion - besides uploading)
|
|
85
|
-
*
|
|
86
|
-
* 3. Users didn't set source maps generation
|
|
87
|
-
* - we enable 'hidden' source maps generation
|
|
88
|
-
* - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)
|
|
89
|
-
*
|
|
90
|
-
* --> only exported for testing
|
|
91
|
-
*/
|
|
92
|
-
function getUpdatedSourceMapSettings(
|
|
93
|
-
viteConfig,
|
|
94
|
-
sentryPluginOptions,
|
|
95
|
-
) {
|
|
55
|
+
function getUpdatedSourceMapSettings(viteConfig, sentryPluginOptions) {
|
|
96
56
|
viteConfig.build = viteConfig.build || {};
|
|
97
|
-
|
|
98
57
|
const viteSourceMap = viteConfig?.build?.sourcemap;
|
|
99
58
|
let updatedSourceMapSetting = viteSourceMap;
|
|
100
|
-
|
|
101
|
-
const settingKey = 'vite.build.sourcemap';
|
|
59
|
+
const settingKey = "vite.build.sourcemap";
|
|
102
60
|
const debug = sentryPluginOptions?.debug;
|
|
103
|
-
|
|
104
61
|
if (viteSourceMap === false) {
|
|
105
62
|
updatedSourceMapSetting = viteSourceMap;
|
|
106
|
-
|
|
107
63
|
if (debug) {
|
|
108
|
-
// Longer debug message with more details
|
|
109
|
-
// eslint-disable-next-line no-console
|
|
110
64
|
console.warn(
|
|
111
|
-
`[Sentry] Source map generation is currently disabled in your SolidStart configuration (\`${settingKey}: false \`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \`${settingKey}\` (e.g. by setting them to \`hidden\`)
|
|
65
|
+
`[Sentry] Source map generation is currently disabled in your SolidStart configuration (\`${settingKey}: false \`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \`${settingKey}\` (e.g. by setting them to \`hidden\`).`
|
|
112
66
|
);
|
|
113
67
|
} else {
|
|
114
|
-
|
|
115
|
-
console.warn('[Sentry] Source map generation is disabled in your SolidStart configuration.');
|
|
68
|
+
console.warn("[Sentry] Source map generation is disabled in your SolidStart configuration.");
|
|
116
69
|
}
|
|
117
|
-
} else if (viteSourceMap && [
|
|
70
|
+
} else if (viteSourceMap && ["hidden", "inline", true].includes(viteSourceMap)) {
|
|
118
71
|
updatedSourceMapSetting = viteSourceMap;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
`[Sentry] We discovered \`${settingKey}\` is set to \`${viteSourceMap.toString()}\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,
|
|
124
|
-
);
|
|
72
|
+
debug && // eslint-disable-next-line no-console
|
|
73
|
+
console.log(
|
|
74
|
+
`[Sentry] We discovered \`${settingKey}\` is set to \`${viteSourceMap.toString()}\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`
|
|
75
|
+
);
|
|
125
76
|
} else {
|
|
126
|
-
updatedSourceMapSetting =
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
`[Sentry] Enabled source map generation in the build options with \`${settingKey}: 'hidden'\`. The source maps will be deleted after they were uploaded to Sentry.`,
|
|
132
|
-
);
|
|
77
|
+
updatedSourceMapSetting = "hidden";
|
|
78
|
+
debug && // eslint-disable-next-line no-console
|
|
79
|
+
console.log(
|
|
80
|
+
`[Sentry] Enabled source map generation in the build options with \`${settingKey}: 'hidden'\`. The source maps will be deleted after they were uploaded to Sentry.`
|
|
81
|
+
);
|
|
133
82
|
}
|
|
134
|
-
|
|
135
83
|
return updatedSourceMapSetting;
|
|
136
84
|
}
|
|
137
85
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import { sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * A Sentry plugin for adding the @sentry/vite-plugin to automatically upload source maps to Sentry.\n */\nexport function makeAddSentryVitePlugin(options: SentrySolidStartPluginOptions, viteConfig: UserConfig): Plugin[] {\n const { authToken, debug, org, project, sourceMapsUploadOptions } = options;\n\n let updatedFilesToDeleteAfterUpload: string[] | undefined = undefined;\n\n if (\n typeof sourceMapsUploadOptions?.filesToDeleteAfterUpload === 'undefined' &&\n typeof sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload ===\n 'undefined' &&\n // Only if source maps were previously not set, we update the \"filesToDeleteAfterUpload\" (as we override the setting with \"hidden\")\n typeof viteConfig.build?.sourcemap === 'undefined'\n ) {\n // For .output, .vercel, .netlify etc.\n updatedFilesToDeleteAfterUpload = ['.*/**/*.map'];\n\n debug &&\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Automatically setting \\`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(\n updatedFilesToDeleteAfterUpload,\n )}\\` to delete generated source maps after they were uploaded to Sentry.`,\n );\n }\n\n return [\n ...sentryVitePlugin({\n authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,\n bundleSizeOptimizations: options.bundleSizeOptimizations,\n debug: debug ?? false,\n org: org ?? process.env.SENTRY_ORG,\n project: project ?? process.env.SENTRY_PROJECT,\n sourcemaps: {\n filesToDeleteAfterUpload:\n (sourceMapsUploadOptions?.filesToDeleteAfterUpload ||\n sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload) ??\n updatedFilesToDeleteAfterUpload,\n ...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps,\n },\n telemetry: sourceMapsUploadOptions?.telemetry ?? true,\n _metaOptions: {\n telemetry: {\n metaFramework: 'solidstart',\n },\n },\n ...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions,\n }),\n ];\n}\n\n/**\n * A Sentry plugin for SolidStart to enable \"hidden\" source maps if they are unset.\n */\nexport function makeEnableSourceMapsVitePlugin(options: SentrySolidStartPluginOptions): Plugin[] {\n return [\n {\n name: 'sentry-solidstart-update-source-map-setting',\n apply: 'build',\n enforce: 'post',\n config(viteConfig) {\n return {\n ...viteConfig,\n build: {\n ...viteConfig.build,\n sourcemap: getUpdatedSourceMapSettings(viteConfig, options),\n },\n };\n },\n },\n ];\n}\n\n/** There are 3 ways to set up source map generation (https://github.com/getsentry/sentry-javascript/issues/13993)\n *\n * 1. User explicitly disabled source maps\n * - keep this setting (emit a warning that errors won't be unminified in Sentry)\n * - We won't upload anything\n *\n * 2. Users enabled source map generation (true, 'hidden', 'inline').\n * - keep this setting (don't do anything - like deletion - besides uploading)\n *\n * 3. Users didn't set source maps generation\n * - we enable 'hidden' source maps generation\n * - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)\n *\n * --> only exported for testing\n */\nexport function getUpdatedSourceMapSettings(\n viteConfig: UserConfig,\n sentryPluginOptions?: SentrySolidStartPluginOptions,\n): boolean | 'inline' | 'hidden' {\n viteConfig.build = viteConfig.build || {};\n\n const viteSourceMap = viteConfig?.build?.sourcemap;\n let updatedSourceMapSetting = viteSourceMap;\n\n const settingKey = 'vite.build.sourcemap';\n const debug = sentryPluginOptions?.debug;\n\n if (viteSourceMap === false) {\n updatedSourceMapSetting = viteSourceMap;\n\n if (debug) {\n // Longer debug message with more details\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation is currently disabled in your SolidStart configuration (\\`${settingKey}: false \\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \\`${settingKey}\\` (e.g. by setting them to \\`hidden\\`).`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Source map generation is disabled in your SolidStart configuration.');\n }\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n updatedSourceMapSetting = viteSourceMap;\n\n debug &&\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${viteSourceMap.toString()}\\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,\n );\n } else {\n updatedSourceMapSetting = 'hidden';\n\n debug &&\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Enabled source map generation in the build options with \\`${settingKey}: 'hidden'\\`. The source maps will be deleted after they were uploaded to Sentry.`,\n );\n }\n\n return updatedSourceMapSetting;\n}\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"sourceMaps.js","sources":["../../../src/vite/sourceMaps.ts"],"sourcesContent":["import { sentryVitePlugin } from '@sentry/vite-plugin';\nimport type { Plugin, UserConfig } from 'vite';\nimport type { SentrySolidStartPluginOptions } from './types';\n\n/**\n * A Sentry plugin for adding the @sentry/vite-plugin to automatically upload source maps to Sentry.\n */\nexport function makeAddSentryVitePlugin(options: SentrySolidStartPluginOptions, viteConfig: UserConfig): Plugin[] {\n const { authToken, debug, org, project, sourceMapsUploadOptions } = options;\n\n let updatedFilesToDeleteAfterUpload: string[] | undefined = undefined;\n\n if (\n typeof sourceMapsUploadOptions?.filesToDeleteAfterUpload === 'undefined' &&\n typeof sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload ===\n 'undefined' &&\n // Only if source maps were previously not set, we update the \"filesToDeleteAfterUpload\" (as we override the setting with \"hidden\")\n typeof viteConfig.build?.sourcemap === 'undefined'\n ) {\n // For .output, .vercel, .netlify etc.\n updatedFilesToDeleteAfterUpload = ['.*/**/*.map'];\n\n debug &&\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Automatically setting \\`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(\n updatedFilesToDeleteAfterUpload,\n )}\\` to delete generated source maps after they were uploaded to Sentry.`,\n );\n }\n\n return [\n ...sentryVitePlugin({\n authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,\n bundleSizeOptimizations: options.bundleSizeOptimizations,\n debug: debug ?? false,\n org: org ?? process.env.SENTRY_ORG,\n project: project ?? process.env.SENTRY_PROJECT,\n sourcemaps: {\n filesToDeleteAfterUpload:\n (sourceMapsUploadOptions?.filesToDeleteAfterUpload ||\n sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload) ??\n updatedFilesToDeleteAfterUpload,\n ...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps,\n },\n telemetry: sourceMapsUploadOptions?.telemetry ?? true,\n _metaOptions: {\n telemetry: {\n metaFramework: 'solidstart',\n },\n },\n ...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions,\n }),\n ];\n}\n\n/**\n * A Sentry plugin for SolidStart to enable \"hidden\" source maps if they are unset.\n */\nexport function makeEnableSourceMapsVitePlugin(options: SentrySolidStartPluginOptions): Plugin[] {\n return [\n {\n name: 'sentry-solidstart-update-source-map-setting',\n apply: 'build',\n enforce: 'post',\n config(viteConfig) {\n return {\n ...viteConfig,\n build: {\n ...viteConfig.build,\n sourcemap: getUpdatedSourceMapSettings(viteConfig, options),\n },\n };\n },\n },\n ];\n}\n\n/** There are 3 ways to set up source map generation (https://github.com/getsentry/sentry-javascript/issues/13993)\n *\n * 1. User explicitly disabled source maps\n * - keep this setting (emit a warning that errors won't be unminified in Sentry)\n * - We won't upload anything\n *\n * 2. Users enabled source map generation (true, 'hidden', 'inline').\n * - keep this setting (don't do anything - like deletion - besides uploading)\n *\n * 3. Users didn't set source maps generation\n * - we enable 'hidden' source maps generation\n * - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)\n *\n * --> only exported for testing\n */\nexport function getUpdatedSourceMapSettings(\n viteConfig: UserConfig,\n sentryPluginOptions?: SentrySolidStartPluginOptions,\n): boolean | 'inline' | 'hidden' {\n viteConfig.build = viteConfig.build || {};\n\n const viteSourceMap = viteConfig?.build?.sourcemap;\n let updatedSourceMapSetting = viteSourceMap;\n\n const settingKey = 'vite.build.sourcemap';\n const debug = sentryPluginOptions?.debug;\n\n if (viteSourceMap === false) {\n updatedSourceMapSetting = viteSourceMap;\n\n if (debug) {\n // Longer debug message with more details\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] Source map generation is currently disabled in your SolidStart configuration (\\`${settingKey}: false \\`). This setting is either a default setting or was explicitly set in your configuration. Sentry won't override this setting. Without source maps, code snippets on the Sentry Issues page will remain minified. To show unminified code, enable source maps in \\`${settingKey}\\` (e.g. by setting them to \\`hidden\\`).`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Source map generation is disabled in your SolidStart configuration.');\n }\n } else if (viteSourceMap && ['hidden', 'inline', true].includes(viteSourceMap)) {\n updatedSourceMapSetting = viteSourceMap;\n\n debug &&\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] We discovered \\`${settingKey}\\` is set to \\`${viteSourceMap.toString()}\\`. Sentry will keep this source map setting. This will un-minify the code snippet on the Sentry Issue page.`,\n );\n } else {\n updatedSourceMapSetting = 'hidden';\n\n debug &&\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Enabled source map generation in the build options with \\`${settingKey}: 'hidden'\\`. The source maps will be deleted after they were uploaded to Sentry.`,\n );\n }\n\n return updatedSourceMapSetting;\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -1 +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,EAAE,sBAAsB,YAAK,EAC7C,6BAA6B,EAAE,6BAA6B,GAC3D,sBAAsB,
|
|
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,EAAE,sBAAsB,YAAK,EAC7C,6BAA6B,EAAE,6BAA6B,GAC3D,sBAAsB,CA+CxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/solidstart",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.54.0",
|
|
4
4
|
"description": "Official Sentry SDK for Solid Start",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/solidstart",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@sentry/core": "10.
|
|
70
|
-
"@sentry/node": "10.
|
|
71
|
-
"@sentry/solid": "10.
|
|
69
|
+
"@sentry/core": "10.54.0",
|
|
70
|
+
"@sentry/node": "10.54.0",
|
|
71
|
+
"@sentry/solid": "10.54.0",
|
|
72
72
|
"@sentry/vite-plugin": "^5.3.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|