diff -r 34716fd837a4 -r be944660c56a wp/wp-includes/js/dist/block-serialization-default-parser.js --- a/wp/wp-includes/js/dist/block-serialization-default-parser.js Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-includes/js/dist/block-serialization-default-parser.js Wed Sep 21 18:19:35 2022 +0200 @@ -82,113 +82,21 @@ /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 303); +/******/ return __webpack_require__(__webpack_require__.s = "SiJt"); /******/ }) /************************************************************************/ /******/ ({ -/***/ 14: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; - -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; }); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js -var arrayWithHoles = __webpack_require__(38); - -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js -function _iterableToArrayLimit(arr, i) { - if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; -} -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js -var unsupportedIterableToArray = __webpack_require__(29); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js -var nonIterableRest = __webpack_require__(39); - -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js - - - - -function _slicedToArray(arr, i) { - return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])(); -} - -/***/ }), - -/***/ 26: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); -function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - - for (var i = 0, arr2 = new Array(len); i < len; i++) { - arr2[i] = arr[i]; - } - - return arr2; -} - -/***/ }), - -/***/ 29: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); -/* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26); - -function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); -} - -/***/ }), - -/***/ 303: +/***/ "SiJt": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parse", function() { return parse; }); -/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14); - -var document; -var offset; -var output; -var stack; +let document; +let offset; +let output; +let stack; /** * Matches block comment delimiters * @@ -231,15 +139,15 @@ * @since 4.6.1 added optimization to prevent backtracking on attribute parsing */ -var tokenizer = /)[^])*)\5|[^]*?)}\s+)?(\/)?-->/g; +const tokenizer = /)[^])*)\5|[^]*?)}\s+)?(\/)?-->/g; function Block(blockName, attrs, innerBlocks, innerHTML, innerContent) { return { - blockName: blockName, - attrs: attrs, - innerBlocks: innerBlocks, - innerHTML: innerHTML, - innerContent: innerContent + blockName, + attrs, + innerBlocks, + innerHTML, + innerContent }; } @@ -249,11 +157,11 @@ function Frame(block, tokenStart, tokenLength, prevOffset, leadingHtmlStart) { return { - block: block, - tokenStart: tokenStart, - tokenLength: tokenLength, + block, + tokenStart, + tokenLength, prevOffset: prevOffset || tokenStart + tokenLength, - leadingHtmlStart: leadingHtmlStart + leadingHtmlStart }; } /** @@ -335,7 +243,7 @@ */ -var parse = function parse(doc) { +const parse = doc => { document = doc; offset = 0; output = []; @@ -349,18 +257,11 @@ }; function proceed() { - var next = nextToken(); + const next = nextToken(); + const [tokenType, blockName, attrs, startOffset, tokenLength] = next; + const stackDepth = stack.length; // we may have some HTML soup before the next block - var _next = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(next, 5), - tokenType = _next[0], - blockName = _next[1], - attrs = _next[2], - startOffset = _next[3], - tokenLength = _next[4]; - - var stackDepth = stack.length; // we may have some HTML soup before the next block - - var leadingHtmlStart = startOffset > offset ? offset : null; + const leadingHtmlStart = startOffset > offset ? offset : null; switch (tokenType) { case 'no-more-tokens': @@ -435,8 +336,8 @@ // block and add it as a innerBlock to the parent - var stackTop = stack.pop(); - var html = document.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset); + const stackTop = stack.pop(); + const html = document.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset); stackTop.block.innerHTML += html; stackTop.block.innerContent.push(html); stackTop.prevOffset = startOffset + tokenLength; @@ -476,32 +377,24 @@ // we're also using a trick here because the only difference between a // block opener and a block closer is the leading `/` before `wp:` (and // a closer has no attributes). we can trap them both and process the - // match back in Javascript to see which one it was. - var matches = tokenizer.exec(document); // we have no more tokens + // match back in JavaScript to see which one it was. + const matches = tokenizer.exec(document); // we have no more tokens if (null === matches) { return ['no-more-tokens']; } - var startedAt = matches.index; - - var _matches = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(matches, 7), - match = _matches[0], - closerMatch = _matches[1], - namespaceMatch = _matches[2], - nameMatch = _matches[3], - attrsMatch + const startedAt = matches.index; + const [match, closerMatch, namespaceMatch, nameMatch, attrsMatch /* internal/unused */ - = _matches[4], - voidMatch = _matches[6]; - - var length = match.length; - var isCloser = !!closerMatch; - var isVoid = !!voidMatch; - var namespace = namespaceMatch || 'core/'; - var name = namespace + nameMatch; - var hasAttrs = !!attrsMatch; - var attrs = hasAttrs ? parseJSON(attrsMatch) : {}; // This state isn't allowed + ,, voidMatch] = matches; + const length = match.length; + const isCloser = !!closerMatch; + const isVoid = !!voidMatch; + const namespace = namespaceMatch || 'core/'; + const name = namespace + nameMatch; + const hasAttrs = !!attrsMatch; + const attrs = hasAttrs ? parseJSON(attrsMatch) : {}; // This state isn't allowed // This is an error if (isCloser && (isVoid || hasAttrs)) {// we can ignore them since they don't hurt anything @@ -520,7 +413,7 @@ } function addFreeform(rawLength) { - var length = rawLength ? rawLength : document.length - offset; + const length = rawLength ? rawLength : document.length - offset; if (0 === length) { return; @@ -530,9 +423,9 @@ } function addInnerBlock(block, tokenStart, tokenLength, lastOffset) { - var parent = stack[stack.length - 1]; + const parent = stack[stack.length - 1]; parent.block.innerBlocks.push(block); - var html = document.substr(parent.prevOffset, tokenStart - parent.prevOffset); + const html = document.substr(parent.prevOffset, tokenStart - parent.prevOffset); if (html) { parent.block.innerHTML += html; @@ -544,13 +437,13 @@ } function addBlockFromStack(endOffset) { - var _stack$pop = stack.pop(), - block = _stack$pop.block, - leadingHtmlStart = _stack$pop.leadingHtmlStart, - prevOffset = _stack$pop.prevOffset, - tokenStart = _stack$pop.tokenStart; - - var html = endOffset ? document.substr(prevOffset, endOffset - prevOffset) : document.substr(prevOffset); + const { + block, + leadingHtmlStart, + prevOffset, + tokenStart + } = stack.pop(); + const html = endOffset ? document.substr(prevOffset, endOffset - prevOffset) : document.substr(prevOffset); if (html) { block.innerHTML += html; @@ -565,28 +458,6 @@ } -/***/ }), - -/***/ 38: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} - -/***/ }), - -/***/ 39: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} - /***/ }) /******/ }); \ No newline at end of file