PluginProbe
Gutenberg / 23.2.1
Gutenberg v23.2.1
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / build / scripts / private-apis / index.js

index.js in Gutenberg 23.2.1, at build/scripts/private-apis/index.js

114 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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/block-directory",
32 "@wordpress/block-editor",
33 "@wordpress/block-library",
34 "@wordpress/blocks",
35 "@wordpress/boot",
36 "@wordpress/commands",
37 "@wordpress/connectors",
38 "@wordpress/workflows",
39 "@wordpress/components",
40 "@wordpress/content-types",
41 "@wordpress/core-commands",
42 "@wordpress/core-data",
43 "@wordpress/customize-widgets",
44 "@wordpress/data",
45 "@wordpress/edit-post",
46 "@wordpress/edit-site",
47 "@wordpress/edit-widgets",
48 "@wordpress/editor",
49 "@wordpress/font-list-route",
50 "@wordpress/format-library",
51 "@wordpress/patterns",
52 "@wordpress/preferences",
53 "@wordpress/reusable-blocks",
54 "@wordpress/rich-text",
55 "@wordpress/route",
56 "@wordpress/router",
57 "@wordpress/routes",
58 "@wordpress/sync",
59 "@wordpress/theme",
60 "@wordpress/dataviews",
61 "@wordpress/fields",
62 "@wordpress/lazy-editor",
63 "@wordpress/media-editor",
64 "@wordpress/media-utils",
65 "@wordpress/upload-media",
66 "@wordpress/global-styles-ui",
67 "@wordpress/ui",
68 "@wordpress/views"
69 ];
70 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.";
71 var __dangerousOptInToUnstableAPIsOnlyForCoreModules = (consent, moduleName) => {
72 if (!CORE_MODULES_USING_PRIVATE_APIS.includes(moduleName)) {
73 throw new Error(
74 `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.`
75 );
76 }
77 if (consent !== requiredConsent) {
78 throw new Error(
79 `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.`
80 );
81 }
82 return {
83 lock,
84 unlock
85 };
86 };
87 function lock(object, privateData) {
88 if (!object) {
89 throw new Error("Cannot lock an undefined object.");
90 }
91 const _object = object;
92 if (!(__private in _object)) {
93 _object[__private] = {};
94 }
95 lockedData.set(_object[__private], privateData);
96 }
97 function unlock(object) {
98 if (!object) {
99 throw new Error("Cannot unlock an undefined object.");
100 }
101 const _object = object;
102 if (!(__private in _object)) {
103 throw new Error(
104 "Cannot unlock an object that was not locked before. "
105 );
106 }
107 return lockedData.get(_object[__private]);
108 }
109 var lockedData = /* @__PURE__ */ new WeakMap();
110 var __private = /* @__PURE__ */ Symbol("Private API ID");
111 return __toCommonJS(index_exports);
112 })();
113 //# sourceMappingURL=index.js.map
114