@wordpress/url 4.31.1-next.f56bd8138.0 → 4.32.1-next.47f435fc9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/add-query-args.js +35 -40
- package/build/add-query-args.js.map +7 -1
- package/build/build-query-string.js +30 -43
- package/build/build-query-string.js.map +7 -1
- package/build/clean-for-slug.js +39 -43
- package/build/clean-for-slug.js.map +7 -1
- package/build/filter-url-for-display.js +39 -39
- package/build/filter-url-for-display.js.map +7 -1
- package/build/get-authority.js +29 -19
- package/build/get-authority.js.map +7 -1
- package/build/get-filename.js +29 -21
- package/build/get-filename.js.map +7 -1
- package/build/get-fragment.js +26 -18
- package/build/get-fragment.js.map +7 -1
- package/build/get-path-and-query-string.js +30 -26
- package/build/get-path-and-query-string.js.map +7 -1
- package/build/get-path.js +26 -18
- package/build/get-path.js.map +7 -1
- package/build/get-protocol.js +26 -18
- package/build/get-protocol.js.map +7 -1
- package/build/get-query-arg.js +28 -24
- package/build/get-query-arg.js.map +7 -1
- package/build/get-query-args.js +42 -65
- package/build/get-query-args.js.map +7 -1
- package/build/get-query-string.js +29 -20
- package/build/get-query-string.js.map +7 -1
- package/build/has-query-arg.js +28 -24
- package/build/has-query-arg.js.map +7 -1
- package/build/index.js +109 -201
- package/build/index.js.map +7 -1
- package/build/is-email.js +26 -18
- package/build/is-email.js.map +7 -1
- package/build/is-phone-number.js +27 -20
- package/build/is-phone-number.js.map +7 -1
- package/build/is-url.js +26 -23
- package/build/is-url.js.map +7 -1
- package/build/is-valid-authority.js +26 -18
- package/build/is-valid-authority.js.map +7 -1
- package/build/is-valid-fragment.js +26 -18
- package/build/is-valid-fragment.js.map +7 -1
- package/build/is-valid-path.js +26 -18
- package/build/is-valid-path.js.map +7 -1
- package/build/is-valid-protocol.js +26 -18
- package/build/is-valid-protocol.js.map +7 -1
- package/build/is-valid-query-string.js +26 -18
- package/build/is-valid-query-string.js.map +7 -1
- package/build/normalize-path.js +28 -32
- package/build/normalize-path.js.map +7 -1
- package/build/prepend-http.js +29 -25
- package/build/prepend-http.js.map +7 -1
- package/build/prepend-https.js +30 -29
- package/build/prepend-https.js.map +7 -1
- package/build/remove-query-args.js +35 -31
- package/build/remove-query-args.js.map +7 -1
- package/build/safe-decode-uri-component.js +26 -13
- package/build/safe-decode-uri-component.js.map +7 -1
- package/build/safe-decode-uri.js +26 -18
- package/build/safe-decode-uri.js.map +7 -1
- package/build-module/add-query-args.js +12 -35
- package/build-module/add-query-args.js.map +7 -1
- package/build-module/build-query-string.js +9 -40
- package/build-module/build-query-string.js.map +7 -1
- package/build-module/clean-for-slug.js +8 -39
- package/build-module/clean-for-slug.js.map +7 -1
- package/build-module/filter-url-for-display.js +18 -36
- package/build-module/filter-url-for-display.js.map +7 -1
- package/build-module/get-authority.js +8 -16
- package/build-module/get-authority.js.map +7 -1
- package/build-module/get-filename.js +8 -18
- package/build-module/get-filename.js.map +7 -1
- package/build-module/get-fragment.js +5 -15
- package/build-module/get-fragment.js.map +7 -1
- package/build-module/get-path-and-query-string.js +7 -21
- package/build-module/get-path-and-query-string.js.map +7 -1
- package/build-module/get-path.js +5 -15
- package/build-module/get-path.js.map +7 -1
- package/build-module/get-protocol.js +5 -15
- package/build-module/get-protocol.js.map +7 -1
- package/build-module/get-query-arg.js +6 -19
- package/build-module/get-query-arg.js.map +7 -1
- package/build-module/get-query-args.js +21 -61
- package/build-module/get-query-args.js.map +7 -1
- package/build-module/get-query-string.js +8 -17
- package/build-module/get-query-string.js.map +7 -1
- package/build-module/has-query-arg.js +7 -21
- package/build-module/has-query-arg.js.map +7 -1
- package/build-module/index.js +59 -29
- package/build-module/index.js.map +7 -1
- package/build-module/is-email.js +5 -15
- package/build-module/is-email.js.map +7 -1
- package/build-module/is-phone-number.js +6 -17
- package/build-module/is-phone-number.js.map +7 -1
- package/build-module/is-url.js +5 -20
- package/build-module/is-url.js.map +7 -1
- package/build-module/is-valid-authority.js +5 -15
- package/build-module/is-valid-authority.js.map +7 -1
- package/build-module/is-valid-fragment.js +5 -15
- package/build-module/is-valid-fragment.js.map +7 -1
- package/build-module/is-valid-path.js +5 -15
- package/build-module/is-valid-path.js.map +7 -1
- package/build-module/is-valid-protocol.js +5 -15
- package/build-module/is-valid-protocol.js.map +7 -1
- package/build-module/is-valid-query-string.js +5 -15
- package/build-module/is-valid-query-string.js.map +7 -1
- package/build-module/normalize-path.js +7 -29
- package/build-module/normalize-path.js.map +7 -1
- package/build-module/prepend-http.js +7 -20
- package/build-module/prepend-http.js.map +7 -1
- package/build-module/prepend-https.js +8 -25
- package/build-module/prepend-https.js.map +7 -1
- package/build-module/remove-query-args.js +12 -26
- package/build-module/remove-query-args.js.map +7 -1
- package/build-module/safe-decode-uri-component.js +5 -10
- package/build-module/safe-decode-uri-component.js.map +7 -1
- package/build-module/safe-decode-uri.js +5 -15
- package/build-module/safe-decode-uri.js.map +7 -1
- package/package.json +10 -3
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var is_valid_fragment_exports = {};
|
|
20
|
+
__export(is_valid_fragment_exports, {
|
|
21
|
+
isValidFragment: () => isValidFragment
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* Checks for invalid characters within the provided fragment.
|
|
9
|
-
*
|
|
10
|
-
* @param fragment The url fragment.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```js
|
|
14
|
-
* const isValid = isValidFragment( '#valid-fragment' ); // true
|
|
15
|
-
* const isNotValid = isValidFragment( '#invalid-#fragment' ); // false
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @return True if the argument contains a valid fragment.
|
|
19
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(is_valid_fragment_exports);
|
|
20
24
|
function isValidFragment(fragment) {
|
|
21
25
|
if (!fragment) {
|
|
22
26
|
return false;
|
|
23
27
|
}
|
|
24
28
|
return /^#[^\s#?\/]*$/.test(fragment);
|
|
25
29
|
}
|
|
26
|
-
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
isValidFragment
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=is-valid-fragment.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/is-valid-fragment.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Checks for invalid characters within the provided fragment.\n *\n * @param fragment The url fragment.\n *\n * @example\n * ```js\n * const isValid = isValidFragment( '#valid-fragment' ); // true\n * const isNotValid = isValidFragment( '#invalid-#fragment' ); // false\n * ```\n *\n * @return True if the argument contains a valid fragment.\n */\nexport function isValidFragment( fragment: string ): boolean {\n\tif ( ! fragment ) {\n\t\treturn false;\n\t}\n\treturn /^#[^\\s#?\\/]*$/.test( fragment );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,gBAAiB,UAA4B;AAC5D,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AACA,SAAO,gBAAgB,KAAM,QAAS;AACvC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/is-valid-path.js
CHANGED
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var is_valid_path_exports = {};
|
|
20
|
+
__export(is_valid_path_exports, {
|
|
21
|
+
isValidPath: () => isValidPath
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* Checks for invalid characters within the provided path.
|
|
9
|
-
*
|
|
10
|
-
* @param path The URL path.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```js
|
|
14
|
-
* const isValid = isValidPath( 'test/path/' ); // true
|
|
15
|
-
* const isNotValid = isValidPath( '/invalid?test/path/' ); // false
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @return True if the argument contains a valid path
|
|
19
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(is_valid_path_exports);
|
|
20
24
|
function isValidPath(path) {
|
|
21
25
|
if (!path) {
|
|
22
26
|
return false;
|
|
23
27
|
}
|
|
24
28
|
return /^[^\s#?]+$/.test(path);
|
|
25
29
|
}
|
|
26
|
-
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
isValidPath
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=is-valid-path.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/is-valid-path.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Checks for invalid characters within the provided path.\n *\n * @param path The URL path.\n *\n * @example\n * ```js\n * const isValid = isValidPath( 'test/path/' ); // true\n * const isNotValid = isValidPath( '/invalid?test/path/' ); // false\n * ```\n *\n * @return True if the argument contains a valid path\n */\nexport function isValidPath( path: string ): boolean {\n\tif ( ! path ) {\n\t\treturn false;\n\t}\n\treturn /^[^\\s#?]+$/.test( path );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,YAAa,MAAwB;AACpD,MAAK,CAAE,MAAO;AACb,WAAO;AAAA,EACR;AACA,SAAO,aAAa,KAAM,IAAK;AAChC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var is_valid_protocol_exports = {};
|
|
20
|
+
__export(is_valid_protocol_exports, {
|
|
21
|
+
isValidProtocol: () => isValidProtocol
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* Tests if a url protocol is valid.
|
|
9
|
-
*
|
|
10
|
-
* @param protocol The url protocol.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```js
|
|
14
|
-
* const isValid = isValidProtocol( 'https:' ); // true
|
|
15
|
-
* const isNotValid = isValidProtocol( 'https :' ); // false
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @return True if the argument is a valid protocol (e.g. http:, tel:).
|
|
19
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(is_valid_protocol_exports);
|
|
20
24
|
function isValidProtocol(protocol) {
|
|
21
25
|
if (!protocol) {
|
|
22
26
|
return false;
|
|
23
27
|
}
|
|
24
28
|
return /^[a-z\-.\+]+[0-9]*:$/i.test(protocol);
|
|
25
29
|
}
|
|
26
|
-
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
isValidProtocol
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=is-valid-protocol.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/is-valid-protocol.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Tests if a url protocol is valid.\n *\n * @param protocol The url protocol.\n *\n * @example\n * ```js\n * const isValid = isValidProtocol( 'https:' ); // true\n * const isNotValid = isValidProtocol( 'https :' ); // false\n * ```\n *\n * @return True if the argument is a valid protocol (e.g. http:, tel:).\n */\nexport function isValidProtocol( protocol: string ): boolean {\n\tif ( ! protocol ) {\n\t\treturn false;\n\t}\n\treturn /^[a-z\\-.\\+]+[0-9]*:$/i.test( protocol );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,gBAAiB,UAA4B;AAC5D,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AACA,SAAO,wBAAwB,KAAM,QAAS;AAC/C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var is_valid_query_string_exports = {};
|
|
20
|
+
__export(is_valid_query_string_exports, {
|
|
21
|
+
isValidQueryString: () => isValidQueryString
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* Checks for invalid characters within the provided query string.
|
|
9
|
-
*
|
|
10
|
-
* @param queryString The query string.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```js
|
|
14
|
-
* const isValid = isValidQueryString( 'query=true&another=false' ); // true
|
|
15
|
-
* const isNotValid = isValidQueryString( 'query=true?another=false' ); // false
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @return True if the argument contains a valid query string.
|
|
19
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(is_valid_query_string_exports);
|
|
20
24
|
function isValidQueryString(queryString) {
|
|
21
25
|
if (!queryString) {
|
|
22
26
|
return false;
|
|
23
27
|
}
|
|
24
28
|
return /^[^\s#?\/]+$/.test(queryString);
|
|
25
29
|
}
|
|
26
|
-
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
isValidQueryString
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=is-valid-query-string.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/is-valid-query-string.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Checks for invalid characters within the provided query string.\n *\n * @param queryString The query string.\n *\n * @example\n * ```js\n * const isValid = isValidQueryString( 'query=true&another=false' ); // true\n * const isNotValid = isValidQueryString( 'query=true?another=false' ); // false\n * ```\n *\n * @return True if the argument contains a valid query string.\n */\nexport function isValidQueryString( queryString: string ): boolean {\n\tif ( ! queryString ) {\n\t\treturn false;\n\t}\n\treturn /^[^\\s#?\\/]+$/.test( queryString );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,mBAAoB,aAA+B;AAClE,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AACA,SAAO,eAAe,KAAM,WAAY;AACzC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/normalize-path.js
CHANGED
|
@@ -1,41 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var normalize_path_exports = {};
|
|
20
|
+
__export(normalize_path_exports, {
|
|
21
|
+
normalizePath: () => normalizePath
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* Given a path, returns a normalized path where equal query parameter values
|
|
9
|
-
* will be treated as identical, regardless of order they appear in the original
|
|
10
|
-
* text.
|
|
11
|
-
*
|
|
12
|
-
* @param path Original path.
|
|
13
|
-
*
|
|
14
|
-
* @return Normalized path.
|
|
15
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(normalize_path_exports);
|
|
16
24
|
function normalizePath(path) {
|
|
17
|
-
const split = path.split(
|
|
25
|
+
const split = path.split("?");
|
|
18
26
|
const query = split[1];
|
|
19
27
|
const base = split[0];
|
|
20
28
|
if (!query) {
|
|
21
29
|
return base;
|
|
22
30
|
}
|
|
23
|
-
|
|
24
|
-
// 'b=1%2C2&c=2&a=5'
|
|
25
|
-
return base + '?' + query
|
|
26
|
-
// [ 'b=1%2C2', 'c=2', 'a=5' ]
|
|
27
|
-
.split('&')
|
|
28
|
-
// [ [ 'b, '1%2C2' ], [ 'c', '2' ], [ 'a', '5' ] ]
|
|
29
|
-
.map(entry => entry.split('='))
|
|
30
|
-
// [ [ 'b', '1,2' ], [ 'c', '2' ], [ 'a', '5' ] ]
|
|
31
|
-
.map(pair => pair.map(decodeURIComponent))
|
|
32
|
-
// [ [ 'a', '5' ], [ 'b, '1,2' ], [ 'c', '2' ] ]
|
|
33
|
-
.sort((a, b) => a[0].localeCompare(b[0]))
|
|
34
|
-
// [ [ 'a', '5' ], [ 'b, '1%2C2' ], [ 'c', '2' ] ]
|
|
35
|
-
.map(pair => pair.map(encodeURIComponent))
|
|
36
|
-
// [ 'a=5', 'b=1%2C2', 'c=2' ]
|
|
37
|
-
.map(pair => pair.join('='))
|
|
38
|
-
// 'a=5&b=1%2C2&c=2'
|
|
39
|
-
.join('&');
|
|
31
|
+
return base + "?" + query.split("&").map((entry) => entry.split("=")).map((pair) => pair.map(decodeURIComponent)).sort((a, b) => a[0].localeCompare(b[0])).map((pair) => pair.map(encodeURIComponent)).map((pair) => pair.join("=")).join("&");
|
|
40
32
|
}
|
|
41
|
-
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
normalizePath
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=normalize-path.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/normalize-path.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Given a path, returns a normalized path where equal query parameter values\n * will be treated as identical, regardless of order they appear in the original\n * text.\n *\n * @param path Original path.\n *\n * @return Normalized path.\n */\nexport function normalizePath( path: string ): string {\n\tconst split = path.split( '?' );\n\tconst query = split[ 1 ];\n\tconst base = split[ 0 ];\n\tif ( ! query ) {\n\t\treturn base;\n\t}\n\n\t// 'b=1%2C2&c=2&a=5'\n\treturn (\n\t\tbase +\n\t\t'?' +\n\t\tquery\n\t\t\t// [ 'b=1%2C2', 'c=2', 'a=5' ]\n\t\t\t.split( '&' )\n\t\t\t// [ [ 'b, '1%2C2' ], [ 'c', '2' ], [ 'a', '5' ] ]\n\t\t\t.map( ( entry ) => entry.split( '=' ) )\n\t\t\t// [ [ 'b', '1,2' ], [ 'c', '2' ], [ 'a', '5' ] ]\n\t\t\t.map( ( pair ) => pair.map( decodeURIComponent ) )\n\t\t\t// [ [ 'a', '5' ], [ 'b, '1,2' ], [ 'c', '2' ] ]\n\t\t\t.sort( ( a, b ) => a[ 0 ].localeCompare( b[ 0 ] ) )\n\t\t\t// [ [ 'a', '5' ], [ 'b, '1%2C2' ], [ 'c', '2' ] ]\n\t\t\t.map( ( pair ) => pair.map( encodeURIComponent ) )\n\t\t\t// [ 'a=5', 'b=1%2C2', 'c=2' ]\n\t\t\t.map( ( pair ) => pair.join( '=' ) )\n\t\t\t// 'a=5&b=1%2C2&c=2'\n\t\t\t.join( '&' )\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,SAAS,cAAe,MAAuB;AACrD,QAAM,QAAQ,KAAK,MAAO,GAAI;AAC9B,QAAM,QAAQ,MAAO,CAAE;AACvB,QAAM,OAAO,MAAO,CAAE;AACtB,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AAGA,SACC,OACA,MACA,MAEE,MAAO,GAAI,EAEX,IAAK,CAAE,UAAW,MAAM,MAAO,GAAI,CAAE,EAErC,IAAK,CAAE,SAAU,KAAK,IAAK,kBAAmB,CAAE,EAEhD,KAAM,CAAE,GAAG,MAAO,EAAG,CAAE,EAAE,cAAe,EAAG,CAAE,CAAE,CAAE,EAEjD,IAAK,CAAE,SAAU,KAAK,IAAK,kBAAmB,CAAE,EAEhD,IAAK,CAAE,SAAU,KAAK,KAAM,GAAI,CAAE,EAElC,KAAM,GAAI;AAEd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/prepend-http.js
CHANGED
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var prepend_http_exports = {};
|
|
20
|
+
__export(prepend_http_exports, {
|
|
21
|
+
prependHTTP: () => prependHTTP
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
23
|
+
module.exports = __toCommonJS(prepend_http_exports);
|
|
24
|
+
var import_is_email = require("./is-email");
|
|
12
25
|
const USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\?|\.|\/)/i;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Prepends "http://" to a url, if it looks like something that is meant to be a TLD.
|
|
16
|
-
*
|
|
17
|
-
* @param url The URL to test.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```js
|
|
21
|
-
* const actualURL = prependHTTP( 'wordpress.org' ); // http://wordpress.org
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @return The updated URL.
|
|
25
|
-
*/
|
|
26
26
|
function prependHTTP(url) {
|
|
27
27
|
if (!url) {
|
|
28
28
|
return url;
|
|
29
29
|
}
|
|
30
30
|
url = url.trim();
|
|
31
|
-
if (!USABLE_HREF_REGEXP.test(url) && !(0,
|
|
32
|
-
return
|
|
31
|
+
if (!USABLE_HREF_REGEXP.test(url) && !(0, import_is_email.isEmail)(url)) {
|
|
32
|
+
return "http://" + url;
|
|
33
33
|
}
|
|
34
34
|
return url;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
prependHTTP
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=prepend-http.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/prepend-http.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { isEmail } from './is-email';\n\nconst USABLE_HREF_REGEXP = /^(?:[a-z]+:|#|\\?|\\.|\\/)/i;\n\n/**\n * Prepends \"http://\" to a url, if it looks like something that is meant to be a TLD.\n *\n * @param url The URL to test.\n *\n * @example\n * ```js\n * const actualURL = prependHTTP( 'wordpress.org' ); // http://wordpress.org\n * ```\n *\n * @return The updated URL.\n */\nexport function prependHTTP( url: string ): string {\n\tif ( ! url ) {\n\t\treturn url;\n\t}\n\n\turl = url.trim();\n\tif ( ! USABLE_HREF_REGEXP.test( url ) && ! isEmail( url ) ) {\n\t\treturn 'http://' + url;\n\t}\n\n\treturn url;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAwB;AAExB,MAAM,qBAAqB;AAcpB,SAAS,YAAa,KAAsB;AAClD,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAEA,QAAM,IAAI,KAAK;AACf,MAAK,CAAE,mBAAmB,KAAM,GAAI,KAAK,KAAE,yBAAS,GAAI,GAAI;AAC3D,WAAO,YAAY;AAAA,EACpB;AAEA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/prepend-https.js
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var prepend_https_exports = {};
|
|
20
|
+
__export(prepend_https_exports, {
|
|
21
|
+
prependHTTPS: () => prependHTTPS
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Prepends "https://" to a url, if it looks like something that is meant to be a TLD.
|
|
14
|
-
*
|
|
15
|
-
* Note: this will not replace "http://" with "https://".
|
|
16
|
-
*
|
|
17
|
-
* @param url The URL to test.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```js
|
|
21
|
-
* const actualURL = prependHTTPS( 'wordpress.org' ); // https://wordpress.org
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @return The updated URL.
|
|
25
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(prepend_https_exports);
|
|
24
|
+
var import_prepend_http = require("./prepend-http");
|
|
26
25
|
function prependHTTPS(url) {
|
|
27
26
|
if (!url) {
|
|
28
27
|
return url;
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
// If url starts with http://, return it as is.
|
|
32
|
-
if (url.startsWith('http://')) {
|
|
29
|
+
if (url.startsWith("http://")) {
|
|
33
30
|
return url;
|
|
34
31
|
}
|
|
35
|
-
url = (0,
|
|
36
|
-
return url.replace(/^http:/,
|
|
32
|
+
url = (0, import_prepend_http.prependHTTP)(url);
|
|
33
|
+
return url.replace(/^http:/, "https:");
|
|
37
34
|
}
|
|
38
|
-
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
prependHTTPS
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=prepend-https.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/prepend-https.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { prependHTTP } from './prepend-http';\n\n/**\n * Prepends \"https://\" to a url, if it looks like something that is meant to be a TLD.\n *\n * Note: this will not replace \"http://\" with \"https://\".\n *\n * @param url The URL to test.\n *\n * @example\n * ```js\n * const actualURL = prependHTTPS( 'wordpress.org' ); // https://wordpress.org\n * ```\n *\n * @return The updated URL.\n */\nexport function prependHTTPS( url: string ): string {\n\tif ( ! url ) {\n\t\treturn url;\n\t}\n\n\t// If url starts with http://, return it as is.\n\tif ( url.startsWith( 'http://' ) ) {\n\t\treturn url;\n\t}\n\n\turl = prependHTTP( url );\n\n\treturn url.replace( /^http:/, 'https:' );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA4B;AAgBrB,SAAS,aAAc,KAAsB;AACnD,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAGA,MAAK,IAAI,WAAY,SAAU,GAAI;AAClC,WAAO;AAAA,EACR;AAEA,YAAM,iCAAa,GAAI;AAEvB,SAAO,IAAI,QAAS,UAAU,QAAS;AACxC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,40 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var remove_query_args_exports = {};
|
|
20
|
+
__export(remove_query_args_exports, {
|
|
21
|
+
removeQueryArgs: () => removeQueryArgs
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Removes arguments from the query string of the url
|
|
15
|
-
*
|
|
16
|
-
* @param url URL.
|
|
17
|
-
* @param args Query Args.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```js
|
|
21
|
-
* const newUrl = removeQueryArgs( 'https://wordpress.org?foo=bar&bar=baz&baz=foobar', 'foo', 'bar' ); // https://wordpress.org?baz=foobar
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @return Updated URL.
|
|
25
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(remove_query_args_exports);
|
|
24
|
+
var import_get_query_args = require("./get-query-args");
|
|
25
|
+
var import_build_query_string = require("./build-query-string");
|
|
26
26
|
function removeQueryArgs(url, ...args) {
|
|
27
|
-
const fragment = url.replace(/^[^#]*/,
|
|
28
|
-
url = url.replace(/#.*/,
|
|
29
|
-
const queryStringIndex = url.indexOf(
|
|
27
|
+
const fragment = url.replace(/^[^#]*/, "");
|
|
28
|
+
url = url.replace(/#.*/, "");
|
|
29
|
+
const queryStringIndex = url.indexOf("?");
|
|
30
30
|
if (queryStringIndex === -1) {
|
|
31
31
|
return url + fragment;
|
|
32
32
|
}
|
|
33
|
-
const query = (0,
|
|
33
|
+
const query = (0, import_get_query_args.getQueryArgs)(url);
|
|
34
34
|
const baseURL = url.substr(0, queryStringIndex);
|
|
35
|
-
args.forEach(arg => delete query[arg]);
|
|
36
|
-
const queryString = (0,
|
|
37
|
-
const updatedUrl = queryString ? baseURL +
|
|
35
|
+
args.forEach((arg) => delete query[arg]);
|
|
36
|
+
const queryString = (0, import_build_query_string.buildQueryString)(query);
|
|
37
|
+
const updatedUrl = queryString ? baseURL + "?" + queryString : baseURL;
|
|
38
38
|
return updatedUrl + fragment;
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
removeQueryArgs
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=remove-query-args.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/remove-query-args.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { getQueryArgs } from './get-query-args';\nimport { buildQueryString } from './build-query-string';\n\n/**\n * Removes arguments from the query string of the url\n *\n * @param url URL.\n * @param args Query Args.\n *\n * @example\n * ```js\n * const newUrl = removeQueryArgs( 'https://wordpress.org?foo=bar&bar=baz&baz=foobar', 'foo', 'bar' ); // https://wordpress.org?baz=foobar\n * ```\n *\n * @return Updated URL.\n */\nexport function removeQueryArgs( url: string, ...args: string[] ): string {\n\tconst fragment = url.replace( /^[^#]*/, '' );\n\turl = url.replace( /#.*/, '' );\n\n\tconst queryStringIndex = url.indexOf( '?' );\n\tif ( queryStringIndex === -1 ) {\n\t\treturn url + fragment;\n\t}\n\n\tconst query = getQueryArgs( url );\n\tconst baseURL = url.substr( 0, queryStringIndex );\n\targs.forEach( ( arg ) => delete query[ arg ] );\n\tconst queryString = buildQueryString( query );\n\tconst updatedUrl = queryString ? baseURL + '?' + queryString : baseURL;\n\treturn updatedUrl + fragment;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,4BAA6B;AAC7B,gCAAiC;AAe1B,SAAS,gBAAiB,QAAgB,MAAyB;AACzE,QAAM,WAAW,IAAI,QAAS,UAAU,EAAG;AAC3C,QAAM,IAAI,QAAS,OAAO,EAAG;AAE7B,QAAM,mBAAmB,IAAI,QAAS,GAAI;AAC1C,MAAK,qBAAqB,IAAK;AAC9B,WAAO,MAAM;AAAA,EACd;AAEA,QAAM,YAAQ,oCAAc,GAAI;AAChC,QAAM,UAAU,IAAI,OAAQ,GAAG,gBAAiB;AAChD,OAAK,QAAS,CAAE,QAAS,OAAO,MAAO,GAAI,CAAE;AAC7C,QAAM,kBAAc,4CAAkB,KAAM;AAC5C,QAAM,aAAa,cAAc,UAAU,MAAM,cAAc;AAC/D,SAAO,aAAa;AACrB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|