@wordpress/url 4.26.1-next.719a03cbe.0 → 4.27.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 (207) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +12 -12
  3. package/build/add-query-args.js +4 -4
  4. package/build/add-query-args.js.map +1 -1
  5. package/build/build-query-string.js +3 -3
  6. package/build/build-query-string.js.map +1 -1
  7. package/build/clean-for-slug.js +2 -2
  8. package/build/clean-for-slug.js.map +1 -1
  9. package/build/filter-url-for-display.js +3 -3
  10. package/build/filter-url-for-display.js.map +1 -1
  11. package/build/get-authority.js +2 -2
  12. package/build/get-authority.js.map +1 -1
  13. package/build/get-filename.js +2 -2
  14. package/build/get-filename.js.map +1 -1
  15. package/build/get-fragment.js +2 -2
  16. package/build/get-fragment.js.map +1 -1
  17. package/build/get-path-and-query-string.js +2 -2
  18. package/build/get-path-and-query-string.js.map +1 -1
  19. package/build/get-path.js +2 -2
  20. package/build/get-path.js.map +1 -1
  21. package/build/get-protocol.js +2 -2
  22. package/build/get-protocol.js.map +1 -1
  23. package/build/get-query-arg.js +3 -11
  24. package/build/get-query-arg.js.map +1 -1
  25. package/build/get-query-args.js +5 -11
  26. package/build/get-query-args.js.map +1 -1
  27. package/build/get-query-string.js +2 -2
  28. package/build/get-query-string.js.map +1 -1
  29. package/build/has-query-arg.js +3 -3
  30. package/build/has-query-arg.js.map +1 -1
  31. package/build/index.js.map +1 -1
  32. package/build/is-email.js +2 -2
  33. package/build/is-email.js.map +1 -1
  34. package/build/is-phone-number.js +2 -2
  35. package/build/is-phone-number.js.map +1 -1
  36. package/build/is-url.js +2 -2
  37. package/build/is-url.js.map +1 -1
  38. package/build/is-valid-authority.js +2 -2
  39. package/build/is-valid-authority.js.map +1 -1
  40. package/build/is-valid-fragment.js +2 -2
  41. package/build/is-valid-fragment.js.map +1 -1
  42. package/build/is-valid-path.js +2 -2
  43. package/build/is-valid-path.js.map +1 -1
  44. package/build/is-valid-protocol.js +2 -2
  45. package/build/is-valid-protocol.js.map +1 -1
  46. package/build/is-valid-query-string.js +2 -2
  47. package/build/is-valid-query-string.js.map +1 -1
  48. package/build/normalize-path.js +2 -2
  49. package/build/normalize-path.js.map +1 -1
  50. package/build/prepend-http.js +2 -2
  51. package/build/prepend-http.js.map +1 -1
  52. package/build/prepend-https.js +2 -2
  53. package/build/prepend-https.js.map +1 -1
  54. package/build/remove-query-args.js +3 -3
  55. package/build/remove-query-args.js.map +1 -1
  56. package/build/safe-decode-uri-component.js +2 -2
  57. package/build/safe-decode-uri-component.js.map +1 -1
  58. package/build/safe-decode-uri.js +2 -2
  59. package/build/safe-decode-uri.js.map +1 -1
  60. package/build-module/add-query-args.js +4 -4
  61. package/build-module/add-query-args.js.map +1 -1
  62. package/build-module/build-query-string.js +3 -3
  63. package/build-module/build-query-string.js.map +1 -1
  64. package/build-module/clean-for-slug.js +2 -2
  65. package/build-module/clean-for-slug.js.map +1 -1
  66. package/build-module/filter-url-for-display.js +3 -3
  67. package/build-module/filter-url-for-display.js.map +1 -1
  68. package/build-module/get-authority.js +2 -2
  69. package/build-module/get-authority.js.map +1 -1
  70. package/build-module/get-filename.js +2 -2
  71. package/build-module/get-filename.js.map +1 -1
  72. package/build-module/get-fragment.js +2 -2
  73. package/build-module/get-fragment.js.map +1 -1
  74. package/build-module/get-path-and-query-string.js +2 -2
  75. package/build-module/get-path-and-query-string.js.map +1 -1
  76. package/build-module/get-path.js +2 -2
  77. package/build-module/get-path.js.map +1 -1
  78. package/build-module/get-protocol.js +2 -2
  79. package/build-module/get-protocol.js.map +1 -1
  80. package/build-module/get-query-arg.js +3 -12
  81. package/build-module/get-query-arg.js.map +1 -1
  82. package/build-module/get-query-args.js +5 -12
  83. package/build-module/get-query-args.js.map +1 -1
  84. package/build-module/get-query-string.js +2 -2
  85. package/build-module/get-query-string.js.map +1 -1
  86. package/build-module/has-query-arg.js +3 -3
  87. package/build-module/has-query-arg.js.map +1 -1
  88. package/build-module/index.js.map +1 -1
  89. package/build-module/is-email.js +2 -2
  90. package/build-module/is-email.js.map +1 -1
  91. package/build-module/is-phone-number.js +2 -2
  92. package/build-module/is-phone-number.js.map +1 -1
  93. package/build-module/is-url.js +2 -2
  94. package/build-module/is-url.js.map +1 -1
  95. package/build-module/is-valid-authority.js +2 -2
  96. package/build-module/is-valid-authority.js.map +1 -1
  97. package/build-module/is-valid-fragment.js +2 -2
  98. package/build-module/is-valid-fragment.js.map +1 -1
  99. package/build-module/is-valid-path.js +2 -2
  100. package/build-module/is-valid-path.js.map +1 -1
  101. package/build-module/is-valid-protocol.js +2 -2
  102. package/build-module/is-valid-protocol.js.map +1 -1
  103. package/build-module/is-valid-query-string.js +2 -2
  104. package/build-module/is-valid-query-string.js.map +1 -1
  105. package/build-module/normalize-path.js +2 -2
  106. package/build-module/normalize-path.js.map +1 -1
  107. package/build-module/prepend-http.js +2 -2
  108. package/build-module/prepend-http.js.map +1 -1
  109. package/build-module/prepend-https.js +2 -2
  110. package/build-module/prepend-https.js.map +1 -1
  111. package/build-module/remove-query-args.js +3 -3
  112. package/build-module/remove-query-args.js.map +1 -1
  113. package/build-module/safe-decode-uri-component.js +2 -2
  114. package/build-module/safe-decode-uri-component.js.map +1 -1
  115. package/build-module/safe-decode-uri.js +2 -2
  116. package/build-module/safe-decode-uri.js.map +1 -1
  117. package/build-types/add-query-args.d.ts +5 -5
  118. package/build-types/add-query-args.d.ts.map +1 -1
  119. package/build-types/build-query-string.d.ts +3 -3
  120. package/build-types/build-query-string.d.ts.map +1 -1
  121. package/build-types/clean-for-slug.d.ts +3 -3
  122. package/build-types/clean-for-slug.d.ts.map +1 -1
  123. package/build-types/filter-url-for-display.d.ts +4 -4
  124. package/build-types/filter-url-for-display.d.ts.map +1 -1
  125. package/build-types/get-authority.d.ts +3 -3
  126. package/build-types/get-authority.d.ts.map +1 -1
  127. package/build-types/get-filename.d.ts +3 -3
  128. package/build-types/get-filename.d.ts.map +1 -1
  129. package/build-types/get-fragment.d.ts +3 -3
  130. package/build-types/get-fragment.d.ts.map +1 -1
  131. package/build-types/get-path-and-query-string.d.ts +3 -3
  132. package/build-types/get-path-and-query-string.d.ts.map +1 -1
  133. package/build-types/get-path.d.ts +3 -3
  134. package/build-types/get-path.d.ts.map +1 -1
  135. package/build-types/get-protocol.d.ts +3 -3
  136. package/build-types/get-protocol.d.ts.map +1 -1
  137. package/build-types/get-query-arg.d.ts +8 -14
  138. package/build-types/get-query-arg.d.ts.map +1 -1
  139. package/build-types/get-query-args.d.ts +6 -5
  140. package/build-types/get-query-args.d.ts.map +1 -1
  141. package/build-types/get-query-string.d.ts +3 -3
  142. package/build-types/get-query-string.d.ts.map +1 -1
  143. package/build-types/has-query-arg.d.ts +4 -4
  144. package/build-types/has-query-arg.d.ts.map +1 -1
  145. package/build-types/index.d.ts +28 -28
  146. package/build-types/index.d.ts.map +1 -1
  147. package/build-types/is-email.d.ts +3 -3
  148. package/build-types/is-email.d.ts.map +1 -1
  149. package/build-types/is-phone-number.d.ts +3 -3
  150. package/build-types/is-phone-number.d.ts.map +1 -1
  151. package/build-types/is-url.d.ts +3 -3
  152. package/build-types/is-url.d.ts.map +1 -1
  153. package/build-types/is-valid-authority.d.ts +3 -3
  154. package/build-types/is-valid-authority.d.ts.map +1 -1
  155. package/build-types/is-valid-fragment.d.ts +3 -3
  156. package/build-types/is-valid-fragment.d.ts.map +1 -1
  157. package/build-types/is-valid-path.d.ts +3 -3
  158. package/build-types/is-valid-path.d.ts.map +1 -1
  159. package/build-types/is-valid-protocol.d.ts +3 -3
  160. package/build-types/is-valid-protocol.d.ts.map +1 -1
  161. package/build-types/is-valid-query-string.d.ts +3 -3
  162. package/build-types/is-valid-query-string.d.ts.map +1 -1
  163. package/build-types/normalize-path.d.ts +3 -3
  164. package/build-types/normalize-path.d.ts.map +1 -1
  165. package/build-types/prepend-http.d.ts +3 -3
  166. package/build-types/prepend-http.d.ts.map +1 -1
  167. package/build-types/prepend-https.d.ts +3 -3
  168. package/build-types/prepend-https.d.ts.map +1 -1
  169. package/build-types/remove-query-args.d.ts +4 -4
  170. package/build-types/remove-query-args.d.ts.map +1 -1
  171. package/build-types/safe-decode-uri-component.d.ts +3 -3
  172. package/build-types/safe-decode-uri-component.d.ts.map +1 -1
  173. package/build-types/safe-decode-uri.d.ts +3 -3
  174. package/build-types/safe-decode-uri.d.ts.map +1 -1
  175. package/package.json +2 -2
  176. package/src/{add-query-args.js → add-query-args.ts} +8 -5
  177. package/src/{build-query-string.js → build-query-string.ts} +7 -6
  178. package/src/{clean-for-slug.js → clean-for-slug.ts} +3 -3
  179. package/src/{filter-url-for-display.js → filter-url-for-display.ts} +7 -4
  180. package/src/{get-authority.js → get-authority.ts} +3 -3
  181. package/src/{get-filename.js → get-filename.ts} +3 -3
  182. package/src/{get-fragment.js → get-fragment.ts} +3 -3
  183. package/src/{get-path-and-query-string.js → get-path-and-query-string.ts} +3 -3
  184. package/src/{get-path.js → get-path.ts} +3 -3
  185. package/src/{get-protocol.js → get-protocol.ts} +3 -3
  186. package/src/get-query-arg.ts +30 -0
  187. package/src/{get-query-args.js → get-query-args.ts} +9 -12
  188. package/src/{get-query-string.js → get-query-string.ts} +3 -3
  189. package/src/{has-query-arg.js → has-query-arg.ts} +4 -4
  190. package/src/{is-email.js → is-email.ts} +3 -3
  191. package/src/{is-phone-number.js → is-phone-number.ts} +3 -3
  192. package/src/{is-url.js → is-url.ts} +3 -3
  193. package/src/{is-valid-authority.js → is-valid-authority.ts} +3 -3
  194. package/src/{is-valid-fragment.js → is-valid-fragment.ts} +3 -3
  195. package/src/{is-valid-path.js → is-valid-path.ts} +3 -3
  196. package/src/{is-valid-protocol.js → is-valid-protocol.ts} +3 -3
  197. package/src/{is-valid-query-string.js → is-valid-query-string.ts} +3 -3
  198. package/src/{normalize-path.js → normalize-path.ts} +3 -3
  199. package/src/{prepend-http.js → prepend-http.ts} +3 -3
  200. package/src/{prepend-https.js → prepend-https.ts} +3 -3
  201. package/src/{remove-query-args.js → remove-query-args.ts} +4 -4
  202. package/src/{safe-decode-uri-component.js → safe-decode-uri-component.ts} +3 -3
  203. package/src/{safe-decode-uri.js → safe-decode-uri.ts} +3 -3
  204. package/src/test/index.js +2 -2
  205. package/tsconfig.tsbuildinfo +1 -1
  206. package/src/get-query-arg.js +0 -29
  207. /package/src/{index.js → index.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.27.0 (2025-07-23)
6
+
5
7
  ## 4.26.0 (2025-06-25)
6
8
 
7
9
  ## 4.25.0 (2025-06-04)
package/README.md CHANGED
@@ -28,8 +28,8 @@ const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://g
28
28
 
29
29
  _Parameters_
30
30
 
31
- - _url_ `[string]`: URL to which arguments should be appended. If omitted, only the resulting querystring is returned.
32
- - _args_ `[Object]`: Query arguments to apply to URL.
31
+ - _url_ `string`: URL to which arguments should be appended. If omitted, only the resulting querystring is returned.
32
+ - _args_ `Record< string, unknown >`: Query arguments to apply to URL.
33
33
 
34
34
  _Returns_
35
35
 
@@ -58,7 +58,7 @@ const queryString = buildQueryString( {
58
58
 
59
59
  _Parameters_
60
60
 
61
- - _data_ `Record<string,*>`: Data to encode.
61
+ - _data_ `Record< string, unknown >`: Data to encode.
62
62
 
63
63
  _Returns_
64
64
 
@@ -99,7 +99,7 @@ const imageUrl = filterURLForDisplay(
99
99
  _Parameters_
100
100
 
101
101
  - _url_ `string`: Original URL.
102
- - _maxLength_ `number|null`: URL length.
102
+ - _maxLength_ `number | null`: URL length.
103
103
 
104
104
  _Returns_
105
105
 
@@ -122,7 +122,7 @@ _Parameters_
122
122
 
123
123
  _Returns_
124
124
 
125
- - `string|void`: The authority part of the URL.
125
+ - `string | void`: The authority part of the URL.
126
126
 
127
127
  ### getFilename
128
128
 
@@ -141,7 +141,7 @@ _Parameters_
141
141
 
142
142
  _Returns_
143
143
 
144
- - `string|void`: The filename part of the URL.
144
+ - `string | void`: The filename part of the URL.
145
145
 
146
146
  ### getFragment
147
147
 
@@ -164,7 +164,7 @@ _Parameters_
164
164
 
165
165
  _Returns_
166
166
 
167
- - `string|void`: The fragment part of the URL.
167
+ - `string | void`: The fragment part of the URL.
168
168
 
169
169
  ### getPath
170
170
 
@@ -183,7 +183,7 @@ _Parameters_
183
183
 
184
184
  _Returns_
185
185
 
186
- - `string|void`: The path part of the URL.
186
+ - `string | void`: The path part of the URL.
187
187
 
188
188
  ### getPathAndQueryString
189
189
 
@@ -225,7 +225,7 @@ _Parameters_
225
225
 
226
226
  _Returns_
227
227
 
228
- - `string|void`: The protocol part of the URL.
228
+ - `string | void`: The protocol part of the URL.
229
229
 
230
230
  ### getQueryArg
231
231
 
@@ -244,7 +244,7 @@ _Parameters_
244
244
 
245
245
  _Returns_
246
246
 
247
- - `QueryArgParsed|void`: Query arg value.
247
+ - `QueryArgParsed | undefined`: Query arg value.
248
248
 
249
249
  ### getQueryArgs
250
250
 
@@ -283,7 +283,7 @@ _Parameters_
283
283
 
284
284
  _Returns_
285
285
 
286
- - `string|void`: The query string part of the URL.
286
+ - `string | void`: The query string part of the URL.
287
287
 
288
288
  ### hasQueryArg
289
289
 
@@ -525,7 +525,7 @@ const newUrl = removeQueryArgs(
525
525
  _Parameters_
526
526
 
527
527
  - _url_ `string`: URL.
528
- - _args_ `...string`: Query Args.
528
+ - _args_ `string[]`: Query Args.
529
529
 
530
530
  _Returns_
531
531
 
@@ -16,16 +16,16 @@ var _getFragment = require("./get-fragment");
16
16
  * includes query arguments, the arguments are merged with (and take precedent
17
17
  * over) the existing set.
18
18
  *
19
- * @param {string} [url=''] URL to which arguments should be appended. If omitted,
20
- * only the resulting querystring is returned.
21
- * @param {Object} [args] Query arguments to apply to URL.
19
+ * @param url URL to which arguments should be appended. If omitted,
20
+ * only the resulting querystring is returned.
21
+ * @param args Query arguments to apply to URL.
22
22
  *
23
23
  * @example
24
24
  * ```js
25
25
  * const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://google.com/?q=test
26
26
  * ```
27
27
  *
28
- * @return {string} URL with arguments applied.
28
+ * @return URL with arguments applied.
29
29
  */
30
30
  function addQueryArgs(url = '', args) {
31
31
  // If no arguments are to be appended, return original URL.
@@ -1 +1 @@
1
- {"version":3,"names":["_getQueryArgs","require","_buildQueryString","_getFragment","addQueryArgs","url","args","Object","keys","length","fragment","getFragment","baseUrl","replace","queryStringIndex","indexOf","assign","getQueryArgs","substr","buildQueryString"],"sources":["@wordpress/url/src/add-query-args.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getQueryArgs } from './get-query-args';\nimport { buildQueryString } from './build-query-string';\nimport { getFragment } from './get-fragment';\n\n/**\n * Appends arguments as querystring to the provided URL. If the URL already\n * includes query arguments, the arguments are merged with (and take precedent\n * over) the existing set.\n *\n * @param {string} [url=''] URL to which arguments should be appended. If omitted,\n * only the resulting querystring is returned.\n * @param {Object} [args] Query arguments to apply to URL.\n *\n * @example\n * ```js\n * const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://google.com/?q=test\n * ```\n *\n * @return {string} URL with arguments applied.\n */\nexport function addQueryArgs( url = '', args ) {\n\t// If no arguments are to be appended, return original URL.\n\tif ( ! args || ! Object.keys( args ).length ) {\n\t\treturn url;\n\t}\n\n\tconst fragment = getFragment( url ) || '';\n\tlet baseUrl = url.replace( fragment, '' );\n\n\t// Determine whether URL already had query arguments.\n\tconst queryStringIndex = url.indexOf( '?' );\n\tif ( queryStringIndex !== -1 ) {\n\t\t// Merge into existing query arguments.\n\t\targs = Object.assign( getQueryArgs( url ), args );\n\n\t\t// Change working base URL to omit previous query arguments.\n\t\tbaseUrl = baseUrl.substr( 0, queryStringIndex );\n\t}\n\n\treturn baseUrl + '?' + buildQueryString( args ) + fragment;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,YAAYA,CAAEC,GAAG,GAAG,EAAE,EAAEC,IAAI,EAAG;EAC9C;EACA,IAAK,CAAEA,IAAI,IAAI,CAAEC,MAAM,CAACC,IAAI,CAAEF,IAAK,CAAC,CAACG,MAAM,EAAG;IAC7C,OAAOJ,GAAG;EACX;EAEA,MAAMK,QAAQ,GAAG,IAAAC,wBAAW,EAAEN,GAAI,CAAC,IAAI,EAAE;EACzC,IAAIO,OAAO,GAAGP,GAAG,CAACQ,OAAO,CAAEH,QAAQ,EAAE,EAAG,CAAC;;EAEzC;EACA,MAAMI,gBAAgB,GAAGT,GAAG,CAACU,OAAO,CAAE,GAAI,CAAC;EAC3C,IAAKD,gBAAgB,KAAK,CAAC,CAAC,EAAG;IAC9B;IACAR,IAAI,GAAGC,MAAM,CAACS,MAAM,CAAE,IAAAC,0BAAY,EAAEZ,GAAI,CAAC,EAAEC,IAAK,CAAC;;IAEjD;IACAM,OAAO,GAAGA,OAAO,CAACM,MAAM,CAAE,CAAC,EAAEJ,gBAAiB,CAAC;EAChD;EAEA,OAAOF,OAAO,GAAG,GAAG,GAAG,IAAAO,kCAAgB,EAAEb,IAAK,CAAC,GAAGI,QAAQ;AAC3D","ignoreList":[]}
1
+ {"version":3,"names":["_getQueryArgs","require","_buildQueryString","_getFragment","addQueryArgs","url","args","Object","keys","length","fragment","getFragment","baseUrl","replace","queryStringIndex","indexOf","assign","getQueryArgs","substr","buildQueryString"],"sources":["@wordpress/url/src/add-query-args.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getQueryArgs } from './get-query-args';\nimport { buildQueryString } from './build-query-string';\nimport { getFragment } from './get-fragment';\n\n/**\n * Appends arguments as querystring to the provided URL. If the URL already\n * includes query arguments, the arguments are merged with (and take precedent\n * over) the existing set.\n *\n * @param url URL to which arguments should be appended. If omitted,\n * only the resulting querystring is returned.\n * @param args Query arguments to apply to URL.\n *\n * @example\n * ```js\n * const newURL = addQueryArgs( 'https://google.com', { q: 'test' } ); // https://google.com/?q=test\n * ```\n *\n * @return URL with arguments applied.\n */\nexport function addQueryArgs(\n\turl: string = '',\n\targs?: Record< string, unknown >\n): string {\n\t// If no arguments are to be appended, return original URL.\n\tif ( ! args || ! Object.keys( args ).length ) {\n\t\treturn url;\n\t}\n\n\tconst fragment = getFragment( url ) || '';\n\tlet baseUrl = url.replace( fragment, '' );\n\n\t// Determine whether URL already had query arguments.\n\tconst queryStringIndex = url.indexOf( '?' );\n\tif ( queryStringIndex !== -1 ) {\n\t\t// Merge into existing query arguments.\n\t\targs = Object.assign( getQueryArgs( url ), args );\n\n\t\t// Change working base URL to omit previous query arguments.\n\t\tbaseUrl = baseUrl.substr( 0, queryStringIndex );\n\t}\n\n\treturn baseUrl + '?' + buildQueryString( args ) + fragment;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,YAAYA,CAC3BC,GAAW,GAAG,EAAE,EAChBC,IAAgC,EACvB;EACT;EACA,IAAK,CAAEA,IAAI,IAAI,CAAEC,MAAM,CAACC,IAAI,CAAEF,IAAK,CAAC,CAACG,MAAM,EAAG;IAC7C,OAAOJ,GAAG;EACX;EAEA,MAAMK,QAAQ,GAAG,IAAAC,wBAAW,EAAEN,GAAI,CAAC,IAAI,EAAE;EACzC,IAAIO,OAAO,GAAGP,GAAG,CAACQ,OAAO,CAAEH,QAAQ,EAAE,EAAG,CAAC;;EAEzC;EACA,MAAMI,gBAAgB,GAAGT,GAAG,CAACU,OAAO,CAAE,GAAI,CAAC;EAC3C,IAAKD,gBAAgB,KAAK,CAAC,CAAC,EAAG;IAC9B;IACAR,IAAI,GAAGC,MAAM,CAACS,MAAM,CAAE,IAAAC,0BAAY,EAAEZ,GAAI,CAAC,EAAEC,IAAK,CAAC;;IAEjD;IACAM,OAAO,GAAGA,OAAO,CAACM,MAAM,CAAE,CAAC,EAAEJ,gBAAiB,CAAC;EAChD;EAEA,OAAOF,OAAO,GAAG,GAAG,GAAG,IAAAO,kCAAgB,EAAEb,IAAK,CAAC,GAAGI,QAAQ;AAC3D","ignoreList":[]}
@@ -24,9 +24,9 @@ exports.buildQueryString = buildQueryString;
24
24
  * // "simple=is%20ok&arrays%5B0%5D=are&arrays%5B1%5D=fine&arrays%5B2%5D=too&objects%5BevenNested%5D%5Bok%5D=yes"
25
25
  * ```
26
26
  *
27
- * @param {Record<string,*>} data Data to encode.
27
+ * @param data Data to encode.
28
28
  *
29
- * @return {string} Query string.
29
+ * @return Query string.
30
30
  */
31
31
  function buildQueryString(data) {
32
32
  let string = '';
@@ -50,7 +50,7 @@ function buildQueryString(data) {
50
50
  if (value === null) {
51
51
  value = '';
52
52
  }
53
- string += '&' + [key, value].map(encodeURIComponent).join('=');
53
+ string += '&' + [key, String(value)].map(encodeURIComponent).join('=');
54
54
  }
55
55
  }
56
56
 
@@ -1 +1 @@
1
- {"version":3,"names":["buildQueryString","data","string","stack","Object","entries","pair","shift","key","value","hasNestedData","Array","isArray","constructor","valuePairs","reverse","member","memberValue","unshift","undefined","map","encodeURIComponent","join","substr"],"sources":["@wordpress/url/src/build-query-string.js"],"sourcesContent":["/**\n * Generates URL-encoded query string using input query data.\n *\n * It is intended to behave equivalent as PHP's `http_build_query`, configured\n * with encoding type PHP_QUERY_RFC3986 (spaces as `%20`).\n *\n * @example\n * ```js\n * const queryString = buildQueryString( {\n * simple: 'is ok',\n * arrays: [ 'are', 'fine', 'too' ],\n * objects: {\n * evenNested: {\n * ok: 'yes',\n * },\n * },\n * } );\n * // \"simple=is%20ok&arrays%5B0%5D=are&arrays%5B1%5D=fine&arrays%5B2%5D=too&objects%5BevenNested%5D%5Bok%5D=yes\"\n * ```\n *\n * @param {Record<string,*>} data Data to encode.\n *\n * @return {string} Query string.\n */\nexport function buildQueryString( data ) {\n\tlet string = '';\n\n\tconst stack = Object.entries( data );\n\n\tlet pair;\n\twhile ( ( pair = stack.shift() ) ) {\n\t\tlet [ key, value ] = pair;\n\n\t\t// Support building deeply nested data, from array or object values.\n\t\tconst hasNestedData =\n\t\t\tArray.isArray( value ) || ( value && value.constructor === Object );\n\n\t\tif ( hasNestedData ) {\n\t\t\t// Push array or object values onto the stack as composed of their\n\t\t\t// original key and nested index or key, retaining order by a\n\t\t\t// combination of Array#reverse and Array#unshift onto the stack.\n\t\t\tconst valuePairs = Object.entries( value ).reverse();\n\t\t\tfor ( const [ member, memberValue ] of valuePairs ) {\n\t\t\t\tstack.unshift( [ `${ key }[${ member }]`, memberValue ] );\n\t\t\t}\n\t\t} else if ( value !== undefined ) {\n\t\t\t// Null is treated as special case, equivalent to empty string.\n\t\t\tif ( value === null ) {\n\t\t\t\tvalue = '';\n\t\t\t}\n\n\t\t\tstring +=\n\t\t\t\t'&' + [ key, value ].map( encodeURIComponent ).join( '=' );\n\t\t}\n\t}\n\n\t// Loop will concatenate with leading `&`, but it's only expected for all\n\t// but the first query parameter. This strips the leading `&`, while still\n\t// accounting for the case that the string may in-fact be empty.\n\treturn string.substr( 1 );\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAgBA,CAAEC,IAAI,EAAG;EACxC,IAAIC,MAAM,GAAG,EAAE;EAEf,MAAMC,KAAK,GAAGC,MAAM,CAACC,OAAO,CAAEJ,IAAK,CAAC;EAEpC,IAAIK,IAAI;EACR,OAAUA,IAAI,GAAGH,KAAK,CAACI,KAAK,CAAC,CAAC,EAAK;IAClC,IAAI,CAAEC,GAAG,EAAEC,KAAK,CAAE,GAAGH,IAAI;;IAEzB;IACA,MAAMI,aAAa,GAClBC,KAAK,CAACC,OAAO,CAAEH,KAAM,CAAC,IAAMA,KAAK,IAAIA,KAAK,CAACI,WAAW,KAAKT,MAAQ;IAEpE,IAAKM,aAAa,EAAG;MACpB;MACA;MACA;MACA,MAAMI,UAAU,GAAGV,MAAM,CAACC,OAAO,CAAEI,KAAM,CAAC,CAACM,OAAO,CAAC,CAAC;MACpD,KAAM,MAAM,CAAEC,MAAM,EAAEC,WAAW,CAAE,IAAIH,UAAU,EAAG;QACnDX,KAAK,CAACe,OAAO,CAAE,CAAE,GAAIV,GAAG,IAAMQ,MAAM,GAAI,EAAEC,WAAW,CAAG,CAAC;MAC1D;IACD,CAAC,MAAM,IAAKR,KAAK,KAAKU,SAAS,EAAG;MACjC;MACA,IAAKV,KAAK,KAAK,IAAI,EAAG;QACrBA,KAAK,GAAG,EAAE;MACX;MAEAP,MAAM,IACL,GAAG,GAAG,CAAEM,GAAG,EAAEC,KAAK,CAAE,CAACW,GAAG,CAAEC,kBAAmB,CAAC,CAACC,IAAI,CAAE,GAAI,CAAC;IAC5D;EACD;;EAEA;EACA;EACA;EACA,OAAOpB,MAAM,CAACqB,MAAM,CAAE,CAAE,CAAC;AAC1B","ignoreList":[]}
1
+ {"version":3,"names":["buildQueryString","data","string","stack","Object","entries","pair","shift","key","value","hasNestedData","Array","isArray","constructor","valuePairs","reverse","member","memberValue","unshift","undefined","String","map","encodeURIComponent","join","substr"],"sources":["@wordpress/url/src/build-query-string.ts"],"sourcesContent":["/**\n * Generates URL-encoded query string using input query data.\n *\n * It is intended to behave equivalent as PHP's `http_build_query`, configured\n * with encoding type PHP_QUERY_RFC3986 (spaces as `%20`).\n *\n * @example\n * ```js\n * const queryString = buildQueryString( {\n * simple: 'is ok',\n * arrays: [ 'are', 'fine', 'too' ],\n * objects: {\n * evenNested: {\n * ok: 'yes',\n * },\n * },\n * } );\n * // \"simple=is%20ok&arrays%5B0%5D=are&arrays%5B1%5D=fine&arrays%5B2%5D=too&objects%5BevenNested%5D%5Bok%5D=yes\"\n * ```\n *\n * @param data Data to encode.\n *\n * @return Query string.\n */\nexport function buildQueryString( data: Record< string, unknown > ): string {\n\tlet string = '';\n\n\tconst stack: Array< [ string, unknown ] > = Object.entries( data );\n\n\tlet pair;\n\twhile ( ( pair = stack.shift() ) ) {\n\t\tlet [ key, value ] = pair;\n\n\t\t// Support building deeply nested data, from array or object values.\n\t\tconst hasNestedData =\n\t\t\tArray.isArray( value ) || ( value && value.constructor === Object );\n\n\t\tif ( hasNestedData ) {\n\t\t\t// Push array or object values onto the stack as composed of their\n\t\t\t// original key and nested index or key, retaining order by a\n\t\t\t// combination of Array#reverse and Array#unshift onto the stack.\n\t\t\tconst valuePairs = Object.entries( value as object ).reverse();\n\t\t\tfor ( const [ member, memberValue ] of valuePairs ) {\n\t\t\t\tstack.unshift( [ `${ key }[${ member }]`, memberValue ] );\n\t\t\t}\n\t\t} else if ( value !== undefined ) {\n\t\t\t// Null is treated as special case, equivalent to empty string.\n\t\t\tif ( value === null ) {\n\t\t\t\tvalue = '';\n\t\t\t}\n\n\t\t\tstring +=\n\t\t\t\t'&' +\n\t\t\t\t[ key, String( value ) ].map( encodeURIComponent ).join( '=' );\n\t\t}\n\t}\n\n\t// Loop will concatenate with leading `&`, but it's only expected for all\n\t// but the first query parameter. This strips the leading `&`, while still\n\t// accounting for the case that the string may in-fact be empty.\n\treturn string.substr( 1 );\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAgBA,CAAEC,IAA+B,EAAW;EAC3E,IAAIC,MAAM,GAAG,EAAE;EAEf,MAAMC,KAAmC,GAAGC,MAAM,CAACC,OAAO,CAAEJ,IAAK,CAAC;EAElE,IAAIK,IAAI;EACR,OAAUA,IAAI,GAAGH,KAAK,CAACI,KAAK,CAAC,CAAC,EAAK;IAClC,IAAI,CAAEC,GAAG,EAAEC,KAAK,CAAE,GAAGH,IAAI;;IAEzB;IACA,MAAMI,aAAa,GAClBC,KAAK,CAACC,OAAO,CAAEH,KAAM,CAAC,IAAMA,KAAK,IAAIA,KAAK,CAACI,WAAW,KAAKT,MAAQ;IAEpE,IAAKM,aAAa,EAAG;MACpB;MACA;MACA;MACA,MAAMI,UAAU,GAAGV,MAAM,CAACC,OAAO,CAAEI,KAAgB,CAAC,CAACM,OAAO,CAAC,CAAC;MAC9D,KAAM,MAAM,CAAEC,MAAM,EAAEC,WAAW,CAAE,IAAIH,UAAU,EAAG;QACnDX,KAAK,CAACe,OAAO,CAAE,CAAE,GAAIV,GAAG,IAAMQ,MAAM,GAAI,EAAEC,WAAW,CAAG,CAAC;MAC1D;IACD,CAAC,MAAM,IAAKR,KAAK,KAAKU,SAAS,EAAG;MACjC;MACA,IAAKV,KAAK,KAAK,IAAI,EAAG;QACrBA,KAAK,GAAG,EAAE;MACX;MAEAP,MAAM,IACL,GAAG,GACH,CAAEM,GAAG,EAAEY,MAAM,CAAEX,KAAM,CAAC,CAAE,CAACY,GAAG,CAAEC,kBAAmB,CAAC,CAACC,IAAI,CAAE,GAAI,CAAC;IAChE;EACD;;EAEA;EACA;EACA;EACA,OAAOrB,MAAM,CAACsB,MAAM,CAAE,CAAE,CAAC;AAC1B","ignoreList":[]}
@@ -22,9 +22,9 @@ var _removeAccents = _interopRequireDefault(require("remove-accents"));
22
22
  * except hyphens. Converts remaining string to lowercase. It does not account
23
23
  * for octets, HTML entities, or other encoded characters.
24
24
  *
25
- * @param {string} string Title or slug to be processed.
25
+ * @param string Title or slug to be processed.
26
26
  *
27
- * @return {string} Processed string.
27
+ * @return Processed string.
28
28
  */
29
29
  function cleanForSlug(string) {
30
30
  if (!string) {
@@ -1 +1 @@
1
- {"version":3,"names":["_removeAccents","_interopRequireDefault","require","cleanForSlug","string","removeAccents","replace","toLowerCase"],"sources":["@wordpress/url/src/clean-for-slug.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * Performs some basic cleanup of a string for use as a post slug.\n *\n * This replicates some of what `sanitize_title_with_dashes()` does in WordPress core, but\n * is only designed to approximate what the slug will be.\n *\n * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin\n * letters. Removes combining diacritical marks. Converts whitespace, periods,\n * and forward slashes to hyphens. Removes any remaining non-word characters\n * except hyphens. Converts remaining string to lowercase. It does not account\n * for octets, HTML entities, or other encoded characters.\n *\n * @param {string} string Title or slug to be processed.\n *\n * @return {string} Processed string.\n */\nexport function cleanForSlug( string ) {\n\tif ( ! string ) {\n\t\treturn '';\n\t}\n\treturn (\n\t\tremoveAccents( string )\n\t\t\t// Convert &nbsp, &ndash, and &mdash to hyphens.\n\t\t\t.replace( /(&nbsp;|&ndash;|&mdash;)/g, '-' )\n\t\t\t// Convert each group of whitespace, periods, and forward slashes to a hyphen.\n\t\t\t.replace( /[\\s\\./]+/g, '-' )\n\t\t\t// Remove all HTML entities.\n\t\t\t.replace( /&\\S+?;/g, '' )\n\t\t\t// Remove anything that's not a letter, number, underscore or hyphen.\n\t\t\t.replace( /[^\\p{L}\\p{N}_-]+/gu, '' )\n\t\t\t// Convert to lowercase\n\t\t\t.toLowerCase()\n\t\t\t// Replace multiple hyphens with a single one.\n\t\t\t.replace( /-+/g, '-' )\n\t\t\t// Remove any remaining leading or trailing hyphens.\n\t\t\t.replace( /(^-+)|(-+$)/g, '' )\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAAEC,MAAM,EAAG;EACtC,IAAK,CAAEA,MAAM,EAAG;IACf,OAAO,EAAE;EACV;EACA,OACC,IAAAC,sBAAa,EAAED,MAAO;EACrB;EAAA,CACCE,OAAO,CAAE,2BAA2B,EAAE,GAAI;EAC3C;EAAA,CACCA,OAAO,CAAE,WAAW,EAAE,GAAI;EAC3B;EAAA,CACCA,OAAO,CAAE,SAAS,EAAE,EAAG;EACxB;EAAA,CACCA,OAAO,CAAE,oBAAoB,EAAE,EAAG;EACnC;EAAA,CACCC,WAAW,CAAC;EACb;EAAA,CACCD,OAAO,CAAE,KAAK,EAAE,GAAI;EACrB;EAAA,CACCA,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;AAEjC","ignoreList":[]}
1
+ {"version":3,"names":["_removeAccents","_interopRequireDefault","require","cleanForSlug","string","removeAccents","replace","toLowerCase"],"sources":["@wordpress/url/src/clean-for-slug.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * Performs some basic cleanup of a string for use as a post slug.\n *\n * This replicates some of what `sanitize_title_with_dashes()` does in WordPress core, but\n * is only designed to approximate what the slug will be.\n *\n * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin\n * letters. Removes combining diacritical marks. Converts whitespace, periods,\n * and forward slashes to hyphens. Removes any remaining non-word characters\n * except hyphens. Converts remaining string to lowercase. It does not account\n * for octets, HTML entities, or other encoded characters.\n *\n * @param string Title or slug to be processed.\n *\n * @return Processed string.\n */\nexport function cleanForSlug( string: string ): string {\n\tif ( ! string ) {\n\t\treturn '';\n\t}\n\treturn (\n\t\tremoveAccents( string )\n\t\t\t// Convert &nbsp, &ndash, and &mdash to hyphens.\n\t\t\t.replace( /(&nbsp;|&ndash;|&mdash;)/g, '-' )\n\t\t\t// Convert each group of whitespace, periods, and forward slashes to a hyphen.\n\t\t\t.replace( /[\\s\\./]+/g, '-' )\n\t\t\t// Remove all HTML entities.\n\t\t\t.replace( /&\\S+?;/g, '' )\n\t\t\t// Remove anything that's not a letter, number, underscore or hyphen.\n\t\t\t.replace( /[^\\p{L}\\p{N}_-]+/gu, '' )\n\t\t\t// Convert to lowercase\n\t\t\t.toLowerCase()\n\t\t\t// Replace multiple hyphens with a single one.\n\t\t\t.replace( /-+/g, '-' )\n\t\t\t// Remove any remaining leading or trailing hyphens.\n\t\t\t.replace( /(^-+)|(-+$)/g, '' )\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAAEC,MAAc,EAAW;EACtD,IAAK,CAAEA,MAAM,EAAG;IACf,OAAO,EAAE;EACV;EACA,OACC,IAAAC,sBAAa,EAAED,MAAO;EACrB;EAAA,CACCE,OAAO,CAAE,2BAA2B,EAAE,GAAI;EAC3C;EAAA,CACCA,OAAO,CAAE,WAAW,EAAE,GAAI;EAC3B;EAAA,CACCA,OAAO,CAAE,SAAS,EAAE,EAAG;EACxB;EAAA,CACCA,OAAO,CAAE,oBAAoB,EAAE,EAAG;EACnC;EAAA,CACCC,WAAW,CAAC;EACb;EAAA,CACCD,OAAO,CAAE,KAAK,EAAE,GAAI;EACrB;EAAA,CACCA,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;AAEjC","ignoreList":[]}
@@ -7,8 +7,8 @@ exports.filterURLForDisplay = filterURLForDisplay;
7
7
  /**
8
8
  * Returns a URL for display.
9
9
  *
10
- * @param {string} url Original URL.
11
- * @param {number|null} maxLength URL length.
10
+ * @param url Original URL.
11
+ * @param maxLength URL length.
12
12
  *
13
13
  * @example
14
14
  * ```js
@@ -16,7 +16,7 @@ exports.filterURLForDisplay = filterURLForDisplay;
16
16
  * const imageUrl = filterURLForDisplay( 'https://www.wordpress.org/wp-content/uploads/img.png', 20 ); // …ent/uploads/img.png
17
17
  * ```
18
18
  *
19
- * @return {string} Displayed URL.
19
+ * @return Displayed URL.
20
20
  */
21
21
  function filterURLForDisplay(url, maxLength = null) {
22
22
  if (!url) {
@@ -1 +1 @@
1
- {"version":3,"names":["filterURLForDisplay","url","maxLength","filteredURL","replace","match","fileRegexp","length","split","urlPieces","file","slice","index","lastIndexOf","fileName","extension","truncatedFile"],"sources":["@wordpress/url/src/filter-url-for-display.js"],"sourcesContent":["/**\n * Returns a URL for display.\n *\n * @param {string} url Original URL.\n * @param {number|null} maxLength URL length.\n *\n * @example\n * ```js\n * const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg\n * const imageUrl = filterURLForDisplay( 'https://www.wordpress.org/wp-content/uploads/img.png', 20 ); // …ent/uploads/img.png\n * ```\n *\n * @return {string} Displayed URL.\n */\nexport function filterURLForDisplay( url, maxLength = null ) {\n\tif ( ! url ) {\n\t\treturn '';\n\t}\n\n\t// Remove protocol and www prefixes.\n\tlet filteredURL = url\n\t\t.replace( /^[a-z\\-.\\+]+[0-9]*:(\\/\\/)?/i, '' )\n\t\t.replace( /^www\\./i, '' );\n\n\t// Ends with / and only has that single slash, strip it.\n\tif ( filteredURL.match( /^[^\\/]+\\/$/ ) ) {\n\t\tfilteredURL = filteredURL.replace( '/', '' );\n\t}\n\n\t// capture file name from URL\n\tconst fileRegexp = /\\/([^\\/?]+)\\.(?:[\\w]+)(?=\\?|$)/;\n\n\tif (\n\t\t! maxLength ||\n\t\tfilteredURL.length <= maxLength ||\n\t\t! filteredURL.match( fileRegexp )\n\t) {\n\t\treturn filteredURL;\n\t}\n\n\t// If the file is not greater than max length, return last portion of URL.\n\tfilteredURL = filteredURL.split( '?' )[ 0 ];\n\tconst urlPieces = filteredURL.split( '/' );\n\tconst file = urlPieces[ urlPieces.length - 1 ];\n\tif ( file.length <= maxLength ) {\n\t\treturn '…' + filteredURL.slice( -maxLength );\n\t}\n\n\t// If the file is greater than max length, truncate the file.\n\tconst index = file.lastIndexOf( '.' );\n\tconst [ fileName, extension ] = [\n\t\tfile.slice( 0, index ),\n\t\tfile.slice( index + 1 ),\n\t];\n\tconst truncatedFile = fileName.slice( -3 ) + '.' + extension;\n\treturn (\n\t\tfile.slice( 0, maxLength - truncatedFile.length - 1 ) +\n\t\t'…' +\n\t\ttruncatedFile\n\t);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAmBA,CAAEC,GAAG,EAAEC,SAAS,GAAG,IAAI,EAAG;EAC5D,IAAK,CAAED,GAAG,EAAG;IACZ,OAAO,EAAE;EACV;;EAEA;EACA,IAAIE,WAAW,GAAGF,GAAG,CACnBG,OAAO,CAAE,6BAA6B,EAAE,EAAG,CAAC,CAC5CA,OAAO,CAAE,SAAS,EAAE,EAAG,CAAC;;EAE1B;EACA,IAAKD,WAAW,CAACE,KAAK,CAAE,YAAa,CAAC,EAAG;IACxCF,WAAW,GAAGA,WAAW,CAACC,OAAO,CAAE,GAAG,EAAE,EAAG,CAAC;EAC7C;;EAEA;EACA,MAAME,UAAU,GAAG,gCAAgC;EAEnD,IACC,CAAEJ,SAAS,IACXC,WAAW,CAACI,MAAM,IAAIL,SAAS,IAC/B,CAAEC,WAAW,CAACE,KAAK,CAAEC,UAAW,CAAC,EAChC;IACD,OAAOH,WAAW;EACnB;;EAEA;EACAA,WAAW,GAAGA,WAAW,CAACK,KAAK,CAAE,GAAI,CAAC,CAAE,CAAC,CAAE;EAC3C,MAAMC,SAAS,GAAGN,WAAW,CAACK,KAAK,CAAE,GAAI,CAAC;EAC1C,MAAME,IAAI,GAAGD,SAAS,CAAEA,SAAS,CAACF,MAAM,GAAG,CAAC,CAAE;EAC9C,IAAKG,IAAI,CAACH,MAAM,IAAIL,SAAS,EAAG;IAC/B,OAAO,GAAG,GAAGC,WAAW,CAACQ,KAAK,CAAE,CAACT,SAAU,CAAC;EAC7C;;EAEA;EACA,MAAMU,KAAK,GAAGF,IAAI,CAACG,WAAW,CAAE,GAAI,CAAC;EACrC,MAAM,CAAEC,QAAQ,EAAEC,SAAS,CAAE,GAAG,CAC/BL,IAAI,CAACC,KAAK,CAAE,CAAC,EAAEC,KAAM,CAAC,EACtBF,IAAI,CAACC,KAAK,CAAEC,KAAK,GAAG,CAAE,CAAC,CACvB;EACD,MAAMI,aAAa,GAAGF,QAAQ,CAACH,KAAK,CAAE,CAAC,CAAE,CAAC,GAAG,GAAG,GAAGI,SAAS;EAC5D,OACCL,IAAI,CAACC,KAAK,CAAE,CAAC,EAAET,SAAS,GAAGc,aAAa,CAACT,MAAM,GAAG,CAAE,CAAC,GACrD,GAAG,GACHS,aAAa;AAEf","ignoreList":[]}
1
+ {"version":3,"names":["filterURLForDisplay","url","maxLength","filteredURL","replace","match","fileRegexp","length","split","urlPieces","file","slice","index","lastIndexOf","fileName","extension","truncatedFile"],"sources":["@wordpress/url/src/filter-url-for-display.ts"],"sourcesContent":["/**\n * Returns a URL for display.\n *\n * @param url Original URL.\n * @param maxLength URL length.\n *\n * @example\n * ```js\n * const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg\n * const imageUrl = filterURLForDisplay( 'https://www.wordpress.org/wp-content/uploads/img.png', 20 ); // …ent/uploads/img.png\n * ```\n *\n * @return Displayed URL.\n */\nexport function filterURLForDisplay(\n\turl: string,\n\tmaxLength: number | null = null\n): string {\n\tif ( ! url ) {\n\t\treturn '';\n\t}\n\n\t// Remove protocol and www prefixes.\n\tlet filteredURL = url\n\t\t.replace( /^[a-z\\-.\\+]+[0-9]*:(\\/\\/)?/i, '' )\n\t\t.replace( /^www\\./i, '' );\n\n\t// Ends with / and only has that single slash, strip it.\n\tif ( filteredURL.match( /^[^\\/]+\\/$/ ) ) {\n\t\tfilteredURL = filteredURL.replace( '/', '' );\n\t}\n\n\t// capture file name from URL\n\tconst fileRegexp = /\\/([^\\/?]+)\\.(?:[\\w]+)(?=\\?|$)/;\n\n\tif (\n\t\t! maxLength ||\n\t\tfilteredURL.length <= maxLength ||\n\t\t! filteredURL.match( fileRegexp )\n\t) {\n\t\treturn filteredURL;\n\t}\n\n\t// If the file is not greater than max length, return last portion of URL.\n\tfilteredURL = filteredURL.split( '?' )[ 0 ];\n\tconst urlPieces = filteredURL.split( '/' );\n\tconst file = urlPieces[ urlPieces.length - 1 ];\n\tif ( file.length <= maxLength ) {\n\t\treturn '…' + filteredURL.slice( -maxLength );\n\t}\n\n\t// If the file is greater than max length, truncate the file.\n\tconst index = file.lastIndexOf( '.' );\n\tconst [ fileName, extension ] = [\n\t\tfile.slice( 0, index ),\n\t\tfile.slice( index + 1 ),\n\t];\n\tconst truncatedFile = fileName.slice( -3 ) + '.' + extension;\n\treturn (\n\t\tfile.slice( 0, maxLength - truncatedFile.length - 1 ) +\n\t\t'…' +\n\t\ttruncatedFile\n\t);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAmBA,CAClCC,GAAW,EACXC,SAAwB,GAAG,IAAI,EACtB;EACT,IAAK,CAAED,GAAG,EAAG;IACZ,OAAO,EAAE;EACV;;EAEA;EACA,IAAIE,WAAW,GAAGF,GAAG,CACnBG,OAAO,CAAE,6BAA6B,EAAE,EAAG,CAAC,CAC5CA,OAAO,CAAE,SAAS,EAAE,EAAG,CAAC;;EAE1B;EACA,IAAKD,WAAW,CAACE,KAAK,CAAE,YAAa,CAAC,EAAG;IACxCF,WAAW,GAAGA,WAAW,CAACC,OAAO,CAAE,GAAG,EAAE,EAAG,CAAC;EAC7C;;EAEA;EACA,MAAME,UAAU,GAAG,gCAAgC;EAEnD,IACC,CAAEJ,SAAS,IACXC,WAAW,CAACI,MAAM,IAAIL,SAAS,IAC/B,CAAEC,WAAW,CAACE,KAAK,CAAEC,UAAW,CAAC,EAChC;IACD,OAAOH,WAAW;EACnB;;EAEA;EACAA,WAAW,GAAGA,WAAW,CAACK,KAAK,CAAE,GAAI,CAAC,CAAE,CAAC,CAAE;EAC3C,MAAMC,SAAS,GAAGN,WAAW,CAACK,KAAK,CAAE,GAAI,CAAC;EAC1C,MAAME,IAAI,GAAGD,SAAS,CAAEA,SAAS,CAACF,MAAM,GAAG,CAAC,CAAE;EAC9C,IAAKG,IAAI,CAACH,MAAM,IAAIL,SAAS,EAAG;IAC/B,OAAO,GAAG,GAAGC,WAAW,CAACQ,KAAK,CAAE,CAACT,SAAU,CAAC;EAC7C;;EAEA;EACA,MAAMU,KAAK,GAAGF,IAAI,CAACG,WAAW,CAAE,GAAI,CAAC;EACrC,MAAM,CAAEC,QAAQ,EAAEC,SAAS,CAAE,GAAG,CAC/BL,IAAI,CAACC,KAAK,CAAE,CAAC,EAAEC,KAAM,CAAC,EACtBF,IAAI,CAACC,KAAK,CAAEC,KAAK,GAAG,CAAE,CAAC,CACvB;EACD,MAAMI,aAAa,GAAGF,QAAQ,CAACH,KAAK,CAAE,CAAC,CAAE,CAAC,GAAG,GAAG,GAAGI,SAAS;EAC5D,OACCL,IAAI,CAACC,KAAK,CAAE,CAAC,EAAET,SAAS,GAAGc,aAAa,CAACT,MAAM,GAAG,CAAE,CAAC,GACrD,GAAG,GACHS,aAAa;AAEf","ignoreList":[]}
@@ -7,7 +7,7 @@ exports.getAuthority = getAuthority;
7
7
  /**
8
8
  * Returns the authority part of the URL.
9
9
  *
10
- * @param {string} url The full URL.
10
+ * @param url The full URL.
11
11
  *
12
12
  * @example
13
13
  * ```js
@@ -15,7 +15,7 @@ exports.getAuthority = getAuthority;
15
15
  * const authority2 = getAuthority( 'https://localhost:8080/test/' ); // 'localhost:8080'
16
16
  * ```
17
17
  *
18
- * @return {string|void} The authority part of the URL.
18
+ * @return The authority part of the URL.
19
19
  */
20
20
  function getAuthority(url) {
21
21
  const matches = /^[^\/\s:]+:(?:\/\/)?\/?([^\/\s#?]+)[\/#?]{0,1}\S*$/.exec(url);
@@ -1 +1 @@
1
- {"version":3,"names":["getAuthority","url","matches","exec"],"sources":["@wordpress/url/src/get-authority.js"],"sourcesContent":["/**\n * Returns the authority part of the URL.\n *\n * @param {string} url The full URL.\n *\n * @example\n * ```js\n * const authority1 = getAuthority( 'https://wordpress.org/help/' ); // 'wordpress.org'\n * const authority2 = getAuthority( 'https://localhost:8080/test/' ); // 'localhost:8080'\n * ```\n *\n * @return {string|void} The authority part of the URL.\n */\nexport function getAuthority( url ) {\n\tconst matches = /^[^\\/\\s:]+:(?:\\/\\/)?\\/?([^\\/\\s#?]+)[\\/#?]{0,1}\\S*$/.exec(\n\t\turl\n\t);\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAYA,CAAEC,GAAG,EAAG;EACnC,MAAMC,OAAO,GAAG,oDAAoD,CAACC,IAAI,CACxEF,GACD,CAAC;EACD,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
1
+ {"version":3,"names":["getAuthority","url","matches","exec"],"sources":["@wordpress/url/src/get-authority.ts"],"sourcesContent":["/**\n * Returns the authority part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const authority1 = getAuthority( 'https://wordpress.org/help/' ); // 'wordpress.org'\n * const authority2 = getAuthority( 'https://localhost:8080/test/' ); // 'localhost:8080'\n * ```\n *\n * @return The authority part of the URL.\n */\nexport function getAuthority( url: string ): string | void {\n\tconst matches = /^[^\\/\\s:]+:(?:\\/\\/)?\\/?([^\\/\\s#?]+)[\\/#?]{0,1}\\S*$/.exec(\n\t\turl\n\t);\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAYA,CAAEC,GAAW,EAAkB;EAC1D,MAAMC,OAAO,GAAG,oDAAoD,CAACC,IAAI,CACxEF,GACD,CAAC;EACD,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
@@ -8,7 +8,7 @@ exports.getFilename = getFilename;
8
8
  /**
9
9
  * Returns the filename part of the URL.
10
10
  *
11
- * @param {string} url The full URL.
11
+ * @param url The full URL.
12
12
  *
13
13
  * @example
14
14
  * ```js
@@ -16,7 +16,7 @@ exports.getFilename = getFilename;
16
16
  * const filename2 = getFilename( '/this/is/a/test.png' ); // 'test.png'
17
17
  * ```
18
18
  *
19
- * @return {string|void} The filename part of the URL.
19
+ * @return The filename part of the URL.
20
20
  */
21
21
  function getFilename(url) {
22
22
  let filename;
@@ -1 +1 @@
1
- {"version":3,"names":["getFilename","url","filename","URL","pathname","split","pop","error"],"sources":["@wordpress/url/src/get-filename.js"],"sourcesContent":["/**\n * Returns the filename part of the URL.\n *\n * @param {string} url The full URL.\n *\n * @example\n * ```js\n * const filename1 = getFilename( 'http://localhost:8080/this/is/a/test.jpg' ); // 'test.jpg'\n * const filename2 = getFilename( '/this/is/a/test.png' ); // 'test.png'\n * ```\n *\n * @return {string|void} The filename part of the URL.\n */\nexport function getFilename( url ) {\n\tlet filename;\n\n\tif ( ! url ) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\tfilename = new URL( url, 'http://example.com' ).pathname\n\t\t\t.split( '/' )\n\t\t\t.pop();\n\t} catch ( error ) {}\n\n\tif ( filename ) {\n\t\treturn filename;\n\t}\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAEC,GAAG,EAAG;EAClC,IAAIC,QAAQ;EAEZ,IAAK,CAAED,GAAG,EAAG;IACZ;EACD;EAEA,IAAI;IACHC,QAAQ,GAAG,IAAIC,GAAG,CAAEF,GAAG,EAAE,oBAAqB,CAAC,CAACG,QAAQ,CACtDC,KAAK,CAAE,GAAI,CAAC,CACZC,GAAG,CAAC,CAAC;EACR,CAAC,CAAC,OAAQC,KAAK,EAAG,CAAC;EAEnB,IAAKL,QAAQ,EAAG;IACf,OAAOA,QAAQ;EAChB;AACD","ignoreList":[]}
1
+ {"version":3,"names":["getFilename","url","filename","URL","pathname","split","pop","error"],"sources":["@wordpress/url/src/get-filename.ts"],"sourcesContent":["/**\n * Returns the filename part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const filename1 = getFilename( 'http://localhost:8080/this/is/a/test.jpg' ); // 'test.jpg'\n * const filename2 = getFilename( '/this/is/a/test.png' ); // 'test.png'\n * ```\n *\n * @return The filename part of the URL.\n */\nexport function getFilename( url: string ): string | void {\n\tlet filename;\n\n\tif ( ! url ) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\tfilename = new URL( url, 'http://example.com' ).pathname\n\t\t\t.split( '/' )\n\t\t\t.pop();\n\t} catch ( error ) {}\n\n\tif ( filename ) {\n\t\treturn filename;\n\t}\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAEC,GAAW,EAAkB;EACzD,IAAIC,QAAQ;EAEZ,IAAK,CAAED,GAAG,EAAG;IACZ;EACD;EAEA,IAAI;IACHC,QAAQ,GAAG,IAAIC,GAAG,CAAEF,GAAG,EAAE,oBAAqB,CAAC,CAACG,QAAQ,CACtDC,KAAK,CAAE,GAAI,CAAC,CACZC,GAAG,CAAC,CAAC;EACR,CAAC,CAAC,OAAQC,KAAK,EAAG,CAAC;EAEnB,IAAKL,QAAQ,EAAG;IACf,OAAOA,QAAQ;EAChB;AACD","ignoreList":[]}
@@ -7,7 +7,7 @@ exports.getFragment = getFragment;
7
7
  /**
8
8
  * Returns the fragment part of the URL.
9
9
  *
10
- * @param {string} url The full URL
10
+ * @param url The full URL
11
11
  *
12
12
  * @example
13
13
  * ```js
@@ -15,7 +15,7 @@ exports.getFragment = getFragment;
15
15
  * const fragment2 = getFragment( 'https://wordpress.org#another-fragment?query=true' ); // '#another-fragment'
16
16
  * ```
17
17
  *
18
- * @return {string|void} The fragment part of the URL.
18
+ * @return The fragment part of the URL.
19
19
  */
20
20
  function getFragment(url) {
21
21
  const matches = /^\S+?(#[^\s\?]*)/.exec(url);
@@ -1 +1 @@
1
- {"version":3,"names":["getFragment","url","matches","exec"],"sources":["@wordpress/url/src/get-fragment.js"],"sourcesContent":["/**\n * Returns the fragment part of the URL.\n *\n * @param {string} url The full URL\n *\n * @example\n * ```js\n * const fragment1 = getFragment( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // '#fragment'\n * const fragment2 = getFragment( 'https://wordpress.org#another-fragment?query=true' ); // '#another-fragment'\n * ```\n *\n * @return {string|void} The fragment part of the URL.\n */\nexport function getFragment( url ) {\n\tconst matches = /^\\S+?(#[^\\s\\?]*)/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAEC,GAAG,EAAG;EAClC,MAAMC,OAAO,GAAG,kBAAkB,CAACC,IAAI,CAAEF,GAAI,CAAC;EAC9C,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
1
+ {"version":3,"names":["getFragment","url","matches","exec"],"sources":["@wordpress/url/src/get-fragment.ts"],"sourcesContent":["/**\n * Returns the fragment part of the URL.\n *\n * @param url The full URL\n *\n * @example\n * ```js\n * const fragment1 = getFragment( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // '#fragment'\n * const fragment2 = getFragment( 'https://wordpress.org#another-fragment?query=true' ); // '#another-fragment'\n * ```\n *\n * @return The fragment part of the URL.\n */\nexport function getFragment( url: string ): string | void {\n\tconst matches = /^\\S+?(#[^\\s\\?]*)/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAEC,GAAW,EAAkB;EACzD,MAAMC,OAAO,GAAG,kBAAkB,CAACC,IAAI,CAAEF,GAAI,CAAC;EAC9C,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
@@ -12,7 +12,7 @@ var _ = require(".");
12
12
  /**
13
13
  * Returns the path part and query string part of the URL.
14
14
  *
15
- * @param {string} url The full URL.
15
+ * @param url The full URL.
16
16
  *
17
17
  * @example
18
18
  * ```js
@@ -20,7 +20,7 @@ var _ = require(".");
20
20
  * const pathAndQueryString2 = getPathAndQueryString( 'https://wordpress.org/help/faq/' ); // '/help/faq'
21
21
  * ```
22
22
  *
23
- * @return {string} The path part and query string part of the URL.
23
+ * @return The path part and query string part of the URL.
24
24
  */
25
25
  function getPathAndQueryString(url) {
26
26
  const path = (0, _.getPath)(url);
@@ -1 +1 @@
1
- {"version":3,"names":["_","require","getPathAndQueryString","url","path","getPath","queryString","getQueryString","value"],"sources":["@wordpress/url/src/get-path-and-query-string.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getPath, getQueryString } from '.';\n\n/**\n * Returns the path part and query string part of the URL.\n *\n * @param {string} url The full URL.\n *\n * @example\n * ```js\n * const pathAndQueryString1 = getPathAndQueryString( 'http://localhost:8080/this/is/a/test?query=true' ); // '/this/is/a/test?query=true'\n * const pathAndQueryString2 = getPathAndQueryString( 'https://wordpress.org/help/faq/' ); // '/help/faq'\n * ```\n *\n * @return {string} The path part and query string part of the URL.\n */\nexport function getPathAndQueryString( url ) {\n\tconst path = getPath( url );\n\tconst queryString = getQueryString( url );\n\tlet value = '/';\n\tif ( path ) {\n\t\tvalue += path;\n\t}\n\tif ( queryString ) {\n\t\tvalue += `?${ queryString }`;\n\t}\n\treturn value;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,CAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,qBAAqBA,CAAEC,GAAG,EAAG;EAC5C,MAAMC,IAAI,GAAG,IAAAC,SAAO,EAAEF,GAAI,CAAC;EAC3B,MAAMG,WAAW,GAAG,IAAAC,gBAAc,EAAEJ,GAAI,CAAC;EACzC,IAAIK,KAAK,GAAG,GAAG;EACf,IAAKJ,IAAI,EAAG;IACXI,KAAK,IAAIJ,IAAI;EACd;EACA,IAAKE,WAAW,EAAG;IAClBE,KAAK,IAAI,IAAKF,WAAW,EAAG;EAC7B;EACA,OAAOE,KAAK;AACb","ignoreList":[]}
1
+ {"version":3,"names":["_","require","getPathAndQueryString","url","path","getPath","queryString","getQueryString","value"],"sources":["@wordpress/url/src/get-path-and-query-string.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getPath, getQueryString } from '.';\n\n/**\n * Returns the path part and query string part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const pathAndQueryString1 = getPathAndQueryString( 'http://localhost:8080/this/is/a/test?query=true' ); // '/this/is/a/test?query=true'\n * const pathAndQueryString2 = getPathAndQueryString( 'https://wordpress.org/help/faq/' ); // '/help/faq'\n * ```\n *\n * @return The path part and query string part of the URL.\n */\nexport function getPathAndQueryString( url: string ): string {\n\tconst path = getPath( url );\n\tconst queryString = getQueryString( url );\n\tlet value = '/';\n\tif ( path ) {\n\t\tvalue += path;\n\t}\n\tif ( queryString ) {\n\t\tvalue += `?${ queryString }`;\n\t}\n\treturn value;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,CAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,qBAAqBA,CAAEC,GAAW,EAAW;EAC5D,MAAMC,IAAI,GAAG,IAAAC,SAAO,EAAEF,GAAI,CAAC;EAC3B,MAAMG,WAAW,GAAG,IAAAC,gBAAc,EAAEJ,GAAI,CAAC;EACzC,IAAIK,KAAK,GAAG,GAAG;EACf,IAAKJ,IAAI,EAAG;IACXI,KAAK,IAAIJ,IAAI;EACd;EACA,IAAKE,WAAW,EAAG;IAClBE,KAAK,IAAI,IAAKF,WAAW,EAAG;EAC7B;EACA,OAAOE,KAAK;AACb","ignoreList":[]}
package/build/get-path.js CHANGED
@@ -7,7 +7,7 @@ exports.getPath = getPath;
7
7
  /**
8
8
  * Returns the path part of the URL.
9
9
  *
10
- * @param {string} url The full URL.
10
+ * @param url The full URL.
11
11
  *
12
12
  * @example
13
13
  * ```js
@@ -15,7 +15,7 @@ exports.getPath = getPath;
15
15
  * const path2 = getPath( 'https://wordpress.org/help/faq/' ); // 'help/faq'
16
16
  * ```
17
17
  *
18
- * @return {string|void} The path part of the URL.
18
+ * @return The path part of the URL.
19
19
  */
20
20
  function getPath(url) {
21
21
  const matches = /^[^\/\s:]+:(?:\/\/)?[^\/\s#?]+[\/]([^\s#?]+)[#?]{0,1}\S*$/.exec(url);
@@ -1 +1 @@
1
- {"version":3,"names":["getPath","url","matches","exec"],"sources":["@wordpress/url/src/get-path.js"],"sourcesContent":["/**\n * Returns the path part of the URL.\n *\n * @param {string} url The full URL.\n *\n * @example\n * ```js\n * const path1 = getPath( 'http://localhost:8080/this/is/a/test?query=true' ); // 'this/is/a/test'\n * const path2 = getPath( 'https://wordpress.org/help/faq/' ); // 'help/faq'\n * ```\n *\n * @return {string|void} The path part of the URL.\n */\nexport function getPath( url ) {\n\tconst matches =\n\t\t/^[^\\/\\s:]+:(?:\\/\\/)?[^\\/\\s#?]+[\\/]([^\\s#?]+)[#?]{0,1}\\S*$/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,OAAOA,CAAEC,GAAG,EAAG;EAC9B,MAAMC,OAAO,GACZ,2DAA2D,CAACC,IAAI,CAAEF,GAAI,CAAC;EACxE,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
1
+ {"version":3,"names":["getPath","url","matches","exec"],"sources":["@wordpress/url/src/get-path.ts"],"sourcesContent":["/**\n * Returns the path part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const path1 = getPath( 'http://localhost:8080/this/is/a/test?query=true' ); // 'this/is/a/test'\n * const path2 = getPath( 'https://wordpress.org/help/faq/' ); // 'help/faq'\n * ```\n *\n * @return The path part of the URL.\n */\nexport function getPath( url: string ): string | void {\n\tconst matches =\n\t\t/^[^\\/\\s:]+:(?:\\/\\/)?[^\\/\\s#?]+[\\/]([^\\s#?]+)[#?]{0,1}\\S*$/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,OAAOA,CAAEC,GAAW,EAAkB;EACrD,MAAMC,OAAO,GACZ,2DAA2D,CAACC,IAAI,CAAEF,GAAI,CAAC;EACxE,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
@@ -7,7 +7,7 @@ exports.getProtocol = getProtocol;
7
7
  /**
8
8
  * Returns the protocol part of the URL.
9
9
  *
10
- * @param {string} url The full URL.
10
+ * @param url The full URL.
11
11
  *
12
12
  * @example
13
13
  * ```js
@@ -15,7 +15,7 @@ exports.getProtocol = getProtocol;
15
15
  * const protocol2 = getProtocol( 'https://wordpress.org' ); // 'https:'
16
16
  * ```
17
17
  *
18
- * @return {string|void} The protocol part of the URL.
18
+ * @return The protocol part of the URL.
19
19
  */
20
20
  function getProtocol(url) {
21
21
  const matches = /^([^\s:]+:)/.exec(url);
@@ -1 +1 @@
1
- {"version":3,"names":["getProtocol","url","matches","exec"],"sources":["@wordpress/url/src/get-protocol.js"],"sourcesContent":["/**\n * Returns the protocol part of the URL.\n *\n * @param {string} url The full URL.\n *\n * @example\n * ```js\n * const protocol1 = getProtocol( 'tel:012345678' ); // 'tel:'\n * const protocol2 = getProtocol( 'https://wordpress.org' ); // 'https:'\n * ```\n *\n * @return {string|void} The protocol part of the URL.\n */\nexport function getProtocol( url ) {\n\tconst matches = /^([^\\s:]+:)/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAEC,GAAG,EAAG;EAClC,MAAMC,OAAO,GAAG,aAAa,CAACC,IAAI,CAAEF,GAAI,CAAC;EACzC,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
1
+ {"version":3,"names":["getProtocol","url","matches","exec"],"sources":["@wordpress/url/src/get-protocol.ts"],"sourcesContent":["/**\n * Returns the protocol part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const protocol1 = getProtocol( 'tel:012345678' ); // 'tel:'\n * const protocol2 = getProtocol( 'https://wordpress.org' ); // 'https:'\n * ```\n *\n * @return The protocol part of the URL.\n */\nexport function getProtocol( url: string ): string | void {\n\tconst matches = /^([^\\s:]+:)/.exec( url );\n\tif ( matches ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAAEC,GAAW,EAAkB;EACzD,MAAMC,OAAO,GAAG,aAAa,CAACC,IAAI,CAAEF,GAAI,CAAC;EACzC,IAAKC,OAAO,EAAG;IACd,OAAOA,OAAO,CAAE,CAAC,CAAE;EACpB;AACD","ignoreList":[]}
@@ -9,26 +9,18 @@ var _getQueryArgs = require("./get-query-args");
9
9
  * Internal dependencies
10
10
  */
11
11
 
12
- /**
13
- * @typedef {{[key: string]: QueryArgParsed}} QueryArgObject
14
- */
15
-
16
- /**
17
- * @typedef {string|string[]|QueryArgObject} QueryArgParsed
18
- */
19
-
20
12
  /**
21
13
  * Returns a single query argument of the url
22
14
  *
23
- * @param {string} url URL.
24
- * @param {string} arg Query arg name.
15
+ * @param url URL.
16
+ * @param arg Query arg name.
25
17
  *
26
18
  * @example
27
19
  * ```js
28
20
  * const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar
29
21
  * ```
30
22
  *
31
- * @return {QueryArgParsed|void} Query arg value.
23
+ * @return Query arg value.
32
24
  */
33
25
  function getQueryArg(url, arg) {
34
26
  return (0, _getQueryArgs.getQueryArgs)(url)[arg];
@@ -1 +1 @@
1
- {"version":3,"names":["_getQueryArgs","require","getQueryArg","url","arg","getQueryArgs"],"sources":["@wordpress/url/src/get-query-arg.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getQueryArgs } from './get-query-args';\n\n/**\n * @typedef {{[key: string]: QueryArgParsed}} QueryArgObject\n */\n\n/**\n * @typedef {string|string[]|QueryArgObject} QueryArgParsed\n */\n\n/**\n * Returns a single query argument of the url\n *\n * @param {string} url URL.\n * @param {string} arg Query arg name.\n *\n * @example\n * ```js\n * const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar\n * ```\n *\n * @return {QueryArgParsed|void} Query arg value.\n */\nexport function getQueryArg( url, arg ) {\n\treturn getQueryArgs( url )[ arg ];\n}\n"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAEC,GAAG,EAAEC,GAAG,EAAG;EACvC,OAAO,IAAAC,0BAAY,EAAEF,GAAI,CAAC,CAAEC,GAAG,CAAE;AAClC","ignoreList":[]}
1
+ {"version":3,"names":["_getQueryArgs","require","getQueryArg","url","arg","getQueryArgs"],"sources":["@wordpress/url/src/get-query-arg.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getQueryArgs } from './get-query-args';\n\nexport interface QueryArgObject {\n\t[ key: string ]: QueryArgParsed;\n}\n\nexport type QueryArgParsed = string | string[] | QueryArgObject;\n\n/**\n * Returns a single query argument of the url\n *\n * @param url URL.\n * @param arg Query arg name.\n *\n * @example\n * ```js\n * const foo = getQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'foo' ); // bar\n * ```\n *\n * @return Query arg value.\n */\nexport function getQueryArg(\n\turl: string,\n\targ: string\n): QueryArgParsed | undefined {\n\treturn getQueryArgs( url )[ arg ];\n}\n"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAC1BC,GAAW,EACXC,GAAW,EACkB;EAC7B,OAAO,IAAAC,0BAAY,EAAEF,GAAI,CAAC,CAAEC,GAAG,CAAE;AAClC","ignoreList":[]}
@@ -10,19 +10,13 @@ var _getQueryString = require("./get-query-string");
10
10
  * Internal dependencies
11
11
  */
12
12
 
13
- /** @typedef {import('./get-query-arg').QueryArgParsed} QueryArgParsed */
14
-
15
- /**
16
- * @typedef {Record<string,QueryArgParsed>} QueryArgs
17
- */
18
-
19
13
  /**
20
14
  * Sets a value in object deeply by a given array of path segments. Mutates the
21
15
  * object reference.
22
16
  *
23
- * @param {Record<string,*>} object Object in which to assign.
24
- * @param {string[]} path Path segment at which to set value.
25
- * @param {*} value Value to set.
17
+ * @param object Object in which to assign.
18
+ * @param path Path segment at which to set value.
19
+ * @param value Value to set.
26
20
  */
27
21
  function setPath(object, path, value) {
28
22
  const length = path.length;
@@ -62,7 +56,7 @@ function setPath(object, path, value) {
62
56
  * Returns an object of query arguments of the given URL. If the given URL is
63
57
  * invalid or has no querystring, an empty object is returned.
64
58
  *
65
- * @param {string} url URL.
59
+ * @param url URL.
66
60
  *
67
61
  * @example
68
62
  * ```js
@@ -70,7 +64,7 @@ function setPath(object, path, value) {
70
64
  * // { "foo": "bar", "bar": "baz" }
71
65
  * ```
72
66
  *
73
- * @return {QueryArgs} Query args object.
67
+ * @return Query args object.
74
68
  */
75
69
  function getQueryArgs(url) {
76
70
  return ((0, _getQueryString.getQueryString)(url) || ''
@@ -1 +1 @@
1
- {"version":3,"names":["_safeDecodeUriComponent","require","_getQueryString","setPath","object","path","value","length","lastIndex","i","key","Array","isArray","toString","includes","toUpperCase","isNextKeyArrayIndex","isNaN","Number","getQueryArgs","url","getQueryString","replace","split","reduce","accumulator","keyValue","filter","Boolean","map","safeDecodeURIComponent","segments","Object","create"],"sources":["@wordpress/url/src/get-query-args.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { safeDecodeURIComponent } from './safe-decode-uri-component';\nimport { getQueryString } from './get-query-string';\n\n/** @typedef {import('./get-query-arg').QueryArgParsed} QueryArgParsed */\n\n/**\n * @typedef {Record<string,QueryArgParsed>} QueryArgs\n */\n\n/**\n * Sets a value in object deeply by a given array of path segments. Mutates the\n * object reference.\n *\n * @param {Record<string,*>} object Object in which to assign.\n * @param {string[]} path Path segment at which to set value.\n * @param {*} value Value to set.\n */\nfunction setPath( object, path, value ) {\n\tconst length = path.length;\n\tconst lastIndex = length - 1;\n\tfor ( let i = 0; i < length; i++ ) {\n\t\tlet key = path[ i ];\n\n\t\tif ( ! key && Array.isArray( object ) ) {\n\t\t\t// If key is empty string and next value is array, derive key from\n\t\t\t// the current length of the array.\n\t\t\tkey = object.length.toString();\n\t\t}\n\n\t\tkey = [ '__proto__', 'constructor', 'prototype' ].includes( key )\n\t\t\t? key.toUpperCase()\n\t\t\t: key;\n\n\t\t// If the next key in the path is numeric (or empty string), it will be\n\t\t// created as an array. Otherwise, it will be created as an object.\n\t\tconst isNextKeyArrayIndex = ! isNaN( Number( path[ i + 1 ] ) );\n\n\t\tobject[ key ] =\n\t\t\ti === lastIndex\n\t\t\t\t? // If at end of path, assign the intended value.\n\t\t\t\t value\n\t\t\t\t: // Otherwise, advance to the next object in the path, creating\n\t\t\t\t // it if it does not yet exist.\n\t\t\t\t object[ key ] || ( isNextKeyArrayIndex ? [] : {} );\n\n\t\tif ( Array.isArray( object[ key ] ) && ! isNextKeyArrayIndex ) {\n\t\t\t// If we current key is non-numeric, but the next value is an\n\t\t\t// array, coerce the value to an object.\n\t\t\tobject[ key ] = { ...object[ key ] };\n\t\t}\n\n\t\t// Update working reference object to the next in the path.\n\t\tobject = object[ key ];\n\t}\n}\n\n/**\n * Returns an object of query arguments of the given URL. If the given URL is\n * invalid or has no querystring, an empty object is returned.\n *\n * @param {string} url URL.\n *\n * @example\n * ```js\n * const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' );\n * // { \"foo\": \"bar\", \"bar\": \"baz\" }\n * ```\n *\n * @return {QueryArgs} Query args object.\n */\nexport function getQueryArgs( url ) {\n\treturn (\n\t\t( getQueryString( url ) || '' )\n\t\t\t// Normalize space encoding, accounting for PHP URL encoding\n\t\t\t// corresponding to `application/x-www-form-urlencoded`.\n\t\t\t//\n\t\t\t// See: https://tools.ietf.org/html/rfc1866#section-8.2.1\n\t\t\t.replace( /\\+/g, '%20' )\n\t\t\t.split( '&' )\n\t\t\t.reduce( ( accumulator, keyValue ) => {\n\t\t\t\tconst [ key, value = '' ] = keyValue\n\t\t\t\t\t.split( '=' )\n\t\t\t\t\t// Filtering avoids decoding as `undefined` for value, where\n\t\t\t\t\t// default is restored in destructuring assignment.\n\t\t\t\t\t.filter( Boolean )\n\t\t\t\t\t.map( safeDecodeURIComponent );\n\n\t\t\t\tif ( key ) {\n\t\t\t\t\tconst segments = key.replace( /\\]/g, '' ).split( '[' );\n\t\t\t\t\tsetPath( accumulator, segments, value );\n\t\t\t\t}\n\n\t\t\t\treturn accumulator;\n\t\t\t}, Object.create( null ) )\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,uBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,OAAOA,CAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAG;EACvC,MAAMC,MAAM,GAAGF,IAAI,CAACE,MAAM;EAC1B,MAAMC,SAAS,GAAGD,MAAM,GAAG,CAAC;EAC5B,KAAM,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,MAAM,EAAEE,CAAC,EAAE,EAAG;IAClC,IAAIC,GAAG,GAAGL,IAAI,CAAEI,CAAC,CAAE;IAEnB,IAAK,CAAEC,GAAG,IAAIC,KAAK,CAACC,OAAO,CAAER,MAAO,CAAC,EAAG;MACvC;MACA;MACAM,GAAG,GAAGN,MAAM,CAACG,MAAM,CAACM,QAAQ,CAAC,CAAC;IAC/B;IAEAH,GAAG,GAAG,CAAE,WAAW,EAAE,aAAa,EAAE,WAAW,CAAE,CAACI,QAAQ,CAAEJ,GAAI,CAAC,GAC9DA,GAAG,CAACK,WAAW,CAAC,CAAC,GACjBL,GAAG;;IAEN;IACA;IACA,MAAMM,mBAAmB,GAAG,CAAEC,KAAK,CAAEC,MAAM,CAAEb,IAAI,CAAEI,CAAC,GAAG,CAAC,CAAG,CAAE,CAAC;IAE9DL,MAAM,CAAEM,GAAG,CAAE,GACZD,CAAC,KAAKD,SAAS;IACZ;IACAF,KAAK;IACL;IACA;IACAF,MAAM,CAAEM,GAAG,CAAE,KAAMM,mBAAmB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAE;IAEtD,IAAKL,KAAK,CAACC,OAAO,CAAER,MAAM,CAAEM,GAAG,CAAG,CAAC,IAAI,CAAEM,mBAAmB,EAAG;MAC9D;MACA;MACAZ,MAAM,CAAEM,GAAG,CAAE,GAAG;QAAE,GAAGN,MAAM,CAAEM,GAAG;MAAG,CAAC;IACrC;;IAEA;IACAN,MAAM,GAAGA,MAAM,CAAEM,GAAG,CAAE;EACvB;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASS,YAAYA,CAAEC,GAAG,EAAG;EACnC,OACC,CAAE,IAAAC,8BAAc,EAAED,GAAI,CAAC,IAAI;EAC1B;EACA;EACA;EACA;EAAA,EACCE,OAAO,CAAE,KAAK,EAAE,KAAM,CAAC,CACvBC,KAAK,CAAE,GAAI,CAAC,CACZC,MAAM,CAAE,CAAEC,WAAW,EAAEC,QAAQ,KAAM;IACrC,MAAM,CAAEhB,GAAG,EAAEJ,KAAK,GAAG,EAAE,CAAE,GAAGoB,QAAQ,CAClCH,KAAK,CAAE,GAAI;IACZ;IACA;IAAA,CACCI,MAAM,CAAEC,OAAQ,CAAC,CACjBC,GAAG,CAAEC,8CAAuB,CAAC;IAE/B,IAAKpB,GAAG,EAAG;MACV,MAAMqB,QAAQ,GAAGrB,GAAG,CAACY,OAAO,CAAE,KAAK,EAAE,EAAG,CAAC,CAACC,KAAK,CAAE,GAAI,CAAC;MACtDpB,OAAO,CAAEsB,WAAW,EAAEM,QAAQ,EAAEzB,KAAM,CAAC;IACxC;IAEA,OAAOmB,WAAW;EACnB,CAAC,EAAEO,MAAM,CAACC,MAAM,CAAE,IAAK,CAAE,CAAC;AAE7B","ignoreList":[]}
1
+ {"version":3,"names":["_safeDecodeUriComponent","require","_getQueryString","setPath","object","path","value","length","lastIndex","i","key","Array","isArray","toString","includes","toUpperCase","isNextKeyArrayIndex","isNaN","Number","getQueryArgs","url","getQueryString","replace","split","reduce","accumulator","keyValue","filter","Boolean","map","safeDecodeURIComponent","segments","Object","create"],"sources":["@wordpress/url/src/get-query-args.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { safeDecodeURIComponent } from './safe-decode-uri-component';\nimport { getQueryString } from './get-query-string';\nimport type { QueryArgParsed } from './get-query-arg';\n\ntype QueryArgs = Record< string, QueryArgParsed >;\n\n/**\n * Sets a value in object deeply by a given array of path segments. Mutates the\n * object reference.\n *\n * @param object Object in which to assign.\n * @param path Path segment at which to set value.\n * @param value Value to set.\n */\nfunction setPath( object: Record< string, any >, path: string[], value: any ) {\n\tconst length = path.length;\n\tconst lastIndex = length - 1;\n\tfor ( let i = 0; i < length; i++ ) {\n\t\tlet key = path[ i ];\n\n\t\tif ( ! key && Array.isArray( object ) ) {\n\t\t\t// If key is empty string and next value is array, derive key from\n\t\t\t// the current length of the array.\n\t\t\tkey = object.length.toString();\n\t\t}\n\n\t\tkey = [ '__proto__', 'constructor', 'prototype' ].includes( key )\n\t\t\t? key.toUpperCase()\n\t\t\t: key;\n\n\t\t// If the next key in the path is numeric (or empty string), it will be\n\t\t// created as an array. Otherwise, it will be created as an object.\n\t\tconst isNextKeyArrayIndex = ! isNaN( Number( path[ i + 1 ] ) );\n\n\t\tobject[ key ] =\n\t\t\ti === lastIndex\n\t\t\t\t? // If at end of path, assign the intended value.\n\t\t\t\t value\n\t\t\t\t: // Otherwise, advance to the next object in the path, creating\n\t\t\t\t // it if it does not yet exist.\n\t\t\t\t object[ key ] || ( isNextKeyArrayIndex ? [] : {} );\n\n\t\tif ( Array.isArray( object[ key ] ) && ! isNextKeyArrayIndex ) {\n\t\t\t// If we current key is non-numeric, but the next value is an\n\t\t\t// array, coerce the value to an object.\n\t\t\tobject[ key ] = { ...object[ key ] };\n\t\t}\n\n\t\t// Update working reference object to the next in the path.\n\t\tobject = object[ key ];\n\t}\n}\n\n/**\n * Returns an object of query arguments of the given URL. If the given URL is\n * invalid or has no querystring, an empty object is returned.\n *\n * @param url URL.\n *\n * @example\n * ```js\n * const foo = getQueryArgs( 'https://wordpress.org?foo=bar&bar=baz' );\n * // { \"foo\": \"bar\", \"bar\": \"baz\" }\n * ```\n *\n * @return Query args object.\n */\nexport function getQueryArgs( url: string ): QueryArgs {\n\treturn (\n\t\t( getQueryString( url ) || '' )\n\t\t\t// Normalize space encoding, accounting for PHP URL encoding\n\t\t\t// corresponding to `application/x-www-form-urlencoded`.\n\t\t\t//\n\t\t\t// See: https://tools.ietf.org/html/rfc1866#section-8.2.1\n\t\t\t.replace( /\\+/g, '%20' )\n\t\t\t.split( '&' )\n\t\t\t.reduce( ( accumulator, keyValue ) => {\n\t\t\t\tconst [ key, value = '' ] = keyValue\n\t\t\t\t\t.split( '=' )\n\t\t\t\t\t// Filtering avoids decoding as `undefined` for value, where\n\t\t\t\t\t// default is restored in destructuring assignment.\n\t\t\t\t\t.filter( Boolean )\n\t\t\t\t\t.map( safeDecodeURIComponent );\n\n\t\t\t\tif ( key ) {\n\t\t\t\t\tconst segments = key.replace( /\\]/g, '' ).split( '[' );\n\t\t\t\t\tsetPath( accumulator, segments, value );\n\t\t\t\t}\n\n\t\t\t\treturn accumulator;\n\t\t\t}, Object.create( null ) )\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,uBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,OAAOA,CAAEC,MAA6B,EAAEC,IAAc,EAAEC,KAAU,EAAG;EAC7E,MAAMC,MAAM,GAAGF,IAAI,CAACE,MAAM;EAC1B,MAAMC,SAAS,GAAGD,MAAM,GAAG,CAAC;EAC5B,KAAM,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,MAAM,EAAEE,CAAC,EAAE,EAAG;IAClC,IAAIC,GAAG,GAAGL,IAAI,CAAEI,CAAC,CAAE;IAEnB,IAAK,CAAEC,GAAG,IAAIC,KAAK,CAACC,OAAO,CAAER,MAAO,CAAC,EAAG;MACvC;MACA;MACAM,GAAG,GAAGN,MAAM,CAACG,MAAM,CAACM,QAAQ,CAAC,CAAC;IAC/B;IAEAH,GAAG,GAAG,CAAE,WAAW,EAAE,aAAa,EAAE,WAAW,CAAE,CAACI,QAAQ,CAAEJ,GAAI,CAAC,GAC9DA,GAAG,CAACK,WAAW,CAAC,CAAC,GACjBL,GAAG;;IAEN;IACA;IACA,MAAMM,mBAAmB,GAAG,CAAEC,KAAK,CAAEC,MAAM,CAAEb,IAAI,CAAEI,CAAC,GAAG,CAAC,CAAG,CAAE,CAAC;IAE9DL,MAAM,CAAEM,GAAG,CAAE,GACZD,CAAC,KAAKD,SAAS;IACZ;IACAF,KAAK;IACL;IACA;IACAF,MAAM,CAAEM,GAAG,CAAE,KAAMM,mBAAmB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAE;IAEtD,IAAKL,KAAK,CAACC,OAAO,CAAER,MAAM,CAAEM,GAAG,CAAG,CAAC,IAAI,CAAEM,mBAAmB,EAAG;MAC9D;MACA;MACAZ,MAAM,CAAEM,GAAG,CAAE,GAAG;QAAE,GAAGN,MAAM,CAAEM,GAAG;MAAG,CAAC;IACrC;;IAEA;IACAN,MAAM,GAAGA,MAAM,CAAEM,GAAG,CAAE;EACvB;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASS,YAAYA,CAAEC,GAAW,EAAc;EACtD,OACC,CAAE,IAAAC,8BAAc,EAAED,GAAI,CAAC,IAAI;EAC1B;EACA;EACA;EACA;EAAA,EACCE,OAAO,CAAE,KAAK,EAAE,KAAM,CAAC,CACvBC,KAAK,CAAE,GAAI,CAAC,CACZC,MAAM,CAAE,CAAEC,WAAW,EAAEC,QAAQ,KAAM;IACrC,MAAM,CAAEhB,GAAG,EAAEJ,KAAK,GAAG,EAAE,CAAE,GAAGoB,QAAQ,CAClCH,KAAK,CAAE,GAAI;IACZ;IACA;IAAA,CACCI,MAAM,CAAEC,OAAQ,CAAC,CACjBC,GAAG,CAAEC,8CAAuB,CAAC;IAE/B,IAAKpB,GAAG,EAAG;MACV,MAAMqB,QAAQ,GAAGrB,GAAG,CAACY,OAAO,CAAE,KAAK,EAAE,EAAG,CAAC,CAACC,KAAK,CAAE,GAAI,CAAC;MACtDpB,OAAO,CAAEsB,WAAW,EAAEM,QAAQ,EAAEzB,KAAM,CAAC;IACxC;IAEA,OAAOmB,WAAW;EACnB,CAAC,EAAEO,MAAM,CAACC,MAAM,CAAE,IAAK,CAAE,CAAC;AAE7B","ignoreList":[]}
@@ -8,14 +8,14 @@ exports.getQueryString = getQueryString;
8
8
  /**
9
9
  * Returns the query string part of the URL.
10
10
  *
11
- * @param {string} url The full URL.
11
+ * @param url The full URL.
12
12
  *
13
13
  * @example
14
14
  * ```js
15
15
  * const queryString = getQueryString( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // 'query=true'
16
16
  * ```
17
17
  *
18
- * @return {string|void} The query string part of the URL.
18
+ * @return The query string part of the URL.
19
19
  */
20
20
  function getQueryString(url) {
21
21
  let query;
@@ -1 +1 @@
1
- {"version":3,"names":["getQueryString","url","query","URL","search","substring","error"],"sources":["@wordpress/url/src/get-query-string.js"],"sourcesContent":["/**\n * Returns the query string part of the URL.\n *\n * @param {string} url The full URL.\n *\n * @example\n * ```js\n * const queryString = getQueryString( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // 'query=true'\n * ```\n *\n * @return {string|void} The query string part of the URL.\n */\nexport function getQueryString( url ) {\n\tlet query;\n\ttry {\n\t\tquery = new URL( url, 'http://example.com' ).search.substring( 1 );\n\t} catch ( error ) {}\n\n\tif ( query ) {\n\t\treturn query;\n\t}\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAAEC,GAAG,EAAG;EACrC,IAAIC,KAAK;EACT,IAAI;IACHA,KAAK,GAAG,IAAIC,GAAG,CAAEF,GAAG,EAAE,oBAAqB,CAAC,CAACG,MAAM,CAACC,SAAS,CAAE,CAAE,CAAC;EACnE,CAAC,CAAC,OAAQC,KAAK,EAAG,CAAC;EAEnB,IAAKJ,KAAK,EAAG;IACZ,OAAOA,KAAK;EACb;AACD","ignoreList":[]}
1
+ {"version":3,"names":["getQueryString","url","query","URL","search","substring","error"],"sources":["@wordpress/url/src/get-query-string.ts"],"sourcesContent":["/**\n * Returns the query string part of the URL.\n *\n * @param url The full URL.\n *\n * @example\n * ```js\n * const queryString = getQueryString( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // 'query=true'\n * ```\n *\n * @return The query string part of the URL.\n */\nexport function getQueryString( url: string ): string | void {\n\tlet query;\n\ttry {\n\t\tquery = new URL( url, 'http://example.com' ).search.substring( 1 );\n\t} catch ( error ) {}\n\n\tif ( query ) {\n\t\treturn query;\n\t}\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAAEC,GAAW,EAAkB;EAC5D,IAAIC,KAAK;EACT,IAAI;IACHA,KAAK,GAAG,IAAIC,GAAG,CAAEF,GAAG,EAAE,oBAAqB,CAAC,CAACG,MAAM,CAACC,SAAS,CAAE,CAAE,CAAC;EACnE,CAAC,CAAC,OAAQC,KAAK,EAAG,CAAC;EAEnB,IAAKJ,KAAK,EAAG;IACZ,OAAOA,KAAK;EACb;AACD","ignoreList":[]}
@@ -12,15 +12,15 @@ var _getQueryArg = require("./get-query-arg");
12
12
  /**
13
13
  * Determines whether the URL contains a given query arg.
14
14
  *
15
- * @param {string} url URL.
16
- * @param {string} arg Query arg name.
15
+ * @param url URL.
16
+ * @param arg Query arg name.
17
17
  *
18
18
  * @example
19
19
  * ```js
20
20
  * const hasBar = hasQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'bar' ); // true
21
21
  * ```
22
22
  *
23
- * @return {boolean} Whether or not the URL contains the query arg.
23
+ * @return Whether or not the URL contains the query arg.
24
24
  */
25
25
  function hasQueryArg(url, arg) {
26
26
  return (0, _getQueryArg.getQueryArg)(url, arg) !== undefined;
@@ -1 +1 @@
1
- {"version":3,"names":["_getQueryArg","require","hasQueryArg","url","arg","getQueryArg","undefined"],"sources":["@wordpress/url/src/has-query-arg.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getQueryArg } from './get-query-arg';\n\n/**\n * Determines whether the URL contains a given query arg.\n *\n * @param {string} url URL.\n * @param {string} arg Query arg name.\n *\n * @example\n * ```js\n * const hasBar = hasQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'bar' ); // true\n * ```\n *\n * @return {boolean} Whether or not the URL contains the query arg.\n */\nexport function hasQueryArg( url, arg ) {\n\treturn getQueryArg( url, arg ) !== undefined;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAEC,GAAG,EAAEC,GAAG,EAAG;EACvC,OAAO,IAAAC,wBAAW,EAAEF,GAAG,EAAEC,GAAI,CAAC,KAAKE,SAAS;AAC7C","ignoreList":[]}
1
+ {"version":3,"names":["_getQueryArg","require","hasQueryArg","url","arg","getQueryArg","undefined"],"sources":["@wordpress/url/src/has-query-arg.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getQueryArg } from './get-query-arg';\n\n/**\n * Determines whether the URL contains a given query arg.\n *\n * @param url URL.\n * @param arg Query arg name.\n *\n * @example\n * ```js\n * const hasBar = hasQueryArg( 'https://wordpress.org?foo=bar&bar=baz', 'bar' ); // true\n * ```\n *\n * @return Whether or not the URL contains the query arg.\n */\nexport function hasQueryArg( url: string, arg: string ): boolean {\n\treturn getQueryArg( url, arg ) !== undefined;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAEC,GAAW,EAAEC,GAAW,EAAY;EAChE,OAAO,IAAAC,wBAAW,EAAEF,GAAG,EAAEC,GAAI,CAAC,KAAKE,SAAS;AAC7C","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_isUrl","require","_isEmail","_isPhoneNumber","_getProtocol","_isValidProtocol","_getAuthority","_isValidAuthority","_getPath","_isValidPath","_getQueryString","_buildQueryString","_isValidQueryString","_getPathAndQueryString","_getFragment","_isValidFragment","_addQueryArgs","_getQueryArg","_getQueryArgs","_hasQueryArg","_removeQueryArgs","_prependHttp","_safeDecodeUri","_safeDecodeUriComponent","_filterUrlForDisplay","_cleanForSlug","_getFilename","_normalizePath","_prependHttps"],"sources":["@wordpress/url/src/index.js"],"sourcesContent":["export { isURL } from './is-url';\nexport { isEmail } from './is-email';\nexport { isPhoneNumber } from './is-phone-number';\nexport { getProtocol } from './get-protocol';\nexport { isValidProtocol } from './is-valid-protocol';\nexport { getAuthority } from './get-authority';\nexport { isValidAuthority } from './is-valid-authority';\nexport { getPath } from './get-path';\nexport { isValidPath } from './is-valid-path';\nexport { getQueryString } from './get-query-string';\nexport { buildQueryString } from './build-query-string';\nexport { isValidQueryString } from './is-valid-query-string';\nexport { getPathAndQueryString } from './get-path-and-query-string';\nexport { getFragment } from './get-fragment';\nexport { isValidFragment } from './is-valid-fragment';\nexport { addQueryArgs } from './add-query-args';\nexport { getQueryArg } from './get-query-arg';\nexport { getQueryArgs } from './get-query-args';\nexport { hasQueryArg } from './has-query-arg';\nexport { removeQueryArgs } from './remove-query-args';\nexport { prependHTTP } from './prepend-http';\nexport { safeDecodeURI } from './safe-decode-uri';\nexport { safeDecodeURIComponent } from './safe-decode-uri-component';\nexport { filterURLForDisplay } from './filter-url-for-display';\nexport { cleanForSlug } from './clean-for-slug';\nexport { getFilename } from './get-filename';\nexport { normalizePath } from './normalize-path';\nexport { prependHTTPS } from './prepend-https';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,mBAAA,GAAAX,OAAA;AACA,IAAAY,sBAAA,GAAAZ,OAAA;AACA,IAAAa,YAAA,GAAAb,OAAA;AACA,IAAAc,gBAAA,GAAAd,OAAA;AACA,IAAAe,aAAA,GAAAf,OAAA;AACA,IAAAgB,YAAA,GAAAhB,OAAA;AACA,IAAAiB,aAAA,GAAAjB,OAAA;AACA,IAAAkB,YAAA,GAAAlB,OAAA;AACA,IAAAmB,gBAAA,GAAAnB,OAAA;AACA,IAAAoB,YAAA,GAAApB,OAAA;AACA,IAAAqB,cAAA,GAAArB,OAAA;AACA,IAAAsB,uBAAA,GAAAtB,OAAA;AACA,IAAAuB,oBAAA,GAAAvB,OAAA;AACA,IAAAwB,aAAA,GAAAxB,OAAA;AACA,IAAAyB,YAAA,GAAAzB,OAAA;AACA,IAAA0B,cAAA,GAAA1B,OAAA;AACA,IAAA2B,aAAA,GAAA3B,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_isUrl","require","_isEmail","_isPhoneNumber","_getProtocol","_isValidProtocol","_getAuthority","_isValidAuthority","_getPath","_isValidPath","_getQueryString","_buildQueryString","_isValidQueryString","_getPathAndQueryString","_getFragment","_isValidFragment","_addQueryArgs","_getQueryArg","_getQueryArgs","_hasQueryArg","_removeQueryArgs","_prependHttp","_safeDecodeUri","_safeDecodeUriComponent","_filterUrlForDisplay","_cleanForSlug","_getFilename","_normalizePath","_prependHttps"],"sources":["@wordpress/url/src/index.ts"],"sourcesContent":["export { isURL } from './is-url';\nexport { isEmail } from './is-email';\nexport { isPhoneNumber } from './is-phone-number';\nexport { getProtocol } from './get-protocol';\nexport { isValidProtocol } from './is-valid-protocol';\nexport { getAuthority } from './get-authority';\nexport { isValidAuthority } from './is-valid-authority';\nexport { getPath } from './get-path';\nexport { isValidPath } from './is-valid-path';\nexport { getQueryString } from './get-query-string';\nexport { buildQueryString } from './build-query-string';\nexport { isValidQueryString } from './is-valid-query-string';\nexport { getPathAndQueryString } from './get-path-and-query-string';\nexport { getFragment } from './get-fragment';\nexport { isValidFragment } from './is-valid-fragment';\nexport { addQueryArgs } from './add-query-args';\nexport { getQueryArg } from './get-query-arg';\nexport { getQueryArgs } from './get-query-args';\nexport { hasQueryArg } from './has-query-arg';\nexport { removeQueryArgs } from './remove-query-args';\nexport { prependHTTP } from './prepend-http';\nexport { safeDecodeURI } from './safe-decode-uri';\nexport { safeDecodeURIComponent } from './safe-decode-uri-component';\nexport { filterURLForDisplay } from './filter-url-for-display';\nexport { cleanForSlug } from './clean-for-slug';\nexport { getFilename } from './get-filename';\nexport { normalizePath } from './normalize-path';\nexport { prependHTTPS } from './prepend-https';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,mBAAA,GAAAX,OAAA;AACA,IAAAY,sBAAA,GAAAZ,OAAA;AACA,IAAAa,YAAA,GAAAb,OAAA;AACA,IAAAc,gBAAA,GAAAd,OAAA;AACA,IAAAe,aAAA,GAAAf,OAAA;AACA,IAAAgB,YAAA,GAAAhB,OAAA;AACA,IAAAiB,aAAA,GAAAjB,OAAA;AACA,IAAAkB,YAAA,GAAAlB,OAAA;AACA,IAAAmB,gBAAA,GAAAnB,OAAA;AACA,IAAAoB,YAAA,GAAApB,OAAA;AACA,IAAAqB,cAAA,GAAArB,OAAA;AACA,IAAAsB,uBAAA,GAAAtB,OAAA;AACA,IAAAuB,oBAAA,GAAAvB,OAAA;AACA,IAAAwB,aAAA,GAAAxB,OAAA;AACA,IAAAyB,YAAA,GAAAzB,OAAA;AACA,IAAA0B,cAAA,GAAA1B,OAAA;AACA,IAAA2B,aAAA,GAAA3B,OAAA","ignoreList":[]}