@fedify/vocab-runtime 2.5.0-dev.2314 → 2.5.0-dev.2332

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/deno.json +1 -1
  2. package/dist/{contexts-BK1CqBR5.cjs → contexts-B09jb9Pi.cjs} +11 -1
  3. package/dist/{contexts-DPuJ4UYL.js → contexts-DWrj4AGR.js} +11 -1
  4. package/dist/{docloader-CYwqh5Df.d.cts → docloader-BMHljyYb.d.cts} +2 -0
  5. package/dist/{docloader-CYwqh5Df.d.ts → docloader-BMHljyYb.d.ts} +2 -0
  6. package/dist/internal/jsonld-cache.d.cts +1 -1
  7. package/dist/internal/jsonld-cache.d.ts +1 -1
  8. package/dist/internal/portable-dereference.cjs +1 -1
  9. package/dist/internal/portable-dereference.d.cts +2 -2
  10. package/dist/internal/portable-dereference.d.ts +2 -2
  11. package/dist/internal/portable-dereference.js +1 -1
  12. package/dist/internal/signed-representation.cjs +1 -1
  13. package/dist/internal/signed-representation.js +1 -1
  14. package/dist/mod.cjs +48 -4
  15. package/dist/mod.d.cts +25 -4
  16. package/dist/mod.d.ts +25 -4
  17. package/dist/mod.js +48 -5
  18. package/dist/{portable-DqtfLy_1.d.cts → portable-6Aj-7dZJ.d.cts} +1 -1
  19. package/dist/{portable-DtWsu2yU.d.ts → portable-nkTiqH0w.d.ts} +1 -1
  20. package/dist/tests/{body-Cdabr1gF.cjs → body-B8-N24Wt.cjs} +1 -1
  21. package/dist/tests/{body-B-JHnPWW.mjs → body-QNeqKF6t.mjs} +1 -1
  22. package/dist/tests/body.test.cjs +1 -1
  23. package/dist/tests/body.test.mjs +1 -1
  24. package/dist/tests/{contexts-DizzBjz4.cjs → contexts-C9Lj11SC.cjs} +11 -1
  25. package/dist/tests/{contexts-CIKsin4e.mjs → contexts-duRA_dDC.mjs} +11 -1
  26. package/dist/tests/decimal.test.cjs +4 -3
  27. package/dist/tests/decimal.test.mjs +4 -3
  28. package/dist/tests/{docloader-CdSUfd2D.cjs → docloader-U8lx6Ahe.cjs} +5 -3
  29. package/dist/tests/{docloader-CdEifqZh.mjs → docloader-_FC4G4HE.mjs} +5 -3
  30. package/dist/tests/docloader.test.cjs +127 -3
  31. package/dist/tests/docloader.test.mjs +127 -3
  32. package/dist/tests/internal/portable-dereference.test.cjs +2 -2
  33. package/dist/tests/internal/portable-dereference.test.mjs +2 -2
  34. package/dist/tests/jsonld-CmDhHNTx.cjs +12 -0
  35. package/dist/tests/jsonld-DweIJ07b.mjs +5 -0
  36. package/dist/tests/{jsonld-cache-C07AyNOY.cjs → jsonld-cache-BEXiiM-V.cjs} +6 -17
  37. package/dist/tests/{jsonld-cache-BPQmOZWD.mjs → jsonld-cache-DFnWsLuZ.mjs} +2 -5
  38. package/dist/tests/jsonld-cache.test.cjs +13 -12
  39. package/dist/tests/jsonld-cache.test.mjs +2 -1
  40. package/dist/tests/{langstr-CQ26J_L7.mjs → langstr-Dw8IBDZl.mjs} +5 -2
  41. package/dist/tests/{langstr-C4Fl80ae.cjs → langstr-h89Kjekh.cjs} +5 -2
  42. package/dist/tests/langstr.test.cjs +8 -1
  43. package/dist/tests/langstr.test.mjs +9 -2
  44. package/dist/tests/langtag-CD3zHKPN.mjs +40 -0
  45. package/dist/tests/langtag-DASCPgl3.cjs +45 -0
  46. package/dist/tests/langtag.test.cjs +45 -0
  47. package/dist/tests/langtag.test.d.cts +1 -0
  48. package/dist/tests/langtag.test.d.mts +1 -0
  49. package/dist/tests/langtag.test.mjs +46 -0
  50. package/dist/tests/{portable-dereference-DRE5bz-l.mjs → portable-dereference-DmTYDy2p.mjs} +3 -2
  51. package/dist/tests/{portable-dereference-BNXtgg5U.cjs → portable-dereference-qTLMqe2_.cjs} +3 -2
  52. package/dist/tests/{portable-media-dMmjIktg.mjs → portable-media-B4LO-ao_.mjs} +2 -2
  53. package/dist/tests/{portable-media-DmLu1roX.cjs → portable-media-CriQQ3xz.cjs} +2 -2
  54. package/dist/tests/portable-media.test.cjs +1 -1
  55. package/dist/tests/portable-media.test.mjs +1 -1
  56. package/dist/tests/portable-workers.test.cjs +1 -1
  57. package/dist/tests/portable-workers.test.mjs +1 -1
  58. package/dist/tests/{request-BWfNh5cM.cjs → request-Bf4ZTr5h.cjs} +1 -1
  59. package/dist/tests/{request-DAbeUUyu.mjs → request-C2niWNLL.mjs} +1 -1
  60. package/dist/tests/request.test.cjs +1 -1
  61. package/dist/tests/request.test.mjs +1 -1
  62. package/dist/tests/signed-representation.test.cjs +1 -1
  63. package/dist/tests/signed-representation.test.mjs +1 -1
  64. package/package.json +1 -1
  65. package/src/contexts/fep-6757.json +12 -0
  66. package/src/contexts/joinmastodon.json +1 -1
  67. package/src/contexts.ts +8 -0
  68. package/src/docloader.test.ts +148 -0
  69. package/src/docloader.ts +2 -0
  70. package/src/langstr.test.ts +18 -1
  71. package/src/langstr.ts +6 -2
  72. package/src/langtag.test.ts +53 -0
  73. package/src/langtag.ts +71 -0
  74. package/src/mod.ts +1 -0
