@fedify/fedify 1.0.0-dev.410 → 1.0.0-dev.412

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. package/CHANGES.md +12 -0
  2. package/esm/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/_validate_binary_like.js +1 -1
  3. package/esm/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/base64.js +3 -5
  4. package/esm/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/base64url.js +3 -5
  5. package/esm/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/hex.js +7 -9
  6. package/esm/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/encoding.js +3 -1
  7. package/esm/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/language.js +2 -2
  8. package/esm/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/media_type.js +7 -7
  9. package/esm/deps/jsr.io/@std/semver/1.0.3/_constants.js +38 -0
  10. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/_shared.js +3 -2
  11. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/can_parse.js +4 -7
  12. package/esm/deps/jsr.io/@std/semver/1.0.3/compare.js +35 -0
  13. package/esm/deps/jsr.io/@std/semver/1.0.3/difference.js +41 -0
  14. package/esm/deps/jsr.io/@std/semver/1.0.3/equals.js +27 -0
  15. package/esm/deps/jsr.io/@std/semver/1.0.3/format.js +32 -0
  16. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/format_range.js +5 -3
  17. package/esm/deps/jsr.io/@std/semver/1.0.3/greater_or_equal.js +26 -0
  18. package/esm/deps/jsr.io/@std/semver/1.0.3/greater_than.js +28 -0
  19. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/greater_than_range.js +14 -13
  20. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/increment.js +13 -14
  21. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/is_range.js +4 -4
  22. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/is_semver.js +3 -5
  23. package/esm/deps/jsr.io/@std/semver/1.0.3/less_or_equal.js +26 -0
  24. package/esm/deps/jsr.io/@std/semver/1.0.3/less_than.js +26 -0
  25. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/less_than_range.js +14 -13
  26. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/max_satisfying.js +2 -2
  27. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/min_satisfying.js +2 -2
  28. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/mod.js +25 -33
  29. package/esm/deps/jsr.io/@std/semver/1.0.3/not_equals.js +25 -0
  30. package/esm/deps/jsr.io/@std/semver/1.0.3/parse.js +44 -0
  31. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/parse_range.js +18 -13
  32. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/range_intersects.js +29 -28
  33. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/satisfies.js +3 -3
  34. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/try_parse.js +5 -8
  35. package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/try_parse_range.js +3 -3
  36. package/esm/federation/collection.js +1 -1
  37. package/esm/federation/handler.js +1 -1
  38. package/esm/nodeinfo/types.js +1 -1
  39. package/esm/runtime/key.js +3 -3
  40. package/esm/sig/http.js +1 -1
  41. package/esm/sig/ld.js +2 -2
  42. package/package.json +4 -4
  43. package/types/deps/jsr.io/@std/encoding/1.0.5/_validate_binary_like.d.ts.map +1 -0
  44. package/types/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/base64.d.ts +2 -2
  45. package/types/deps/jsr.io/@std/encoding/1.0.5/base64.d.ts.map +1 -0
  46. package/types/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/base64url.d.ts +2 -2
  47. package/types/deps/jsr.io/@std/encoding/1.0.5/base64url.d.ts.map +1 -0
  48. package/types/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/hex.d.ts +2 -2
  49. package/types/deps/jsr.io/@std/encoding/1.0.5/hex.d.ts.map +1 -0
  50. package/types/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/common.d.ts +2 -2
  51. package/types/deps/jsr.io/@std/http/1.0.6/_negotiation/common.d.ts.map +1 -0
  52. package/types/deps/jsr.io/@std/http/1.0.6/_negotiation/encoding.d.ts.map +1 -0
  53. package/types/deps/jsr.io/@std/http/1.0.6/_negotiation/language.d.ts.map +1 -0
  54. package/types/deps/jsr.io/@std/http/1.0.6/_negotiation/media_type.d.ts.map +1 -0
  55. package/types/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/negotiation.d.ts +13 -18
  56. package/types/deps/jsr.io/@std/http/1.0.6/negotiation.d.ts.map +1 -0
  57. package/types/deps/jsr.io/@std/semver/1.0.3/_constants.d.ts +16 -0
  58. package/types/deps/jsr.io/@std/semver/1.0.3/_constants.d.ts.map +1 -0
  59. package/types/deps/jsr.io/@std/semver/1.0.3/_shared.d.ts.map +1 -0
  60. package/types/deps/jsr.io/@std/semver/1.0.3/_test_comparator_set.d.ts.map +1 -0
  61. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/can_parse.d.ts +2 -2
  62. package/types/deps/jsr.io/@std/semver/1.0.3/can_parse.d.ts.map +1 -0
  63. package/types/deps/jsr.io/@std/semver/1.0.3/compare.d.ts +28 -0
  64. package/types/deps/jsr.io/@std/semver/1.0.3/compare.d.ts.map +1 -0
  65. package/types/deps/jsr.io/@std/semver/1.0.3/difference.d.ts +27 -0
  66. package/types/deps/jsr.io/@std/semver/1.0.3/difference.d.ts.map +1 -0
  67. package/types/deps/jsr.io/@std/semver/1.0.3/equals.d.ts +24 -0
  68. package/types/deps/jsr.io/@std/semver/1.0.3/equals.d.ts.map +1 -0
  69. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/format.d.ts +3 -7
  70. package/types/deps/jsr.io/@std/semver/1.0.3/format.d.ts.map +1 -0
  71. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/format_range.d.ts +3 -2
  72. package/types/deps/jsr.io/@std/semver/1.0.3/format_range.d.ts.map +1 -0
  73. package/types/deps/jsr.io/@std/semver/1.0.3/greater_or_equal.d.ts +25 -0
  74. package/types/deps/jsr.io/@std/semver/1.0.3/greater_or_equal.d.ts.map +1 -0
  75. package/types/deps/jsr.io/@std/semver/1.0.3/greater_than.d.ts +25 -0
  76. package/types/deps/jsr.io/@std/semver/1.0.3/greater_than.d.ts.map +1 -0
  77. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/greater_than_range.d.ts +8 -7
  78. package/types/deps/jsr.io/@std/semver/1.0.3/greater_than_range.d.ts.map +1 -0
  79. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/increment.d.ts +11 -5
  80. package/types/deps/jsr.io/@std/semver/1.0.3/increment.d.ts.map +1 -0
  81. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/is_range.d.ts +2 -2
  82. package/types/deps/jsr.io/@std/semver/1.0.3/is_range.d.ts.map +1 -0
  83. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/is_semver.d.ts +2 -2
  84. package/types/deps/jsr.io/@std/semver/1.0.3/is_semver.d.ts.map +1 -0
  85. package/types/deps/jsr.io/@std/semver/1.0.3/less_or_equal.d.ts +25 -0
  86. package/types/deps/jsr.io/@std/semver/1.0.3/less_or_equal.d.ts.map +1 -0
  87. package/types/deps/jsr.io/@std/semver/1.0.3/less_than.d.ts +25 -0
  88. package/types/deps/jsr.io/@std/semver/1.0.3/less_than.d.ts.map +1 -0
  89. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/less_than_range.d.ts +8 -7
  90. package/types/deps/jsr.io/@std/semver/1.0.3/less_than_range.d.ts.map +1 -0
  91. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/max_satisfying.d.ts +2 -2
  92. package/types/deps/jsr.io/@std/semver/1.0.3/max_satisfying.d.ts.map +1 -0
  93. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/min_satisfying.d.ts +2 -2
  94. package/types/deps/jsr.io/@std/semver/1.0.3/min_satisfying.d.ts.map +1 -0
  95. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/mod.d.ts +25 -33
  96. package/types/deps/jsr.io/@std/semver/1.0.3/mod.d.ts.map +1 -0
  97. package/types/deps/jsr.io/@std/semver/1.0.3/not_equals.d.ts +24 -0
  98. package/types/deps/jsr.io/@std/semver/1.0.3/not_equals.d.ts.map +1 -0
  99. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/parse.d.ts +5 -5
  100. package/types/deps/jsr.io/@std/semver/1.0.3/parse.d.ts.map +1 -0
  101. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/parse_range.d.ts +6 -5
  102. package/types/deps/jsr.io/@std/semver/1.0.3/parse_range.d.ts.map +1 -0
  103. package/types/deps/jsr.io/@std/semver/1.0.3/range_intersects.d.ts +25 -0
  104. package/types/deps/jsr.io/@std/semver/1.0.3/range_intersects.d.ts.map +1 -0
  105. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/satisfies.d.ts +3 -3
  106. package/types/deps/jsr.io/@std/semver/1.0.3/satisfies.d.ts.map +1 -0
  107. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/try_parse.d.ts +4 -4
  108. package/types/deps/jsr.io/@std/semver/1.0.3/try_parse.d.ts.map +1 -0
  109. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/try_parse_range.d.ts +2 -2
  110. package/types/deps/jsr.io/@std/semver/1.0.3/try_parse_range.d.ts.map +1 -0
  111. package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/types.d.ts +23 -4
  112. package/types/deps/jsr.io/@std/semver/1.0.3/types.d.ts.map +1 -0
  113. package/types/nodeinfo/types.d.ts +1 -1
  114. package/types/nodeinfo/types.d.ts.map +1 -1
  115. package/esm/deps/jsr.io/@std/semver/0.224.3/_constants.js +0 -10
  116. package/esm/deps/jsr.io/@std/semver/0.224.3/compare.js +0 -35
  117. package/esm/deps/jsr.io/@std/semver/0.224.3/constants.js +0 -71
  118. package/esm/deps/jsr.io/@std/semver/0.224.3/difference.js +0 -37
  119. package/esm/deps/jsr.io/@std/semver/0.224.3/equals.js +0 -27
  120. package/esm/deps/jsr.io/@std/semver/0.224.3/format.js +0 -48
  121. package/esm/deps/jsr.io/@std/semver/0.224.3/greater_or_equal.js +0 -25
  122. package/esm/deps/jsr.io/@std/semver/0.224.3/greater_than.js +0 -27
  123. package/esm/deps/jsr.io/@std/semver/0.224.3/less_or_equal.js +0 -25
  124. package/esm/deps/jsr.io/@std/semver/0.224.3/less_than.js +0 -25
  125. package/esm/deps/jsr.io/@std/semver/0.224.3/not_equals.js +0 -24
  126. package/esm/deps/jsr.io/@std/semver/0.224.3/parse.js +0 -50
  127. package/esm/deps/jsr.io/@std/semver/0.224.3/range_max.js +0 -77
  128. package/esm/deps/jsr.io/@std/semver/0.224.3/range_min.js +0 -68
  129. package/esm/deps/jsr.io/@std/semver/0.224.3/test_range.js +0 -28
  130. package/types/deps/jsr.io/@std/encoding/0.224.3/_validate_binary_like.d.ts.map +0 -1
  131. package/types/deps/jsr.io/@std/encoding/0.224.3/base64.d.ts.map +0 -1
  132. package/types/deps/jsr.io/@std/encoding/0.224.3/base64url.d.ts.map +0 -1
  133. package/types/deps/jsr.io/@std/encoding/0.224.3/hex.d.ts.map +0 -1
  134. package/types/deps/jsr.io/@std/http/0.224.5/_negotiation/common.d.ts.map +0 -1
  135. package/types/deps/jsr.io/@std/http/0.224.5/_negotiation/encoding.d.ts.map +0 -1
  136. package/types/deps/jsr.io/@std/http/0.224.5/_negotiation/language.d.ts.map +0 -1
  137. package/types/deps/jsr.io/@std/http/0.224.5/_negotiation/media_type.d.ts.map +0 -1
  138. package/types/deps/jsr.io/@std/http/0.224.5/negotiation.d.ts.map +0 -1
  139. package/types/deps/jsr.io/@std/semver/0.224.3/_constants.d.ts +0 -2
  140. package/types/deps/jsr.io/@std/semver/0.224.3/_constants.d.ts.map +0 -1
  141. package/types/deps/jsr.io/@std/semver/0.224.3/_shared.d.ts.map +0 -1
  142. package/types/deps/jsr.io/@std/semver/0.224.3/_test_comparator_set.d.ts.map +0 -1
  143. package/types/deps/jsr.io/@std/semver/0.224.3/can_parse.d.ts.map +0 -1
  144. package/types/deps/jsr.io/@std/semver/0.224.3/compare.d.ts +0 -28
  145. package/types/deps/jsr.io/@std/semver/0.224.3/compare.d.ts.map +0 -1
  146. package/types/deps/jsr.io/@std/semver/0.224.3/constants.d.ts +0 -43
  147. package/types/deps/jsr.io/@std/semver/0.224.3/constants.d.ts.map +0 -1
  148. package/types/deps/jsr.io/@std/semver/0.224.3/difference.d.ts +0 -27
  149. package/types/deps/jsr.io/@std/semver/0.224.3/difference.d.ts.map +0 -1
  150. package/types/deps/jsr.io/@std/semver/0.224.3/equals.d.ts +0 -24
  151. package/types/deps/jsr.io/@std/semver/0.224.3/equals.d.ts.map +0 -1
  152. package/types/deps/jsr.io/@std/semver/0.224.3/format.d.ts.map +0 -1
  153. package/types/deps/jsr.io/@std/semver/0.224.3/format_range.d.ts.map +0 -1
  154. package/types/deps/jsr.io/@std/semver/0.224.3/greater_or_equal.d.ts +0 -24
  155. package/types/deps/jsr.io/@std/semver/0.224.3/greater_or_equal.d.ts.map +0 -1
  156. package/types/deps/jsr.io/@std/semver/0.224.3/greater_than.d.ts +0 -24
  157. package/types/deps/jsr.io/@std/semver/0.224.3/greater_than.d.ts.map +0 -1
  158. package/types/deps/jsr.io/@std/semver/0.224.3/greater_than_range.d.ts.map +0 -1
  159. package/types/deps/jsr.io/@std/semver/0.224.3/increment.d.ts.map +0 -1
  160. package/types/deps/jsr.io/@std/semver/0.224.3/is_range.d.ts.map +0 -1
  161. package/types/deps/jsr.io/@std/semver/0.224.3/is_semver.d.ts.map +0 -1
  162. package/types/deps/jsr.io/@std/semver/0.224.3/less_or_equal.d.ts +0 -24
  163. package/types/deps/jsr.io/@std/semver/0.224.3/less_or_equal.d.ts.map +0 -1
  164. package/types/deps/jsr.io/@std/semver/0.224.3/less_than.d.ts +0 -24
  165. package/types/deps/jsr.io/@std/semver/0.224.3/less_than.d.ts.map +0 -1
  166. package/types/deps/jsr.io/@std/semver/0.224.3/less_than_range.d.ts.map +0 -1
  167. package/types/deps/jsr.io/@std/semver/0.224.3/max_satisfying.d.ts.map +0 -1
  168. package/types/deps/jsr.io/@std/semver/0.224.3/min_satisfying.d.ts.map +0 -1
  169. package/types/deps/jsr.io/@std/semver/0.224.3/mod.d.ts.map +0 -1
  170. package/types/deps/jsr.io/@std/semver/0.224.3/not_equals.d.ts +0 -23
  171. package/types/deps/jsr.io/@std/semver/0.224.3/not_equals.d.ts.map +0 -1
  172. package/types/deps/jsr.io/@std/semver/0.224.3/parse.d.ts.map +0 -1
  173. package/types/deps/jsr.io/@std/semver/0.224.3/parse_range.d.ts.map +0 -1
  174. package/types/deps/jsr.io/@std/semver/0.224.3/range_intersects.d.ts +0 -24
  175. package/types/deps/jsr.io/@std/semver/0.224.3/range_intersects.d.ts.map +0 -1
  176. package/types/deps/jsr.io/@std/semver/0.224.3/range_max.d.ts +0 -25
  177. package/types/deps/jsr.io/@std/semver/0.224.3/range_max.d.ts.map +0 -1
  178. package/types/deps/jsr.io/@std/semver/0.224.3/range_min.d.ts +0 -25
  179. package/types/deps/jsr.io/@std/semver/0.224.3/range_min.d.ts.map +0 -1
  180. package/types/deps/jsr.io/@std/semver/0.224.3/satisfies.d.ts.map +0 -1
  181. package/types/deps/jsr.io/@std/semver/0.224.3/test_range.d.ts +0 -27
  182. package/types/deps/jsr.io/@std/semver/0.224.3/test_range.d.ts.map +0 -1
  183. package/types/deps/jsr.io/@std/semver/0.224.3/try_parse.d.ts.map +0 -1
  184. package/types/deps/jsr.io/@std/semver/0.224.3/try_parse_range.d.ts.map +0 -1
  185. package/types/deps/jsr.io/@std/semver/0.224.3/types.d.ts.map +0 -1
  186. /package/esm/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/common.js +0 -0
  187. /package/esm/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/negotiation.js +0 -0
  188. /package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/_test_comparator_set.js +0 -0
  189. /package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/types.js +0 -0
  190. /package/types/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/_validate_binary_like.d.ts +0 -0
  191. /package/types/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/encoding.d.ts +0 -0
  192. /package/types/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/language.d.ts +0 -0
  193. /package/types/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/media_type.d.ts +0 -0
  194. /package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/_shared.d.ts +0 -0
  195. /package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/_test_comparator_set.d.ts +0 -0
