warning.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /******/ (function() { // webpackBootstrap
  2. /******/ "use strict";
  3. /******/ // The require scope
  4. /******/ var __webpack_require__ = {};
  5. /******/
  6. /************************************************************************/
  7. /******/ /* webpack/runtime/define property getters */
  8. /******/ !function() {
  9. /******/ // define getter functions for harmony exports
  10. /******/ __webpack_require__.d = function(exports, definition) {
  11. /******/ for(var key in definition) {
  12. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  13. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  14. /******/ }
  15. /******/ }
  16. /******/ };
  17. /******/ }();
  18. /******/
  19. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  20. /******/ !function() {
  21. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  22. /******/ }();
  23. /******/
  24. /************************************************************************/
  25. var __webpack_exports__ = {};
  26. // EXPORTS
  27. __webpack_require__.d(__webpack_exports__, {
  28. "default": function() { return /* binding */ warning; }
  29. });
  30. ;// CONCATENATED MODULE: ./node_modules/@wordpress/warning/build-module/utils.js
  31. /**
  32. * Object map tracking messages which have been logged, for use in ensuring a
  33. * message is only logged once.
  34. *
  35. * @type {Set<string>}
  36. */
  37. const logged = new Set();
  38. ;// CONCATENATED MODULE: ./node_modules/@wordpress/warning/build-module/index.js
  39. /**
  40. * Internal dependencies
  41. */
  42. function isDev() {
  43. return typeof process !== 'undefined' && process.env && "production" !== 'production';
  44. }
  45. /**
  46. * Shows a warning with `message` if environment is not `production`.
  47. *
  48. * @param {string} message Message to show in the warning.
  49. *
  50. * @example
  51. * ```js
  52. * import warning from '@wordpress/warning';
  53. *
  54. * function MyComponent( props ) {
  55. * if ( ! props.title ) {
  56. * warning( '`props.title` was not passed' );
  57. * }
  58. * ...
  59. * }
  60. * ```
  61. */
  62. function warning(message) {
  63. if (!isDev()) {
  64. return;
  65. } // Skip if already logged.
  66. if (logged.has(message)) {
  67. return;
  68. } // eslint-disable-next-line no-console
  69. console.warn(message); // Throwing an error and catching it immediately to improve debugging
  70. // A consumer can use 'pause on caught exceptions'
  71. // https://github.com/facebook/react/issues/4216
  72. try {
  73. throw Error(message);
  74. } catch (x) {// Do nothing.
  75. }
  76. logged.add(message);
  77. }
  78. (window.wp = window.wp || {}).warning = __webpack_exports__["default"];
  79. /******/ })()
  80. ;