@@ -1,8 +1,9 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
2
- const require_request = require("./request-BWfNh5cM.cjs");
3
- const require_contexts = require("./contexts-DizzBjz4.cjs");
2
+ const require_request = require("./request-Bf4ZTr5h.cjs");
3
+ const require_contexts = require("./contexts-C9Lj11SC.cjs");
4
4
  const require_url = require("./url-BNakuZ8k.cjs");
5
- const require_docloader = require("./docloader-CdSUfd2D.cjs");
5
+ const require_docloader = require("./docloader-U8lx6Ahe.cjs");
6
+ const require_jsonld = require("./jsonld-CmDhHNTx.cjs");
6
7
  let node_zlib = require("node:zlib");
7
8
  let _logtape_logtape = require("@logtape/logtape");
8
9
  let node_assert = require("node:assert");
@@ -1542,6 +1543,21 @@ var esm_default = new class FetchMock {
1542
1543
  document
1543
1544
  });
1544
1545
  });
1546
+ await t.step("preloaded Mastodon attribution domains", async () => {
1547
+ const context = ["https://www.w3.org/ns/activitystreams", "http://joinmastodon.org/ns"];
1548
+ const expanded = await require_jsonld.jsonld_default.expand({
1549
+ "@context": context,
1550
+ id: "https://social.example/users/alice",
1551
+ type: "Person",
1552
+ attributionDomains: ["blog.example"]
1553
+ }, { documentLoader: fetchDocumentLoader });
1554
+ (0, node_assert.deepStrictEqual)(expanded, [{
1555
+ "@id": "https://social.example/users/alice",
1556
+ "@type": ["https://www.w3.org/ns/activitystreams#Person"],
1557
+ "http://joinmastodon.org/ns#attributionDomains": [{ "@value": "blog.example" }]
1558
+ }]);
1559
+ (0, node_assert.deepStrictEqual)((await require_jsonld.jsonld_default.compact(expanded, context, { documentLoader: fetchDocumentLoader })).attributionDomains, ["blog.example"]);
1560
+ });
1545
1561
  esm_default.get("https://www.w3.org/ns/cid/v1", { status: 503 });
1546
1562
  await t.step("preloaded CID v1 context", async () => {
1547
1563
  const url = "https://www.w3.org/ns/cid/v1";
@@ -1598,6 +1614,114 @@ var esm_default = new class FetchMock {
1598
1614
  });
1599
1615
  (0, node_assert.deepStrictEqual)(esm_default.callHistory.calls(url).length, 0);
1600
1616
  });
