diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/js/dist/url.js --- a/wp/wp-includes/js/dist/url.js Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/js/dist/url.js Tue Sep 27 16:37:53 2022 +0200 @@ -1,133 +1,73 @@ -this["wp"] = this["wp"] || {}; this["wp"]["url"] = -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ // The require scope +/******/ var __webpack_require__ = {}; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } /******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "lbya"); -/******/ }) +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ /************************************************************************/ -/******/ ({ - -/***/ "YLtl": -/***/ (function(module, exports) { - -(function() { module.exports = window["lodash"]; }()); - -/***/ }), - -/***/ "lbya": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; +var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS -__webpack_require__.d(__webpack_exports__, "isURL", function() { return /* reexport */ isURL; }); -__webpack_require__.d(__webpack_exports__, "isEmail", function() { return /* reexport */ isEmail; }); -__webpack_require__.d(__webpack_exports__, "getProtocol", function() { return /* reexport */ getProtocol; }); -__webpack_require__.d(__webpack_exports__, "isValidProtocol", function() { return /* reexport */ isValidProtocol; }); -__webpack_require__.d(__webpack_exports__, "getAuthority", function() { return /* reexport */ getAuthority; }); -__webpack_require__.d(__webpack_exports__, "isValidAuthority", function() { return /* reexport */ isValidAuthority; }); -__webpack_require__.d(__webpack_exports__, "getPath", function() { return /* reexport */ getPath; }); -__webpack_require__.d(__webpack_exports__, "isValidPath", function() { return /* reexport */ isValidPath; }); -__webpack_require__.d(__webpack_exports__, "getQueryString", function() { return /* reexport */ getQueryString; }); -__webpack_require__.d(__webpack_exports__, "buildQueryString", function() { return /* reexport */ buildQueryString; }); -__webpack_require__.d(__webpack_exports__, "isValidQueryString", function() { return /* reexport */ isValidQueryString; }); -__webpack_require__.d(__webpack_exports__, "getPathAndQueryString", function() { return /* reexport */ getPathAndQueryString; }); -__webpack_require__.d(__webpack_exports__, "getFragment", function() { return /* reexport */ getFragment; }); -__webpack_require__.d(__webpack_exports__, "isValidFragment", function() { return /* reexport */ isValidFragment; }); -__webpack_require__.d(__webpack_exports__, "addQueryArgs", function() { return /* reexport */ addQueryArgs; }); -__webpack_require__.d(__webpack_exports__, "getQueryArg", function() { return /* reexport */ getQueryArg; }); -__webpack_require__.d(__webpack_exports__, "getQueryArgs", function() { return /* reexport */ getQueryArgs; }); -__webpack_require__.d(__webpack_exports__, "hasQueryArg", function() { return /* reexport */ hasQueryArg; }); -__webpack_require__.d(__webpack_exports__, "removeQueryArgs", function() { return /* reexport */ removeQueryArgs; }); -__webpack_require__.d(__webpack_exports__, "prependHTTP", function() { return /* reexport */ prependHTTP; }); -__webpack_require__.d(__webpack_exports__, "safeDecodeURI", function() { return /* reexport */ safeDecodeURI; }); -__webpack_require__.d(__webpack_exports__, "safeDecodeURIComponent", function() { return /* reexport */ safeDecodeURIComponent; }); -__webpack_require__.d(__webpack_exports__, "filterURLForDisplay", function() { return /* reexport */ filterURLForDisplay; }); -__webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return /* reexport */ cleanForSlug; }); +__webpack_require__.d(__webpack_exports__, { + "addQueryArgs": function() { return /* reexport */ addQueryArgs; }, + "buildQueryString": function() { return /* reexport */ buildQueryString; }, + "cleanForSlug": function() { return /* reexport */ cleanForSlug; }, + "filterURLForDisplay": function() { return /* reexport */ filterURLForDisplay; }, + "getAuthority": function() { return /* reexport */ getAuthority; }, + "getFilename": function() { return /* reexport */ getFilename; }, + "getFragment": function() { return /* reexport */ getFragment; }, + "getPath": function() { return /* reexport */ getPath; }, + "getPathAndQueryString": function() { return /* reexport */ getPathAndQueryString; }, + "getProtocol": function() { return /* reexport */ getProtocol; }, + "getQueryArg": function() { return /* reexport */ getQueryArg; }, + "getQueryArgs": function() { return /* reexport */ getQueryArgs; }, + "getQueryString": function() { return /* reexport */ getQueryString; }, + "hasQueryArg": function() { return /* reexport */ hasQueryArg; }, + "isEmail": function() { return /* reexport */ isEmail; }, + "isURL": function() { return /* reexport */ isURL; }, + "isValidAuthority": function() { return /* reexport */ isValidAuthority; }, + "isValidFragment": function() { return /* reexport */ isValidFragment; }, + "isValidPath": function() { return /* reexport */ isValidPath; }, + "isValidProtocol": function() { return /* reexport */ isValidProtocol; }, + "isValidQueryString": function() { return /* reexport */ isValidQueryString; }, + "normalizePath": function() { return /* reexport */ normalizePath; }, + "prependHTTP": function() { return /* reexport */ prependHTTP; }, + "removeQueryArgs": function() { return /* reexport */ removeQueryArgs; }, + "safeDecodeURI": function() { return /* reexport */ safeDecodeURI; }, + "safeDecodeURIComponent": function() { return /* reexport */ safeDecodeURIComponent; } +}); -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-url.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-url.js /** * Determines whether the given string looks like a URL. * @@ -154,7 +94,7 @@ } } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-email.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-email.js const EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i; /** * Determines whether the given string looks like an email. @@ -173,7 +113,7 @@ return EMAIL_REGEXP.test(email); } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-protocol.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-protocol.js /** * Returns the protocol part of the URL. * @@ -195,7 +135,7 @@ } } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-protocol.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-protocol.js /** * Tests if a url protocol is valid. * @@ -217,7 +157,7 @@ return /^[a-z\-.\+]+[0-9]*:$/i.test(protocol); } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-authority.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-authority.js /** * Returns the authority part of the URL. * @@ -239,7 +179,7 @@ } } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-authority.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-authority.js /** * Checks for invalid characters within the provided authority. * @@ -261,7 +201,7 @@ return /^[^\s#?]+$/.test(authority); } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-path.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-path.js /** * Returns the path part of the URL. * @@ -283,7 +223,7 @@ } } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-path.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-path.js /** * Checks for invalid characters within the provided path. * @@ -305,7 +245,7 @@ return /^[^\s#?]+$/.test(path); } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-string.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-string.js /** * Returns the query string part of the URL. * @@ -330,7 +270,7 @@ } } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/build-query-string.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/build-query-string.js /** * Generates URL-encoded query string using input query data. * @@ -390,7 +330,7 @@ return string.substr(1); } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-query-string.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-query-string.js /** * Checks for invalid characters within the provided query string. * @@ -412,7 +352,7 @@ return /^[^\s#?\/]+$/.test(queryString); } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-path-and-query-string.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-path-and-query-string.js /** * Internal dependencies */ @@ -440,7 +380,7 @@ return value; } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-fragment.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-fragment.js /** * Returns the fragment part of the URL. * @@ -462,7 +402,7 @@ } } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-fragment.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/is-valid-fragment.js /** * Checks for invalid characters within the provided fragment. * @@ -484,7 +424,7 @@ return /^#[^\s#?\/]*$/.test(fragment); } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-args.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-args.js /** * Internal dependencies */ @@ -515,10 +455,11 @@ // If key is empty string and next value is array, derive key from // the current length of the array. key = object.length.toString(); - } // If the next key in the path is numeric (or empty string), it will be + } + + key = ['__proto__', 'constructor', 'prototype'].includes(key) ? key.toUpperCase() : key; // If the next key in the path is numeric (or empty string), it will be // created as an array. Otherwise, it will be created as an object. - const isNextKeyArrayIndex = !isNaN(Number(path[i + 1])); object[key] = i === lastIndex ? // If at end of path, assign the intended value. value : // Otherwise, advance to the next object in the path, creating @@ -553,11 +494,11 @@ function getQueryArgs(url) { - return (getQueryString(url) || ''). // Normalize space encoding, accounting for PHP URL encoding + return (getQueryString(url) || '' // Normalize space encoding, accounting for PHP URL encoding // corresponding to `application/x-www-form-urlencoded`. // // See: https://tools.ietf.org/html/rfc1866#section-8.2.1 - replace(/\+/g, '%20').split('&').reduce((accumulator, keyValue) => { + ).replace(/\+/g, '%20').split('&').reduce((accumulator, keyValue) => { const [key, value = ''] = keyValue.split('=') // Filtering avoids decoding as `undefined` for value, where // default is restored in destructuring assignment. .filter(Boolean).map(decodeURIComponent); @@ -568,10 +509,10 @@ } return accumulator; - }, {}); + }, Object.create(null)); } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/add-query-args.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/add-query-args.js /** * Internal dependencies */ @@ -582,9 +523,9 @@ * includes query arguments, the arguments are merged with (and take precedent * over) the existing set. * - * @param {string} [url=''] URL to which arguments should be appended. If omitted, - * only the resulting querystring is returned. - * @param {Object} [args] Query arguments to apply to URL. + * @param {string} [url=''] URL to which arguments should be appended. If omitted, + * only the resulting querystring is returned. + * @param {Object} [args] Query arguments to apply to URL. * * @example * ```js @@ -594,7 +535,10 @@ * @return {string} URL with arguments applied. */ -function addQueryArgs(url = '', args) { +function addQueryArgs() { + let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + let args = arguments.length > 1 ? arguments[1] : undefined; + // If no arguments are to be appended, return original URL. if (!args || !Object.keys(args).length) { return url; @@ -614,7 +558,7 @@ return baseUrl + '?' + buildQueryString(args); } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-arg.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-query-arg.js /** * Internal dependencies */ @@ -645,7 +589,7 @@ return getQueryArgs(url)[arg]; } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/has-query-arg.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/has-query-arg.js /** * Internal dependencies */ @@ -668,7 +612,7 @@ return getQueryArg(url, arg) !== undefined; } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/remove-query-args.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/remove-query-args.js /** * Internal dependencies */ @@ -688,7 +632,7 @@ * @return {string} Updated URL. */ -function removeQueryArgs(url, ...args) { +function removeQueryArgs(url) { const queryStringIndex = url.indexOf('?'); if (queryStringIndex === -1) { @@ -697,12 +641,17 @@ const query = getQueryArgs(url); const baseURL = url.substr(0, queryStringIndex); + + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + args.forEach(arg => delete query[arg]); const queryString = buildQueryString(query); return queryString ? baseURL + '?' + queryString : baseURL; } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/prepend-http.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/prepend-http.js /** * Internal dependencies */ @@ -735,7 +684,7 @@ return url; } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/safe-decode-uri.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/safe-decode-uri.js /** * Safely decodes a URI with `decodeURI`. Returns the URI unmodified if * `decodeURI` throws an error. @@ -757,7 +706,7 @@ } } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/safe-decode-uri-component.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/safe-decode-uri-component.js /** * Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if * `decodeURIComponent` throws an error. @@ -774,11 +723,11 @@ } } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/filter-url-for-display.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/filter-url-for-display.js /** * Returns a URL for display. * - * @param {string} url Original URL. + * @param {string} url Original URL. * @param {number|null} maxLength URL length. * * @example @@ -789,7 +738,8 @@ * * @return {string} Displayed URL. */ -function filterURLForDisplay(url, maxLength = null) { +function filterURLForDisplay(url) { + let maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; // Remove protocol and www prefixes. let filteredURL = url.replace(/^(?:https?:)\/\/(?:www\.)?/, ''); // Ends with / and only has that single slash, strip it. @@ -819,10 +769,9 @@ return file.slice(0, maxLength - truncatedFile.length - 1) + '…' + truncatedFile; } -// EXTERNAL MODULE: external "lodash" -var external_lodash_ = __webpack_require__("YLtl"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/clean-for-slug.js +;// CONCATENATED MODULE: external "lodash" +var external_lodash_namespaceObject = window["lodash"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/clean-for-slug.js /** * External dependencies */ @@ -849,10 +798,66 @@ return ''; } - return Object(external_lodash_["trim"])(Object(external_lodash_["deburr"])(string).replace(/[\s\./]+/g, '-').replace(/[^\w-]+/g, '').toLowerCase(), '-'); + return (0,external_lodash_namespaceObject.trim)((0,external_lodash_namespaceObject.deburr)(string).replace(/[\s\./]+/g, '-').replace(/[^\p{L}\p{N}_-]+/gu, '').toLowerCase(), '-'); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/get-filename.js +/** + * Returns the filename part of the URL. + * + * @param {string} url The full URL. + * + * @example + * ```js + * const filename1 = getFilename( 'http://localhost:8080/this/is/a/test.jpg' ); // 'test.jpg' + * const filename2 = getFilename( '/this/is/a/test.png' ); // 'test.png' + * ``` + * + * @return {string|void} The filename part of the URL. + */ +function getFilename(url) { + let filename; + + try { + filename = new URL(url, 'http://example.com').pathname.split('/').pop(); + } catch (error) {} + + if (filename) { + return filename; + } } -// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/normalize-path.js +/** + * Given a path, returns a normalized path where equal query parameter values + * will be treated as identical, regardless of order they appear in the original + * text. + * + * @param {string} path Original path. + * + * @return {string} Normalized path. + */ +function normalizePath(path) { + const splitted = path.split('?'); + const query = splitted[1]; + const base = splitted[0]; + + if (!query) { + return base; + } // 'b=1%2C2&c=2&a=5' + + + return base + '?' + query // [ 'b=1%2C2', 'c=2', 'a=5' ] + .split('&') // [ [ 'b, '1%2C2' ], [ 'c', '2' ], [ 'a', '5' ] ] + .map(entry => entry.split('=')) // [ [ 'b', '1,2' ], [ 'c', '2' ], [ 'a', '5' ] ] + .map(pair => pair.map(decodeURIComponent)) // [ [ 'a', '5' ], [ 'b, '1,2' ], [ 'c', '2' ] ] + .sort((a, b) => a[0].localeCompare(b[0])) // [ [ 'a', '5' ], [ 'b, '1%2C2' ], [ 'c', '2' ] ] + .map(pair => pair.map(encodeURIComponent)) // [ 'a=5', 'b=1%2C2', 'c=2' ] + .map(pair => pair.join('=')) // 'a=5&b=1%2C2&c=2' + .join('&'); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/index.js @@ -879,6 +884,7 @@ -/***/ }) -/******/ }); \ No newline at end of file +(window.wp = window.wp || {}).url = __webpack_exports__; +/******/ })() +; \ No newline at end of file