🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@sentry/react

Package Overview
Dependencies
Maintainers
10
Versions
472
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/react - npm Package Compare versions

Comparing version

to
8.50.0

2

build/cjs/index.js

@@ -34,2 +34,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

exports.wrapCreateBrowserRouterV6 = reactrouterv6.wrapCreateBrowserRouterV6;
exports.wrapCreateMemoryRouterV6 = reactrouterv6.wrapCreateMemoryRouterV6;
exports.wrapUseRoutes = reactrouterv6.wrapUseRoutes;

@@ -40,2 +41,3 @@ exports.wrapUseRoutesV6 = reactrouterv6.wrapUseRoutesV6;

exports.wrapCreateBrowserRouterV7 = reactrouterv7.wrapCreateBrowserRouterV7;
exports.wrapCreateMemoryRouterV7 = reactrouterv7.wrapCreateMemoryRouterV7;
exports.wrapUseRoutesV7 = reactrouterv7.wrapUseRoutesV7;

@@ -42,0 +44,0 @@ Object.prototype.hasOwnProperty.call(browser, '__proto__') &&

@@ -58,5 +58,2 @@ Object.defineProperty(exports, '__esModule', { value: true });

// `opts` for createBrowserHistory and createMemoryHistory are different, but also not relevant for us at the moment.
// `basename` is the only option that is relevant for us, and it is the same for all.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return function (routes, opts) {

@@ -93,2 +90,71 @@ const router = createRouterFunction(routes, opts);

/**
* Creates a wrapCreateMemoryRouter function that can be used with all React Router v6 compatible versions.
*/
function createV6CompatibleWrapCreateMemoryRouter
(
createRouterFunction,
version,
) {
if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {
debugBuild.DEBUG_BUILD &&
core.logger.warn(
`reactRouterV${version}Instrumentation was unable to wrap the \`createMemoryRouter\` function because of one or more missing parameters.`,
);
return createRouterFunction;
}
return function (
routes,
opts
,
) {
const router = createRouterFunction(routes, opts);
const basename = opts ? opts.basename : undefined;
const activeRootSpan = getActiveRootSpan();
let initialEntry = undefined;
const initialEntries = opts ? opts.initialEntries : undefined;
const initialIndex = opts ? opts.initialIndex : undefined;
const hasOnlyOneInitialEntry = initialEntries && initialEntries.length === 1;
const hasIndexedEntry = initialIndex !== undefined && initialEntries && initialEntries[initialIndex];
initialEntry = hasOnlyOneInitialEntry
? initialEntries[0]
: hasIndexedEntry
? initialEntries[initialIndex]
: undefined;
const location = initialEntry
? typeof initialEntry === 'string'
? { pathname: initialEntry }
: initialEntry
: router.state.location;
if (router.state.historyAction === 'POP' && activeRootSpan) {
updatePageloadTransaction(activeRootSpan, location, routes, undefined, basename);
}
router.subscribe((state) => {
const location = state.location;
if (state.historyAction === 'PUSH' || state.historyAction === 'POP') {
handleNavigation({
location,
routes,
navigationType: state.historyAction,
version,
basename,
});
}
});
return router;
};
}
/**
* Creates a browser tracing integration that can be used with all React Router v6 compatible versions.

@@ -566,4 +632,5 @@ */

exports.createV6CompatibleWrapCreateBrowserRouter = createV6CompatibleWrapCreateBrowserRouter;
exports.createV6CompatibleWrapCreateMemoryRouter = createV6CompatibleWrapCreateMemoryRouter;
exports.createV6CompatibleWrapUseRoutes = createV6CompatibleWrapUseRoutes;
exports.handleNavigation = handleNavigation;
//# sourceMappingURL=reactrouterv6-compat-utils.js.map

@@ -46,2 +46,14 @@ Object.defineProperty(exports, '__esModule', { value: true });