1617
+ esm_default.get("https://w3id.org/fep/6757", { status: 502 });
1618
+ await t.step("preloaded FEP-6757 context", async () => {
1619
+ const url = "https://w3id.org/fep/6757";
1620
+ (0, node_assert.deepStrictEqual)(await fetchDocumentLoader(url), {
1621
+ contextUrl: null,
1622
+ documentUrl: url,
1623
+ document: { "@context": {
1624
+ license: {
1625
+ "@id": "http://purl.org/dc/terms/license",
1626
+ "@type": "@id"
1627
+ },
1628
+ preferredLicense: {
1629
+ "@id": "https://w3id.org/fep/6757#preferredLicense",
1630
+ "@type": "@id"
1631
+ }
1632
+ } }
1633
+ });
1634
+ (0, node_assert.deepStrictEqual)(await require_jsonld.jsonld_default.expand({
1635
+ "@context": ["https://www.w3.org/ns/activitystreams", url],
1636
+ type: "Person",
1637
+ license: "https://creativecommons.org/licenses/by/4.0/",
1638
+ preferredLicense: "https://creativecommons.org/licenses/by-nc/4.0/"
1639
+ }, { documentLoader: fetchDocumentLoader }), [{
1640
+ "@type": ["https://www.w3.org/ns/activitystreams#Person"],
1641
+ "http://purl.org/dc/terms/license": [{ "@id": "https://creativecommons.org/licenses/by/4.0/" }],
1642
+ "https://w3id.org/fep/6757#preferredLicense": [{ "@id": "https://creativecommons.org/licenses/by-nc/4.0/" }]
1643
+ }]);
1644
+ (0, node_assert.deepStrictEqual)(esm_default.callHistory.calls(url).length, 0);
1645
+ });
1646
+ esm_default.get("https://w3id.org/fep/22cd", { status: 502 });
1647
+ await t.step("preloaded FEP-22cd context", async () => {
1648
+ const url = "https://w3id.org/fep/22cd";
1649
+ const articleId = "https://example.com/articles/1";
1650
+ const translatorId = "https://example.com/users/alice";
1651
+ const revisionId = "https://example.com/articles/1/revisions/1";
1652
+ (0, node_assert.deepStrictEqual)(await fetchDocumentLoader(url), {
1653
+ contextUrl: null,
1654
+ documentUrl: url,
1655
+ document: { "@context": {
1656
+ "fep-22cd": "https://w3id.org/fep/22cd#",
1657
+ schema: "https://schema.org/",
1658
+ xsd: "http://www.w3.org/2001/XMLSchema#",
1659
+ translations: {
1660
+ "@id": "fep-22cd:translations",
1661
+ "@container": "@set"
1662
+ },
1663
+ Translation: "fep-22cd:Translation",
1664
+ sourceUpdated: {
1665
+ "@id": "fep-22cd:sourceUpdated",
1666
+ "@type": "xsd:dateTime"
1667
+ },
1668
+ translator: {
1669
+ "@id": "schema:translator",
1670
+ "@type": "@id",
1671
+ "@container": "@set"
1672
+ },
1673
+ inLanguage: "schema:inLanguage",
1674
+ translationOfWork: {
1675
+ "@id": "schema:translationOfWork",
1676
+ "@type": "@id"
1677
+ },
1678
+ isBasedOn: {
1679
+ "@id": "schema:isBasedOn",
1680
+ "@type": "@id"
1681
+ }
1682
+ } }
1683
+ });
1684
+ (0, node_assert.deepStrictEqual)(await require_jsonld.jsonld_default.expand({
1685
+ "@context": ["https://www.w3.org/ns/activitystreams", url],
1686
+ id: articleId,
1687
+ type: "Article",
1688
+ contentMap: {
1689
+ en: "Original",
1690
+ ko: "Translation"
1691
+ },
1692
+ translations: [{
1693
+ type: "Translation",
1694
+ inLanguage: "ko",
1695
+ translator: [translatorId],
1696
+ translationOfWork: articleId,
1697
+ sourceUpdated: "2026-09-01T00:00:00Z",
1698
+ isBasedOn: revisionId
1699
+ }]
1700
+ }, { documentLoader: fetchDocumentLoader }), [{
1701
+ "@id": articleId,
1702
+ "@type": ["https://www.w3.org/ns/activitystreams#Article"],
1703
+ "https://www.w3.org/ns/activitystreams#content": [{
1704
+ "@language": "en",
1705
+ "@value": "Original"
1706
+ }, {
1707
+ "@language": "ko",
1708
+ "@value": "Translation"
1709
+ }],
1710
+ "https://w3id.org/fep/22cd#translations": [{
1711
+ "@type": ["https://w3id.org/fep/22cd#Translation"],
1712
+ "https://schema.org/inLanguage": [{ "@value": "ko" }],
1713
+ "https://schema.org/translator": [{ "@id": translatorId }],
1714
+ "https://schema.org/translationOfWork": [{ "@id": articleId }],
1715
+ "https://w3id.org/fep/22cd#sourceUpdated": [{
1716
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime",
1717
+ "@value": "2026-09-01T00:00:00Z"
1718
+ }],
1719
+ "https://schema.org/isBasedOn": [{ "@id": revisionId }]
1720
+ }]
1721
+ }]);
1722
+ (0, node_assert.deepStrictEqual)(esm_default.callHistory.calls(url).length, 0);
1723
+ (0, node_assert.deepStrictEqual)(esm_default.callHistory.calls("https://www.w3.org/ns/activitystreams").length, 0);
1724
+ });
1601
1725
  await t.step("deny non-HTTP/HTTPS", async () => {
1602
1726
  await (0, node_assert.rejects)(() => fetchDocumentLoader("ftp://localhost"), require_url.UrlError);
1603
1727
  });
@@ -1,7 +1,8 @@
1
- import { t as FetchError } from "./request-DAbeUUyu.mjs";
2
- import { n as cid_v1_default, t as preloadedContexts } from "./contexts-CIKsin4e.mjs";
1
+ import { t as FetchError } from "./request-C2niWNLL.mjs";
2
+ import { n as cid_v1_default, t as preloadedContexts } from "./contexts-duRA_dDC.mjs";
3
3
  import { n as UrlError } from "./url-DMxmp7ZG.mjs";
4
- import { i as withDocumentLoaderTimeout, n as getRemoteDocument, r as resolveDocumentLoaderTimeout, t as getDocumentLoader } from "./docloader-CdEifqZh.mjs";
4
+ import { i as withDocumentLoaderTimeout, n as getRemoteDocument, r as resolveDocumentLoaderTimeout, t as getDocumentLoader } from "./docloader-_FC4G4HE.mjs";
5
+ import { t as jsonld_default } from "./jsonld-DweIJ07b.mjs";
5
6
  import { gzipSync } from "node:zlib";
6
7
  import { configure, reset } from "@logtape/logtape";
7
8
  import { deepStrictEqual, ok, rejects, throws } from "node:assert";
@@ -1560,6 +1561,21 @@ test("getDocumentLoader()", async (t) => {
1560
1561
  document
1561
1562
  });
1562
1563
  });
