@fedify/vocab-runtime 2.0.0-dev.1908 → 2.0.0-dev.196

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 (46) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -1
  3. package/deno.json +7 -1
  4. package/dist/chunk-DWy1uDak.cjs +39 -0
  5. package/dist/docloader.test.cjs +5851 -0
  6. package/dist/docloader.test.d.cts +1 -0
  7. package/dist/docloader.test.d.ts +1 -0
  8. package/dist/docloader.test.js +5877 -0
  9. package/dist/key.test.cjs +272 -0
  10. package/dist/key.test.d.cts +1 -0
  11. package/dist/key.test.d.ts +1 -0
  12. package/dist/key.test.js +271 -0
  13. package/dist/langstr.test.cjs +51 -0
  14. package/dist/langstr.test.d.cts +1 -0
  15. package/dist/langstr.test.d.ts +1 -0
  16. package/dist/langstr.test.js +50 -0
  17. package/dist/link-CdFPEo9O.cjs +189 -0
  18. package/dist/link-Ck2yj4dH.js +183 -0
  19. package/dist/link.test.cjs +56 -0
  20. package/dist/link.test.d.cts +1 -0
  21. package/dist/link.test.d.ts +1 -0
  22. package/dist/link.test.js +55 -0
  23. package/dist/mod.cjs +102 -63
  24. package/dist/mod.js +102 -63
  25. package/dist/multibase/multibase.test.cjs +346 -0
  26. package/dist/multibase/multibase.test.d.cts +1 -0
  27. package/dist/multibase/multibase.test.d.ts +1 -0
  28. package/dist/multibase/multibase.test.js +345 -0
  29. package/dist/multibase-BFbBiaPE.cjs +347 -0
  30. package/dist/multibase-DStmqni9.js +311 -0
  31. package/dist/request-BPQb2VYj.cjs +138 -0
  32. package/dist/request-SuYiIZUu.js +108 -0
  33. package/dist/request.test.cjs +44 -0
  34. package/dist/request.test.d.cts +1 -0
  35. package/dist/request.test.d.ts +1 -0
  36. package/dist/request.test.js +43 -0
  37. package/dist/url-C5Vs9nYh.cjs +93 -0
  38. package/dist/url-fW_DHbih.js +63 -0
  39. package/dist/url.test.cjs +37 -0
  40. package/dist/url.test.d.cts +1 -0
  41. package/dist/url.test.d.ts +1 -0
  42. package/dist/url.test.js +36 -0
  43. package/package.json +4 -3
  44. package/src/docloader.test.ts +29 -1
  45. package/src/docloader.ts +101 -45
  46. package/tsdown.config.ts +18 -7
