exportGlobals.tsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 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. React,
  13. Reflux,
  14. Sentry,
  15. moment,
  16. Router: ReactRouter,
  17. ReactDOM: {findDOMNode, render},
  18. // django templates make use of these globals
  19. SentryApp: {},
  20. };
  21. // The SentryApp global contains exported app modules for use in javascript
  22. // modules that are not compiled with the sentry bundle.
  23. const SentryApp = {
  24. // The following components are used in sentry-plugins.
  25. FormState: require('sentry/components/forms/state').default,
  26. LoadingIndicator: require('sentry/components/loadingIndicator').default,
  27. plugins: {
  28. add: plugins.add,
  29. addContext: plugins.addContext,
  30. BasePlugin: plugins.BasePlugin,
  31. DefaultIssuePlugin: plugins.DefaultIssuePlugin,
  32. },
  33. // The following components are used in legacy django HTML views
  34. // or in the Sentry sandbox
  35. ConfigStore: require('sentry/stores/configStore').default,
  36. HookStore: require('sentry/stores/hookStore').default,
  37. GuideActionCreator: require('sentry/actionCreators/guides'),
  38. Modal: require('sentry/actionCreators/modal'),
  39. getModalPortal: require('sentry/utils/getModalPortal').default,
  40. Client: require('sentry/api').Client,
  41. // This is used in the Email Modal in the Sandbox
  42. IconArrow: require('sentry/icons/iconArrow').IconArrow,
  43. };
  44. globals.SentryApp = SentryApp;
  45. Object.keys(globals).forEach(name => (window[name] = globals[name]));
  46. export {globals as exportedGlobals};