1564
+ await t.step("preloaded Mastodon attribution domains", async () => {
1565
+ const context = ["https://www.w3.org/ns/activitystreams", "http://joinmastodon.org/ns"];
1566
+ const expanded = await jsonld_default.expand({
1567
+ "@context": context,
1568
+ id: "https://social.example/users/alice",
1569
+ type: "Person",
1570
+ attributionDomains: ["blog.example"]
1571
+ }, { documentLoader: fetchDocumentLoader });
1572
+ deepStrictEqual(expanded, [{
1573
+ "@id": "https://social.example/users/alice",
1574
+ "@type": ["https://www.w3.org/ns/activitystreams#Person"],
1575
+ "http://joinmastodon.org/ns#attributionDomains": [{ "@value": "blog.example" }]
1576
+ }]);
1577
+ deepStrictEqual((await jsonld_default.compact(expanded, context, { documentLoader: fetchDocumentLoader })).attributionDomains, ["blog.example"]);
1578
+ });
1563
1579
  esm_default.get("https://www.w3.org/ns/cid/v1", { status: 503 });
1564
1580
  await t.step("preloaded CID v1 context", async () => {
1565
1581
  const url = "https://www.w3.org/ns/cid/v1";
@@ -1616,6 +1632,114 @@ test("getDocumentLoader()", async (t) => {
1616
1632
  });
1617
1633
  deepStrictEqual(esm_default.callHistory.calls(url).length, 0);
1618
1634
  });
1635
+ esm_default.get("https://w3id.org/fep/6757", { status: 502 });
1636
+ await t.step("preloaded FEP-6757 context", async () => {
1637
+ const url = "https://w3id.org/fep/6757";
1638
+ deepStrictEqual(await fetchDocumentLoader(url), {
1639
+ contextUrl: null,
1640
+ documentUrl: url,
1641
+ document: { "@context": {
1642
+ license: {
1643
+ "@id": "http://purl.org/dc/terms/license",
1644
+ "@type": "@id"
1645
+ },
1646
+ preferredLicense: {
1647
+ "@id": "https://w3id.org/fep/6757#preferredLicense",
1648
+ "@type": "@id"
1649
+ }
1650
+ } }
1651
+ });
1652
+ deepStrictEqual(await jsonld_default.expand({
1653
+ "@context": ["https://www.w3.org/ns/activitystreams", url],
1654
+ type: "Person",
1655
+ license: "https://creativecommons.org/licenses/by/4.0/",
1656
+ preferredLicense: "https://creativecommons.org/licenses/by-nc/4.0/"
1657
+ }, { documentLoader: fetchDocumentLoader }), [{
1658
+ "@type": ["https://www.w3.org/ns/activitystreams#Person"],
1659
+ "http://purl.org/dc/terms/license": [{ "@id": "https://creativecommons.org/licenses/by/4.0/" }],
1660
+ "https://w3id.org/fep/6757#preferredLicense": [{ "@id": "https://creativecommons.org/licenses/by-nc/4.0/" }]
1661
+ }]);
1662
+ deepStrictEqual(esm_default.callHistory.calls(url).length, 0);
1663
+ });
1664
+ esm_default.get("https://w3id.org/fep/22cd", { status: 502 });
1665
+ await t.step("preloaded FEP-22cd context", async () => {
1666
+ const url = "https://w3id.org/fep/22cd";
1667
+ const articleId = "https://example.com/articles/1";
1668
+ const translatorId = "https://example.com/users/alice";
1669
+ const revisionId = "https://example.com/articles/1/revisions/1";
1670
+ deepStrictEqual(await fetchDocumentLoader(url), {
1671
+ contextUrl: null,
1672
+ documentUrl: url,
1673
+ document: { "@context": {
1674
+ "fep-22cd": "https://w3id.org/fep/22cd#",
1675
+ schema: "https://schema.org/",
1676
+ xsd: "http://www.w3.org/2001/XMLSchema#",
1677
+ translations: {
1678
+ "@id": "fep-22cd:translations",
1679
+ "@container": "@set"
1680
+ },
1681
+ Translation: "fep-22cd:Translation",
1682
+ sourceUpdated: {
1683
+ "@id": "fep-22cd:sourceUpdated",
1684
+ "@type": "xsd:dateTime"
1685
+ },
1686
+ translator: {
1687
+ "@id": "schema:translator",
1688
+ "@type": "@id",
1689
+ "@container": "@set"
1690
+ },
1691
+ inLanguage: "schema:inLanguage",
1692
+ translationOfWork: {
1693
+ "@id": "schema:translationOfWork",
1694
+ "@type": "@id"
1695
+ },
1696
+ isBasedOn: {
1697
+ "@id": "schema:isBasedOn",
1698
+ "@type": "@id"
1699
+ }
1700
+ } }
1701
+ });
1702
+ deepStrictEqual(await jsonld_default.expand({
1703
+ "@context": ["https://www.w3.org/ns/activitystreams", url],
1704
+ id: articleId,
1705
+ type: "Article",
1706
+ contentMap: {
1707
+ en: "Original",
1708
+ ko: "Translation"
1709
+ },
1710
+ translations: [{
1711
+ type: "Translation",
1712
+ inLanguage: "ko",
1713
+ translator: [translatorId],
1714
+ translationOfWork: articleId,
1715
+ sourceUpdated: "2026-09-01T00:00:00Z",
1716
+ isBasedOn: revisionId
1717
+ }]
1718
+ }, { documentLoader: fetchDocumentLoader }), [{
1719
+ "@id": articleId,
1720
+ "@type": ["https://www.w3.org/ns/activitystreams#Article"],
1721
+ "https://www.w3.org/ns/activitystreams#content": [{
1722
+ "@language": "en",
1723
+ "@value": "Original"
1724
+ }, {
1725
+ "@language": "ko",
1726
+ "@value": "Translation"
1727
+ }],
1728
+ "https://w3id.org/fep/22cd#translations": [{
1729
+ "@type": ["https://w3id.org/fep/22cd#Translation"],
1730
+ "https://schema.org/inLanguage": [{ "@value": "ko" }],
1731
+ "https://schema.org/translator": [{ "@id": translatorId }],
1732
+ "https://schema.org/translationOfWork": [{ "@id": articleId }],
1733
+ "https://w3id.org/fep/22cd#sourceUpdated": [{
1734
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime",
1735
+ "@value": "2026-09-01T00:00:00Z"
1736
+ }],
1737
+ "https://schema.org/isBasedOn": [{ "@id": revisionId }]
1738
+ }]
1739
+ }]);
1740
+ deepStrictEqual(esm_default.callHistory.calls(url).length, 0);
1741
+ deepStrictEqual(esm_default.callHistory.calls("https://www.w3.org/ns/activitystreams").length, 0);
1742
+ });
1619
1743
  await t.step("deny non-HTTP/HTTPS", async () => {
1620
1744
  await rejects(() => fetchDocumentLoader("ftp://localhost"), UrlError);
1621
1745
  });
