[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
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 /******/ /* webpack/runtime/make namespace object */ 25 /******/ (() => { 26 /******/ // define __esModule on exports 27 /******/ __webpack_require__.r = (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 // ESM COMPAT FLAG 38 __webpack_require__.r(__webpack_exports__); 39 40 // EXPORTS 41 __webpack_require__.d(__webpack_exports__, { 42 __dangerousOptInToUnstableAPIsOnlyForCoreModules: () => (/* reexport */ __dangerousOptInToUnstableAPIsOnlyForCoreModules) 43 }); 44 45 ;// ./node_modules/@wordpress/private-apis/build-module/implementation.js 46 /** 47 * wordpress/private-apis – the utilities to enable private cross-package 48 * exports of private APIs. 49 * 50 * This "implementation.ts" file is needed for the sake of the unit tests. It 51 * exports more than the public API of the package to aid in testing. 52 */ 53 54 /** 55 * The list of core modules allowed to opt-in to the private APIs. 56 */ 57 const CORE_MODULES_USING_PRIVATE_APIS = ['@wordpress/block-directory', '@wordpress/block-editor', '@wordpress/block-library', '@wordpress/blocks', '@wordpress/commands', '@wordpress/components', '@wordpress/core-commands', '@wordpress/core-data', '@wordpress/customize-widgets', '@wordpress/data', '@wordpress/edit-post', '@wordpress/edit-site', '@wordpress/edit-widgets', '@wordpress/editor', '@wordpress/format-library', '@wordpress/patterns', '@wordpress/preferences', '@wordpress/reusable-blocks', '@wordpress/router', '@wordpress/dataviews', '@wordpress/fields', '@wordpress/media-utils', '@wordpress/upload-media']; 58 59 /** 60 * A list of core modules that already opted-in to 61 * the privateApis package. 62 */ 63 const registeredPrivateApis = []; 64 65 /* 66 * Warning for theme and plugin developers. 67 * 68 * The use of private developer APIs is intended for use by WordPress Core 69 * and the Gutenberg plugin exclusively. 70 * 71 * Dangerously opting in to using these APIs is NOT RECOMMENDED. Furthermore, 72 * the WordPress Core philosophy to strive to maintain backward compatibility 73 * for third-party developers DOES NOT APPLY to private APIs. 74 * 75 * THE CONSENT STRING FOR OPTING IN TO THESE APIS MAY CHANGE AT ANY TIME AND 76 * WITHOUT NOTICE. THIS CHANGE WILL BREAK EXISTING THIRD-PARTY CODE. SUCH A 77 * CHANGE MAY OCCUR IN EITHER A MAJOR OR MINOR RELEASE. 78 */ 79 const requiredConsent = 'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.'; 80 81 // The safety measure is meant for WordPress core where IS_WORDPRESS_CORE is set to true. 82 const allowReRegistration = true ? false : 0; 83 84 /** 85 * Called by a @wordpress package wishing to opt-in to accessing or exposing 86 * private private APIs. 87 * 88 * @param consent The consent string. 89 * @param moduleName The name of the module that is opting in. 90 * @return An object containing the lock and unlock functions. 91 */ 92 const __dangerousOptInToUnstableAPIsOnlyForCoreModules = (consent, moduleName) => { 93 if (!CORE_MODULES_USING_PRIVATE_APIS.includes(moduleName)) { 94 throw new Error(`You tried to opt-in to unstable APIs as 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.'); 95 } 96 if (!allowReRegistration && registeredPrivateApis.includes(moduleName)) { 97 // This check doesn't play well with Story Books / Hot Module Reloading 98 // and isn't included in the Gutenberg plugin. It only matters in the 99 // WordPress core release. 100 throw new Error(`You tried to opt-in to unstable APIs as 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.'); 101 } 102 if (consent !== requiredConsent) { 103 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.'); 104 } 105 registeredPrivateApis.push(moduleName); 106 return { 107 lock, 108 unlock 109 }; 110 }; 111 112 /** 113 * Binds private data to an object. 114 * It does not alter the passed object in any way, only 115 * registers it in an internal map of private data. 116 * 117 * The private data can't be accessed by any other means 118 * than the `unlock` function. 119 * 120 * @example 121 * ```js 122 * const object = {}; 123 * const privateData = { a: 1 }; 124 * lock( object, privateData ); 125 * 126 * object 127 * // {} 128 * 129 * unlock( object ); 130 * // { a: 1 } 131 * ``` 132 * 133 * @param object The object to bind the private data to. 134 * @param privateData The private data to bind to the object. 135 */ 136 function lock(object, privateData) { 137 if (!object) { 138 throw new Error('Cannot lock an undefined object.'); 139 } 140 const _object = object; 141 if (!(__private in _object)) { 142 _object[__private] = {}; 143 } 144 lockedData.set(_object[__private], privateData); 145 } 146 147 /** 148 * Unlocks the private data bound to an object. 149 * 150 * It does not alter the passed object in any way, only 151 * returns the private data paired with it using the `lock()` 152 * function. 153 * 154 * @example 155 * ```js 156 * const object = {}; 157 * const privateData = { a: 1 }; 158 * lock( object, privateData ); 159 * 160 * object 161 * // {} 162 * 163 * unlock( object ); 164 * // { a: 1 } 165 * ``` 166 * 167 * @param object The object to unlock the private data from. 168 * @return The private data bound to the object. 169 */ 170 function unlock(object) { 171 if (!object) { 172 throw new Error('Cannot unlock an undefined object.'); 173 } 174 const _object = object; 175 if (!(__private in _object)) { 176 throw new Error('Cannot unlock an object that was not locked before. '); 177 } 178 return lockedData.get(_object[__private]); 179 } 180 const lockedData = new WeakMap(); 181 182 /** 183 * Used by lock() and unlock() to uniquely identify the private data 184 * related to a containing object. 185 */ 186 const __private = Symbol('Private API ID'); 187 188 // Unit tests utilities: 189 190 /** 191 * Private function to allow the unit tests to allow 192 * a mock module to access the private APIs. 193 * 194 * @param name The name of the module. 195 */ 196 function allowCoreModule(name) { 197 CORE_MODULES_USING_PRIVATE_APIS.push(name); 198 } 199 200 /** 201 * Private function to allow the unit tests to set 202 * a custom list of allowed modules. 203 */ 204 function resetAllowedCoreModules() { 205 while (CORE_MODULES_USING_PRIVATE_APIS.length) { 206 CORE_MODULES_USING_PRIVATE_APIS.pop(); 207 } 208 } 209 /** 210 * Private function to allow the unit tests to reset 211 * the list of registered private apis. 212 */ 213 function resetRegisteredPrivateApis() { 214 while (registeredPrivateApis.length) { 215 registeredPrivateApis.pop(); 216 } 217 } 218 219 ;// ./node_modules/@wordpress/private-apis/build-module/index.js 220 221 222 (window.wp = window.wp || {}).privateApis = __webpack_exports__; 223 /******/ })() 224 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Sat Feb 22 08:20:01 2025 | Cross-referenced by PHPXref |