wp/wp-includes/js/dist/warning.js
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     1 /******/ (function() { // webpackBootstrap
     1 /******/ (() => { // webpackBootstrap
     2 /******/ 	"use strict";
     2 /******/ 	"use strict";
     3 /******/ 	// The require scope
     3 /******/ 	// The require scope
     4 /******/ 	var __webpack_require__ = {};
     4 /******/ 	var __webpack_require__ = {};
     5 /******/ 	
     5 /******/ 	
     6 /************************************************************************/
     6 /************************************************************************/
     7 /******/ 	/* webpack/runtime/define property getters */
     7 /******/ 	/* webpack/runtime/define property getters */
     8 /******/ 	!function() {
     8 /******/ 	(() => {
     9 /******/ 		// define getter functions for harmony exports
     9 /******/ 		// define getter functions for harmony exports
    10 /******/ 		__webpack_require__.d = function(exports, definition) {
    10 /******/ 		__webpack_require__.d = (exports, definition) => {
    11 /******/ 			for(var key in definition) {
    11 /******/ 			for(var key in definition) {
    12 /******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
    12 /******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
    13 /******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
    13 /******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
    14 /******/ 				}
    14 /******/ 				}
    15 /******/ 			}
    15 /******/ 			}
    16 /******/ 		};
    16 /******/ 		};
    17 /******/ 	}();
    17 /******/ 	})();
    18 /******/ 	
    18 /******/ 	
    19 /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
    19 /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
    20 /******/ 	!function() {
    20 /******/ 	(() => {
    21 /******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
    21 /******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
    22 /******/ 	}();
    22 /******/ 	})();
    23 /******/ 	
    23 /******/ 	
    24 /************************************************************************/
    24 /************************************************************************/
    25 var __webpack_exports__ = {};
    25 var __webpack_exports__ = {};
    26 
    26 
    27 // EXPORTS
    27 // EXPORTS
    28 __webpack_require__.d(__webpack_exports__, {
    28 __webpack_require__.d(__webpack_exports__, {
    29   "default": function() { return /* binding */ warning; }
    29   "default": () => (/* binding */ warning)
    30 });
    30 });
    31 
    31 
    32 ;// CONCATENATED MODULE: ./node_modules/@wordpress/warning/build-module/utils.js
    32 ;// CONCATENATED MODULE: ./node_modules/@wordpress/warning/build-module/utils.js
    33 /**
    33 /**
    34  * Object map tracking messages which have been logged, for use in ensuring a
    34  * Object map tracking messages which have been logged, for use in ensuring a
    41 ;// CONCATENATED MODULE: ./node_modules/@wordpress/warning/build-module/index.js
    41 ;// CONCATENATED MODULE: ./node_modules/@wordpress/warning/build-module/index.js
    42 /**
    42 /**
    43  * Internal dependencies
    43  * Internal dependencies
    44  */
    44  */
    45 
    45 
       
    46 function isDev() {
       
    47   // eslint-disable-next-line @wordpress/wp-global-usage
       
    48   return true === true;
       
    49 }
    46 
    50 
    47 function isDev() {
       
    48   return typeof process !== 'undefined' && process.env && "production" !== 'production';
       
    49 }
       
    50 /**
    51 /**
    51  * Shows a warning with `message` if environment is not `production`.
    52  * Shows a warning with `message` if environment is not `production`.
    52  *
    53  *
    53  * @param {string} message Message to show in the warning.
    54  * @param {string} message Message to show in the warning.
    54  *
    55  *
    62  *   }
    63  *   }
    63  *   ...
    64  *   ...
    64  * }
    65  * }
    65  * ```
    66  * ```
    66  */
    67  */
    67 
       
    68 
       
    69 function warning(message) {
    68 function warning(message) {
    70   if (!isDev()) {
    69   if (!isDev()) {
    71     return;
    70     return;
    72   } // Skip if already logged.
    71   }
    73 
    72 
    74 
    73   // Skip if already logged.
    75   if (logged.has(message)) {
    74   if (logged.has(message)) {
    76     return;
    75     return;
    77   } // eslint-disable-next-line no-console
    76   }
    78 
    77 
       
    78   // eslint-disable-next-line no-console
       
    79   console.warn(message);
    79 
    80 
    80   console.warn(message); // Throwing an error and catching it immediately to improve debugging
    81   // Throwing an error and catching it immediately to improve debugging
    81   // A consumer can use 'pause on caught exceptions'
    82   // A consumer can use 'pause on caught exceptions'
    82   // https://github.com/facebook/react/issues/4216
    83   // https://github.com/facebook/react/issues/4216
    83 
       
    84   try {
    84   try {
    85     throw Error(message);
    85     throw Error(message);
    86   } catch (x) {// Do nothing.
    86   } catch (x) {
       
    87     // Do nothing.
    87   }
    88   }
    88 
       
    89   logged.add(message);
    89   logged.add(message);
    90 }
    90 }
    91 
    91 
    92 (window.wp = window.wp || {}).warning = __webpack_exports__["default"];
    92 (window.wp = window.wp || {}).warning = __webpack_exports__["default"];
    93 /******/ })()
    93 /******/ })()