@@ -1,6 +1,6 @@
1
1
  const require_url = require("../url-BNakuZ8k.cjs");
2
- const require_jsonld_cache = require("../jsonld-cache-C07AyNOY.cjs");
3
- const require_portable_dereference = require("../portable-dereference-BNXtgg5U.cjs");
2
+ const require_jsonld_cache = require("../jsonld-cache-BEXiiM-V.cjs");
3
+ const require_portable_dereference = require("../portable-dereference-qTLMqe2_.cjs");
4
4
  let node_assert_strict = require("node:assert/strict");
5
5
  let node_test = require("node:test");
6
6
  //#region src/internal/portable-dereference.test.ts
@@ -1,6 +1,6 @@
1
1
  import { S as withGatewayHints, _ as parseIri } from "../url-DMxmp7ZG.mjs";
2
- import { n as createScopedContextLoader } from "../jsonld-cache-BPQmOZWD.mjs";
3
- import { a as recordPortableReferrer, i as isPortableIri, n as getPortableGatewayCandidates, r as getReferrerGateways, t as createSnapshotContextLoader } from "../portable-dereference-DRE5bz-l.mjs";
2
+ import { n as createScopedContextLoader } from "../jsonld-cache-DFnWsLuZ.mjs";
3
+ import { a as recordPortableReferrer, i as isPortableIri, n as getPortableGatewayCandidates, r as getReferrerGateways, t as createSnapshotContextLoader } from "../portable-dereference-DmTYDy2p.mjs";
4
4
  import { deepStrictEqual, ok, throws } from "node:assert/strict";
5
5
  import { test } from "node:test";
6
6
  //#region src/internal/portable-dereference.test.ts
@@ -0,0 +1,12 @@
1
+ const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
2
+ let jsonld_dist_jsonld_esm_js = require("jsonld/dist/jsonld.esm.js");
3
+ jsonld_dist_jsonld_esm_js = require_rolldown_runtime.__toESM(jsonld_dist_jsonld_esm_js, 1);
4
+ //#region src/jsonld.ts
5
+ var jsonld_default = jsonld_dist_jsonld_esm_js.default;
6
+ //#endregion
7
+ Object.defineProperty(exports, "jsonld_default", {
8
+ enumerable: true,
9
+ get: function() {
10
+ return jsonld_default;
11
+ }
12
+ });
@@ -0,0 +1,5 @@
1
+ import jsonld from "jsonld/dist/jsonld.esm.js";
2
+ //#region src/jsonld.ts
3
+ var jsonld_default = jsonld;
4
+ //#endregion
5
+ export { jsonld_default as t };
@@ -1,10 +1,5 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
2
1
  const require_url = require("./url-BNakuZ8k.cjs");
3
- let jsonld_dist_jsonld_esm_js = require("jsonld/dist/jsonld.esm.js");
4
- jsonld_dist_jsonld_esm_js = require_rolldown_runtime.__toESM(jsonld_dist_jsonld_esm_js, 1);
5
- //#region src/jsonld.ts
6
- var jsonld_default = jsonld_dist_jsonld_esm_js.default;
7
- //#endregion
2
+ const require_jsonld = require("./jsonld-CmDhHNTx.cjs");
8
3
  //#region src/internal/jsonld-cache.ts
9
4
  /**
10
5
  * Reads expanded gateways, including an unmapped term on portable actors.
@@ -184,7 +179,7 @@ async function compactJsonLdCache(normalized, original, documentLoader, depth =
184
179
  const ownContext = getOwnJsonLdContext(original);
185
180
  const context = ownContext === noJsonLdContext ? inheritedContext : ownContext;
186
181
  if (context == null) return preserveNoContextJsonLdShape(normalized, original, depth);
187
- return await preserveJsonLdShape(await mergeUnmappedTerms(await jsonld_default.compact(Array.isArray(normalized) && normalized.length === 1 ? normalized[0] : normalized, context, { documentLoader }), original, context, documentLoader), original, context, documentLoader, depth);
182
+ return await preserveJsonLdShape(await mergeUnmappedTerms(await require_jsonld.jsonld_default.compact(Array.isArray(normalized) && normalized.length === 1 ? normalized[0] : normalized, context, { documentLoader }), original, context, documentLoader), original, context, documentLoader, depth);
188
183
  }
189
184
  function preserveNoContextJsonLdShape(normalized, original, depth = 0) {
190
185
  if (depth > 32) return normalized;
@@ -247,11 +242,11 @@ async function mergeUnmappedTerms(compacted, original, context, documentLoader)
247
242
  "@context": context,
248
243
  ...compacted
249
244
  } : compacted;
250
- const compactedTerms = getTopLevelTerms(await jsonld_default.expand(compactedWithContext, { documentLoader }));
245
+ const compactedTerms = getTopLevelTerms(await require_jsonld.jsonld_default.expand(compactedWithContext, { documentLoader }));
251
246
  const dummyPrefix = "urn:fedify:dummy:";
252
247
  const dummy = { "@context": context };
253
248
  for (let i = 0; i < unmappedKeys.length; i++) defineJsonLdProperty(dummy, unmappedKeys[i], `${dummyPrefix}${i}`);
254
- const expanded = await jsonld_default.expand(dummy, { documentLoader });
249
+ const expanded = await require_jsonld.jsonld_default.expand(dummy, { documentLoader });
255
250
  const representedKeys = /* @__PURE__ */ new Set();
