@fedify/vocab-runtime 2.0.1 → 2.0.2-dev.407

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.
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-runtime",
3
- "version": "2.0.1",
3
+ "version": "2.0.2-dev.407+6f4b2e28",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts"
package/dist/mod.cjs CHANGED
@@ -4182,7 +4182,7 @@ var contexts_default = preloadedContexts;
4182
4182
  //#endregion
4183
4183
  //#region deno.json
4184
4184
  var name = "@fedify/vocab-runtime";
4185
- var version = "2.0.1";
4185
+ var version = "2.0.2-dev.407+6f4b2e28";
4186
4186
  var license = "MIT";
4187
4187
  var exports$1 = { ".": "./src/mod.ts" };
4188
4188
  var description = "Runtime library for @fedify/vocab";
@@ -5199,12 +5199,12 @@ var LanguageString = class extends String {
5199
5199
  super(value);
5200
5200
  this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
5201
5201
  }
5202
- [Symbol.for("Deno.customInspect")](inspect, options) {
5203
- return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
5204
- }
5205
- [Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
5206
- return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
5207
- }
5202
+ };
5203
+ LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
5204
+ return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
5205
+ };
5206
+ LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
5207
+ return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
5208
5208
  };
5209
5209
 
5210
5210
  //#endregion
package/dist/mod.d.cts CHANGED
@@ -1,188 +1,191 @@
1
1
  import { Logger } from "@logtape/logtape";
2
2
 
3
3
  //#region src/contexts.d.ts
4
+ // Preloaded context documents
5
+ // https://github.com/fedify-dev/fedify/issues/74
6
+ // cSpell: disable
4
7
  declare const preloadedContexts: Record<string, unknown>;
5
8
  //#endregion
6
9
  //#region src/request.d.ts
7
10
  /**
8
- * Error thrown when fetching a JSON-LD document failed.
9
- */
11
+ * Error thrown when fetching a JSON-LD document failed.
12
+ */
10
13
  declare class FetchError extends Error {
11
14
  /**
12
- * The URL that failed to fetch.
13
- */
15
+ * The URL that failed to fetch.
16
+ */
14
17
  url: URL;
15
18
  /**
16
- * Constructs a new `FetchError`.
17
- *
18
- * @param url The URL that failed to fetch.
19
- * @param message Error message.
20
- */
19
+ * Constructs a new `FetchError`.
20
+ *
21
+ * @param url The URL that failed to fetch.
22
+ * @param message Error message.
23
+ */
21
24
  constructor(url: URL | string, message?: string);
22
25
  }
23
26
  /**
24
- * Options for creating a request.
25
- * @internal
26
- */
27
+ * Options for creating a request.
28
+ * @internal
29
+ */
27
30
  interface CreateRequestOptions {
28
31
  userAgent?: GetUserAgentOptions | string;
29
32
  }
30
33
  /**
31
- * Creates a request for the given URL.
32
- * @param url The URL to create the request for.
33
- * @param options The options for the request.
34
- * @returns The created request.
35
- * @internal
36
- */
34
+ * Creates a request for the given URL.
35
+ * @param url The URL to create the request for.
36
+ * @param options The options for the request.
37
+ * @returns The created request.
38
+ * @internal
39
+ */
37
40
  declare function createActivityPubRequest(url: string, options?: CreateRequestOptions): Request;
38
41
  /**
39
- * Options for making `User-Agent` string.
40
- * @see {@link getUserAgent}
41
- * @since 1.3.0
42
- */
42
+ * Options for making `User-Agent` string.
43
+ * @see {@link getUserAgent}
44
+ * @since 1.3.0
45
+ */
43
46
  interface GetUserAgentOptions {
44
47
  /**
45
- * An optional software name and version, e.g., `"Hollo/1.0.0"`.
46
- */
48
+ * An optional software name and version, e.g., `"Hollo/1.0.0"`.
49
+ */
47
50
  software?: string | null;
48
51
  /**
49
- * An optional URL to append to the user agent string.
50
- * Usually the URL of the ActivityPub instance.
51
- */
52
+ * An optional URL to append to the user agent string.
53
+ * Usually the URL of the ActivityPub instance.
54
+ */
52
55
  url?: string | URL | null;
53
56
  }
54
57
  /**
55
- * Gets the user agent string for the given application and URL.
56
- * @param options The options for making the user agent string.
57
- * @returns The user agent string.
58
- * @since 1.3.0
59
- */
58
+ * Gets the user agent string for the given application and URL.
59
+ * @param options The options for making the user agent string.
60
+ * @returns The user agent string.
61
+ * @since 1.3.0
62
+ */
60
63
  declare function getUserAgent({
61
64
  software,
62
65
  url
63
66
  }?: GetUserAgentOptions): string;
64
67
  /**
65
- * Logs the request.
66
- * @param request The request to log.
67
- * @internal
68
- */
68
+ * Logs the request.
69
+ * @param request The request to log.
70
+ * @internal
71
+ */
69
72
  declare function logRequest(logger: Logger, request: Request): void;
70
73
  //#endregion
71
74
  //#region src/docloader.d.ts
72
75
  /**
73
- * A remote JSON-LD document and its context fetched by
74
- * a {@link DocumentLoader}.
75
- */
76
+ * A remote JSON-LD document and its context fetched by
77
+ * a {@link DocumentLoader}.
78
+ */
76
79
  interface RemoteDocument {
77
80
  /**
78
- * The URL of the context document.
79
- */
81
+ * The URL of the context document.
82
+ */
80
83
  contextUrl: string | null;
81
84
  /**
82
- * The fetched JSON-LD document.
83
- */
85
+ * The fetched JSON-LD document.
86
+ */
84
87
  document: unknown;
85
88
  /**
86
- * The URL of the fetched document.
87
- */
89
+ * The URL of the fetched document.
90
+ */
88
91
  documentUrl: string;
89
92
  }
