@fedify/vocab-runtime 2.2.0-dev.613 → 2.2.0-dev.628

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 (56) hide show
  1. package/deno.json +1 -1
  2. package/dist/{chunk-CUT6urMc.cjs → chunk-CKQMccvm.cjs} +7 -9
  3. package/dist/jsonld.cjs +4 -5
  4. package/dist/jsonld.d.cts +3 -4
  5. package/dist/jsonld.d.ts +2 -2
  6. package/dist/jsonld.js +1 -3
  7. package/dist/mod.cjs +80 -170
  8. package/dist/mod.d.cts +1 -2
  9. package/dist/mod.d.ts +1 -2
  10. package/dist/mod.js +56 -149
  11. package/dist/tests/{chunk-DWy1uDak.cjs → chunk-Do9eywBl.cjs} +13 -17
  12. package/dist/tests/decimal.test.cjs +12 -21
  13. package/dist/tests/{decimal.test.js → decimal.test.mjs} +10 -18
  14. package/dist/tests/{docloader-DEi540Xh.js → docloader-OyxWpw3H.mjs} +35 -65
  15. package/dist/tests/{docloader-txRGFv1x.cjs → docloader-qks_ixwW.cjs} +51 -81
  16. package/dist/tests/docloader.test.cjs +53 -90
  17. package/dist/tests/{docloader.test.js → docloader.test.mjs} +53 -96
  18. package/dist/tests/internal/multicodec.test.cjs +5 -7
  19. package/dist/tests/internal/{multicodec.test.js → multicodec.test.mjs} +3 -4
  20. package/dist/tests/{key-ByCmSI2y.js → key-BeTHFQJK.mjs} +14 -25
  21. package/dist/tests/{key-CCPn6TEY.cjs → key-DTTIntwb.cjs} +60 -71
  22. package/dist/tests/key.test.cjs +23 -45
  23. package/dist/tests/{key.test.js → key.test.mjs} +21 -42
  24. package/dist/tests/{langstr-EPh86hXK.cjs → langstr-CbAxaeEZ.cjs} +6 -8
  25. package/dist/tests/{langstr-BsVE3s9u.js → langstr-Di5AvKpB.mjs} +1 -2
  26. package/dist/tests/langstr.test.cjs +7 -8
  27. package/dist/tests/{langstr.test.js → langstr.test.mjs} +3 -4
  28. package/dist/tests/{link-DYNFAdNu.cjs → link-FguCydMA.cjs} +6 -8
  29. package/dist/tests/{link-C3q2TC2G.js → link-NUUWCdnK.mjs} +1 -2
  30. package/dist/tests/link.test.cjs +5 -7
  31. package/dist/tests/{link.test.js → link.test.mjs} +3 -4
  32. package/dist/tests/multibase/multibase.test.cjs +10 -17
  33. package/dist/tests/multibase/{multibase.test.js → multibase.test.mjs} +10 -18
  34. package/dist/tests/{multibase-B4g8pz6F.js → multibase-BgU9XRf7.mjs} +5 -12
  35. package/dist/tests/{multibase-o_ovPHYJ.cjs → multibase-F7LtMMsK.cjs} +43 -49
  36. package/dist/tests/{multicodec--6hQ74zI.cjs → multicodec-CxGVGa91.cjs} +16 -18
  37. package/dist/tests/{multicodec-Dq3IiOV4.js → multicodec-CyFp54fI.mjs} +1 -2
  38. package/dist/tests/{request-BO6hGoBJ.js → request-Cx6B4KEl.mjs} +4 -45
  39. package/dist/tests/{request-73FIhAHw.cjs → request-D1_g3-fs.cjs} +38 -72
  40. package/dist/tests/request.test.cjs +23 -24
  41. package/dist/tests/request.test.mjs +42 -0
  42. package/dist/tests/{url-CWEP9Zs9.js → url-BQ_kgmCk.mjs} +3 -7
  43. package/dist/tests/{url-DIjOdK8Q.cjs → url-pFuSds44.cjs} +31 -35
  44. package/dist/tests/url.test.cjs +5 -7
  45. package/dist/tests/{url.test.js → url.test.mjs} +3 -4
  46. package/package.json +3 -3
  47. package/dist/tests/request.test.js +0 -43
  48. /package/dist/tests/{decimal.test.d.ts → decimal.test.d.mts} +0 -0
  49. /package/dist/tests/{docloader.test.d.ts → docloader.test.d.mts} +0 -0
  50. /package/dist/tests/internal/{multicodec.test.d.ts → multicodec.test.d.mts} +0 -0
  51. /package/dist/tests/{key.test.d.ts → key.test.d.mts} +0 -0
  52. /package/dist/tests/{langstr.test.d.ts → langstr.test.d.mts} +0 -0
  53. /package/dist/tests/{link.test.d.ts → link.test.d.mts} +0 -0
  54. /package/dist/tests/multibase/{multibase.test.d.ts → multibase.test.d.mts} +0 -0
  55. /package/dist/tests/{request.test.d.ts → request.test.d.mts} +0 -0
  56. /package/dist/tests/{url.test.d.ts → url.test.d.mts} +0 -0