/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v6 createMemoryRouter function.
* This is used to automatically capture route changes as transactions when using the createMemoryRouter API.
* The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,
* optional `initialEntries` are also taken into account.
*/
function wrapCreateMemoryRouterV6
(createMemoryRouterFunction) {
return reactrouterv6CompatUtils.createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '6');
}
/**
* A higher-order component that adds Sentry routing instrumentation to a React Router v6 Route component.

@@ -59,4 +71,5 @@ * This is used to automatically capture route changes as transactions.

exports.wrapCreateBrowserRouterV6 = wrapCreateBrowserRouterV6;
exports.wrapCreateMemoryRouterV6 = wrapCreateMemoryRouterV6;
exports.wrapUseRoutes = wrapUseRoutes;
exports.wrapUseRoutesV6 = wrapUseRoutesV6;
//# sourceMappingURL=reactrouterv6.js.map

@@ -35,2 +35,14 @@ Object.defineProperty(exports, '__esModule', { value: true });

/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v7 createMemoryRouter function.
* This is used to automatically capture route changes as transactions when using the createMemoryRouter API.
* The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,
* optional `initialEntries` are also taken into account.
*/
function wrapCreateMemoryRouterV7
(createMemoryRouterFunction) {
return reactrouterv6CompatUtils.createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '7');
}
/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v7 useRoutes hook.

@@ -46,3 +58,4 @@ * This is used to automatically capture route changes as transactions when using the useRoutes hook.

exports.wrapCreateBrowserRouterV7 = wrapCreateBrowserRouterV7;
exports.wrapCreateMemoryRouterV7 = wrapCreateMemoryRouterV7;
exports.wrapUseRoutesV7 = wrapUseRoutesV7;
//# sourceMappingURL=reactrouterv7.js.map

4

build/esm/index.js

@@ -10,4 +10,4 @@ export * from '@sentry/browser';

export { reactRouterV4BrowserTracingIntegration, reactRouterV5BrowserTracingIntegration, withSentryRouting } from './reactrouter.js';
export { reactRouterV6BrowserTracingIntegration, withSentryReactRouterV6Routing, wrapCreateBrowserRouter, wrapCreateBrowserRouterV6, wrapUseRoutes, wrapUseRoutesV6 } from './reactrouterv6.js';
export { reactRouterV7BrowserTracingIntegration, withSentryReactRouterV7Routing, wrapCreateBrowserRouterV7, wrapUseRoutesV7 } from './reactrouterv7.js';
export { reactRouterV6BrowserTracingIntegration, withSentryReactRouterV6Routing, wrapCreateBrowserRouter, wrapCreateBrowserRouterV6, wrapCreateMemoryRouterV6, wrapUseRoutes, wrapUseRoutesV6 } from './reactrouterv6.js';
export { reactRouterV7BrowserTracingIntegration, withSentryReactRouterV7Routing, wrapCreateBrowserRouterV7, wrapCreateMemoryRouterV7, wrapUseRoutesV7 } from './reactrouterv7.js';
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

{"type":"module","version":"8.49.0","sideEffects":false}
{"type":"module","version":"8.50.0","sideEffects":false}

@@ -39,5 +39,2 @@ import { browserTracingIntegration, WINDOW, startBrowserTracingPageLoadSpan, startBrowserTracingNavigationSpan } from '@sentry/browser';

// `opts` for createBrowserHistory and createMemoryHistory are different, but also not relevant for us at the moment.
// `basename` is the only option that is relevant for us, and it is the same for all.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return function (routes, opts) {

@@ -74,2 +71,71 @@ const router = createRouterFunction(routes, opts);

