--- a/wp/wp-includes/js/dist/shortcode.js Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/js/dist/shortcode.js Tue Dec 15 13:49:49 2020 +0100
@@ -82,7 +82,7 @@
/******/
/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 352);
+/******/ return __webpack_require__(__webpack_require__.s = 431);
/******/ })
/************************************************************************/
/******/ ({
@@ -94,7 +94,7 @@
/***/ }),
-/***/ 352:
+/***/ 431:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -107,7 +107,7 @@
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromMatch", function() { return fromMatch; });
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41);
+/* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(60);
/* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(memize__WEBPACK_IMPORTED_MODULE_1__);
/**
* External dependencies
@@ -199,7 +199,6 @@
*/
function replace(tag, text, callback) {
- var _arguments = arguments;
return text.replace(regexp(tag), function (match, left, $3, attrs, slash, content, closing, right) {
// If both extra brackets exist, the shortcode has been properly
// escaped.
@@ -208,7 +207,7 @@
} // Create the match object and pass it through the callback.
- var result = callback(fromMatch(_arguments)); // Make sure to return any of the extra brackets if they weren't used to
+ var result = callback(fromMatch(arguments)); // Make sure to return any of the extra brackets if they weren't used to
// escape the shortcode.
return result ? left + result + right : match;
@@ -464,16 +463,58 @@
/***/ }),
-/***/ 41:
+/***/ 60:
/***/ (function(module, exports, __webpack_require__) {
-module.exports = function memize( fn, options ) {
- var size = 0,
- maxSize, head, tail;
+/**
+ * Memize options object.
+ *
+ * @typedef MemizeOptions
+ *
+ * @property {number} [maxSize] Maximum size of the cache.
+ */
+
+/**
+ * Internal cache entry.
+ *
+ * @typedef MemizeCacheNode
+ *
+ * @property {?MemizeCacheNode|undefined} [prev] Previous node.
+ * @property {?MemizeCacheNode|undefined} [next] Next node.
+ * @property {Array<*>} args Function arguments for cache
+ * entry.
+ * @property {*} val Function result.
+ */
- if ( options && options.maxSize ) {
- maxSize = options.maxSize;
- }
+/**
+ * Properties of the enhanced function for controlling cache.
+ *
+ * @typedef MemizeMemoizedFunction
+ *
+ * @property {()=>void} clear Clear the cache.
+ */
+
+/**
+ * Accepts a function to be memoized, and returns a new memoized function, with
+ * optional options.
+ *
+ * @template {Function} F
+ *
+ * @param {F} fn Function to memoize.
+ * @param {MemizeOptions} [options] Options object.
+ *
+ * @return {F & MemizeMemoizedFunction} Memoized function.
+ */
+function memize( fn, options ) {
+ var size = 0;
+
+ /** @type {?MemizeCacheNode|undefined} */
+ var head;
+
+ /** @type {?MemizeCacheNode|undefined} */
+ var tail;
+
+ options = options || {};
function memoized( /* ...args */ ) {
var node = head,
@@ -513,14 +554,14 @@
// Adjust siblings to point to each other. If node was tail,
// this also handles new tail's empty `next` assignment.
- node.prev.next = node.next;
+ /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next;
if ( node.next ) {
node.next.prev = node.prev;
}
node.next = head;
node.prev = null;
- head.prev = node;
+ /** @type {MemizeCacheNode} */ ( head ).prev = node;
head = node;
}
@@ -540,7 +581,7 @@
args: args,
// Generate the result from original function
- val: fn.apply( null, args )
+ val: fn.apply( null, args ),
};
// Don't need to check whether node is already head, since it would
@@ -556,9 +597,9 @@
}
// Trim tail if we're reached max size and are pending cache insertion
- if ( size === maxSize ) {
- tail = tail.prev;
- tail.next = null;
+ if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) {
+ tail = /** @type {MemizeCacheNode} */ ( tail ).prev;
+ /** @type {MemizeCacheNode} */ ( tail ).next = null;
} else {
size++;
}
@@ -576,8 +617,16 @@
if ( false ) {}
+ // Ignore reason: There's not a clear solution to create an intersection of
+ // the function with additional properties, where the goal is to retain the
+ // function signature of the incoming argument and add control properties
+ // on the return value.
+
+ // @ts-ignore
return memoized;
-};
+}
+
+module.exports = memize;
/***/ })