exportGlobals.tsx 1.8 KB

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