| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 "use strict"; 2 var wp; 3 (wp ||= {}).privateApis = (() => { 4 var __defProp = Object.defineProperty; 5 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 6 var __getOwnPropNames = Object.getOwnPropertyNames; 7 var __hasOwnProp = Object.prototype.hasOwnProperty; 8 var __export = (target, all) => { 9 for (var name in all) 10 __defProp(target, name, { get: all[name], enumerable: true }); 11 }; 12 var __copyProps = (to, from, except, desc) => { 13 if (from && typeof from === "object" || typeof from === "function") { 14 for (let key of __getOwnPropNames(from)) 15 if (!__hasOwnProp.call(to, key) && key !== except) 16 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 17 } 18 return to; 19 }; 20 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 21 22 // packages/private-apis/build-module/index.mjs 23 var index_exports = {}; 24 __export(index_exports, { 25 __dangerousOptInToUnstableAPIsOnlyForCoreModules: () => __dangerousOptInToUnstableAPIsOnlyForCoreModules 26 }); 27 28 // packages/private-apis/build-module/implementation.mjs 29 var CORE_MODULES_USING_PRIVATE_APIS = [ 30 "@wordpress/admin-ui", 31 "@wordpress/api-fetch", 32 "@wordpress/block-directory", 33 "@wordpress/block-editor", 34 "@wordpress/block-library", 35 "@wordpress/blocks", 36 "@wordpress/boot", 37 "@wordpress/commands", 38 "@wordpress/compose", 39 "@wordpress/connectors", 40 "@wordpress/workflows", 41 "@wordpress/components", 42 "@wordpress/content-types", 43 "@wordpress/core-commands", 44 "@wordpress/core-data", 45 "@wordpress/customize-widgets", 46 "@wordpress/data", 47 "@wordpress/edit-post", 48 "@wordpress/edit-site", 49 "@wordpress/edit-widgets", 50 "@wordpress/editor", 51 "@wordpress/font-list-route", 52 "@wordpress/format-library", 53 "@wordpress/patterns", 54 "@wordpress/preferences", 55 "@wordpress/reusable-blocks", 56 "@wordpress/rich-text", 57 "@wordpress/route", 58 "@wordpress/router", 59 "@wordpress/routes", 60 "@wordpress/storybook", 61 "@wordpress/sync", 62 "@wordpress/theme", 63 "@wordpress/dataviews", 64 "@wordpress/fields", 65 "@wordpress/lazy-editor", 66 "@wordpress/media-editor", 67 "@wordpress/media-utils", 68 "@wordpress/upload-media", 69 "@wordpress/global-styles-engine", 70 "@wordpress/global-styles-ui", 71 "@wordpress/ui", 72 "@wordpress/views", 73 "@wordpress/widget-dashboard" 74 ]; 75 var requiredConsent = "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress."; 76 var __dangerousOptInToUnstableAPIsOnlyForCoreModules = (consent, moduleName) => { 77 if (!CORE_MODULES_USING_PRIVATE_APIS.includes(moduleName)) { 78 throw new Error( 79 `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.` 80 ); 81 } 82 if (consent !== requiredConsent) { 83 throw new Error( 84 `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.` 85 ); 86 } 87 return { 88 lock, 89 unlock 90 }; 91 }; 92 function lock(object, privateData) { 93 if (!object) { 94 throw new Error("Cannot lock an undefined object."); 95 } 96 const _object = object; 97 if (!(__private in _object)) { 98 _object[__private] = {}; 99 } 100 lockedData.set(_object[__private], privateData); 101 } 102 function unlock(object) { 103 if (!object) { 104 throw new Error("Cannot unlock an undefined object."); 105 } 106 const _object = object; 107 if (!(__private in _object)) { 108 throw new Error( 109 "Cannot unlock an object that was not locked before. " 110 ); 111 } 112 return lockedData.get(_object[__private]); 113 } 114 var lockedData = /* @__PURE__ */ new WeakMap(); 115 var __private = /* @__PURE__ */ Symbol("Private API ID"); 116 return __toCommonJS(index_exports); 117 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Tue Jul 21 08:20:16 2026 | Cross-referenced by PHPXref |