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