@fedify/vocab-runtime 2.2.15 → 2.2.17
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 +2 -2
- package/dist/mod.cjs +97 -4
- package/dist/mod.d.cts +30 -2
- package/dist/mod.d.ts +30 -2
- package/dist/mod.js +97 -5
- package/dist/tests/{body-CqKAKwOx.cjs → body-Bxt2m_JA.cjs} +1 -1
- package/dist/tests/{body-BEICpUEw.mjs → body-DfFCA-Lo.mjs} +1 -1
- package/dist/tests/body.test.cjs +1 -1
- package/dist/tests/body.test.mjs +1 -1
- package/dist/tests/decimal.test.cjs +3 -2
- package/dist/tests/decimal.test.mjs +3 -2
- package/dist/tests/{docloader-Cdxserjt.mjs → docloader-B2YL1dZE.mjs} +49 -3
- package/dist/tests/{docloader-BuajalHS.cjs → docloader-bp9CfxxP.cjs} +49 -3
- package/dist/tests/docloader.test.cjs +168 -43
- package/dist/tests/docloader.test.mjs +158 -34
- package/dist/tests/{langstr-DDLc4833.mjs → langstr-ABdAOKlF.mjs} +5 -2
- package/dist/tests/{langstr-BOQHfJDr.cjs → langstr-BsqFJupv.cjs} +5 -2
- package/dist/tests/langstr.test.cjs +8 -1
- package/dist/tests/langstr.test.mjs +9 -2
- package/dist/tests/langtag-DgySESmk.cjs +50 -0
- package/dist/tests/langtag-LDBqlxHv.mjs +45 -0
- package/dist/tests/langtag.test.cjs +46 -0
- package/dist/tests/langtag.test.d.cts +1 -0
- package/dist/tests/langtag.test.d.mts +1 -0
- package/dist/tests/langtag.test.mjs +46 -0
- package/dist/tests/multibase/multibase.test.cjs +7 -7
- package/dist/tests/multibase/multibase.test.mjs +5 -5
- package/dist/tests/{request-kSQ7_Tkq.mjs → request-BI4kDbBx.mjs} +1 -1
- package/dist/tests/{request-DbfTXEol.cjs → request-CHH9A9oL.cjs} +1 -1
- package/dist/tests/request.test.cjs +1 -1
- package/dist/tests/request.test.mjs +1 -1
- package/package.json +6 -3
- package/scripts/test-bun.mjs +18 -0
- package/src/contexts/fep-22cd.json +14 -0
- package/src/contexts/fep-6757.json +12 -0
- package/src/contexts/joinmastodon.json +1 -1
- package/src/contexts.ts +16 -0
- package/src/docloader.test.ts +222 -67
- package/src/docloader.ts +2 -0
- package/src/langstr.test.ts +18 -1
- package/src/langstr.ts +6 -2
- package/src/langtag.test.ts +53 -0
- package/src/langtag.ts +76 -0
- package/src/mod.ts +1 -0
- package/src/multibase/multibase.test.ts +5 -5
package/deno.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/vocab-runtime",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/mod.ts",
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
},
|
|
35
35
|
"tasks": {
|
|
36
36
|
"check": "deno fmt --check && deno lint && deno check src/*.ts",
|
|
37
|
-
"test": "deno test"
|
|
37
|
+
"test": "deno test --allow-net --allow-env=LOG"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/dist/mod.cjs
CHANGED
|
@@ -564,6 +564,36 @@ var did_v1_default = { "@context": {
|
|
|
564
564
|
}
|
|
565
565
|
} };
|
|
566
566
|
//#endregion
|
|
567
|
+
//#region src/contexts/fep-22cd.json
|
|
568
|
+
var fep_22cd_default = { "@context": {
|
|
569
|
+
"fep-22cd": "https://w3id.org/fep/22cd#",
|
|
570
|
+
"schema": "https://schema.org/",
|
|
571
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
572
|
+
"translations": {
|
|
573
|
+
"@id": "fep-22cd:translations",
|
|
574
|
+
"@container": "@set"
|
|
575
|
+
},
|
|
576
|
+
"Translation": "fep-22cd:Translation",
|
|
577
|
+
"sourceUpdated": {
|
|
578
|
+
"@id": "fep-22cd:sourceUpdated",
|
|
579
|
+
"@type": "xsd:dateTime"
|
|
580
|
+
},
|
|
581
|
+
"translator": {
|
|
582
|
+
"@id": "schema:translator",
|
|
583
|
+
"@type": "@id",
|
|
584
|
+
"@container": "@set"
|
|
585
|
+
},
|
|
586
|
+
"inLanguage": "schema:inLanguage",
|
|
587
|
+
"translationOfWork": {
|
|
588
|
+
"@id": "schema:translationOfWork",
|
|
589
|
+
"@type": "@id"
|
|
590
|
+
},
|
|
591
|
+
"isBasedOn": {
|
|
592
|
+
"@id": "schema:isBasedOn",
|
|
593
|
+
"@type": "@id"
|
|
594
|
+
}
|
|
595
|
+
} };
|
|
596
|
+
//#endregion
|
|
567
597
|
//#region src/contexts/fep-5711.json
|
|
568
598
|
var fep_5711_default = { "@context": {
|
|
569
599
|
"likesOf": {
|
|
@@ -600,6 +630,18 @@ var fep_5711_default = { "@context": {
|
|
|
600
630
|
}
|
|
601
631
|
} };
|
|
602
632
|
//#endregion
|
|
633
|
+
//#region src/contexts/fep-6757.json
|
|
634
|
+
var fep_6757_default = { "@context": {
|
|
635
|
+
"license": {
|
|
636
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
637
|
+
"@type": "@id"
|
|
638
|
+
},
|
|
639
|
+
"preferredLicense": {
|
|
640
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
641
|
+
"@type": "@id"
|
|
642
|
+
}
|
|
643
|
+
} };
|
|
644
|
+
//#endregion
|
|
603
645
|
//#region src/contexts/fep-7aa9.json
|
|
604
646
|
var fep_7aa9_default = { "@context": {
|
|
605
647
|
"FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
|
|
@@ -926,7 +968,7 @@ var joinmastodon_default = { "@context": {
|
|
|
926
968
|
"suspended": "toot:suspended",
|
|
927
969
|
"attributionDomains": {
|
|
928
970
|
"@id": "toot:attributionDomains",
|
|
929
|
-
"@
|
|
971
|
+
"@container": "@set"
|
|
930
972
|
}
|
|
931
973
|
} };
|
|
932
974
|
//#endregion
|
|
@@ -4542,6 +4584,8 @@ const preloadedContexts = {
|
|
|
4542
4584
|
"https://www.w3.org/ns/cid/v1": cid_v1_default,
|
|
4543
4585
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
4544
4586
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
4587
|
+
"https://w3id.org/fep/6757": fep_6757_default,
|
|
4588
|
+
"https://w3id.org/fep/22cd": fep_22cd_default,
|
|
4545
4589
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
4546
4590
|
"http://joinmastodon.org/ns": joinmastodon_default,
|
|
4547
4591
|
"https://purl.archive.org/miscellany": miscellany_default
|
|
@@ -4549,7 +4593,7 @@ const preloadedContexts = {
|
|
|
4549
4593
|
//#endregion
|
|
4550
4594
|
//#region deno.json
|
|
4551
4595
|
var name = "@fedify/vocab-runtime";
|
|
4552
|
-
var version = "2.2.
|
|
4596
|
+
var version = "2.2.17";
|
|
4553
4597
|
//#endregion
|
|
4554
4598
|
//#region src/request.ts
|
|
4555
4599
|
/**
|
|
@@ -5197,6 +5241,8 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5197
5241
|
* - <https://w3id.org/security/multikey/v1>
|
|
5198
5242
|
* - <https://w3id.org/fep/ef61>
|
|
5199
5243
|
* - <https://w3id.org/fep/7aa9>
|
|
5244
|
+
* - <https://w3id.org/fep/6757>
|
|
5245
|
+
* - <https://w3id.org/fep/22cd>
|
|
5200
5246
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5201
5247
|
* - <http://schema.org/>
|
|
5202
5248
|
* @param options Options for the document loader.
|
|
@@ -5855,6 +5901,50 @@ function parseDecimal(value) {
|
|
|
5855
5901
|
return normalized;
|
|
5856
5902
|
}
|
|
5857
5903
|
//#endregion
|
|
5904
|
+
//#region src/langtag.ts
|
|
5905
|
+
const EXTLANG_PAIRS = new Set(Object.entries({
|
|
5906
|
+
ar: "aao abh abv acm acq acw acx acy adf aeb aec afb ajp apc apd arb arq ars ary arz auz avl ayh ayl ayn ayp bbz pga shu ssh",
|
|
5907
|
+
kok: "gom knn",
|
|
5908
|
+
lv: "ltg lvs",
|
|
5909
|
+
ms: "bjn btj bve bvu coa dup hji jak jax kvb kvr kxd lce lcf liw max meo mfa mfb min mqg msi mui orn ors pel pse tmw urk vkk vkt xmm zlm zmi zsm",
|
|
5910
|
+
sgn: "ads aed aen afg ajs ase asf asp asq asw bfi bfk bog bqn bqy bvl bzs cds csc csd cse csf csg csl csn csq csr csx doq dse dsl dsz dyl ecs ehs esl esn eso eth fcs fse fsl fss gds gse gsg gsm gss gus hab haf hds hks hos hps hsh hsl icl iks ils inl ins ise isg isr jcs jhs jks jls jos jsl jus kgi kvk lbs lgs lls lsb lsc lsg lsl lsn lso lsp lst lsv lsw lsy lws mdl mfs mre msd msr mzc mzg mzy nbs ncs nsi nsl nsp nsr nzs okl pgz pks prl prz psc psd psg psl pso psp psr pys rib rms rnb rsi rsl rsm rsn sdl sfb sfs sgg sgx slf sls sqk sqs sqx ssp ssr svk swl syy szs tse tsm tsq tss tsy tza ugn ugy ukl uks vgt vsi vsl vsv wbs xki xml xms yds ygs yhs ysl ysm zhk zib zsl",
|
|
5911
|
+
sw: "swc swh",
|
|
5912
|
+
uz: "uzn uzs",
|
|
5913
|
+
zh: "cdo cjy cmn cnp cpx csp czh czo gan hak hnm hsn luh lzh mnp nan sjc wuu yue"
|
|
5914
|
+
}).flatMap(([prefix, extlangs]) => extlangs.split(" ").map((extlang) => `${prefix}-${extlang}`)));
|
|
5915
|
+
const PREFIX_PATTERN = /^[A-Za-z]{2,3}$/;
|
|
5916
|
+
const EXTLANG_PATTERN = /^[A-Za-z]{3}$/;
|
|
5917
|
+
/**
|
|
5918
|
+
* Normalizes a BCP 47 language tag that has an extended language subtag
|
|
5919
|
+
* (extlang), such as `zh-yue`, into its canonical form, such as `yue`, as
|
|
5920
|
+
* described in [RFC 5646, Section 4.5][1]. `Intl.Locale` rejects extlang
|
|
5921
|
+
* tags, so tags should be normalized before being passed to it.
|
|
5922
|
+
*
|
|
5923
|
+
* Only registered extlangs that follow their registered prefix are removed;
|
|
5924
|
+
* any other tag is returned unchanged, so the result still needs to be
|
|
5925
|
+
* validated, e.g., by `Intl.Locale`.
|
|
5926
|
+
*
|
|
5927
|
+
* NOTE: This function is marked as internal in the 2.0.x–2.4.x patch
|
|
5928
|
+
* releases. When merging it into the *main* branch, remove the `@internal`
|
|
5929
|
+
* tag, formalize it as a public API (`@since 2.5.0`), and add it to
|
|
5930
|
+
* the changelog fragment.
|
|
5931
|
+
*
|
|
5932
|
+
* [1]: https://www.rfc-editor.org/rfc/rfc5646.html#section-4.5
|
|
5933
|
+
*
|
|
5934
|
+
* @param tag The BCP 47 language tag to normalize.
|
|
5935
|
+
* @returns The normalized language tag.
|
|
5936
|
+
* @internal
|
|
5937
|
+
*/
|
|
5938
|
+
function normalizeLanguageTag(tag) {
|
|
5939
|
+
const subtags = tag.split("-");
|
|
5940
|
+
if (subtags.length < 2) return tag;
|
|
5941
|
+
const [prefix, extlang, ...rest] = subtags;
|
|
5942
|
+
if (!PREFIX_PATTERN.test(prefix) || !EXTLANG_PATTERN.test(extlang)) return tag;
|
|
5943
|
+
const language = extlang.toLowerCase();
|
|
5944
|
+
if (!EXTLANG_PAIRS.has(`${prefix.toLowerCase()}-${language}`)) return tag;
|
|
5945
|
+
return [language, ...rest].join("-");
|
|
5946
|
+
}
|
|
5947
|
+
//#endregion
|
|
5858
5948
|
//#region src/langstr.ts
|
|
5859
5949
|
/**
|
|
5860
5950
|
* A language-tagged string which corresponds to the `rdf:langString` type.
|
|
@@ -5869,11 +5959,13 @@ var LanguageString = class extends String {
|
|
|
5869
5959
|
* Constructs a new `LanguageString`.
|
|
5870
5960
|
* @param value A string value written in the given language.
|
|
5871
5961
|
* @param language The language of the string. If a string is given, it will
|
|
5872
|
-
* be parsed as a `Intl.Locale` object.
|
|
5962
|
+
* be parsed as a `Intl.Locale` object. Extended language
|
|
5963
|
+
* subtags are normalized first, e.g., `zh-yue` is parsed as
|
|
5964
|
+
* `yue`.
|
|
5873
5965
|
*/
|
|
5874
5966
|
constructor(value, language) {
|
|
5875
5967
|
super(value);
|
|
5876
|
-
this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
|
|
5968
|
+
this.locale = typeof language === "string" ? new Intl.Locale(normalizeLanguageTag(language)) : language;
|
|
5877
5969
|
}
|
|
5878
5970
|
};
|
|
5879
5971
|
LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
@@ -5905,6 +5997,7 @@ exports.isDecimal = isDecimal;
|
|
|
5905
5997
|
exports.isValidPublicIPv4Address = isValidPublicIPv4Address;
|
|
5906
5998
|
exports.isValidPublicIPv6Address = isValidPublicIPv6Address;
|
|
5907
5999
|
exports.logRequest = logRequest;
|
|
6000
|
+
exports.normalizeLanguageTag = normalizeLanguageTag;
|
|
5908
6001
|
exports.parseDecimal = parseDecimal;
|
|
5909
6002
|
exports.preloadedContexts = preloadedContexts;
|
|
5910
6003
|
exports.validatePublicUrl = validatePublicUrl;
|
package/dist/mod.d.cts
CHANGED
|
@@ -194,6 +194,8 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
194
194
|
* - <https://w3id.org/security/multikey/v1>
|
|
195
195
|
* - <https://w3id.org/fep/ef61>
|
|
196
196
|
* - <https://w3id.org/fep/7aa9>
|
|
197
|
+
* - <https://w3id.org/fep/6757>
|
|
198
|
+
* - <https://w3id.org/fep/22cd>
|
|
197
199
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
198
200
|
* - <http://schema.org/>
|
|
199
201
|
* @param options Options for the document loader.
|
|
@@ -369,11 +371,37 @@ declare class LanguageString extends String {
|
|
|
369
371
|
* Constructs a new `LanguageString`.
|
|
370
372
|
* @param value A string value written in the given language.
|
|
371
373
|
* @param language The language of the string. If a string is given, it will
|
|
372
|
-
* be parsed as a `Intl.Locale` object.
|
|
374
|
+
* be parsed as a `Intl.Locale` object. Extended language
|
|
375
|
+
* subtags are normalized first, e.g., `zh-yue` is parsed as
|
|
376
|
+
* `yue`.
|
|
373
377
|
*/
|
|
374
378
|
constructor(value: string, language: Intl.Locale | string);
|
|
375
379
|
}
|
|
376
380
|
//#endregion
|
|
381
|
+
//#region src/langtag.d.ts
|
|
382
|
+
/**
|
|
383
|
+
* Normalizes a BCP 47 language tag that has an extended language subtag
|
|
384
|
+
* (extlang), such as `zh-yue`, into its canonical form, such as `yue`, as
|
|
385
|
+
* described in [RFC 5646, Section 4.5][1]. `Intl.Locale` rejects extlang
|
|
386
|
+
* tags, so tags should be normalized before being passed to it.
|
|
387
|
+
*
|
|
388
|
+
* Only registered extlangs that follow their registered prefix are removed;
|
|
389
|
+
* any other tag is returned unchanged, so the result still needs to be
|
|
390
|
+
* validated, e.g., by `Intl.Locale`.
|
|
391
|
+
*
|
|
392
|
+
* NOTE: This function is marked as internal in the 2.0.x–2.4.x patch
|
|
393
|
+
* releases. When merging it into the *main* branch, remove the `@internal`
|
|
394
|
+
* tag, formalize it as a public API (`@since 2.5.0`), and add it to
|
|
395
|
+
* the changelog fragment.
|
|
396
|
+
*
|
|
397
|
+
* [1]: https://www.rfc-editor.org/rfc/rfc5646.html#section-4.5
|
|
398
|
+
*
|
|
399
|
+
* @param tag The BCP 47 language tag to normalize.
|
|
400
|
+
* @returns The normalized language tag.
|
|
401
|
+
* @internal
|
|
402
|
+
*/
|
|
403
|
+
declare function normalizeLanguageTag(tag: string): string;
|
|
404
|
+
//#endregion
|
|
377
405
|
//#region src/multibase/types.d.ts
|
|
378
406
|
type BaseCode = "\x00" | "0" | "7" | "9" | "f" | "F" | "v" | "V" | "t" | "T" | "b" | "B" | "c" | "C" | "h" | "k" | "K" | "z" | "Z" | "m" | "M" | "u" | "U";
|
|
379
407
|
/**
|
|
@@ -448,4 +476,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
|
|
|
448
476
|
declare function isValidPublicIPv6Address(address: string): boolean;
|
|
449
477
|
declare function expandIPv6Address(address: string): string;
|
|
450
478
|
//#endregion
|
|
451
|
-
export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, LanguageString, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, preloadedContexts, validatePublicUrl };
|
|
479
|
+
export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, LanguageString, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, normalizeLanguageTag, parseDecimal, preloadedContexts, validatePublicUrl };
|
package/dist/mod.d.ts
CHANGED
|
@@ -193,6 +193,8 @@ interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
|
193
193
|
* - <https://w3id.org/security/multikey/v1>
|
|
194
194
|
* - <https://w3id.org/fep/ef61>
|
|
195
195
|
* - <https://w3id.org/fep/7aa9>
|
|
196
|
+
* - <https://w3id.org/fep/6757>
|
|
197
|
+
* - <https://w3id.org/fep/22cd>
|
|
196
198
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
197
199
|
* - <http://schema.org/>
|
|
198
200
|
* @param options Options for the document loader.
|
|
@@ -368,11 +370,37 @@ declare class LanguageString extends String {
|
|
|
368
370
|
* Constructs a new `LanguageString`.
|
|
369
371
|
* @param value A string value written in the given language.
|
|
370
372
|
* @param language The language of the string. If a string is given, it will
|
|
371
|
-
* be parsed as a `Intl.Locale` object.
|
|
373
|
+
* be parsed as a `Intl.Locale` object. Extended language
|
|
374
|
+
* subtags are normalized first, e.g., `zh-yue` is parsed as
|
|
375
|
+
* `yue`.
|
|
372
376
|
*/
|
|
373
377
|
constructor(value: string, language: Intl.Locale | string);
|
|
374
378
|
}
|
|
375
379
|
//#endregion
|
|
380
|
+
//#region src/langtag.d.ts
|
|
381
|
+
/**
|
|
382
|
+
* Normalizes a BCP 47 language tag that has an extended language subtag
|
|
383
|
+
* (extlang), such as `zh-yue`, into its canonical form, such as `yue`, as
|
|
384
|
+
* described in [RFC 5646, Section 4.5][1]. `Intl.Locale` rejects extlang
|
|
385
|
+
* tags, so tags should be normalized before being passed to it.
|
|
386
|
+
*
|
|
387
|
+
* Only registered extlangs that follow their registered prefix are removed;
|
|
388
|
+
* any other tag is returned unchanged, so the result still needs to be
|
|
389
|
+
* validated, e.g., by `Intl.Locale`.
|
|
390
|
+
*
|
|
391
|
+
* NOTE: This function is marked as internal in the 2.0.x–2.4.x patch
|
|
392
|
+
* releases. When merging it into the *main* branch, remove the `@internal`
|
|
393
|
+
* tag, formalize it as a public API (`@since 2.5.0`), and add it to
|
|
394
|
+
* the changelog fragment.
|
|
395
|
+
*
|
|
396
|
+
* [1]: https://www.rfc-editor.org/rfc/rfc5646.html#section-4.5
|
|
397
|
+
*
|
|
398
|
+
* @param tag The BCP 47 language tag to normalize.
|
|
399
|
+
* @returns The normalized language tag.
|
|
400
|
+
* @internal
|
|
401
|
+
*/
|
|
402
|
+
declare function normalizeLanguageTag(tag: string): string;
|
|
403
|
+
//#endregion
|
|
376
404
|
//#region src/multibase/types.d.ts
|
|
377
405
|
type BaseCode = "\x00" | "0" | "7" | "9" | "f" | "F" | "v" | "V" | "t" | "T" | "b" | "B" | "c" | "C" | "h" | "k" | "K" | "z" | "Z" | "m" | "M" | "u" | "U";
|
|
378
406
|
/**
|
|
@@ -447,4 +475,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
|
|
|
447
475
|
declare function isValidPublicIPv6Address(address: string): boolean;
|
|
448
476
|
declare function expandIPv6Address(address: string): string;
|
|
449
477
|
//#endregion
|
|
450
|
-
export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, LanguageString, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, preloadedContexts, validatePublicUrl };
|
|
478
|
+
export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, LanguageString, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, normalizeLanguageTag, parseDecimal, preloadedContexts, validatePublicUrl };
|
package/dist/mod.js
CHANGED
|
@@ -559,6 +559,36 @@ var did_v1_default = { "@context": {
|
|
|
559
559
|
}
|
|
560
560
|
} };
|
|
561
561
|
//#endregion
|
|
562
|
+
//#region src/contexts/fep-22cd.json
|
|
563
|
+
var fep_22cd_default = { "@context": {
|
|
564
|
+
"fep-22cd": "https://w3id.org/fep/22cd#",
|
|
565
|
+
"schema": "https://schema.org/",
|
|
566
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
567
|
+
"translations": {
|
|
568
|
+
"@id": "fep-22cd:translations",
|
|
569
|
+
"@container": "@set"
|
|
570
|
+
},
|
|
571
|
+
"Translation": "fep-22cd:Translation",
|
|
572
|
+
"sourceUpdated": {
|
|
573
|
+
"@id": "fep-22cd:sourceUpdated",
|
|
574
|
+
"@type": "xsd:dateTime"
|
|
575
|
+
},
|
|
576
|
+
"translator": {
|
|
577
|
+
"@id": "schema:translator",
|
|
578
|
+
"@type": "@id",
|
|
579
|
+
"@container": "@set"
|
|
580
|
+
},
|
|
581
|
+
"inLanguage": "schema:inLanguage",
|
|
582
|
+
"translationOfWork": {
|
|
583
|
+
"@id": "schema:translationOfWork",
|
|
584
|
+
"@type": "@id"
|
|
585
|
+
},
|
|
586
|
+
"isBasedOn": {
|
|
587
|
+
"@id": "schema:isBasedOn",
|
|
588
|
+
"@type": "@id"
|
|
589
|
+
}
|
|
590
|
+
} };
|
|
591
|
+
//#endregion
|
|
562
592
|
//#region src/contexts/fep-5711.json
|
|
563
593
|
var fep_5711_default = { "@context": {
|
|
564
594
|
"likesOf": {
|
|
@@ -595,6 +625,18 @@ var fep_5711_default = { "@context": {
|
|
|
595
625
|
}
|
|
596
626
|
} };
|
|
597
627
|
//#endregion
|
|
628
|
+
//#region src/contexts/fep-6757.json
|
|
629
|
+
var fep_6757_default = { "@context": {
|
|
630
|
+
"license": {
|
|
631
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
632
|
+
"@type": "@id"
|
|
633
|
+
},
|
|
634
|
+
"preferredLicense": {
|
|
635
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
636
|
+
"@type": "@id"
|
|
637
|
+
}
|
|
638
|
+
} };
|
|
639
|
+
//#endregion
|
|
598
640
|
//#region src/contexts/fep-7aa9.json
|
|
599
641
|
var fep_7aa9_default = { "@context": {
|
|
600
642
|
"FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
|
|
@@ -921,7 +963,7 @@ var joinmastodon_default = { "@context": {
|
|
|
921
963
|
"suspended": "toot:suspended",
|
|
922
964
|
"attributionDomains": {
|
|
923
965
|
"@id": "toot:attributionDomains",
|
|
924
|
-
"@
|
|
966
|
+
"@container": "@set"
|
|
925
967
|
}
|
|
926
968
|
} };
|
|
927
969
|
//#endregion
|
|
@@ -4537,6 +4579,8 @@ const preloadedContexts = {
|
|
|
4537
4579
|
"https://www.w3.org/ns/cid/v1": cid_v1_default,
|
|
4538
4580
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
4539
4581
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
4582
|
+
"https://w3id.org/fep/6757": fep_6757_default,
|
|
4583
|
+
"https://w3id.org/fep/22cd": fep_22cd_default,
|
|
4540
4584
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
4541
4585
|
"http://joinmastodon.org/ns": joinmastodon_default,
|
|
4542
4586
|
"https://purl.archive.org/miscellany": miscellany_default
|
|
@@ -4544,7 +4588,7 @@ const preloadedContexts = {
|
|
|
4544
4588
|
//#endregion
|
|
4545
4589
|
//#region deno.json
|
|
4546
4590
|
var name = "@fedify/vocab-runtime";
|
|
4547
|
-
var version = "2.2.
|
|
4591
|
+
var version = "2.2.17";
|
|
4548
4592
|
//#endregion
|
|
4549
4593
|
//#region src/request.ts
|
|
4550
4594
|
/**
|
|
@@ -5192,6 +5236,8 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
5192
5236
|
* - <https://w3id.org/security/multikey/v1>
|
|
5193
5237
|
* - <https://w3id.org/fep/ef61>
|
|
5194
5238
|
* - <https://w3id.org/fep/7aa9>
|
|
5239
|
+
* - <https://w3id.org/fep/6757>
|
|
5240
|
+
* - <https://w3id.org/fep/22cd>
|
|
5195
5241
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
5196
5242
|
* - <http://schema.org/>
|
|
5197
5243
|
* @param options Options for the document loader.
|
|
@@ -5850,6 +5896,50 @@ function parseDecimal(value) {
|
|
|
5850
5896
|
return normalized;
|
|
5851
5897
|
}
|
|
5852
5898
|
//#endregion
|
|
5899
|
+
//#region src/langtag.ts
|
|
5900
|
+
const EXTLANG_PAIRS = new Set(Object.entries({
|
|
5901
|
+
ar: "aao abh abv acm acq acw acx acy adf aeb aec afb ajp apc apd arb arq ars ary arz auz avl ayh ayl ayn ayp bbz pga shu ssh",
|
|
5902
|
+
kok: "gom knn",
|
|
5903
|
+
lv: "ltg lvs",
|
|
5904
|
+
ms: "bjn btj bve bvu coa dup hji jak jax kvb kvr kxd lce lcf liw max meo mfa mfb min mqg msi mui orn ors pel pse tmw urk vkk vkt xmm zlm zmi zsm",
|
|
5905
|
+
sgn: "ads aed aen afg ajs ase asf asp asq asw bfi bfk bog bqn bqy bvl bzs cds csc csd cse csf csg csl csn csq csr csx doq dse dsl dsz dyl ecs ehs esl esn eso eth fcs fse fsl fss gds gse gsg gsm gss gus hab haf hds hks hos hps hsh hsl icl iks ils inl ins ise isg isr jcs jhs jks jls jos jsl jus kgi kvk lbs lgs lls lsb lsc lsg lsl lsn lso lsp lst lsv lsw lsy lws mdl mfs mre msd msr mzc mzg mzy nbs ncs nsi nsl nsp nsr nzs okl pgz pks prl prz psc psd psg psl pso psp psr pys rib rms rnb rsi rsl rsm rsn sdl sfb sfs sgg sgx slf sls sqk sqs sqx ssp ssr svk swl syy szs tse tsm tsq tss tsy tza ugn ugy ukl uks vgt vsi vsl vsv wbs xki xml xms yds ygs yhs ysl ysm zhk zib zsl",
|
|
5906
|
+
sw: "swc swh",
|
|
5907
|
+
uz: "uzn uzs",
|
|
5908
|
+
zh: "cdo cjy cmn cnp cpx csp czh czo gan hak hnm hsn luh lzh mnp nan sjc wuu yue"
|
|
5909
|
+
}).flatMap(([prefix, extlangs]) => extlangs.split(" ").map((extlang) => `${prefix}-${extlang}`)));
|
|
5910
|
+
const PREFIX_PATTERN = /^[A-Za-z]{2,3}$/;
|
|
5911
|
+
const EXTLANG_PATTERN = /^[A-Za-z]{3}$/;
|
|
5912
|
+
/**
|
|
5913
|
+
* Normalizes a BCP 47 language tag that has an extended language subtag
|
|
5914
|
+
* (extlang), such as `zh-yue`, into its canonical form, such as `yue`, as
|
|
5915
|
+
* described in [RFC 5646, Section 4.5][1]. `Intl.Locale` rejects extlang
|
|
5916
|
+
* tags, so tags should be normalized before being passed to it.
|
|
5917
|
+
*
|
|
5918
|
+
* Only registered extlangs that follow their registered prefix are removed;
|
|
5919
|
+
* any other tag is returned unchanged, so the result still needs to be
|
|
5920
|
+
* validated, e.g., by `Intl.Locale`.
|
|
5921
|
+
*
|
|
5922
|
+
* NOTE: This function is marked as internal in the 2.0.x–2.4.x patch
|
|
5923
|
+
* releases. When merging it into the *main* branch, remove the `@internal`
|
|
5924
|
+
* tag, formalize it as a public API (`@since 2.5.0`), and add it to
|
|
5925
|
+
* the changelog fragment.
|
|
5926
|
+
*
|
|
5927
|
+
* [1]: https://www.rfc-editor.org/rfc/rfc5646.html#section-4.5
|
|
5928
|
+
*
|
|
5929
|
+
* @param tag The BCP 47 language tag to normalize.
|
|
5930
|
+
* @returns The normalized language tag.
|
|
5931
|
+
* @internal
|
|
5932
|
+
*/
|
|
5933
|
+
function normalizeLanguageTag(tag) {
|
|
5934
|
+
const subtags = tag.split("-");
|
|
5935
|
+
if (subtags.length < 2) return tag;
|
|
5936
|
+
const [prefix, extlang, ...rest] = subtags;
|
|
5937
|
+
if (!PREFIX_PATTERN.test(prefix) || !EXTLANG_PATTERN.test(extlang)) return tag;
|
|
5938
|
+
const language = extlang.toLowerCase();
|
|
5939
|
+
if (!EXTLANG_PAIRS.has(`${prefix.toLowerCase()}-${language}`)) return tag;
|
|
5940
|
+
return [language, ...rest].join("-");
|
|
5941
|
+
}
|
|
5942
|
+
//#endregion
|
|
5853
5943
|
//#region src/langstr.ts
|
|
5854
5944
|
/**
|
|
5855
5945
|
* A language-tagged string which corresponds to the `rdf:langString` type.
|
|
@@ -5864,11 +5954,13 @@ var LanguageString = class extends String {
|
|
|
5864
5954
|
* Constructs a new `LanguageString`.
|
|
5865
5955
|
* @param value A string value written in the given language.
|
|
5866
5956
|
* @param language The language of the string. If a string is given, it will
|
|
5867
|
-
* be parsed as a `Intl.Locale` object.
|
|
5957
|
+
* be parsed as a `Intl.Locale` object. Extended language
|
|
5958
|
+
* subtags are normalized first, e.g., `zh-yue` is parsed as
|
|
5959
|
+
* `yue`.
|
|
5868
5960
|
*/
|
|
5869
5961
|
constructor(value, language) {
|
|
5870
5962
|
super(value);
|
|
5871
|
-
this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
|
|
5963
|
+
this.locale = typeof language === "string" ? new Intl.Locale(normalizeLanguageTag(language)) : language;
|
|
5872
5964
|
}
|
|
5873
5965
|
};
|
|
5874
5966
|
LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
@@ -5878,4 +5970,4 @@ LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_d
|
|
|
5878
5970
|
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
5879
5971
|
};
|
|
5880
5972
|
//#endregion
|
|
5881
|
-
export { FetchError, LanguageString, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, preloadedContexts, validatePublicUrl };
|
|
5973
|
+
export { FetchError, LanguageString, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, normalizeLanguageTag, parseDecimal, preloadedContexts, validatePublicUrl };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-Do9eywBl.cjs");
|
|
2
|
-
const require_request = require("./request-
|
|
2
|
+
const require_request = require("./request-CHH9A9oL.cjs");
|
|
3
3
|
let _logtape_logtape = require("@logtape/logtape");
|
|
4
4
|
//#region src/body.ts
|
|
5
5
|
/** Decoded JSON body limit: 16 MiB. @internal */
|
package/dist/tests/body.test.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-Do9eywBl.cjs");
|
|
2
|
-
const require_body = require("./body-
|
|
2
|
+
const require_body = require("./body-Bxt2m_JA.cjs");
|
|
3
3
|
let node_assert_strict = require("node:assert/strict");
|
|
4
4
|
let node_test = require("node:test");
|
|
5
5
|
let node_zlib = require("node:zlib");
|
package/dist/tests/body.test.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as readBoundedText, t as BodyTooLargeError } from "./body-
|
|
1
|
+
import { r as readBoundedText, t as BodyTooLargeError } from "./body-DfFCA-Lo.mjs";
|
|
2
2
|
import { deepStrictEqual, ok, rejects } from "node:assert/strict";
|
|
3
3
|
import { test } from "node:test";
|
|
4
4
|
import { gunzipSync, gzipSync } from "node:zlib";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
require("./chunk-Do9eywBl.cjs");
|
|
2
|
-
require("./docloader-
|
|
2
|
+
require("./docloader-bp9CfxxP.cjs");
|
|
3
3
|
require("./url-vZTgkIZg.cjs");
|
|
4
4
|
require("./key-BarKGLQz.cjs");
|
|
5
5
|
require("./multibase-8zhYPa7o.cjs");
|
|
6
|
-
require("./
|
|
6
|
+
require("./langtag-DgySESmk.cjs");
|
|
7
|
+
require("./langstr-BsqFJupv.cjs");
|
|
7
8
|
let node_test = require("node:test");
|
|
8
9
|
let node_assert = require("node:assert");
|
|
9
10
|
//#region src/decimal.ts
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import "./docloader-
|
|
1
|
+
import "./docloader-B2YL1dZE.mjs";
|
|
2
2
|
import "./url-3fyJuqC0.mjs";
|
|
3
3
|
import "./key-BDIsC6hV.mjs";
|
|
4
4
|
import "./multibase-Ds75BvXs.mjs";
|
|
5
|
-
import "./
|
|
5
|
+
import "./langtag-LDBqlxHv.mjs";
|
|
6
|
+
import "./langstr-ABdAOKlF.mjs";
|
|
6
7
|
import { test } from "node:test";
|
|
7
8
|
import { deepStrictEqual, throws } from "node:assert";
|
|
8
9
|
//#region src/decimal.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-
|
|
2
|
-
import { n as MAX_BODY_SIZE, r as readBoundedText } from "./body-
|
|
1
|
+
import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-BI4kDbBx.mjs";
|
|
2
|
+
import { n as MAX_BODY_SIZE, r as readBoundedText } from "./body-DfFCA-Lo.mjs";
|
|
3
3
|
import { t as HttpHeaderLink } from "./link-CYszIegt.mjs";
|
|
4
4
|
import { o as validatePublicUrl, t as UrlError } from "./url-3fyJuqC0.mjs";
|
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -553,6 +553,36 @@ var did_v1_default = { "@context": {
|
|
|
553
553
|
}
|
|
554
554
|
} };
|
|
555
555
|
//#endregion
|
|
556
|
+
//#region src/contexts/fep-22cd.json
|
|
557
|
+
var fep_22cd_default = { "@context": {
|
|
558
|
+
"fep-22cd": "https://w3id.org/fep/22cd#",
|
|
559
|
+
"schema": "https://schema.org/",
|
|
560
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
561
|
+
"translations": {
|
|
562
|
+
"@id": "fep-22cd:translations",
|
|
563
|
+
"@container": "@set"
|
|
564
|
+
},
|
|
565
|
+
"Translation": "fep-22cd:Translation",
|
|
566
|
+
"sourceUpdated": {
|
|
567
|
+
"@id": "fep-22cd:sourceUpdated",
|
|
568
|
+
"@type": "xsd:dateTime"
|
|
569
|
+
},
|
|
570
|
+
"translator": {
|
|
571
|
+
"@id": "schema:translator",
|
|
572
|
+
"@type": "@id",
|
|
573
|
+
"@container": "@set"
|
|
574
|
+
},
|
|
575
|
+
"inLanguage": "schema:inLanguage",
|
|
576
|
+
"translationOfWork": {
|
|
577
|
+
"@id": "schema:translationOfWork",
|
|
578
|
+
"@type": "@id"
|
|
579
|
+
},
|
|
580
|
+
"isBasedOn": {
|
|
581
|
+
"@id": "schema:isBasedOn",
|
|
582
|
+
"@type": "@id"
|
|
583
|
+
}
|
|
584
|
+
} };
|
|
585
|
+
//#endregion
|
|
556
586
|
//#region src/contexts/fep-5711.json
|
|
557
587
|
var fep_5711_default = { "@context": {
|
|
558
588
|
"likesOf": {
|
|
@@ -589,6 +619,18 @@ var fep_5711_default = { "@context": {
|
|
|
589
619
|
}
|
|
590
620
|
} };
|
|
591
621
|
//#endregion
|
|
622
|
+
//#region src/contexts/fep-6757.json
|
|
623
|
+
var fep_6757_default = { "@context": {
|
|
624
|
+
"license": {
|
|
625
|
+
"@id": "http://purl.org/dc/terms/license",
|
|
626
|
+
"@type": "@id"
|
|
627
|
+
},
|
|
628
|
+
"preferredLicense": {
|
|
629
|
+
"@id": "https://w3id.org/fep/6757#preferredLicense",
|
|
630
|
+
"@type": "@id"
|
|
631
|
+
}
|
|
632
|
+
} };
|
|
633
|
+
//#endregion
|
|
592
634
|
//#region src/contexts/fep-7aa9.json
|
|
593
635
|
var fep_7aa9_default = { "@context": {
|
|
594
636
|
"FeaturedCollection": "https://w3id.org/fep/7aa9#FeaturedCollection",
|
|
@@ -915,7 +957,7 @@ var joinmastodon_default = { "@context": {
|
|
|
915
957
|
"suspended": "toot:suspended",
|
|
916
958
|
"attributionDomains": {
|
|
917
959
|
"@id": "toot:attributionDomains",
|
|
918
|
-
"@
|
|
960
|
+
"@container": "@set"
|
|
919
961
|
}
|
|
920
962
|
} };
|
|
921
963
|
//#endregion
|
|
@@ -4531,6 +4573,8 @@ const preloadedContexts = {
|
|
|
4531
4573
|
"https://www.w3.org/ns/cid/v1": cid_v1_default,
|
|
4532
4574
|
"https://w3id.org/fep/ef61": fep_ef61_default,
|
|
4533
4575
|
"https://w3id.org/fep/7aa9": fep_7aa9_default,
|
|
4576
|
+
"https://w3id.org/fep/6757": fep_6757_default,
|
|
4577
|
+
"https://w3id.org/fep/22cd": fep_22cd_default,
|
|
4534
4578
|
"https://join-lemmy.org/context.json": join_lemmy_default,
|
|
4535
4579
|
"http://joinmastodon.org/ns": joinmastodon_default,
|
|
4536
4580
|
"https://purl.archive.org/miscellany": miscellany_default
|
|
@@ -4647,6 +4691,8 @@ async function getRemoteDocument(url, response, fetch) {
|
|
|
4647
4691
|
* - <https://w3id.org/security/multikey/v1>
|
|
4648
4692
|
* - <https://w3id.org/fep/ef61>
|
|
4649
4693
|
* - <https://w3id.org/fep/7aa9>
|
|
4694
|
+
* - <https://w3id.org/fep/6757>
|
|
4695
|
+
* - <https://w3id.org/fep/22cd>
|
|
4650
4696
|
* - <https://purl.archive.org/socialweb/webfinger>
|
|
4651
4697
|
* - <http://schema.org/>
|
|
4652
4698
|
* @param options Options for the document loader.
|