rebase on oct-10-2023
This commit is contained in:
51
wp/wp-includes/js/dist/url.js
vendored
51
wp/wp-includes/js/dist/url.js
vendored
@@ -534,6 +534,7 @@ __webpack_require__.d(__webpack_exports__, {
|
||||
"isValidQueryString": function() { return /* reexport */ isValidQueryString; },
|
||||
"normalizePath": function() { return /* reexport */ normalizePath; },
|
||||
"prependHTTP": function() { return /* reexport */ prependHTTP; },
|
||||
"prependHTTPS": function() { return /* reexport */ prependHTTPS; },
|
||||
"removeQueryArgs": function() { return /* reexport */ removeQueryArgs; },
|
||||
"safeDecodeURI": function() { return /* reexport */ safeDecodeURI; },
|
||||
"safeDecodeURIComponent": function() { return /* reexport */ safeDecodeURIComponent; }
|
||||
@@ -1025,10 +1026,7 @@ function getQueryArgs(url) {
|
||||
* @return {string} URL with arguments applied.
|
||||
*/
|
||||
|
||||
function addQueryArgs() {
|
||||
let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
||||
let args = arguments.length > 1 ? arguments[1] : undefined;
|
||||
|
||||
function addQueryArgs(url = '', args) {
|
||||
// If no arguments are to be appended, return original URL.
|
||||
if (!args || !Object.keys(args).length) {
|
||||
return url;
|
||||
@@ -1122,7 +1120,7 @@ function hasQueryArg(url, arg) {
|
||||
* @return {string} Updated URL.
|
||||
*/
|
||||
|
||||
function removeQueryArgs(url) {
|
||||
function removeQueryArgs(url, ...args) {
|
||||
const queryStringIndex = url.indexOf('?');
|
||||
|
||||
if (queryStringIndex === -1) {
|
||||
@@ -1131,11 +1129,6 @@ function removeQueryArgs(url) {
|
||||
|
||||
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;
|
||||
@@ -1211,8 +1204,7 @@ function safeDecodeURI(uri) {
|
||||
*
|
||||
* @return {string} Displayed URL.
|
||||
*/
|
||||
function filterURLForDisplay(url) {
|
||||
let maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||||
function filterURLForDisplay(url, maxLength = null) {
|
||||
// Remove protocol and www prefixes.
|
||||
let filteredURL = url.replace(/^(?:https?:)\/\/(?:www\.)?/, ''); // Ends with / and only has that single slash, strip it.
|
||||
|
||||
@@ -1336,6 +1328,40 @@ function normalizePath(path) {
|
||||
.join('&');
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/prepend-https.js
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepends "https://" to a url, if it looks like something that is meant to be a TLD.
|
||||
*
|
||||
* Note: this will not replace "http://" with "https://".
|
||||
*
|
||||
* @param {string} url The URL to test.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const actualURL = prependHTTPS( 'wordpress.org' ); // https://wordpress.org
|
||||
* ```
|
||||
*
|
||||
* @return {string} The updated URL.
|
||||
*/
|
||||
|
||||
function prependHTTPS(url) {
|
||||
if (!url) {
|
||||
return url;
|
||||
} // If url starts with http://, return it as is.
|
||||
|
||||
|
||||
if (url.startsWith('http://')) {
|
||||
return url;
|
||||
}
|
||||
|
||||
url = prependHTTP(url);
|
||||
return url.replace(/^http:/, 'https:');
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/url/build-module/index.js
|
||||
|
||||
|
||||
@@ -1362,6 +1388,7 @@ function normalizePath(path) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}();
|
||||
|
||||
Reference in New Issue
Block a user