index.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. Object.defineProperty(exports, '__esModule', { value: true });
  2. const core = require('@sentry/core');
  3. const vercelEdge = require('@sentry/vercel-edge');
  4. const isBuild = require('../common/utils/isBuild.js');
  5. const rewriteFramesIntegration = require('./rewriteFramesIntegration.js');
  6. const wrapGetStaticPropsWithSentry = require('../common/wrapGetStaticPropsWithSentry.js');
  7. const wrapGetInitialPropsWithSentry = require('../common/wrapGetInitialPropsWithSentry.js');
  8. const wrapAppGetInitialPropsWithSentry = require('../common/wrapAppGetInitialPropsWithSentry.js');
  9. const wrapDocumentGetInitialPropsWithSentry = require('../common/wrapDocumentGetInitialPropsWithSentry.js');
  10. const wrapErrorGetInitialPropsWithSentry = require('../common/wrapErrorGetInitialPropsWithSentry.js');
  11. const wrapGetServerSidePropsWithSentry = require('../common/wrapGetServerSidePropsWithSentry.js');
  12. const wrapServerComponentWithSentry = require('../common/wrapServerComponentWithSentry.js');
  13. const wrapRouteHandlerWithSentry = require('../common/wrapRouteHandlerWithSentry.js');
  14. const wrapApiHandlerWithSentryVercelCrons = require('../common/wrapApiHandlerWithSentryVercelCrons.js');
  15. const wrapMiddlewareWithSentry = require('../common/wrapMiddlewareWithSentry.js');
  16. const wrapPageComponentWithSentry = require('../common/wrapPageComponentWithSentry.js');
  17. const wrapGenerationFunctionWithSentry = require('../common/wrapGenerationFunctionWithSentry.js');
  18. const withServerActionInstrumentation = require('../common/withServerActionInstrumentation.js');
  19. const wrapApiHandlerWithSentry = require('./wrapApiHandlerWithSentry.js');
  20. /** Inits the Sentry NextJS SDK on the Edge Runtime. */
  21. function init(options = {}) {
  22. core.addTracingExtensions();
  23. if (isBuild.isBuild()) {
  24. return;
  25. }
  26. const customDefaultIntegrations = [...vercelEdge.getDefaultIntegrations(options), rewriteFramesIntegration.rewriteFramesIntegration()];
  27. const opts = {
  28. defaultIntegrations: customDefaultIntegrations,
  29. ...options,
  30. };
  31. core.applySdkMetadata(opts, 'nextjs');
  32. vercelEdge.init(opts);
  33. }
  34. /**
  35. * Just a passthrough in case this is imported from the client.
  36. */
  37. function withSentryConfig(exportedUserNextConfig) {
  38. return exportedUserNextConfig;
  39. }
  40. exports.Span = core.Span;
  41. exports.Transaction = core.Transaction;
  42. exports.rewriteFramesIntegration = rewriteFramesIntegration.rewriteFramesIntegration;
  43. exports.withSentryGetStaticProps = wrapGetStaticPropsWithSentry.withSentryGetStaticProps;
  44. exports.wrapGetStaticPropsWithSentry = wrapGetStaticPropsWithSentry.wrapGetStaticPropsWithSentry;
  45. exports.withSentryServerSideGetInitialProps = wrapGetInitialPropsWithSentry.withSentryServerSideGetInitialProps;
  46. exports.wrapGetInitialPropsWithSentry = wrapGetInitialPropsWithSentry.wrapGetInitialPropsWithSentry;
  47. exports.withSentryServerSideAppGetInitialProps = wrapAppGetInitialPropsWithSentry.withSentryServerSideAppGetInitialProps;
  48. exports.wrapAppGetInitialPropsWithSentry = wrapAppGetInitialPropsWithSentry.wrapAppGetInitialPropsWithSentry;
  49. exports.withSentryServerSideDocumentGetInitialProps = wrapDocumentGetInitialPropsWithSentry.withSentryServerSideDocumentGetInitialProps;
  50. exports.wrapDocumentGetInitialPropsWithSentry = wrapDocumentGetInitialPropsWithSentry.wrapDocumentGetInitialPropsWithSentry;
  51. exports.withSentryServerSideErrorGetInitialProps = wrapErrorGetInitialPropsWithSentry.withSentryServerSideErrorGetInitialProps;
  52. exports.wrapErrorGetInitialPropsWithSentry = wrapErrorGetInitialPropsWithSentry.wrapErrorGetInitialPropsWithSentry;
  53. exports.withSentryGetServerSideProps = wrapGetServerSidePropsWithSentry.withSentryGetServerSideProps;
  54. exports.wrapGetServerSidePropsWithSentry = wrapGetServerSidePropsWithSentry.wrapGetServerSidePropsWithSentry;
  55. exports.wrapServerComponentWithSentry = wrapServerComponentWithSentry.wrapServerComponentWithSentry;
  56. exports.wrapRouteHandlerWithSentry = wrapRouteHandlerWithSentry.wrapRouteHandlerWithSentry;
  57. exports.wrapApiHandlerWithSentryVercelCrons = wrapApiHandlerWithSentryVercelCrons.wrapApiHandlerWithSentryVercelCrons;
  58. exports.wrapMiddlewareWithSentry = wrapMiddlewareWithSentry.wrapMiddlewareWithSentry;
  59. exports.wrapPageComponentWithSentry = wrapPageComponentWithSentry.wrapPageComponentWithSentry;
  60. exports.wrapGenerationFunctionWithSentry = wrapGenerationFunctionWithSentry.wrapGenerationFunctionWithSentry;
  61. exports.withServerActionInstrumentation = withServerActionInstrumentation.withServerActionInstrumentation;
  62. exports.withSentryAPI = wrapApiHandlerWithSentry.withSentryAPI;
  63. exports.wrapApiHandlerWithSentry = wrapApiHandlerWithSentry.wrapApiHandlerWithSentry;
  64. exports.init = init;
  65. exports.withSentryConfig = withSentryConfig;
  66. for (const k in vercelEdge) {
  67. if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = vercelEdge[k];
  68. }
  69. //# sourceMappingURL=index.js.map