PluginProbe
Gutenberg / 14.5.2
Gutenberg v14.5.2
24.0.0 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 All 403 releases
← All changes | build/server-side-render/index.js +64 -33 12.6.0 → 14.5.2 View file →
@@ -1,5 +1,5 @@
1 -/******/ (function() { // webpackBootstrap
1 +/******/ (() => { // webpackBootstrap
2 2 /******/ "use strict";
3 3 /******/ // The require scope
4 4 /******/ var __webpack_require__ = {};
5 5 /******/
@@ -4,23 +4,23 @@
4 4 /******/ var __webpack_require__ = {};
5 5 /******/
6 6 /************************************************************************/
7 7 /******/ /* webpack/runtime/compat get default export */
8 -/******/ !function() {
8 +/******/ (() => {
9 9 /******/ // getDefaultExport function for compatibility with non-harmony modules
10 -/******/ __webpack_require__.n = function(module) {
10 +/******/ __webpack_require__.n = (module) => {
11 11 /******/ var getter = module && module.__esModule ?
12 -/******/ function() { return module['default']; } :
13 -/******/ function() { return module; };
12 +/******/ () => (module['default']) :
13 +/******/ () => (module);
14 14 /******/ __webpack_require__.d(getter, { a: getter });
15 15 /******/ return getter;
16 16 /******/ };
17 -/******/ }();
17 +/******/ })();
18 18 /******/
19 19 /******/ /* webpack/runtime/define property getters */
20 -/******/ !function() {
20 +/******/ (() => {
21 21 /******/ // define getter functions for harmony exports
22 -/******/ __webpack_require__.d = function(exports, definition) {
22 +/******/ __webpack_require__.d = (exports, definition) => {
23 23 /******/ for(var key in definition) {
24 24 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25 25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26 26 /******/ }
@@ -25,14 +25,14 @@
25 25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26 26 /******/ }
27 27 /******/ }
28 28 /******/ };
29 -/******/ }();
29 +/******/ })();
30 30 /******/
31 31 /******/ /* webpack/runtime/hasOwnProperty shorthand */
32 -/******/ !function() {
33 -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
34 -/******/ }();
32 +/******/ (() => {
33 +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
34 +/******/ })();
35 35 /******/
36 36 /************************************************************************/
37 37 var __webpack_exports__ = {};
38 38
@@ -37,9 +37,9 @@
37 37 var __webpack_exports__ = {};
38 38
39 39 // EXPORTS
40 40 __webpack_require__.d(__webpack_exports__, {
41 - "default": function() { return /* binding */ build_module; }
41 + "default": () => (/* binding */ build_module)
42 42 });
43 43
44 44 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
45 45 function _extends() {
@@ -59,29 +59,29 @@
59 59
60 60 return _extends.apply(this, arguments);
61 61 }
62 62 ;// CONCATENATED MODULE: external ["wp","element"]
63 -var external_wp_element_namespaceObject = window["wp"]["element"];
63 +const external_wp_element_namespaceObject = window["wp"]["element"];
64 64 ;// CONCATENATED MODULE: external ["wp","data"]
65 -var external_wp_data_namespaceObject = window["wp"]["data"];
65 +const external_wp_data_namespaceObject = window["wp"]["data"];
66 66 ;// CONCATENATED MODULE: external ["wp","deprecated"]
67 -var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
67 +const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
68 68 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
69 69 ;// CONCATENATED MODULE: external "lodash"
70 -var external_lodash_namespaceObject = window["lodash"];
70 +const external_lodash_namespaceObject = window["lodash"];
71 71 ;// CONCATENATED MODULE: external ["wp","compose"]
72 -var external_wp_compose_namespaceObject = window["wp"]["compose"];
72 +const external_wp_compose_namespaceObject = window["wp"]["compose"];
73 73 ;// CONCATENATED MODULE: external ["wp","i18n"]
74 -var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
74 +const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
75 75 ;// CONCATENATED MODULE: external ["wp","apiFetch"]
76 -var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
76 +const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
77 77 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
78 78 ;// CONCATENATED MODULE: external ["wp","url"]
79 -var external_wp_url_namespaceObject = window["wp"]["url"];
79 +const external_wp_url_namespaceObject = window["wp"]["url"];
80 80 ;// CONCATENATED MODULE: external ["wp","components"]
81 -var external_wp_components_namespaceObject = window["wp"]["components"];
81 +const external_wp_components_namespaceObject = window["wp"]["components"];
82 82 ;// CONCATENATED MODULE: external ["wp","blocks"]
83 -var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
83 +const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
84 84 ;// CONCATENATED MODULE: ./packages/server-side-render/build-module/server-side-render.js
85 85
86 86
87 87
@@ -99,8 +99,9 @@
99 99
100 100
101 101
102 102
103 +const EMPTY_OBJECT = {};
103 104 function rendererPath(block) {
104 105 let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
105 106 let urlQueryArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
106 107 return (0,external_wp_url_namespaceObject.addQueryArgs)(`/wp/v2/block-renderer/${block}`, {
@@ -110,8 +111,31 @@
110 111 } : {}),
111 112 ...urlQueryArgs
112 113 });
113 114 }
115 +function removeBlockSupportAttributes(attributes) {
116 + const {
117 + backgroundColor,
118 + borderColor,
119 + fontFamily,
120 + fontSize,
121 + gradient,
122 + textColor,
123 + className,
124 + ...restAttributes
125 + } = attributes;
126 + const {
127 + border,
128 + color,
129 + elements,
130 + spacing,
131 + typography,
132 + ...restStyles
133 + } = (attributes === null || attributes === void 0 ? void 0 : attributes.style) || EMPTY_OBJECT;
134 + return { ...restAttributes,
135 + style: restStyles
136 + };
137 +}
114 138
115 139 function DefaultEmptyResponsePlaceholder(_ref) {
116 140 let {
117 141 className
@@ -163,8 +187,9 @@
163 187 block,
164 188 className,
165 189 httpMethod = 'GET',
166 190 urlQueryArgs,
191 + skipBlockSupportAttributes = false,
167 192 EmptyResponsePlaceholder = DefaultEmptyResponsePlaceholder,
168 193 ErrorResponsePlaceholder = DefaultErrorResponsePlaceholder,
169 194 LoadingResponsePlaceholder = DefaultLoadingResponsePlaceholder
170 195 } = props;
@@ -175,8 +200,10 @@
175 200 const prevProps = (0,external_wp_compose_namespaceObject.usePrevious)(props);
176 201 const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false);
177 202
178 203 function fetchData() {
204 + var _sanitizedAttributes, _sanitizedAttributes2;
205 +
179 206 if (!isMountedRef.current) {
180 207 return;
181 208 }
182 209
@@ -181,17 +208,21 @@
181 208 }
182 209
183 210 setIsLoading(true);
184 211
185 - const sanitizedAttributes = attributes && (0,external_wp_blocks_namespaceObject.__experimentalSanitizeBlockAttributes)(block, attributes); // If httpMethod is 'POST', send the attributes in the request body instead of the URL.
212 + let sanitizedAttributes = attributes && (0,external_wp_blocks_namespaceObject.__experimentalSanitizeBlockAttributes)(block, attributes);
213 +
214 + if (skipBlockSupportAttributes) {
215 + sanitizedAttributes = removeBlockSupportAttributes(sanitizedAttributes);
216 + } // If httpMethod is 'POST', send the attributes in the request body instead of the URL.
186 217 // This allows sending a larger attributes object than in a GET request, where the attributes are in the URL.
187 218
188 219
189 220 const isPostRequest = 'POST' === httpMethod;
190 - const urlAttributes = isPostRequest ? null : sanitizedAttributes !== null && sanitizedAttributes !== void 0 ? sanitizedAttributes : null;
221 + const urlAttributes = isPostRequest ? null : (_sanitizedAttributes = sanitizedAttributes) !== null && _sanitizedAttributes !== void 0 ? _sanitizedAttributes : null;
191 222 const path = rendererPath(block, urlAttributes, urlQueryArgs);
192 223 const data = isPostRequest ? {
193 - attributes: sanitizedAttributes !== null && sanitizedAttributes !== void 0 ? sanitizedAttributes : null
224 + attributes: (_sanitizedAttributes2 = sanitizedAttributes) !== null && _sanitizedAttributes2 !== void 0 ? _sanitizedAttributes2 : null
194 225 } : null; // Store the latest fetch request so that when we process it, we can
195 226 // check if it is the current request, to avoid race conditions on slow networks.
196 227
197 228 const fetchRequest = fetchRequestRef.current = external_wp_apiFetch_default()({
@@ -224,9 +255,9 @@
224 255 isMountedRef.current = false;
225 256 }, []);
226 257 (0,external_wp_element_namespaceObject.useEffect)(() => {
227 258 // Don't debounce the first fetch. This ensures that the first render
228 - // shows data as soon as possible
259 + // shows data as soon as possible.
229 260 if (prevProps === undefined) {
230 261 fetchData();
231 262 } else if (!(0,external_lodash_namespaceObject.isEqual)(prevProps, props)) {
232 263 debouncedFetchData();
@@ -273,9 +304,9 @@
273 304 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, {
274 305 className: className
275 306 }, response);
276 307 }
277 -//# sourceMappingURL=server-side-render.js.map
308 +
278 309 ;// CONCATENATED MODULE: ./packages/server-side-render/build-module/index.js
279 310
280 311
281 312
@@ -293,9 +324,9 @@
293 324 /**
294 325 * Constants
295 326 */
296 327
297 -const EMPTY_OBJECT = {};
328 +const build_module_EMPTY_OBJECT = {};
298 329 const ExportedServerSideRender = (0,external_wp_data_namespaceObject.withSelect)(select => {
299 330 // FIXME: @wordpress/server-side-render should not depend on @wordpress/editor.
300 331 // It is used by blocks that can be loaded into a *non-post* block editor.
301 332 // eslint-disable-next-line @wordpress/data-no-store-string-literals
@@ -313,12 +344,12 @@
313 344 };
314 345 }
315 346 }
316 347
317 - return EMPTY_OBJECT;
348 + return build_module_EMPTY_OBJECT;
318 349 })(_ref => {
319 350 let {
320 - urlQueryArgs = EMPTY_OBJECT,
351 + urlQueryArgs = build_module_EMPTY_OBJECT,
321 352 currentPostId,
322 353 ...props
323 354 } = _ref;
324 355 const newUrlQueryArgs = (0,external_wp_element_namespaceObject.useMemo)(() => {
@@ -348,9 +379,9 @@
348 379 }));
349 380 });
350 381 }
351 382
352 -/* harmony default export */ var build_module = (ExportedServerSideRender);
353 -//# sourceMappingURL=index.js.map
383 +/* harmony default export */ const build_module = (ExportedServerSideRender);
384 +
354 385 (window.wp = window.wp || {}).serverSideRender = __webpack_exports__["default"];
355 386 /******/ })()
356 387 ;