package/CHANGES.md CHANGED
@@ -133,6 +133,18 @@ To be released.
133
133
  it's terminated so that the peers can clean up data related to the temporary
134
134
  actor. [[#135]]
135
135
 
136
+ - Add options for PostgreSQL drivers to `fedify init` command.
137
+
138
+ - Added `postgres` value to the `-k`/`--kv-store` option of the `fedify
139
+ init` command.
140
+ - Added `postgres` value to the `-q`/`--message-queue` option of
141
+ the `fedify init` command.
142
+
143
+ - The generated project by the `fedify init` command now enables dotenv
144
+ by default.
145
+
146
+ - The `fedify init` command now generates *.env* file with default values.
147
+
136
148
  - Added more log messages using the [LogTape] library. Currently the below
137
149
  logger categories are used:
138
150
 
@@ -22,5 +22,5 @@ export function validateBinaryLike(source) {
22
22
  else if (source instanceof ArrayBuffer) {
23
23
  return new Uint8Array(source);
24
24
  }
25
- throw new TypeError(`The input must be a Uint8Array, a string, or an ArrayBuffer. Received a value of the type ${getTypeName(source)}.`);
25
+ throw new TypeError(`Cannot validate the input as it must be a Uint8Array, a string, or an ArrayBuffer: received a value of the type ${getTypeName(source)}`);
26
26
  }
@@ -5,14 +5,12 @@
5
5
  * {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-4 | base64}
6
6
  * encoding and decoding.
7
7
  *
8
- * This module is browser compatible.
9
- *
10
8
  * ```ts
11
9
  * import {
12
10
  * encodeBase64,
13
11
  * decodeBase64,
14
12
  * } from "@std/encoding/base64";
15
- * import { assertEquals } from "@std/assert/assert-equals";
13
+ * import { assertEquals } from "@std/assert";
16
14
  *
17
15
  * const foobar = new TextEncoder().encode("foobar");
18
16
  *
@@ -100,7 +98,7 @@ const base64abc = [
100
98
  * @example Usage
101
99
  * ```ts
102
100
  * import { encodeBase64 } from "@std/encoding/base64";
103
- * import { assertEquals } from "@std/assert/assert-equals";
101
+ * import { assertEquals } from "@std/assert";
104
102
  *
105
103
  * assertEquals(encodeBase64("foobar"), "Zm9vYmFy");
106
104
  * ```
@@ -146,7 +144,7 @@ export function encodeBase64(data) {
146
144
  * @example Usage
147
145
  * ```ts
148
146
  * import { decodeBase64 } from "@std/encoding/base64";
149
- * import { assertEquals } from "@std/assert/assert-equals";
147
+ * import { assertEquals } from "@std/assert";
150
148
  *
151
149
  * assertEquals(
152
150
  * decodeBase64("Zm9vYmFy"),
@@ -5,8 +5,6 @@
5
5
  * {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-5 | base64url}
6
6
  * encoding and decoding.
7
7
  *
8
- * This module is browser compatible.
9
- *
10
8
  * @module
11
9
  */
12
10
  import * as base64 from "./base64.js";
@@ -22,7 +20,7 @@ function addPaddingToBase64url(base64url) {
22
20
  if (base64url.length % 4 === 3)
23
21
  return base64url + "=";
24
22
  if (base64url.length % 4 === 1) {
25
- throw new TypeError("Illegal base64url string!");
23
+ throw new TypeError("Illegal base64url string");
26
24
  }
27
25
  return base64url;
28
26
  }
@@ -51,7 +49,7 @@ function convertBase64ToBase64url(b64) {
51
49
  * @example Usage
52
50
  * ```ts
53
51
  * import { encodeBase64Url } from "@std/encoding/base64url";
54
- * import { assertEquals } from "@std/assert/assert-equals";
52
+ * import { assertEquals } from "@std/assert";
55
53
  *
56
54
  * assertEquals(encodeBase64Url("foobar"), "Zm9vYmFy");
57
55
  * ```
@@ -70,7 +68,7 @@ export function encodeBase64Url(data) {
70
68
  * @example Usage
71
69
  * ```ts
72
70
  * import { decodeBase64Url } from "@std/encoding/base64url";
73
- * import { assertEquals } from "@std/assert/assert-equals";
71
+ * import { assertEquals } from "@std/assert";
74
72
  *
75
73
  * assertEquals(
76
74
  * decodeBase64Url("Zm9vYmFy"),
@@ -7,14 +7,12 @@
7
7
  * {@link https://github.com/golang/go/blob/go1.12.5/src/encoding/hex/hex.go | encoding/hex}
8
8
  * library.
9
9
  *
10
- * This module is browser compatible.
11
- *
12
10
  * ```ts
13
11
  * import {
14
12
  * decodeHex,
15
13
  * encodeHex,
16
14
  * } from "@std/encoding/hex";
17
- * import { assertEquals } from "@std/assert/assert-equals";
15
+ * import { assertEquals } from "@std/assert";
18
16
  *
19
17
  * assertEquals(encodeHex("abc"), "616263");
20
18
  *
@@ -33,8 +31,8 @@ const textDecoder = new TextDecoder();
33
31
  function errInvalidByte(byte) {
34
32
  return new TypeError(`Invalid byte '${String.fromCharCode(byte)}'`);
35
33
  }
36
- function errLength() {
37
- return new RangeError("Odd length hex string");
34
+ function errLength(len) {
35
+ return new RangeError(`Cannot decode the hex string as the input length should be even: length is ${len}`);
38
36
  }
39
37
  /** Converts a hex character into its value. */
40
38
  function fromHexChar(byte) {
@@ -59,7 +57,7 @@ function fromHexChar(byte) {
59
57
  * @example Usage
60
58
  * ```ts
61
59
  * import { encodeHex } from "@std/encoding/hex";
62
- * import { assertEquals } from "@std/assert/assert-equals";
60
+ * import { assertEquals } from "@std/assert";
63
61
  *
64
62
  * assertEquals(encodeHex("abc"), "616263");
65
63
  * ```
@@ -67,7 +65,7 @@ function fromHexChar(byte) {
67
65
  export function encodeHex(src) {
68
66
  const u8 = validateBinaryLike(src);
69
67
  const dst = new Uint8Array(u8.length * 2);
70
- for (let i = 0; i < dst.length; i++) {
68
+ for (let i = 0; i < u8.length; i++) {
71
69
  const v = u8[i];
72
70
  dst[i * 2] = hexTable[v >> 4];
73
71
  dst[i * 2 + 1] = hexTable[v & 0x0f];
@@ -85,7 +83,7 @@ export function encodeHex(src) {
85
83
  * @example Usage
86
84
  * ```ts
87
85
  * import { decodeHex } from "@std/encoding/hex";
88
- * import { assertEquals } from "@std/assert/assert-equals";
86
+ * import { assertEquals } from "@std/assert";
89
87
  *
90
88
  * assertEquals(
91
89
  * decodeHex("616263"),
@@ -105,7 +103,7 @@ export function decodeHex(src) {
105
103
  // Check for invalid char before reporting bad length,
106
104
  // since the invalid char (if present) is an earlier problem.
107
105
  fromHexChar(u8[dst.length * 2]);
108
- throw errLength();
106
+ throw errLength(u8.length);
109
107
  }
110
108
  return dst;
111
109
  }
@@ -47,7 +47,7 @@ function parseEncoding(str, i) {
47
47
  }
48
48
  }
49
49
  }
50
- return { encoding, q, i };
50
+ return { encoding, o: undefined, q, i, s: undefined };
51
51
  }
52
52
  function specify(encoding, spec, i = -1) {
53
53
  if (!spec.encoding) {
@@ -83,8 +83,10 @@ function parseAcceptEncoding(accept) {
83
83
  if (!hasIdentity) {
84
84
  parsedAccepts.push({
85
85
  encoding: "identity",
86
+ o: undefined,
86
87
  q: minQuality,
87
88
  i: accepts.length - 1,
89
+ s: undefined,
88
90
  });
89
91
  }
90
92
  return parsedAccepts;
@@ -39,7 +39,7 @@ function parseLanguage(str, i) {
39
39
  if (!prefix) {
40
40
  return undefined;
41
41
  }
42
- const full = suffix ? `${prefix}-${suffix}` : prefix;
42
+ const full = suffix !== undefined ? `${prefix}-${suffix}` : prefix;
43
43
  let q = 1;
44
44
  if (match[3]) {
45
45
  const params = match[3].split(";");
@@ -51,7 +51,7 @@ function parseLanguage(str, i) {
51
51
  }
52
52
  }
53
53
  }
54
- return { prefix, suffix, full, q, i };
54
+ return { prefix, suffix, full, i, o: undefined, q, s: undefined };
55
55
  }
56
56
  function parseAcceptLanguage(accept) {
57
57
  const accepts = accept.split(",");
@@ -58,7 +58,7 @@ function parseMediaType(str, i) {
58
58
  params[key] = value;
59
59
  }
60
60
  }
61
- return { type, subtype, params, q, i };
61
+ return { type, subtype, params, i, o: undefined, q, s: undefined };
62
62
  }
63
63
  function parseAccept(accept) {
64
64
  const accepts = accept.split(",").map((p) => p.trim());
@@ -94,8 +94,8 @@ function specify(type, spec, index) {
94
94
  }
95
95
  const keys = Object.keys(spec.params);
96
96
  if (keys.length) {
97
- if (keys.every((key) => (spec.params[key] || "").toLowerCase() ===
98
- (p.params[key] || "").toLowerCase())) {
97
+ if (keys.every((key) => (spec.params[key] ?? "").toLowerCase() ===
98
+ (p.params[key] ?? "").toLowerCase())) {
99
99
  s |= 1;
100
100
  }
101
101
  else {
@@ -114,16 +114,16 @@ function getMediaTypePriority(type, accepted, index) {
114
114
  for (const accepts of accepted) {
115
115
  const spec = specify(type, accepts, index);
116
116
  if (spec &&
117
- ((priority.s || 0) - (spec.s || 0) ||
118
- (priority.q || 0) - (spec.q || 0) ||
119
- (priority.o || 0) - (spec.o || 0)) < 0) {
117
+ ((priority.s ?? 0) - (spec.s ?? 0) ||
118
+ (priority.q ?? 0) - (spec.q ?? 0) ||
119
+ (priority.o ?? 0) - (spec.o ?? 0)) < 0) {
120
120
  priority = spec;
121
121
  }
122
122
  }
123
123
  return priority;
124
124
  }
125
125
  export function preferredMediaTypes(accept, provided) {
126
- const accepts = parseAccept(accept === undefined ? "*/*" : accept || "");
126
+ const accepts = parseAccept(accept === undefined ? "*/*" : accept ?? "");
127
127
  if (!provided) {
128
128
  return accepts
129
129
  .filter(isQuality)
@@ -0,0 +1,38 @@
1
+ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
+ /**
3
+ * The minimum valid SemVer object. Equivalent to `0.0.0`.
4
+ */
5
+ export const MIN = {
6
+ major: 0,
7
+ minor: 0,
8
+ patch: 0,
9
+ prerelease: [],
10
+ build: [],
11
+ };
12
+ /**
13
+ * ANY is a sentinel value used by some range calculations. It is not a valid
14
+ * SemVer object and should not be used directly.
15
+ */
16
+ export const ANY = {
17
+ major: Number.NaN,
18
+ minor: Number.NaN,
19
+ patch: Number.NaN,
20
+ prerelease: [],
21
+ build: [],
22
+ };
23
+ /**
24
+ * A comparator which will span all valid semantic versions
25
+ */
26
+ export const ALL = {
27
+ operator: undefined,
28
+ ...ANY,
29
+ };
30
+ export const OPERATORS = [
31
+ undefined,
32
+ "=",
33
+ "!=",
34
+ ">",
35
+ ">=",
36
+ "<",
37
+ "<=",
38
+ ];
@@ -1,7 +1,8 @@
1
1
  // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
2
  export function compareNumber(a, b) {
3
- if (isNaN(a) || isNaN(b))
4
- throw new Error("Comparison against non-numbers");
3
+ if (isNaN(a) || isNaN(b)) {
4
+ throw new Error("Cannot compare against non-numbers");
5
+ }
5
6
  return a === b ? 0 : a < b ? -1 : 1;
6
7
  }
7
8
  export function checkIdentifier(v1 = [], v2 = []) {
@@ -13,18 +13,15 @@ import { parse } from "./parse.js";
13
13
  * assertFalse(canParse("invalid"));
14
14
  * ```
15
15
  *
16
- * @param version The version string to check
16
+ * @param value The version string to check
17
17
  * @returns `true` if the string can be parsed as SemVer, `false` otherwise
18
18
  */
19
- export function canParse(version) {
19
+ export function canParse(value) {
20
20
  try {
21
- parse(version);
21
+ parse(value);
22
22
  return true;
23
23
  }
24
- catch (err) {
25
- if (!(err instanceof TypeError)) {
26
- throw err;
27
- }
24
+ catch {
28
25
  return false;
29
26
  }
30
27
  }
@@ -0,0 +1,35 @@
1
+ import { checkIdentifier, compareIdentifier, compareNumber, } from "./_shared.js";
2
+ /**
3
+ * Compare two SemVers.
4
+ *
5
+ * Returns `0` if `version1` equals `version2`, or `1` if `version1` is greater, or `-1` if `version2` is
6
+ * greater.
7
+ *
8
+ * Sorts in ascending order if passed to {@linkcode Array.sort}.
9
+ *
10
+ * @example Usage
11
+ * ```ts
12
+ * import { parse, compare } from "@std/semver";
13
+ * import { assertEquals } from "@std/assert";
14
+ *
15
+ * const version1 = parse("1.2.3");
16
+ * const version2 = parse("1.2.4");
17
+ *
18
+ * assertEquals(compare(version1, version2), -1);
19
+ * assertEquals(compare(version2, version1), 1);
20
+ * assertEquals(compare(version1, version1), 0);
21
+ * ```
22
+ *
23
+ * @param version1 The first SemVer to compare
24
+ * @param version2 The second SemVer to compare
25
+ * @returns `1` if `version1` is greater, `0` if equal, or `-1` if `version2` is greater
26
+ */
27
+ export function compare(version1, version2) {
28
+ if (version1 === version2)
29
+ return 0;
30
+ return (compareNumber(version1.major, version2.major) ||
31
+ compareNumber(version1.minor, version2.minor) ||
32
+ compareNumber(version1.patch, version2.patch) ||
33
+ checkIdentifier(version1.prerelease, version2.prerelease) ||
34
+ compareIdentifier(version1.prerelease, version2.prerelease));
35
+ }
@@ -0,0 +1,41 @@
1
+ import { compareIdentifier } from "./_shared.js";
2
+ /**
3
+ * Returns difference between two SemVers by the release type,
4
+ * or `undefined` if the SemVers are the same.
5
+ *
6
+ * @example Usage
7
+ * ```ts
8
+ * import { parse, difference } from "@std/semver";
9
+ * import { assertEquals } from "@std/assert";
10
+ *
11
+ * const version1 = parse("1.2.3");
12
+ * const version2 = parse("1.2.4");
13
+ * const version3 = parse("1.3.0");
14
+ * const version4 = parse("2.0.0");
15
+ *
16
+ * assertEquals(difference(version1, version2), "patch");
17
+ * assertEquals(difference(version1, version3), "minor");
18
+ * assertEquals(difference(version1, version4), "major");
19
+ * assertEquals(difference(version1, version1), undefined);
20
+ * ```
21
+ *
22
+ * @param version1 The first SemVer to compare
23
+ * @param version2 The second SemVer to compare
24
+ * @returns The release type difference or `undefined` if the versions are the same
25
+ */
26
+ export function difference(version1, version2) {
27
+ const hasPrerelease = version1.prerelease?.length ||
28
+ version2.prerelease?.length;
29
+ if (version1.major !== version2.major) {
30
+ return hasPrerelease ? "premajor" : "major";
31
+ }
32
+ if (version1.minor !== version2.minor) {
33
+ return hasPrerelease ? "preminor" : "minor";
34
+ }
35
+ if (version1.patch !== version2.patch) {
36
+ return hasPrerelease ? "prepatch" : "patch";
37
+ }
38
+ if (compareIdentifier(version1.prerelease, version2.prerelease) !== 0) {
39
+ return "prerelease";
40
+ }
41
+ }
@@ -0,0 +1,27 @@
1
+ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ import { compare } from "./compare.js";
4
+ /**
5
+ * Returns `true` if both SemVers are equivalent.
6
+ *
7
+ * This is equal to `compare(version1, version2) === 0`.
8
+ *
9
+ * @example Usage
10
+ * ```ts
11
+ * import { parse, equals } from "@std/semver";
12
+ * import { assert } from "@std/assert";
13
+ *
14
+ * const version1 = parse("1.2.3");
15
+ * const version2 = parse("1.2.3");
16
+ *
17
+ * assert(equals(version1, version2));
18
+ * assert(!equals(version1, parse("1.2.4")));
19
+ * ```
20
+ *
21
+ * @param version1 The first SemVer to compare
22
+ * @param version2 The second SemVer to compare
23
+ * @returns `true` if `version1` is equal to `version2`, `false` otherwise
24
+ */
25
+ export function equals(version1, version2) {
26
+ return compare(version1, version2) === 0;
27
+ }
@@ -0,0 +1,32 @@
1
+ function formatNumber(value) {
2
+ return value.toFixed(0);
3
+ }
4
+ /**
5
+ * Format a SemVer object into a string.
6
+ *
7
+ * @example Usage
8
+ * ```ts
9
+ * import { format } from "@std/semver/format";
10
+ * import { assertEquals } from "@std/assert";
11
+ *
12
+ * const semver = {
13
+ * major: 1,
14
+ * minor: 2,
15
+ * patch: 3,
16
+ * };
17
+ * assertEquals(format(semver), "1.2.3");
18
+ * ```
19
+ *
20
+ * @param version The SemVer to format
21
+ * @returns The string representation of a semantic version.
22
+ */
23
+ export function format(version) {
24
+ const major = formatNumber(version.major);
25
+ const minor = formatNumber(version.minor);
26
+ const patch = formatNumber(version.patch);
27
+ const pre = version.prerelease?.join(".") ?? "";
28
+ const build = version.build?.join(".") ?? "";
29
+ const primary = `${major}.${minor}.${patch}`;
30
+ const release = [primary, pre].filter((v) => v).join("-");
31
+ return [release, build].filter((v) => v).join("+");
32
+ }
@@ -1,12 +1,14 @@
1
1
  // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
2
  // This module is browser compatible.
3
3
  import { format } from "./format.js";
4
+ import { isWildcardComparator } from "./_shared.js";
4
5
  function formatComparator(comparator) {
5
6
  const { operator } = comparator;
6
- return `${operator === undefined ? "" : operator}${format(comparator)}`;
7
+ return `${operator === undefined ? "" : operator}${isWildcardComparator(comparator) ? "*" : format(comparator)}`;
7
8
  }
8
9
  /**
9
- * Formats the range into a string
10
+ * Formats the SemVerrange into a string.
11
+ *
10
12
  * @example Usage
11
13
  * ```ts
12
14
  * import { formatRange, parseRange } from "@std/semver";
@@ -17,7 +19,7 @@ function formatComparator(comparator) {
17
19
  * ```
18
20
  *
19
21
  * @param range The range to format
20
- * @returns A string representation of the range
22
+ * @returns A string representation of the SemVer range
21
23
  */
22
24
  export function formatRange(range) {
23
25
  return range.map((c) => c.map((c) => formatComparator(c)).join(" "))
@@ -0,0 +1,26 @@
1
+ import { compare } from "./compare.js";
2
+ /**
3
+ * Greater than or equal to comparison for two SemVers.
4
+ *
5
+ * This is equal to `compare(version1, version2) >= 0`.
6
+ *
7
+ * @example Usage
8
+ * ```ts
9
+ * import { parse, greaterOrEqual } from "@std/semver";
10
+ * import { assert } from "@std/assert";
11
+ *
12
+ * const version1 = parse("1.2.3");
13
+ * const version2 = parse("1.2.4");
14
+ *
15
+ * assert(greaterOrEqual(version2, version1));
16
+ * assert(!greaterOrEqual(version1, version2));
17
+ * assert(greaterOrEqual(version1, version1));
18
+ * ```
19
+ *
20
+ * @param version1 The first version to compare
21
+ * @param version2 The second version to compare
22
+ * @returns `true` if `version1` is greater than or equal to `version2`, `false` otherwise
23
+ */
24
+ export function greaterOrEqual(version1, version2) {
25
+ return compare(version1, version2) >= 0;
26
+ }
@@ -0,0 +1,28 @@
1
+ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ import { compare } from "./compare.js";
4
+ /**
5
+ * Greater than comparison for two SemVers.
6
+ *
7
+ * This is equal to `compare(version1, version2) > 0`.
8
+ *
9
+ * @example Usage
10
+ * ```ts
11
+ * import { parse, greaterThan } from "@std/semver";
12
+ * import { assert } from "@std/assert";
13
+ *
14
+ * const version1 = parse("1.2.3");
15
+ * const version2 = parse("1.2.4");
16
+ *
17
+ * assert(greaterThan(version2, version1));
18
+ * assert(!greaterThan(version1, version2));
19
+ * assert(!greaterThan(version1, version1));
20
+ * ```
21
+ *
22
+ * @param version1 The first version to compare
23
+ * @param version2 The second version to compare
24
+ * @returns `true` if `version1` is greater than `version2`, `false` otherwise
25
+ */
26
+ export function greaterThan(version1, version2) {
27
+ return compare(version1, version2) > 0;
28
+ }
@@ -9,36 +9,37 @@ import { compare } from "./compare.js";
9
9
  * @example Usage
10
10
  * ```ts
11
11
  * import { parse, parseRange, greaterThanRange } from "@std/semver";
12
- * import { assert, assertFalse } from "@std/assert";
12
+ * import { assert } from "@std/assert";
13
13
  *
14
- * const v0 = parse("1.2.3");
15
- * const v1 = parse("1.2.4");
14
+ * const version1 = parse("1.2.3");
15
+ * const version2 = parse("1.2.4");
16
16
  * const range = parseRange(">=1.2.3 <1.2.4");
17
- * assertFalse(greaterThanRange(v0, range));
18
- * assert(greaterThanRange(v1, range));
17
+ *
18
+ * assert(!greaterThanRange(version1, range));
19
+ * assert(greaterThanRange(version2, range));
19
20
  * ```
20
21
  *
21
- * @param semver The version to check.
22
+ * @param version The version to check.
22
23
  * @param range The range to check against.
23
24
  * @returns `true` if the semver is greater than the range, `false` otherwise.
24
25
  */
25
- export function greaterThanRange(semver, range) {
26
- return range.every((comparatorSet) => greaterThanComparatorSet(semver, comparatorSet));
26
+ export function greaterThanRange(version, range) {
27
+ return range.every((comparatorSet) => greaterThanComparatorSet(version, comparatorSet));
27
28
  }
28
- function greaterThanComparatorSet(semver, comparatorSet) {
29
+ function greaterThanComparatorSet(version, comparatorSet) {
29
30
  // If the comparator set contains wildcard, then the semver is not greater than the range.
30
31
  if (comparatorSet.some(isWildcardComparator))
31
32
  return false;
32
33
  // If the semver satisfies the comparator set, then it's not greater than the range.
33
- if (testComparatorSet(semver, comparatorSet))
34
+ if (testComparatorSet(version, comparatorSet))
34
35
  return false;
35
36
  // If the semver is less than any of the comparator set, then it's not greater than the range.
36
- if (comparatorSet.some((comparator) => lessThanComparator(semver, comparator)))
37
+ if (comparatorSet.some((comparator) => lessThanComparator(version, comparator)))
37
38
  return false;
38
39
  return true;
39
40
  }
40
- function lessThanComparator(semver, comparator) {
41
- const cmp = compare(semver, comparator);
41
+ function lessThanComparator(version, comparator) {
42
+ const cmp = compare(version, comparator);
42
43
  switch (comparator.operator) {
43
44
  case "=":
44
45
  case undefined: