@fedify/webfinger 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.
@@ -1,21 +1,17 @@
1
- import "node:module";
2
1
  import { test } from "@fedify/fixture";
3
2
  import { withTimeout } from "es-toolkit";
4
3
  import { deepStrictEqual } from "node:assert/strict";
5
4
  import { UrlError, getUserAgent, validatePublicUrl } from "@fedify/vocab-runtime";
6
5
  import { getLogger } from "@logtape/logtape";
7
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
-
9
- //#region rolldown:runtime
7
+ //#region \0rolldown/runtime.js
10
8
  var __create = Object.create;
11
9
  var __defProp = Object.defineProperty;
12
10
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
11
  var __getOwnPropNames = Object.getOwnPropertyNames;
14
12
  var __getProtoOf = Object.getPrototypeOf;
15
13
  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
- };
14
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
15
  var __copyProps = (to, from, except, desc) => {
20
16
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
21
17
  key = keys[i];
@@ -30,13 +26,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
26
  value: mod,
31
27
  enumerable: true
32
28
  }) : target, mod));
33
-
34
29
  //#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);
30
+ //#region ../../node_modules/.pnpm/regexparam@3.0.0/node_modules/regexparam/dist/index.mjs
31
+ var import_glob_to_regexp = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
32
+ module.exports = function(glob, opts) {
33
+ if (typeof glob !== "string") throw new TypeError("Expected a string");
34
+ var str = String(glob);
40
35
  var reStr = "";
41
36
  var extended = opts ? !!opts.extended : false;
42
37
  var globstar = opts ? !!opts.globstar : false;
@@ -93,13 +88,10 @@ var require_glob_to_regexp = __commonJS({ "../../node_modules/.pnpm/glob-to-rege
93
88
  }
94
89
  var nextChar = str[i + 1];
95
90
  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
- }
91
+ else if (starCount > 1 && (prevChar === "/" || prevChar === void 0) && (nextChar === "/" || nextChar === void 0)) {
92
+ reStr += "((?:[^/]*(?:/|$))*)";
93
+ i++;
94
+ } else reStr += "([^/]*)";
103
95
  break;
104
96
  default: reStr += c;
105
97
  }
@@ -107,10 +99,7 @@ var require_glob_to_regexp = __commonJS({ "../../node_modules/.pnpm/glob-to-rege
107
99
  if (!flags || !~flags.indexOf("g")) reStr = "^" + reStr + "$";
108
100
  return new RegExp(reStr, flags);
109
101
  };
110
- } });
111
-
112
- //#endregion
113
- //#region ../../node_modules/.pnpm/regexparam@3.0.0/node_modules/regexparam/dist/index.mjs
102
+ })))(), 1);
114
103
  /**
115
104
  * @param {string|RegExp} input The route pattern
116
105
  * @param {boolean} [loose] Allow open-ended matching. Ignored with `RegExp` input.
@@ -140,7 +129,6 @@ function parse(input, loose) {
140
129
  pattern: new RegExp("^" + pattern + (loose ? "(?=$|/)" : "/?$"), "i")
141
130
  };
142
131
  }
143
-
144
132
  //#endregion
145
133
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/TypeDescriptor.js
146
134
  const valueTypes = new Set([
@@ -232,7 +220,6 @@ var TypeDescriptor = class TypeDescriptor {
232
220
  return TypeDescriptor.of(value) === "undefined";
233
221
  }
234
222
  };
235
-
236
223
  //#endregion
237
224
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/IsSubsetOf.js
238
225
  const allowedTypes = new Set([
@@ -259,7 +246,7 @@ const isSubsetOf = function(subset, superset, visited = []) {
259
246
  switch (subsetItemType) {
260
247
  case "array":
261
248
  case "object":
262
- case "function": {
249
+ case "function":
263
250
  if (visited.includes(subsetItem)) continue;
264
251
  visited.push(subsetItem);
265
252
  isItemInSuperset = superset.some((supersetItem) => {
@@ -270,7 +257,6 @@ const isSubsetOf = function(subset, superset, visited = []) {
270
257
  }
271
258
  });
272
259
  break;
273
- }
274
260
  default: isItemInSuperset = superset.includes(subsetItem);
275
261
  }
276
262
  if (!isItemInSuperset) return false;
@@ -282,21 +268,18 @@ const isSubsetOf = function(subset, superset, visited = []) {
282
268
  if (Object.keys(subset).length > Object.keys(superset).length) return false;
283
269
  for (const [subsetKey, subsetValue] of Object.entries(subset)) {
284
270
  const supersetValue = superset[subsetKey];
285
- const subsetValueType = TypeDescriptor.of(subsetValue);
286
- switch (subsetValueType) {
271
+ switch (TypeDescriptor.of(subsetValue)) {
287
272
  case "array":
288
273
  case "object":
289
- case "function": {
274
+ case "function":
290
275
  if (visited.includes(subsetValue)) continue;
291
276
  visited.push(subsetValue);
292
277
  try {
293
- const isInSuperset = isSubsetOf(subsetValue, supersetValue, visited);
294
- if (!isInSuperset) return false;
278
+ if (!isSubsetOf(subsetValue, supersetValue, visited)) return false;
295
279
  } catch {
296
280
  return false;
297
281
  }
298
282
  break;
299
- }
300
283
  default: if (subsetValue !== supersetValue) return false;
301
284
  }
302
285
  }
@@ -319,8 +302,7 @@ isSubsetOf.structural = function(subset, superset, visited = []) {
319
302
  if (visited.includes(subsetValue)) continue;
320
303
  visited.push(subsetValue);
321
304
  try {
322
- const isInSuperset = isSubsetOf.structural(subsetValue, supersetValue, visited);
323
- if (!isInSuperset) return false;
305
+ if (!isSubsetOf.structural(subsetValue, supersetValue, visited)) return false;
324
306
  } catch {
325
307
  return false;
326
308
  }
@@ -328,7 +310,6 @@ isSubsetOf.structural = function(subset, superset, visited = []) {
328
310
  }
329
311
  return true;
330
312
  };
331
-
332
313
  //#endregion
333
314
  //#region ../../node_modules/.pnpm/dequal@2.0.3/node_modules/dequal/dist/index.mjs
334
315
  var has = Object.prototype.hasOwnProperty;
@@ -391,11 +372,10 @@ function dequal(foo, bar) {
391
372
  }
392
373
  return foo !== foo && bar !== bar;
393
374
  }
394
-
395
375
  //#endregion
396
376
  //#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");
377
+ const absoluteUrlRX = /* @__PURE__ */ new RegExp("^[a-z]+://|^data:", "i");
378
+ const protocolRelativeUrlRX = /* @__PURE__ */ new RegExp("^//", "i");
399
379
  function hasCredentialsInUrl(url) {
400
380
  const urlObject = new URL(url, !absoluteUrlRX.test(url) ? "http://dummy" : void 0);
401
381
  return Boolean(urlObject.username || urlObject.password);
@@ -443,7 +423,7 @@ async function createCallLogFromRequest(request, options) {
443
423
  } catch {}
444
424
  if (request.headers) derivedOptions.headers = normalizeHeaders(request.headers);
445
425
  const url = normalizeUrl(request.url, true);
446
- const callLog = {
426
+ return {
447
427
  args: [request, options],
448
428
  url,
449
429
  queryParams: new URLSearchParams(getQuery(url)),
@@ -452,11 +432,9 @@ async function createCallLogFromRequest(request, options) {
452
432
  signal: options && options.signal || request.signal,
453
433
  pendingPromises
454
434
  };
455
- return callLog;
456
435
  }
457
436
  function getPath(url) {
458
- const u = absoluteUrlRX.test(url) ? new URL(url) : new URL(url, "http://dummy");
459
- return u.pathname;
437
+ return (absoluteUrlRX.test(url) ? new URL(url) : new URL(url, "http://dummy")).pathname;
460
438
  }
461
439
  function getHost(url) {
462
440
  if (absoluteUrlRX.test(url)) return new URL(url).host;
@@ -474,10 +452,8 @@ function normalizeHeaders(headers) {
474
452
  else entries = Object.entries(headers);
475
453
  return Object.fromEntries(entries.map(([key, val]) => [key.toLowerCase(), String(val).valueOf()]));
476
454
  }
477
-
478
455
  //#endregion
479
456
  //#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
457
  const isUrlMatcher = (matcher) => matcher instanceof RegExp || typeof matcher === "string" || typeof matcher === "object" && "href" in matcher;
482
458
  const isFunctionMatcher = (matcher) => typeof matcher === "function";
483
459
  const stringMatchers = {
@@ -531,8 +507,7 @@ const getMissingHeaderMatcher = ({ missingHeaders: expectedMissingHeaders }) =>
531
507
  const getMethodMatcher = ({ method: expectedMethod }) => {
532
508
  if (!expectedMethod) return;
533
509
  return ({ options: { method } = {} }) => {
534
- const actualMethod = method ? method.toLowerCase() : "get";
535
- return expectedMethod === actualMethod;
510
+ return expectedMethod === (method ? method.toLowerCase() : "get");
536
511
  };
537
512
  };
538
513
  const getQueryParamsMatcher = ({ query: passedQuery }) => {
@@ -611,7 +586,7 @@ const getUrlMatcher = (route) => {
611
586
  }
612
587
  if (typeof matcherUrl === "string") {
613
588
  for (const shorthand in stringMatchers) if (matcherUrl.indexOf(`${shorthand}:`) === 0) {
614
- const urlFragment = matcherUrl.replace(/* @__PURE__ */ new RegExp(`^${shorthand}:`), "");
589
+ const urlFragment = matcherUrl.replace(new RegExp(`^${shorthand}:`), "");
615
590
  return stringMatchers[shorthand](urlFragment);
616
591
  }
617
592
  return getFullUrlMatcher(route, matcherUrl, query);
@@ -622,7 +597,7 @@ const getUrlMatcher = (route) => {
622
597
  else if (key in stringMatchers) return stringMatchers[key](pattern);
623
598
  else throw new Error(`unrecognised url matching pattern: ${key}`);
624
599
  });
625
- return (route$1) => matchers.every((matcher) => matcher(route$1));
600
+ return (route) => matchers.every((matcher) => matcher(route));
626
601
  }
627
602
  };
628
603
  const builtInMatchers = [
@@ -660,7 +635,6 @@ const builtInMatchers = [
660
635
  matcher: getFunctionMatcher
661
636
  }
662
637
  ];
663
-
664
638
  //#endregion
665
639
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/StatusTextMap.js
666
640
  const statusTextMap = {
@@ -727,17 +701,15 @@ const statusTextMap = {
727
701
  510: "Not Extended",
728
702
  511: "Network Authentication Required"
729
703
  };
730
- var StatusTextMap_default = statusTextMap;
731
-
732
704
  //#endregion
733
705
  //#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) {
706
+ var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
735
707
  if (kind === "m") throw new TypeError("Private method is not writable");
736
708
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
737
709
  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
710
  return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
739
711
  };
740
- var __classPrivateFieldGet = void 0 && (void 0).__classPrivateFieldGet || function(receiver, state, kind, f) {
712
+ var __classPrivateFieldGet = function(receiver, state, kind, f) {
741
713
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
742
714
  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
715
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -798,14 +770,13 @@ var Route = class {
798
770
  constructResponseOptions(responseInput) {
799
771
  const options = responseInput.options || {};
800
772
  options.status = sanitizeStatus(responseInput.status);
801
- options.statusText = StatusTextMap_default[options.status];
773
+ options.statusText = statusTextMap[options.status];
802
774
  options.headers = new this.config.Headers(responseInput.headers);
803
775
  return options;
804
776
  }
805
777
  constructResponseBody(responseInput, responseOptions) {
806
778
  let body = responseInput.body;
807
- const bodyIsBodyInit = isBodyInit(body);
808
- if (!bodyIsBodyInit) if (typeof body === "undefined") body = null;
779
+ if (!isBodyInit(body)) if (typeof body === "undefined") body = null;
809
780
  else if (typeof body === "object") {
810
781
  body = JSON.stringify(body);
811
782
  if (!responseOptions.headers.has("Content-Type")) responseOptions.headers.set("Content-Type", "application/json");
@@ -824,26 +795,25 @@ var Route = class {
824
795
  _a.registeredMatchers.push(matcher);
825
796
  }
826
797
  };
827
- _a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route_instances = /* @__PURE__ */ new WeakSet(), _Route_validate = function _Route_validate$1() {
798
+ _a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route_instances = /* @__PURE__ */ new WeakSet(), _Route_validate = function _Route_validate() {
828
799
  if (["matched", "unmatched"].includes(this.config.name)) throw new Error(`fetch-mock: Routes cannot use the reserved name \`${this.config.name}\``);
829
800
  if (!("response" in this.config)) throw new Error("fetch-mock: Each route must define a response");
830
- if (!_a.registeredMatchers.some(({ name: name$1 }) => name$1 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
+ 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 '*'");
802
+ }, _Route_sanitize = function _Route_sanitize() {
832
803
  if (this.config.method) this.config.method = this.config.method.toLowerCase();
833
- }, _Route_generateMatcher = function _Route_generateMatcher$1() {
834
- const activeMatchers = _a.registeredMatchers.filter(({ name: name$1 }) => name$1 in this.config).map(({ matcher, usesBody }) => ({
804
+ }, _Route_generateMatcher = function _Route_generateMatcher() {
805
+ const activeMatchers = _a.registeredMatchers.filter(({ name }) => name in this.config).map(({ matcher, usesBody }) => ({
835
806
  matcher: matcher(this.config),
836
807
  usesBody
837
808
  }));
838
809
  this.config.usesBody = activeMatchers.some(({ usesBody }) => usesBody);
839
810
  this.matcher = (normalizedRequest) => activeMatchers.every(({ matcher }) => matcher(normalizedRequest));
840
- }, _Route_limit = function _Route_limit$1() {
811
+ }, _Route_limit = function _Route_limit() {
841
812
  if (!this.config.repeat) return;
842
813
  const originalMatcher = this.matcher;
843
814
  let timesLeft = this.config.repeat;
844
815
  this.matcher = (callLog) => {
845
- const match = timesLeft && originalMatcher(callLog);
846
- if (match) {
816
+ if (timesLeft && originalMatcher(callLog)) {
847
817
  timesLeft--;
848
818
  return true;
849
819
  }
@@ -851,7 +821,7 @@ _a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route
851
821
  this.reset = () => {
852
822
  timesLeft = this.config.repeat;
853
823
  };
854
- }, _Route_delayResponse = function _Route_delayResponse$1() {
824
+ }, _Route_delayResponse = function _Route_delayResponse() {
855
825
  if (this.config.delay) {
856
826
  const { response } = this.config;
857
827
  this.config.response = () => {
@@ -861,8 +831,6 @@ _a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route
861
831
  };
862
832
  Route.registeredMatchers = [];
863
833
  builtInMatchers.forEach(Route.defineMatcher);
864
- var Route_default = Route;
865
-
866
834
  //#endregion
867
835
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Router.js
868
836
  const responseConfigProps = [
@@ -935,8 +903,7 @@ var Router = class {
935
903
  });
936
904
  }
937
905
  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));
906
+ const route = (this.fallbackRoute ? [...this.routes, this.fallbackRoute] : this.routes).find((route) => route.matcher(callLog));
940
907
  if (route) try {
941
908
  callLog.route = route;
942
909
  const { response, responseOptions, responseInput } = await this.generateResponse(callLog);
@@ -963,24 +930,24 @@ var Router = class {
963
930
  return callLog.route.constructResponse(responseConfig);
964
931
  }
965
932
  createObservableResponse(response, responseConfig, responseInput, responseUrl, pendingPromises) {
966
- return new Proxy(response, { get: (originalResponse, name$1) => {
933
+ return new Proxy(response, { get: (originalResponse, name) => {
967
934
  if (responseInput.redirectUrl) {
968
- if (name$1 === "url") return responseInput.redirectUrl;
969
- if (name$1 === "redirected") return true;
935
+ if (name === "url") return responseInput.redirectUrl;
936
+ if (name === "redirected") return true;
970
937
  } else {
971
- if (name$1 === "url") return responseUrl;
972
- if (name$1 === "redirected") return false;
938
+ if (name === "url") return responseUrl;
939
+ if (name === "redirected") return false;
973
940
  }
974
941
  if (responseInput.status === 0) {
975
- if (name$1 === "status") return 0;
976
- if (name$1 === "statusText") return "";
942
+ if (name === "status") return 0;
943
+ if (name === "statusText") return "";
977
944
  }
978
- if (typeof response[name$1] === "function") return new Proxy(response[name$1], { apply: (func, thisArg, args) => {
945
+ if (typeof response[name] === "function") return new Proxy(response[name], { apply: (func, thisArg, args) => {
979
946
  const result = func.apply(response, args);
980
947
  if (result.then) pendingPromises.push(result.catch(() => void 0));
981
948
  return result;
982
949
  } });
983
- return originalResponse[name$1];
950
+ return originalResponse[name];
984
951
  } });
985
952
  }
986
953
  addRoute(matcher, response, nameOrOptions) {
@@ -991,7 +958,7 @@ var Router = class {
991
958
  else Object.assign(config, matcher);
992
959
  if (typeof response !== "undefined") config.response = response;
993
960
  if (nameOrOptions) Object.assign(config, typeof nameOrOptions === "string" ? nameToOptions(nameOrOptions) : nameOrOptions);
994
- const route = new Route_default({
961
+ const route = new Route({
995
962
  ...this.config,
996
963
  ...config
997
964
  });
@@ -1010,7 +977,7 @@ var Router = class {
1010
977
  }
1011
978
  setFallback(response) {
1012
979
  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({
980
+ this.fallbackRoute = new Route({
1014
981
  matcherFunction: () => true,
1015
982
  response: response || "ok",
1016
983
  ...this.config
@@ -1019,15 +986,15 @@ var Router = class {
1019
986
  }
1020
987
  removeRoutes({ names, includeSticky, includeFallback } = {}) {
1021
988
  includeFallback = includeFallback ?? true;
1022
- this.routes = this.routes.filter(({ config: { sticky, name: name$1 } }) => {
989
+ this.routes = this.routes.filter(({ config: { sticky, name } }) => {
1023
990
  if (sticky && !includeSticky) return true;
1024
991
  if (!names) return false;
1025
- return !names.includes(name$1);
992
+ return !names.includes(name);
1026
993
  });
1027
994
  if (includeFallback) delete this.fallbackRoute;
1028
995
  }
1029
996
  modifyRoute(routeName, options) {
1030
- const route = this.routes.find(({ config: { name: name$1 } }) => name$1 === routeName);
997
+ const route = this.routes.find(({ config: { name } }) => name === routeName);
1031
998
  if (!route) throw new Error(`Cannot call modifyRoute() on route \`${routeName}\`: route of that name not found`);
1032
999
  if (route.config.sticky) throw new Error(`Cannot call modifyRoute() on route \`${routeName}\`: route is sticky and cannot be modified`);
1033
1000
  if ("name" in options) throw new Error(`Cannot rename the route \`${routeName}\` as \`${options.name}\`: renaming routes is not supported`);
@@ -1042,7 +1009,6 @@ var Router = class {
1042
1009
  route.init(newConfig);
1043
1010
  }
1044
1011
  };
1045
-
1046
1012
  //#endregion
1047
1013
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/CallHistory.js
1048
1014
  const isName = (filter) => typeof filter === "string" && /^[\da-zA-Z-]+$/.test(filter) && !["matched", "unmatched"].includes(filter);
@@ -1088,12 +1054,12 @@ var CallHistory = class {
1088
1054
  ...filter,
1089
1055
  ...options || {}
1090
1056
  };
1091
- const { matcher } = new Route_default({
1057
+ const { matcher } = new Route({
1092
1058
  response: "ok",
1093
1059
  ...options
1094
1060
  });
1095
- calls = calls.filter(({ url, options: options$1 }) => {
1096
- return matcher(createCallLogFromUrlAndOptions(url, options$1));
1061
+ calls = calls.filter(({ url, options }) => {
1062
+ return matcher(createCallLogFromUrlAndOptions(url, options));
1097
1063
  });
1098
1064
  return calls;
1099
1065
  }
@@ -1107,7 +1073,7 @@ var CallHistory = class {
1107
1073
  let routesToCheck = this.router.routes;
1108
1074
  if (routeNames) {
1109
1075
  routeNames = Array.isArray(routeNames) ? routeNames : [routeNames];
1110
- routesToCheck = this.router.routes.filter(({ config: { name: name$1 } }) => routeNames.includes(name$1));
1076
+ routesToCheck = this.router.routes.filter(({ config: { name } }) => routeNames.includes(name));
1111
1077
  }
1112
1078
  return routesToCheck.map((route) => {
1113
1079
  const calls = this.callLogs.filter(({ route: routeApplied }) => routeApplied === route);
@@ -1126,8 +1092,6 @@ var CallHistory = class {
1126
1092
  }).every((isDone) => isDone);
1127
1093
  }
1128
1094
  };
1129
- var CallHistory_default = CallHistory;
1130
-
1131
1095
  //#endregion
1132
1096
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/FetchMock.js
1133
1097
  const defaultFetchMockConfig = {
@@ -1149,7 +1113,9 @@ const defineGreedyShorthand = (shorthandOptions) => {
1149
1113
  return this.route("*", response, Object.assign(options || {}, shorthandOptions));
1150
1114
  };
1151
1115
  };
1152
- var FetchMock = class FetchMock {
1116
+ //#endregion
1117
+ //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/index.js
1118
+ var esm_default = new class FetchMock {
1153
1119
  constructor(config, router) {
1154
1120
  this.sticky = defineShorthand({ sticky: true });
1155
1121
  this.once = defineShorthand({ repeat: 1 });
@@ -1190,7 +1156,7 @@ var FetchMock = class FetchMock {
1190
1156
  routes: router ? [...router.routes] : [],
1191
1157
  fallbackRoute: router ? router.fallbackRoute : null
1192
1158
  });
1193
- this.callHistory = new CallHistory_default(this.config, this.router);
1159
+ this.callHistory = new CallHistory(this.config, this.router);
1194
1160
  this.fetchHandler = this.fetchHandler.bind(this);
1195
1161
  Object.assign(this.fetchHandler, { fetchMock: this });
1196
1162
  }
@@ -1215,7 +1181,7 @@ var FetchMock = class FetchMock {
1215
1181
  return this;
1216
1182
  }
1217
1183
  defineMatcher(matcher) {
1218
- Route_default.defineMatcher(matcher);
1184
+ Route.defineMatcher(matcher);
1219
1185
  }
1220
1186
  removeRoutes(options) {
1221
1187
  this.router.removeRoutes(options);
@@ -1247,9 +1213,9 @@ var FetchMock = class FetchMock {
1247
1213
  this.unmockGlobal();
1248
1214
  return this;
1249
1215
  }
1250
- spy(matcher, name$1) {
1216
+ spy(matcher, name) {
1251
1217
  const boundFetch = this.config.fetch.bind(globalThis);
1252
- if (matcher) this.route(matcher, ({ args }) => boundFetch(...args), name$1);
1218
+ if (matcher) this.route(matcher, ({ args }) => boundFetch(...args), name);
1253
1219
  else this.catch(({ args }) => boundFetch(...args));
1254
1220
  return this;
1255
1221
  }
@@ -1257,49 +1223,11 @@ var FetchMock = class FetchMock {
1257
1223
  this.mockGlobal();
1258
1224
  return this.spy();
1259
1225
  }
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
-
1226
+ }({ ...defaultFetchMockConfig });
1268
1227
  //#endregion
1269
1228
  //#region deno.json
1270
1229
  var name = "@fedify/webfinger";
1271
- var version = "2.2.0-dev.613+cf8cd122";
1272
- var license = "MIT";
1273
- var exports = { ".": "./src/mod.ts" };
1274
- var description = "WebFinger client library for Fedify";
1275
- var author = {
1276
- "name": "Hong Minhee",
1277
- "email": "hong@minhee.org",
1278
- "url": "https://hongminhee.org/"
1279
- };
1280
- var imports = {
1281
- "es-toolkit": "npm:es-toolkit@^1.42.0",
1282
- "fetch-mock": "npm:fetch-mock@^12.5.4"
1283
- };
1284
- var exclude = ["dist", "node_modules"];
1285
- var publish = { "exclude": ["**/*.test.ts", "tsdown.config.ts"] };
1286
- var tasks = {
1287
- "check": "deno fmt --check && deno lint && deno check src/*.ts",
1288
- "test": "deno test"
1289
- };
1290
- var deno_default = {
1291
- name,
1292
- version,
1293
- license,
1294
- exports,
1295
- description,
1296
- author,
1297
- imports,
1298
- exclude,
1299
- publish,
1300
- tasks
1301
- };
1302
-
1230
+ var version = "2.2.0-dev.628+7f7a1e9b";
1303
1231
  //#endregion
1304
1232
  //#region src/lookup.ts
1305
1233
  const logger = getLogger([
@@ -1316,9 +1244,7 @@ const DEFAULT_MAX_REDIRECTION = 5;
1316
1244
  * @since 0.2.0
1317
1245
  */
1318
1246
  async function lookupWebFinger(resource, options = {}) {
1319
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
1320
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
1321
- return await tracer.startActiveSpan("webfinger.lookup", {
1247
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("webfinger.lookup", {
1322
1248
  kind: SpanKind.CLIENT,
1323
1249
  attributes: {
1324
1250
  "webfinger.resource": resource.toString(),
@@ -1421,7 +1347,6 @@ async function lookupWebFingerInternal(resource, options = {}) {
1421
1347
  }
1422
1348
  }
1423
1349
  }
1424
-
1425
1350
  //#endregion
1426
1351
  //#region src/lookup.test.ts
1427
1352
  test({
@@ -1503,8 +1428,7 @@ test({
1503
1428
  headers: { Location: "/.well-known/webfinger" }
1504
1429
  });
1505
1430
  await t.step("infinite redirection", async () => {
1506
- const result = await withTimeout(() => lookupWebFinger("acct:johndoe@example.com"), 2e3);
1507
- deepStrictEqual(result, null);
1431
+ deepStrictEqual(await withTimeout(() => lookupWebFinger("acct:johndoe@example.com"), 2e3), null);
1508
1432
  });
1509
1433
  esm_default.removeRoutes();
1510
1434
  esm_default.get("begin:https://example.com/.well-known/webfinger?", {
@@ -1584,18 +1508,15 @@ test({
1584
1508
  await t.step("cancellation with immediate abort", async () => {
1585
1509
  const controller = new AbortController();
1586
1510
  controller.abort();
1587
- const result = await lookupWebFinger("acct:johndoe@example.com", { signal: controller.signal });
1588
- deepStrictEqual(result, null);
1511
+ deepStrictEqual(await lookupWebFinger("acct:johndoe@example.com", { signal: controller.signal }), null);
1589
1512
  });
1590
1513
  esm_default.removeRoutes();
1591
1514
  esm_default.get("begin:https://example.com/.well-known/webfinger?", { body: expected });
1592
1515
  await t.step("successful request with signal", async () => {
1593
- const controller = new AbortController();
1594
- const result = await lookupWebFinger("acct:johndoe@example.com", { signal: controller.signal });
1595
- deepStrictEqual(result, expected);
1516
+ deepStrictEqual(await lookupWebFinger("acct:johndoe@example.com", { signal: new AbortController().signal }), expected);
1596
1517
  });
1597
1518
  esm_default.hardReset();
1598
1519
  }
1599
1520
  });
1600
-
1601
- //#endregion
1521
+ //#endregion
1522
+ export {};