| 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 |
/******/ /* webpack/runtime/make namespace object */ |
| 25 |
/******/ !function() { |
| 26 |
/******/ // define __esModule on exports |
| 27 |
/******/ __webpack_require__.r = function(exports) { |
| 28 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 29 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 30 |
/******/ } |
| 31 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 32 |
/******/ }; |
| 33 |
/******/ }(); |
| 34 |
/******/ |
| 35 |
/************************************************************************/ |
| 36 |
var __webpack_exports__ = {}; |
| 37 |
__webpack_require__.r(__webpack_exports__); |
| 38 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 39 |
/* harmony export */ "__dangerousOptInToUnstableAPIsOnlyForCoreModules": function() { return /* binding */ __dangerousOptInToUnstableAPIsOnlyForCoreModules; } |
| 40 |
/* harmony export */ }); |
| 41 |
const CORE_MODULES_USING_EXPERIMENTS = ['@wordpress/data', '@wordpress/block-editor', '@wordpress/block-library', '@wordpress/blocks', '@wordpress/core-data', '@wordpress/date', '@wordpress/edit-site', '@wordpress/edit-widgets']; |
| 42 |
const registeredExperiments = {}; |
| 43 |
/* |
| 44 |
* Warning for theme and plugin developers. |
| 45 |
* |
| 46 |
* The use of experimental developer APIs is intended for use by WordPress Core |
| 47 |
* and the Gutenberg plugin exclusively. |
| 48 |
* |
| 49 |
* Dangerously opting in to using these APIs is NOT RECOMMENDED. Furthermore, |
| 50 |
* the WordPress Core philosophy to strive to maintain backward compatibility |
| 51 |
* for third-party developers DOES NOT APPLY to experimental APIs. |
| 52 |
* |
| 53 |
* THE CONSENT STRING FOR OPTING IN TO THESE APIS MAY CHANGE AT ANY TIME AND |
| 54 |
* WITHOUT NOTICE. THIS CHANGE WILL BREAK EXISTING THIRD-PARTY CODE. SUCH A |
| 55 |
* CHANGE MAY OCCUR IN EITHER A MAJOR OR MINOR RELEASE. |
| 56 |
*/ |
| 57 |
|
| 58 |
const requiredConsent = 'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.'; |
| 59 |
const __dangerousOptInToUnstableAPIsOnlyForCoreModules = (consent, moduleName) => { |
| 60 |
if (!CORE_MODULES_USING_EXPERIMENTS.includes(moduleName)) { |
| 61 |
throw new Error(`You tried to opt-in to unstable APIs as a module "${moduleName}". ` + 'This feature is only for JavaScript modules shipped with WordPress core. ' + 'Please do not use it in plugins and themes as the unstable APIs will be removed ' + 'without a warning. If you ignore this error and depend on unstable features, ' + 'your product will inevitably break on one of the next WordPress releases.'); |
| 62 |
} |
| 63 |
|
| 64 |
if (moduleName in registeredExperiments) { |
| 65 |
throw new Error(`You tried to opt-in to unstable APIs as a module "${moduleName}" which is already registered. ` + 'This feature is only for JavaScript modules shipped with WordPress core. ' + 'Please do not use it in plugins and themes as the unstable APIs will be removed ' + 'without a warning. If you ignore this error and depend on unstable features, ' + 'your product will inevitably break on one of the next WordPress releases.'); |
| 66 |
} |
| 67 |
|
| 68 |
if (consent !== requiredConsent) { |
| 69 |
throw new Error(`You tried to opt-in to unstable APIs without confirming you know the consequences. ` + 'This feature is only for JavaScript modules shipped with WordPress core. ' + 'Please do not use it in plugins and themes as the unstable APIs will removed ' + 'without a warning. If you ignore this error and depend on unstable features, ' + 'your product will inevitably break on the next WordPress release.'); |
| 70 |
} |
| 71 |
|
| 72 |
registeredExperiments[moduleName] = { |
| 73 |
accessKey: {}, |
| 74 |
apis: {} |
| 75 |
}; |
| 76 |
return { |
| 77 |
register: experiments => { |
| 78 |
for (const key in experiments) { |
| 79 |
registeredExperiments[moduleName].apis[key] = experiments[key]; |
| 80 |
} |
| 81 |
|
| 82 |
return registeredExperiments[moduleName].accessKey; |
| 83 |
}, |
| 84 |
unlock: accessKey => { |
| 85 |
for (const experiment of Object.values(registeredExperiments)) { |
| 86 |
if (experiment.accessKey === accessKey) { |
| 87 |
return experiment.apis; |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
throw new Error('There is no registered module matching the specified access key'); |
| 92 |
} |
| 93 |
}; |
| 94 |
}; |
| 95 |
|
| 96 |
(window.wp = window.wp || {}).experiments = __webpack_exports__; |
| 97 |
/******/ })() |
| 98 |
; |