90
93
  /**
91
- * Options for {@link DocumentLoader}.
92
- * @since 1.8.0
93
- */
94
+ * Options for {@link DocumentLoader}.
95
+ * @since 1.8.0
96
+ */
94
97
  interface DocumentLoaderOptions {
95
98
  /**
96
- * An `AbortSignal` for cancellation.
97
- * @since 1.8.0
98
- */
99
+ * An `AbortSignal` for cancellation.
100
+ * @since 1.8.0
101
+ */
99
102
  signal?: AbortSignal;
100
103
  }
101
104
  /**
102
- * A JSON-LD document loader that fetches documents from the Web.
103
- * @param url The URL of the document to load.
104
- * @param options The options for the document loader.
105
- * @returns The loaded remote document.
106
- */
105
+ * A JSON-LD document loader that fetches documents from the Web.
106
+ * @param url The URL of the document to load.
107
+ * @param options The options for the document loader.
108
+ * @returns The loaded remote document.
109
+ */
107
110
  type DocumentLoader = (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>;
108
111
  /**
109
- * A factory function that creates a {@link DocumentLoader} with options.
110
- * @param options The options for the document loader.
111
- * @returns The document loader.
112
- * @since 1.4.0
113
- */
112
+ * A factory function that creates a {@link DocumentLoader} with options.
113
+ * @param options The options for the document loader.
114
+ * @returns The document loader.
115
+ * @since 1.4.0
116
+ */
114
117
  type DocumentLoaderFactory = (options?: DocumentLoaderFactoryOptions) => DocumentLoader;
115
118
  /**
116
- * Options for {@link DocumentLoaderFactory}.
117
- * @see {@link DocumentLoaderFactory}
118
- * @see {@link AuthenticatedDocumentLoaderFactory}
119
- * @since 1.4.0
120
- */
119
+ * Options for {@link DocumentLoaderFactory}.
120
+ * @see {@link DocumentLoaderFactory}
121
+ * @see {@link AuthenticatedDocumentLoaderFactory}
122
+ * @since 1.4.0
123
+ */
121
124
  interface DocumentLoaderFactoryOptions {
122
125
  /**
123
- * Whether to allow fetching private network addresses.
124
- * Turned off by default.
125
- * @default `false``
126
- */
126
+ * Whether to allow fetching private network addresses.
127
+ * Turned off by default.
128
+ * @default `false``
129
+ */
127
130
  allowPrivateAddress?: boolean;
128
131
  /**
129
- * Options for making `User-Agent` string.
130
- * If a string is given, it is used as the `User-Agent` header value.
131
- * If an object is given, it is passed to {@link getUserAgent} function.
132
- */
132
+ * Options for making `User-Agent` string.
133
+ * If a string is given, it is used as the `User-Agent` header value.
134
+ * If an object is given, it is passed to {@link getUserAgent} function.
135
+ */
133
136
  userAgent?: GetUserAgentOptions | string;
134
137
  }
135
138
  /**
136
- * A factory function that creates an authenticated {@link DocumentLoader} for
137
- * a given identity. This is used for fetching documents that require
138
- * authentication.
139
- * @param identity The identity to create the document loader for.
140
- * The actor's key pair.
141
- * @param options The options for the document loader.
142
- * @returns The authenticated document loader.
143
- * @since 0.4.0
144
- */
139
+ * A factory function that creates an authenticated {@link DocumentLoader} for
140
+ * a given identity. This is used for fetching documents that require
141
+ * authentication.
142
+ * @param identity The identity to create the document loader for.
143
+ * The actor's key pair.
144
+ * @param options The options for the document loader.
145
+ * @returns The authenticated document loader.
146
+ * @since 0.4.0
147
+ */
145
148
  type AuthenticatedDocumentLoaderFactory = (identity: {
146
149
  keyId: URL;
147
150
  privateKey: CryptoKey;
148
151
  }, options?: DocumentLoaderFactoryOptions) => DocumentLoader;
149
152
  /**
150
- * Gets a {@link RemoteDocument} from the given response.
151
- * @param url The URL of the document to load.
152
- * @param response The response to get the document from.
153
- * @param fetch The function to fetch the document.
154
- * @returns The loaded remote document.
155
- * @throws {FetchError} If the response is not OK.
156
- * @internal
157
- */
153
+ * Gets a {@link RemoteDocument} from the given response.
154
+ * @param url The URL of the document to load.
155
+ * @param response The response to get the document from.
156
+ * @param fetch The function to fetch the document.
157
+ * @returns The loaded remote document.
158
+ * @throws {FetchError} If the response is not OK.
159
+ * @internal
160
+ */
158
161
  declare function getRemoteDocument(url: string, response: Response, fetch: (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>): Promise<RemoteDocument>;
159
162
  /**
160
- * Options for {@link getDocumentLoader}.
161
- * @since 1.3.0
162
- */
163
+ * Options for {@link getDocumentLoader}.
164
+ * @since 1.3.0
165
+ */
163
166
  interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
164
167
  /**
165
- * Whether to preload the frequently used contexts.
166
- */
168
+ * Whether to preload the frequently used contexts.
169
+ */
167
170
  skipPreloadedContexts?: boolean;
168
171
  }
169
172
  /**
170
- * Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
171
- *
172
- * The created loader preloads the below frequently used contexts by default
173
- * (unless `options.skipPreloadedContexts` is set to `true`):
174
- *
175
- * - <https://www.w3.org/ns/activitystreams>
176
- * - <https://w3id.org/security/v1>
177
- * - <https://w3id.org/security/data-integrity/v1>
178
- * - <https://www.w3.org/ns/did/v1>
179
- * - <https://w3id.org/security/multikey/v1>
180
- * - <https://purl.archive.org/socialweb/webfinger>
181
- * - <http://schema.org/>
182
- * @param options Options for the document loader.
183
- * @returns The document loader.
184
- * @since 1.3.0
185
- */
173
+ * Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
174
+ *
175
+ * The created loader preloads the below frequently used contexts by default
176
+ * (unless `options.skipPreloadedContexts` is set to `true`):
177
+ *
178
+ * - <https://www.w3.org/ns/activitystreams>
179
+ * - <https://w3id.org/security/v1>
180
+ * - <https://w3id.org/security/data-integrity/v1>
181
+ * - <https://www.w3.org/ns/did/v1>
182
+ * - <https://w3id.org/security/multikey/v1>
183
+ * - <https://purl.archive.org/socialweb/webfinger>
184
+ * - <http://schema.org/>
185
+ * @param options Options for the document loader.
186
+ * @returns The document loader.
187
+ * @since 1.3.0
188
+ */
186
189
  declare function getDocumentLoader({
187
190
  allowPrivateAddress,
188
191
  skipPreloadedContexts,
@@ -191,74 +194,74 @@ declare function getDocumentLoader({
191
194
  //#endregion
192
195
  //#region src/key.d.ts
193
196
  /**
194
- * Imports a PEM-SPKI formatted public key.
195
- * @param pem The PEM-SPKI formatted public key.
196
- * @returns The imported public key.
197
- * @throws {TypeError} If the key is invalid or unsupported.
198
- * @since 0.5.0
199
- */
197
+ * Imports a PEM-SPKI formatted public key.
198
+ * @param pem The PEM-SPKI formatted public key.
199
+ * @returns The imported public key.
200
+ * @throws {TypeError} If the key is invalid or unsupported.
201
+ * @since 0.5.0
202
+ */
200
203
  declare function importSpki(pem: string): Promise<CryptoKey>;
201
204
  /**
202
- * Exports a public key in PEM-SPKI format.
203
- * @param key The public key to export.
204
- * @returns The exported public key in PEM-SPKI format.
205
- * @throws {TypeError} If the key is invalid or unsupported.
206
- * @since 0.5.0
207
- */
205
+ * Exports a public key in PEM-SPKI format.
206
+ * @param key The public key to export.
207
+ * @returns The exported public key in PEM-SPKI format.
208
+ * @throws {TypeError} If the key is invalid or unsupported.
209
+ * @since 0.5.0
210
+ */
208
211
  declare function exportSpki(key: CryptoKey): Promise<string>;
209
212
  /**
210
- * Imports a PEM-PKCS#1 formatted public key.
211
- * @param pem The PEM-PKCS#1 formatted public key.
212
- * @returns The imported public key.
213
- * @throws {TypeError} If the key is invalid or unsupported.
214
- * @since 1.5.0
215
- */
213
+ * Imports a PEM-PKCS#1 formatted public key.
214
+ * @param pem The PEM-PKCS#1 formatted public key.
215
+ * @returns The imported public key.
216
+ * @throws {TypeError} If the key is invalid or unsupported.
217
+ * @since 1.5.0
218
+ */
216
219
  declare function importPkcs1(pem: string): Promise<CryptoKey>;
217
220
  /**
218
- * Imports a PEM formatted public key (SPKI or PKCS#1).
219
- * @param pem The PEM formatted public key to import (SPKI or PKCS#1).
220
- * @returns The imported public key.
221
- * @throws {TypeError} If the key is invalid or unsupported.
222
- * @since 1.5.0
223
- */
221
+ * Imports a PEM formatted public key (SPKI or PKCS#1).
222
+ * @param pem The PEM formatted public key to import (SPKI or PKCS#1).
223
+ * @returns The imported public key.
224
+ * @throws {TypeError} If the key is invalid or unsupported.
225
+ * @since 1.5.0
226
+ */
224
227
  declare function importPem(pem: string): Promise<CryptoKey>;
225
228
  /**
226
- * Imports a [Multibase]-encoded public key.
227
- *
228
- * [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
229
- * @param key The Multibase-encoded public key.
230
- * @returns The imported public key.
231
- * @throws {TypeError} If the key is invalid or unsupported.
232
- * @since 0.10.0
233
- */
229
+ * Imports a [Multibase]-encoded public key.
230
+ *
231
+ * [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
232
+ * @param key The Multibase-encoded public key.
233
+ * @returns The imported public key.
234
+ * @throws {TypeError} If the key is invalid or unsupported.
235
+ * @since 0.10.0
236
+ */
234
237
  declare function importMultibaseKey(key: string): Promise<CryptoKey>;
235
238
  /**
236
- * Exports a public key in [Multibase] format.
237
- *
238
- * [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
239
- * @param key The public key to export.
240
- * @returns The exported public key in Multibase format.
241
- * @throws {TypeError} If the key is invalid or unsupported.
242
- * @since 0.10.0
243
- */
239
+ * Exports a public key in [Multibase] format.
240
+ *
241
+ * [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
242
+ * @param key The public key to export.
243
+ * @returns The exported public key in Multibase format.
244
+ * @throws {TypeError} If the key is invalid or unsupported.
245
+ * @since 0.10.0
246
+ */
244
247
  declare function exportMultibaseKey(key: CryptoKey): Promise<string>;
245
248
  //#endregion
246
249
  //#region src/langstr.d.ts
247
250
  /**
248
- * A language-tagged string which corresponds to the `rdf:langString` type.
249
- */
251
+ * A language-tagged string which corresponds to the `rdf:langString` type.
252
+ */
250
253
  declare class LanguageString extends String {
251
254
  /**
252
- * The locale of the string.
253
- * @since 2.0.0
254
- */
255
+ * The locale of the string.
256
+ * @since 2.0.0
257
+ */
255
258
  readonly locale: Intl.Locale;
256
259
  /**
257
- * Constructs a new `LanguageString`.
258
- * @param value A string value written in the given language.
259
- * @param language The language of the string. If a string is given, it will
260
- * be parsed as a `Intl.Locale` object.
261
- */
260
+ * Constructs a new `LanguageString`.
261
+ * @param value A string value written in the given language.
262
+ * @param language The language of the string. If a string is given, it will
263
+ * be parsed as a `Intl.Locale` object.
264
+ */
262
265
  constructor(value: string, language: Intl.Locale | string);
263
266
  }
264
267
  //#endregion
@@ -280,8 +283,8 @@ interface CodecFactory {
280
283
  //#endregion
281
284
  //#region src/multibase/base.d.ts
282
285
  /**
283
- * Class to encode/decode in the supported Bases
284
- */
286
+ * Class to encode/decode in the supported Bases
287
+ */
285
288
  declare class Base {
286
289
  name: BaseName;
287
290
  private code;
@@ -295,25 +298,25 @@ declare class Base {
295
298
  //#endregion
296
299
  //#region src/multibase/mod.d.ts
297
300
  /**
298
- * Encode data with the specified base and add the multibase prefix.
299
- *
300
- * @throws {Error} Will throw if the encoding is not supported
301
- */
301
+ * Encode data with the specified base and add the multibase prefix.
302
+ *
303
+ * @throws {Error} Will throw if the encoding is not supported
304
+ */
302
305
  declare function encodeMultibase(nameOrCode: BaseNameOrCode, buf: Uint8Array): Uint8Array;
303
306
  /**
304
- * Takes a Uint8Array or string encoded with multibase header, decodes it and
305
- * returns the decoded buffer
306
- *
307
- * @throws {Error} Will throw if the encoding is not supported
308
- */
307
+ * Takes a Uint8Array or string encoded with multibase header, decodes it and
308
+ * returns the decoded buffer
309
+ *
310
+ * @throws {Error} Will throw if the encoding is not supported
311
+ */
309
312
  declare function decodeMultibase(data: Uint8Array | string): Uint8Array;
310
313
  /**
311
- * Get encoding multibase from data
312
- *
313
- * @param {string|Uint8Array} data
314
- * @returns {Base}
315
- * @throws {Error} Will throw if the encoding is not supported
316
- */
314
+ * Get encoding multibase from data
315
+ *
316
+ * @param {string|Uint8Array} data
317
+ * @returns {Base}
318
+ * @throws {Error} Will throw if the encoding is not supported
319
+ */
317
320
  declare function encodingFromBaseData(data: string | Uint8Array): Base;
318
321
  //#endregion
319
322
  //#region src/url.d.ts
@@ -321,8 +324,8 @@ declare class UrlError extends Error {
321
324
  constructor(message: string);
322
325
  }
323
326
  /**
324
- * Validates a URL to prevent SSRF attacks.
325
- */
327
+ * Validates a URL to prevent SSRF attacks.
328
+ */
326
329
  declare function validatePublicUrl(url: string): Promise<void>;
327
330
  declare function isValidPublicIPv4Address(address: string): boolean;
328
331
  declare function isValidPublicIPv6Address(address: string): boolean;
package/dist/mod.d.ts CHANGED
@@ -1,188 +1,191 @@
1
1
  import { Logger } from "@logtape/logtape";
2
2
 
3
3
  //#region src/contexts.d.ts
4
+ // Preloaded context documents
5
+ // https://github.com/fedify-dev/fedify/issues/74
6
+ // cSpell: disable
4
7
  declare const preloadedContexts: Record<string, unknown>;
5
8
  //#endregion
6
9
  //#region src/request.d.ts
7
10
  /**
8
- * Error thrown when fetching a JSON-LD document failed.
9
- */
11
+ * Error thrown when fetching a JSON-LD document failed.
12
+ */
10
13
  declare class FetchError extends Error {
11
14
  /**
12
- * The URL that failed to fetch.
13
- */
15
+ * The URL that failed to fetch.
16
+ */
14
17
  url: URL;
15
18
  /**
16
- * Constructs a new `FetchError`.
17
- *
18
- * @param url The URL that failed to fetch.
19
- * @param message Error message.
20
- */
19
+ * Constructs a new `FetchError`.
20
+ *
21
+ * @param url The URL that failed to fetch.
22
+ * @param message Error message.
23
+ */
21
24
  constructor(url: URL | string, message?: string);
22
25
  }
23
26
  /**
24
- * Options for creating a request.
25
- * @internal
26
- */
27
+ * Options for creating a request.
28
+ * @internal
29
+ */
27
30
  interface CreateRequestOptions {
28
31
  userAgent?: GetUserAgentOptions | string;
29
32
  }
30
33
  /**
31
- * Creates a request for the given URL.
32
- * @param url The URL to create the request for.
33
- * @param options The options for the request.
34
- * @returns The created request.
35
- * @internal
36
- */
34
+ * Creates a request for the given URL.
35
+ * @param url The URL to create the request for.
36
+ * @param options The options for the request.
37
+ * @returns The created request.
38
+ * @internal
39
+ */
37
40
  declare function createActivityPubRequest(url: string, options?: CreateRequestOptions): Request;
38
41
  /**
39
- * Options for making `User-Agent` string.
40
- * @see {@link getUserAgent}
41
- * @since 1.3.0
42
- */
42
+ * Options for making `User-Agent` string.
43
+ * @see {@link getUserAgent}
44
+ * @since 1.3.0
45
+ */
43
46
  interface GetUserAgentOptions {
44
47
  /**
45
- * An optional software name and version, e.g., `"Hollo/1.0.0"`.
46
- */
48
+ * An optional software name and version, e.g., `"Hollo/1.0.0"`.
49
+ */
47
50
  software?: string | null;
48
51
  /**
49
- * An optional URL to append to the user agent string.
50
- * Usually the URL of the ActivityPub instance.
51
- */
52
+ * An optional URL to append to the user agent string.
53
+ * Usually the URL of the ActivityPub instance.
54
+ */
52
55
  url?: string | URL | null;
53
56
  }
54
57
  /**
55
- * Gets the user agent string for the given application and URL.
56
- * @param options The options for making the user agent string.
57
- * @returns The user agent string.
58
- * @since 1.3.0
59
- */
58
+ * Gets the user agent string for the given application and URL.
59
+ * @param options The options for making the user agent string.
60
+ * @returns The user agent string.
61
+ * @since 1.3.0
62
+ */
60
63
  declare function getUserAgent({
61
64
  software,
62
65
  url
63
66
  }?: GetUserAgentOptions): string;
64
67
  /**
65
- * Logs the request.
66
- * @param request The request to log.
67
- * @internal
68
- */
68
+ * Logs the request.
69
+ * @param request The request to log.
70
+ * @internal
71
+ */
69
72
  declare function logRequest(logger: Logger, request: Request): void;
70
73
  //#endregion
71
74
  //#region src/docloader.d.ts
72
75
  /**
73
- * A remote JSON-LD document and its context fetched by
74
- * a {@link DocumentLoader}.
75
- */
76
+ * A remote JSON-LD document and its context fetched by
77
+ * a {@link DocumentLoader}.
78
+ */
76
79
  interface RemoteDocument {
77
80
  /**
78
- * The URL of the context document.
79
- */
81
+ * The URL of the context document.
82
+ */
80
83
  contextUrl: string | null;
81
84
  /**
82
- * The fetched JSON-LD document.
83
- */
85
+ * The fetched JSON-LD document.
86
+ */
84
87
  document: unknown;
85
88
  /**
86
- * The URL of the fetched document.
87
- */
89
+ * The URL of the fetched document.
90
+ */
88
91
  documentUrl: string;
89
92
  }
90
93
  /**
91
- * Options for {@link DocumentLoader}.
92
- * @since 1.8.0
93
- */
94
+ * Options for {@link DocumentLoader}.
95
+ * @since 1.8.0
96
+ */
94
97
  interface DocumentLoaderOptions {
95
98
  /**
96
- * An `AbortSignal` for cancellation.
97
- * @since 1.8.0
98
- */
99
+ * An `AbortSignal` for cancellation.
100
+ * @since 1.8.0
101
+ */
99
102
  signal?: AbortSignal;
100
103
  }
101
104
  /**
102
- * A JSON-LD document loader that fetches documents from the Web.
103
- * @param url The URL of the document to load.
104
- * @param options The options for the document loader.
105
- * @returns The loaded remote document.
106
- */
105
+ * A JSON-LD document loader that fetches documents from the Web.
106
+ * @param url The URL of the document to load.
107
+ * @param options The options for the document loader.
108
+ * @returns The loaded remote document.
109
+ */
107
110
  type DocumentLoader = (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>;
108
111
  /**
109
- * A factory function that creates a {@link DocumentLoader} with options.
110
- * @param options The options for the document loader.
111
- * @returns The document loader.
112
- * @since 1.4.0
113
- */
112
+ * A factory function that creates a {@link DocumentLoader} with options.
113
+ * @param options The options for the document loader.
114
+ * @returns The document loader.
115
+ * @since 1.4.0
116
+ */
114
117
  type DocumentLoaderFactory = (options?: DocumentLoaderFactoryOptions) => DocumentLoader;
115
118
  /**
116
- * Options for {@link DocumentLoaderFactory}.
117
- * @see {@link DocumentLoaderFactory}
118
- * @see {@link AuthenticatedDocumentLoaderFactory}
119
- * @since 1.4.0
120
- */
119
+ * Options for {@link DocumentLoaderFactory}.
120
+ * @see {@link DocumentLoaderFactory}
121
+ * @see {@link AuthenticatedDocumentLoaderFactory}
122
+ * @since 1.4.0
123
+ */
121
124
  interface DocumentLoaderFactoryOptions {
122
125
  /**
123
- * Whether to allow fetching private network addresses.
124
- * Turned off by default.
125
- * @default `false``
126
- */
126
+ * Whether to allow fetching private network addresses.
127
+ * Turned off by default.
128
+ * @default `false``
129
+ */
127
130
  allowPrivateAddress?: boolean;
128
131
  /**
129
- * Options for making `User-Agent` string.
130
- * If a string is given, it is used as the `User-Agent` header value.
131
- * If an object is given, it is passed to {@link getUserAgent} function.
132
- */
132
+ * Options for making `User-Agent` string.
133
+ * If a string is given, it is used as the `User-Agent` header value.
134
+ * If an object is given, it is passed to {@link getUserAgent} function.
135
+ */
133
136
  userAgent?: GetUserAgentOptions | string;
134
137
  }
135
138
  /**
136
- * A factory function that creates an authenticated {@link DocumentLoader} for
137
- * a given identity. This is used for fetching documents that require
138
- * authentication.
139
- * @param identity The identity to create the document loader for.
140
- * The actor's key pair.
141
- * @param options The options for the document loader.
142
- * @returns The authenticated document loader.
143
- * @since 0.4.0
144
- */
139
+ * A factory function that creates an authenticated {@link DocumentLoader} for
140
+ * a given identity. This is used for fetching documents that require
141
+ * authentication.
142
+ * @param identity The identity to create the document loader for.
143
+ * The actor's key pair.
144
+ * @param options The options for the document loader.
145
+ * @returns The authenticated document loader.
146
+ * @since 0.4.0
147
+ */
145
148
  type AuthenticatedDocumentLoaderFactory = (identity: {
146
149
  keyId: URL;
147
150
  privateKey: CryptoKey;
148
151
  }, options?: DocumentLoaderFactoryOptions) => DocumentLoader;
149
152
  /**
150
- * Gets a {@link RemoteDocument} from the given response.
151
- * @param url The URL of the document to load.
152
- * @param response The response to get the document from.
153
- * @param fetch The function to fetch the document.
154
- * @returns The loaded remote document.
155
- * @throws {FetchError} If the response is not OK.
156
- * @internal
157
- */
153
+ * Gets a {@link RemoteDocument} from the given response.
154
+ * @param url The URL of the document to load.
155
+ * @param response The response to get the document from.
156
+ * @param fetch The function to fetch the document.
157
+ * @returns The loaded remote document.
158
+ * @throws {FetchError} If the response is not OK.
159
+ * @internal
160
+ */
158
161
  declare function getRemoteDocument(url: string, response: Response, fetch: (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>): Promise<RemoteDocument>;
159
162
  /**
160
- * Options for {@link getDocumentLoader}.
161
- * @since 1.3.0
162
- */
163
+ * Options for {@link getDocumentLoader}.
164
+ * @since 1.3.0
165
+ */
163
166
  interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
164
167
  /**
165
- * Whether to preload the frequently used contexts.
166
- */
168
+ * Whether to preload the frequently used contexts.
169
+ */
167
170
  skipPreloadedContexts?: boolean;
168
171
  }
169
172
  /**
170
- * Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
171
- *
172
- * The created loader preloads the below frequently used contexts by default
173
- * (unless `options.skipPreloadedContexts` is set to `true`):
174
- *
175
- * - <https://www.w3.org/ns/activitystreams>
176
- * - <https://w3id.org/security/v1>
177
- * - <https://w3id.org/security/data-integrity/v1>
178
- * - <https://www.w3.org/ns/did/v1>
179
- * - <https://w3id.org/security/multikey/v1>
180
- * - <https://purl.archive.org/socialweb/webfinger>
181
- * - <http://schema.org/>
182
- * @param options Options for the document loader.
183
- * @returns The document loader.
184
- * @since 1.3.0
185
- */
173
+ * Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
174
+ *
175
+ * The created loader preloads the below frequently used contexts by default
176
+ * (unless `options.skipPreloadedContexts` is set to `true`):
177
+ *
178
+ * - <https://www.w3.org/ns/activitystreams>
179
+ * - <https://w3id.org/security/v1>
180
+ * - <https://w3id.org/security/data-integrity/v1>
181
+ * - <https://www.w3.org/ns/did/v1>
182
+ * - <https://w3id.org/security/multikey/v1>
183
+ * - <https://purl.archive.org/socialweb/webfinger>
184
+ * - <http://schema.org/>
185
+ * @param options Options for the document loader.
186
+ * @returns The document loader.
187
+ * @since 1.3.0
188
+ */
186
189
  declare function getDocumentLoader({
187
190
  allowPrivateAddress,
188
191
  skipPreloadedContexts,
@@ -191,74 +194,74 @@ declare function getDocumentLoader({
191
194
  //#endregion
192
195
  //#region src/key.d.ts
193
196
  /**
194
- * Imports a PEM-SPKI formatted public key.
195
- * @param pem The PEM-SPKI formatted public key.
196
- * @returns The imported public key.
197
- * @throws {TypeError} If the key is invalid or unsupported.
198
- * @since 0.5.0
199
- */
197
+ * Imports a PEM-SPKI formatted public key.
198
+ * @param pem The PEM-SPKI formatted public key.
199
+ * @returns The imported public key.
200
+ * @throws {TypeError} If the key is invalid or unsupported.
201
+ * @since 0.5.0
202
+ */
200
203
  declare function importSpki(pem: string): Promise<CryptoKey>;
201
204
  /**
202
- * Exports a public key in PEM-SPKI format.
203
- * @param key The public key to export.
204
- * @returns The exported public key in PEM-SPKI format.
205
- * @throws {TypeError} If the key is invalid or unsupported.
206
- * @since 0.5.0
207
- */
205
+ * Exports a public key in PEM-SPKI format.
206
+ * @param key The public key to export.
207
+ * @returns The exported public key in PEM-SPKI format.
208
+ * @throws {TypeError} If the key is invalid or unsupported.
209
+ * @since 0.5.0
210
+ */
208
211
  declare function exportSpki(key: CryptoKey): Promise<string>;
209
212
  /**
210
- * Imports a PEM-PKCS#1 formatted public key.
211
- * @param pem The PEM-PKCS#1 formatted public key.
212
- * @returns The imported public key.
213
- * @throws {TypeError} If the key is invalid or unsupported.
214
- * @since 1.5.0
215
- */
213
+ * Imports a PEM-PKCS#1 formatted public key.
214
+ * @param pem The PEM-PKCS#1 formatted public key.
215
+ * @returns The imported public key.
216
+ * @throws {TypeError} If the key is invalid or unsupported.
217
+ * @since 1.5.0
218
+ */
216
219
  declare function importPkcs1(pem: string): Promise<CryptoKey>;
217
220
  /**
218
- * Imports a PEM formatted public key (SPKI or PKCS#1).
219
- * @param pem The PEM formatted public key to import (SPKI or PKCS#1).
220
- * @returns The imported public key.
221
- * @throws {TypeError} If the key is invalid or unsupported.
222
- * @since 1.5.0
223
- */
221
+ * Imports a PEM formatted public key (SPKI or PKCS#1).
222
+ * @param pem The PEM formatted public key to import (SPKI or PKCS#1).
223
+ * @returns The imported public key.
224
+ * @throws {TypeError} If the key is invalid or unsupported.
225
+ * @since 1.5.0
226
+ */
224
227
  declare function importPem(pem: string): Promise<CryptoKey>;
225
228
  /**
226
- * Imports a [Multibase]-encoded public key.
227
- *
228
- * [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
229
- * @param key The Multibase-encoded public key.
230
- * @returns The imported public key.
231
- * @throws {TypeError} If the key is invalid or unsupported.
232
- * @since 0.10.0
233
- */
229
+ * Imports a [Multibase]-encoded public key.
230
+ *
231
+ * [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
232
+ * @param key The Multibase-encoded public key.
233
+ * @returns The imported public key.
234
+ * @throws {TypeError} If the key is invalid or unsupported.
235
+ * @since 0.10.0
236
+ */
234
237
  declare function importMultibaseKey(key: string): Promise<CryptoKey>;
235
238
  /**
236
- * Exports a public key in [Multibase] format.
237
- *
238
- * [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
239
- * @param key The public key to export.
240
- * @returns The exported public key in Multibase format.
241
- * @throws {TypeError} If the key is invalid or unsupported.
242
- * @since 0.10.0
243
- */
239
+ * Exports a public key in [Multibase] format.
240
+ *
241
+ * [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
242
+ * @param key The public key to export.
243
+ * @returns The exported public key in Multibase format.
244
+ * @throws {TypeError} If the key is invalid or unsupported.
245
+ * @since 0.10.0
246
+ */
244
247
  declare function exportMultibaseKey(key: CryptoKey): Promise<string>;
245
248
  //#endregion
246
249
  //#region src/langstr.d.ts
247
250
  /**
248
- * A language-tagged string which corresponds to the `rdf:langString` type.
249
- */
251
+ * A language-tagged string which corresponds to the `rdf:langString` type.
252
+ */
250
253
  declare class LanguageString extends String {
251
254
  /**
252
- * The locale of the string.
253
- * @since 2.0.0
254
- */
255
+ * The locale of the string.
256
+ * @since 2.0.0
257
+ */
255
258
  readonly locale: Intl.Locale;
256
259
  /**
257
- * Constructs a new `LanguageString`.
258
- * @param value A string value written in the given language.
259
- * @param language The language of the string. If a string is given, it will
260
- * be parsed as a `Intl.Locale` object.
261
- */
260
+ * Constructs a new `LanguageString`.
261
+ * @param value A string value written in the given language.
262
+ * @param language The language of the string. If a string is given, it will
263
+ * be parsed as a `Intl.Locale` object.
264
+ */
262
265
  constructor(value: string, language: Intl.Locale | string);
263
266
  }
264
267
  //#endregion
@@ -280,8 +283,8 @@ interface CodecFactory {
280
283
  //#endregion
281
284
  //#region src/multibase/base.d.ts
282
285
  /**
283
- * Class to encode/decode in the supported Bases
284
- */
286
+ * Class to encode/decode in the supported Bases
287
+ */
285
288
  declare class Base {
286
289
  name: BaseName;
287
290
  private code;
@@ -295,25 +298,25 @@ declare class Base {
295
298
  //#endregion
296
299
  //#region src/multibase/mod.d.ts
297
300
  /**
298
- * Encode data with the specified base and add the multibase prefix.
299
- *
300
- * @throws {Error} Will throw if the encoding is not supported
301
- */
301
+ * Encode data with the specified base and add the multibase prefix.
302
+ *
303
+ * @throws {Error} Will throw if the encoding is not supported
304
+ */
302
305
  declare function encodeMultibase(nameOrCode: BaseNameOrCode, buf: Uint8Array): Uint8Array;
303
306
  /**
304
- * Takes a Uint8Array or string encoded with multibase header, decodes it and
305
- * returns the decoded buffer
306
- *
307
- * @throws {Error} Will throw if the encoding is not supported
308
- */
307
+ * Takes a Uint8Array or string encoded with multibase header, decodes it and
308
+ * returns the decoded buffer
309
+ *
310
+ * @throws {Error} Will throw if the encoding is not supported
311
+ */
309
312
  declare function decodeMultibase(data: Uint8Array | string): Uint8Array;
310
313
  /**
311
- * Get encoding multibase from data
312
- *
313
- * @param {string|Uint8Array} data
314
- * @returns {Base}
315
- * @throws {Error} Will throw if the encoding is not supported
316
- */
314
+ * Get encoding multibase from data
315
+ *
316
+ * @param {string|Uint8Array} data
317
+ * @returns {Base}
318
+ * @throws {Error} Will throw if the encoding is not supported
319
+ */
317
320
  declare function encodingFromBaseData(data: string | Uint8Array): Base;
318
321
  //#endregion
319
322
  //#region src/url.d.ts
@@ -321,8 +324,8 @@ declare class UrlError extends Error {
321
324
  constructor(message: string);
322
325
  }
323
326
  /**
324
- * Validates a URL to prevent SSRF attacks.
325
- */
327
+ * Validates a URL to prevent SSRF attacks.
328
+ */
326
329
  declare function validatePublicUrl(url: string): Promise<void>;
327
330
  declare function isValidPublicIPv4Address(address: string): boolean;
328
331
  declare function isValidPublicIPv6Address(address: string): boolean;
package/dist/mod.js CHANGED
@@ -4159,7 +4159,7 @@ var contexts_default = preloadedContexts;
4159
4159
  //#endregion
4160
4160
  //#region deno.json
4161
4161
  var name = "@fedify/vocab-runtime";
4162
- var version = "2.0.1";
4162
+ var version = "2.0.2-dev.407+6f4b2e28";
4163
4163
  var license = "MIT";
4164
4164
  var exports = { ".": "./src/mod.ts" };
4165
4165
  var description = "Runtime library for @fedify/vocab";
@@ -5176,12 +5176,12 @@ var LanguageString = class extends String {
5176
5176
  super(value);
5177
5177
  this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
5178
5178
  }
5179
- [Symbol.for("Deno.customInspect")](inspect, options) {
5180
- return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
5181
- }
5182
- [Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
5183
- return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
5184
- }
5179
+ };
5180
+ LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
5181
+ return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
5182
+ };
5183
+ LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
5184
+ return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
5185
5185
  };
5186
5186
 
5187
5187
  //#endregion
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-DWy1uDak.cjs');
2
- const require_request = require('./request-SIAvz5ea.cjs');
2
+ const require_request = require('./request-BqFfup5U.cjs');
3
3
  const require_link = require('./link-CdFPEo9O.cjs');
4
4
  const require_url = require('./url-C5Vs9nYh.cjs');
5
5
  const node_assert = require_chunk.__toESM(require("node:assert"));
@@ -1,4 +1,4 @@
1
- import { FetchError, createActivityPubRequest, deno_default, logRequest } from "./request-IQS3NkQj.js";
1
+ import { FetchError, createActivityPubRequest, deno_default, logRequest } from "./request-MG88TQ9o.js";
2
2
  import { HttpHeaderLink } from "./link-Ck2yj4dH.js";
3
3
  import { UrlError, validatePublicUrl } from "./url-fW_DHbih.js";
4
4
  import "node:module";
@@ -23,12 +23,12 @@ var LanguageString = class extends String {
23
23
  super(value);
24
24
  this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
25
25
  }
26
- [Symbol.for("Deno.customInspect")](inspect, options) {
27
- return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
28
- }
29
- [Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
30
- return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
31
- }
26
+ };
27
+ LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
28
+ return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
29
+ };
30
+ LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
31
+ return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
32
32
  };
33
33
 
34
34
  //#endregion
@@ -22,12 +22,12 @@ var LanguageString = class extends String {
22
22
  super(value);
23
23
  this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
24
24
  }
25
- [Symbol.for("Deno.customInspect")](inspect, options) {
26
- return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
27
- }
28
- [Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
29
- return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
30
- }
25
+ };
26
+ LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
27
+ return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
28
+ };
29
+ LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
30
+ return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
31
31
  };
32
32
 
33
33
  //#endregion
@@ -3,7 +3,7 @@ const node_process = require_chunk.__toESM(require("node:process"));
3
3
 
4
4
  //#region deno.json
5
5
  var name = "@fedify/vocab-runtime";
6
- var version = "2.0.1";
6
+ var version = "2.0.2-dev.407+6f4b2e28";
7
7
  var license = "MIT";
8
8
  var exports$1 = { ".": "./src/mod.ts" };
9
9
  var description = "Runtime library for @fedify/vocab";
@@ -2,7 +2,7 @@ import process from "node:process";
2
2
 
3
3
  //#region deno.json
4
4
  var name = "@fedify/vocab-runtime";
5
- var version = "2.0.1";
5
+ var version = "2.0.2-dev.407+6f4b2e28";
6
6
  var license = "MIT";
7
7
  var exports = { ".": "./src/mod.ts" };
8
8
  var description = "Runtime library for @fedify/vocab";
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-DWy1uDak.cjs');
2
- const require_request = require('./request-SIAvz5ea.cjs');
2
+ const require_request = require('./request-BqFfup5U.cjs');
3
3
  const node_assert = require_chunk.__toESM(require("node:assert"));
4
4
  const node_test = require_chunk.__toESM(require("node:test"));
5
5
  const node_process = require_chunk.__toESM(require("node:process"));
@@ -1,4 +1,4 @@
1
- import { deno_default, getUserAgent } from "./request-IQS3NkQj.js";
1
+ import { deno_default, getUserAgent } from "./request-MG88TQ9o.js";
2
2
  import { deepStrictEqual } from "node:assert";
3
3
  import { test } from "node:test";
4
4
  import process from "node:process";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-runtime",
3
- "version": "2.0.1",
3
+ "version": "2.0.2-dev.407+6f4b2e28",
4
4
  "homepage": "https://fedify.dev/",
5
5
  "repository": {
6
6
  "type": "git",
package/src/langstr.ts CHANGED
@@ -20,19 +20,27 @@ export class LanguageString extends String {
20
20
  ? new Intl.Locale(language)
21
21
  : language;
22
22
  }
23
+ }
23
24
 
24
- [Symbol.for("Deno.customInspect")](
25
- inspect: typeof Deno.inspect,
26
- options: Deno.InspectOptions,
27
- ): string {
28
- return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
29
- }
25
+ // Custom inspect hooks for Deno and Node.js debuggers are assigned outside
26
+ // the class body because computed property names using Symbol.for() are
27
+ // incompatible with isolatedDeclarations mode.
28
+ // deno-lint-ignore no-explicit-any
29
+ (LanguageString.prototype as any)[Symbol.for("Deno.customInspect")] = function (
30
+ this: LanguageString,
31
+ inspect: (val: unknown, opts: unknown) => string,
32
+ options: unknown,
33
+ ): string {
34
+ return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
35
+ };
30
36
 
31
- [Symbol.for("nodejs.util.inspect.custom")](
37
+ // deno-lint-ignore no-explicit-any
38
+ (LanguageString.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] =
39
+ function (
40
+ this: LanguageString,
32
41
  _depth: number,
33
42
  options: unknown,
34
43
  inspect: (value: unknown, options: unknown) => string,
35
44
  ): string {
36
45
  return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
37
- }
38
- }
46
+ };
@@ -72,7 +72,9 @@ const constants: Array<[BaseName, BaseCode, CodecFactory, string]> = [
72
72
  ],
73
73
  ];
74
74
 
75
- export const names = constants.reduce<Record<BaseName, Base>>(
75
+ export const names: Record<BaseName, Base> = constants.reduce<
76
+ Record<BaseName, Base>
77
+ >(
76
78
  (prev, tupple) => {
77
79
  prev[tupple[0]] = new Base(tupple[0], tupple[1], tupple[2], tupple[3]);
78
80
  return prev;
@@ -80,7 +82,9 @@ export const names = constants.reduce<Record<BaseName, Base>>(
80
82
  {} as Record<BaseName, Base>,
81
83
  );
82
84
 
83
- export const codes = constants.reduce<Record<BaseCode, Base>>(
85
+ export const codes: Record<BaseCode, Base> = constants.reduce<
86
+ Record<BaseCode, Base>
87
+ >(
84
88
  (prev, tupple) => {
85
89
  prev[tupple[1]] = names[tupple[0]];
86
90
  return prev;
package/src/request.ts CHANGED
@@ -103,7 +103,7 @@ export function getUserAgent(
103
103
  * @param request The request to log.
104
104
  * @internal
105
105
  */
106
- export function logRequest(logger: Logger, request: Request) {
106
+ export function logRequest(logger: Logger, request: Request): void {
107
107
  logger.debug(
108
108
  "Fetching document: {method} {url} {headers}",
109
109
  {
package/tsdown.config.ts CHANGED
@@ -5,7 +5,7 @@ import { defineConfig } from "tsdown";
5
5
  export default [
6
6
  defineConfig({
7
7
  entry: ["src/mod.ts"],
8
- dts: true,
8
+ dts: { compilerOptions: { isolatedDeclarations: true, declaration: true } },
9
9
  format: ["esm", "cjs"],
10
10
  platform: "neutral",
11
11
  external: [/^node:/],