exportGlobals.tsx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import * as React from 'react';
  2. import {findDOMNode, render} from 'react-dom';
  3. import * as ReactRouter from 'react-router';
  4. import * as Sentry from '@sentry/react';
  5. import moment from 'moment';
  6. import * as PropTypes from 'prop-types';
  7. import * as Reflux from 'reflux';
  8. import plugins from 'sentry/plugins';
  9. const globals = {
  10. // The following globals are used in sentry-plugins webpack externals
  11. // configuration.
  12. PropTypes,
  13. React,
  14. Reflux,
  15. Sentry,
  16. moment,
  17. Router: ReactRouter,
  18. ReactDOM: {findDOMNode, render},
  19. // django templates make use of these globals
  20. SentryApp: {},
  21. };
  22. // The SentryApp global contains exported app modules for use in javascript
  23. // modules that are not compiled with the sentry bundle.
  24. const SentryApp = {
  25. // The following components are used in sentry-plugins.
  26. Form: require('sentry/components/deprecatedforms/form').default,
  27. FormState: require('sentry/components/forms/state').default,
  28. LoadingIndicator: require('sentry/components/loadingIndicator').default,
  29. plugins: {
  30. add: plugins.add,
  31. addContext: plugins.addContext,
  32. BasePlugin: plugins.BasePlugin,
  33. DefaultIssuePlugin: plugins.DefaultIssuePlugin,
  34. },
  35. // The following components are used in legacy django HTML views
  36. // or in the Sentry sandbox
  37. ConfigStore: require('sentry/stores/configStore').default,
  38. HookStore: require('sentry/stores/hookStore').default,
  39. GuideActionCreator: require('sentry/actionCreators/guides'),
  40. Modal: require('sentry/actionCreators/modal'),
  41. getModalPortal: require('sentry/utils/getModalPortal').default,
  42. Client: require('sentry/api').Client,
  43. };
  44. globals.SentryApp = SentryApp;
  45. Object.keys(globals).forEach(name => (window[name] = globals[name]));
  46. export default globals;