256
251
  const nodes = Array.isArray(expanded) ? expanded : [expanded];
257
252
  for (const node of nodes) {
@@ -330,8 +325,8 @@ async function compactWithEmptyContext(compacted, context, documentLoader) {
330
325
  "@context": context,
331
326
  ...compacted
332
327
  } : compacted;
333
- const expanded = await jsonld_default.expand(compactedWithContext, { documentLoader });
334
- return await jsonld_default.compact(expanded, {}, { documentLoader });
328
+ const expanded = await require_jsonld.jsonld_default.expand(compactedWithContext, { documentLoader });
329
+ return await require_jsonld.jsonld_default.compact(expanded, {}, { documentLoader });
335
330
  }
336
331
  function combineContexts(inheritedContext, ownContext) {
337
332
  if (ownContext === noJsonLdContext || ownContext === inheritedContext) return inheritedContext;
@@ -371,12 +366,6 @@ Object.defineProperty(exports, "isTrustedIriOrigin", {
371
366
  return isTrustedIriOrigin;
372
367
  }
373
368
  });
374
- Object.defineProperty(exports, "jsonld_default", {
375
- enumerable: true,
376
- get: function() {
377
- return jsonld_default;
378
- }
379
- });
380
369
  Object.defineProperty(exports, "normalizeJsonLdIris", {
381
370
  enumerable: true,
382
371
  get: function() {
@@ -1,8 +1,5 @@
1
1
  import { _ as parseIri, c as getFe34Origin, d as haveSameIriOrigin, o as formatIri, s as fromCompatibleEf61Id, u as haveSameFe34Origin } from "./url-DMxmp7ZG.mjs";
2
- import jsonld from "jsonld/dist/jsonld.esm.js";
3
- //#region src/jsonld.ts
4
- var jsonld_default = jsonld;
5
- //#endregion
2
+ import { t as jsonld_default } from "./jsonld-DweIJ07b.mjs";
6
3
  //#region src/internal/jsonld-cache.ts
7
4
  /**
8
5
  * Reads expanded gateways, including an unmapped term on portable actors.
@@ -339,4 +336,4 @@ function combineContexts(inheritedContext, ownContext) {
339
336
  return [...inherited, ...own];
340
337
  }
341
338
  //#endregion
342
- export { isTrustedIriOrigin as a, unwrapReleasedDocumentLoader as c, getPortableActorGateways as i, jsonld_default as l, createScopedContextLoader as n, normalizeJsonLdIris as o, getJsonLdContext as r, registerDocumentLoaderWrapper as s, compactJsonLdCache as t };
339
+ export { isTrustedIriOrigin as a, unwrapReleasedDocumentLoader as c, getPortableActorGateways as i, createScopedContextLoader as n, normalizeJsonLdIris as o, getJsonLdContext as r, registerDocumentLoaderWrapper as s, compactJsonLdCache as t };
@@ -1,5 +1,6 @@
1
1
  const require_url = require("./url-BNakuZ8k.cjs");
2
- const require_jsonld_cache = require("./jsonld-cache-C07AyNOY.cjs");
2
+ const require_jsonld = require("./jsonld-CmDhHNTx.cjs");
3
+ const require_jsonld_cache = require("./jsonld-cache-BEXiiM-V.cjs");
3
4
  let node_test = require("node:test");
4
5
  let node_assert = require("node:assert");
5
6
  //#region src/jsonld-cache.test.ts
@@ -125,7 +126,7 @@ let node_assert = require("node:assert");
125
126
  "https://www.w3.org/ns/activitystreams#attributedTo": [{ "@id": "ap://did:key:z6Mkabc/actor" }],
126
127
  "https://www.w3.org/ns/activitystreams#content": [{ "@value": "No-context object shape should stay cached." }]
127
128
  };
128
- (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld_cache.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id", "https://www.w3.org/ns/activitystreams#attributedTo"])), original), {
129
+ (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id", "https://www.w3.org/ns/activitystreams#attributedTo"])), original), {
129
130
  "@id": "ap+ef61://did:key:z6Mkabc/objects/1",
130
131
  "@type": ["https://www.w3.org/ns/activitystreams#Note"],
131
132
  "https://www.w3.org/ns/activitystreams#attributedTo": [{ "@id": "ap+ef61://did:key:z6Mkabc/actor" }],
@@ -146,7 +147,7 @@ let node_assert = require("node:assert");
146
147
  name: "Nested object"
147
148
  }]
148
149
  };
149
- (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld_cache.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
150
+ (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
150
151
  "@id": "ap+ef61://did:key:z6Mkabc/objects/1",
151
152
  "@type": ["https://www.w3.org/ns/activitystreams#Note"],
152
153
  "https://www.w3.org/ns/activitystreams#attachment": [{
@@ -193,7 +194,7 @@ let node_assert = require("node:assert");
193
194
  extra: "This nested unmapped property should stay cached."
194
195
  }
195
196
  };
196
- (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld_cache.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
197
+ (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
197
198
  "@context": context,
198
199
  type: "as:Note",
199
200
  id: "ap+ef61://did:key:z6Mkabc/objects/1",
@@ -225,7 +226,7 @@ let node_assert = require("node:assert");
225
226
  extra
226
227
  }
227
228
  };
228
- const compacted = await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld_cache.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original);
229
+ const compacted = await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original);
229
230
  (0, node_assert.strictEqual)(compacted.rootExtra, rootExtra);
230
231
  (0, node_assert.strictEqual)(compacted.attachment.extra, extra);
231
232
  });
@@ -246,7 +247,7 @@ let node_assert = require("node:assert");
246
247
  configurable: true,
247
248
  writable: true
248
249
  });
249
- const compacted = await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld_cache.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original);
250
+ const compacted = await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original);
250
251
  (0, node_assert.strictEqual)(globalThis.Object.getOwnPropertyDescriptor(compacted, "__proto__")?.value, protoValue);
251
252
  (0, node_assert.strictEqual)(globalThis.Object.getPrototypeOf(compacted), Object.prototype);
252
253
  });
@@ -273,7 +274,7 @@ let node_assert = require("node:assert");
273
274
  configurable: true,
274
275
  writable: true
275
276
  });
276
- const compacted = await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld_cache.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original);
277
+ const compacted = await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original);
277
278
  const protoDescriptor = globalThis.Object.getOwnPropertyDescriptor(compacted, "__proto__");
278
279
  (0, node_assert.ok)(protoDescriptor?.value === "Alias represented by the compacted term." || Array.isArray(protoDescriptor?.value) && protoDescriptor.value.includes("Alias represented by the compacted term."));
279
280
  (0, node_assert.strictEqual)(protoDescriptor?.enumerable, true);
@@ -303,7 +304,7 @@ let node_assert = require("node:assert");
303
304
  title: "Nested title."
304
305
  }
305
306
  };
306
- (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld_cache.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
307
+ (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
307
308
  "@context": context,
308
309
  type: "as:Note",
309
310
  id: "ap+ef61://did:key:z6Mkabc/objects/1",
@@ -335,7 +336,7 @@ let node_assert = require("node:assert");
335
336
  title: "Nested title."
336
337
  }
337
338
  };
338
- (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld_cache.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
339
+ (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
339
340
  "@context": context,
340
341
  type: "as:Note",
341
342
  id: "ap+ef61://did:key:z6Mkabc/objects/1",
@@ -363,7 +364,7 @@ let node_assert = require("node:assert");
363
364
  "https://example.com/ns#title": "Absolute title."
364
365
  }
365
366
  };
366
- (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld_cache.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
367
+ (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
367
368
  "@context": context,
368
369
  type: "as:Note",
369
370
  id: "ap+ef61://did:key:z6Mkabc/objects/1",
@@ -402,7 +403,7 @@ let node_assert = require("node:assert");
402
403
  actorRef: "ap://did:key:z6Mkabc/actor"
403
404
  }
404
405
  };
405
- (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld_cache.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id", "https://www.w3.org/ns/activitystreams#actor"])), original), {
406
+ (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id", "https://www.w3.org/ns/activitystreams#actor"])), original), {
406
407
  "@context": context,
407
408
  type: "as:Note",
408
409
  id: "ap+ef61://did:key:z6Mkabc/objects/1",
@@ -436,7 +437,7 @@ let node_assert = require("node:assert");
436
437
  key9: "Extension 9",
437
438
  key10: "Alias represented by the compacted term."
438
439
  };
439
- (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld_cache.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
440
+ (0, node_assert.deepStrictEqual)(await require_jsonld_cache.compactJsonLdCache(require_jsonld_cache.normalizeJsonLdIris(await require_jsonld.jsonld_default.expand(original), /* @__PURE__ */ new Set(["@id"])), original), {
440
441
  "@context": context,
441
442
  id: "ap+ef61://did:key:z6Mkabc/objects/1",
442
443
  key0: "Extension 0",
@@ -1,5 +1,6 @@
1
1
  import { _ as parseIri } from "./url-DMxmp7ZG.mjs";
2
- import { a as isTrustedIriOrigin, i as getPortableActorGateways, l as jsonld_default, o as normalizeJsonLdIris, r as getJsonLdContext, t as compactJsonLdCache } from "./jsonld-cache-BPQmOZWD.mjs";
2
+ import { t as jsonld_default } from "./jsonld-DweIJ07b.mjs";
3
+ import { a as isTrustedIriOrigin, i as getPortableActorGateways, o as normalizeJsonLdIris, r as getJsonLdContext, t as compactJsonLdCache } from "./jsonld-cache-DFnWsLuZ.mjs";
3
4
  import { test } from "node:test";
4
5
  import { deepStrictEqual, ok, strictEqual } from "node:assert";
5
6
  //#region src/jsonld-cache.test.ts
@@ -1,3 +1,4 @@
1
+ import { t as normalizeLanguageTag } from "./langtag-CD3zHKPN.mjs";
1
2
  //#region src/langstr.ts
2
3
  /**
3
4
  * A language-tagged string which corresponds to the `rdf:langString` type.
@@ -12,11 +13,13 @@ var LanguageString = class extends String {
12
13
  * Constructs a new `LanguageString`.
13
14
  * @param value A string value written in the given language.
14
15
  * @param language The language of the string. If a string is given, it will
15
- * be parsed as a `Intl.Locale` object.
16
+ * be parsed as a `Intl.Locale` object. Extended language
17
+ * subtags are normalized first, e.g., `zh-yue` is parsed as
18
+ * `yue`.
16
19
  */
17
20
  constructor(value, language) {
18
21
  super(value);
19
- this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
22
+ this.locale = typeof language === "string" ? new Intl.Locale(normalizeLanguageTag(language)) : language;
20
23
  }
21
24
  };
22
25
  LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
@@ -1,3 +1,4 @@
1
+ const require_langtag = require("./langtag-DASCPgl3.cjs");
1
2
  //#region src/langstr.ts
2
3
  /**
3
4
  * A language-tagged string which corresponds to the `rdf:langString` type.
@@ -12,11 +13,13 @@ var LanguageString = class extends String {
12
13
  * Constructs a new `LanguageString`.
13
14
  * @param value A string value written in the given language.
14
15
  * @param language The language of the string. If a string is given, it will
15
- * be parsed as a `Intl.Locale` object.
16
+ * be parsed as a `Intl.Locale` object. Extended language
17
+ * subtags are normalized first, e.g., `zh-yue` is parsed as
18
+ * `yue`.
16
19
  */
17
20
  constructor(value, language) {
18
21
  super(value);
19
- this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
22
+ this.locale = typeof language === "string" ? new Intl.Locale(require_langtag.normalizeLanguageTag(language)) : language;
20
23
  }
21
24
  };
22
25
  LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
2
- const require_langstr = require("./langstr-C4Fl80ae.cjs");
2
+ const require_langstr = require("./langstr-h89Kjekh.cjs");
3
3
  let node_test = require("node:test");
4
4
  let node_assert = require("node:assert");
5
5
  let node_util = require("node:util");
@@ -11,6 +11,13 @@ node_util = require_rolldown_runtime.__toESM(node_util, 1);
11
11
  (0, node_assert.deepStrictEqual)(langStr.locale, new Intl.Locale("en"));
12
12
  (0, node_assert.deepStrictEqual)(new require_langstr.LanguageString("Hello", new Intl.Locale("en")), langStr);
13
13
  });
14
+ (0, node_test.test)("new LanguageString() with extlang tags", () => {
15
+ (0, node_assert.deepStrictEqual)(new require_langstr.LanguageString("你好", "zh-YUE").locale.baseName, "yue");
16
+ (0, node_assert.deepStrictEqual)(new require_langstr.LanguageString("你好", "zh-yue-HK").locale.baseName, "yue-HK");
17
+ (0, node_assert.deepStrictEqual)(new require_langstr.LanguageString("你好", "zh-cmn-Hant").locale.baseName, new Intl.Locale("cmn-Hant").baseName);
18
+ (0, node_assert.throws)(() => new require_langstr.LanguageString("Hello", "en-USA"), RangeError);
19
+ (0, node_assert.throws)(() => new require_langstr.LanguageString("你好", "zh-yue-"), RangeError);
20
+ });
14
21
  (0, node_test.test)("Deno.inspect(LanguageString)", () => {
15
22
  const langStr = new require_langstr.LanguageString("Hello, 'world'", "en");
16
23
  (0, node_assert.deepStrictEqual)(node_util.default.inspect(langStr, { colors: false }), "<en> \"Hello, 'world'\"");
@@ -1,6 +1,6 @@
1
- import { t as LanguageString } from "./langstr-CQ26J_L7.mjs";
1
+ import { t as LanguageString } from "./langstr-Dw8IBDZl.mjs";
2
2
  import { test } from "node:test";
3
- import { deepStrictEqual } from "node:assert";
3
+ import { deepStrictEqual, throws } from "node:assert";
4
4
  import util from "node:util";
5
5
  //#region src/langstr.test.ts
6
6
  test("new LanguageString()", () => {
@@ -9,6 +9,13 @@ test("new LanguageString()", () => {
9
9
  deepStrictEqual(langStr.locale, new Intl.Locale("en"));
10
10
  deepStrictEqual(new LanguageString("Hello", new Intl.Locale("en")), langStr);
11
11
  });
12
+ test("new LanguageString() with extlang tags", () => {
13
+ deepStrictEqual(new LanguageString("你好", "zh-YUE").locale.baseName, "yue");
14
+ deepStrictEqual(new LanguageString("你好", "zh-yue-HK").locale.baseName, "yue-HK");
15
+ deepStrictEqual(new LanguageString("你好", "zh-cmn-Hant").locale.baseName, new Intl.Locale("cmn-Hant").baseName);
16
+ throws(() => new LanguageString("Hello", "en-USA"), RangeError);
17
+ throws(() => new LanguageString("你好", "zh-yue-"), RangeError);
18
+ });
12
19
  test("Deno.inspect(LanguageString)", () => {
13
20
  const langStr = new LanguageString("Hello, 'world'", "en");
14
21
  deepStrictEqual(util.inspect(langStr, { colors: false }), "<en> \"Hello, 'world'\"");