@sentry/solidstart 11.12.0 → 11.13.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/_virtual/_rolldown/runtime.js +34 -0
- package/build/cjs/client/index.js +11 -18
- package/build/cjs/client/sdk.js +19 -20
- package/build/cjs/client/sdk.js.map +1 -1
- package/build/cjs/client/solidrouter.js +8 -16
- package/build/cjs/common/tunnel.js +11 -8
- package/build/cjs/common/tunnel.js.map +1 -1
- package/build/cjs/config/addInstrumentation.js +110 -111
- package/build/cjs/config/addInstrumentation.js.map +1 -1
- package/build/cjs/config/index.js +2 -0
- package/build/cjs/config/withSentry.js +86 -87
- package/build/cjs/config/withSentry.js.map +1 -1
- package/build/cjs/config/wrapServerEntryWithDynamicImport.js +139 -135
- package/build/cjs/config/wrapServerEntryWithDynamicImport.js.map +1 -1
- package/build/cjs/index.client.js +12 -18
- package/build/cjs/index.server.js +162 -159
- package/build/cjs/index.server.js.map +1 -1
- package/build/cjs/nitro/tunnelPlugin.js +12 -10
- package/build/cjs/nitro/tunnelPlugin.js.map +1 -1
- package/build/cjs/server/index.js +151 -158
- package/build/cjs/server/middleware.js +26 -37
- package/build/cjs/server/middleware.js.map +1 -1
- package/build/cjs/server/sdk.js +13 -14
- package/build/cjs/server/sdk.js.map +1 -1
- package/build/cjs/server/solidrouter.js +26 -18
- package/build/cjs/server/solidrouter.js.map +1 -1
- package/build/cjs/server/utils.js +32 -27
- package/build/cjs/server/utils.js.map +1 -1
- package/build/cjs/server/withServerActionInstrumentation.js +46 -49
- package/build/cjs/server/withServerActionInstrumentation.js.map +1 -1
- package/build/cjs/solidrouter.client.js +9 -16
- package/build/cjs/solidrouter.js +12 -18
- package/build/cjs/solidrouter.server.js +3 -8
- package/build/cjs/vite/buildInstrumentationFile.js +46 -46
- package/build/cjs/vite/buildInstrumentationFile.js.map +1 -1
- package/build/cjs/vite/index.js +5 -10
- package/build/cjs/vite/sentrySolidStart.js +86 -39
- package/build/cjs/vite/sentrySolidStart.js.map +1 -1
- package/build/cjs/vite/sentrySolidStartVite.js +32 -35
- package/build/cjs/vite/sentrySolidStartVite.js.map +1 -1
- package/build/cjs/vite/sourceMaps.js +117 -152
- package/build/cjs/vite/sourceMaps.js.map +1 -1
- package/build/esm/client/index.js +2 -3
- package/build/esm/client/sdk.js +19 -18
- package/build/esm/client/sdk.js.map +1 -1
- package/build/esm/client/solidrouter.js +1 -2
- package/build/esm/common/tunnel.js +11 -6
- package/build/esm/common/tunnel.js.map +1 -1
- package/build/esm/config/addInstrumentation.js +107 -109
- package/build/esm/config/addInstrumentation.js.map +1 -1
- package/build/esm/config/index.js +1 -0
- package/build/esm/config/withSentry.js +86 -84
- package/build/esm/config/withSentry.js.map +1 -1
- package/build/esm/config/wrapServerEntryWithDynamicImport.js +139 -133
- package/build/esm/config/wrapServerEntryWithDynamicImport.js.map +1 -1
- package/build/esm/index.client.js +3 -3
- package/build/esm/index.server.js +14 -10
- package/build/esm/index.server.js.map +1 -1
- package/build/esm/nitro/tunnelPlugin.js +12 -10
- package/build/esm/nitro/tunnelPlugin.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/server/index.js +7 -7
- package/build/esm/server/middleware.js +26 -35
- package/build/esm/server/middleware.js.map +1 -1
- package/build/esm/server/sdk.js +13 -12
- package/build/esm/server/sdk.js.map +1 -1
- package/build/esm/server/solidrouter.js +25 -16
- package/build/esm/server/solidrouter.js.map +1 -1
- package/build/esm/server/utils.js +32 -25
- package/build/esm/server/utils.js.map +1 -1
- package/build/esm/server/withServerActionInstrumentation.js +46 -47
- package/build/esm/server/withServerActionInstrumentation.js.map +1 -1
- package/build/esm/solidrouter.client.js +2 -2
- package/build/esm/solidrouter.js +3 -3
- package/build/esm/solidrouter.server.js +1 -2
- package/build/esm/vite/buildInstrumentationFile.js +43 -44
- package/build/esm/vite/buildInstrumentationFile.js.map +1 -1
- package/build/esm/vite/index.js +3 -3
- package/build/esm/vite/sentrySolidStart.js +86 -37
- package/build/esm/vite/sentrySolidStart.js.map +1 -1
- package/build/esm/vite/sentrySolidStartVite.js +32 -33
- package/build/esm/vite/sentrySolidStartVite.js.map +1 -1
- package/build/esm/vite/sourceMaps.js +117 -150
- package/build/esm/vite/sourceMaps.js.map +1 -1
- package/package.json +20 -20
- package/build/cjs/client/index.js.map +0 -1
- package/build/cjs/client/solidrouter.js.map +0 -1
- package/build/cjs/index.client.js.map +0 -1
- package/build/cjs/server/index.js.map +0 -1
- package/build/cjs/solidrouter.client.js.map +0 -1
- package/build/cjs/solidrouter.js.map +0 -1
- package/build/cjs/solidrouter.server.js.map +0 -1
- package/build/cjs/vite/index.js.map +0 -1
- package/build/esm/client/index.js.map +0 -1
- package/build/esm/client/solidrouter.js.map +0 -1
- package/build/esm/index.client.js.map +0 -1
- package/build/esm/server/index.js.map +0 -1
- package/build/esm/solidrouter.client.js.map +0 -1
- package/build/esm/solidrouter.js.map +0 -1
- package/build/esm/solidrouter.server.js.map +0 -1
- package/build/esm/vite/index.js.map +0 -1
package/build/esm/server/sdk.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { filterLowQualityTransactions } from "./utils.js";
|
|
2
|
+
import { applySdkMetadata } from "@sentry/core";
|
|
3
|
+
import { init as init$1 } from "@sentry/node";
|
|
4
|
+
// src/server/sdk.ts
|
|
5
|
+
/**
|
|
6
|
+
* Initializes the server side of the Solid Start SDK
|
|
7
|
+
*/
|
|
5
8
|
function init(options) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
filterLowQualityTransactions(opts);
|
|
11
|
-
return init$1(opts);
|
|
9
|
+
const opts = { ...options };
|
|
10
|
+
applySdkMetadata(opts, "solidstart", ["solidstart", "node"]);
|
|
11
|
+
filterLowQualityTransactions(opts);
|
|
12
|
+
return init$1(opts);
|
|
12
13
|
}
|
|
13
|
-
|
|
14
14
|
export { init };
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import { applySdkMetadata } from '@sentry/core';\nimport type { NodeClient, NodeOptions } from '@sentry/node';\nimport { init as initNodeSdk } from '@sentry/node';\nimport { filterLowQualityTransactions } from './utils';\n\n/**\n * Initializes the server side of the Solid Start SDK\n */\nexport function init(options: NodeOptions): NodeClient | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'solidstart', ['solidstart', 'node']);\n filterLowQualityTransactions(opts);\n\n return initNodeSdk(opts);\n}\n"],"
|
|
1
|
+
{"version":3,"file":"sdk.js","names":["initNodeSdk"],"sources":["../../../src/server/sdk.ts"],"sourcesContent":["import { applySdkMetadata } from '@sentry/core';\nimport type { NodeClient, NodeOptions } from '@sentry/node';\nimport { init as initNodeSdk } from '@sentry/node';\nimport { filterLowQualityTransactions } from './utils';\n\n/**\n * Initializes the server side of the Solid Start SDK\n */\nexport function init(options: NodeOptions): NodeClient | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'solidstart', ['solidstart', 'node']);\n filterLowQualityTransactions(opts);\n\n return initNodeSdk(opts);\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,KAAK,SAA8C;CACjE,MAAM,OAAO,EACX,GAAG,QACL;CAEA,iBAAiB,MAAM,cAAc,CAAC,cAAc,MAAM,CAAC;CAC3D,6BAA6B,IAAI;CAEjC,OAAOA,OAAY,IAAI;AACzB"}
|
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createComponent } from
|
|
3
|
-
|
|
1
|
+
import { mergeProps, splitProps } from "solid-js";
|
|
2
|
+
import { createComponent } from "solid-js/web";
|
|
3
|
+
// src/server/solidrouter.ts
|
|
4
|
+
/** Pass-through component in case user didn't specify a root **/
|
|
4
5
|
function SentryDefaultRoot(props) {
|
|
5
|
-
|
|
6
|
+
return props.children;
|
|
6
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* On the client, router hooks are used in the router's root render prop.
|
|
10
|
+
* This creates a matching structure that's purely pass-through to avoid hydration errors.
|
|
11
|
+
*/
|
|
7
12
|
function withSentryRouterRoot(Root) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
const SentryRouterRoot = (props) => {
|
|
14
|
+
return createComponent(Root, props);
|
|
15
|
+
};
|
|
16
|
+
return SentryRouterRoot;
|
|
12
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* On the client, router hooks are used to start navigation spans.
|
|
20
|
+
* This creates a matching structure that's purely pass-through to avoid hydration errors.
|
|
21
|
+
*/
|
|
13
22
|
function withSentryRouterRouting(Router) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
const SentryRouter = (props) => {
|
|
24
|
+
const [local, others] = splitProps(props, ["root"]);
|
|
25
|
+
const Root = withSentryRouterRoot(local.root ? local.root : SentryDefaultRoot);
|
|
26
|
+
return createComponent(Router, mergeProps({ root: Root }, others));
|
|
27
|
+
};
|
|
28
|
+
return SentryRouter;
|
|
20
29
|
}
|
|
21
|
-
|
|
22
30
|
export { withSentryRouterRouting };
|
|
23
|
-
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=solidrouter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidrouter.js","sources":["../../../src/server/solidrouter.ts"],"sourcesContent":["import type { HashRouter, MemoryRouter, Router as BaseRouter, RouteSectionProps, StaticRouter } from '@solidjs/router';\nimport type { Component, JSX, ParentProps } from 'solid-js';\nimport { mergeProps, splitProps } from 'solid-js';\nimport { createComponent } from 'solid-js/web';\n\n// We use @sentry/solid/solidrouter on the client.\n// On the server, we have to create matching components\n// in structure to avoid hydration errors.\n\n/** Pass-through component in case user didn't specify a root **/\nfunction SentryDefaultRoot(props: ParentProps): JSX.Element {\n return props.children;\n}\n\n/**\n * On the client, router hooks are used in the router's root render prop.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nfunction withSentryRouterRoot(Root: Component<RouteSectionProps>): Component<RouteSectionProps> {\n const SentryRouterRoot = (props: RouteSectionProps): JSX.Element => {\n return createComponent(Root, props);\n };\n\n return SentryRouterRoot;\n}\n\nexport type RouterType = typeof BaseRouter | typeof HashRouter | typeof MemoryRouter | typeof StaticRouter;\n\n/**\n * On the client, router hooks are used to start navigation spans.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nexport function withSentryRouterRouting(Router: RouterType): RouterType {\n const SentryRouter = (props: Parameters<RouterType>[0]): JSX.Element => {\n const [local, others] = splitProps(props, ['root']);\n // We need to wrap root here in case the user passed in their own root\n const Root = withSentryRouterRoot(local.root ? local.root : SentryDefaultRoot);\n\n return createComponent(Router, mergeProps({ root: Root }, others));\n };\n\n return SentryRouter;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"solidrouter.js","names":[],"sources":["../../../src/server/solidrouter.ts"],"sourcesContent":["import type { HashRouter, MemoryRouter, Router as BaseRouter, RouteSectionProps, StaticRouter } from '@solidjs/router';\nimport type { Component, JSX, ParentProps } from 'solid-js';\nimport { mergeProps, splitProps } from 'solid-js';\nimport { createComponent } from 'solid-js/web';\n\n// We use @sentry/solid/solidrouter on the client.\n// On the server, we have to create matching components\n// in structure to avoid hydration errors.\n\n/** Pass-through component in case user didn't specify a root **/\nfunction SentryDefaultRoot(props: ParentProps): JSX.Element {\n return props.children;\n}\n\n/**\n * On the client, router hooks are used in the router's root render prop.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nfunction withSentryRouterRoot(Root: Component<RouteSectionProps>): Component<RouteSectionProps> {\n const SentryRouterRoot = (props: RouteSectionProps): JSX.Element => {\n return createComponent(Root, props);\n };\n\n return SentryRouterRoot;\n}\n\nexport type RouterType = typeof BaseRouter | typeof HashRouter | typeof MemoryRouter | typeof StaticRouter;\n\n/**\n * On the client, router hooks are used to start navigation spans.\n * This creates a matching structure that's purely pass-through to avoid hydration errors.\n */\nexport function withSentryRouterRouting(Router: RouterType): RouterType {\n const SentryRouter = (props: Parameters<RouterType>[0]): JSX.Element => {\n const [local, others] = splitProps(props, ['root']);\n // We need to wrap root here in case the user passed in their own root\n const Root = withSentryRouterRoot(local.root ? local.root : SentryDefaultRoot);\n\n return createComponent(Router, mergeProps({ root: Root }, others));\n };\n\n return SentryRouter;\n}\n"],"mappings":";;;;AAUA,SAAS,kBAAkB,OAAiC;CAC1D,OAAO,MAAM;AACf;;;;;AAMA,SAAS,qBAAqB,MAAkE;CAC9F,MAAM,oBAAoB,UAA0C;EAClE,OAAO,gBAAgB,MAAM,KAAK;CACpC;CAEA,OAAO;AACT;;;;;AAQA,SAAgB,wBAAwB,QAAgC;CACtE,MAAM,gBAAgB,UAAkD;EACtE,MAAM,CAAC,OAAO,UAAU,WAAW,OAAO,CAAC,MAAM,CAAC;EAElD,MAAM,OAAO,qBAAqB,MAAM,OAAO,MAAM,OAAO,iBAAiB;EAE7E,OAAO,gBAAgB,QAAQ,WAAW,EAAE,MAAM,KAAK,GAAG,MAAM,CAAC;CACnE;CAEA,OAAO;AACT"}
|
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
import { debug } from
|
|
2
|
-
import { getGlobalScope } from
|
|
3
|
-
|
|
1
|
+
import { debug } from "@sentry/core";
|
|
2
|
+
import { getGlobalScope } from "@sentry/node";
|
|
3
|
+
// src/server/utils.ts
|
|
4
|
+
/**
|
|
5
|
+
* Determines if a thrown "error" is a redirect Response which Solid Start users can throw to redirect to another route.
|
|
6
|
+
* see: https://docs.solidjs.com/solid-router/reference/data-apis/response-helpers#redirect
|
|
7
|
+
* @param error the potential redirect error
|
|
8
|
+
*/
|
|
4
9
|
function isRedirect(error) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const hasValidStatus = error.status >= 300 && error.status <= 308;
|
|
10
|
-
return hasValidLocation && hasValidStatus;
|
|
10
|
+
if (error == null || !(error instanceof Response)) return false;
|
|
11
|
+
const hasValidLocation = typeof error.headers.get("location") === "string";
|
|
12
|
+
const hasValidStatus = error.status >= 300 && error.status <= 308;
|
|
13
|
+
return hasValidLocation && hasValidStatus;
|
|
11
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Filter function for low quality transactions
|
|
17
|
+
*
|
|
18
|
+
* Exported only for tests
|
|
19
|
+
*/
|
|
12
20
|
function lowQualityTransactionsFilter(options) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
return event;
|
|
23
|
-
}),
|
|
24
|
-
{ id: "SolidStartLowQualityTransactionsFilter" }
|
|
25
|
-
);
|
|
21
|
+
return Object.assign(((event) => {
|
|
22
|
+
if (event.type !== "transaction") return event;
|
|
23
|
+
if (event.transaction?.match(/^GET \/_build\//)) {
|
|
24
|
+
options.debug && debug.log("SolidStartLowQualityTransactionsFilter filtered transaction", event.transaction);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return event;
|
|
28
|
+
}), { id: "SolidStartLowQualityTransactionsFilter" });
|
|
26
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Adds an event processor to filter out low quality transactions,
|
|
32
|
+
* e.g. to filter out transactions for build assets
|
|
33
|
+
*/
|
|
27
34
|
function filterLowQualityTransactions(options) {
|
|
28
|
-
|
|
35
|
+
getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));
|
|
29
36
|
}
|
|
30
|
-
|
|
31
37
|
export { filterLowQualityTransactions, isRedirect, lowQualityTransactionsFilter };
|
|
32
|
-
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/server/utils.ts"],"sourcesContent":["import type { EventProcessor, Options } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { getGlobalScope } from '@sentry/node';\n\n/**\n * Determines if a thrown \"error\" is a redirect Response which Solid Start users can throw to redirect to another route.\n * see: https://docs.solidjs.com/solid-router/reference/data-apis/response-helpers#redirect\n * @param error the potential redirect error\n */\nexport function isRedirect(error: unknown): boolean {\n if (error == null || !(error instanceof Response)) {\n return false;\n }\n\n const hasValidLocation = typeof error.headers.get('location') === 'string';\n const hasValidStatus = error.status >= 300 && error.status <= 308;\n return hasValidLocation && hasValidStatus;\n}\n\n/**\n * Filter function for low quality transactions\n *\n * Exported only for tests\n */\nexport function lowQualityTransactionsFilter(options: Options): EventProcessor {\n return Object.assign(\n (event => {\n if (event.type !== 'transaction') {\n return event;\n }\n // Filter out transactions for build assets\n if (event.transaction?.match(/^GET \\/_build\\//)) {\n options.debug && debug.log('SolidStartLowQualityTransactionsFilter filtered transaction', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'SolidStartLowQualityTransactionsFilter' },\n );\n}\n\n/**\n * Adds an event processor to filter out low quality transactions,\n * e.g. to filter out transactions for build assets\n */\nexport function filterLowQualityTransactions(options: Options): void {\n getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));\n}\n"],"
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/server/utils.ts"],"sourcesContent":["import type { EventProcessor, Options } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { getGlobalScope } from '@sentry/node';\n\n/**\n * Determines if a thrown \"error\" is a redirect Response which Solid Start users can throw to redirect to another route.\n * see: https://docs.solidjs.com/solid-router/reference/data-apis/response-helpers#redirect\n * @param error the potential redirect error\n */\nexport function isRedirect(error: unknown): boolean {\n if (error == null || !(error instanceof Response)) {\n return false;\n }\n\n const hasValidLocation = typeof error.headers.get('location') === 'string';\n const hasValidStatus = error.status >= 300 && error.status <= 308;\n return hasValidLocation && hasValidStatus;\n}\n\n/**\n * Filter function for low quality transactions\n *\n * Exported only for tests\n */\nexport function lowQualityTransactionsFilter(options: Options): EventProcessor {\n return Object.assign(\n (event => {\n if (event.type !== 'transaction') {\n return event;\n }\n // Filter out transactions for build assets\n if (event.transaction?.match(/^GET \\/_build\\//)) {\n options.debug && debug.log('SolidStartLowQualityTransactionsFilter filtered transaction', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'SolidStartLowQualityTransactionsFilter' },\n );\n}\n\n/**\n * Adds an event processor to filter out low quality transactions,\n * e.g. to filter out transactions for build assets\n */\nexport function filterLowQualityTransactions(options: Options): void {\n getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,WAAW,OAAyB;CAClD,IAAI,SAAS,QAAQ,EAAE,iBAAiB,WACtC,OAAO;CAGT,MAAM,mBAAmB,OAAO,MAAM,QAAQ,IAAI,UAAU,MAAM;CAClE,MAAM,iBAAiB,MAAM,UAAU,OAAO,MAAM,UAAU;CAC9D,OAAO,oBAAoB;AAC7B;;;;;;AAOA,SAAgB,6BAA6B,SAAkC;CAC7E,OAAO,OAAO,SACX,UAAS;EACR,IAAI,MAAM,SAAS,eACjB,OAAO;EAGT,IAAI,MAAM,aAAa,MAAM,iBAAiB,GAAG;GAC/C,QAAQ,SAAS,MAAM,IAAI,+DAA+D,MAAM,WAAW;GAC3G,OAAO;EACT;EACA,OAAO;CACT,IACA,EAAE,IAAI,yCAAyC,CACjD;AACF;;;;;AAMA,SAAgB,6BAA6B,SAAwB;CACnE,eAAe,CAAC,CAAC,kBAAkB,6BAA6B,OAAO,CAAC;AAC1E"}
|
|
@@ -1,50 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { FUNCTION } from
|
|
7
|
-
import { setHttpServerSpanRouteAttribute } from
|
|
8
|
-
|
|
1
|
+
import { isRedirect } from "./utils.js";
|
|
2
|
+
import { SPAN_STATUS_ERROR, handleCallbackErrors } from "@sentry/core";
|
|
3
|
+
import { captureException, getActiveSpan, getRootSpan, spanToJSON, startSpan } from "@sentry/node";
|
|
4
|
+
import { flushIfServerless } from "@sentry/core/server";
|
|
5
|
+
import { CODE_FUNCTION_NAME, HTTP_ROUTE, HTTP_TARGET, SENTRY_OP, SENTRY_ORIGIN, SENTRY_SEGMENT_NAME_SOURCE, URL_PATH } from "@sentry/conventions/attributes";
|
|
6
|
+
import { FUNCTION } from "@sentry/conventions/op";
|
|
7
|
+
import { setHttpServerSpanRouteAttribute } from "@sentry/server-utils";
|
|
8
|
+
// src/server/withServerActionInstrumentation.ts
|
|
9
|
+
/**
|
|
10
|
+
* Wraps a server action (functions that use the 'use server' directive)
|
|
11
|
+
* function body with Sentry Error and Performance instrumentation.
|
|
12
|
+
*/
|
|
9
13
|
async function withServerActionInstrumentation(serverActionName, callback) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
} finally {
|
|
45
|
-
await flushIfServerless();
|
|
46
|
-
}
|
|
14
|
+
const activeSpan = getActiveSpan();
|
|
15
|
+
if (activeSpan) {
|
|
16
|
+
const spanData = spanToJSON(getRootSpan(activeSpan)).attributes;
|
|
17
|
+
const requestPath = spanData?.[URL_PATH] ?? spanData?.[HTTP_TARGET];
|
|
18
|
+
if (spanData && !spanData[HTTP_ROUTE] && requestPath === "/_server") setHttpServerSpanRouteAttribute(serverActionName);
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
return await startSpan({
|
|
22
|
+
name: serverActionName,
|
|
23
|
+
attributes: {
|
|
24
|
+
[SENTRY_OP]: FUNCTION,
|
|
25
|
+
[CODE_FUNCTION_NAME]: serverActionName,
|
|
26
|
+
[SENTRY_ORIGIN]: "auto.function.solidstart",
|
|
27
|
+
[SENTRY_SEGMENT_NAME_SOURCE]: "component"
|
|
28
|
+
}
|
|
29
|
+
}, async (span) => {
|
|
30
|
+
return await handleCallbackErrors(callback, (error) => {
|
|
31
|
+
if (!isRedirect(error)) {
|
|
32
|
+
span.setStatus({
|
|
33
|
+
code: SPAN_STATUS_ERROR,
|
|
34
|
+
message: "internal_error"
|
|
35
|
+
});
|
|
36
|
+
captureException(error, { mechanism: {
|
|
37
|
+
handled: false,
|
|
38
|
+
type: "auto.function.solidstart"
|
|
39
|
+
} });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
} finally {
|
|
44
|
+
await flushIfServerless();
|
|
45
|
+
}
|
|
47
46
|
}
|
|
48
|
-
|
|
49
47
|
export { withServerActionInstrumentation };
|
|
50
|
-
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=withServerActionInstrumentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withServerActionInstrumentation.js","sources":["../../../src/server/withServerActionInstrumentation.ts"],"sourcesContent":["import { handleCallbackErrors, SPAN_STATUS_ERROR } from '@sentry/core';\nimport { flushIfServerless } from '@sentry/core/server';\nimport { captureException, getActiveSpan, getRootSpan, spanToJSON, startSpan } from '@sentry/node';\nimport { isRedirect } from './utils';\nimport {\n SENTRY_SEGMENT_NAME_SOURCE,\n CODE_FUNCTION_NAME,\n HTTP_ROUTE,\n HTTP_TARGET,\n SENTRY_OP,\n URL_PATH,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { FUNCTION } from '@sentry/conventions/op';\nimport { setHttpServerSpanRouteAttribute } from '@sentry/server-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 // Read the request's `http.server` root span, which is the span we rename. The active span is\n // usually a framework handler span (e.g. Nitro's h3 `handler` span) without any URL attributes.\n const spanData = spanToJSON(getRootSpan(activeSpan)).attributes;\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 // `@sentry/node` HTTP spans only carry `url.path`; the deprecated `http.target` is kept as a\n // fallback for instrumentation that still sets only that.\n // oxlint-disable-next-line typescript/no-deprecated\n const requestPath = spanData?.[URL_PATH] ?? spanData?.[HTTP_TARGET];\n\n if (spanData && !spanData[HTTP_ROUTE] && requestPath === '/_server') {\n setHttpServerSpanRouteAttribute(serverActionName);\n }\n }\n\n try {\n return await startSpan(\n {\n name: serverActionName,\n attributes: {\n [SENTRY_OP]: FUNCTION,\n [CODE_FUNCTION_NAME]: serverActionName,\n [SENTRY_ORIGIN]: 'auto.function.solidstart',\n [SENTRY_SEGMENT_NAME_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"],"
|
|
1
|
+
{"version":3,"file":"withServerActionInstrumentation.js","names":[],"sources":["../../../src/server/withServerActionInstrumentation.ts"],"sourcesContent":["import { handleCallbackErrors, SPAN_STATUS_ERROR } from '@sentry/core';\nimport { flushIfServerless } from '@sentry/core/server';\nimport { captureException, getActiveSpan, getRootSpan, spanToJSON, startSpan } from '@sentry/node';\nimport { isRedirect } from './utils';\nimport {\n SENTRY_SEGMENT_NAME_SOURCE,\n CODE_FUNCTION_NAME,\n HTTP_ROUTE,\n HTTP_TARGET,\n SENTRY_OP,\n URL_PATH,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { FUNCTION } from '@sentry/conventions/op';\nimport { setHttpServerSpanRouteAttribute } from '@sentry/server-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 // Read the request's `http.server` root span, which is the span we rename. The active span is\n // usually a framework handler span (e.g. Nitro's h3 `handler` span) without any URL attributes.\n const spanData = spanToJSON(getRootSpan(activeSpan)).attributes;\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 // `@sentry/node` HTTP spans only carry `url.path`; the deprecated `http.target` is kept as a\n // fallback for instrumentation that still sets only that.\n // oxlint-disable-next-line typescript/no-deprecated\n const requestPath = spanData?.[URL_PATH] ?? spanData?.[HTTP_TARGET];\n\n if (spanData && !spanData[HTTP_ROUTE] && requestPath === '/_server') {\n setHttpServerSpanRouteAttribute(serverActionName);\n }\n }\n\n try {\n return await startSpan(\n {\n name: serverActionName,\n attributes: {\n [SENTRY_OP]: FUNCTION,\n [CODE_FUNCTION_NAME]: serverActionName,\n [SENTRY_ORIGIN]: 'auto.function.solidstart',\n [SENTRY_SEGMENT_NAME_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"],"mappings":";;;;;;;;;;;;AAoBA,eAAsB,gCACpB,kBACA,UACwB;CACxB,MAAM,aAAa,cAAc;CAEjC,IAAI,YAAY;EAGd,MAAM,WAAW,WAAW,YAAY,UAAU,CAAC,CAAC,CAAC;EAUrD,MAAM,cAAc,WAAW,aAAa,WAAW;EAEvD,IAAI,YAAY,CAAC,SAAS,eAAe,gBAAgB,YACvD,gCAAgC,gBAAgB;CAEpD;CAEA,IAAI;EACF,OAAO,MAAM,UACX;GACE,MAAM;GACN,YAAY;KACT,YAAY;KACZ,qBAAqB;KACrB,gBAAgB;KAChB,6BAA6B;GAChC;EACF,GACA,OAAM,SAAQ;GAcZ,OAAO,MAZc,qBAAqB,WAAU,UAAS;IAC3D,IAAI,CAAC,WAAW,KAAK,GAAG;KACtB,KAAK,UAAU;MAAE,MAAM;MAAmB,SAAS;KAAiB,CAAC;KACrE,iBAAiB,OAAO,EACtB,WAAW;MACT,SAAS;MACT,MAAM;KACR,EACF,CAAC;IACH;GACF,CAAC;EAGH,CACF;CACF,UAAU;EACR,MAAM,kBAAkB;CAC1B;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import "./client/solidrouter.js";
|
|
2
|
+
export * from "@sentry/solid/solidrouter";
|
package/build/esm/solidrouter.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export { withSentryRouterRouting } from
|
|
3
|
-
|
|
1
|
+
import "./client/solidrouter.js";
|
|
2
|
+
export { withSentryRouterRouting } from "./server/solidrouter.js";
|
|
3
|
+
export * from "@sentry/solid/solidrouter";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { withSentryRouterRouting } from
|
|
2
|
-
//# sourceMappingURL=solidrouter.server.js.map
|
|
1
|
+
export { withSentryRouterRouting } from "./server/solidrouter.js";
|
|
@@ -1,47 +1,46 @@
|
|
|
1
|
-
import { consoleSandbox } from
|
|
2
|
-
import * as fs from
|
|
3
|
-
import * as path from
|
|
4
|
-
|
|
1
|
+
import { consoleSandbox } from "@sentry/core";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
// src/vite/buildInstrumentationFile.ts
|
|
5
|
+
/**
|
|
6
|
+
* A Sentry plugin for SolidStart to build the server
|
|
7
|
+
* `instrument.server.ts` file.
|
|
8
|
+
*/
|
|
5
9
|
function makeBuildInstrumentationFilePlugin(options = {}) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
};
|
|
10
|
+
return {
|
|
11
|
+
name: "sentry-solidstart-build-instrumentation-file",
|
|
12
|
+
apply: "build",
|
|
13
|
+
enforce: "post",
|
|
14
|
+
async config(config, { command }) {
|
|
15
|
+
const instrumentationFilePath = options.instrumentation || "./src/instrument.server.ts";
|
|
16
|
+
const router = config.router;
|
|
17
|
+
const { rollupOptions, rolldownOptions, ...build } = config.build || {};
|
|
18
|
+
const bundlerOptionsKey = rolldownOptions ? "rolldownOptions" : "rollupOptions";
|
|
19
|
+
const bundlerOptions = rolldownOptions || rollupOptions || {};
|
|
20
|
+
const input = [...bundlerOptions.input || []];
|
|
21
|
+
if (command !== "build" || router.target !== "server" || router.name === "server-fns") return config;
|
|
22
|
+
try {
|
|
23
|
+
await fs.promises.access(instrumentationFilePath, fs.constants.F_OK);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
consoleSandbox(() => {
|
|
26
|
+
console.warn(`[Sentry SolidStart Plugin] Could not access \`${instrumentationFilePath}\`, please make sure it exists.`, error);
|
|
27
|
+
});
|
|
28
|
+
return config;
|
|
29
|
+
}
|
|
30
|
+
input.push(path.resolve(router.root, instrumentationFilePath));
|
|
31
|
+
return {
|
|
32
|
+
...config,
|
|
33
|
+
build: {
|
|
34
|
+
...build,
|
|
35
|
+
[bundlerOptionsKey]: {
|
|
36
|
+
...bundlerOptions,
|
|
37
|
+
input
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
44
43
|
}
|
|
45
|
-
|
|
46
44
|
export { makeBuildInstrumentationFilePlugin };
|
|
47
|
-
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=buildInstrumentationFile.js.map
|
|
@@ -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 // `rollupOptions` is a deprecated alias of `rolldownOptions` in Vite 8+, but the only option in older Vite.\n // Returning both makes Vite 8 ignore `rollupOptions`, so only write back the one that is in use.\n // oxlint-disable-next-line typescript/no-deprecated\n const { rollupOptions, rolldownOptions, ...build } = config.build || {};\n const bundlerOptionsKey = rolldownOptions ? 'rolldownOptions' : 'rollupOptions';\n const bundlerOptions = rolldownOptions || rollupOptions || {};\n const input = [...((bundlerOptions.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 [bundlerOptionsKey]: {\n ...bundlerOptions,\n input,\n },\n },\n };\n },\n };\n}\n"],"
|
|
1
|
+
{"version":3,"file":"buildInstrumentationFile.js","names":[],"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 // `rollupOptions` is a deprecated alias of `rolldownOptions` in Vite 8+, but the only option in older Vite.\n // Returning both makes Vite 8 ignore `rollupOptions`, so only write back the one that is in use.\n // oxlint-disable-next-line typescript/no-deprecated\n const { rollupOptions, rolldownOptions, ...build } = config.build || {};\n const bundlerOptionsKey = rolldownOptions ? 'rolldownOptions' : 'rollupOptions';\n const bundlerOptions = rolldownOptions || rollupOptions || {};\n const input = [...((bundlerOptions.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 [bundlerOptionsKey]: {\n ...bundlerOptions,\n input,\n },\n },\n };\n },\n };\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,mCAAmC,UAAyC,CAAC,GAAW;CACtG,OAAO;EACL,MAAM;EACN,OAAO;EACP,SAAS;EACT,MAAM,OAAO,QAAoB,EAAE,WAAW;GAC5C,MAAM,0BAA0B,QAAQ,mBAAmB;GAC3D,MAAM,SAAU,OAAmF;GAInG,MAAM,EAAE,eAAe,iBAAiB,GAAG,UAAU,OAAO,SAAS,CAAC;GACtE,MAAM,oBAAoB,kBAAkB,oBAAoB;GAChE,MAAM,iBAAiB,mBAAmB,iBAAiB,CAAC;GAC5D,MAAM,QAAQ,CAAC,GAAK,eAAe,SAAS,CAAC,CAAe;GAG5D,IAAI,YAAY,WAAW,OAAO,WAAW,YAAY,OAAO,SAAS,cACvE,OAAO;GAGT,IAAI;IACF,MAAM,GAAG,SAAS,OAAO,yBAAyB,GAAG,UAAU,IAAI;GACrE,SAAS,OAAO;IACd,qBAAqB;KAEnB,QAAQ,KACN,iDAAiD,wBAAwB,kCACzE,KACF;IACF,CAAC;IACD,OAAO;GACT;GAEA,MAAM,KAAK,KAAK,QAAQ,OAAO,MAAM,uBAAuB,CAAC;GAE7D,OAAO;IACL,GAAG;IACH,OAAO;KACL,GAAG;MACF,oBAAoB;MACnB,GAAG;MACH;KACF;IACF;GACF;EACF;CACF;AACF"}
|
package/build/esm/vite/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { sentrySolidStart } from "./sentrySolidStart.js";
|
|
2
|
+
import { withSentry } from "../config/withSentry.js";
|
|
3
|
+
export { sentrySolidStart, withSentry };
|
|
@@ -1,42 +1,91 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { makeAddSentryVitePluginSolidStart2, makeEnableSourceMapsVitePlugin } from "./sourceMaps.js";
|
|
2
|
+
import { _INTERNAL_normalizeTunnelBasePath, warnOnRemovedBuildOptions } from "@sentry/core";
|
|
3
|
+
import { setupSentryNitroModule } from "@sentry/nitro";
|
|
4
|
+
import { sentryOrchestrionPlugin } from "@sentry/server-utils/orchestrion/vite";
|
|
5
|
+
// src/vite/sentrySolidStart.ts
|
|
6
|
+
/**
|
|
7
|
+
* Vite plugins for the Sentry SolidStart SDK. Requires SolidStart 2.
|
|
8
|
+
*
|
|
9
|
+
* On SolidStart 1, use `withSentry` in `app.config.ts` instead.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // vite.config.ts
|
|
14
|
+
* import { sentrySolidStart } from '@sentry/solidstart/vite';
|
|
15
|
+
* import { solidStart } from '@solidjs/start/config';
|
|
16
|
+
* import { nitro } from 'nitro/vite';
|
|
17
|
+
* import { defineConfig } from 'vite';
|
|
18
|
+
*
|
|
19
|
+
* export default defineConfig({
|
|
20
|
+
* plugins: [
|
|
21
|
+
* solidStart(),
|
|
22
|
+
* sentrySolidStart({
|
|
23
|
+
* org: 'your-org',
|
|
24
|
+
* project: 'your-project',
|
|
25
|
+
* }),
|
|
26
|
+
* nitro(),
|
|
27
|
+
* ],
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param options - Options to configure the Sentry Vite plugins
|
|
32
|
+
* @returns An array of Vite plugins
|
|
33
|
+
*/
|
|
6
34
|
function sentrySolidStart(options = {}) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
35
|
+
warnOnRemovedBuildOptions(options, ["unstable_sentryVitePluginOptions"]);
|
|
36
|
+
const plugins = [makeSentryNitroPlugin(options), makeServerEntryPlugin()];
|
|
37
|
+
if (process.env.NODE_ENV === "development") return plugins;
|
|
38
|
+
plugins.push(sentryOrchestrionPlugin({ buildTimeInstrumentation: options.buildTimeInstrumentation }));
|
|
39
|
+
if (options.sourcemaps?.disable !== true) plugins.push(...makeAddSentryVitePluginSolidStart2(options), ...makeEnableSourceMapsVitePlugin(options));
|
|
40
|
+
return plugins;
|
|
41
|
+
}
|
|
42
|
+
const SERVER_RUNTIME_CONDITION = "sentry-solidstart-runtime";
|
|
43
|
+
/**
|
|
44
|
+
* Resolves `@sentry/solidstart` in server environments to the entry without the deprecated SolidStart 1
|
|
45
|
+
* `withSentry`. Its build-time imports (Sentry CLI, oxc-parser) otherwise end up in the server output:
|
|
46
|
+
* Nitro traces their native files, and Rolldown still emits the CLI's dynamic-import chunks after
|
|
47
|
+
* tree-shaking the code that imports them.
|
|
48
|
+
*/
|
|
49
|
+
function makeServerEntryPlugin() {
|
|
50
|
+
return {
|
|
51
|
+
name: "sentry-solidstart-server-entry",
|
|
52
|
+
configEnvironment(name, config) {
|
|
53
|
+
if (name === "client" || config.consumer === "client" || !config.resolve?.conditions) return;
|
|
54
|
+
return { resolve: { conditions: [SERVER_RUNTIME_CONDITION] } };
|
|
55
|
+
}
|
|
56
|
+
};
|
|
17
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Delivers everything only Nitro can reach — server source maps, runtime hooks, the
|
|
60
|
+
* `sourcemapMinify` opt-out — through Vite's `nitro` key, and the app's base path to the browser SDK.
|
|
61
|
+
*
|
|
62
|
+
* `setupSentryNitroModule` is handed only the keys it reads, never the user's whole config, so what
|
|
63
|
+
* comes back is purely Sentry's additions. Vite concatenates arrays when merging a `config` return
|
|
64
|
+
* value, so echoing the user's own `modules`/`plugins` back would duplicate every entry.
|
|
65
|
+
*
|
|
66
|
+
* `enforce: 'pre'` is load-bearing: Nitro creates its instance inside its own `config` hook, so a
|
|
67
|
+
* normal-priority hook sorting after it would be read too late and silently ignored.
|
|
68
|
+
*/
|
|
18
69
|
function makeSentryNitroPlugin(options) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
};
|
|
70
|
+
return {
|
|
71
|
+
name: "sentry-solidstart-nitro",
|
|
72
|
+
enforce: "pre",
|
|
73
|
+
config(userConfig) {
|
|
74
|
+
const userNitro = userConfig.nitro;
|
|
75
|
+
const tunnelBasePath = _INTERNAL_normalizeTunnelBasePath(userConfig.server?.baseURL || userConfig.base);
|
|
76
|
+
return {
|
|
77
|
+
define: { __SENTRY_SOLIDSTART_TUNNEL_BASE_PATH__: JSON.stringify(tunnelBasePath) },
|
|
78
|
+
nitro: {
|
|
79
|
+
...setupSentryNitroModule({
|
|
80
|
+
sourcemap: userNitro?.sourcemap,
|
|
81
|
+
tracingChannel: userNitro?.tracingChannel
|
|
82
|
+
}, options),
|
|
83
|
+
...tunnelBasePath && { runtimeConfig: { sentryTunnelBasePath: tunnelBasePath } }
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
};
|
|
39
88
|
}
|
|
40
|
-
|
|
41
89
|
export { sentrySolidStart };
|
|
42
|
-
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=sentrySolidStart.js.map
|