| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 (function() { 2 "use strict"; 3 var wp; 4 (wp ||= {}).privateApis = (() => { 5 var __defProp = Object.defineProperty; 6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 7 var __getOwnPropNames = Object.getOwnPropertyNames; 8 var __hasOwnProp = Object.prototype.hasOwnProperty; 9 var __export = (target, all) => { 10 for (var name in all) 11 __defProp(target, name, { get: all[name], enumerable: true }); 12 }; 13 var __copyProps = (to, from, except, desc) => { 14 if (from && typeof from === "object" || typeof from === "function") { 15 for (let key of __getOwnPropNames(from)) 16 if (!__hasOwnProp.call(to, key) && key !== except) 17 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 18 } 19 return to; 20 }; 21 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 22 23 // packages/private-apis/build-module/index.mjs 24 var index_exports = {}; 25 __export(index_exports, { 26 __dangerousOptInToUnstableAPIsOnlyForCoreModules: () => __dangerousOptInToUnstableAPIsOnlyForCoreModules 27 }); 28 29 // packages/private-apis/build-module/implementation.mjs 30 var CORE_MODULES_USING_PRIVATE_APIS = [ 31 "@wordpress/admin-ui", 32 "@wordpress/api-fetch", 33 "@wordpress/block-directory", 34 "@wordpress/block-editor", 35 "@wordpress/block-library", 36 "@wordpress/blocks", 37 "@wordpress/boot", 38 "@wordpress/commands", 39 "@wordpress/compose", 40 "@wordpress/connectors", 41 "@wordpress/workflows", 42 "@wordpress/components", 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/rich-text", 56 "@wordpress/route", 57 "@wordpress/router", 58 "@wordpress/routes", 59 "@wordpress/storybook", 60 "@wordpress/sync", 61 "@wordpress/theme", 62 // Do not remove: older `@wordpress/dataviews` versions published to npm 63 // call the opt-in at module load, so a plugin bundling one of those 64 // copies throws at load time if this entry is missing. 65 "@wordpress/dataviews", 66 "@wordpress/fields", 67 "@wordpress/lazy-editor", 68 "@wordpress/media-editor", 69 "@wordpress/media-utils", 70 "@wordpress/upload-media", 71 "@wordpress/global-styles-engine", 72 "@wordpress/global-styles-ui", 73 "@wordpress/ui", 74 "@wordpress/views", 75 "@wordpress/widget-dashboard" 76 ]; 77 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."; 78 var __dangerousOptInToUnstableAPIsOnlyForCoreModules = (consent, moduleName) => { 79 if (!CORE_MODULES_USING_PRIVATE_APIS.includes(moduleName)) { 80 throw new Error( 81 `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.` 82 ); 83 } 84 if (consent !== requiredConsent) { 85 throw new Error( 86 `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.` 87 ); 88 } 89 return { 90 lock, 91 unlock 92 }; 93 }; 94 function lock(object, privateData) { 95 if (!object) { 96 throw new Error("Cannot lock an undefined object."); 97 } 98 const _object = object; 99 if (!(__private in _object)) { 100 _object[__private] = {}; 101 } 102 lockedData.set(_object[__private], privateData); 103 } 104 function unlock(object) { 105 if (!object) { 106 throw new Error("Cannot unlock an undefined object."); 107 } 108 const _object = object; 109 if (!(__private in _object)) { 110 throw new Error( 111 "Cannot unlock an object that was not locked before. " 112 ); 113 } 114 return lockedData.get(_object[__private]); 115 } 116 var lockedData = /* @__PURE__ */ new WeakMap(); 117 var __private = /* @__PURE__ */ Symbol("Private API ID"); 118 return __toCommonJS(index_exports); 119 })(); 120 (window.wp ||= {}).privateApis = wp.privateApis; 121 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Wed Sep 16 08:20:31 2026 | Cross-referenced by PHPXref |