@sentry/react-router 10.36.0 → 10.38.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/createClientInstrumentation.js +309 -0
- package/build/cjs/client/createClientInstrumentation.js.map +1 -0
- package/build/cjs/client/hydratedRouter.js +15 -18
- package/build/cjs/client/hydratedRouter.js.map +1 -1
- package/build/cjs/client/tracingIntegration.js +25 -2
- package/build/cjs/client/tracingIntegration.js.map +1 -1
- package/build/cjs/cloudflare/index.js +4 -0
- package/build/cjs/cloudflare/index.js.map +1 -1
- package/build/cjs/common/utils.js +68 -0
- package/build/cjs/common/utils.js.map +1 -0
- package/build/cjs/index.client.js +4 -0
- package/build/cjs/index.client.js.map +1 -1
- package/build/cjs/index.server.js +4 -0
- package/build/cjs/index.server.js.map +1 -1
- package/build/cjs/server/createSentryHandleError.js +1 -4
- package/build/cjs/server/createSentryHandleError.js.map +1 -1
- package/build/cjs/server/createServerInstrumentation.js +231 -0
- package/build/cjs/server/createServerInstrumentation.js.map +1 -0
- package/build/cjs/server/instrumentation/reactRouter.js +8 -0
- package/build/cjs/server/instrumentation/reactRouter.js.map +1 -1
- package/build/cjs/server/integration/reactRouterServer.js +16 -6
- package/build/cjs/server/integration/reactRouterServer.js.map +1 -1
- package/build/cjs/server/serverGlobals.js +25 -0
- package/build/cjs/server/serverGlobals.js.map +1 -0
- package/build/cjs/server/wrapSentryHandleRequest.js +22 -7
- package/build/cjs/server/wrapSentryHandleRequest.js.map +1 -1
- package/build/cjs/server/wrapServerAction.js +21 -1
- package/build/cjs/server/wrapServerAction.js.map +1 -1
- package/build/cjs/server/wrapServerLoader.js +21 -1
- package/build/cjs/server/wrapServerLoader.js.map +1 -1
- package/build/cjs/vite/makeCustomSentryVitePlugins.js +1 -1
- package/build/cjs/vite/makeCustomSentryVitePlugins.js.map +1 -1
- package/build/esm/client/createClientInstrumentation.js +305 -0
- package/build/esm/client/createClientInstrumentation.js.map +1 -0
- package/build/esm/client/hydratedRouter.js +16 -19
- package/build/esm/client/hydratedRouter.js.map +1 -1
- package/build/esm/client/tracingIntegration.js +25 -2
- package/build/esm/client/tracingIntegration.js.map +1 -1
- package/build/esm/cloudflare/index.js +1 -0
- package/build/esm/cloudflare/index.js.map +1 -1
- package/build/esm/common/utils.js +63 -0
- package/build/esm/common/utils.js.map +1 -0
- package/build/esm/index.client.js +1 -0
- package/build/esm/index.client.js.map +1 -1
- package/build/esm/index.server.js +2 -0
- package/build/esm/index.server.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/server/createSentryHandleError.js +1 -4
- package/build/esm/server/createSentryHandleError.js.map +1 -1
- package/build/esm/server/createServerInstrumentation.js +229 -0
- package/build/esm/server/createServerInstrumentation.js.map +1 -0
- package/build/esm/server/instrumentation/reactRouter.js +9 -1
- package/build/esm/server/instrumentation/reactRouter.js.map +1 -1
- package/build/esm/server/integration/reactRouterServer.js +16 -6
- package/build/esm/server/integration/reactRouterServer.js.map +1 -1
- package/build/esm/server/serverGlobals.js +22 -0
- package/build/esm/server/serverGlobals.js.map +1 -0
- package/build/esm/server/wrapSentryHandleRequest.js +23 -8
- package/build/esm/server/wrapSentryHandleRequest.js.map +1 -1
- package/build/esm/server/wrapServerAction.js +22 -2
- package/build/esm/server/wrapServerAction.js.map +1 -1
- package/build/esm/server/wrapServerLoader.js +22 -2
- package/build/esm/server/wrapServerLoader.js.map +1 -1
- package/build/esm/vite/makeCustomSentryVitePlugins.js +1 -1
- package/build/esm/vite/makeCustomSentryVitePlugins.js.map +1 -1
- package/build/types/client/createClientInstrumentation.d.ts +28 -0
- package/build/types/client/createClientInstrumentation.d.ts.map +1 -0
- package/build/types/client/hydratedRouter.d.ts.map +1 -1
- package/build/types/client/index.d.ts +2 -1
- package/build/types/client/index.d.ts.map +1 -1
- package/build/types/client/tracingIntegration.d.ts +32 -2
- package/build/types/client/tracingIntegration.d.ts.map +1 -1
- package/build/types/common/types.d.ts +88 -0
- package/build/types/common/types.d.ts.map +1 -0
- package/build/types/common/utils.d.ts +27 -0
- package/build/types/common/utils.d.ts.map +1 -0
- package/build/types/server/createSentryHandleError.d.ts.map +1 -1
- package/build/types/server/createServerInstrumentation.d.ts +18 -0
- package/build/types/server/createServerInstrumentation.d.ts.map +1 -0
- package/build/types/server/index.d.ts +1 -0
- package/build/types/server/index.d.ts.map +1 -1
- package/build/types/server/instrumentation/reactRouter.d.ts.map +1 -1
- package/build/types/server/integration/reactRouterServer.d.ts.map +1 -1
- package/build/types/server/serverGlobals.d.ts +11 -0
- package/build/types/server/serverGlobals.d.ts.map +1 -0
- package/build/types/server/wrapSentryHandleRequest.d.ts.map +1 -1
- package/build/types/server/wrapServerAction.d.ts.map +1 -1
- package/build/types/server/wrapServerLoader.d.ts.map +1 -1
- package/package.json +12 -12
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { GLOBAL_OBJ } from '@sentry/core';
|
|
2
|
+
|
|
3
|
+
const SENTRY_SERVER_INSTRUMENTATION_FLAG = '__sentryReactRouterServerInstrumentationUsed';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Mark that the React Router instrumentation API is being used on the server.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
function markInstrumentationApiUsed() {
|
|
10
|
+
(GLOBAL_OBJ )[SENTRY_SERVER_INSTRUMENTATION_FLAG] = true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Check if React Router's instrumentation API is being used on the server.
|
|
15
|
+
* @experimental
|
|
16
|
+
*/
|
|
17
|
+
function isInstrumentationApiUsed() {
|
|
18
|
+
return !!(GLOBAL_OBJ )[SENTRY_SERVER_INSTRUMENTATION_FLAG];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { isInstrumentationApiUsed, markInstrumentationApiUsed };
|
|
22
|
+
//# sourceMappingURL=serverGlobals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverGlobals.js","sources":["../../../src/server/serverGlobals.ts"],"sourcesContent":["import { GLOBAL_OBJ } from '@sentry/core';\n\nconst SENTRY_SERVER_INSTRUMENTATION_FLAG = '__sentryReactRouterServerInstrumentationUsed';\n\ntype GlobalObjWithFlag = typeof GLOBAL_OBJ & {\n [SENTRY_SERVER_INSTRUMENTATION_FLAG]?: boolean;\n};\n\n/**\n * Mark that the React Router instrumentation API is being used on the server.\n * @internal\n */\nexport function markInstrumentationApiUsed(): void {\n (GLOBAL_OBJ as GlobalObjWithFlag)[SENTRY_SERVER_INSTRUMENTATION_FLAG] = true;\n}\n\n/**\n * Check if React Router's instrumentation API is being used on the server.\n * @experimental\n */\nexport function isInstrumentationApiUsed(): boolean {\n return !!(GLOBAL_OBJ as GlobalObjWithFlag)[SENTRY_SERVER_INSTRUMENTATION_FLAG];\n}\n"],"names":[],"mappings":";;AAEA,MAAM,kCAAA,GAAqC,8CAA8C;;AAMzF;AACA;AACA;AACA;AACO,SAAS,0BAA0B,GAAS;AACnD,EAAE,CAAC,UAAA,GAAiC,kCAAkC,CAAA,GAAI,IAAI;AAC9E;;AAEA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,GAAY;AACpD,EAAE,OAAO,CAAC,CAAC,CAAC,aAAiC,kCAAkC,CAAC;AAChF;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { context } from '@opentelemetry/api';
|
|
2
2
|
import { getRPCMetadata, RPCType } from '@opentelemetry/core';
|
|
3
3
|
import { ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';
|
|
4
|
-
import { getActiveSpan, getRootSpan,
|
|
4
|
+
import { getActiveSpan, getRootSpan, updateSpanName, getCurrentScope, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, flushIfServerless } from '@sentry/core';
|
|
5
|
+
import { isInstrumentationApiUsed } from './serverGlobals.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Wraps the original handleRequest function to add Sentry instrumentation.
|
|
@@ -26,7 +27,8 @@ function wrapSentryHandleRequest(
|
|
|
26
27
|
const rootSpan = activeSpan ? getRootSpan(activeSpan) : undefined;
|
|
27
28
|
|
|
28
29
|
if (parameterizedPath && rootSpan) {
|
|
29
|
-
|
|
30
|
+
// Normalize route name - avoid "//" for root routes
|
|
31
|
+
const routeName = parameterizedPath.startsWith('/') ? parameterizedPath : `/${parameterizedPath}`;
|
|
30
32
|
|
|
31
33
|
// The express instrumentation writes on the rpcMetadata and that ends up stomping on the `http.route` attribute.
|
|
32
34
|
const rpcMetadata = getRPCMetadata(context.active());
|
|
@@ -35,12 +37,25 @@ function wrapSentryHandleRequest(
|
|
|
35
37
|
rpcMetadata.route = routeName;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const transactionName = `${request.method} ${routeName}`;
|
|
41
|
+
|
|
42
|
+
updateSpanName(rootSpan, transactionName);
|
|
43
|
+
getCurrentScope().setTransactionName(transactionName);
|
|
44
|
+
|
|
45
|
+
// Set route attributes - acts as fallback for lazy-only routes when using instrumentation API
|
|
46
|
+
// Don't override origin when instrumentation API is used (preserve instrumentation_api origin)
|
|
47
|
+
if (isInstrumentationApiUsed()) {
|
|
48
|
+
rootSpan.setAttributes({
|
|
49
|
+
[ATTR_HTTP_ROUTE]: routeName,
|
|
50
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
rootSpan.setAttributes({
|
|
54
|
+
[ATTR_HTTP_ROUTE]: routeName,
|
|
55
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
|
|
56
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.request_handler',
|
|
57
|
+
});
|
|
58
|
+
}
|
|
44
59
|
}
|
|
45
60
|
|
|
46
61
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapSentryHandleRequest.js","sources":["../../../src/server/wrapSentryHandleRequest.ts"],"sourcesContent":["import { context } from '@opentelemetry/api';\nimport { getRPCMetadata, RPCType } from '@opentelemetry/core';\nimport { ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';\nimport {\n flushIfServerless,\n getActiveSpan,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport type { AppLoadContext, EntryContext, RouterContextProvider } from 'react-router';\n\ntype OriginalHandleRequestWithoutMiddleware = (\n request: Request,\n responseStatusCode: number,\n responseHeaders: Headers,\n routerContext: EntryContext,\n loadContext: AppLoadContext,\n) => Promise<unknown>;\n\ntype OriginalHandleRequestWithMiddleware = (\n request: Request,\n responseStatusCode: number,\n responseHeaders: Headers,\n routerContext: EntryContext,\n loadContext: RouterContextProvider,\n) => Promise<unknown>;\n\n/**\n * Wraps the original handleRequest function to add Sentry instrumentation.\n *\n * @param originalHandle - The original handleRequest function to wrap\n * @returns A wrapped version of the handle request function with Sentry instrumentation\n */\nexport function wrapSentryHandleRequest(\n originalHandle: OriginalHandleRequestWithoutMiddleware,\n): OriginalHandleRequestWithoutMiddleware;\n/**\n * Wraps the original handleRequest function to add Sentry instrumentation.\n *\n * @param originalHandle - The original handleRequest function to wrap\n * @returns A wrapped version of the handle request function with Sentry instrumentation\n */\nexport function wrapSentryHandleRequest(\n originalHandle: OriginalHandleRequestWithMiddleware,\n): OriginalHandleRequestWithMiddleware;\n/**\n * Wraps the original handleRequest function to add Sentry instrumentation.\n *\n * @param originalHandle - The original handleRequest function to wrap\n * @returns A wrapped version of the handle request function with Sentry instrumentation\n */\nexport function wrapSentryHandleRequest(\n originalHandle: OriginalHandleRequestWithoutMiddleware | OriginalHandleRequestWithMiddleware,\n): OriginalHandleRequestWithoutMiddleware | OriginalHandleRequestWithMiddleware {\n return async function sentryInstrumentedHandleRequest(\n request: Request,\n responseStatusCode: number,\n responseHeaders: Headers,\n routerContext: EntryContext,\n loadContext: AppLoadContext | RouterContextProvider,\n ) {\n const parameterizedPath =\n routerContext?.staticHandlerContext?.matches?.[routerContext.staticHandlerContext.matches.length - 1]?.route.path;\n\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan ? getRootSpan(activeSpan) : undefined;\n\n if (parameterizedPath && rootSpan) {\n const routeName = `/${parameterizedPath}`;\n\n // The express instrumentation writes on the rpcMetadata and that ends up stomping on the `http.route` attribute.\n const rpcMetadata = getRPCMetadata(context.active());\n\n if (rpcMetadata?.type === RPCType.HTTP) {\n rpcMetadata.route = routeName;\n }\n\n
|
|
1
|
+
{"version":3,"file":"wrapSentryHandleRequest.js","sources":["../../../src/server/wrapSentryHandleRequest.ts"],"sourcesContent":["import { context } from '@opentelemetry/api';\nimport { getRPCMetadata, RPCType } from '@opentelemetry/core';\nimport { ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';\nimport {\n flushIfServerless,\n getActiveSpan,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n updateSpanName,\n} from '@sentry/core';\nimport type { AppLoadContext, EntryContext, RouterContextProvider } from 'react-router';\nimport { isInstrumentationApiUsed } from './serverGlobals';\n\ntype OriginalHandleRequestWithoutMiddleware = (\n request: Request,\n responseStatusCode: number,\n responseHeaders: Headers,\n routerContext: EntryContext,\n loadContext: AppLoadContext,\n) => Promise<unknown>;\n\ntype OriginalHandleRequestWithMiddleware = (\n request: Request,\n responseStatusCode: number,\n responseHeaders: Headers,\n routerContext: EntryContext,\n loadContext: RouterContextProvider,\n) => Promise<unknown>;\n\n/**\n * Wraps the original handleRequest function to add Sentry instrumentation.\n *\n * @param originalHandle - The original handleRequest function to wrap\n * @returns A wrapped version of the handle request function with Sentry instrumentation\n */\nexport function wrapSentryHandleRequest(\n originalHandle: OriginalHandleRequestWithoutMiddleware,\n): OriginalHandleRequestWithoutMiddleware;\n/**\n * Wraps the original handleRequest function to add Sentry instrumentation.\n *\n * @param originalHandle - The original handleRequest function to wrap\n * @returns A wrapped version of the handle request function with Sentry instrumentation\n */\nexport function wrapSentryHandleRequest(\n originalHandle: OriginalHandleRequestWithMiddleware,\n): OriginalHandleRequestWithMiddleware;\n/**\n * Wraps the original handleRequest function to add Sentry instrumentation.\n *\n * @param originalHandle - The original handleRequest function to wrap\n * @returns A wrapped version of the handle request function with Sentry instrumentation\n */\nexport function wrapSentryHandleRequest(\n originalHandle: OriginalHandleRequestWithoutMiddleware | OriginalHandleRequestWithMiddleware,\n): OriginalHandleRequestWithoutMiddleware | OriginalHandleRequestWithMiddleware {\n return async function sentryInstrumentedHandleRequest(\n request: Request,\n responseStatusCode: number,\n responseHeaders: Headers,\n routerContext: EntryContext,\n loadContext: AppLoadContext | RouterContextProvider,\n ) {\n const parameterizedPath =\n routerContext?.staticHandlerContext?.matches?.[routerContext.staticHandlerContext.matches.length - 1]?.route.path;\n\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan ? getRootSpan(activeSpan) : undefined;\n\n if (parameterizedPath && rootSpan) {\n // Normalize route name - avoid \"//\" for root routes\n const routeName = parameterizedPath.startsWith('/') ? parameterizedPath : `/${parameterizedPath}`;\n\n // The express instrumentation writes on the rpcMetadata and that ends up stomping on the `http.route` attribute.\n const rpcMetadata = getRPCMetadata(context.active());\n\n if (rpcMetadata?.type === RPCType.HTTP) {\n rpcMetadata.route = routeName;\n }\n\n const transactionName = `${request.method} ${routeName}`;\n\n updateSpanName(rootSpan, transactionName);\n getCurrentScope().setTransactionName(transactionName);\n\n // Set route attributes - acts as fallback for lazy-only routes when using instrumentation API\n // Don't override origin when instrumentation API is used (preserve instrumentation_api origin)\n if (isInstrumentationApiUsed()) {\n rootSpan.setAttributes({\n [ATTR_HTTP_ROUTE]: routeName,\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',\n });\n } else {\n rootSpan.setAttributes({\n [ATTR_HTTP_ROUTE]: routeName,\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.request_handler',\n });\n }\n }\n\n try {\n // Type guard to call the correct overload based on loadContext type\n if (isRouterContextProvider(loadContext)) {\n // loadContext is RouterContextProvider\n return await (originalHandle as OriginalHandleRequestWithMiddleware)(\n request,\n responseStatusCode,\n responseHeaders,\n routerContext,\n loadContext,\n );\n } else {\n // loadContext is AppLoadContext\n return await (originalHandle as OriginalHandleRequestWithoutMiddleware)(\n request,\n responseStatusCode,\n responseHeaders,\n routerContext,\n loadContext,\n );\n }\n } finally {\n await flushIfServerless();\n }\n\n /**\n * Helper type guard to determine if the context is a RouterContextProvider.\n *\n * @param ctx - The context to check\n * @returns True if the context is a RouterContextProvider\n */\n function isRouterContextProvider(ctx: AppLoadContext | RouterContextProvider): ctx is RouterContextProvider {\n return typeof (ctx as RouterContextProvider)?.get === 'function';\n }\n };\n}\n\n// todo(v11): remove this\n/** @deprecated Use `wrapSentryHandleRequest` instead. */\nexport const sentryHandleRequest = wrapSentryHandleRequest;\n"],"names":[],"mappings":";;;;;;AAiDA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAuB;AACvC,EAAE,cAAc;AAChB,EAAgF;AAChF,EAAE,OAAO,eAAe,+BAA+B;AACvD,IAAI,OAAO;AACX,IAAI,kBAAkB;AACtB,IAAI,eAAe;AACnB,IAAI,aAAa;AACjB,IAAI,WAAW;AACf,IAAI;AACJ,IAAI,MAAM,iBAAA;AACV,MAAM,aAAa,EAAE,oBAAoB,EAAE,OAAO,GAAG,aAAa,CAAC,oBAAoB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI;;AAEvH,IAAI,MAAM,UAAA,GAAa,aAAa,EAAE;AACt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A,MAAA,CAAA,MAAA;AACA;AACA,QAAA,OAAA,MAAA,CAAA,cAAA;AACA,UAAA,OAAA;AACA,UAAA,kBAAA;AACA,UAAA,eAAA;AACA,UAAA,aAAA;AACA,UAAA,WAAA;AACA,SAAA;AACA,MAAA;AACA,IAAA,CAAA,SAAA;AACA,MAAA,MAAA,iBAAA,EAAA;AACA,IAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAA,SAAA,uBAAA,CAAA,GAAA,EAAA;AACA,MAAA,OAAA,OAAA,CAAA,GAAA,IAAA,GAAA,KAAA,UAAA;AACA,IAAA;AACA,EAAA,CAAA;AACA;;AAEA;AACA;AACA,MAAA,mBAAA,GAAA;;;;"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { SEMATTRS_HTTP_TARGET } from '@opentelemetry/semantic-conventions';
|
|
2
|
-
import { getActiveSpan, getRootSpan, spanToJSON, updateSpanName, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, flushIfServerless } from '@sentry/core';
|
|
2
|
+
import { debug, getActiveSpan, getRootSpan, spanToJSON, updateSpanName, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, flushIfServerless } from '@sentry/core';
|
|
3
|
+
import { DEBUG_BUILD } from '../common/debug-build.js';
|
|
4
|
+
import { isInstrumentationApiUsed } from './serverGlobals.js';
|
|
5
|
+
|
|
6
|
+
// Track if we've already warned about duplicate instrumentation
|
|
7
|
+
let hasWarnedAboutDuplicateActionInstrumentation = false;
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
10
|
* Wraps a React Router server action function with Sentry performance monitoring.
|
|
@@ -20,8 +25,23 @@ import { getActiveSpan, getRootSpan, spanToJSON, updateSpanName, SEMANTIC_ATTRIB
|
|
|
20
25
|
* );
|
|
21
26
|
* ```
|
|
22
27
|
*/
|
|
23
|
-
function wrapServerAction(
|
|
28
|
+
function wrapServerAction(
|
|
29
|
+
options = {},
|
|
30
|
+
actionFn,
|
|
31
|
+
) {
|
|
24
32
|
return async function (args) {
|
|
33
|
+
// Skip instrumentation if instrumentation API is already handling it
|
|
34
|
+
if (isInstrumentationApiUsed()) {
|
|
35
|
+
if (DEBUG_BUILD && !hasWarnedAboutDuplicateActionInstrumentation) {
|
|
36
|
+
hasWarnedAboutDuplicateActionInstrumentation = true;
|
|
37
|
+
debug.warn(
|
|
38
|
+
'wrapServerAction is redundant when using the instrumentation API. ' +
|
|
39
|
+
'The action is already instrumented automatically. You can safely remove wrapServerAction.',
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return actionFn(args);
|
|
43
|
+
}
|
|
44
|
+
|
|
25
45
|
const name = options.name || 'Executing Server Action';
|
|
26
46
|
const active = getActiveSpan();
|
|
27
47
|
if (active) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapServerAction.js","sources":["../../../src/server/wrapServerAction.ts"],"sourcesContent":["import { SEMATTRS_HTTP_TARGET } from '@opentelemetry/semantic-conventions';\nimport type { SpanAttributes } from '@sentry/core';\nimport {\n flushIfServerless,\n getActiveSpan,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n startSpan,\n updateSpanName,\n} from '@sentry/core';\nimport type { ActionFunctionArgs } from 'react-router';\n\ntype SpanOptions = {\n name?: string;\n attributes?: SpanAttributes;\n};\n\n/**\n * Wraps a React Router server action function with Sentry performance monitoring.\n * @param options - Optional span configuration options including name, operation, description and attributes\n * @param actionFn - The server action function to wrap\n *\n * @example\n * ```ts\n * // Wrap an action function with custom span options\n * export const action = wrapServerAction(\n * {\n * name: 'Submit Form Data',\n * description: 'Processes form submission data',\n * },\n * async ({ request }) => {\n * // ... your action logic\n * }\n * );\n * ```\n */\nexport function wrapServerAction<T>(options: SpanOptions = {}
|
|
1
|
+
{"version":3,"file":"wrapServerAction.js","sources":["../../../src/server/wrapServerAction.ts"],"sourcesContent":["import { SEMATTRS_HTTP_TARGET } from '@opentelemetry/semantic-conventions';\nimport type { SpanAttributes } from '@sentry/core';\nimport {\n debug,\n flushIfServerless,\n getActiveSpan,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n startSpan,\n updateSpanName,\n} from '@sentry/core';\nimport type { ActionFunctionArgs } from 'react-router';\nimport { DEBUG_BUILD } from '../common/debug-build';\nimport { isInstrumentationApiUsed } from './serverGlobals';\n\ntype SpanOptions = {\n name?: string;\n attributes?: SpanAttributes;\n};\n\n// Track if we've already warned about duplicate instrumentation\nlet hasWarnedAboutDuplicateActionInstrumentation = false;\n\n/**\n * Wraps a React Router server action function with Sentry performance monitoring.\n * @param options - Optional span configuration options including name, operation, description and attributes\n * @param actionFn - The server action function to wrap\n *\n * @example\n * ```ts\n * // Wrap an action function with custom span options\n * export const action = wrapServerAction(\n * {\n * name: 'Submit Form Data',\n * description: 'Processes form submission data',\n * },\n * async ({ request }) => {\n * // ... your action logic\n * }\n * );\n * ```\n */\nexport function wrapServerAction<T>(\n options: SpanOptions = {},\n actionFn: (args: ActionFunctionArgs) => Promise<T>,\n): (args: ActionFunctionArgs) => Promise<T> {\n return async function (args: ActionFunctionArgs): Promise<T> {\n // Skip instrumentation if instrumentation API is already handling it\n if (isInstrumentationApiUsed()) {\n if (DEBUG_BUILD && !hasWarnedAboutDuplicateActionInstrumentation) {\n hasWarnedAboutDuplicateActionInstrumentation = true;\n debug.warn(\n 'wrapServerAction is redundant when using the instrumentation API. ' +\n 'The action is already instrumented automatically. You can safely remove wrapServerAction.',\n );\n }\n return actionFn(args);\n }\n\n const name = options.name || 'Executing Server Action';\n const active = getActiveSpan();\n if (active) {\n const root = getRootSpan(active);\n const spanData = spanToJSON(root);\n if (spanData.origin === 'auto.http.otel.http') {\n // eslint-disable-next-line deprecation/deprecation\n const target = spanData.data[SEMATTRS_HTTP_TARGET];\n\n if (target) {\n // We cannot rely on the regular span name inferral here, as the express instrumentation sets `*` as the route\n // So we force this to be a more sensible name here\n updateSpanName(root, `${args.request.method} ${target}`);\n root.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.action',\n });\n }\n }\n }\n\n try {\n return await startSpan(\n {\n name,\n ...options,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.action',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.react_router.action',\n ...options.attributes,\n },\n },\n () => actionFn(args),\n );\n } finally {\n await flushIfServerless();\n }\n };\n}\n"],"names":[],"mappings":";;;;;AAuBA;AACA,IAAI,4CAAA,GAA+C,KAAK;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB;AAChC,EAAE,OAAO,GAAgB,EAAE;AAC3B,EAAE,QAAQ;AACV,EAA4C;AAC5C,EAAE,OAAO,gBAAgB,IAAI,EAAkC;AAC/D;AACA,IAAI,IAAI,wBAAwB,EAAE,EAAE;AACpC,MAAM,IAAI,WAAA,IAAe,CAAC,4CAA4C,EAAE;AACxE,QAAQ,4CAAA,GAA+C,IAAI;AAC3D,QAAQ,KAAK,CAAC,IAAI;AAClB,UAAU,oEAAA;AACV,YAAY,2FAA2F;AACvG,SAAS;AACT,MAAM;AACN,MAAM,OAAO,QAAQ,CAAC,IAAI,CAAC;AAC3B,IAAI;;AAEJ,IAAI,MAAM,IAAA,GAAO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N, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, flushIfServerless } from '@sentry/core';
|
|
2
|
+
import { debug, getActiveSpan, getRootSpan, spanToJSON, updateSpanName, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, flushIfServerless } from '@sentry/core';
|
|
3
|
+
import { DEBUG_BUILD } from '../common/debug-build.js';
|
|
4
|
+
import { isInstrumentationApiUsed } from './serverGlobals.js';
|
|
5
|
+
|
|
6
|
+
// Track if we've already warned about duplicate instrumentation
|
|
7
|
+
let hasWarnedAboutDuplicateLoaderInstrumentation = false;
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
10
|
* Wraps a React Router server loader function with Sentry performance monitoring.
|
|
@@ -20,8 +25,23 @@ import { getActiveSpan, getRootSpan, spanToJSON, updateSpanName, SEMANTIC_ATTRIB
|
|
|
20
25
|
* );
|
|
21
26
|
* ```
|
|
22
27
|
*/
|
|
23
|
-
function wrapServerLoader(
|
|
28
|
+
function wrapServerLoader(
|
|
29
|
+
options = {},
|
|
30
|
+
loaderFn,
|
|
31
|
+
) {
|
|
24
32
|
return async function (args) {
|
|
33
|
+
// Skip instrumentation if instrumentation API is already handling it
|
|
34
|
+
if (isInstrumentationApiUsed()) {
|
|
35
|
+
if (DEBUG_BUILD && !hasWarnedAboutDuplicateLoaderInstrumentation) {
|
|
36
|
+
hasWarnedAboutDuplicateLoaderInstrumentation = true;
|
|
37
|
+
debug.warn(
|
|
38
|
+
'wrapServerLoader is redundant when using the instrumentation API. ' +
|
|
39
|
+
'The loader is already instrumented automatically. You can safely remove wrapServerLoader.',
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return loaderFn(args);
|
|
43
|
+
}
|
|
44
|
+
|
|
25
45
|
const name = options.name || 'Executing Server Loader';
|
|
26
46
|
const active = getActiveSpan();
|
|
27
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapServerLoader.js","sources":["../../../src/server/wrapServerLoader.ts"],"sourcesContent":["import { SEMATTRS_HTTP_TARGET } from '@opentelemetry/semantic-conventions';\nimport type { SpanAttributes } from '@sentry/core';\nimport {\n flushIfServerless,\n getActiveSpan,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n startSpan,\n updateSpanName,\n} from '@sentry/core';\nimport type { LoaderFunctionArgs } from 'react-router';\n\ntype SpanOptions = {\n name?: string;\n attributes?: SpanAttributes;\n};\n\n/**\n * Wraps a React Router server loader function with Sentry performance monitoring.\n * @param options - Optional span configuration options including name, operation, description and attributes\n * @param loaderFn - The server loader function to wrap\n *\n * @example\n * ```ts\n * // Wrap a loader function with custom span options\n * export const loader = wrapServerLoader(\n * {\n * name: 'Load Some Data',\n * description: 'Loads some data from the db',\n * },\n * async ({ params }) => {\n * // ... your loader logic\n * }\n * );\n * ```\n */\nexport function wrapServerLoader<T>(options: SpanOptions = {}
|
|
1
|
+
{"version":3,"file":"wrapServerLoader.js","sources":["../../../src/server/wrapServerLoader.ts"],"sourcesContent":["import { SEMATTRS_HTTP_TARGET } from '@opentelemetry/semantic-conventions';\nimport type { SpanAttributes } from '@sentry/core';\nimport {\n debug,\n flushIfServerless,\n getActiveSpan,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n spanToJSON,\n startSpan,\n updateSpanName,\n} from '@sentry/core';\nimport type { LoaderFunctionArgs } from 'react-router';\nimport { DEBUG_BUILD } from '../common/debug-build';\nimport { isInstrumentationApiUsed } from './serverGlobals';\n\ntype SpanOptions = {\n name?: string;\n attributes?: SpanAttributes;\n};\n\n// Track if we've already warned about duplicate instrumentation\nlet hasWarnedAboutDuplicateLoaderInstrumentation = false;\n\n/**\n * Wraps a React Router server loader function with Sentry performance monitoring.\n * @param options - Optional span configuration options including name, operation, description and attributes\n * @param loaderFn - The server loader function to wrap\n *\n * @example\n * ```ts\n * // Wrap a loader function with custom span options\n * export const loader = wrapServerLoader(\n * {\n * name: 'Load Some Data',\n * description: 'Loads some data from the db',\n * },\n * async ({ params }) => {\n * // ... your loader logic\n * }\n * );\n * ```\n */\nexport function wrapServerLoader<T>(\n options: SpanOptions = {},\n loaderFn: (args: LoaderFunctionArgs) => Promise<T>,\n): (args: LoaderFunctionArgs) => Promise<T> {\n return async function (args: LoaderFunctionArgs): Promise<T> {\n // Skip instrumentation if instrumentation API is already handling it\n if (isInstrumentationApiUsed()) {\n if (DEBUG_BUILD && !hasWarnedAboutDuplicateLoaderInstrumentation) {\n hasWarnedAboutDuplicateLoaderInstrumentation = true;\n debug.warn(\n 'wrapServerLoader is redundant when using the instrumentation API. ' +\n 'The loader is already instrumented automatically. You can safely remove wrapServerLoader.',\n );\n }\n return loaderFn(args);\n }\n\n const name = options.name || 'Executing Server Loader';\n const active = getActiveSpan();\n\n if (active) {\n const root = getRootSpan(active);\n const spanData = spanToJSON(root);\n if (spanData.origin === 'auto.http.otel.http') {\n // eslint-disable-next-line deprecation/deprecation\n const target = spanData.data[SEMATTRS_HTTP_TARGET];\n\n if (target) {\n // We cannot rely on the regular span name inferral here, as the express instrumentation sets `*` as the route\n // So we force this to be a more sensible name here\n updateSpanName(root, `${args.request.method} ${target}`);\n root.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.loader',\n });\n }\n }\n }\n try {\n return await startSpan(\n {\n name,\n ...options,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.loader',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.react_router.loader',\n ...options.attributes,\n },\n },\n () => loaderFn(args),\n );\n } finally {\n await flushIfServerless();\n }\n };\n}\n"],"names":[],"mappings":";;;;;AAuBA;AACA,IAAI,4CAAA,GAA+C,KAAK;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB;AAChC,EAAE,OAAO,GAAgB,EAAE;AAC3B,EAAE,QAAQ;AACV,EAA4C;AAC5C,EAAE,OAAO,gBAAgB,IAAI,EAAkC;AAC/D;AACA,IAAI,IAAI,wBAAwB,EAAE,EAAE;AACpC,MAAM,IAAI,WAAA,IAAe,CAAC,4CAA4C,EAAE;AACxE,QAAQ,4CAAA,GAA+C,IAAI;AAC3D,QAAQ,KAAK,CAAC,IAAI;AAClB,UAAU,oEAAA;AACV,YAAY,2FAA2F;AACvG,SAAS;AACT,MAAM;AACN,MAAM,OAAO,QAAQ,CAAC,IAAI,CAAC;AAC3B,IAAI;;AAEJ,IAAI,MAAM,IAAA,GAAO,OAAO,CAAC,IAAA,IAAQ,yBAAyB;AAC1D,IAAI,MAAM,MAAA,GAAS,aAAa,EAAE;;AAElC,IAAI,IAAI,MAAM,EAAE;AAChB,MAAM,MAAM,IAAA,GAAO,WAAW,CAAC,MAAM,CAAC;AACtC,MAAM,MAAM,QAAA,GAAW,UAAU,CAAC,IAAI,CAAC;AACvC,MAAM,IAAI,QAAQ,CAAC,MAAA,KAAW,qBAAqB,EAAE;AACrD;AACA,QAAQ,MAAM,SAAS,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC;;AAE1D,QAAQ,IAAI,MAAM,EAAE;AACpB;AACA;AACA,UAAU,cAAc,CAAC,IAAI,EAAE,CAAC,EAAA,IAAA,CAAA,OAAA,CAAA,MAAA,CAAA,CAAA,EAAA,MAAA,CAAA,CAAA,CAAA;AACA,UAAA,IAAA,CAAA,aAAA,CAAA;AACA,YAAA,CAAA,gCAAA,GAAA,KAAA;AACA,YAAA,CAAA,gCAAA,GAAA,+BAAA;AACA,WAAA,CAAA;AACA,QAAA;AACA,MAAA;AACA,IAAA;AACA,IAAA,IAAA;AACA,MAAA,OAAA,MAAA,SAAA;AACA,QAAA;AACA,UAAA,IAAA;AACA,UAAA,GAAA,OAAA;AACA,UAAA,UAAA,EAAA;AACA,YAAA,CAAA,gCAAA,GAAA,+BAAA;AACA,YAAA,CAAA,4BAAA,GAAA,8BAAA;AACA,YAAA,GAAA,OAAA,CAAA,UAAA;AACA,WAAA;AACA,SAAA;AACA,QAAA,MAAA,QAAA,CAAA,IAAA,CAAA;AACA,OAAA;AACA,IAAA,CAAA,SAAA;AACA,MAAA,MAAA,iBAAA,EAAA;AACA,IAAA;AACA,EAAA,CAAA;AACA;;;;"}
|
|
@@ -51,7 +51,7 @@ async function makeCustomSentryVitePlugins(options) {
|
|
|
51
51
|
...sentryVitePlugins.filter(plugin => {
|
|
52
52
|
return [
|
|
53
53
|
'sentry-telemetry-plugin',
|
|
54
|
-
'sentry-vite-
|
|
54
|
+
'sentry-vite-injection-plugin',
|
|
55
55
|
...(reactComponentAnnotation?.enabled || unstable_sentryVitePluginOptions?.reactComponentAnnotation?.enabled
|
|
56
56
|
? ['sentry-vite-component-name-annotate-plugin']
|
|
57
57
|
: []),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeCustomSentryVitePlugins.js","sources":["../../../src/vite/makeCustomSentryVitePlugins.ts"],"sourcesContent":["import { sentryVitePlugin } from '@sentry/vite-plugin';\nimport { type Plugin } from 'vite';\nimport type { SentryReactRouterBuildOptions } from './types';\n\n/**\n * Create a custom subset of sentry's vite plugins\n */\nexport async function makeCustomSentryVitePlugins(options: SentryReactRouterBuildOptions): Promise<Plugin[]> {\n const {\n debug,\n unstable_sentryVitePluginOptions,\n bundleSizeOptimizations,\n authToken,\n org,\n project,\n telemetry,\n reactComponentAnnotation,\n release,\n } = options;\n\n const sentryVitePlugins = sentryVitePlugin({\n authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,\n bundleSizeOptimizations,\n debug: debug ?? false,\n org: org ?? process.env.SENTRY_ORG,\n project: project ?? process.env.SENTRY_PROJECT,\n telemetry: telemetry ?? true,\n _metaOptions: {\n telemetry: {\n metaFramework: 'react-router',\n },\n ...unstable_sentryVitePluginOptions?._metaOptions,\n },\n reactComponentAnnotation: {\n enabled: reactComponentAnnotation?.enabled ?? undefined,\n ignoredComponents: reactComponentAnnotation?.ignoredComponents ?? undefined,\n ...unstable_sentryVitePluginOptions?.reactComponentAnnotation,\n },\n release: {\n ...unstable_sentryVitePluginOptions?.release,\n ...release,\n },\n // will be handled in buildEnd hook\n sourcemaps: {\n disable: true,\n ...unstable_sentryVitePluginOptions?.sourcemaps,\n },\n ...unstable_sentryVitePluginOptions,\n }) as Plugin[];\n\n // only use a subset of the plugins as all upload and file deletion tasks will be handled in the buildEnd hook\n return [\n ...sentryVitePlugins.filter(plugin => {\n return [\n 'sentry-telemetry-plugin',\n 'sentry-vite-
|
|
1
|
+
{"version":3,"file":"makeCustomSentryVitePlugins.js","sources":["../../../src/vite/makeCustomSentryVitePlugins.ts"],"sourcesContent":["import { sentryVitePlugin } from '@sentry/vite-plugin';\nimport { type Plugin } from 'vite';\nimport type { SentryReactRouterBuildOptions } from './types';\n\n/**\n * Create a custom subset of sentry's vite plugins\n */\nexport async function makeCustomSentryVitePlugins(options: SentryReactRouterBuildOptions): Promise<Plugin[]> {\n const {\n debug,\n unstable_sentryVitePluginOptions,\n bundleSizeOptimizations,\n authToken,\n org,\n project,\n telemetry,\n reactComponentAnnotation,\n release,\n } = options;\n\n const sentryVitePlugins = sentryVitePlugin({\n authToken: authToken ?? process.env.SENTRY_AUTH_TOKEN,\n bundleSizeOptimizations,\n debug: debug ?? false,\n org: org ?? process.env.SENTRY_ORG,\n project: project ?? process.env.SENTRY_PROJECT,\n telemetry: telemetry ?? true,\n _metaOptions: {\n telemetry: {\n metaFramework: 'react-router',\n },\n ...unstable_sentryVitePluginOptions?._metaOptions,\n },\n reactComponentAnnotation: {\n enabled: reactComponentAnnotation?.enabled ?? undefined,\n ignoredComponents: reactComponentAnnotation?.ignoredComponents ?? undefined,\n ...unstable_sentryVitePluginOptions?.reactComponentAnnotation,\n },\n release: {\n ...unstable_sentryVitePluginOptions?.release,\n ...release,\n },\n // will be handled in buildEnd hook\n sourcemaps: {\n disable: true,\n ...unstable_sentryVitePluginOptions?.sourcemaps,\n },\n ...unstable_sentryVitePluginOptions,\n }) as Plugin[];\n\n // only use a subset of the plugins as all upload and file deletion tasks will be handled in the buildEnd hook\n return [\n ...sentryVitePlugins.filter(plugin => {\n return [\n 'sentry-telemetry-plugin',\n 'sentry-vite-injection-plugin',\n ...(reactComponentAnnotation?.enabled || unstable_sentryVitePluginOptions?.reactComponentAnnotation?.enabled\n ? ['sentry-vite-component-name-annotate-plugin']\n : []),\n ].includes(plugin.name);\n }),\n ];\n}\n"],"names":[],"mappings":";;AAIA;AACA;AACA;AACO,eAAe,2BAA2B,CAAC,OAAO,EAAoD;AAC7G,EAAE,MAAM;AACR,IAAI,KAAK;AACT,IAAI,gCAAgC;AACpC,IAAI,uBAAuB;AAC3B,IAAI,SAAS;AACb,IAAI,GAAG;AACP,IAAI,OAAO;AACX,IAAI,SAAS;AACb,IAAI,wBAAwB;AAC5B,IAAI,OAAO;AACX,GAAE,GAAI,OAAO;;AAEb,EAAE,MAAM,iBAAA,GAAoB,gBAAgB,CAAC;AAC7C,IAAI,SAAS,EAAE,SAAA,IAAa,OAAO,CAAC,GAAG,CAAC,iBAAiB;AACzD,IAAI,uBAAuB;AAC3B,IAAI,KAAK,EAAE,KAAA,IAAS,KAAK;AACzB,IAAI,GAAG,EAAE,GAAA,IAAO,OAAO,CAAC,GAAG,CAAC,UAAU;AACtC,IAAI,OAAO,EAAE,OAAA,IAAW,OAAO,CAAC,GAAG,CAAC,cAAc;AAClD,IAAI,SAAS,EAAE,SAAA,IAAa,IAAI;AAChC,IAAI,YAAY,EAAE;AAClB,MAAM,SAAS,EAAE;AACjB,QAAQ,aAAa,EAAE,cAAc;AACrC,OAAO;AACP,MAAM,GAAG,gCAAgC,EAAE,YAAY;AACvD,KAAK;AACL,IAAI,wBAAwB,EAAE;AAC9B,MAAM,OAAO,EAAE,wBAAwB,EAAE,OAAA,IAAW,SAAS;AAC7D,MAAM,iBAAiB,EAAE,wBAAwB,EAAE,iBAAA,IAAqB,SAAS;AACjF,MAAM,GAAG,gCAAgC,EAAE,wBAAwB;AACnE,KAAK;AACL,IAAI,OAAO,EAAE;AACb,MAAM,GAAG,gCAAgC,EAAE,OAAO;AAClD,MAAM,GAAG,OAAO;AAChB,KAAK;AACL;AACA,IAAI,UAAU,EAAE;AAChB,MAAM,OAAO,EAAE,IAAI;AACnB,MAAM,GAAG,gCAAgC,EAAE,UAAU;AACrD,KAAK;AACL,IAAI,GAAG,gCAAgC;AACvC,GAAG,CAAA;;AAEH;AACA,EAAE,OAAO;AACT,IAAI,GAAG,iBAAiB,CAAC,MAAM,CAAC,UAAU;AAC1C,MAAM,OAAO;AACb,QAAQ,yBAAyB;AACjC,QAAQ,8BAA8B;AACtC,QAAQ,IAAI,wBAAwB,EAAE,WAAW,gCAAgC,EAAE,wBAAwB,EAAE;AAC7G,YAAY,CAAC,4CAA4C;AACzD,YAAY,EAAE,CAAC;AACf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;AAC7B,IAAI,CAAC,CAAC;AACN,GAAG;AACH;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ClientInstrumentation } from '../common/types';
|
|
2
|
+
/**
|
|
3
|
+
* Options for creating Sentry client instrumentation.
|
|
4
|
+
*/
|
|
5
|
+
export interface CreateSentryClientInstrumentationOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Whether to capture errors from loaders/actions automatically.
|
|
8
|
+
* Set to `false` to avoid duplicates if using custom error handlers.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
captureErrors?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a Sentry client instrumentation for React Router's instrumentation API.
|
|
15
|
+
* @experimental
|
|
16
|
+
*/
|
|
17
|
+
export declare function createSentryClientInstrumentation(options?: CreateSentryClientInstrumentationOptions): ClientInstrumentation;
|
|
18
|
+
/**
|
|
19
|
+
* Check if React Router's instrumentation API is being used on the client.
|
|
20
|
+
* @experimental
|
|
21
|
+
*/
|
|
22
|
+
export declare function isClientInstrumentationApiUsed(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Check if React Router's instrumentation API's navigate hook was invoked.
|
|
25
|
+
* @experimental
|
|
26
|
+
*/
|
|
27
|
+
export declare function isNavigateHookInvoked(): boolean;
|
|
28
|
+
//# sourceMappingURL=createClientInstrumentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createClientInstrumentation.d.ts","sourceRoot":"","sources":["../../../src/client/createClientInstrumentation.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAA6C,MAAM,iBAAiB,CAAC;AAqBxG;;GAEG;AACH,MAAM,WAAW,wCAAwC;IACvD;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,CAC/C,OAAO,GAAE,wCAA6C,GACrD,qBAAqB,CAkQvB;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,IAAI,OAAO,CAExD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydratedRouter.d.ts","sourceRoot":"","sources":["../../../src/client/hydratedRouter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hydratedRouter.d.ts","sourceRoot":"","sources":["../../../src/client/hydratedRouter.ts"],"names":[],"mappings":"AAuBA;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CA+E/C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@sentry/browser';
|
|
2
2
|
export { init } from './sdk';
|
|
3
|
-
export { reactRouterTracingIntegration } from './tracingIntegration';
|
|
3
|
+
export { reactRouterTracingIntegration, type ReactRouterTracingIntegration, type ReactRouterTracingIntegrationOptions, } from './tracingIntegration';
|
|
4
4
|
export { captureReactException, reactErrorHandler, Profiler, withProfiler, useProfiler } from '@sentry/react';
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated ErrorBoundary is deprecated, use React Router's error boundary instead.
|
|
@@ -12,4 +12,5 @@ export { ErrorBoundary, withErrorBoundary } from '@sentry/react';
|
|
|
12
12
|
* See https://docs.sentry.io/platforms/javascript/guides/react-router/#report-errors-from-error-boundaries
|
|
13
13
|
*/
|
|
14
14
|
export type { ErrorBoundaryProps, FallbackRender } from '@sentry/react';
|
|
15
|
+
export { createSentryClientInstrumentation, isClientInstrumentationApiUsed, isNavigateHookInvoked, type CreateSentryClientInstrumentationOptions, } from './createClientInstrumentation';
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAGA,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAGA,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EACL,6BAA6B,EAC7B,KAAK,6BAA6B,EAClC,KAAK,oCAAoC,GAC1C,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE9G;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEjE;;;GAGG;AACH,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGxE,OAAO,EACL,iCAAiC,EACjC,8BAA8B,EAC9B,qBAAqB,EACrB,KAAK,wCAAwC,GAC9C,MAAM,+BAA+B,CAAC"}
|
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
import type { Integration } from '@sentry/core';
|
|
2
|
+
import type { ClientInstrumentation } from '../common/types';
|
|
3
|
+
import { type CreateSentryClientInstrumentationOptions } from './createClientInstrumentation';
|
|
4
|
+
/**
|
|
5
|
+
* Options for the React Router tracing integration.
|
|
6
|
+
*/
|
|
7
|
+
export interface ReactRouterTracingIntegrationOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Options for React Router's instrumentation API.
|
|
10
|
+
* @experimental
|
|
11
|
+
*/
|
|
12
|
+
instrumentationOptions?: CreateSentryClientInstrumentationOptions;
|
|
13
|
+
/**
|
|
14
|
+
* Enable React Router's instrumentation API.
|
|
15
|
+
* When true, prepares for use with HydratedRouter's `unstable_instrumentations` prop.
|
|
16
|
+
* @experimental
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
useInstrumentationAPI?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* React Router tracing integration with support for the instrumentation API.
|
|
23
|
+
*/
|
|
24
|
+
export interface ReactRouterTracingIntegration extends Integration {
|
|
25
|
+
/**
|
|
26
|
+
* Client instrumentation for React Router's instrumentation API.
|
|
27
|
+
* Lazily initialized on first access.
|
|
28
|
+
* @experimental HydratedRouter doesn't invoke these hooks in Framework Mode yet.
|
|
29
|
+
*/
|
|
30
|
+
readonly clientInstrumentation: ClientInstrumentation;
|
|
31
|
+
}
|
|
2
32
|
/**
|
|
3
33
|
* Browser tracing integration for React Router (Framework) applications.
|
|
4
|
-
* This integration will create navigation spans and enhance
|
|
34
|
+
* This integration will create navigation spans and enhance transaction names with parameterized routes.
|
|
5
35
|
*/
|
|
6
|
-
export declare function reactRouterTracingIntegration():
|
|
36
|
+
export declare function reactRouterTracingIntegration(options?: ReactRouterTracingIntegrationOptions): ReactRouterTracingIntegration;
|
|
7
37
|
//# sourceMappingURL=tracingIntegration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracingIntegration.d.ts","sourceRoot":"","sources":["../../../src/client/tracingIntegration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tracingIntegration.d.ts","sourceRoot":"","sources":["../../../src/client/tracingIntegration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAEL,KAAK,wCAAwC,EAC9C,MAAM,+BAA+B,CAAC;AAGvC;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;OAGG;IACH,sBAAsB,CAAC,EAAE,wCAAwC,CAAC;IAElE;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,WAAW;IAChE;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;CACvD;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,GAAE,oCAAyC,GACjD,6BAA6B,CA8B/B"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for React Router's instrumentation API.
|
|
3
|
+
*
|
|
4
|
+
* Derived from React Router v7.x `unstable_instrumentations` API.
|
|
5
|
+
* The stable `instrumentations` API is planned for React Router v8.
|
|
6
|
+
* If React Router changes these types, this file must be updated.
|
|
7
|
+
*
|
|
8
|
+
* @see https://reactrouter.com/how-to/instrumentation
|
|
9
|
+
* @experimental
|
|
10
|
+
*/
|
|
11
|
+
export type InstrumentationResult = {
|
|
12
|
+
status: 'success';
|
|
13
|
+
error: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
status: 'error';
|
|
16
|
+
error: unknown;
|
|
17
|
+
};
|
|
18
|
+
export interface ReadonlyRequest {
|
|
19
|
+
method: string;
|
|
20
|
+
url: string;
|
|
21
|
+
headers: Pick<Headers, 'get'>;
|
|
22
|
+
}
|
|
23
|
+
export interface RouteHandlerInstrumentationInfo {
|
|
24
|
+
readonly request: ReadonlyRequest;
|
|
25
|
+
readonly params: Record<string, string | undefined>;
|
|
26
|
+
readonly pattern?: string;
|
|
27
|
+
readonly unstable_pattern?: string;
|
|
28
|
+
readonly context?: unknown;
|
|
29
|
+
}
|
|
30
|
+
export interface RouterNavigationInstrumentationInfo {
|
|
31
|
+
readonly to: string | number;
|
|
32
|
+
readonly currentUrl: string;
|
|
33
|
+
readonly formMethod?: string;
|
|
34
|
+
readonly formEncType?: string;
|
|
35
|
+
readonly formData?: FormData;
|
|
36
|
+
readonly body?: unknown;
|
|
37
|
+
}
|
|
38
|
+
export interface RouterFetchInstrumentationInfo {
|
|
39
|
+
readonly href: string;
|
|
40
|
+
readonly currentUrl: string;
|
|
41
|
+
readonly fetcherKey: string;
|
|
42
|
+
readonly formMethod?: string;
|
|
43
|
+
readonly formEncType?: string;
|
|
44
|
+
readonly formData?: FormData;
|
|
45
|
+
readonly body?: unknown;
|
|
46
|
+
}
|
|
47
|
+
export interface RequestHandlerInstrumentationInfo {
|
|
48
|
+
readonly request: Request;
|
|
49
|
+
readonly context: unknown;
|
|
50
|
+
}
|
|
51
|
+
export type InstrumentFunction<T> = (handler: () => Promise<InstrumentationResult>, info: T) => Promise<void>;
|
|
52
|
+
export interface RouteInstrumentations {
|
|
53
|
+
lazy?: InstrumentFunction<undefined>;
|
|
54
|
+
'lazy.loader'?: InstrumentFunction<undefined>;
|
|
55
|
+
'lazy.action'?: InstrumentFunction<undefined>;
|
|
56
|
+
'lazy.middleware'?: InstrumentFunction<undefined>;
|
|
57
|
+
middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
|
58
|
+
loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
|
59
|
+
action?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
|
60
|
+
}
|
|
61
|
+
export interface RouterInstrumentations {
|
|
62
|
+
navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>;
|
|
63
|
+
fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>;
|
|
64
|
+
}
|
|
65
|
+
export interface RequestHandlerInstrumentations {
|
|
66
|
+
request?: InstrumentFunction<RequestHandlerInstrumentationInfo>;
|
|
67
|
+
}
|
|
68
|
+
export interface InstrumentableRoute {
|
|
69
|
+
id: string;
|
|
70
|
+
index: boolean | undefined;
|
|
71
|
+
path: string | undefined;
|
|
72
|
+
instrument(instrumentations: RouteInstrumentations): void;
|
|
73
|
+
}
|
|
74
|
+
export interface InstrumentableRouter {
|
|
75
|
+
instrument(instrumentations: RouterInstrumentations): void;
|
|
76
|
+
}
|
|
77
|
+
export interface InstrumentableRequestHandler {
|
|
78
|
+
instrument(instrumentations: RequestHandlerInstrumentations): void;
|
|
79
|
+
}
|
|
80
|
+
export interface ClientInstrumentation {
|
|
81
|
+
router?(router: InstrumentableRouter): void;
|
|
82
|
+
route?(route: InstrumentableRoute): void;
|
|
83
|
+
}
|
|
84
|
+
export interface ServerInstrumentation {
|
|
85
|
+
handler?(handler: InstrumentableRequestHandler): void;
|
|
86
|
+
route?(route: InstrumentableRoute): void;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH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AgB,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAC3D;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,gBAAgB,EAAE,sBAAsB,GAAG,IAAI,CAAC;CAC5D;AAED,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,gBAAgB,EAAE,8BAA8B,GAAG,IAAI,CAAC;CACpE;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,CAAC,OAAO,EAAE,4BAA4B,GAAG,IAAI,CAAC;IACtD,KAAK,CAAC,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC1C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { InstrumentationResult } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts pathname from request URL.
|
|
4
|
+
* Falls back to '<unknown>' with DEBUG warning if URL cannot be parsed.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getPathFromRequest(request: {
|
|
7
|
+
url: string;
|
|
8
|
+
}): string;
|
|
9
|
+
/**
|
|
10
|
+
* Extracts route pattern from instrumentation info.
|
|
11
|
+
* Prefers `pattern` (planned for v8) over `unstable_pattern` (v7.x).
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPattern(info: {
|
|
14
|
+
pattern?: string;
|
|
15
|
+
unstable_pattern?: string;
|
|
16
|
+
}): string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Normalizes route path by ensuring it starts with a slash.
|
|
19
|
+
* Returns undefined if the input is falsy.
|
|
20
|
+
*/
|
|
21
|
+
export declare function normalizeRoutePath(pattern?: string): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Captures an error from instrumentation result.
|
|
24
|
+
* Caller must verify result contains an Error before calling.
|
|
25
|
+
*/
|
|
26
|
+
export declare function captureInstrumentationError(result: InstrumentationResult, captureErrors: boolean, mechanismType: string, data: Record<string, string | boolean>): void;
|
|
27
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/common/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAYnE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,SAAS,CAEpG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKvE;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,qBAAqB,EAC7B,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GACrC,IAAI,CAUN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSentryHandleError.d.ts","sourceRoot":"","sources":["../../../src/server/createSentryHandleError.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"createSentryHandleError.d.ts","sourceRoot":"","sources":["../../../src/server/createSentryHandleError.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,SAAiB,EAAE,EAAE,wBAAwB,GAAG,mBAAmB,CAuB5G"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ServerInstrumentation } from '../common/types';
|
|
2
|
+
export { isInstrumentationApiUsed } from './serverGlobals';
|
|
3
|
+
/**
|
|
4
|
+
* Options for creating Sentry server instrumentation.
|
|
5
|
+
*/
|
|
6
|
+
export interface CreateSentryServerInstrumentationOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Whether to capture errors from loaders/actions automatically.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
captureErrors?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a Sentry server instrumentation for React Router's instrumentation API.
|
|
15
|
+
* @experimental
|
|
16
|
+
*/
|
|
17
|
+
export declare function createSentryServerInstrumentation(options?: CreateSentryServerInstrumentationOptions): ServerInstrumentation;
|
|
18
|
+
//# sourceMappingURL=createServerInstrumentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createServerInstrumentation.d.ts","sourceRoot":"","sources":["../../../src/server/createServerInstrumentation.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAqD,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAKhH,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,wCAAwC;IACvD;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,CAC/C,OAAO,GAAE,wCAA6C,GACrD,qBAAqB,CA8KvB"}
|
|
@@ -6,4 +6,5 @@ export { wrapServerAction } from './wrapServerAction';
|
|
|
6
6
|
export { wrapServerLoader } from './wrapServerLoader';
|
|
7
7
|
export { createSentryHandleError, type SentryHandleErrorOptions } from './createSentryHandleError';
|
|
8
8
|
export { getMetaTagTransformer } from './getMetaTagTransformer';
|
|
9
|
+
export { createSentryServerInstrumentation, isInstrumentationApiUsed, type CreateSentryServerInstrumentationOptions, } from './createServerInstrumentation';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAGA,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,KAAK,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,KAAK,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAGA,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,KAAK,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,KAAK,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EACL,iCAAiC,EACjC,wBAAwB,EACxB,KAAK,wCAAwC,GAC9C,MAAM,+BAA+B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactRouter.d.ts","sourceRoot":"","sources":["../../../../src/server/instrumentation/reactRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,mCAAmC,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"reactRouter.d.ts","sourceRoot":"","sources":["../../../../src/server/instrumentation/reactRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,mCAAmC,EAAE,MAAM,gCAAgC,CAAC;AAwB1G;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,mBAAmB,CAAC,qBAAqB,CAAC;gBACrE,MAAM,GAAE,qBAA0B;IAIrD;;OAEG;IAEH,SAAS,CAAC,IAAI,IAAI,mCAAmC;IAgBrD;;;OAGG;IACH,OAAO,CAAC,yBAAyB;CAmElC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactRouterServer.d.ts","sourceRoot":"","sources":["../../../../src/server/integration/reactRouterServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reactRouterServer.d.ts","sourceRoot":"","sources":["../../../../src/server/integration/reactRouterServer.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,2BAA2B,SAClC,IAAI;;CAIT,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,0CAsCvC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mark that the React Router instrumentation API is being used on the server.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare function markInstrumentationApiUsed(): void;
|
|
6
|
+
/**
|
|
7
|
+
* Check if React Router's instrumentation API is being used on the server.
|
|
8
|
+
* @experimental
|
|
9
|
+
*/
|
|
10
|
+
export declare function isInstrumentationApiUsed(): boolean;
|
|
11
|
+
//# sourceMappingURL=serverGlobals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverGlobals.d.ts","sourceRoot":"","sources":["../../../src/server/serverGlobals.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAElD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapSentryHandleRequest.d.ts","sourceRoot":"","sources":["../../../src/server/wrapSentryHandleRequest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wrapSentryHandleRequest.d.ts","sourceRoot":"","sources":["../../../src/server/wrapSentryHandleRequest.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGxF,KAAK,sCAAsC,GAAG,CAC5C,OAAO,EAAE,OAAO,EAChB,kBAAkB,EAAE,MAAM,EAC1B,eAAe,EAAE,OAAO,EACxB,aAAa,EAAE,YAAY,EAC3B,WAAW,EAAE,cAAc,KACxB,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,KAAK,mCAAmC,GAAG,CACzC,OAAO,EAAE,OAAO,EAChB,kBAAkB,EAAE,MAAM,EAC1B,eAAe,EAAE,OAAO,EACxB,aAAa,EAAE,YAAY,EAC3B,WAAW,EAAE,qBAAqB,KAC/B,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,sCAAsC,GACrD,sCAAsC,CAAC;AAC1C;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,mCAAmC,GAClD,mCAAmC,CAAC;AA6FvC,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,gCAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapServerAction.d.ts","sourceRoot":"","sources":["../../../src/server/wrapServerAction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"wrapServerAction.d.ts","sourceRoot":"","sources":["../../../src/server/wrapServerAction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAanD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIvD,KAAK,WAAW,GAAG;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B,CAAC;AAKF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,OAAO,EAAE,WAAW,YAAK,EACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC,CAAC,CAAC,GACjD,CAAC,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC,CAAC,CAAC,CAoD1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapServerLoader.d.ts","sourceRoot":"","sources":["../../../src/server/wrapServerLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"wrapServerLoader.d.ts","sourceRoot":"","sources":["../../../src/server/wrapServerLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAanD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIvD,KAAK,WAAW,GAAG;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B,CAAC;AAKF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,OAAO,EAAE,WAAW,YAAK,EACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC,CAAC,CAAC,GACjD,CAAC,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC,CAAC,CAAC,CAoD1C"}
|