/**
* Creates a wrapCreateMemoryRouter function that can be used with all React Router v6 compatible versions.
*/
function createV6CompatibleWrapCreateMemoryRouter
(
createRouterFunction,
version,
) {
if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes) {
DEBUG_BUILD &&
logger.warn(
`reactRouterV${version}Instrumentation was unable to wrap the \`createMemoryRouter\` function because of one or more missing parameters.`,
);
return createRouterFunction;
}
return function (
routes,
opts
,
) {
const router = createRouterFunction(routes, opts);
const basename = opts ? opts.basename : undefined;
const activeRootSpan = getActiveRootSpan();
let initialEntry = undefined;
const initialEntries = opts ? opts.initialEntries : undefined;
const initialIndex = opts ? opts.initialIndex : undefined;
const hasOnlyOneInitialEntry = initialEntries && initialEntries.length === 1;
const hasIndexedEntry = initialIndex !== undefined && initialEntries && initialEntries[initialIndex];
initialEntry = hasOnlyOneInitialEntry
? initialEntries[0]
: hasIndexedEntry
? initialEntries[initialIndex]
: undefined;
const location = initialEntry
? typeof initialEntry === 'string'
? { pathname: initialEntry }
: initialEntry
: router.state.location;
if (router.state.historyAction === 'POP' && activeRootSpan) {
updatePageloadTransaction(activeRootSpan, location, routes, undefined, basename);
}
router.subscribe((state) => {
const location = state.location;
if (state.historyAction === 'PUSH' || state.historyAction === 'POP') {
handleNavigation({
location,
routes,
navigationType: state.historyAction,
version,
basename,
});
}
});
return router;
};
}
/**
* Creates a browser tracing integration that can be used with all React Router v6 compatible versions.

@@ -544,3 +610,3 @@ */

export { createReactRouterV6CompatibleTracingIntegration, createV6CompatibleWithSentryReactRouterRouting, createV6CompatibleWrapCreateBrowserRouter, createV6CompatibleWrapUseRoutes, handleNavigation };
export { createReactRouterV6CompatibleTracingIntegration, createV6CompatibleWithSentryReactRouterRouting, createV6CompatibleWrapCreateBrowserRouter, createV6CompatibleWrapCreateMemoryRouter, createV6CompatibleWrapUseRoutes, handleNavigation };
//# sourceMappingURL=reactrouterv6-compat-utils.js.map

@@ -1,2 +0,2 @@

import { createReactRouterV6CompatibleTracingIntegration, createV6CompatibleWrapUseRoutes, createV6CompatibleWrapCreateBrowserRouter, createV6CompatibleWithSentryReactRouterRouting } from './reactrouterv6-compat-utils.js';
import { createReactRouterV6CompatibleTracingIntegration, createV6CompatibleWrapUseRoutes, createV6CompatibleWrapCreateBrowserRouter, createV6CompatibleWrapCreateMemoryRouter, createV6CompatibleWithSentryReactRouterRouting } from './reactrouterv6-compat-utils.js';

@@ -44,2 +44,14 @@ /**

/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v6 createMemoryRouter function.
* This is used to automatically capture route changes as transactions when using the createMemoryRouter API.
* The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,
* optional `initialEntries` are also taken into account.
*/
function wrapCreateMemoryRouterV6
(createMemoryRouterFunction) {
return createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '6');
}
/**
* A higher-order component that adds Sentry routing instrumentation to a React Router v6 Route component.

@@ -53,3 +65,3 @@ * This is used to automatically capture route changes as transactions.

export { reactRouterV6BrowserTracingIntegration, withSentryReactRouterV6Routing, wrapCreateBrowserRouter, wrapCreateBrowserRouterV6, wrapUseRoutes, wrapUseRoutesV6 };
export { reactRouterV6BrowserTracingIntegration, withSentryReactRouterV6Routing, wrapCreateBrowserRouter, wrapCreateBrowserRouterV6, wrapCreateMemoryRouterV6, wrapUseRoutes, wrapUseRoutesV6 };
//# sourceMappingURL=reactrouterv6.js.map

@@ -1,2 +0,2 @@

import { createReactRouterV6CompatibleTracingIntegration, createV6CompatibleWithSentryReactRouterRouting, createV6CompatibleWrapCreateBrowserRouter, createV6CompatibleWrapUseRoutes } from './reactrouterv6-compat-utils.js';
import { createReactRouterV6CompatibleTracingIntegration, createV6CompatibleWithSentryReactRouterRouting, createV6CompatibleWrapCreateBrowserRouter, createV6CompatibleWrapCreateMemoryRouter, createV6CompatibleWrapUseRoutes } from './reactrouterv6-compat-utils.js';

@@ -33,2 +33,14 @@ /**

/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v7 createMemoryRouter function.
* This is used to automatically capture route changes as transactions when using the createMemoryRouter API.
* The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,
* optional `initialEntries` are also taken into account.
*/
function wrapCreateMemoryRouterV7
(createMemoryRouterFunction) {
return createV6CompatibleWrapCreateMemoryRouter(createMemoryRouterFunction, '7');
}
/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v7 useRoutes hook.

