@fedify/fedify 1.0.0-dev.409 → 1.0.0-dev.411
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGES.md +12 -0
- package/esm/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/_validate_binary_like.js +1 -1
- package/esm/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/base64.js +3 -5
- package/esm/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/base64url.js +3 -5
- package/esm/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/hex.js +7 -9
- package/esm/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/encoding.js +3 -1
- package/esm/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/language.js +2 -2
- package/esm/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/media_type.js +7 -7
- package/esm/deps/jsr.io/@std/semver/1.0.3/_constants.js +38 -0
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/_shared.js +3 -2
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/can_parse.js +4 -7
- package/esm/deps/jsr.io/@std/semver/1.0.3/compare.js +35 -0
- package/esm/deps/jsr.io/@std/semver/1.0.3/difference.js +41 -0
- package/esm/deps/jsr.io/@std/semver/1.0.3/equals.js +27 -0
- package/esm/deps/jsr.io/@std/semver/1.0.3/format.js +32 -0
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/format_range.js +5 -3
- package/esm/deps/jsr.io/@std/semver/1.0.3/greater_or_equal.js +26 -0
- package/esm/deps/jsr.io/@std/semver/1.0.3/greater_than.js +28 -0
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/greater_than_range.js +14 -13
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/increment.js +13 -14
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/is_range.js +4 -4
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/is_semver.js +3 -5
- package/esm/deps/jsr.io/@std/semver/1.0.3/less_or_equal.js +26 -0
- package/esm/deps/jsr.io/@std/semver/1.0.3/less_than.js +26 -0
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/less_than_range.js +14 -13
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/max_satisfying.js +2 -2
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/min_satisfying.js +2 -2
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/mod.js +25 -33
- package/esm/deps/jsr.io/@std/semver/1.0.3/not_equals.js +25 -0
- package/esm/deps/jsr.io/@std/semver/1.0.3/parse.js +44 -0
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/parse_range.js +18 -13
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/range_intersects.js +29 -28
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/satisfies.js +3 -3
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/try_parse.js +5 -8
- package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/try_parse_range.js +3 -3
- package/esm/federation/collection.js +1 -1
- package/esm/federation/handler.js +1 -1
- package/esm/nodeinfo/types.js +1 -1
- package/esm/runtime/key.js +3 -3
- package/esm/sig/http.js +1 -1
- package/esm/sig/ld.js +2 -2
- package/package.json +4 -4
- package/types/deps/jsr.io/@std/encoding/1.0.5/_validate_binary_like.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/base64.d.ts +2 -2
- package/types/deps/jsr.io/@std/encoding/1.0.5/base64.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/base64url.d.ts +2 -2
- package/types/deps/jsr.io/@std/encoding/1.0.5/base64url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/hex.d.ts +2 -2
- package/types/deps/jsr.io/@std/encoding/1.0.5/hex.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/common.d.ts +2 -2
- package/types/deps/jsr.io/@std/http/1.0.6/_negotiation/common.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/http/1.0.6/_negotiation/encoding.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/http/1.0.6/_negotiation/language.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/http/1.0.6/_negotiation/media_type.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/negotiation.d.ts +13 -18
- package/types/deps/jsr.io/@std/http/1.0.6/negotiation.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/_constants.d.ts +16 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/_constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/_shared.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/_test_comparator_set.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/can_parse.d.ts +2 -2
- package/types/deps/jsr.io/@std/semver/1.0.3/can_parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/compare.d.ts +28 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/compare.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/difference.d.ts +27 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/difference.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/equals.d.ts +24 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/format.d.ts +3 -7
- package/types/deps/jsr.io/@std/semver/1.0.3/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/format_range.d.ts +3 -2
- package/types/deps/jsr.io/@std/semver/1.0.3/format_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/greater_or_equal.d.ts +25 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/greater_or_equal.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/greater_than.d.ts +25 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/greater_than.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/greater_than_range.d.ts +8 -7
- package/types/deps/jsr.io/@std/semver/1.0.3/greater_than_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/increment.d.ts +11 -5
- package/types/deps/jsr.io/@std/semver/1.0.3/increment.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/is_range.d.ts +2 -2
- package/types/deps/jsr.io/@std/semver/1.0.3/is_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/is_semver.d.ts +2 -2
- package/types/deps/jsr.io/@std/semver/1.0.3/is_semver.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/less_or_equal.d.ts +25 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/less_or_equal.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/less_than.d.ts +25 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/less_than.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/less_than_range.d.ts +8 -7
- package/types/deps/jsr.io/@std/semver/1.0.3/less_than_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/max_satisfying.d.ts +2 -2
- package/types/deps/jsr.io/@std/semver/1.0.3/max_satisfying.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/min_satisfying.d.ts +2 -2
- package/types/deps/jsr.io/@std/semver/1.0.3/min_satisfying.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/mod.d.ts +25 -33
- package/types/deps/jsr.io/@std/semver/1.0.3/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/not_equals.d.ts +24 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/not_equals.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/parse.d.ts +5 -5
- package/types/deps/jsr.io/@std/semver/1.0.3/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/parse_range.d.ts +6 -5
- package/types/deps/jsr.io/@std/semver/1.0.3/parse_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/range_intersects.d.ts +25 -0
- package/types/deps/jsr.io/@std/semver/1.0.3/range_intersects.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/satisfies.d.ts +3 -3
- package/types/deps/jsr.io/@std/semver/1.0.3/satisfies.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/try_parse.d.ts +4 -4
- package/types/deps/jsr.io/@std/semver/1.0.3/try_parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/try_parse_range.d.ts +2 -2
- package/types/deps/jsr.io/@std/semver/1.0.3/try_parse_range.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/types.d.ts +23 -4
- package/types/deps/jsr.io/@std/semver/1.0.3/types.d.ts.map +1 -0
- package/types/nodeinfo/types.d.ts +1 -1
- package/types/nodeinfo/types.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/semver/0.224.3/_constants.js +0 -10
- package/esm/deps/jsr.io/@std/semver/0.224.3/compare.js +0 -35
- package/esm/deps/jsr.io/@std/semver/0.224.3/constants.js +0 -71
- package/esm/deps/jsr.io/@std/semver/0.224.3/difference.js +0 -37
- package/esm/deps/jsr.io/@std/semver/0.224.3/equals.js +0 -27
- package/esm/deps/jsr.io/@std/semver/0.224.3/format.js +0 -48
- package/esm/deps/jsr.io/@std/semver/0.224.3/greater_or_equal.js +0 -25
- package/esm/deps/jsr.io/@std/semver/0.224.3/greater_than.js +0 -27
- package/esm/deps/jsr.io/@std/semver/0.224.3/less_or_equal.js +0 -25
- package/esm/deps/jsr.io/@std/semver/0.224.3/less_than.js +0 -25
- package/esm/deps/jsr.io/@std/semver/0.224.3/not_equals.js +0 -24
- package/esm/deps/jsr.io/@std/semver/0.224.3/parse.js +0 -50
- package/esm/deps/jsr.io/@std/semver/0.224.3/range_max.js +0 -77
- package/esm/deps/jsr.io/@std/semver/0.224.3/range_min.js +0 -68
- package/esm/deps/jsr.io/@std/semver/0.224.3/test_range.js +0 -28
- package/types/deps/jsr.io/@std/encoding/0.224.3/_validate_binary_like.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/encoding/0.224.3/base64.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/encoding/0.224.3/base64url.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/encoding/0.224.3/hex.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/http/0.224.5/_negotiation/common.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/http/0.224.5/_negotiation/encoding.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/http/0.224.5/_negotiation/language.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/http/0.224.5/_negotiation/media_type.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/http/0.224.5/negotiation.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/_constants.d.ts +0 -2
- package/types/deps/jsr.io/@std/semver/0.224.3/_constants.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/_shared.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/_test_comparator_set.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/can_parse.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/compare.d.ts +0 -28
- package/types/deps/jsr.io/@std/semver/0.224.3/compare.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/constants.d.ts +0 -43
- package/types/deps/jsr.io/@std/semver/0.224.3/constants.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/difference.d.ts +0 -27
- package/types/deps/jsr.io/@std/semver/0.224.3/difference.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/equals.d.ts +0 -24
- package/types/deps/jsr.io/@std/semver/0.224.3/equals.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/format.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/format_range.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/greater_or_equal.d.ts +0 -24
- package/types/deps/jsr.io/@std/semver/0.224.3/greater_or_equal.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/greater_than.d.ts +0 -24
- package/types/deps/jsr.io/@std/semver/0.224.3/greater_than.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/greater_than_range.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/increment.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/is_range.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/is_semver.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/less_or_equal.d.ts +0 -24
- package/types/deps/jsr.io/@std/semver/0.224.3/less_or_equal.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/less_than.d.ts +0 -24
- package/types/deps/jsr.io/@std/semver/0.224.3/less_than.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/less_than_range.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/max_satisfying.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/min_satisfying.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/not_equals.d.ts +0 -23
- package/types/deps/jsr.io/@std/semver/0.224.3/not_equals.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/parse.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/parse_range.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/range_intersects.d.ts +0 -24
- package/types/deps/jsr.io/@std/semver/0.224.3/range_intersects.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/range_max.d.ts +0 -25
- package/types/deps/jsr.io/@std/semver/0.224.3/range_max.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/range_min.d.ts +0 -25
- package/types/deps/jsr.io/@std/semver/0.224.3/range_min.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/satisfies.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/test_range.d.ts +0 -27
- package/types/deps/jsr.io/@std/semver/0.224.3/test_range.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/try_parse.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/try_parse_range.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/semver/0.224.3/types.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/common.js +0 -0
- /package/esm/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/negotiation.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/_test_comparator_set.js +0 -0
- /package/esm/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/types.js +0 -0
- /package/types/deps/jsr.io/@std/encoding/{0.224.3 → 1.0.5}/_validate_binary_like.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/encoding.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/language.d.ts +0 -0
- /package/types/deps/jsr.io/@std/http/{0.224.5 → 1.0.6}/_negotiation/media_type.d.ts +0 -0
- /package/types/deps/jsr.io/@std/semver/{0.224.3 → 1.0.3}/_shared.d.ts +0 -0
- /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(`
|
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
|
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
|
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
|
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
|
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
|
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
|
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(
|
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
|
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 <
|
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
|
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,
|
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,
|
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]
|
98
|
-
(p.params[key]
|
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
|
118
|
-
(priority.q
|
119
|
-
(priority.o
|
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("
|
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
|
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(
|
19
|
+
export function canParse(value) {
|
20
20
|
try {
|
21
|
-
parse(
|
21
|
+
parse(value);
|
22
22
|
return true;
|
23
23
|
}
|
24
|
-
catch
|
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
|
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
|
12
|
+
* import { assert } from "@std/assert";
|
13
13
|
*
|
14
|
-
* const
|
15
|
-
* const
|
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
|
-
*
|
18
|
-
* assert(greaterThanRange(
|
17
|
+
*
|
18
|
+
* assert(!greaterThanRange(version1, range));
|
19
|
+
* assert(greaterThanRange(version2, range));
|
19
20
|
* ```
|
20
21
|
*
|
21
|
-
* @param
|
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(
|
26
|
-
return range.every((comparatorSet) => greaterThanComparatorSet(
|
26
|
+
export function greaterThanRange(version, range) {
|
27
|
+
return range.every((comparatorSet) => greaterThanComparatorSet(version, comparatorSet));
|
27
28
|
}
|
28
|
-
function greaterThanComparatorSet(
|
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(
|
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(
|
37
|
+
if (comparatorSet.some((comparator) => lessThanComparator(version, comparator)))
|
37
38
|
return false;
|
38
39
|
return true;
|
39
40
|
}
|
40
|
-
function lessThanComparator(
|
41
|
-
const cmp = compare(
|
41
|
+
function lessThanComparator(version, comparator) {
|
42
|
+
const cmp = compare(version, comparator);
|
42
43
|
switch (comparator.operator) {
|
43
44
|
case "=":
|
44
45
|
case undefined:
|