@sentry/solidstart 10.53.1 → 10.55.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
|
@@ -4,56 +4,39 @@ const core = require('@sentry/core');
|
|
|
4
4
|
const node = require('@sentry/node');
|
|
5
5
|
const utils = require('./utils.js');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
* Wraps a server action (functions that use the 'use server' directive)
|
|
9
|
-
* function body with Sentry Error and Performance instrumentation.
|
|
10
|
-
*/
|
|
11
|
-
async function withServerActionInstrumentation(
|
|
12
|
-
serverActionName,
|
|
13
|
-
callback,
|
|
14
|
-
) {
|
|
7
|
+
async function withServerActionInstrumentation(serverActionName, callback) {
|
|
15
8
|
const activeSpan = node.getActiveSpan();
|
|
16
|
-
|
|
17
9
|
if (activeSpan) {
|
|
18
10
|
const spanData = node.spanToJSON(activeSpan).data;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// if the target is `/_server`, otherwise we'd overwrite pageloads on routes that use
|
|
23
|
-
// server actions (which are more meaningful, e.g. a request to `GET /users/5` is more
|
|
24
|
-
// meaningful than overwriting it with `GET doSomeFunctionCall`).
|
|
25
|
-
if (spanData && !spanData['http.route'] && spanData['http.target'] === '/_server') {
|
|
26
|
-
activeSpan.setAttribute('http.route', serverActionName);
|
|
27
|
-
activeSpan.setAttribute(node.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'component');
|
|
11
|
+
if (spanData && !spanData["http.route"] && spanData["http.target"] === "/_server") {
|
|
12
|
+
activeSpan.setAttribute("http.route", serverActionName);
|
|
13
|
+
activeSpan.setAttribute(node.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, "component");
|
|
28
14
|
}
|
|
29
15
|
}
|
|
30
|
-
|
|
31
16
|
try {
|
|
32
17
|
return await node.startSpan(
|
|
33
18
|
{
|
|
34
|
-
op:
|
|
19
|
+
op: "function.server_action",
|
|
35
20
|
name: serverActionName,
|
|
36
21
|
attributes: {
|
|
37
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:
|
|
38
|
-
[node.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]:
|
|
39
|
-
}
|
|
22
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.solidstart",
|
|
23
|
+
[node.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "component"
|
|
24
|
+
}
|
|
40
25
|
},
|
|
41
|
-
async span => {
|
|
42
|
-
|
|
43
|
-
const result = await core.handleCallbackErrors(callback, error => {
|
|
26
|
+
async (span) => {
|
|
27
|
+
const result = await core.handleCallbackErrors(callback, (error) => {
|
|
44
28
|
if (!utils.isRedirect(error)) {
|
|
45
|
-
span.setStatus({ code: core.SPAN_STATUS_ERROR, message:
|
|
29
|
+
span.setStatus({ code: core.SPAN_STATUS_ERROR, message: "internal_error" });
|
|
46
30
|
node.captureException(error, {
|
|
47
31
|
mechanism: {
|
|
48
32
|
handled: false,
|
|
49
|
-
type:
|
|
50
|
-
}
|
|
33
|
+
type: "auto.function.solidstart"
|
|
34
|
+
}
|
|
51
35
|
});
|
|
52
36
|
}
|
|
53
37
|
});
|
|
54
|
-
|
|
55
38
|
return result;
|
|
56
|
-
}
|
|
39
|
+
}
|
|
57
40
|
);
|
|
58
41
|
} finally {
|
|
59
42
|
await core.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":["getActiveSpan","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","startSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","handleCallbackErrors","isRedirect","SPAN_STATUS_ERROR","captureException","flushIfServerless"],"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":["getActiveSpan","spanToJSON","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","startSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","handleCallbackErrors","isRedirect","SPAN_STATUS_ERROR","captureException","flushIfServerless"],"mappings":";;;;;;AAaA,eAAsB,+BAAA,CACpB,kBACA,QAAA,EACwB;AACxB,EAAA,MAAM,aAAaA,kBAAA,EAAc;AAEjC,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,MAAM,QAAA,GAAWC,eAAA,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,CAAaC,uCAAkC,WAAW,CAAA;AAAA,IACvE;AAAA,EACF;AAEA,EAAA,IAAI;AACF,IAAA,OAAO,MAAMC,cAAA;AAAA,MACX;AAAA,QACE,EAAA,EAAI,wBAAA;AAAA,QACJ,IAAA,EAAM,gBAAA;AAAA,QACN,UAAA,EAAY;AAAA,UACV,CAACC,qCAAgC,GAAG,0BAAA;AAAA,UACpC,CAACF,qCAAgC,GAAG;AAAA;AACtC,OACF;AAAA,MACA,OAAM,IAAA,KAAQ;AAEZ,QAAA,MAAM,MAAA,GAAS,MAAMG,yBAAA,CAAqB,QAAA,EAAU,CAAA,KAAA,KAAS;AAC3D,UAAA,IAAI,CAACC,gBAAA,CAAW,KAAK,CAAA,EAAG;AACtB,YAAA,IAAA,CAAK,UAAU,EAAE,IAAA,EAAMC,sBAAA,EAAmB,OAAA,EAAS,kBAAkB,CAAA;AACrE,YAAAC,qBAAA,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,MAAMC,sBAAA,EAAkB;AAAA,EAC1B;AACF;;;;"}
|
|
@@ -4,53 +4,43 @@ const core = require('@sentry/core');
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* A Sentry plugin for SolidStart to build the server
|
|
9
|
-
* `instrument.server.ts` file.
|
|
10
|
-
*/
|
|
11
7
|
function makeBuildInstrumentationFilePlugin(options = {}) {
|
|
12
8
|
return {
|
|
13
|
-
name:
|
|
14
|
-
apply:
|
|
15
|
-
enforce:
|
|
9
|
+
name: "sentry-solidstart-build-instrumentation-file",
|
|
10
|
+
apply: "build",
|
|
11
|
+
enforce: "post",
|
|
16
12
|
async config(config, { command }) {
|
|
17
|
-
const instrumentationFilePath = options.instrumentation ||
|
|
18
|
-
const router =
|
|
13
|
+
const instrumentationFilePath = options.instrumentation || "./src/instrument.server.ts";
|
|
14
|
+
const router = config.router;
|
|
19
15
|
const build = config.build || {};
|
|
20
16
|
const rollupOptions = build.rollupOptions || {};
|
|
21
|
-
const input = [...
|
|
22
|
-
|
|
23
|
-
// plugin runs for client, server and sever-fns, we only want to run it for the server once.
|
|
24
|
-
if (command !== 'build' || router.target !== 'server' || router.name === 'server-fns') {
|
|
17
|
+
const input = [...rollupOptions.input || []];
|
|
18
|
+
if (command !== "build" || router.target !== "server" || router.name === "server-fns") {
|
|
25
19
|
return config;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
try {
|
|
29
22
|
await fs.promises.access(instrumentationFilePath, fs.constants.F_OK);
|
|
30
23
|
} catch (error) {
|
|
31
24
|
core.consoleSandbox(() => {
|
|
32
|
-
// eslint-disable-next-line no-console
|
|
33
25
|
console.warn(
|
|
34
26
|
`[Sentry SolidStart Plugin] Could not access \`${instrumentationFilePath}\`, please make sure it exists.`,
|
|
35
|
-
error
|
|
27
|
+
error
|
|
36
28
|
);
|
|
37
29
|
});
|
|
38
30
|
return config;
|
|
39
31
|
}
|
|
40
|
-
|
|
41
32
|
input.push(path.resolve(router.root, instrumentationFilePath));
|
|
42
|
-
|
|
43
33
|
return {
|
|
44
34
|
...config,
|
|
45
35
|
build: {
|
|
46
36
|
...build,
|
|
47
37
|
rollupOptions: {
|
|
48
38
|
...rollupOptions,
|
|
49
|
-
input
|
|
50
|
-
}
|
|
51
|
-
}
|
|
39
|
+
input
|
|
40
|
+
}
|
|
41
|
+
}
|
|
52
42
|
};
|
|
53
|
-
}
|
|
43
|
+
}
|
|
54
44
|
};
|
|
55
45
|
}
|
|
56
46
|
|
|
@@ -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":["consoleSandbox"],"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 rollupOpt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AA,UACL,GAAG,KAAA;AAAA,UACH,aAAA,EAAe;AAAA,YACb,GAAG,aAAA;AAAA,YACH;AAAA;AACF;AACF,OACF;AAAA,IACF;AAAA,GACF;AACF;;;;"}
|
|
@@ -3,38 +3,26 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3
3
|
const buildInstrumentationFile = require('./buildInstrumentationFile.js');
|
|
4
4
|
const sourceMaps = require('./sourceMaps.js');
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Various Sentry vite plugins to be used for SolidStart.
|
|
8
|
-
*/
|
|
9
6
|
const sentrySolidStartVite = (options = {}, viteConfig) => {
|
|
10
7
|
const sentryPlugins = [];
|
|
11
|
-
|
|
12
|
-
if (options.autoInjectServerSentry !== 'experimental_dynamic-import') {
|
|
8
|
+
if (options.autoInjectServerSentry !== "experimental_dynamic-import") {
|
|
13
9
|
sentryPlugins.push(buildInstrumentationFile.makeBuildInstrumentationFilePlugin(options));
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
if (process.env.NODE_ENV !== 'development') {
|
|
11
|
+
if (process.env.NODE_ENV !== "development") {
|
|
17
12
|
if (options.sourceMapsUploadOptions?.enabled ?? true) {
|
|
18
13
|
const sourceMapsPlugin = sourceMaps.makeAddSentryVitePlugin(options, viteConfig);
|
|
19
14
|
const enableSourceMapsPlugin = sourceMaps.makeEnableSourceMapsVitePlugin(options);
|
|
20
|
-
|
|
21
15
|
sentryPlugins.push(...sourceMapsPlugin, ...enableSourceMapsPlugin);
|
|
22
16
|
}
|
|
23
17
|
}
|
|
24
|
-
|
|
25
18
|
return sentryPlugins;
|
|
26
19
|
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Helper to add the Sentry SolidStart vite plugin to a vite config.
|
|
30
|
-
*/
|
|
31
20
|
const addSentryPluginToVite = (config = {}, options) => {
|
|
32
21
|
const plugins = Array.isArray(config.plugins) ? [...config.plugins] : [];
|
|
33
22
|
plugins.unshift(sentrySolidStartVite(options, config));
|
|
34
|
-
|
|
35
23
|
return {
|
|
36
24
|
...config,
|
|
37
|
-
plugins
|
|
25
|
+
plugins
|
|
38
26
|
};
|
|
39
27
|
};
|
|
40
28
|
|
|
@@ -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":["makeBuildInstrumentationFilePlugin","makeAddSentryVitePlugin","makeEnableSourceMapsVitePlugin"],"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":["makeBuildInstrumentationFilePlugin","makeAddSentryVitePlugin","makeEnableSourceMapsVitePlugin"],"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,CAAKA,2DAAA,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,GAAmBC,kCAAA,CAAwB,OAAA,EAAS,UAAU,CAAA;AACpE,MAAA,MAAM,sBAAA,GAAyBC,0CAA+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;;;;;"}
|
|
@@ -2,33 +2,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
|
|
3
3
|
const vitePlugin = require('@sentry/vite-plugin');
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* A Sentry plugin for adding the @sentry/vite-plugin to automatically upload source maps to Sentry.
|
|
7
|
-
*/
|
|
8
5
|
function makeAddSentryVitePlugin(options, viteConfig) {
|
|
9
6
|
const { authToken, debug, org, project, sourceMapsUploadOptions } = options;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// For .output, .vercel, .netlify etc.
|
|
21
|
-
updatedFilesToDeleteAfterUpload = ['.*/**/*.map'];
|
|
22
|
-
|
|
23
|
-
debug &&
|
|
24
|
-
// eslint-disable-next-line no-console
|
|
25
|
-
console.log(
|
|
26
|
-
`[Sentry] Automatically setting \`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(
|
|
27
|
-
updatedFilesToDeleteAfterUpload,
|
|
28
|
-
)}\` to delete generated source maps after they were uploaded to Sentry.`,
|
|
29
|
-
);
|
|
7
|
+
let updatedFilesToDeleteAfterUpload = void 0;
|
|
8
|
+
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")
|
|
9
|
+
typeof viteConfig.build?.sourcemap === "undefined") {
|
|
10
|
+
updatedFilesToDeleteAfterUpload = [".*/**/*.map"];
|
|
11
|
+
debug && // eslint-disable-next-line no-console
|
|
12
|
+
console.log(
|
|
13
|
+
`[Sentry] Automatically setting \`sourceMapsUploadOptions.filesToDeleteAfterUpload: ${JSON.stringify(
|
|
14
|
+
updatedFilesToDeleteAfterUpload
|
|
15
|
+
)}\` to delete generated source maps after they were uploaded to Sentry.`
|
|
16
|
+
);
|
|
30
17
|
}
|
|
31
|
-
|
|
32
18
|
return [
|
|
33
19
|
...vitePlugin.sentryVitePlugin({
|
|
34
20
|
authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,
|
|
@@ -37,103 +23,65 @@ function makeAddSentryVitePlugin(options, viteConfig) {
|
|
|
37
23
|
org: org ?? process.env.SENTRY_ORG,
|
|
38
24
|
project: project ?? process.env.SENTRY_PROJECT,
|
|
39
25
|
sourcemaps: {
|
|
40
|
-
filesToDeleteAfterUpload:
|
|
41
|
-
|
|
42
|
-
sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload) ??
|
|
43
|
-
updatedFilesToDeleteAfterUpload,
|
|
44
|
-
...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps,
|
|
26
|
+
filesToDeleteAfterUpload: (sourceMapsUploadOptions?.filesToDeleteAfterUpload || sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps?.filesToDeleteAfterUpload) ?? updatedFilesToDeleteAfterUpload,
|
|
27
|
+
...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions?.sourcemaps
|
|
45
28
|
},
|
|
46
29
|
telemetry: sourceMapsUploadOptions?.telemetry ?? true,
|
|
47
30
|
_metaOptions: {
|
|
48
31
|
telemetry: {
|
|
49
|
-
metaFramework:
|
|
50
|
-
}
|
|
32
|
+
metaFramework: "solidstart"
|
|
33
|
+
}
|
|
51
34
|
},
|
|
52
|
-
...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions
|
|
53
|
-
})
|
|
35
|
+
...sourceMapsUploadOptions?.unstable_sentryVitePluginOptions
|
|
36
|
+
})
|
|
54
37
|
];
|
|
55
38
|
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* A Sentry plugin for SolidStart to enable "hidden" source maps if they are unset.
|
|
59
|
-
*/
|
|
60
39
|
function makeEnableSourceMapsVitePlugin(options) {
|
|
61
40
|
return [
|
|
62
41
|
{
|
|
63
|
-
name:
|
|
64
|
-
apply:
|
|
65
|
-
enforce:
|
|
42
|
+
name: "sentry-solidstart-update-source-map-setting",
|
|
43
|
+
apply: "build",
|
|
44
|
+
enforce: "post",
|
|
66
45
|
config(viteConfig) {
|
|
67
46
|
return {
|
|
68
47
|
...viteConfig,
|
|
69
48
|
build: {
|
|
70
49
|
...viteConfig.build,
|
|
71
|
-
sourcemap: getUpdatedSourceMapSettings(viteConfig, options)
|
|
72
|
-
}
|
|
50
|
+
sourcemap: getUpdatedSourceMapSettings(viteConfig, options)
|
|
51
|
+
}
|
|
73
52
|
};
|
|
74
|
-
}
|
|
75
|
-
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
76
55
|
];
|
|
77
56
|
}
|
|
78
|
-
|
|
79
|
-
/** There are 3 ways to set up source map generation (https://github.com/getsentry/sentry-javascript/issues/13993)
|
|
80
|
-
*
|
|
81
|
-
* 1. User explicitly disabled source maps
|
|
82
|
-
* - keep this setting (emit a warning that errors won't be unminified in Sentry)
|
|
83
|
-
* - We won't upload anything
|
|
84
|
-
*
|
|
85
|
-
* 2. Users enabled source map generation (true, 'hidden', 'inline').
|
|
86
|
-
* - keep this setting (don't do anything - like deletion - besides uploading)
|
|
87
|
-
*
|
|
88
|
-
* 3. Users didn't set source maps generation
|
|
89
|
-
* - we enable 'hidden' source maps generation
|
|
90
|
-
* - configure `filesToDeleteAfterUpload` to delete all .map files (we emit a log about this)
|
|
91
|
-
*
|
|
92
|
-
* --> only exported for testing
|
|
93
|
-
*/
|
|
94
|
-
function getUpdatedSourceMapSettings(
|
|
95
|
-
viteConfig,
|
|
96
|
-
sentryPluginOptions,
|
|
97
|
-
) {
|
|
57
|
+
function getUpdatedSourceMapSettings(viteConfig, sentryPluginOptions) {
|
|
98
58
|
viteConfig.build = viteConfig.build || {};
|
|
99
|
-
|
|
100
59
|
const viteSourceMap = viteConfig?.build?.sourcemap;
|
|
101
60
|
let updatedSourceMapSetting = viteSourceMap;
|
|
102
|
-
|
|
103
|
-
const settingKey = 'vite.build.sourcemap';
|
|
61
|
+
const settingKey = "vite.build.sourcemap";
|
|
104
62
|
const debug = sentryPluginOptions?.debug;
|
|
105
|
-
|
|
106
63
|
if (viteSourceMap === false) {
|
|
107
64
|
updatedSourceMapSetting = viteSourceMap;
|
|
108
|
-
|
|
109
65
|
if (debug) {
|
|
110
|
-
// Longer debug message with more details
|
|
111
|
-
// eslint-disable-next-line no-console
|
|
112
66
|
console.warn(
|
|
113
|
-
`[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\`)
|
|
67
|
+
`[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\`).`
|
|
114
68
|
);
|
|
115
69
|
} else {
|
|
116
|
-
|
|
117
|
-
console.warn('[Sentry] Source map generation is disabled in your SolidStart configuration.');
|
|
70
|
+
console.warn("[Sentry] Source map generation is disabled in your SolidStart configuration.");
|
|
118
71
|
}
|
|
119
|
-
} else if (viteSourceMap && [
|
|
72
|
+
} else if (viteSourceMap && ["hidden", "inline", true].includes(viteSourceMap)) {
|
|
120
73
|
updatedSourceMapSetting = viteSourceMap;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
`[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.`,
|
|
126
|
-
);
|
|
74
|
+
debug && // eslint-disable-next-line no-console
|
|
75
|
+
console.log(
|
|
76
|
+
`[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.`
|
|
77
|
+
);
|
|
127
78
|
} else {
|
|
128
|
-
updatedSourceMapSetting =
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
`[Sentry] Enabled source map generation in the build options with \`${settingKey}: 'hidden'\`. The source maps will be deleted after they were uploaded to Sentry.`,
|
|
134
|
-
);
|
|
79
|
+
updatedSourceMapSetting = "hidden";
|
|
80
|
+
debug && // eslint-disable-next-line no-console
|
|
81
|
+
console.log(
|
|
82
|
+
`[Sentry] Enabled source map generation in the build options with \`${settingKey}: 'hidden'\`. The source maps will be deleted after they were uploaded to Sentry.`
|
|
83
|
+
);
|
|
135
84
|
}
|
|
136
|
-
|
|
137
85
|
return updatedSourceMapSetting;
|
|
138
86
|
}
|
|
139
87
|
|
|
@@ -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":["sentryVitePlugin"],"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":["sentryVitePlugin"],"mappings":";;;;AAOO,SAAS,uBAAA,CAAwB,SAAwC,UAAA,EAAkC;AAChH,EAAA,MAAM,EAAE,SAAA,EAAW,KAAA,EAAO,GAAA,EAAK,OAAA,EAAS,yBAAwB,GAAI,OAAA;AAEpE,EAAA,IAAI,+BAAA,GAAwD,MAAA;AAE5D,EAAA,IACE,OAAO,yBAAyB,wBAAA,KAA6B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KAClF;AAAA,EACJ;AAEA,EAAA,OAAO,uBAAA;AACT;;;;;;"}
|
package/build/esm/client/sdk.js
CHANGED
|
@@ -1,36 +1,19 @@
|
|
|
1
1
|
import { applySdkMetadata } from '@sentry/core';
|
|
2
2
|
import { init as init$1, getDefaultIntegrations as getDefaultIntegrations$1, browserTracingIntegration } from '@sentry/solid';
|
|
3
3
|
|
|
4
|
-
// Treeshakable guard to remove all code related to tracing
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Initializes the client side of the Solid Start SDK.
|
|
8
|
-
*/
|
|
9
4
|
function init(options) {
|
|
10
5
|
const opts = {
|
|
11
6
|
defaultIntegrations: getDefaultIntegrations(options),
|
|
12
|
-
...options
|
|
7
|
+
...options
|
|
13
8
|
};
|
|
14
|
-
|
|
15
|
-
applySdkMetadata(opts, 'solidstart', ['solidstart', 'solid']);
|
|
16
|
-
|
|
9
|
+
applySdkMetadata(opts, "solidstart", ["solidstart", "solid"]);
|
|
17
10
|
return init$1(opts);
|
|
18
11
|
}
|
|
19
|
-
|
|
20
12
|
function getDefaultIntegrations(options) {
|
|
21
13
|
const integrations = getDefaultIntegrations$1(options);
|
|
22
|
-
|
|
23
|
-
// This evaluates to true unless __SENTRY_TRACING__ is text-replaced with "false",
|
|
24
|
-
// in which case everything inside will get tree-shaken away
|
|
25
|
-
if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {
|
|
26
|
-
// We add the default BrowserTracingIntegration here always.
|
|
27
|
-
// We can do this, even if `solidRouterBrowserTracingIntegration` is
|
|
28
|
-
// supplied as integration in `init` by users because it will win
|
|
29
|
-
// over the default integration by virtue of having the same
|
|
30
|
-
// `BrowserTracing` integration name and being added later.
|
|
14
|
+
if (typeof __SENTRY_TRACING__ === "undefined" || __SENTRY_TRACING__) {
|
|
31
15
|
integrations.push(browserTracingIntegration());
|
|
32
16
|
}
|
|
33
|
-
|
|
34
17
|
return integrations;
|
|
35
18
|
}
|
|
36
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import type { Client, Integration } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { BrowserOptions } from '@sentry/solid';\nimport {\n browserTracingIntegration,\n getDefaultIntegrations as getDefaultSolidIntegrations,\n init as initSolidSDK,\n} from '@sentry/solid';\n\n// Treeshakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\n/**\n * Initializes the client side of the Solid Start SDK.\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(opts, 'solidstart', ['solidstart', 'solid']);\n\n return initSolidSDK(opts);\n}\n\nfunction getDefaultIntegrations(options: BrowserOptions): Integration[] {\n const integrations = getDefaultSolidIntegrations(options);\n\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\",\n // in which case everything inside will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n // We add the default BrowserTracingIntegration here always.\n // We can do this, even if `solidRouterBrowserTracingIntegration` is\n // supplied as integration in `init` by users because it will win\n // over the default integration by virtue of having the same\n // `BrowserTracing` integration name and being added later.\n integrations.push(browserTracingIntegration());\n }\n\n return integrations;\n}\n"],"names":["initSolidSDK","getDefaultSolidIntegrations"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import type { Client, Integration } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { BrowserOptions } from '@sentry/solid';\nimport {\n browserTracingIntegration,\n getDefaultIntegrations as getDefaultSolidIntegrations,\n init as initSolidSDK,\n} from '@sentry/solid';\n\n// Treeshakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\n/**\n * Initializes the client side of the Solid Start SDK.\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(opts, 'solidstart', ['solidstart', 'solid']);\n\n return initSolidSDK(opts);\n}\n\nfunction getDefaultIntegrations(options: BrowserOptions): Integration[] {\n const integrations = getDefaultSolidIntegrations(options);\n\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\",\n // in which case everything inside will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n // We add the default BrowserTracingIntegration here always.\n // We can do this, even if `solidRouterBrowserTracingIntegration` is\n // supplied as integration in `init` by users because it will win\n // over the default integration by virtue of having the same\n // `BrowserTracing` integration name and being added later.\n integrations.push(browserTracingIntegration());\n }\n\n return integrations;\n}\n"],"names":["initSolidSDK","getDefaultSolidIntegrations"],"mappings":";;;AAeO,SAAS,KAAK,OAAA,EAA6C;AAChE,EAAA,MAAM,IAAA,GAAO;AAAA,IACX,mBAAA,EAAqB,uBAAuB,OAAO,CAAA;AAAA,IACnD,GAAG;AAAA,GACL;AAEA,EAAA,gBAAA,CAAiB,IAAA,EAAM,YAAA,EAAc,CAAC,YAAA,EAAc,OAAO,CAAC,CAAA;AAE5D,EAAA,OAAOA,OAAa,IAAI,CAAA;AAC1B;AAEA,SAAS,uBAAuB,OAAA,EAAwC;AACtE,EAAA,MAAM,YAAA,GAAeC,yBAA4B,OAAO,CAAA;AAIxD,EAAA,IAAI,OAAO,kBAAA,KAAuB,WAAA,IAAe,kBAAA,EAAoB;AAMnE,IAAA,YAAA,CAAa,IAAA,CAAK,2BAA2B,CAAA;AAAA,EAC/C;AAEA,EAAA,OAAO,YAAA;AACT;;;;"}
|