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/api-fetch/index.js +41 -40 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,11 +4,11 @@
4 4 /******/ var __webpack_require__ = {};
5 5 /******/
6 6 /************************************************************************/
7 7 /******/ /* webpack/runtime/define property getters */
8 -/******/ !function() {
8 +/******/ (() => {
9 9 /******/ // define getter functions for harmony exports
10 -/******/ __webpack_require__.d = function(exports, definition) {
10 +/******/ __webpack_require__.d = (exports, definition) => {
11 11 /******/ for(var key in definition) {
12 12 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
13 13 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
14 14 /******/ }
@@ -13,14 +13,14 @@
13 13 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
14 14 /******/ }
15 15 /******/ }
16 16 /******/ };
17 -/******/ }();
17 +/******/ })();
18 18 /******/
19 19 /******/ /* webpack/runtime/hasOwnProperty shorthand */
20 -/******/ !function() {
21 -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
22 -/******/ }();
20 +/******/ (() => {
21 +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
22 +/******/ })();
23 23 /******/
24 24 /************************************************************************/
25 25 var __webpack_exports__ = {};
26 26
@@ -25,13 +25,13 @@
25 25 var __webpack_exports__ = {};
26 26
27 27 // EXPORTS
28 28 __webpack_require__.d(__webpack_exports__, {
29 - "default": function() { return /* binding */ build_module; }
29 + "default": () => (/* binding */ build_module)
30 30 });
31 31
32 32 ;// CONCATENATED MODULE: external ["wp","i18n"]
33 -var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
33 +const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
34 34 ;// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/nonce.js
35 35 /**
36 36 * @param {string} nonce
37 37 * @return {import('../types').APIFetchMiddleware & { nonce: string }} A middleware to enhance a request with a nonce.
@@ -62,10 +62,10 @@
62 62 middleware.nonce = nonce;
63 63 return middleware;
64 64 }
65 65
66 -/* harmony default export */ var nonce = (createNonceMiddleware);
67 -//# sourceMappingURL=nonce.js.map
66 +/* harmony default export */ const nonce = (createNonceMiddleware);
67 +
68 68 ;// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/namespace-endpoint.js
69 69 /**
70 70 * @type {import('../types').APIFetchMiddleware}
71 71 */
@@ -90,10 +90,10 @@
90 90 path
91 91 });
92 92 };
93 93
94 -/* harmony default export */ var namespace_endpoint = (namespaceAndEndpointMiddleware);
95 -//# sourceMappingURL=namespace-endpoint.js.map
94 +/* harmony default export */ const namespace_endpoint = (namespaceAndEndpointMiddleware);
95 +
96 96 ;// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/root-url.js
97 97 /**
98 98 * Internal dependencies
99 99 */
@@ -131,12 +131,12 @@
131 131 });
132 132 });
133 133 };
134 134
135 -/* harmony default export */ var root_url = (createRootURLMiddleware);
136 -//# sourceMappingURL=root-url.js.map
135 +/* harmony default export */ const root_url = (createRootURLMiddleware);
136 +
137 137 ;// CONCATENATED MODULE: external ["wp","url"]
138 -var external_wp_url_namespaceObject = window["wp"]["url"];
138 +const external_wp_url_namespaceObject = window["wp"]["url"];
139 139 ;// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/preloading.js
140 140 /**
141 141 * WordPress dependencies
142 142 */
@@ -146,14 +146,12 @@
146 146 * @return {import('../types').APIFetchMiddleware} Preloading middleware.
147 147 */
148 148
149 149 function createPreloadingMiddleware(preloadedData) {
150 - const cache = Object.keys(preloadedData).reduce((result, path) => {
151 - result[(0,external_wp_url_namespaceObject.normalizePath)(path)] = preloadedData[path];
152 - return result;
153 - },
154 - /** @type {Record<string, any>} */
155 - {});
150 + const cache = Object.fromEntries(Object.entries(preloadedData).map(_ref => {
151 + let [path, data] = _ref;
152 + return [(0,external_wp_url_namespaceObject.normalizePath)(path), data];
153 + }));
156 154 return (options, next) => {
157 155 const {
158 156 parse = true
159 157 } = options;
@@ -161,12 +159,15 @@
161 159
162 160 let rawPath = options.path;
163 161
164 162 if (!rawPath && options.url) {
165 - const pathFromQuery = (0,external_wp_url_namespaceObject.getQueryArg)(options.url, 'rest_route');
163 + const {
164 + rest_route: pathFromQuery,
165 + ...queryArgs
166 + } = (0,external_wp_url_namespaceObject.getQueryArgs)(options.url);
166 167
167 168 if (typeof pathFromQuery === 'string') {
168 - rawPath = pathFromQuery;
169 + rawPath = (0,external_wp_url_namespaceObject.addQueryArgs)(pathFromQuery, queryArgs);
169 170 }
170 171 }
171 172
172 173 if (typeof rawPath !== 'string') {
@@ -176,14 +177,14 @@
176 177 const method = options.method || 'GET';
177 178 const path = (0,external_wp_url_namespaceObject.normalizePath)(rawPath);
178 179
179 180 if ('GET' === method && cache[path]) {
180 - const cacheData = cache[path]; // Unsetting the cache key ensures that the data is only used a single time
181 + const cacheData = cache[path]; // Unsetting the cache key ensures that the data is only used a single time.
181 182
182 183 delete cache[path];
183 184 return prepareResponse(cacheData, !!parse);
184 185 } else if ('OPTIONS' === method && cache[method] && cache[method][path]) {
185 - const cacheData = cache[method][path]; // Unsetting the cache key ensures that the data is only used a single time
186 + const cacheData = cache[method][path]; // Unsetting the cache key ensures that the data is only used a single time.
186 187
187 188 delete cache[method][path];
188 189 return prepareResponse(cacheData, !!parse);
189 190 }
@@ -207,10 +208,10 @@
207 208 headers: responseData.headers
208 209 }));
209 210 }
210 211
211 -/* harmony default export */ var preloading = (createPreloadingMiddleware);
212 -//# sourceMappingURL=preloading.js.map
212 +/* harmony default export */ const preloading = (createPreloadingMiddleware);
213 +
213 214 ;// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/fetch-all-middleware.js
214 215 /**
215 216 * WordPress dependencies
216 217 */
@@ -348,10 +349,10 @@
348 349
349 350 return mergedResults;
350 351 };
351 352
352 -/* harmony default export */ var fetch_all_middleware = (fetchAllMiddleware);
353 -//# sourceMappingURL=fetch-all-middleware.js.map
353 +/* harmony default export */ const fetch_all_middleware = (fetchAllMiddleware);
354 +
354 355 ;// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/http-v1.js
355 356 /**
356 357 * Set of HTTP methods which are eligible to be overridden.
357 358 *
@@ -394,10 +395,10 @@
394 395
395 396 return next(options);
396 397 };
397 398
398 -/* harmony default export */ var http_v1 = (httpV1Middleware);
399 -//# sourceMappingURL=http-v1.js.map
399 +/* harmony default export */ const http_v1 = (httpV1Middleware);
400 +
400 401 ;// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/user-locale.js
401 402 /**
402 403 * WordPress dependencies
403 404 */
@@ -421,10 +422,10 @@
421 422
422 423 return next(options);
423 424 };
424 425
425 -/* harmony default export */ var user_locale = (userLocaleMiddleware);
426 -//# sourceMappingURL=user-locale.js.map
426 +/* harmony default export */ const user_locale = (userLocaleMiddleware);
427 +
427 428 ;// CONCATENATED MODULE: ./packages/api-fetch/build-module/utils/response.js
428 429 /**
429 430 * WordPress dependencies
430 431 */
@@ -510,9 +511,9 @@
510 511 };
511 512 throw error || unknownError;
512 513 });
513 514 }
514 -//# sourceMappingURL=response.js.map
515 +
515 516 ;// CONCATENATED MODULE: ./packages/api-fetch/build-module/middlewares/media-upload.js
516 517 /**
517 518 * WordPress dependencies
518 519 */
@@ -594,10 +595,10 @@
594 595 return parseAndThrowError(response, options.parse);
595 596 }).then(response => parseResponseAndNormalizeError(response, options.parse));
596 597 };
597 598
598 -/* harmony default export */ var media_upload = (mediaUploadMiddleware);
599 -//# sourceMappingURL=media-upload.js.map
599 +/* harmony default export */ const media_upload = (mediaUploadMiddleware);
600 +
600 601 ;// CONCATENATED MODULE: ./packages/api-fetch/build-module/index.js
601 602 /**
602 603 * WordPress dependencies
603 604 */
@@ -701,9 +702,9 @@
701 702 body = JSON.stringify(data);
702 703 headers['Content-Type'] = 'application/json';
703 704 }
704 705
705 - const responsePromise = window.fetch( // fall back to explicitly passing `window.location` which is the behavior if `undefined` is passed
706 + const responsePromise = window.fetch( // Fall back to explicitly passing `window.location` which is the behavior if `undefined` is passed.
706 707 url || path || window.location.href, { ...DEFAULT_OPTIONS,
707 708 ...remainingOptions,
708 709 body,
709 710 headers
@@ -775,9 +776,9 @@
775 776 apiFetch.createPreloadingMiddleware = preloading;
776 777 apiFetch.createRootURLMiddleware = root_url;
777 778 apiFetch.fetchAllMiddleware = fetch_all_middleware;
778 779 apiFetch.mediaUploadMiddleware = media_upload;
779 -/* harmony default export */ var build_module = (apiFetch);
780 -//# sourceMappingURL=index.js.map
780 +/* harmony default export */ const build_module = (apiFetch);
781 +
781 782 (window.wp = window.wp || {}).apiFetch = __webpack_exports__["default"];
782 783 /******/ })()
783 784 ;