@@ -1,21 +1,16 @@
1
- import { contexts_default, getDocumentLoader } from "./docloader-DEi540Xh.js";
2
- import { FetchError } from "./request-BO6hGoBJ.js";
3
- import "./link-C3q2TC2G.js";
4
- import { UrlError } from "./url-CWEP9Zs9.js";
5
- import "node:module";
1
+ import { n as preloadedContexts, t as getDocumentLoader } from "./docloader-OyxWpw3H.mjs";
2
+ import { t as FetchError } from "./request-Cx6B4KEl.mjs";
3
+ import { t as UrlError } from "./url-BQ_kgmCk.mjs";
6
4
  import { deepStrictEqual, ok, rejects } from "node:assert";
7
5
  import { test } from "node:test";
8
-
9
- //#region rolldown:runtime
6
+ //#region \0rolldown/runtime.js
10
7
  var __create = Object.create;
11
8
  var __defProp = Object.defineProperty;
12
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
14
11
  var __getProtoOf = Object.getPrototypeOf;
15
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __commonJS = (cb, mod) => function() {
17
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
- };
13
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
14
  var __copyProps = (to, from, except, desc) => {
20
15
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
21
16
  key = keys[i];
@@ -30,13 +25,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
25
  value: mod,
31
26
  enumerable: true
32
27
  }) : target, mod));
33
-
34
28
  //#endregion
