@sentry/react 6.19.4 → 7.0.0-alpha.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/types → cjs}/constants.d.ts +0 -0
- package/{build/types → cjs}/constants.d.ts.map +0 -0
- package/{dist → cjs}/constants.js +0 -0
- package/cjs/constants.js.map +1 -0
- package/{build/types → cjs}/errorboundary.d.ts +0 -0
- package/{build/types → cjs}/errorboundary.d.ts.map +1 -1
- package/{dist → cjs}/errorboundary.js +2 -1
- package/cjs/errorboundary.js.map +1 -0
- package/cjs/flags.d.ts +3 -0
- package/cjs/flags.d.ts.map +1 -0
- package/cjs/flags.js +17 -0
- package/cjs/flags.js.map +1 -0
- package/{build/types → cjs}/index.d.ts +0 -0
- package/{build/types → cjs}/index.d.ts.map +0 -0
- package/{dist → cjs}/index.js +0 -0
- package/cjs/index.js.map +1 -0
- package/{build/types → cjs}/profiler.d.ts +0 -1
- package/cjs/profiler.d.ts.map +1 -0
- package/{dist → cjs}/profiler.js +6 -74
- package/cjs/profiler.js.map +1 -0
- package/{build/types → cjs}/reactrouter.d.ts +0 -0
- package/{build/types → cjs}/reactrouter.d.ts.map +0 -0
- package/{dist → cjs}/reactrouter.js +0 -0
- package/cjs/reactrouter.js.map +1 -0
- package/{build/types → cjs}/reactrouterv3.d.ts +0 -0
- package/{build/types → cjs}/reactrouterv3.d.ts.map +0 -0
- package/{dist → cjs}/reactrouterv3.js +0 -0
- package/cjs/reactrouterv3.js.map +1 -0
- package/{build/types → cjs}/redux.d.ts +0 -0
- package/{build/types → cjs}/redux.d.ts.map +0 -0
- package/{dist → cjs}/redux.js +0 -0
- package/cjs/redux.js.map +1 -0
- package/{build/types → cjs}/sdk.d.ts +0 -0
- package/{build/types → cjs}/sdk.d.ts.map +0 -0
- package/{dist → cjs}/sdk.js +0 -0
- package/cjs/sdk.js.map +1 -0
- package/{build/types → cjs}/types.d.ts +0 -0
- package/{build/types → cjs}/types.d.ts.map +0 -0
- package/{dist → cjs}/types.js +0 -0
- package/cjs/types.js.map +1 -0
- package/esm/constants.d.ts.map +1 -1
- package/esm/constants.js.map +1 -1
- package/esm/errorboundary.d.ts.map +1 -1
- package/esm/errorboundary.js +3 -2
- package/esm/errorboundary.js.map +1 -1
- package/esm/flags.d.ts +3 -0
- package/esm/flags.d.ts.map +1 -0
- package/esm/flags.js +16 -0
- package/esm/flags.js.map +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js.map +1 -1
- package/esm/profiler.d.ts +0 -1
- package/esm/profiler.d.ts.map +1 -1
- package/esm/profiler.js +6 -74
- package/esm/profiler.js.map +1 -1
- package/esm/reactrouter.d.ts.map +1 -1
- package/esm/reactrouter.js.map +1 -1
- package/esm/reactrouterv3.d.ts.map +1 -1
- package/esm/reactrouterv3.js.map +1 -1
- package/esm/redux.d.ts.map +1 -1
- package/esm/redux.js.map +1 -1
- package/esm/sdk.d.ts.map +1 -1
- package/esm/sdk.js.map +1 -1
- package/esm/types.d.ts.map +1 -1
- package/esm/types.js.map +1 -1
- package/package.json +9 -61
- package/{dist → types}/constants.d.ts +0 -0
- package/types/constants.d.ts.map +1 -0
- package/{dist → types}/errorboundary.d.ts +0 -0
- package/types/errorboundary.d.ts.map +1 -0
- package/types/flags.d.ts +3 -0
- package/types/flags.d.ts.map +1 -0
- package/{dist → types}/index.d.ts +0 -0
- package/types/index.d.ts.map +1 -0
- package/{dist → types}/profiler.d.ts +0 -1
- package/types/profiler.d.ts.map +1 -0
- package/{dist → types}/reactrouter.d.ts +0 -0
- package/types/reactrouter.d.ts.map +1 -0
- package/{dist → types}/reactrouterv3.d.ts +0 -0
- package/types/reactrouterv3.d.ts.map +1 -0
- package/{dist → types}/redux.d.ts +0 -0
- package/types/redux.d.ts.map +1 -0
- package/{dist → types}/sdk.d.ts +0 -0
- package/types/sdk.d.ts.map +1 -0
- package/{dist → types}/types.d.ts +0 -0
- package/types/types.d.ts.map +1 -0
- package/build/types/profiler.d.ts.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/errorboundary.d.ts.map +0 -1
- package/dist/errorboundary.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/profiler.d.ts.map +0 -1
- package/dist/profiler.js.map +0 -1
- package/dist/reactrouter.d.ts.map +0 -1
- package/dist/reactrouter.js.map +0 -1
- package/dist/reactrouterv3.d.ts.map +0 -1
- package/dist/reactrouterv3.js.map +0 -1
- package/dist/redux.d.ts.map +0 -1
- package/dist/redux.js.map +0 -1
- package/dist/sdk.d.ts.map +0 -1
- package/dist/sdk.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";AAAa,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAEpC,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAEpC,QAAA,cAAc,GAAG,gBAAgB,CAAC","sourcesContent":["export const REACT_RENDER_OP = 'ui.react.render';\n\nexport const REACT_UPDATE_OP = 'ui.react.update';\n\nexport const REACT_MOUNT_OP = 'ui.react.mount';\n"]}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorboundary.d.ts","sourceRoot":"","sources":["../../src/errorboundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,mBAAmB,EAAE,KAAK,EAA+B,MAAM,iBAAiB,CAAC;AAG5G,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"errorboundary.d.ts","sourceRoot":"","sources":["../../src/errorboundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,mBAAmB,EAAE,KAAK,EAA+B,MAAM,iBAAiB,CAAC;AAG5G,OAAO,KAAK,KAAK,MAAM,OAAO,C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B,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;IACzD,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAQF;;;;;GAKG;AACH,cAAM,aAAc,SAAQ,KAAK,CAAC,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAC1E,KAAK,EAAE,kBAAkB,CAAiB;IAE1C,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG;QAAE,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE,EAAE,EAAE,cAAc,EAAE,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI;IAiC9F,iBAAiB,IAAI,IAAI;IAOzB,oBAAoB,IAAI,IAAI;IAQ5B,kBAAkB,EAAE,MAAM,IAAI,CAOnC;IAEK,MAAM,IAAI,KAAK,CAAC,SAAS;CA6BjC;AAGD,iBAAS,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACtD,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACxC,oBAAoB,EAAE,kBAAkB,GACvC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAiBb;AAED,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -4,6 +4,7 @@ var browser_1 = require("@sentry/browser");
|
|
|
4
4
|
var utils_1 = require("@sentry/utils");
|
|
5
5
|
var hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics"));
|
|
6
6
|
var React = tslib_1.__importStar(require("react"));
|
|
7
|
+
var flags_1 = require("./flags");
|
|
7
8
|
function isAtLeastReact17(version) {
|
|
8
9
|
var major = version.match(/^([^.]+)/);
|
|
9
10
|
return major !== null && parseInt(major[0]) >= 17;
|
|
@@ -94,7 +95,7 @@ var ErrorBoundary = /** @class */ (function (_super) {
|
|
|
94
95
|
return element;
|
|
95
96
|
}
|
|
96
97
|
if (fallback) {
|
|
97
|
-
|
|
98
|
+
flags_1.IS_DEBUG_BUILD && utils_1.logger.warn('fallback did not produce a valid ReactElement');
|
|
98
99
|
}
|
|
99
100
|
// Fail gracefully if no fallback provided or is not valid
|
|
100
101
|
return null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorboundary.js","sourceRoot":"","sources":["../../src/errorboundary.tsx"],"names":[],"mappings":";;AAAA,2CAA4G;AAC5G,uCAAuC;AACvC,4FAA2D;AAC3D,mDAA+B;AAE/B,iCAAyC;AAEzC,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,IAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxC,OAAO,KAAK,KAAK,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACpD,CAAC;AAHD,4CAGC;AAEY,QAAA,iBAAiB,GAAG,SAAS,CAAC;AA4C3C,IAAM,aAAa,GAAG;IACpB,cAAc,EAAE,IAAI;IACpB,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;CACd,CAAC;AAEF;;;;;GAKG;AACH;IAA4B,yCAAuD;IAAnF;QAAA,qEAyFC;QAxFQ,WAAK,GAAuB,aAAa,CAAC;QAkD1C,wBAAkB,GAAe;YAC9B,IAAA,6BAAO,CAAgB;YACzB,IAAA,gBAA+C,EAA7C,gBAAK,EAAE,kCAAc,EAAE,oBAAsB,CAAC;YACtD,IAAI,OAAO,EAAE;gBACX,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;aACzC;YACD,KAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAC/B,CAAC,CAAC;;IA+BJ,CAAC;IAtFQ,yCAAiB,GAAxB,UAAyB,KAAgC,EAAE,EAAmC;QAA9F,iBA+BC;YA/B4D,kCAAc;QACnE,IAAA,eAAkE,EAAh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oBAAoB;QACrC,oBAAC,gBAAgB,uBAAK,KAAK,EAAI,CACjB,CACjB,EAJ0C,CAI1C,CAAC;IAEF,sEAAsE;IACtE,OAAO,CAAC,WAAW,GAAG,mBAAiB,oBAAoB,MAAG,CAAC;IAE/D,kEAAkE;IAClE,gGAAgG;IAChG,iCAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAChD,OAAO,OAAO,CAAC;AACjB,CAAC;AAEuB,8CAAiB","sourcesContent":["import { captureException, ReportDialogOptions, Scope, showReportDialog, withScope } from '@sentry/browser';\nimport { logger } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\n\nimport { IS_DEBUG_BUILD } from './flags';\n\nexport function isAtLeastReact17(version: string): boolean {\n const major = version.match(/^([^.]+)/);\n return major !== null && parseInt(major[0]) >= 17;\n}\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type FallbackRender = (errorData: {\n error: Error;\n componentStack: string | null;\n eventId: string | null;\n resetError(): void;\n}) => React.ReactElement;\n\nexport type ErrorBoundaryProps = {\n /** If a Sentry report dialog should be rendered on error */\n showDialog?: boolean;\n /**\n * Options to be passed into the Sentry report dialog.\n * No-op if {@link showDialog} is false.\n */\n dialogOptions?: ReportDialogOptions;\n /**\n * A fallback component that gets rendered when the error boundary encounters an error.\n *\n * Can either provide a React Component, or a function that returns React Component as\n * a valid fallback prop. If a function is provided, the function will be called with\n * the error, the component stack, and an function that resets the error boundary on error.\n *\n */\n fallback?: React.ReactElement | FallbackRender;\n /** Called when the error boundary encounters an error */\n onError?(error: Error, componentStack: string, eventId: string): void;\n /** Called on componentDidMount() */\n onMount?(): void;\n /** Called if resetError() is called from the fallback render props function */\n onReset?(error: Error | null, componentStack: string | null, eventId: string | null): void;\n /** Called on componentWillUnmount() */\n onUnmount?(error: Error | null, componentStack: string | null, eventId: string | null): void;\n /** Called before the error is captured by Sentry, allows for you to add tags or context using the scope */\n beforeCapture?(scope: Scope, error: Error | null, componentStack: string | null): void;\n};\n\ntype ErrorBoundaryState = {\n componentStack: React.ErrorInfo['componentStack'] | null;\n error: Error | null;\n eventId: string | null;\n};\n\nconst INITIAL_STATE = {\n componentStack: null,\n error: null,\n eventId: null,\n};\n\n/**\n * A ErrorBoundary component that logs errors to Sentry. Requires React >= 16.\n * NOTE: If you are a Sentry user, and you are seeing this stack frame, it means the\n * Sentry React SDK ErrorBoundary caught an error invoking your application code. This\n * is expected behavior and NOT indicative of a bug with the Sentry React SDK.\n */\nclass ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n public state: ErrorBoundaryState = INITIAL_STATE;\n\n public componentDidCatch(error: Error & { cause?: Error }, { componentStack }: React.ErrorInfo): void {\n const { beforeCapture, onError, showDialog, dialogOptions } = this.props;\n\n withScope(scope => {\n // If on React version >= 17, create stack trace from componentStack param and links\n // to to the original error using `error.cause` otherwise relies on error param for stacktrace.\n // Linking errors requires the `LinkedErrors` integration be enabled.\n if (isAtLeastReact17(React.version)) {\n const errorBoundaryError = new Error(error.message);\n errorBoundaryError.name = `React ErrorBoundary ${errorBoundaryError.name}`;\n errorBoundaryError.stack = componentStack;\n\n // Using the `LinkedErrors` integration to link the errors together.\n error.cause = errorBoundaryError;\n }\n\n if (beforeCapture) {\n beforeCapture(scope, error, componentStack);\n }\n const eventId = captureException(error, { contexts: { react: { componentStack } } });\n if (onError) {\n onError(error, componentStack, eventId);\n }\n if (showDialog) {\n showReportDialog({ ...dialogOptions, eventId });\n }\n\n // componentDidCatch is used over getDerivedStateFromError\n // so that componentStack is accessible through state.\n this.setState({ error, componentStack, eventId });\n });\n }\n\n public componentDidMount(): void {\n const { onMount } = this.props;\n if (onMount) {\n onMount();\n }\n }\n\n public componentWillUnmount(): void {\n const { error, componentStack, eventId } = this.state;\n const { onUnmount } = this.props;\n if (onUnmount) {\n onUnmount(error, componentStack, eventId);\n }\n }\n\n public resetErrorBoundary: () => void = () => {\n const { onReset } = this.props;\n const { error, componentStack, eventId } = this.state;\n if (onReset) {\n onReset(error, componentStack, eventId);\n }\n this.setState(INITIAL_STATE);\n };\n\n public render(): React.ReactNode {\n const { fallback, children } = this.props;\n const { error, componentStack, eventId } = this.state;\n\n if (error) {\n let element: React.ReactElement | undefined = undefined;\n if (typeof fallback === 'function') {\n element = fallback({ error, componentStack, resetError: this.resetErrorBoundary, eventId });\n } else {\n element = fallback;\n }\n\n if (React.isValidElement(element)) {\n return element;\n }\n\n if (fallback) {\n IS_DEBUG_BUILD && logger.warn('fallback did not produce a valid ReactElement');\n }\n\n // Fail gracefully if no fallback provided or is not valid\n return null;\n }\n\n if (typeof children === 'function') {\n return children();\n }\n return children;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withErrorBoundary<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n errorBoundaryOptions: ErrorBoundaryProps,\n): React.FC<P> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <ErrorBoundary {...errorBoundaryOptions}>\n <WrappedComponent {...props} />\n </ErrorBoundary>\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n Wrapped.displayName = `errorBoundary(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\nexport { ErrorBoundary, withErrorBoundary };\n"]}
|
package/cjs/flags.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../src/flags.ts"],"names":[],"mappings":"AAgBA,2DAA2D;AAC3D,eAAO,MAAM,cAAc,SAAoE,CAAC"}
|
package/cjs/flags.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking
|
|
3
|
+
* for users.
|
|
4
|
+
*
|
|
5
|
+
* Debug flags need to be declared in each package individually and must not be imported across package boundaries,
|
|
6
|
+
* because some build tools have trouble tree-shaking imported guards.
|
|
7
|
+
*
|
|
8
|
+
* As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.
|
|
9
|
+
*
|
|
10
|
+
* Debug flag files will contain "magic strings" like `__SENTRY_DEBUG__` that may get replaced with actual values during
|
|
11
|
+
* our, or the user's build process. Take care when introducing new flags - they must not throw if they are not
|
|
12
|
+
* replaced.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
/** Flag that is true for debug builds, false otherwise. */
|
|
16
|
+
exports.IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;
|
|
17
|
+
//# sourceMappingURL=flags.js.map
|
package/cjs/flags.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;;AAIH,2DAA2D;AAC9C,QAAA,cAAc,GAAG,OAAO,gBAAgB,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC","sourcesContent":["/*\n * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking\n * for users.\n *\n * Debug flags need to be declared in each package individually and must not be imported across package boundaries,\n * because some build tools have trouble tree-shaking imported guards.\n *\n * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.\n *\n * Debug flag files will contain \"magic strings\" like `__SENTRY_DEBUG__` that may get replaced with actual values during\n * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not\n * replaced.\n */\n\ndeclare const __SENTRY_DEBUG__: boolean;\n\n/** Flag that is true for debug builds, false otherwise. */\nexport const IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;\n"]}
|
|
File without changes
|
|
File without changes
|
package/{dist → cjs}/index.js
RENAMED
|
File without changes
|
package/cjs/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,0DAAgC;AAEhC,6BAA6B;AAApB,qBAAA,IAAI,CAAA;AACb,uCAAiE;AAAxD,8BAAA,QAAQ,CAAA;AAAE,kCAAA,YAAY,CAAA;AAAE,iCAAA,WAAW,CAAA;AAC5C,iDAAmE;AAA1D,wCAAA,aAAa,CAAA;AAAE,4CAAA,iBAAiB,CAAA;AACzC,iCAA8C;AAArC,sCAAA,mBAAmB,CAAA;AAC5B,iDAA+D;AAAtD,uDAAA,4BAA4B,CAAA;AACrC,6CAA8G;AAArG,qDAAA,4BAA4B,CAAA;AAAE,qDAAA,4BAA4B,CAAA;AAAE,0CAAA,iBAAiB,CAAA","sourcesContent":["export * from '@sentry/browser';\n\nexport { init } from './sdk';\nexport { Profiler, withProfiler, useProfiler } from './profiler';\nexport { ErrorBoundary, withErrorBoundary } from './errorboundary';\nexport { createReduxEnhancer } from './redux';\nexport { reactRouterV3Instrumentation } from './reactrouterv3';\nexport { reactRouterV4Instrumentation, reactRouterV5Instrumentation, withSentryRouting } from './reactrouter';\n"]}
|
|
@@ -21,7 +21,6 @@ declare class Profiler extends React.Component<ProfilerProps> {
|
|
|
21
21
|
* Made protected for the React Native SDK to access
|
|
22
22
|
*/
|
|
23
23
|
protected _mountSpan: Span | undefined;
|
|
24
|
-
private _mountActivity;
|
|
25
24
|
static defaultProps: Partial<ProfilerProps>;
|
|
26
25
|
constructor(props: ProfilerProps);
|
|
27
26
|
componentDidMount(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler.d.ts","sourceRoot":"","sources":["../../src/profiler.tsx"],"names":[],"m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,EACZ,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAGrD,GACA,IAAI,CAmCN;AAED,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAE/C,yCAAyC;AACzC,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,WAAW,EAAE,GAAG,GAAE,GAAqB,GAAG,CAAC,GAAG,SAAS,CASrG"}
|
package/{dist → cjs}/profiler.js
RENAMED
|
@@ -8,57 +8,6 @@ var hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react
|
|
|
8
8
|
var React = tslib_1.__importStar(require("react"));
|
|
9
9
|
var constants_1 = require("./constants");
|
|
10
10
|
exports.UNKNOWN_COMPONENT = 'unknown';
|
|
11
|
-
var TRACING_GETTER = {
|
|
12
|
-
id: 'Tracing',
|
|
13
|
-
};
|
|
14
|
-
var globalTracingIntegration = null;
|
|
15
|
-
/** @deprecated remove when @sentry/apm no longer used */
|
|
16
|
-
var getTracingIntegration = function () {
|
|
17
|
-
if (globalTracingIntegration) {
|
|
18
|
-
return globalTracingIntegration;
|
|
19
|
-
}
|
|
20
|
-
globalTracingIntegration = browser_1.getCurrentHub().getIntegration(TRACING_GETTER);
|
|
21
|
-
return globalTracingIntegration;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* pushActivity creates an new react activity.
|
|
25
|
-
* Is a no-op if Tracing integration is not valid
|
|
26
|
-
* @param name displayName of component that started activity
|
|
27
|
-
* @deprecated remove when @sentry/apm no longer used
|
|
28
|
-
*/
|
|
29
|
-
function pushActivity(name, op) {
|
|
30
|
-
if (globalTracingIntegration === null) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return globalTracingIntegration.constructor.pushActivity(name, {
|
|
34
|
-
description: "<" + name + ">",
|
|
35
|
-
op: op,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* popActivity removes a React activity.
|
|
40
|
-
* Is a no-op if Tracing integration is not valid.
|
|
41
|
-
* @param activity id of activity that is being popped
|
|
42
|
-
* @deprecated remove when @sentry/apm no longer used
|
|
43
|
-
*/
|
|
44
|
-
function popActivity(activity) {
|
|
45
|
-
if (activity === null || globalTracingIntegration === null) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
globalTracingIntegration.constructor.popActivity(activity);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Obtain a span given an activity id.
|
|
52
|
-
* Is a no-op if Tracing integration is not valid.
|
|
53
|
-
* @param activity activity id associated with obtained span
|
|
54
|
-
* @deprecated remove when @sentry/apm no longer used
|
|
55
|
-
*/
|
|
56
|
-
function getActivitySpan(activity) {
|
|
57
|
-
if (activity === null || globalTracingIntegration === null) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
return globalTracingIntegration.constructor.getActivitySpan(activity);
|
|
61
|
-
}
|
|
62
11
|
/**
|
|
63
12
|
* The Profiler component leverages Sentry's Tracing integration to generate
|
|
64
13
|
* spans based on component lifecycles.
|
|
@@ -72,26 +21,16 @@ var Profiler = /** @class */ (function (_super) {
|
|
|
72
21
|
* Made protected for the React Native SDK to access
|
|
73
22
|
*/
|
|
74
23
|
_this._mountSpan = undefined;
|
|
75
|
-
// The activity representing how long it takes to mount a component.
|
|
76
|
-
_this._mountActivity = null;
|
|
77
24
|
var _a = _this.props, name = _a.name, _b = _a.disabled, disabled = _b === void 0 ? false : _b;
|
|
78
25
|
if (disabled) {
|
|
79
26
|
return _this;
|
|
80
27
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
else {
|
|
88
|
-
var activeTransaction = getActiveTransaction();
|
|
89
|
-
if (activeTransaction) {
|
|
90
|
-
_this._mountSpan = activeTransaction.startChild({
|
|
91
|
-
description: "<" + name + ">",
|
|
92
|
-
op: constants_1.REACT_MOUNT_OP,
|
|
93
|
-
});
|
|
94
|
-
}
|
|
28
|
+
var activeTransaction = getActiveTransaction();
|
|
29
|
+
if (activeTransaction) {
|
|
30
|
+
_this._mountSpan = activeTransaction.startChild({
|
|
31
|
+
description: "<" + name + ">",
|
|
32
|
+
op: constants_1.REACT_MOUNT_OP,
|
|
33
|
+
});
|
|
95
34
|
}
|
|
96
35
|
return _this;
|
|
97
36
|
}
|
|
@@ -100,13 +39,6 @@ var Profiler = /** @class */ (function (_super) {
|
|
|
100
39
|
if (this._mountSpan) {
|
|
101
40
|
this._mountSpan.finish();
|
|
102
41
|
}
|
|
103
|
-
else {
|
|
104
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
105
|
-
this._mountSpan = getActivitySpan(this._mountActivity);
|
|
106
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
107
|
-
popActivity(this._mountActivity);
|
|
108
|
-
this._mountActivity = null;
|
|
109
|
-
}
|
|
110
42
|
};
|
|
111
43
|
Profiler.prototype.componentDidUpdate = function (_a) {
|
|
112
44
|
var _this = this;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler.js","sourceRoot":"","sources":["../../src/profiler.tsx"],"names":[],"mappings":";;AAAA,+DAA+D;AAC/D,uDAAuD;AACvD,2CAAqD;AAErD,uCAAgD;AAChD,4FAA2D;AAC3D,mDAA+B;AAE/B,yCAA+E;AAElE,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAgB3C;;;GAGG;AACH;IAAuB,oCAA8B;IAcnD,kBAAmB,KAAoB;QAAvC,YACE,kBAAM,KAAK,CAAC,SAcb;QA5BD;;;WAGG;QACO,gBAAU,GAAqB,SAAS,CAAC;QAW3C,IAAA,gBAAuC,EAArC,cAAI,EAAE,gBAAgB,EAAhB,qCAA+B,CAAC;QAE9C,IAAI,QAAQ,EAAE;;SAEb;QAED,IAAM,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;QACjD,IAAI,iBAAiB,EAAE;YACrB,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C;AAoDQ,oCAAY;AAlDrB;;;;;;GAMG;AACH,SAAS,WAAW,CAClB,IAAY,EACZ,OAGC;IAHD,wBAAA,EAAA;QACE,QAAQ,EAAE,KAAK;QACf,aAAa,EAAE,IAAI;KACpB;IAEK,IAAA;;;;;;;;;;;;UAcJ,EAdK,iBAcL,CAAC;IAEH,KAAK,CAAC,SAAS,CAAC;QACd,IAAI,SAAS,EAAE;YACb,SAAS,CAAC,MAAM,EAAE,CAAC;SACpB;QAED,OAAO;YACL,IAAI,SAAS,IAAI,OAAO,CAAC,aAAa,EAAE;gBACtC,SAAS,CAAC,UAAU,CAAC;oBACnB,WAAW,EAAE,MAAI,IAAI,MAAG;oBACxB,YAAY,EAAE,uBAAe,EAAE;oBAC/B,EAAE,EAAE,2BAAe;oBACnB,cAAc,EAAE,SAAS,CAAC,YAAY;iBACvC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC;QACF,iCAAiC;QACjC,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAEgC,kCAAW;AAE5C,yCAAyC;AACzC,SAAgB,oBAAoB,CAAwB,GAA0B;IAA1B,oBAAA,EAAA,MAAW,uBAAa,EAAE;IACpF,IAAI,GAAG,EAAE;QACP,IAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC7B,IAAI,KAAK,EAAE;YACT,OAAO,KAAK,CAAC,cAAc,EAAmB,CAAC;SAChD;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AATD,oDASC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { getCurrentHub, Hub } from '@sentry/browser';\nimport { Span, Transaction } from '@sentry/types';\nimport { timestampWithMs } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\n\nimport { REACT_MOUNT_OP, REACT_RENDER_OP, REACT_UPDATE_OP } from './constants';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type ProfilerProps = {\n // The name of the component being profiled.\n name: string;\n // If the Profiler is disabled. False by default. This is useful if you want to disable profilers\n // in certain environments.\n disabled?: boolean;\n // If time component is on page should be displayed as spans. True by default.\n includeRender?: boolean;\n // If component updates should be displayed as spans. True by default.\n includeUpdates?: boolean;\n // props given to component being profiled.\n updateProps: { [key: string]: unknown };\n};\n\n/**\n * The Profiler component leverages Sentry's Tracing integration to generate\n * spans based on component lifecycles.\n */\nclass Profiler extends React.Component<ProfilerProps> {\n /**\n * The span of the mount activity\n * Made protected for the React Native SDK to access\n */\n protected _mountSpan: Span | undefined = undefined;\n\n // eslint-disable-next-line @typescript-eslint/member-ordering\n public static defaultProps: Partial<ProfilerProps> = {\n disabled: false,\n includeRender: true,\n includeUpdates: true,\n };\n\n public constructor(props: ProfilerProps) {\n super(props);\n const { name, disabled = false } = this.props;\n\n if (disabled) {\n return;\n }\n\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n this._mountSpan = activeTransaction.startChild({\n description: `<${name}>`,\n op: REACT_MOUNT_OP,\n });\n }\n }\n\n // If a component mounted, we can finish the mount activity.\n public componentDidMount(): void {\n if (this._mountSpan) {\n this._mountSpan.finish();\n }\n }\n\n public componentDidUpdate({ updateProps, includeUpdates = true }: ProfilerProps): void {\n // Only generate an update span if hasUpdateSpan is true, if there is a valid mountSpan,\n // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.\n // We are just trying to give baseline clues for further investigation.\n if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {\n // See what props haved changed between the previous props, and the current props. This is\n // set as data on the span. We just store the prop keys as the values could be potenially very large.\n const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);\n if (changedProps.length > 0) {\n // The update span is a point in time span with 0 duration, just signifying that the component\n // has been updated.\n const now = timestampWithMs();\n this._mountSpan.startChild({\n data: {\n changedProps,\n },\n description: `<${this.props.name}>`,\n endTimestamp: now,\n op: REACT_UPDATE_OP,\n startTimestamp: now,\n });\n }\n }\n }\n\n // If a component is unmounted, we can say it is no longer on the screen.\n // This means we can finish the span representing the component render.\n public componentWillUnmount(): void {\n const { name, includeRender = true } = this.props;\n\n if (this._mountSpan && includeRender) {\n // If we were able to obtain the spanId of the mount activity, we should set the\n // next activity as a child to the component mount activity.\n this._mountSpan.startChild({\n description: `<${name}>`,\n endTimestamp: timestampWithMs(),\n op: REACT_RENDER_OP,\n startTimestamp: this._mountSpan.endTimestamp,\n });\n }\n }\n\n public render(): React.ReactNode {\n return this.props.children;\n }\n}\n\n/**\n * withProfiler is a higher order component that wraps a\n * component in a {@link Profiler} component. It is recommended that\n * the higher order component be used over the regular {@link Profiler} component.\n *\n * @param WrappedComponent component that is wrapped by Profiler\n * @param options the {@link ProfilerProps} you can pass into the Profiler\n */\nfunction withProfiler<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n // We do not want to have `updateProps` given in options, it is instead filled through the HOC.\n options?: Pick<Partial<ProfilerProps>, Exclude<keyof ProfilerProps, 'updateProps'>>,\n): React.FC<P> {\n const componentDisplayName =\n (options && options.name) || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <Profiler {...options} name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </Profiler>\n );\n\n Wrapped.displayName = `profiler(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\n/**\n *\n * `useProfiler` is a React hook that profiles a React component.\n *\n * Requires React 16.8 or above.\n * @param name displayName of component being profiled\n */\nfunction useProfiler(\n name: string,\n options: { disabled?: boolean; hasRenderSpan?: boolean } = {\n disabled: false,\n hasRenderSpan: true,\n },\n): void {\n const [mountSpan] = React.useState(() => {\n if (options && options.disabled) {\n return undefined;\n }\n\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n return activeTransaction.startChild({\n description: `<${name}>`,\n op: REACT_MOUNT_OP,\n });\n }\n\n return undefined;\n });\n\n React.useEffect(() => {\n if (mountSpan) {\n mountSpan.finish();\n }\n\n return (): void => {\n if (mountSpan && options.hasRenderSpan) {\n mountSpan.startChild({\n description: `<${name}>`,\n endTimestamp: timestampWithMs(),\n op: REACT_RENDER_OP,\n startTimestamp: mountSpan.endTimestamp,\n });\n }\n };\n // We only want this to run once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n\nexport { withProfiler, Profiler, useProfiler };\n\n/** Grabs active transaction off scope */\nexport function getActiveTransaction<T extends Transaction>(hub: Hub = getCurrentHub()): T | undefined {\n if (hub) {\n const scope = hub.getScope();\n if (scope) {\n return scope.getTransaction() as T | undefined;\n }\n }\n\n return undefined;\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactrouter.js","sourceRoot":"","sources":["../../src/reactrouter.tsx"],"names":[],"mappings":";;AACA,uCAAgD;AAChD,4FAA2D;AAC3D,mDAA+B;AAuB/B,sDAAsD;AAEtD,IAAM,MAAM,GAAG,uBAAe,EAAU,CAAC;AAEzC,IAAI,iBAA0C,CAAC;AAE/C,SAAgB,4BAA4B,CAC1C,OAAsB,EACtB,MAAsB,EACtB,SAAqB;IAErB,OAAO,gCAAgC,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AACzF,CAAC;AAND,oEAMC;AAED,SAAgB,4BAA4B,CAC1C,OAAsB,EACtB,MAAsB,EACtB,SAAqB;IAErB,OAAO,gCAAgC,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AACzF,CAAC;AAND,oEAMC;AAED,SAAS,gCAAgC,CACvC,OAAsB,EACtB,IAAY,EACZ,SAA6B,EAC7B,SAAqB;I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AAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAgB;IACxC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,KAAK,GAAG,EAAE,CAAC;AACxE,CAAC;AAED,mGAAmG;AACnG,SAAgB,iBAAiB,CAAkE,KAAQ;IACzG,IAAM,oBAAoB,GAAI,KAAa,CAAC,WAAW,IAAK,KAAa,CAAC,IAAI,CAAC;IAE/E,IAAM,YAAY,GAAgB,UAAC,KAAQ;QACzC,IAAI,iBAAiB,IAAI,KAAK,IAAI,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE;YACpF,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;SACrD;QAED,gFAAgF;QAChF,kEAAkE;QAClE,2IAA2I;QAC3I,OAAO,oBAAC,KAAK,uBAAK,KAAK,EAAI,CAAC;IAC9B,CAAC,CAAC;IAEF,YAAY,CAAC,WAAW,GAAG,iBAAe,oBAAoB,MAAG,CAAC;IAClE,iCAAoB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC1C,gFAAgF;IAChF,kEAAkE;IAClE,2IAA2I;IAC3I,OAAO,YAAY,CAAC;AACtB,CAAC;AApBD,8CAoBC;AACD,kGAAkG","sourcesContent":["import { Transaction } from '@sentry/types';\nimport { getGlobalObject } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\n\nimport { Action, Location, ReactRouterInstrumentation } from './types';\n\n// We need to disable eslint no-explict-any because any is required for the\n// react-router typings.\n/* eslint-disable @typescript-eslint/no-explicit-any */\ntype Match = { path: string; url: string; params: Record<string, any>; isExact: boolean };\n\nexport type RouterHistory = {\n location?: Location;\n listen?(cb: (location: Location, action: Action) => void): void;\n} & Record<string, any>;\n\nexport type RouteConfig = {\n [propName: string]: any;\n path?: string | string[];\n exact?: boolean;\n component?: JSX.Element;\n routes?: RouteConfig[];\n};\n\ntype MatchPath = (pathname: string, props: string | string[] | any, parent?: Match | null) => Match | null;\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\nconst global = getGlobalObject<Window>();\n\nlet activeTransaction: Transaction | undefined;\n\nexport function reactRouterV4Instrumentation(\n history: RouterHistory,\n routes?: RouteConfig[],\n matchPath?: MatchPath,\n): ReactRouterInstrumentation {\n return createReactRouterInstrumentation(history, 'react-router-v4', routes, matchPath);\n}\n\nexport function reactRouterV5Instrumentation(\n history: RouterHistory,\n routes?: RouteConfig[],\n matchPath?: MatchPath,\n): ReactRouterInstrumentation {\n return createReactRouterInstrumentation(history, 'react-router-v5', routes, matchPath);\n}\n\nfunction createReactRouterInstrumentation(\n history: RouterHistory,\n name: string,\n allRoutes: RouteConfig[] = [],\n matchPath?: MatchPath,\n): ReactRouterInstrumentation {\n function getInitPathName(): string | undefined {\n if (history && history.location) {\n return history.location.pathname;\n }\n\n if (global && global.location) {\n return global.location.pathname;\n }\n\n return undefined;\n }\n\n function getTransactionName(pathname: string): string {\n if (allRoutes.length === 0 || !matchPath) {\n return pathname;\n }\n\n const branches = matchRoutes(allRoutes, pathname, matchPath);\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let x = 0; x < branches.length; x++) {\n if (branches[x].match.isExact) {\n return branches[x].match.path;\n }\n }\n\n return pathname;\n }\n\n return (customStartTransaction, startTransactionOnPageLoad = true, startTransactionOnLocationChange = true): void => {\n const initPathName = getInitPathName();\n if (startTransactionOnPageLoad && initPathName) {\n activeTransaction = customStartTransaction({\n name: getTransactionName(initPathName),\n op: 'pageload',\n tags: {\n 'routing.instrumentation': name,\n },\n });\n }\n\n if (startTransactionOnLocationChange && history.listen) {\n history.listen((location, action) => {\n if (action && (action === 'PUSH' || action === 'POP')) {\n if (activeTransaction) {\n activeTransaction.finish();\n }\n const tags = {\n 'routing.instrumentation': name,\n };\n\n activeTransaction = customStartTransaction({\n name: getTransactionName(location.pathname),\n op: 'navigation',\n tags,\n });\n }\n });\n }\n };\n}\n\n/**\n * Matches a set of routes to a pathname\n * Based on implementation from\n */\nfunction matchRoutes(\n routes: RouteConfig[],\n pathname: string,\n matchPath: MatchPath,\n branch: Array<{ route: RouteConfig; match: Match }> = [],\n): Array<{ route: RouteConfig; match: Match }> {\n routes.some(route => {\n const match = route.path\n ? matchPath(pathname, route)\n : branch.length\n ? branch[branch.length - 1].match // use parent match\n : computeRootMatch(pathname); // use default \"root\" match\n\n if (match) {\n branch.push({ route, match });\n\n if (route.routes) {\n matchRoutes(route.routes, pathname, matchPath, branch);\n }\n }\n\n return !!match;\n });\n\n return branch;\n}\n\nfunction computeRootMatch(pathname: string): Match {\n return { path: '/', url: '/', params: {}, isExact: pathname === '/' };\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\nexport function withSentryRouting<P extends Record<string, any>, R extends React.ComponentType<P>>(Route: R): R {\n const componentDisplayName = (Route as any).displayName || (Route as any).name;\n\n const WrappedRoute: React.FC<P> = (props: P) => {\n if (activeTransaction && props && props.computedMatch && props.computedMatch.isExact) {\n activeTransaction.setName(props.computedMatch.path);\n }\n\n // @ts-ignore Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return <Route {...props} />;\n };\n\n WrappedRoute.displayName = `sentryRoute(${componentDisplayName})`;\n hoistNonReactStatics(WrappedRoute, Route);\n // @ts-ignore Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return WrappedRoute;\n}\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactrouterv3.js","sourceRoot":"","sources":["../../src/reactrouterv3.ts"],"names":[],"mappings":";AACA,uCAAgD;AAoBhD,IAAM,MAAM,GAAG,uBAAe,EAAU,CAAC;AAEzC;;;;;;;GAOG;AACH,SAAgB,4BAA4B,CAC1C,OAAkB,EAClB,MAAe,EACf,KAAY;IAEZ,OAAO,UACL,gBAA0E,EAC1E,0BAA0C,EAC1C,gCAAgD;QADhD,2CAAA,EAAA,iCAA0C;QAC1C,iDAAA,EAAA,uCAAgD;QAEhD,IAAI,iBAA0C,CAAC;QAC/C,IAAI,QAA4B,CAAC;QAEjC,6EAA6E;QAC7E,IAAI,0BAA0B,IAAI,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE;YAC3D,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,QAA+B,EAAE,KAAK,EAAE,UAAC,SAAiB;gBAChG,QAAQ,GAAG,SAAS,CAAC;gBACrB,iBAAiB,GAAG,gBAAgB,CAAC;oBACnC,IAAI,EAAE,QAAQ;oBACd,EAAE,EAAE,UAAU;oBACd,IAAI,EAAE;wBACJ,yBAAyB,EAAE,iBAAiB;qBAC7C;iBACF,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;QAED,IAAI,gCAAgC,IAAI,OAAO,CAAC,MAAM,EAAE;YACtD,OAAO,CAAC,MAAM,CAAC,UAAA,QAAQ;gBACrB,IAAI,QAAQ,CAAC,MAAM,KAAK,MAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,KAAK,EAAE;oBAC3D,IAAI,iBAAiB,EAAE;wBACrB,iBAAiB,CAAC,MAAM,EAAE,CAAC;qBAC5B;oBACD,IAAM,MAAI,GAA8B;wBACtC,yBAAyB,EAAE,iBAAiB;qBAC7C,CAAC;oBACF,IAAI,QAAQ,EAAE;wBACZ,MAAI,CAAC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KAAY,IAAK,OAAA,CAAC,CAAC,KAAK,CAAC,IAAI,EAAZ,CAAY,CAAC,CAAC;IAE/E,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACpD,IAAM,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAC5C,KAAK,GAAG,CAAC,CAAC;YACV,MAAM;SACP;KACF;IAED,OAAO,eAAe;SACnB,KAAK,CAAC,KAAK,CAAC;SACZ,MAAM,CAAC,UAAC,EAAQ;YAAN,cAAI;QAAO,OAAA,CAAC,CAAC,IAAI;IAAN,CAAM,CAAC;SAC5B,GAAG,CAAC,UAAC,EAAQ;YAAN,cAAI;QAAO,OAAA,IAAI;IAAJ,CAAI,CAAC;SACvB,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC","sourcesContent":["import { Primitive, Transaction, TransactionContext } from '@sentry/types';\nimport { getGlobalObject } from '@sentry/utils';\n\nimport { Location, ReactRouterInstrumentation } from './types';\n\n// Many of the types below had to be mocked out to prevent typescript issues\n// these types are required for correct functionality.\n\ntype HistoryV3 = {\n location?: Location;\n listen?(cb: (location: Location) => void): void;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n} & Record<string, any>;\n\nexport type Route = { path?: string; childRoutes?: Route[] };\n\nexport type Match = (\n props: { location: Location; routes: Route[] },\n cb: (error?: Error, _redirectLocation?: Location, renderProps?: { routes?: Route[] }) => void,\n) => void;\n\nconst global = getGlobalObject<Window>();\n\n/**\n * Creates routing instrumentation for React Router v3\n * Works for React Router >= 3.2.0 and < 4.0.0\n *\n * @param history object from the `history` library\n * @param routes a list of all routes, should be\n * @param match `Router.match` utility\n */\nexport function reactRouterV3Instrumentation(\n history: HistoryV3,\n routes: Route[],\n match: Match,\n): ReactRouterInstrumentation {\n return (\n startTransaction: (context: TransactionContext) => Transaction | undefined,\n startTransactionOnPageLoad: boolean = true,\n startTransactionOnLocationChange: boolean = true,\n ) => {\n let activeTransaction: Transaction | undefined;\n let prevName: string | undefined;\n\n // Have to use global.location because history.location might not be defined.\n if (startTransactionOnPageLoad && global && global.location) {\n normalizeTransactionName(routes, global.location as unknown as Location, match, (localName: string) => {\n prevName = localName;\n activeTransaction = startTransaction({\n name: prevName,\n op: 'pageload',\n tags: {\n 'routing.instrumentation': 'react-router-v3',\n },\n });\n });\n }\n\n if (startTransactionOnLocationChange && history.listen) {\n history.listen(location => {\n if (location.action === 'PUSH' || location.action === 'POP') {\n if (activeTransaction) {\n activeTransaction.finish();\n }\n const tags: Record<string, Primitive> = {\n 'routing.instrumentation': 'react-router-v3',\n };\n if (prevName) {\n tags.from = prevName;\n }\n normalizeTransactionName(routes, location, match, (localName: string) => {\n prevName = localName;\n activeTransaction = startTransaction({\n name: prevName,\n op: 'navigation',\n tags,\n });\n });\n }\n });\n }\n };\n}\n\n/**\n * Normalize transaction names using `Router.match`\n */\nfunction normalizeTransactionName(\n appRoutes: Route[],\n location: Location,\n match: Match,\n callback: (pathname: string) => void,\n): void {\n let name = location.pathname;\n match(\n {\n location,\n routes: appRoutes,\n },\n (error, _redirectLocation, renderProps) => {\n if (error || !renderProps) {\n return callback(name);\n }\n\n const routePath = getRouteStringFromRoutes(renderProps.routes || []);\n if (routePath.length === 0 || routePath === '/*') {\n return callback(name);\n }\n\n name = routePath;\n return callback(name);\n },\n );\n}\n\n/**\n * Generate route name from array of routes\n */\nfunction getRouteStringFromRoutes(routes: Route[]): string {\n if (!Array.isArray(routes) || routes.length === 0) {\n return '';\n }\n\n const routesWithPaths: Route[] = routes.filter((route: Route) => !!route.path);\n\n let index = -1;\n for (let x = routesWithPaths.length - 1; x >= 0; x--) {\n const route = routesWithPaths[x];\n if (route.path && route.path.startsWith('/')) {\n index = x;\n break;\n }\n }\n\n return routesWithPaths\n .slice(index)\n .filter(({ path }) => !!path)\n .map(({ path }) => path)\n .join('');\n}\n"]}
|
|
File without changes
|
|
File without changes
|
package/{dist → cjs}/redux.js
RENAMED
|
File without changes
|
package/cjs/redux.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redux.js","sourceRoot":"","sources":["../../src/redux.ts"],"names":[],"mappings":";;AAAA,uDAAuD;AACvD,2CAAiD;AAmEjD,IAAM,0BAA0B,GAAG,cAAc,CAAC;AAClD,IAAM,sBAAsB,GAAG,MAAM,CAAC;AACtC,IAAM,iBAAiB,GAAG,aAAa,CAAC;AAExC,IAAM,cAAc,GAA0B;IAC5C,iBAAiB,EAAE,UAAA,MAAM,IAAI,OAAA,MAAM,EAAN,CAAM;IACnC,gBAAgB,EAAE,UAAA,KAAK,IAAI,OAAA,KAAK,IAAI,IAAI,EAAb,CAAa;CACzC,CAAC;AAEF;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,eAAgD;IAC3E,6DAA6D;IAC7D,IAAM,OAAO,yCACR,cAAc,GACd,eAAe,CACnB,CAAC;IAEF,OAAO,UAAC,IAA+B;QACrC,OAAA,UAAwC,OAAsB,EAAE,YAAgC;YAC9F,IAAM,aAAa,GAAkB,UAAC,KAAK,EAAE,MAAM;gBACjD,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBAExC,wBAAc,CAAC,UAAA,KAAK;oBAClB,wBAAwB;oBACxB,IAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;oBAC5D,IAAI,OAAO,iBAAiB,KAAK,WAAW,IAAI,iBAAiB,KAAK,IAAI,EAAE;wBAC1E,KAAK,CAAC,aAAa,CAAC;4BAClB,QAAQ,EAAE,0BAA0B;4BACpC,IAAI,EAAE,iBAAiB;4BACvB,IAAI,EAAE,sBAAsB;yBAC7B,CAAC,CAAC;qBACJ;oBAED,+BAA+B;oBAC/B,IAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;oBAC5D,IAAI,OAAO,gBAAgB,KAAK,WAAW,IAAI,gBAAgB,KAAK,IAAI,EAAE;wBACxE,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;qBACvD;yBAAM;wBACL,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;qBAC3C;oBAED,qDAAqD;oBACrD,6DAA6D;oBACrD,IAAA,yDAAuB,CAAa;oBAC5C,IAAI,OAAO,uBAAuB,KAAK,UAAU,EAAE;wBACjD,uBAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;qBAC1C;gBACH,CAAC,CAAC,CAAC;gBAEH,OAAO,QAAQ,CAAC;YAClB,CAAC,CAAC;YAEF,OAAO,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;QAC3C,CAAC;IAnCD,CAmCC,CAAC;AACN,CAAC;AAEQ,kDAAmB","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { configureScope } from '@sentry/minimal';\nimport { Scope } from '@sentry/types';\n\ninterface Action<T = any> {\n type: T;\n}\n\ninterface AnyAction extends Action {\n [extraProps: string]: any;\n}\n\ntype Reducer<S = any, A extends Action = AnyAction> = (state: S | undefined, action: A) => S;\n\ntype Dispatch<A extends Action = AnyAction> = <T extends A>(action: T, ...extraArgs: any[]) => T;\n\ntype ExtendState<State, Extension> = [Extension] extends [never] ? State : State & Extension;\n\ntype Unsubscribe = () => void;\n\ninterface Store<S = any, A extends Action = AnyAction, StateExt = never, Ext = Record<string, unknown>> {\n dispatch: Dispatch<A>;\n getState(): S;\n subscribe(listener: () => void): Unsubscribe;\n replaceReducer<NewState, NewActions extends Action>(\n nextReducer: Reducer<NewState, NewActions>,\n ): Store<ExtendState<NewState, StateExt>, NewActions, StateExt, Ext> & Ext;\n}\n\ndeclare const $CombinedState: unique symbol;\n\ntype CombinedState<S> = { readonly [$CombinedState]?: undefined } & S;\n\ntype PreloadedState<S> = Required<S> extends {\n [$CombinedState]: undefined;\n}\n ? S extends CombinedState<infer S1>\n ? { [K in keyof S1]?: S1[K] extends Record<string, unknown> ? PreloadedState<S1[K]> : S1[K] }\n : never\n : { [K in keyof S]: S[K] extends string | number | boolean | symbol ? S[K] : PreloadedState<S[K]> };\n\ntype StoreEnhancerStoreCreator<Ext = Record<string, unknown>, StateExt = never> = <\n S = any,\n A extends Action = AnyAction,\n>(\n reducer: Reducer<S, A>,\n preloadedState?: PreloadedState<S>,\n) => Store<ExtendState<S, StateExt>, A, StateExt, Ext> & Ext;\n\nexport interface SentryEnhancerOptions<S = any> {\n /**\n * Transforms the state before attaching it to an event.\n * Use this to remove any private data before sending it to Sentry.\n * Return null to not attach the state.\n */\n stateTransformer(state: S | undefined): (S & any) | null;\n /**\n * Transforms the action before sending it as a breadcrumb.\n * Use this to remove any private data before sending it to Sentry.\n * Return null to not send the breadcrumb.\n */\n actionTransformer(action: AnyAction): AnyAction | null;\n /**\n * Called on every state update, configure the Sentry Scope with the redux state.\n */\n configureScopeWithState?(scope: Scope, state: S): void;\n}\n\nconst ACTION_BREADCRUMB_CATEGORY = 'redux.action';\nconst ACTION_BREADCRUMB_TYPE = 'info';\nconst STATE_CONTEXT_KEY = 'redux.state';\n\nconst defaultOptions: SentryEnhancerOptions = {\n actionTransformer: action => action,\n stateTransformer: state => state || null,\n};\n\n/**\n * Creates an enhancer that would be passed to Redux's createStore to log actions and the latest state to Sentry.\n *\n * @param enhancerOptions Options to pass to the enhancer\n */\nfunction createReduxEnhancer(enhancerOptions?: Partial<SentryEnhancerOptions>): any {\n // Note: We return an any type as to not have type conflicts.\n const options = {\n ...defaultOptions,\n ...enhancerOptions,\n };\n\n return (next: StoreEnhancerStoreCreator): StoreEnhancerStoreCreator =>\n <S = any, A extends Action = AnyAction>(reducer: Reducer<S, A>, initialState?: PreloadedState<S>) => {\n const sentryReducer: Reducer<S, A> = (state, action): S => {\n const newState = reducer(state, action);\n\n configureScope(scope => {\n /* Action breadcrumbs */\n const transformedAction = options.actionTransformer(action);\n if (typeof transformedAction !== 'undefined' && transformedAction !== null) {\n scope.addBreadcrumb({\n category: ACTION_BREADCRUMB_CATEGORY,\n data: transformedAction,\n type: ACTION_BREADCRUMB_TYPE,\n });\n }\n\n /* Set latest state to scope */\n const transformedState = options.stateTransformer(newState);\n if (typeof transformedState !== 'undefined' && transformedState !== null) {\n scope.setContext(STATE_CONTEXT_KEY, transformedState);\n } else {\n scope.setContext(STATE_CONTEXT_KEY, null);\n }\n\n /* Allow user to configure scope with latest state */\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { configureScopeWithState } = options;\n if (typeof configureScopeWithState === 'function') {\n configureScopeWithState(scope, newState);\n }\n });\n\n return newState;\n };\n\n return next(sentryReducer, initialState);\n };\n}\n\nexport { createReduxEnhancer };\n"]}
|
|
File without changes
|
|
File without changes
|
package/{dist → cjs}/sdk.js
RENAMED
|
File without changes
|
package/cjs/sdk.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":";AAAA,2CAAmF;AAEnF;;GAEG;AACH,SAAgB,IAAI,CAAC,OAAuB;IAC1C,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;IAC5C,OAAO,CAAC,SAAS,CAAC,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI;QAC/C,IAAI,EAAE,yBAAyB;QAC/B,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,qBAAW;aACrB;SACF;QACD,OAAO,EAAE,qBAAW;KACrB,CAAC;IACF,cAAW,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC;AAbD,oBAaC","sourcesContent":["import { BrowserOptions, init as browserInit, SDK_VERSION } from '@sentry/browser';\n\n/**\n * Inits the React SDK\n */\nexport function init(options: BrowserOptions): void {\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || {\n name: 'sentry.javascript.react',\n packages: [\n {\n name: 'npm:@sentry/react',\n version: SDK_VERSION,\n },\n ],\n version: SDK_VERSION,\n };\n browserInit(options);\n}\n"]}
|
|
File without changes
|
|
File without changes
|
package/{dist → cjs}/types.js
RENAMED
|
File without changes
|
package/cjs/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Transaction, TransactionContext } from '@sentry/types';\n\nexport type Action = 'PUSH' | 'REPLACE' | 'POP';\n\nexport type Location = {\n pathname: string;\n action?: Action;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n} & Record<string, any>;\n\nexport type ReactRouterInstrumentation = <T extends Transaction>(\n startTransaction: (context: TransactionContext) => T | undefined,\n startTransactionOnPageLoad?: boolean,\n startTransactionOnLocationChange?: boolean,\n) => void;\n"]}
|
package/esm/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,eAAO,MAAM,cAAc,mBAAmB,CAAC"}
|
package/esm/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,eAAe,GAAG,iBAAiB,CAAC;AAEjD,MAAM,CAAC,IAAM,eAAe,GAAG,iBAAiB,CAAC;AAEjD,MAAM,CAAC,IAAM,cAAc,GAAG,gBAAgB,CAAC","sourcesContent":["export const REACT_RENDER_OP = 'ui.react.render';\n\nexport const REACT_UPDATE_OP = 'ui.react.update';\n\nexport const REACT_MOUNT_OP = 'ui.react.mount';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorboundary.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"errorboundary.d.ts","sourceRoot":"","sources":["../../src/errorboundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,mBAAmB,EAAE,KAAK,EAA+B,MAAM,iBAAiB,CAAC;AAG5G,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,oBAAY,cAAc,GAAG,CAAC,SAAS,EAAE;IACvC,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,IAAI,IAAI,CAAC;CACpB,KAAK,KAAK,CAAC,YAAY,CAAC;AAEzB,oBAAY,kBAAkB,GAAG;IAC/B,4DAA4D;IAC5D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,cAAc,CAAC;IAC/C,yDAAyD;IACzD,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACtE,oCAAoC;IACpC,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,gFAAgF;IAChF,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,G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AAC,CAAC,CAiBb;AAED,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC"}
|
package/esm/errorboundary.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __assign, __extends } from "tslib";
|
|
2
2
|
import { captureException, showReportDialog, withScope } from '@sentry/browser';
|
|
3
|
-
import {
|
|
3
|
+
import { logger } from '@sentry/utils';
|
|
4
4
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import { IS_DEBUG_BUILD } from './flags';
|
|
6
7
|
export function isAtLeastReact17(version) {
|
|
7
8
|
var major = version.match(/^([^.]+)/);
|
|
8
9
|
return major !== null && parseInt(major[0]) >= 17;
|
|
@@ -92,7 +93,7 @@ var ErrorBoundary = /** @class */ (function (_super) {
|
|
|
92
93
|
return element;
|
|
93
94
|
}
|
|
94
95
|
if (fallback) {
|
|
95
|
-
|
|
96
|
+
IS_DEBUG_BUILD && logger.warn('fallback did not produce a valid ReactElement');
|
|
96
97
|
}
|
|
97
98
|
// Fail gracefully if no fallback provided or is not valid
|
|
98
99
|
return null;
|
package/esm/errorboundary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorboundary.js","sourceRoot":"","sources":["../src/errorboundary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAA8B,gBAAgB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,IAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxC,OAAO,KAAK,KAAK,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,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,CAAC;aACpB;YAED,IAAI,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;gBACjC,OAAO,OAAO,CAAC;aAChB;YAED,IAAI,QAAQ,EAAE;gBACZ,YAAY,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;aAChF;YAED,0DAA0D;YAC1D,OAAO,IAAI,CAAC;SACb;QAED,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YAClC,OAAO,QAAQ,EAAE,CAAC;SACnB;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACH,oBAAC;AAAD,CAAC,AAzFD,CAA4B,KAAK,CAAC,SAAS,GAyF1C;AAED,8DAA8D;AAC9D,SAAS,iBAAiB,CACxB,gBAAwC,EACxC,oBAAwC;IAExC,sEAAsE;IACtE,IAAM,oBAAoB,GAAG,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,iBAAiB,CAAC;IAExG,IAAM,OAAO,GAAgB,UAAC,KAAQ,IAAK,OAAA,CACzC,oBAAC,aAAa,eAAK,oBAAoB;QACrC,oBAAC,gBAAgB,eAAK,KAAK,EAAI,CACjB,CACjB,EAJ0C,CAI1C,CAAC;IAEF,sEAAsE;IACtE,OAAO,CAAC,WAAW,GAAG,mBAAiB,oBAAoB,MAAG,CAAC;IAE/D,kEAAkE;IAClE,gGAAgG;IAChG,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAChD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import { captureException, ReportDialogOptions, Scope, showReportDialog, withScope } from '@sentry/browser';\nimport { isDebugBuild, logger } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\n\nexport function isAtLeastReact17(version: string): boolean {\n const major = version.match(/^([^.]+)/);\n return major !== null && parseInt(major[0]) >= 17;\n}\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type FallbackRender = (errorData: {\n error: Error;\n componentStack: string | null;\n eventId: string | null;\n resetError(): void;\n}) => React.ReactElement;\n\nexport type ErrorBoundaryProps = {\n /** If a Sentry report dialog should be rendered on error */\n showDialog?: boolean;\n /**\n * Options to be passed into the Sentry report dialog.\n * No-op if {@link showDialog} is false.\n */\n dialogOptions?: ReportDialogOptions;\n /**\n * A fallback component that gets rendered when the error boundary encounters an error.\n *\n * Can either provide a React Component, or a function that returns React Component as\n * a valid fallback prop. If a function is provided, the function will be called with\n * the error, the component stack, and an function that resets the error boundary on error.\n *\n */\n fallback?: React.ReactElement | FallbackRender;\n /** Called when the error boundary encounters an error */\n onError?(error: Error, componentStack: string, eventId: string): void;\n /** Called on componentDidMount() */\n onMount?(): void;\n /** Called if resetError() is called from the fallback render props function */\n onReset?(error: Error | null, componentStack: string | null, eventId: string | null): void;\n /** Called on componentWillUnmount() */\n onUnmount?(error: Error | null, componentStack: string | null, eventId: string | null): void;\n /** Called before the error is captured by Sentry, allows for you to add tags or context using the scope */\n beforeCapture?(scope: Scope, error: Error | null, componentStack: string | null): void;\n};\n\ntype ErrorBoundaryState = {\n componentStack: React.ErrorInfo['componentStack'] | null;\n error: Error | null;\n eventId: string | null;\n};\n\nconst INITIAL_STATE = {\n componentStack: null,\n error: null,\n eventId: null,\n};\n\n/**\n * A ErrorBoundary component that logs errors to Sentry. Requires React >= 16.\n * NOTE: If you are a Sentry user, and you are seeing this stack frame, it means the\n * Sentry React SDK ErrorBoundary caught an error invoking your application code. This\n * is expected behavior and NOT indicative of a bug with the Sentry React SDK.\n */\nclass ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n public state: ErrorBoundaryState = INITIAL_STATE;\n\n public componentDidCatch(error: Error & { cause?: Error }, { componentStack }: React.ErrorInfo): void {\n const { beforeCapture, onError, showDialog, dialogOptions } = this.props;\n\n withScope(scope => {\n // If on React version >= 17, create stack trace from componentStack param and links\n // to to the original error using `error.cause` otherwise relies on error param for stacktrace.\n // Linking errors requires the `LinkedErrors` integration be enabled.\n if (isAtLeastReact17(React.version)) {\n const errorBoundaryError = new Error(error.message);\n errorBoundaryError.name = `React ErrorBoundary ${errorBoundaryError.name}`;\n errorBoundaryError.stack = componentStack;\n\n // Using the `LinkedErrors` integration to link the errors together.\n error.cause = errorBoundaryError;\n }\n\n if (beforeCapture) {\n beforeCapture(scope, error, componentStack);\n }\n const eventId = captureException(error, { contexts: { react: { componentStack } } });\n if (onError) {\n onError(error, componentStack, eventId);\n }\n if (showDialog) {\n showReportDialog({ ...dialogOptions, eventId });\n }\n\n // componentDidCatch is used over getDerivedStateFromError\n // so that componentStack is accessible through state.\n this.setState({ error, componentStack, eventId });\n });\n }\n\n public componentDidMount(): void {\n const { onMount } = this.props;\n if (onMount) {\n onMount();\n }\n }\n\n public componentWillUnmount(): void {\n const { error, componentStack, eventId } = this.state;\n const { onUnmount } = this.props;\n if (onUnmount) {\n onUnmount(error, componentStack, eventId);\n }\n }\n\n public resetErrorBoundary: () => void = () => {\n const { onReset } = this.props;\n const { error, componentStack, eventId } = this.state;\n if (onReset) {\n onReset(error, componentStack, eventId);\n }\n this.setState(INITIAL_STATE);\n };\n\n public render(): React.ReactNode {\n const { fallback, children } = this.props;\n const { error, componentStack, eventId } = this.state;\n\n if (error) {\n let element: React.ReactElement | undefined = undefined;\n if (typeof fallback === 'function') {\n element = fallback({ error, componentStack, resetError: this.resetErrorBoundary, eventId });\n } else {\n element = fallback;\n }\n\n if (React.isValidElement(element)) {\n return element;\n }\n\n if (fallback) {\n isDebugBuild() && logger.warn('fallback did not produce a valid ReactElement');\n }\n\n // Fail gracefully if no fallback provided or is not valid\n return null;\n }\n\n if (typeof children === 'function') {\n return children();\n }\n return children;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withErrorBoundary<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n errorBoundaryOptions: ErrorBoundaryProps,\n): React.FC<P> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <ErrorBoundary {...errorBoundaryOptions}>\n <WrappedComponent {...props} />\n </ErrorBoundary>\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n Wrapped.displayName = `errorBoundary(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\nexport { ErrorBoundary, withErrorBoundary };\n"]}
|
|
1
|
+
{"version":3,"file":"errorboundary.js","sourceRoot":"","sources":["../../src/errorboundary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAA8B,gBAAgB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5G,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,IAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxC,OAAO,KAAK,KAAK,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,IAAM,iBAAiB,GAAG,SAAS,CAAC;AA4C3C,IAAM,aAAa,GAAG;IACpB,cAAc,EAAE,IAAI;IACpB,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;CACd,CAAC;AAEF;;;;;GAKG;AACH;IAA4B,iCAAuD;IAAnF;QAAA,qEAyFC;QAxFQ,WAAK,G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U,EAAE;YAClC,OAAO,QAAQ,EAAE,CAAC;SACnB;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACH,oBAAC;AAAD,CAAC,AAzFD,CAA4B,KAAK,CAAC,SAAS,GAyF1C;AAED,8DAA8D;AAC9D,SAAS,iBAAiB,CACxB,gBAAwC,EACxC,oBAAwC;IAExC,sEAAsE;IACtE,IAAM,oBAAoB,GAAG,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,iBAAiB,CAAC;IAExG,IAAM,OAAO,GAAgB,UAAC,KAAQ,IAAK,OAAA,CACzC,oBAAC,aAAa,eAAK,oBAAoB;QACrC,oBAAC,gBAAgB,eAAK,KAAK,EAAI,CACjB,CACjB,EAJ0C,CAI1C,CAAC;IAEF,sEAAsE;IACtE,OAAO,CAAC,WAAW,GAAG,mBAAiB,oBAAoB,MAAG,CAAC;IAE/D,kEAAkE;IAClE,gGAAgG;IAChG,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAChD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import { captureException, ReportDialogOptions, Scope, showReportDialog, withScope } from '@sentry/browser';\nimport { logger } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\n\nimport { IS_DEBUG_BUILD } from './flags';\n\nexport function isAtLeastReact17(version: string): boolean {\n const major = version.match(/^([^.]+)/);\n return major !== null && parseInt(major[0]) >= 17;\n}\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type FallbackRender = (errorData: {\n error: Error;\n componentStack: string | null;\n eventId: string | null;\n resetError(): void;\n}) => React.ReactElement;\n\nexport type ErrorBoundaryProps = {\n /** If a Sentry report dialog should be rendered on error */\n showDialog?: boolean;\n /**\n * Options to be passed into the Sentry report dialog.\n * No-op if {@link showDialog} is false.\n */\n dialogOptions?: ReportDialogOptions;\n /**\n * A fallback component that gets rendered when the error boundary encounters an error.\n *\n * Can either provide a React Component, or a function that returns React Component as\n * a valid fallback prop. If a function is provided, the function will be called with\n * the error, the component stack, and an function that resets the error boundary on error.\n *\n */\n fallback?: React.ReactElement | FallbackRender;\n /** Called when the error boundary encounters an error */\n onError?(error: Error, componentStack: string, eventId: string): void;\n /** Called on componentDidMount() */\n onMount?(): void;\n /** Called if resetError() is called from the fallback render props function */\n onReset?(error: Error | null, componentStack: string | null, eventId: string | null): void;\n /** Called on componentWillUnmount() */\n onUnmount?(error: Error | null, componentStack: string | null, eventId: string | null): void;\n /** Called before the error is captured by Sentry, allows for you to add tags or context using the scope */\n beforeCapture?(scope: Scope, error: Error | null, componentStack: string | null): void;\n};\n\ntype ErrorBoundaryState = {\n componentStack: React.ErrorInfo['componentStack'] | null;\n error: Error | null;\n eventId: string | null;\n};\n\nconst INITIAL_STATE = {\n componentStack: null,\n error: null,\n eventId: null,\n};\n\n/**\n * A ErrorBoundary component that logs errors to Sentry. Requires React >= 16.\n * NOTE: If you are a Sentry user, and you are seeing this stack frame, it means the\n * Sentry React SDK ErrorBoundary caught an error invoking your application code. This\n * is expected behavior and NOT indicative of a bug with the Sentry React SDK.\n */\nclass ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n public state: ErrorBoundaryState = INITIAL_STATE;\n\n public componentDidCatch(error: Error & { cause?: Error }, { componentStack }: React.ErrorInfo): void {\n const { beforeCapture, onError, showDialog, dialogOptions } = this.props;\n\n withScope(scope => {\n // If on React version >= 17, create stack trace from componentStack param and links\n // to to the original error using `error.cause` otherwise relies on error param for stacktrace.\n // Linking errors requires the `LinkedErrors` integration be enabled.\n if (isAtLeastReact17(React.version)) {\n const errorBoundaryError = new Error(error.message);\n errorBoundaryError.name = `React ErrorBoundary ${errorBoundaryError.name}`;\n errorBoundaryError.stack = componentStack;\n\n // Using the `LinkedErrors` integration to link the errors together.\n error.cause = errorBoundaryError;\n }\n\n if (beforeCapture) {\n beforeCapture(scope, error, componentStack);\n }\n const eventId = captureException(error, { contexts: { react: { componentStack } } });\n if (onError) {\n onError(error, componentStack, eventId);\n }\n if (showDialog) {\n showReportDialog({ ...dialogOptions, eventId });\n }\n\n // componentDidCatch is used over getDerivedStateFromError\n // so that componentStack is accessible through state.\n this.setState({ error, componentStack, eventId });\n });\n }\n\n public componentDidMount(): void {\n const { onMount } = this.props;\n if (onMount) {\n onMount();\n }\n }\n\n public componentWillUnmount(): void {\n const { error, componentStack, eventId } = this.state;\n const { onUnmount } = this.props;\n if (onUnmount) {\n onUnmount(error, componentStack, eventId);\n }\n }\n\n public resetErrorBoundary: () => void = () => {\n const { onReset } = this.props;\n const { error, componentStack, eventId } = this.state;\n if (onReset) {\n onReset(error, componentStack, eventId);\n }\n this.setState(INITIAL_STATE);\n };\n\n public render(): React.ReactNode {\n const { fallback, children } = this.props;\n const { error, componentStack, eventId } = this.state;\n\n if (error) {\n let element: React.ReactElement | undefined = undefined;\n if (typeof fallback === 'function') {\n element = fallback({ error, componentStack, resetError: this.resetErrorBoundary, eventId });\n } else {\n element = fallback;\n }\n\n if (React.isValidElement(element)) {\n return element;\n }\n\n if (fallback) {\n IS_DEBUG_BUILD && logger.warn('fallback did not produce a valid ReactElement');\n }\n\n // Fail gracefully if no fallback provided or is not valid\n return null;\n }\n\n if (typeof children === 'function') {\n return children();\n }\n return children;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withErrorBoundary<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n errorBoundaryOptions: ErrorBoundaryProps,\n): React.FC<P> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <ErrorBoundary {...errorBoundaryOptions}>\n <WrappedComponent {...props} />\n </ErrorBoundary>\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n Wrapped.displayName = `errorBoundary(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\nexport { ErrorBoundary, withErrorBoundary };\n"]}
|
package/esm/flags.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../src/flags.ts"],"names":[],"mappings":"AAgBA,2DAA2D;AAC3D,eAAO,MAAM,cAAc,SAAoE,CAAC"}
|
package/esm/flags.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking
|
|
3
|
+
* for users.
|
|
4
|
+
*
|
|
5
|
+
* Debug flags need to be declared in each package individually and must not be imported across package boundaries,
|
|
6
|
+
* because some build tools have trouble tree-shaking imported guards.
|
|
7
|
+
*
|
|
8
|
+
* As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.
|
|
9
|
+
*
|
|
10
|
+
* Debug flag files will contain "magic strings" like `__SENTRY_DEBUG__` that may get replaced with actual values during
|
|
11
|
+
* our, or the user's build process. Take care when introducing new flags - they must not throw if they are not
|
|
12
|
+
* replaced.
|
|
13
|
+
*/
|
|
14
|
+
/** Flag that is true for debug builds, false otherwise. */
|
|
15
|
+
export var IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;
|
|
16
|
+
//# sourceMappingURL=flags.js.map
|
package/esm/flags.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,2DAA2D;AAC3D,MAAM,CAAC,IAAM,cAAc,GAAG,OAAO,gBAAgB,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC","sourcesContent":["/*\n * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking\n * for users.\n *\n * Debug flags need to be declared in each package individually and must not be imported across package boundaries,\n * because some build tools have trouble tree-shaking imported guards.\n *\n * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.\n *\n * Debug flag files will contain \"magic strings\" like `__SENTRY_DEBUG__` that may get replaced with actual values during\n * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not\n * replaced.\n */\n\ndeclare const __SENTRY_DEBUG__: boolean;\n\n/** Flag that is true for debug builds, false otherwise. */\nexport const IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;\n"]}
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export * from '@sentry/browser';\n\nexport { init } from './sdk';\nexport { Profiler, withProfiler, useProfiler } from './profiler';\nexport { ErrorBoundary, withErrorBoundary } from './errorboundary';\nexport { createReduxEnhancer } from './redux';\nexport { reactRouterV3Instrumentation } from './reactrouterv3';\nexport { reactRouterV4Instrumentation, reactRouterV5Instrumentation, withSentryRouting } from './reactrouter';\n"]}
|
package/esm/profiler.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ declare class Profiler extends React.Component<ProfilerProps> {
|
|
|
21
21
|
* Made protected for the React Native SDK to access
|
|
22
22
|
*/
|
|
23
23
|
protected _mountSpan: Span | undefined;
|
|
24
|
-
private _mountActivity;
|
|
25
24
|
static defaultProps: Partial<ProfilerProps>;
|
|
26
25
|
constructor(props: ProfilerProps);
|
|
27
26
|
componentDidMount(): void;
|
package/esm/profiler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiler.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"profiler.d.ts","sourceRoot":"","sources":["../../src/profiler.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,iBAA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