@@ -41,3 +53,3 @@ * This is used to automatically capture route changes as transactions when using the useRoutes hook.

export { reactRouterV7BrowserTracingIntegration, withSentryReactRouterV7Routing, wrapCreateBrowserRouterV7, wrapUseRoutesV7 };
export { reactRouterV7BrowserTracingIntegration, withSentryReactRouterV7Routing, wrapCreateBrowserRouterV7, wrapCreateMemoryRouterV7, wrapUseRoutesV7 };
//# sourceMappingURL=reactrouterv7.js.map

@@ -11,4 +11,4 @@ export * from '@sentry/browser';

export { withSentryRouting, reactRouterV4BrowserTracingIntegration, reactRouterV5BrowserTracingIntegration, } from './reactrouter';
export { reactRouterV6BrowserTracingIntegration, withSentryReactRouterV6Routing, wrapUseRoutes, wrapUseRoutesV6, wrapCreateBrowserRouter, wrapCreateBrowserRouterV6, } from './reactrouterv6';
export { reactRouterV7BrowserTracingIntegration, withSentryReactRouterV7Routing, wrapCreateBrowserRouterV7, wrapUseRoutesV7, } from './reactrouterv7';
export { reactRouterV6BrowserTracingIntegration, withSentryReactRouterV6Routing, wrapUseRoutes, wrapUseRoutesV6, wrapCreateBrowserRouter, wrapCreateBrowserRouterV6, wrapCreateMemoryRouterV6, } from './reactrouterv6';
export { reactRouterV7BrowserTracingIntegration, withSentryReactRouterV7Routing, wrapCreateBrowserRouterV7, wrapCreateMemoryRouterV7, wrapUseRoutesV7, } from './reactrouterv7';
//# sourceMappingURL=index.d.ts.map

@@ -19,2 +19,6 @@ import { browserTracingIntegration } from '@sentry/browser';

/**
* Creates a wrapCreateMemoryRouter function that can be used with all React Router v6 compatible versions.
*/
export declare function createV6CompatibleWrapCreateMemoryRouter<TState extends RouterState = RouterState, TRouter extends Router<TState> = Router<TState>>(createRouterFunction: CreateRouterFunction<TState, TRouter>, version: V6CompatibleVersion): CreateRouterFunction<TState, TRouter>;
/**
* Creates a browser tracing integration that can be used with all React Router v6 compatible versions.

@@ -21,0 +25,0 @@ */

@@ -32,2 +32,9 @@ /// <reference types="react" />

/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v6 createMemoryRouter function.
* This is used to automatically capture route changes as transactions when using the createMemoryRouter API.
* The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,
* optional `initialEntries` are also taken into account.
*/
export declare function wrapCreateMemoryRouterV6<TState extends RouterState = RouterState, TRouter extends Router<TState> = Router<TState>>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter>;
/**
* A higher-order component that adds Sentry routing instrumentation to a React Router v6 Route component.

@@ -34,0 +41,0 @@ * This is used to automatically capture route changes as transactions.

@@ -22,2 +22,9 @@ /// <reference types="react" />

/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v7 createMemoryRouter function.
* This is used to automatically capture route changes as transactions when using the createMemoryRouter API.
* The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,
* optional `initialEntries` are also taken into account.
*/
export declare function wrapCreateMemoryRouterV7<TState extends RouterState = RouterState, TRouter extends Router<TState> = Router<TState>>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter>;
/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v7 useRoutes hook.