@@ -0,0 +1,346 @@
1
+ const require_chunk = require('../chunk-DWy1uDak.cjs');
2
+ const require_multibase = require('../multibase-BFbBiaPE.cjs');
3
+ const node_assert = require_chunk.__toESM(require("node:assert"));
4
+ const node_test = require_chunk.__toESM(require("node:test"));
5
+
6
+ //#region src/multibase/multibase.test.ts
7
+ (0, node_test.test)("multibase.encode and decode", async (t) => {
8
+ const testCases = [
9
+ [
10
+ "base16",
11
+ require_multibase.decodeText(Uint8Array.from([1])),
12
+ "f01"
13
+ ],
14
+ [
15
+ "base16",
16
+ require_multibase.decodeText(Uint8Array.from([15])),
17
+ "f0f"
18
+ ],
19
+ [
20
+ "base16",
21
+ "f",
22
+ "f66"
23
+ ],
24
+ [
25
+ "base16",
26
+ "fo",
27
+ "f666f"
28
+ ],
29
+ [
30
+ "base16",
31
+ "foo",
32
+ "f666f6f"
33
+ ],
34
+ [
35
+ "base16",
36
+ "foob",
37
+ "f666f6f62"
38
+ ],
39
+ [
40
+ "base16",
41
+ "fooba",
42
+ "f666f6f6261"
43
+ ],
44
+ [
45
+ "base16",
46
+ "foobar",
47
+ "f666f6f626172"
48
+ ],
49
+ [
50
+ "base32",
51
+ "yes mani !",
52
+ "bpfsxgidnmfxgsibb"
53
+ ],
54
+ [
55
+ "base32",
56
+ "f",
57
+ "bmy"
58
+ ],
59
+ [
60
+ "base32",
61
+ "fo",
62
+ "bmzxq"
63
+ ],
64
+ [
65
+ "base32",
66
+ "foo",
67
+ "bmzxw6"
68
+ ],
69
+ [
70
+ "base32",
71
+ "foob",
72
+ "bmzxw6yq"
73
+ ],
74
+ [
75
+ "base32",
76
+ "fooba",
77
+ "bmzxw6ytb"
78
+ ],
79
+ [
80
+ "base32",
81
+ "foobar",
82
+ "bmzxw6ytboi"
83
+ ],
84
+ [
85
+ "base32pad",
86
+ "yes mani !",
87
+ "cpfsxgidnmfxgsibb"
88
+ ],
89
+ [
90
+ "base32pad",
91
+ "f",
92
+ "cmy======"
93
+ ],
94
+ [
95
+ "base32pad",
96
+ "fo",
97
+ "cmzxq===="
98
+ ],
99
+ [
100
+ "base32pad",
101
+ "foo",
102
+ "cmzxw6==="
103
+ ],
104
+ [
105
+ "base32pad",
106
+ "foob",
107
+ "cmzxw6yq="
108
+ ],
109
+ [
110
+ "base32pad",
111
+ "fooba",
112
+ "cmzxw6ytb"
113
+ ],
114
+ [
115
+ "base32pad",
116
+ "foobar",
117
+ "cmzxw6ytboi======"
118
+ ],
119
+ [
120
+ "base32hex",
121
+ "yes mani !",
122
+ "vf5in683dc5n6i811"
123
+ ],
124
+ [
125
+ "base32hex",
126
+ "f",
127
+ "vco"
128
+ ],
129
+ [
130
+ "base32hex",
131
+ "fo",
132
+ "vcpng"
133
+ ],
134
+ [
135
+ "base32hex",
136
+ "foo",
137
+ "vcpnmu"
138
+ ],
139
+ [
140
+ "base32hex",
141
+ "foob",
142
+ "vcpnmuog"
143
+ ],
144
+ [
145
+ "base32hex",
146
+ "fooba",
147
+ "vcpnmuoj1"
148
+ ],
149
+ [
150
+ "base32hex",
151
+ "foobar",
152
+ "vcpnmuoj1e8"
153
+ ],
154
+ [
155
+ "base32hexpad",
156
+ "yes mani !",
157
+ "tf5in683dc5n6i811"
158
+ ],
159
+ [
160
+ "base32hexpad",
161
+ "f",
162
+ "tco======"
163
+ ],
164
+ [
165
+ "base32hexpad",
166
+ "fo",
167
+ "tcpng===="
168
+ ],
169
+ [
170
+ "base32hexpad",
171
+ "foo",
172
+ "tcpnmu==="
173
+ ],
174
+ [
175
+ "base32hexpad",
176
+ "foob",
177
+ "tcpnmuog="
178
+ ],
179
+ [
180
+ "base32hexpad",
181
+ "fooba",
182
+ "tcpnmuoj1"
183
+ ],
184
+ [
185
+ "base32hexpad",
186
+ "foobar",
187
+ "tcpnmuoj1e8======"
188
+ ],
189
+ [
190
+ "base32z",
191
+ "yes mani !",
192
+ "hxf1zgedpcfzg1ebb"
193
+ ],
194
+ [
195
+ "base58flickr",
196
+ "yes mani !",
197
+ "Z7Pznk19XTTzBtx"
198
+ ],
199
+ [
200
+ "base58btc",
201
+ "yes mani !",
202
+ "z7paNL19xttacUY"
203
+ ],
204
+ [
205
+ "base64",
206
+ "÷ïÿ",
207
+ "mw7fDr8O/"
208
+ ],
209
+ [
210
+ "base64",
211
+ "f",
212
+ "mZg"
213
+ ],
214
+ [
215
+ "base64",
216
+ "fo",
217
+ "mZm8"
218
+ ],
219
+ [
220
+ "base64",
221
+ "foo",
222
+ "mZm9v"
223
+ ],
224
+ [
225
+ "base64",
226
+ "foob",
227
+ "mZm9vYg"
228
+ ],
229
+ [
230
+ "base64",
231
+ "fooba",
232
+ "mZm9vYmE"
233
+ ],
234
+ [
235
+ "base64",
236
+ "foobar",
237
+ "mZm9vYmFy"
238
+ ],
239
+ [
240
+ "base64",
241
+ "÷ïÿ🥰÷ïÿ😎🥶🤯",
242
+ "mw7fDr8O/8J+lsMO3w6/Dv/CfmI7wn6W28J+krw"
243
+ ],
244
+ [
245
+ "base64pad",
246
+ "f",
247
+ "MZg=="
248
+ ],
249
+ [
250
+ "base64pad",
251
+ "fo",
252
+ "MZm8="
253
+ ],
254
+ [
255
+ "base64pad",
256
+ "foo",
257
+ "MZm9v"
258
+ ],
259
+ [
260
+ "base64pad",
261
+ "foob",
262
+ "MZm9vYg=="
263
+ ],
264
+ [
265
+ "base64pad",
266
+ "fooba",
267
+ "MZm9vYmE="
268
+ ],
269
+ [
270
+ "base64pad",
271
+ "foobar",
272
+ "MZm9vYmFy"
273
+ ],
274
+ [
275
+ "base64url",
276
+ "÷ïÿ",
277
+ "uw7fDr8O_"
278
+ ],
279
+ [
280
+ "base64url",
281
+ "÷ïÿ🥰÷ïÿ😎🥶🤯",
282
+ "uw7fDr8O_8J-lsMO3w6_Dv_CfmI7wn6W28J-krw"
283
+ ],
284
+ [
285
+ "base64urlpad",
286
+ "f",
287
+ "UZg=="
288
+ ],
289
+ [
290
+ "base64urlpad",
291
+ "fo",
292
+ "UZm8="
293
+ ],
294
+ [
295
+ "base64urlpad",
296
+ "foo",
297
+ "UZm9v"
298
+ ],
299
+ [
300
+ "base64urlpad",
301
+ "foob",
302
+ "UZm9vYg=="
303
+ ],
304
+ [
305
+ "base64urlpad",
306
+ "fooba",
307
+ "UZm9vYmE="
308
+ ],
309
+ [
310
+ "base64urlpad",
311
+ "foobar",
312
+ "UZm9vYmFy"
313
+ ],
314
+ [
315
+ "base64urlpad",
316
+ "÷ïÿ🥰÷ïÿ😎🥶🤯",
317
+ "Uw7fDr8O_8J-lsMO3w6_Dv_CfmI7wn6W28J-krw=="
318
+ ]
319
+ ];
320
+ for (const [name, input, expectedOutput] of testCases) await t.test(`Encoding/Decoding ${name} with ${input}`, () => {
321
+ const encoded = require_multibase.encodeMultibase(name, require_multibase.encodeText(input));
322
+ (0, node_assert.deepStrictEqual)(require_multibase.decodeText(encoded), expectedOutput, `Encoding ${name} failed`);
323
+ const decoded = require_multibase.decodeMultibase(expectedOutput);
324
+ (0, node_assert.deepStrictEqual)(decoded, require_multibase.encodeText(input), `Decoding ${name} failed`);
325
+ const decodedFromBuffer = require_multibase.decodeMultibase(require_multibase.encodeText(expectedOutput));
326
+ (0, node_assert.deepStrictEqual)(decodedFromBuffer, require_multibase.encodeText(input), `Decoding buffer of ${name} failed`);
327
+ });
328
+ await t.test("should allow base32pad full alphabet", () => {
329
+ const encodedStr = "ctimaq4ygg2iegci7";
330
+ const decoded = require_multibase.decodeMultibase(encodedStr);
331
+ const encoded = require_multibase.encodeMultibase("c", decoded);
332
+ (0, node_assert.deepStrictEqual)(require_multibase.decodeMultibase(encoded), decoded);
333
+ });
334
+ });
335
+ (0, node_test.test)("constants", async (t) => {
336
+ await t.test("constants indexed by name", () => {
337
+ const names$1 = require_multibase.names;
338
+ (0, node_assert.deepStrictEqual)(Object.keys(names$1).length, 23);
339
+ });
340
+ await t.test("constants indexed by code", () => {
341
+ const codes$1 = require_multibase.codes;
342
+ (0, node_assert.deepStrictEqual)(Object.keys(codes$1).length, 23);
343
+ });
344
+ });
345
+
346
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,345 @@
1
+ import { codes, decodeMultibase, decodeText, encodeMultibase, encodeText, names } from "../multibase-DStmqni9.js";
2
+ import { deepStrictEqual } from "node:assert";
3
+ import { test } from "node:test";
4
+
5
+ //#region src/multibase/multibase.test.ts
6
+ test("multibase.encode and decode", async (t) => {
7
+ const testCases = [
8
+ [
9
+ "base16",
10
+ decodeText(Uint8Array.from([1])),
11
+ "f01"
12
+ ],
13
+ [
14
+ "base16",
15
+ decodeText(Uint8Array.from([15])),
16
+ "f0f"
17
+ ],
18
+ [
19
+ "base16",
20
+ "f",
21
+ "f66"
22
+ ],
23
+ [
24
+ "base16",
25
+ "fo",
26
+ "f666f"
27
+ ],
28
+ [
29
+ "base16",
30
+ "foo",
31
+ "f666f6f"
32
+ ],
33
+ [
34
+ "base16",
35
+ "foob",
36
+ "f666f6f62"
37
+ ],
38
+ [
39
+ "base16",
40
+ "fooba",
41
+ "f666f6f6261"
42
+ ],
43
+ [
44
+ "base16",
45
+ "foobar",
46
+ "f666f6f626172"
47
+ ],
48
+ [
49
+ "base32",
50
+ "yes mani !",
51
+ "bpfsxgidnmfxgsibb"
52
+ ],
53
+ [
54
+ "base32",
55
+ "f",
56
+ "bmy"
57
+ ],
58
+ [
59
+ "base32",
60
+ "fo",
61
+ "bmzxq"
62
+ ],
63
+ [
64
+ "base32",
65
+ "foo",
66
+ "bmzxw6"
67
+ ],
68
+ [
69
+ "base32",
70
+ "foob",
71
+ "bmzxw6yq"
72
+ ],
73
+ [
74
+ "base32",
75
+ "fooba",
76
+ "bmzxw6ytb"
77
+ ],
78
+ [
79
+ "base32",
80
+ "foobar",
81
+ "bmzxw6ytboi"
82
+ ],
83
+ [
84
+ "base32pad",
85
+ "yes mani !",
86
+ "cpfsxgidnmfxgsibb"
87
+ ],
88
+ [
89
+ "base32pad",
90
+ "f",
91
+ "cmy======"
92
+ ],
93
+ [
94
+ "base32pad",
95
+ "fo",
96
+ "cmzxq===="
97
+ ],
98
+ [
99
+ "base32pad",
100
+ "foo",
101
+ "cmzxw6==="
102
+ ],
103
+ [
104
+ "base32pad",
105
+ "foob",
106
+ "cmzxw6yq="
107
+ ],
108
+ [
109
+ "base32pad",
110
+ "fooba",
111
+ "cmzxw6ytb"
112
+ ],
113
+ [
114
+ "base32pad",
115
+ "foobar",
116
+ "cmzxw6ytboi======"
117
+ ],
118
+ [
119
+ "base32hex",
120
+ "yes mani !",
121
+ "vf5in683dc5n6i811"
122
+ ],
123
+ [
124
+ "base32hex",
125
+ "f",
126
+ "vco"
127
+ ],
128
+ [
129
+ "base32hex",
130
+ "fo",
131
+ "vcpng"
132
+ ],
133
+ [
134
+ "base32hex",
135
+ "foo",
136
+ "vcpnmu"
137
+ ],
138
+ [
139
+ "base32hex",
140
+ "foob",
141
+ "vcpnmuog"
142
+ ],
143
+ [
144
+ "base32hex",
145
+ "fooba",
146
+ "vcpnmuoj1"
147
+ ],
148
+ [
149
+ "base32hex",
150
+ "foobar",
151
+ "vcpnmuoj1e8"
152
+ ],
153
+ [
154
+ "base32hexpad",
155
+ "yes mani !",
156
+ "tf5in683dc5n6i811"
157
+ ],
158
+ [
159
+ "base32hexpad",
160
+ "f",
161
+ "tco======"
162
+ ],
163
+ [
164
+ "base32hexpad",
165
+ "fo",
166
+ "tcpng===="
167
+ ],
168
+ [
169
+ "base32hexpad",
170
+ "foo",
171
+ "tcpnmu==="
172
+ ],
173
+ [
174
+ "base32hexpad",
175
+ "foob",
176
+ "tcpnmuog="
177
+ ],
178
+ [
179
+ "base32hexpad",
180
+ "fooba",
181
+ "tcpnmuoj1"
182
+ ],
183
+ [
184
+ "base32hexpad",
185
+ "foobar",
186
+ "tcpnmuoj1e8======"
187
+ ],
188
+ [
189
+ "base32z",
190
+ "yes mani !",
191
+ "hxf1zgedpcfzg1ebb"
192
+ ],
193
+ [
194
+ "base58flickr",
195
+ "yes mani !",
196
+ "Z7Pznk19XTTzBtx"
197
+ ],
198
+ [
199
+ "base58btc",
200
+ "yes mani !",
201
+ "z7paNL19xttacUY"
202
+ ],
203
+ [
204
+ "base64",
205
+ "÷ïÿ",
206
+ "mw7fDr8O/"
207
+ ],
208
+ [
209
+ "base64",
210
+ "f",
211
+ "mZg"
212
+ ],
213
+ [
214
+ "base64",
215
+ "fo",
216
+ "mZm8"
217
+ ],
218
+ [
219
+ "base64",
220
+ "foo",
221
+ "mZm9v"
222
+ ],
223
+ [
224
+ "base64",
225
+ "foob",
226
+ "mZm9vYg"
227
+ ],
228
+ [
229
+ "base64",
230
+ "fooba",
231
+ "mZm9vYmE"
232
+ ],
233
+ [
234
+ "base64",
235
+ "foobar",
236
+ "mZm9vYmFy"
237
+ ],
238
+ [
239
+ "base64",
240
+ "÷ïÿ🥰÷ïÿ😎🥶🤯",
241
+ "mw7fDr8O/8J+lsMO3w6/Dv/CfmI7wn6W28J+krw"
242
+ ],
243
+ [
244
+ "base64pad",
245
+ "f",
246
+ "MZg=="
247
+ ],
248
+ [
249
+ "base64pad",
250
+ "fo",
251
+ "MZm8="
252
+ ],
253
+ [
254
+ "base64pad",
255
+ "foo",
256
+ "MZm9v"
257
+ ],
258
+ [
259
+ "base64pad",
260
+ "foob",
261
+ "MZm9vYg=="
262
+ ],
263
+ [
264
+ "base64pad",
265
+ "fooba",
266
+ "MZm9vYmE="
267
+ ],
268
+ [
269
+ "base64pad",
270
+ "foobar",
271
+ "MZm9vYmFy"
272
+ ],
273
+ [
274
+ "base64url",
275
+ "÷ïÿ",
276
+ "uw7fDr8O_"
277
+ ],
278
+ [
279
+ "base64url",
280
+ "÷ïÿ🥰÷ïÿ😎🥶🤯",
281
+ "uw7fDr8O_8J-lsMO3w6_Dv_CfmI7wn6W28J-krw"
282
+ ],
283
+ [
284
+ "base64urlpad",
285
+ "f",
286
+ "UZg=="
287
+ ],
288
+ [
289
+ "base64urlpad",
290
+ "fo",
291
+ "UZm8="
292
+ ],
293
+ [
294
+ "base64urlpad",
295
+ "foo",
296
+ "UZm9v"
297
+ ],
298
+ [
299
+ "base64urlpad",
300
+ "foob",
301
+ "UZm9vYg=="
302
+ ],
303
+ [
304
+ "base64urlpad",
305
+ "fooba",
306
+ "UZm9vYmE="
307
+ ],
308
+ [
309
+ "base64urlpad",
310
+ "foobar",
311
+ "UZm9vYmFy"
312
+ ],
313
+ [
314
+ "base64urlpad",
315
+ "÷ïÿ🥰÷ïÿ😎🥶🤯",
316
+ "Uw7fDr8O_8J-lsMO3w6_Dv_CfmI7wn6W28J-krw=="
317
+ ]
318
+ ];
319
+ for (const [name, input, expectedOutput] of testCases) await t.test(`Encoding/Decoding ${name} with ${input}`, () => {
320
+ const encoded = encodeMultibase(name, encodeText(input));
321
+ deepStrictEqual(decodeText(encoded), expectedOutput, `Encoding ${name} failed`);
322
+ const decoded = decodeMultibase(expectedOutput);
323
+ deepStrictEqual(decoded, encodeText(input), `Decoding ${name} failed`);
324
+ const decodedFromBuffer = decodeMultibase(encodeText(expectedOutput));
325
+ deepStrictEqual(decodedFromBuffer, encodeText(input), `Decoding buffer of ${name} failed`);
326
+ });
327
+ await t.test("should allow base32pad full alphabet", () => {
328
+ const encodedStr = "ctimaq4ygg2iegci7";
329
+ const decoded = decodeMultibase(encodedStr);
330
+ const encoded = encodeMultibase("c", decoded);
331
+ deepStrictEqual(decodeMultibase(encoded), decoded);
332
+ });
333
+ });
334
+ test("constants", async (t) => {
335
+ await t.test("constants indexed by name", () => {
336
+ const names$1 = names;
337
+ deepStrictEqual(Object.keys(names$1).length, 23);
338
+ });
339
+ await t.test("constants indexed by code", () => {
340
+ const codes$1 = codes;
341
+ deepStrictEqual(Object.keys(codes$1).length, 23);
342
+ });
343
+ });
344
+
345
+ //#endregion