35
- //#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
36
- var require_glob_to_regexp = __commonJS({ "../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js"(exports, module) {
37
- module.exports = function(glob$1, opts) {
38
- if (typeof glob$1 !== "string") throw new TypeError("Expected a string");
39
- var str = String(glob$1);
29
+ //#region ../../node_modules/.pnpm/regexparam@3.0.0/node_modules/regexparam/dist/index.mjs
30
+ var import_glob_to_regexp = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
31
+ module.exports = function(glob, opts) {
32
+ if (typeof glob !== "string") throw new TypeError("Expected a string");
33
+ var str = String(glob);
40
34
  var reStr = "";
41
35
  var extended = opts ? !!opts.extended : false;
42
36
  var globstar = opts ? !!opts.globstar : false;
@@ -93,13 +87,10 @@ var require_glob_to_regexp = __commonJS({ "../../node_modules/.pnpm/glob-to-rege
93
87
  }
94
88
  var nextChar = str[i + 1];
95
89
  if (!globstar) reStr += ".*";
96
- else {
97
- var isGlobstar = starCount > 1 && (prevChar === "/" || prevChar === void 0) && (nextChar === "/" || nextChar === void 0);
98
- if (isGlobstar) {
99
- reStr += "((?:[^/]*(?:/|$))*)";
100
- i++;
101
- } else reStr += "([^/]*)";
102
- }
90
+ else if (starCount > 1 && (prevChar === "/" || prevChar === void 0) && (nextChar === "/" || nextChar === void 0)) {
91
+ reStr += "((?:[^/]*(?:/|$))*)";
92
+ i++;
93
+ } else reStr += "([^/]*)";
103
94
  break;
104
95
  default: reStr += c;
105
96
  }
@@ -107,10 +98,7 @@ var require_glob_to_regexp = __commonJS({ "../../node_modules/.pnpm/glob-to-rege
107
98
  if (!flags || !~flags.indexOf("g")) reStr = "^" + reStr + "$";
108
99
  return new RegExp(reStr, flags);
109
100
  };
110
- } });
111
-
112
- //#endregion
113
- //#region ../../node_modules/.pnpm/regexparam@3.0.0/node_modules/regexparam/dist/index.mjs
101
+ })))(), 1);
114
102
  /**
115
103
  * @param {string|RegExp} input The route pattern
116
104
  * @param {boolean} [loose] Allow open-ended matching. Ignored with `RegExp` input.
@@ -140,7 +128,6 @@ function parse(input, loose) {
140
128
  pattern: new RegExp("^" + pattern + (loose ? "(?=$|/)" : "/?$"), "i")
141
129
  };
142
130
  }
143
-
144
131
  //#endregion
145
132
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/TypeDescriptor.js
146
133
  const valueTypes = new Set([
@@ -232,7 +219,6 @@ var TypeDescriptor = class TypeDescriptor {
232
219
  return TypeDescriptor.of(value) === "undefined";
233
220
  }
234
221
  };
235
-
236
222
  //#endregion
237
223
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/IsSubsetOf.js
238
224
  const allowedTypes = new Set([
@@ -259,7 +245,7 @@ const isSubsetOf = function(subset, superset, visited = []) {
259
245
  switch (subsetItemType) {
260
246
  case "array":
261
247
  case "object":
262
- case "function": {
248
+ case "function":
263
249
  if (visited.includes(subsetItem)) continue;
264
250
  visited.push(subsetItem);
265
251
  isItemInSuperset = superset.some((supersetItem) => {
@@ -270,7 +256,6 @@ const isSubsetOf = function(subset, superset, visited = []) {
270
256
  }
271
257
  });
272
258
  break;
273
- }
274
259
  default: isItemInSuperset = superset.includes(subsetItem);
275
260
  }
276
261
  if (!isItemInSuperset) return false;
@@ -282,21 +267,18 @@ const isSubsetOf = function(subset, superset, visited = []) {
282
267
  if (Object.keys(subset).length > Object.keys(superset).length) return false;
283
268
  for (const [subsetKey, subsetValue] of Object.entries(subset)) {
284
269
  const supersetValue = superset[subsetKey];
285
- const subsetValueType = TypeDescriptor.of(subsetValue);
286
- switch (subsetValueType) {
270
+ switch (TypeDescriptor.of(subsetValue)) {
287
271
  case "array":
288
272
  case "object":
289
- case "function": {
273
+ case "function":
290
274
  if (visited.includes(subsetValue)) continue;
291
275
  visited.push(subsetValue);
292
276
  try {
293
- const isInSuperset = isSubsetOf(subsetValue, supersetValue, visited);
294
- if (!isInSuperset) return false;
277
+ if (!isSubsetOf(subsetValue, supersetValue, visited)) return false;
295
278
  } catch {
296
279
  return false;
297
280
  }
298
281
  break;
299
- }
300
282
  default: if (subsetValue !== supersetValue) return false;
301
283
  }
302
284
  }
@@ -319,8 +301,7 @@ isSubsetOf.structural = function(subset, superset, visited = []) {
319
301
  if (visited.includes(subsetValue)) continue;
320
302
  visited.push(subsetValue);
321
303
  try {
322
- const isInSuperset = isSubsetOf.structural(subsetValue, supersetValue, visited);
323
- if (!isInSuperset) return false;
304
+ if (!isSubsetOf.structural(subsetValue, supersetValue, visited)) return false;
324
305
  } catch {
325
306
  return false;
326
307
  }
@@ -328,7 +309,6 @@ isSubsetOf.structural = function(subset, superset, visited = []) {
328
309
  }
329
310
  return true;
330
311
  };
331
-
332
312
  //#endregion
333
313
  //#region ../../node_modules/.pnpm/dequal@2.0.3/node_modules/dequal/dist/index.mjs
334
314
  var has = Object.prototype.hasOwnProperty;
@@ -391,11 +371,10 @@ function dequal(foo, bar) {
391
371
  }
392
372
  return foo !== foo && bar !== bar;
393
373
  }
394
-
395
374
  //#endregion
396
375
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/RequestUtils.js
397
- const absoluteUrlRX = new RegExp("^[a-z]+://|^data:", "i");
398
- const protocolRelativeUrlRX = new RegExp("^//", "i");
376
+ const absoluteUrlRX = /* @__PURE__ */ new RegExp("^[a-z]+://|^data:", "i");
377
+ const protocolRelativeUrlRX = /* @__PURE__ */ new RegExp("^//", "i");
399
378
  function hasCredentialsInUrl(url) {
400
379
  const urlObject = new URL(url, !absoluteUrlRX.test(url) ? "http://dummy" : void 0);
401
380
  return Boolean(urlObject.username || urlObject.password);
@@ -443,7 +422,7 @@ async function createCallLogFromRequest(request, options) {
443
422
  } catch {}
444
423
  if (request.headers) derivedOptions.headers = normalizeHeaders(request.headers);
445
424
  const url = normalizeUrl(request.url, true);
446
- const callLog = {
425
+ return {
447
426
  args: [request, options],
448
427
  url,
449
428
  queryParams: new URLSearchParams(getQuery(url)),
@@ -452,11 +431,9 @@ async function createCallLogFromRequest(request, options) {
452
431
  signal: options && options.signal || request.signal,
453
432
  pendingPromises
454
433
  };
455
- return callLog;
456
434
  }
457
435
  function getPath(url) {
458
- const u = absoluteUrlRX.test(url) ? new URL(url) : new URL(url, "http://dummy");
459
- return u.pathname;
436
+ return (absoluteUrlRX.test(url) ? new URL(url) : new URL(url, "http://dummy")).pathname;
460
437
  }
461
438
  function getHost(url) {
462
439
  if (absoluteUrlRX.test(url)) return new URL(url).host;
@@ -474,10 +451,8 @@ function normalizeHeaders(headers) {
474
451
  else entries = Object.entries(headers);
475
452
  return Object.fromEntries(entries.map(([key, val]) => [key.toLowerCase(), String(val).valueOf()]));
476
453
  }
477
-
478
454
  //#endregion
479
455
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Matchers.js
480
- var import_glob_to_regexp = __toESM(require_glob_to_regexp(), 1);
481
456
  const isUrlMatcher = (matcher) => matcher instanceof RegExp || typeof matcher === "string" || typeof matcher === "object" && "href" in matcher;
482
457
  const isFunctionMatcher = (matcher) => typeof matcher === "function";
483
458
  const stringMatchers = {
@@ -531,8 +506,7 @@ const getMissingHeaderMatcher = ({ missingHeaders: expectedMissingHeaders }) =>
531
506
  const getMethodMatcher = ({ method: expectedMethod }) => {
532
507
  if (!expectedMethod) return;
533
508
  return ({ options: { method } = {} }) => {
534
- const actualMethod = method ? method.toLowerCase() : "get";
535
- return expectedMethod === actualMethod;
509
+ return expectedMethod === (method ? method.toLowerCase() : "get");
536
510
  };
537
511
  };
538
512
  const getQueryParamsMatcher = ({ query: passedQuery }) => {
@@ -611,7 +585,7 @@ const getUrlMatcher = (route) => {
611
585
  }
612
586
  if (typeof matcherUrl === "string") {
613
587
  for (const shorthand in stringMatchers) if (matcherUrl.indexOf(`${shorthand}:`) === 0) {
614
- const urlFragment = matcherUrl.replace(/* @__PURE__ */ new RegExp(`^${shorthand}:`), "");
588
+ const urlFragment = matcherUrl.replace(new RegExp(`^${shorthand}:`), "");
615
589
  return stringMatchers[shorthand](urlFragment);
616
590
  }
617
591
  return getFullUrlMatcher(route, matcherUrl, query);
@@ -622,7 +596,7 @@ const getUrlMatcher = (route) => {
622
596
  else if (key in stringMatchers) return stringMatchers[key](pattern);
623
597
  else throw new Error(`unrecognised url matching pattern: ${key}`);
624
598
  });
625
- return (route$1) => matchers.every((matcher) => matcher(route$1));
599
+ return (route) => matchers.every((matcher) => matcher(route));
626
600
  }
627
601
  };
628
602
  const builtInMatchers = [
@@ -660,7 +634,6 @@ const builtInMatchers = [
660
634
  matcher: getFunctionMatcher
661
635
  }
662
636
  ];
663
-
664
637
  //#endregion
665
638
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/StatusTextMap.js
666
639
  const statusTextMap = {
@@ -727,17 +700,15 @@ const statusTextMap = {
727
700
  510: "Not Extended",
728
701
  511: "Network Authentication Required"
729
702
  };
730
- var StatusTextMap_default = statusTextMap;
731
-
732
703
  //#endregion
733
704
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Route.js
734
- var __classPrivateFieldSet = void 0 && (void 0).__classPrivateFieldSet || function(receiver, state, value, kind, f) {
705
+ var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
735
706
  if (kind === "m") throw new TypeError("Private method is not writable");
736
707
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
737
708
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
738
709
  return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
739
710
  };
740
- var __classPrivateFieldGet = void 0 && (void 0).__classPrivateFieldGet || function(receiver, state, kind, f) {
711
+ var __classPrivateFieldGet = function(receiver, state, kind, f) {
741
712
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
742
713
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
743
714
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -798,14 +769,13 @@ var Route = class {
798
769
  constructResponseOptions(responseInput) {
799
770
  const options = responseInput.options || {};
800
771
  options.status = sanitizeStatus(responseInput.status);
801
- options.statusText = StatusTextMap_default[options.status];
772
+ options.statusText = statusTextMap[options.status];
802
773
  options.headers = new this.config.Headers(responseInput.headers);
803
774
  return options;
804
775
  }
805
776
  constructResponseBody(responseInput, responseOptions) {
806
777
  let body = responseInput.body;
807
- const bodyIsBodyInit = isBodyInit(body);
808
- if (!bodyIsBodyInit) if (typeof body === "undefined") body = null;
778
+ if (!isBodyInit(body)) if (typeof body === "undefined") body = null;
809
779
  else if (typeof body === "object") {
810
780
  body = JSON.stringify(body);
811
781
  if (!responseOptions.headers.has("Content-Type")) responseOptions.headers.set("Content-Type", "application/json");
@@ -824,26 +794,25 @@ var Route = class {
824
794
  _a.registeredMatchers.push(matcher);
825
795
  }
826
796
  };
827
- _a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route_instances = /* @__PURE__ */ new WeakSet(), _Route_validate = function _Route_validate$1() {
797
+ _a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route_instances = /* @__PURE__ */ new WeakSet(), _Route_validate = function _Route_validate() {
828
798
  if (["matched", "unmatched"].includes(this.config.name)) throw new Error(`fetch-mock: Routes cannot use the reserved name \`${this.config.name}\``);
829
799
  if (!("response" in this.config)) throw new Error("fetch-mock: Each route must define a response");
830
800
  if (!_a.registeredMatchers.some(({ name }) => name in this.config)) throw new Error("fetch-mock: Each route must specify some criteria for matching calls to fetch. To match all calls use '*'");
831
- }, _Route_sanitize = function _Route_sanitize$1() {
801
+ }, _Route_sanitize = function _Route_sanitize() {
832
802
  if (this.config.method) this.config.method = this.config.method.toLowerCase();
833
- }, _Route_generateMatcher = function _Route_generateMatcher$1() {
803
+ }, _Route_generateMatcher = function _Route_generateMatcher() {
834
804
  const activeMatchers = _a.registeredMatchers.filter(({ name }) => name in this.config).map(({ matcher, usesBody }) => ({
835
805
  matcher: matcher(this.config),
836
806
  usesBody
837
807
  }));
838
808
  this.config.usesBody = activeMatchers.some(({ usesBody }) => usesBody);
839
809
  this.matcher = (normalizedRequest) => activeMatchers.every(({ matcher }) => matcher(normalizedRequest));
840
- }, _Route_limit = function _Route_limit$1() {
810
+ }, _Route_limit = function _Route_limit() {
841
811
  if (!this.config.repeat) return;
842
812
  const originalMatcher = this.matcher;
843
813
  let timesLeft = this.config.repeat;
844
814
  this.matcher = (callLog) => {
845
- const match = timesLeft && originalMatcher(callLog);
846
- if (match) {
815
+ if (timesLeft && originalMatcher(callLog)) {
847
816
  timesLeft--;
848
817
  return true;
849
818
  }
@@ -851,7 +820,7 @@ _a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route
851
820
  this.reset = () => {
852
821
  timesLeft = this.config.repeat;
853
822
  };
854
- }, _Route_delayResponse = function _Route_delayResponse$1() {
823
+ }, _Route_delayResponse = function _Route_delayResponse() {
855
824
  if (this.config.delay) {
856
825
  const { response } = this.config;
857
826
  this.config.response = () => {
@@ -861,8 +830,6 @@ _a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route
861
830
  };
862
831
  Route.registeredMatchers = [];
863
832
  builtInMatchers.forEach(Route.defineMatcher);
864
- var Route_default = Route;
865
-
866
833
  //#endregion
867
834
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Router.js
868
835
  const responseConfigProps = [
@@ -935,8 +902,7 @@ var Router = class {
935
902
  });
936
903
  }
937
904
  if (this.needsToReadBody(request)) options.body = await options.body;
938
- const routesToTry = this.fallbackRoute ? [...this.routes, this.fallbackRoute] : this.routes;
939
- const route = routesToTry.find((route$1) => route$1.matcher(callLog));
905
+ const route = (this.fallbackRoute ? [...this.routes, this.fallbackRoute] : this.routes).find((route) => route.matcher(callLog));
940
906
  if (route) try {
941
907
  callLog.route = route;
942
908
  const { response, responseOptions, responseInput } = await this.generateResponse(callLog);
@@ -991,7 +957,7 @@ var Router = class {
991
957
  else Object.assign(config, matcher);
992
958
  if (typeof response !== "undefined") config.response = response;
993
959
  if (nameOrOptions) Object.assign(config, typeof nameOrOptions === "string" ? nameToOptions(nameOrOptions) : nameOrOptions);
994
- const route = new Route_default({
960
+ const route = new Route({
995
961
  ...this.config,
996
962
  ...config
997
963
  });
@@ -1010,7 +976,7 @@ var Router = class {
1010
976
  }
1011
977
  setFallback(response) {
1012
978
  if (this.fallbackRoute) console.warn("calling fetchMock.catch() twice - are you sure you want to overwrite the previous fallback response");
1013
- this.fallbackRoute = new Route_default({
979
+ this.fallbackRoute = new Route({
1014
980
  matcherFunction: () => true,
1015
981
  response: response || "ok",
1016
982
  ...this.config
@@ -1042,7 +1008,6 @@ var Router = class {
1042
1008
  route.init(newConfig);
1043
1009
  }
1044
1010
  };
1045
-
1046
1011
  //#endregion
1047
1012
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/CallHistory.js
1048
1013
  const isName = (filter) => typeof filter === "string" && /^[\da-zA-Z-]+$/.test(filter) && !["matched", "unmatched"].includes(filter);
@@ -1088,12 +1053,12 @@ var CallHistory = class {
1088
1053
  ...filter,
1089
1054
  ...options || {}
1090
1055
  };
1091
- const { matcher } = new Route_default({
1056
+ const { matcher } = new Route({
1092
1057
  response: "ok",
1093
1058
  ...options
1094
1059
  });
1095
- calls = calls.filter(({ url, options: options$1 }) => {
1096
- return matcher(createCallLogFromUrlAndOptions(url, options$1));
1060
+ calls = calls.filter(({ url, options }) => {
1061
+ return matcher(createCallLogFromUrlAndOptions(url, options));
1097
1062
  });
1098
1063
  return calls;
1099
1064
  }
@@ -1126,8 +1091,6 @@ var CallHistory = class {
1126
1091
  }).every((isDone) => isDone);
1127
1092
  }
1128
1093
  };
1129
- var CallHistory_default = CallHistory;
1130
-
1131
1094
  //#endregion
1132
1095
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/FetchMock.js
1133
1096
  const defaultFetchMockConfig = {
@@ -1149,7 +1112,9 @@ const defineGreedyShorthand = (shorthandOptions) => {
1149
1112
  return this.route("*", response, Object.assign(options || {}, shorthandOptions));
1150
1113
  };
1151
1114
  };
1152
- var FetchMock = class FetchMock {
1115
+ //#endregion
1116
+ //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/index.js
1117
+ var esm_default = new class FetchMock {
1153
1118
  constructor(config, router) {
1154
1119
  this.sticky = defineShorthand({ sticky: true });
1155
1120
  this.once = defineShorthand({ repeat: 1 });
@@ -1190,7 +1155,7 @@ var FetchMock = class FetchMock {
1190
1155
  routes: router ? [...router.routes] : [],
1191
1156
  fallbackRoute: router ? router.fallbackRoute : null
1192
1157
  });
1193
- this.callHistory = new CallHistory_default(this.config, this.router);
1158
+ this.callHistory = new CallHistory(this.config, this.router);
1194
1159
  this.fetchHandler = this.fetchHandler.bind(this);
1195
1160
  Object.assign(this.fetchHandler, { fetchMock: this });
1196
1161
  }
@@ -1215,7 +1180,7 @@ var FetchMock = class FetchMock {
1215
1180
  return this;
1216
1181
  }
1217
1182
  defineMatcher(matcher) {
1218
- Route_default.defineMatcher(matcher);
1183
+ Route.defineMatcher(matcher);
1219
1184
  }
1220
1185
  removeRoutes(options) {
1221
1186
  this.router.removeRoutes(options);
@@ -1257,14 +1222,7 @@ var FetchMock = class FetchMock {
1257
1222
  this.mockGlobal();
1258
1223
  return this.spy();
1259
1224
  }
1260
- };
1261
- const fetchMock = new FetchMock({ ...defaultFetchMockConfig });
1262
- var FetchMock_default = fetchMock;
1263
-
1264
- //#endregion
1265
- //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/index.js
1266
- var esm_default = FetchMock_default;
1267
-
1225
+ }({ ...defaultFetchMockConfig });
1268
1226
  //#endregion
1269
1227
  //#region src/docloader.test.ts
1270
1228
  test("new FetchError()", () => {
@@ -1486,7 +1444,7 @@ test("getDocumentLoader()", async (t) => {
1486
1444
  await rejects(() => fetchDocumentLoader("https://example.com/404"), FetchError, "HTTP 404: https://example.com/404");
1487
1445
  });
1488
1446
  await t.test("preloaded contexts", async () => {
1489
- for (const [url, document] of Object.entries(contexts_default)) deepStrictEqual(await fetchDocumentLoader(url), {
1447
+ for (const [url, document] of Object.entries(preloadedContexts)) deepStrictEqual(await fetchDocumentLoader(url), {
1490
1448
  contextUrl: null,
1491
1449
  documentUrl: url,
1492
1450
  document
@@ -1541,10 +1499,9 @@ test("getDocumentLoader()", async (t) => {
1541
1499
  let redirectAttempts = 0;
1542
1500
  esm_default.get("begin:https://example.com/too-many-redirects/", (cl) => {
1543
1501
  redirectAttempts++;
1544
- const index = Number(cl.url.split("/").at(-1));
1545
1502
  return {
1546
1503
  status: 302,
1547
- headers: { Location: `https://example.com/too-many-redirects/${index + 1}` }
1504
+ headers: { Location: `https://example.com/too-many-redirects/${Number(cl.url.split("/").at(-1)) + 1}` }
1548
1505
  };
1549
1506
  });
1550
1507
  await t.test("too many redirects", async () => {
@@ -1604,5 +1561,5 @@ test("getDocumentLoader()", async (t) => {
1604
1561
  });
1605
1562
  esm_default.hardReset();
1606
1563
  });
1607
-
1608
- //#endregion
1564
+ //#endregion
1565
+ export {};
@@ -1,8 +1,7 @@
1
- const require_chunk = require('../chunk-DWy1uDak.cjs');
2
- const require_multicodec = require('../multicodec--6hQ74zI.cjs');
3
- const node_assert = require_chunk.__toESM(require("node:assert"));
4
- const node_test = require_chunk.__toESM(require("node:test"));
5
-
1
+ require("../chunk-Do9eywBl.cjs");
2
+ const require_multicodec = require("../multicodec-CxGVGa91.cjs");
3
+ let node_assert = require("node:assert");
4
+ let node_test = require("node:test");
6
5
  //#region src/internal/multicodec.test.ts
7
6
  (0, node_test.test)("getMulticodecPrefix() decodes supported multicodec prefixes", () => {
8
7
  (0, node_assert.deepStrictEqual)(require_multicodec.getMulticodecPrefix(Uint8Array.from([
@@ -73,5 +72,4 @@ const node_test = require_chunk.__toESM(require("node:test"));
73
72
  ])), /* @__PURE__ */ new TypeError("Invalid multicodec prefix."));
74
73
  (0, node_assert.throws)(() => require_multicodec.addMulticodecPrefix(-1, Uint8Array.from([0])), /* @__PURE__ */ new TypeError("Invalid multicodec code."));
75
74
  });
76
-
77
- //#endregion
75
+ //#endregion
@@ -1,7 +1,6 @@
1
- import { addMulticodecPrefix, getMulticodecPrefix, removeMulticodecPrefix } from "../multicodec-Dq3IiOV4.js";
1
+ import { n as getMulticodecPrefix, r as removeMulticodecPrefix, t as addMulticodecPrefix } from "../multicodec-CyFp54fI.mjs";
2
2
  import { deepStrictEqual, throws } from "node:assert";
3
3
  import { test } from "node:test";
4
-
5
4
  //#region src/internal/multicodec.test.ts
6
5
  test("getMulticodecPrefix() decodes supported multicodec prefixes", () => {
7
6
  deepStrictEqual(getMulticodecPrefix(Uint8Array.from([
@@ -72,5 +71,5 @@ test("multicodec helpers reject malformed prefixes", () => {
72
71
  ])), /* @__PURE__ */ new TypeError("Invalid multicodec prefix."));
73
72
  throws(() => addMulticodecPrefix(-1, Uint8Array.from([0])), /* @__PURE__ */ new TypeError("Invalid multicodec code."));
74
73
  });
75
-
76
- //#endregion
74
+ //#endregion
75
+ export {};
@@ -1,19 +1,17 @@
1
- import { addMulticodecPrefix, getMulticodecPrefix, removeMulticodecPrefix } from "./multicodec-Dq3IiOV4.js";
2
- import { decodeMultibase, encodeMultibase } from "./multibase-B4g8pz6F.js";
1
+ import { n as getMulticodecPrefix, r as removeMulticodecPrefix, t as addMulticodecPrefix } from "./multicodec-CyFp54fI.mjs";
2
+ import { n as encodeMultibase, t as decodeMultibase } from "./multibase-BgU9XRf7.mjs";
3
3
  import { Integer, Sequence } from "asn1js";
4
4
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
5
5
  import { decodeBase64Url } from "byte-encodings/base64url";
6
6
  import { createPublicKey } from "node:crypto";
7
7
  import { PublicKeyInfo } from "pkijs";
8
-
9
8
  //#region src/jwk.ts
10
9
  function validateCryptoKey(key, type) {
11
10
  if (type != null && key.type !== type) throw new TypeError(`The key is not a ${type} key.`);
12
11
  if (!key.extractable) throw new TypeError("The key is not extractable.");
13
12
  if (key.algorithm.name !== "RSASSA-PKCS1-v1_5" && key.algorithm.name !== "Ed25519") throw new TypeError("Currently only RSASSA-PKCS1-v1_5 and Ed25519 keys are supported. More algorithms will be added in the future!");
14
13
  if (key.algorithm.name === "RSASSA-PKCS1-v1_5") {
15
- const algorithm = key.algorithm;
16
- if (algorithm.hash.name !== "SHA-256") throw new TypeError("For compatibility with the existing Fediverse software (e.g., Mastodon), hash algorithm for RSASSA-PKCS1-v1_5 keys must be SHA-256.");
14
+ if (key.algorithm.hash.name !== "SHA-256") throw new TypeError("For compatibility with the existing Fediverse software (e.g., Mastodon), hash algorithm for RSASSA-PKCS1-v1_5 keys must be SHA-256.");
17
15
  }
18
16
  }
19
17
  async function exportJwk(key) {
@@ -38,7 +36,6 @@ async function importJwk(jwk, type) {
38
36
  validateCryptoKey(key, type);
39
37
  return key;
40
38
  }
41
-
42
39
  //#endregion
43
40
  //#region src/key.ts
44
41
  const algorithms = {
@@ -63,8 +60,7 @@ async function importSpki(pem) {
63
60
  } catch (_) {
64
61
  throw new TypeError("Invalid PEM-SPKI format.");
65
62
  }
66
- const pki = PublicKeyInfo.fromBER(spki);
67
- const oid = pki.algorithm.algorithmId;
63
+ const oid = PublicKeyInfo.fromBER(spki).algorithm.algorithmId;
68
64
  const algorithm = algorithms[oid];
69
65
  if (algorithm == null) throw new TypeError("Unsupported algorithm: " + oid);
70
66
  return await crypto.subtle.importKey("spki", spki, algorithm, true, ["verify"]);
@@ -78,8 +74,7 @@ async function importSpki(pem) {
78
74
  */
79
75
  async function exportSpki(key) {
80
76
  validateCryptoKey(key);
81
- const spki = await crypto.subtle.exportKey("spki", key);
82
- let pem = encodeBase64(spki);
77
+ let pem = encodeBase64(await crypto.subtle.exportKey("spki", key));
83
78
  pem = (pem.match(/.{1,64}/g) || []).join("\n");
84
79
  return `-----BEGIN PUBLIC KEY-----\n${pem}\n-----END PUBLIC KEY-----\n`;
85
80
  }
@@ -91,16 +86,14 @@ async function exportSpki(key) {
91
86
  * @since 1.5.0
92
87
  */
93
88
  function importPkcs1(pem) {
94
- const key = createPublicKey({
89
+ return importSpki(createPublicKey({
95
90
  key: pem,
96
91
  format: "pem",
97
92
  type: "pkcs1"
98
- });
99
- const spki = key.export({
93
+ }).export({
100
94
  type: "spki",
101
95
  format: "pem"
102
- });
103
- return importSpki(spki);
96
+ }));
104
97
  }
105
98
  const PKCS1_HEADER = /^\s*-----BEGIN\s+RSA\s+PUBLIC\s+KEY-----\s*\n/;
106
99
  /**
@@ -127,12 +120,11 @@ async function importMultibaseKey(key) {
127
120
  const { code } = getMulticodecPrefix(decoded);
128
121
  const content = removeMulticodecPrefix(decoded);
129
122
  if (code === 4613) {
130
- const keyObject = createPublicKey({
123
+ const exported = createPublicKey({
131
124
  key: content,
132
125
  format: "der",
133
126
  type: "pkcs1"
134
- });
135
- const exported = keyObject.export({
127
+ }).export({
136
128
  type: "spki",
137
129
  format: "der"
138
130
  });
@@ -164,20 +156,17 @@ async function exportMultibaseKey(key) {
164
156
  const decodedN = decodeBase64Url(jwk.n);
165
157
  const n = new Uint8Array(decodedN.length + 1);
166
158
  n.set(decodedN, 1);
167
- const sequence = new Sequence({ value: [new Integer({
159
+ content = new Sequence({ value: [new Integer({
168
160
  isHexOnly: true,
169
161
  valueHex: n
170
162
  }), new Integer({
171
163
  isHexOnly: true,
172
164
  valueHex: decodeBase64Url(jwk.e)
173
- })] });
174
- content = sequence.toBER(false);
165
+ })] }).toBER(false);
175
166
  code = 4613;
176
167
  } else throw new TypeError("Unsupported key type: " + JSON.stringify(key.algorithm));
177
- const prefixed = addMulticodecPrefix(code, new Uint8Array(content));
178
- const encoded = encodeMultibase("base58btc", prefixed);
168
+ const encoded = encodeMultibase("base58btc", addMulticodecPrefix(code, new Uint8Array(content)));
179
169
  return new TextDecoder().decode(encoded);
180
170
  }
181
-
182
171
  //#endregion
183
- export { exportJwk, exportMultibaseKey, exportSpki, importJwk, importMultibaseKey, importPem, importPkcs1, importSpki };
172
+ export { importPkcs1 as a, importJwk as c, importPem as i, exportSpki as n, importSpki as o, importMultibaseKey as r, exportJwk as s, exportMultibaseKey as t };