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. 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. // This is used in the Email Modal in the Sandbox
  44. IconArrow: require('sentry/icons/iconArrow').IconArrow,
  45. };
  46. globals.SentryApp = SentryApp;
  47. Object.keys(globals).forEach(name => (window[name] = globals[name]));
  48. export {globals as exportedGlobals};