@@ -24,0 +31,0 @@ * This is used to automatically capture route changes as transactions when using the useRoutes hook.

@@ -11,4 +11,4 @@ export * from '@sentry/browser';

export { withSentryRouting, reactRouterV4BrowserTracingIntegration, reactRouterV5BrowserTracingIntegration, } from './reactrouter';
export { reactRouterV6BrowserTracingIntegration, withSentryReactRouterV6Routing, wrapUseRoutes, wrapUseRoutesV6, wrapCreateBrowserRouter, wrapCreateBrowserRouterV6, } from './reactrouterv6';
export { reactRouterV7BrowserTracingIntegration, withSentryReactRouterV7Routing, wrapCreateBrowserRouterV7, wrapUseRoutesV7, } from './reactrouterv7';
export { reactRouterV6BrowserTracingIntegration, withSentryReactRouterV6Routing, wrapUseRoutes, wrapUseRoutesV6, wrapCreateBrowserRouter, wrapCreateBrowserRouterV6, wrapCreateMemoryRouterV6, } from './reactrouterv6';
export { reactRouterV7BrowserTracingIntegration, withSentryReactRouterV7Routing, wrapCreateBrowserRouterV7, wrapCreateMemoryRouterV7, wrapUseRoutesV7, } from './reactrouterv7';
//# sourceMappingURL=index.d.ts.map

@@ -19,2 +19,6 @@ import { browserTracingIntegration } from '@sentry/browser';

/**
* Creates a wrapCreateMemoryRouter function that can be used with all React Router v6 compatible versions.
*/
export declare function createV6CompatibleWrapCreateMemoryRouter<TState extends RouterState = RouterState, TRouter extends Router<TState> = Router<TState>>(createRouterFunction: CreateRouterFunction<TState, TRouter>, version: V6CompatibleVersion): CreateRouterFunction<TState, TRouter>;
/**
* Creates a browser tracing integration that can be used with all React Router v6 compatible versions.

@@ -21,0 +25,0 @@ */

@@ -32,2 +32,9 @@ /// <reference types="react" />

/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v6 createMemoryRouter function.
* This is used to automatically capture route changes as transactions when using the createMemoryRouter API.
* The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,
* optional `initialEntries` are also taken into account.
*/
export declare function wrapCreateMemoryRouterV6<TState extends RouterState = RouterState, TRouter extends Router<TState> = Router<TState>>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter>;
/**
* A higher-order component that adds Sentry routing instrumentation to a React Router v6 Route component.

@@ -34,0 +41,0 @@ * This is used to automatically capture route changes as transactions.

@@ -22,2 +22,9 @@ /// <reference types="react" />

/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v7 createMemoryRouter function.
* This is used to automatically capture route changes as transactions when using the createMemoryRouter API.
* The difference between createBrowserRouter and createMemoryRouter is that with createMemoryRouter,
* optional `initialEntries` are also taken into account.
*/
export declare function wrapCreateMemoryRouterV7<TState extends RouterState = RouterState, TRouter extends Router<TState> = Router<TState>>(createMemoryRouterFunction: CreateRouterFunction<TState, TRouter>): CreateRouterFunction<TState, TRouter>;
/**
* A wrapper function that adds Sentry routing instrumentation to a React Router v7 useRoutes hook.

@@ -24,0 +31,0 @@ * This is used to automatically capture route changes as transactions when using the useRoutes hook.

{
"name": "@sentry/react",
"version": "8.49.0",
"version": "8.50.0",
"description": "Official Sentry SDK for React.js",

@@ -42,4 +42,4 @@ "repository": "git://github.com/getsentry/sentry-javascript.git",

"dependencies": {
"@sentry/browser": "8.49.0",
"@sentry/core": "8.49.0",
"@sentry/browser": "8.50.0",
"@sentry/core": "8.50.0",
"hoist-non-react-statics": "^3.3.2"

@@ -46,0 +46,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet