@wordpress/url 4.32.0 → 4.32.1-next.b8c8708f3.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.
Files changed (117) hide show
  1. package/build/add-query-args.js +35 -40
  2. package/build/add-query-args.js.map +7 -1
  3. package/build/build-query-string.js +30 -43
  4. package/build/build-query-string.js.map +7 -1
  5. package/build/clean-for-slug.js +39 -43
  6. package/build/clean-for-slug.js.map +7 -1
  7. package/build/filter-url-for-display.js +39 -39
  8. package/build/filter-url-for-display.js.map +7 -1
  9. package/build/get-authority.js +29 -19
  10. package/build/get-authority.js.map +7 -1
  11. package/build/get-filename.js +29 -21
  12. package/build/get-filename.js.map +7 -1
  13. package/build/get-fragment.js +26 -18
  14. package/build/get-fragment.js.map +7 -1
  15. package/build/get-path-and-query-string.js +30 -26
  16. package/build/get-path-and-query-string.js.map +7 -1
  17. package/build/get-path.js +26 -18
  18. package/build/get-path.js.map +7 -1
  19. package/build/get-protocol.js +26 -18
  20. package/build/get-protocol.js.map +7 -1
  21. package/build/get-query-arg.js +28 -24
  22. package/build/get-query-arg.js.map +7 -1
  23. package/build/get-query-args.js +42 -65
  24. package/build/get-query-args.js.map +7 -1
  25. package/build/get-query-string.js +29 -20
  26. package/build/get-query-string.js.map +7 -1
  27. package/build/has-query-arg.js +28 -24
  28. package/build/has-query-arg.js.map +7 -1
  29. package/build/index.js +109 -201
  30. package/build/index.js.map +7 -1
  31. package/build/is-email.js +26 -18
  32. package/build/is-email.js.map +7 -1
  33. package/build/is-phone-number.js +27 -20
  34. package/build/is-phone-number.js.map +7 -1
  35. package/build/is-url.js +26 -23
  36. package/build/is-url.js.map +7 -1
  37. package/build/is-valid-authority.js +26 -18
  38. package/build/is-valid-authority.js.map +7 -1
  39. package/build/is-valid-fragment.js +26 -18
  40. package/build/is-valid-fragment.js.map +7 -1
  41. package/build/is-valid-path.js +26 -18
  42. package/build/is-valid-path.js.map +7 -1
  43. package/build/is-valid-protocol.js +26 -18
  44. package/build/is-valid-protocol.js.map +7 -1
  45. package/build/is-valid-query-string.js +26 -18
  46. package/build/is-valid-query-string.js.map +7 -1
  47. package/build/normalize-path.js +28 -32
  48. package/build/normalize-path.js.map +7 -1
  49. package/build/prepend-http.js +29 -25
  50. package/build/prepend-http.js.map +7 -1
  51. package/build/prepend-https.js +30 -29
  52. package/build/prepend-https.js.map +7 -1
  53. package/build/remove-query-args.js +35 -31
  54. package/build/remove-query-args.js.map +7 -1
  55. package/build/safe-decode-uri-component.js +26 -13
  56. package/build/safe-decode-uri-component.js.map +7 -1
  57. package/build/safe-decode-uri.js +26 -18
  58. package/build/safe-decode-uri.js.map +7 -1
  59. package/build-module/add-query-args.js +12 -35
  60. package/build-module/add-query-args.js.map +7 -1
  61. package/build-module/build-query-string.js +9 -40
  62. package/build-module/build-query-string.js.map +7 -1
  63. package/build-module/clean-for-slug.js +8 -39
  64. package/build-module/clean-for-slug.js.map +7 -1
  65. package/build-module/filter-url-for-display.js +18 -36
  66. package/build-module/filter-url-for-display.js.map +7 -1
  67. package/build-module/get-authority.js +8 -16
  68. package/build-module/get-authority.js.map +7 -1
  69. package/build-module/get-filename.js +8 -18
  70. package/build-module/get-filename.js.map +7 -1
  71. package/build-module/get-fragment.js +5 -15
  72. package/build-module/get-fragment.js.map +7 -1
  73. package/build-module/get-path-and-query-string.js +7 -21
  74. package/build-module/get-path-and-query-string.js.map +7 -1
  75. package/build-module/get-path.js +5 -15
  76. package/build-module/get-path.js.map +7 -1
  77. package/build-module/get-protocol.js +5 -15
  78. package/build-module/get-protocol.js.map +7 -1
  79. package/build-module/get-query-arg.js +6 -19
  80. package/build-module/get-query-arg.js.map +7 -1
  81. package/build-module/get-query-args.js +21 -61
  82. package/build-module/get-query-args.js.map +7 -1
  83. package/build-module/get-query-string.js +8 -17
  84. package/build-module/get-query-string.js.map +7 -1
  85. package/build-module/has-query-arg.js +7 -21
  86. package/build-module/has-query-arg.js.map +7 -1
  87. package/build-module/index.js +59 -29
  88. package/build-module/index.js.map +7 -1
  89. package/build-module/is-email.js +5 -15
  90. package/build-module/is-email.js.map +7 -1
  91. package/build-module/is-phone-number.js +6 -17
  92. package/build-module/is-phone-number.js.map +7 -1
  93. package/build-module/is-url.js +5 -20
  94. package/build-module/is-url.js.map +7 -1
  95. package/build-module/is-valid-authority.js +5 -15
  96. package/build-module/is-valid-authority.js.map +7 -1
  97. package/build-module/is-valid-fragment.js +5 -15
  98. package/build-module/is-valid-fragment.js.map +7 -1
  99. package/build-module/is-valid-path.js +5 -15
  100. package/build-module/is-valid-path.js.map +7 -1
  101. package/build-module/is-valid-protocol.js +5 -15
  102. package/build-module/is-valid-protocol.js.map +7 -1
  103. package/build-module/is-valid-query-string.js +5 -15
  104. package/build-module/is-valid-query-string.js.map +7 -1
  105. package/build-module/normalize-path.js +7 -29
  106. package/build-module/normalize-path.js.map +7 -1
  107. package/build-module/prepend-http.js +7 -20
  108. package/build-module/prepend-http.js.map +7 -1
  109. package/build-module/prepend-https.js +8 -25
  110. package/build-module/prepend-https.js.map +7 -1
  111. package/build-module/remove-query-args.js +12 -26
  112. package/build-module/remove-query-args.js.map +7 -1
  113. package/build-module/safe-decode-uri-component.js +5 -10
  114. package/build-module/safe-decode-uri-component.js.map +7 -1
  115. package/build-module/safe-decode-uri.js +5 -15
  116. package/build-module/safe-decode-uri.js.map +7 -1
  117. package/package.json +10 -3
@@ -1 +1,7 @@
1
- {"version":3,"names":["isValidFragment","fragment","test"],"sources":["@wordpress/url/src/is-valid-fragment.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAeA,CAAEC,QAAgB,EAAY;EAC5D,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA,OAAO,eAAe,CAACC,IAAI,CAAED,QAAS,CAAC;AACxC","ignoreList":[]}
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
+ }
@@ -1,26 +1,34 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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.isValidPath = isValidPath;
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
- //# sourceMappingURL=is-valid-path.js.map
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
- {"version":3,"names":["isValidPath","path","test"],"sources":["@wordpress/url/src/is-valid-path.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAEC,IAAY,EAAY;EACpD,IAAK,CAAEA,IAAI,EAAG;IACb,OAAO,KAAK;EACb;EACA,OAAO,YAAY,CAACC,IAAI,CAAED,IAAK,CAAC;AACjC","ignoreList":[]}
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.defineProperty(exports, "__esModule", {
4
- value: true
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.isValidProtocol = isValidProtocol;
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
- //# sourceMappingURL=is-valid-protocol.js.map
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
- {"version":3,"names":["isValidProtocol","protocol","test"],"sources":["@wordpress/url/src/is-valid-protocol.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAeA,CAAEC,QAAgB,EAAY;EAC5D,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA,OAAO,uBAAuB,CAACC,IAAI,CAAED,QAAS,CAAC;AAChD","ignoreList":[]}
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.defineProperty(exports, "__esModule", {
4
- value: true
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.isValidQueryString = isValidQueryString;
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
- //# sourceMappingURL=is-valid-query-string.js.map
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
- {"version":3,"names":["isValidQueryString","queryString","test"],"sources":["@wordpress/url/src/is-valid-query-string.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAkBA,CAAEC,WAAmB,EAAY;EAClE,IAAK,CAAEA,WAAW,EAAG;IACpB,OAAO,KAAK;EACb;EACA,OAAO,cAAc,CAACC,IAAI,CAAED,WAAY,CAAC;AAC1C","ignoreList":[]}
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
+ }
@@ -1,41 +1,37 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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.normalizePath = normalizePath;
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
- //# sourceMappingURL=normalize-path.js.map
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
- {"version":3,"names":["normalizePath","path","split","query","base","map","entry","pair","decodeURIComponent","sort","a","b","localeCompare","encodeURIComponent","join"],"sources":["@wordpress/url/src/normalize-path.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAAEC,IAAY,EAAW;EACrD,MAAMC,KAAK,GAAGD,IAAI,CAACC,KAAK,CAAE,GAAI,CAAC;EAC/B,MAAMC,KAAK,GAAGD,KAAK,CAAE,CAAC,CAAE;EACxB,MAAME,IAAI,GAAGF,KAAK,CAAE,CAAC,CAAE;EACvB,IAAK,CAAEC,KAAK,EAAG;IACd,OAAOC,IAAI;EACZ;;EAEA;EACA,OACCA,IAAI,GACJ,GAAG,GACHD;EACC;EAAA,CACCD,KAAK,CAAE,GAAI;EACZ;EAAA,CACCG,GAAG,CAAIC,KAAK,IAAMA,KAAK,CAACJ,KAAK,CAAE,GAAI,CAAE;EACtC;EAAA,CACCG,GAAG,CAAIE,IAAI,IAAMA,IAAI,CAACF,GAAG,CAAEG,kBAAmB,CAAE;EACjD;EAAA,CACCC,IAAI,CAAE,CAAEC,CAAC,EAAEC,CAAC,KAAMD,CAAC,CAAE,CAAC,CAAE,CAACE,aAAa,CAAED,CAAC,CAAE,CAAC,CAAG,CAAE;EAClD;EAAA,CACCN,GAAG,CAAIE,IAAI,IAAMA,IAAI,CAACF,GAAG,CAAEQ,kBAAmB,CAAE;EACjD;EAAA,CACCR,GAAG,CAAIE,IAAI,IAAMA,IAAI,CAACO,IAAI,CAAE,GAAI,CAAE;EACnC;EAAA,CACCA,IAAI,CAAE,GAAI,CAAC;AAEf","ignoreList":[]}
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
+ }
@@ -1,36 +1,40 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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.prependHTTP = prependHTTP;
7
- var _isEmail = require("./is-email");
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, _isEmail.isEmail)(url)) {
32
- return 'http://' + url;
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
- //# sourceMappingURL=prepend-http.js.map
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
- {"version":3,"names":["_isEmail","require","USABLE_HREF_REGEXP","prependHTTP","url","trim","test","isEmail"],"sources":["@wordpress/url/src/prepend-http.ts"],"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"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,kBAAkB,GAAG,0BAA0B;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAEC,GAAW,EAAW;EAClD,IAAK,CAAEA,GAAG,EAAG;IACZ,OAAOA,GAAG;EACX;EAEAA,GAAG,GAAGA,GAAG,CAACC,IAAI,CAAC,CAAC;EAChB,IAAK,CAAEH,kBAAkB,CAACI,IAAI,CAAEF,GAAI,CAAC,IAAI,CAAE,IAAAG,gBAAO,EAAEH,GAAI,CAAC,EAAG;IAC3D,OAAO,SAAS,GAAGA,GAAG;EACvB;EAEA,OAAOA,GAAG;AACX","ignoreList":[]}
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
+ }
@@ -1,38 +1,39 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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.prependHTTPS = prependHTTPS;
7
- var _prependHttp = require("./prepend-http");
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, _prependHttp.prependHTTP)(url);
36
- return url.replace(/^http:/, 'https:');
32
+ url = (0, import_prepend_http.prependHTTP)(url);
33
+ return url.replace(/^http:/, "https:");
37
34
  }
38
- //# sourceMappingURL=prepend-https.js.map
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
- {"version":3,"names":["_prependHttp","require","prependHTTPS","url","startsWith","prependHTTP","replace"],"sources":["@wordpress/url/src/prepend-https.ts"],"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"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAAEC,GAAW,EAAW;EACnD,IAAK,CAAEA,GAAG,EAAG;IACZ,OAAOA,GAAG;EACX;;EAEA;EACA,IAAKA,GAAG,CAACC,UAAU,CAAE,SAAU,CAAC,EAAG;IAClC,OAAOD,GAAG;EACX;EAEAA,GAAG,GAAG,IAAAE,wBAAW,EAAEF,GAAI,CAAC;EAExB,OAAOA,GAAG,CAACG,OAAO,CAAE,QAAQ,EAAE,QAAS,CAAC;AACzC","ignoreList":[]}
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.defineProperty(exports, "__esModule", {
4
- value: true
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.removeQueryArgs = removeQueryArgs;
7
- var _getQueryArgs = require("./get-query-args");
8
- var _buildQueryString = require("./build-query-string");
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, _getQueryArgs.getQueryArgs)(url);
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, _buildQueryString.buildQueryString)(query);
37
- const updatedUrl = queryString ? baseURL + '?' + 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
- //# sourceMappingURL=remove-query-args.js.map
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
- {"version":3,"names":["_getQueryArgs","require","_buildQueryString","removeQueryArgs","url","args","fragment","replace","queryStringIndex","indexOf","query","getQueryArgs","baseURL","substr","forEach","arg","queryString","buildQueryString","updatedUrl"],"sources":["@wordpress/url/src/remove-query-args.ts"],"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"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,eAAeA,CAAEC,GAAW,EAAE,GAAGC,IAAc,EAAW;EACzE,MAAMC,QAAQ,GAAGF,GAAG,CAACG,OAAO,CAAE,QAAQ,EAAE,EAAG,CAAC;EAC5CH,GAAG,GAAGA,GAAG,CAACG,OAAO,CAAE,KAAK,EAAE,EAAG,CAAC;EAE9B,MAAMC,gBAAgB,GAAGJ,GAAG,CAACK,OAAO,CAAE,GAAI,CAAC;EAC3C,IAAKD,gBAAgB,KAAK,CAAC,CAAC,EAAG;IAC9B,OAAOJ,GAAG,GAAGE,QAAQ;EACtB;EAEA,MAAMI,KAAK,GAAG,IAAAC,0BAAY,EAAEP,GAAI,CAAC;EACjC,MAAMQ,OAAO,GAAGR,GAAG,CAACS,MAAM,CAAE,CAAC,EAAEL,gBAAiB,CAAC;EACjDH,IAAI,CAACS,OAAO,CAAIC,GAAG,IAAM,OAAOL,KAAK,CAAEK,GAAG,CAAG,CAAC;EAC9C,MAAMC,WAAW,GAAG,IAAAC,kCAAgB,EAAEP,KAAM,CAAC;EAC7C,MAAMQ,UAAU,GAAGF,WAAW,GAAGJ,OAAO,GAAG,GAAG,GAAGI,WAAW,GAAGJ,OAAO;EACtE,OAAOM,UAAU,GAAGZ,QAAQ;AAC7B","ignoreList":[]}
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
+ }
@@ -1,17 +1,26 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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 safe_decode_uri_component_exports = {};
20
+ __export(safe_decode_uri_component_exports, {
21
+ safeDecodeURIComponent: () => safeDecodeURIComponent
5
22
  });
6
- exports.safeDecodeURIComponent = safeDecodeURIComponent;
7
- /**
8
- * Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if
9
- * `decodeURIComponent` throws an error.
10
- *
11
- * @param uriComponent URI component to decode.
12
- *
13
- * @return Decoded URI component if possible.
14
- */
23
+ module.exports = __toCommonJS(safe_decode_uri_component_exports);
15
24
  function safeDecodeURIComponent(uriComponent) {
16
25
  try {
17
26
  return decodeURIComponent(uriComponent);
@@ -19,4 +28,8 @@ function safeDecodeURIComponent(uriComponent) {
19
28
  return uriComponent;
20
29
  }
21
30
  }
22
- //# sourceMappingURL=safe-decode-uri-component.js.map
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ safeDecodeURIComponent
34
+ });
35
+ //# sourceMappingURL=safe-decode-uri-component.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["safeDecodeURIComponent","uriComponent","decodeURIComponent","uriComponentError"],"sources":["@wordpress/url/src/safe-decode-uri-component.ts"],"sourcesContent":["/**\n * Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if\n * `decodeURIComponent` throws an error.\n *\n * @param uriComponent URI component to decode.\n *\n * @return Decoded URI component if possible.\n */\nexport function safeDecodeURIComponent( uriComponent: string ): string {\n\ttry {\n\t\treturn decodeURIComponent( uriComponent );\n\t} catch ( uriComponentError ) {\n\t\treturn uriComponent;\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAsBA,CAAEC,YAAoB,EAAW;EACtE,IAAI;IACH,OAAOC,kBAAkB,CAAED,YAAa,CAAC;EAC1C,CAAC,CAAC,OAAQE,iBAAiB,EAAG;IAC7B,OAAOF,YAAY;EACpB;AACD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/safe-decode-uri-component.ts"],
4
+ "sourcesContent": ["/**\n * Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if\n * `decodeURIComponent` throws an error.\n *\n * @param uriComponent URI component to decode.\n *\n * @return Decoded URI component if possible.\n */\nexport function safeDecodeURIComponent( uriComponent: string ): string {\n\ttry {\n\t\treturn decodeURIComponent( uriComponent );\n\t} catch ( uriComponentError ) {\n\t\treturn uriComponent;\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,SAAS,uBAAwB,cAA+B;AACtE,MAAI;AACH,WAAO,mBAAoB,YAAa;AAAA,EACzC,SAAU,mBAAoB;AAC7B,WAAO;AAAA,EACR;AACD;",
6
+ "names": []
7
+ }