@thomasfosterau/effect-rdf 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +2251 -2
- package/dist/Algebra-CGG4oae3.mjs +433 -0
- package/dist/Algebra-CGG4oae3.mjs.map +1 -0
- package/dist/Algebra-uGsIEOUA.d.mts +446 -0
- package/dist/Ast-CPRZmBvk.mjs +552 -0
- package/dist/Ast-CPRZmBvk.mjs.map +1 -0
- package/dist/Ast-vcw2W-lf.d.mts +827 -0
- package/dist/Bindings-Ck3m7JRC.mjs +249 -0
- package/dist/Bindings-Ck3m7JRC.mjs.map +1 -0
- package/dist/Bindings-DiKpBd7f.d.mts +153 -0
- package/dist/ClientErrors-CpXdFX5u.mjs +128 -0
- package/dist/ClientErrors-CpXdFX5u.mjs.map +1 -0
- package/dist/ClientErrors-D4IZHUM-.d.mts +101 -0
- package/dist/ClientFormats-CXomkXLV.mjs +73 -0
- package/dist/ClientFormats-CXomkXLV.mjs.map +1 -0
- package/dist/ClientFormats-Dm57ZPwR.d.mts +36 -0
- package/dist/Csv2Json-DynEcwCh.mjs +194 -0
- package/dist/Csv2Json-DynEcwCh.mjs.map +1 -0
- package/dist/Csv2Json-aXNVDoXQ.d.mts +40 -0
- package/dist/Csv2Rdf-8maXP6mt.d.mts +41 -0
- package/dist/Csv2Rdf-DuSEkaKE.mjs +161 -0
- package/dist/Csv2Rdf-DuSEkaKE.mjs.map +1 -0
- package/dist/Dataset-BlmlcI7J.mjs +782 -0
- package/dist/Dataset-BlmlcI7J.mjs.map +1 -0
- package/dist/Dataset-DS3ESOcO.d.mts +426 -0
- package/dist/Dataset.d.mts +2 -0
- package/dist/Dataset.mjs +1 -0
- package/dist/Datatype-CxMpamHC.d.mts +212 -0
- package/dist/Datatype-DQvkNkiH.mjs +1001 -0
- package/dist/Datatype-DQvkNkiH.mjs.map +1 -0
- package/dist/Dialect-8ChFj5EX.d.mts +113 -0
- package/dist/Dialect-CzVH38uo.mjs +165 -0
- package/dist/Dialect-CzVH38uo.mjs.map +1 -0
- package/dist/DocumentLoader-D3lZREnB.mjs +346 -0
- package/dist/DocumentLoader-D3lZREnB.mjs.map +1 -0
- package/dist/DocumentLoader-ZUCEVrW5.d.mts +178 -0
- package/dist/DublinCore-AnwqxRx6.mjs +137 -0
- package/dist/DublinCore-AnwqxRx6.mjs.map +1 -0
- package/dist/DublinCore-Dq-tVA5d.d.mts +119 -0
- package/dist/Engine-CYPB3g4h.d.mts +144 -0
- package/dist/Engine-DF8PN7g-.mjs +872 -0
- package/dist/Engine-DF8PN7g-.mjs.map +1 -0
- package/dist/Errors-CMdV1RhU.mjs +37 -0
- package/dist/Errors-CMdV1RhU.mjs.map +1 -0
- package/dist/Errors-u2bDjUeM.d.mts +30 -0
- package/dist/Evaluator-DEsU4d1o.d.mts +50 -0
- package/dist/Evaluator-DOY2-guC.mjs +281 -0
- package/dist/Evaluator-DOY2-guC.mjs.map +1 -0
- package/dist/Exif-CpqniYQd.d.mts +78 -0
- package/dist/Exif-DjkCfEB-.mjs +89 -0
- package/dist/Exif-DjkCfEB-.mjs.map +1 -0
- package/dist/Expression-BIMMvduQ.mjs +230 -0
- package/dist/Expression-BIMMvduQ.mjs.map +1 -0
- package/dist/Expression-W8A9cyX7.d.mts +89 -0
- package/dist/Extract-Bop85jES.mjs +220 -0
- package/dist/Extract-Bop85jES.mjs.map +1 -0
- package/dist/Extract-C_pCvuTC.d.mts +88 -0
- package/dist/Federation-BcNrozc1.d.mts +52 -0
- package/dist/Federation-CHScBkaK.mjs +130 -0
- package/dist/Federation-CHScBkaK.mjs.map +1 -0
- package/dist/Functions-AvjNcId_.mjs +1346 -0
- package/dist/Functions-AvjNcId_.mjs.map +1 -0
- package/dist/Functions-OQJZP-F6.d.mts +111 -0
- package/dist/Generator-C52mmq01.d.mts +50 -0
- package/dist/Generator-D3utCJC7.mjs +205 -0
- package/dist/Generator-D3utCJC7.mjs.map +1 -0
- package/dist/Grammar-CPlSxGH6.mjs +200 -0
- package/dist/Grammar-CPlSxGH6.mjs.map +1 -0
- package/dist/Grammar-CRhnRoCu.d.mts +148 -0
- package/dist/Grammar-D6jZdJQ3.d.mts +169 -0
- package/dist/Grammar-mQ8CgE1M.mjs +258 -0
- package/dist/Grammar-mQ8CgE1M.mjs.map +1 -0
- package/dist/GraphStore-DhUa4nFO.d.mts +45 -0
- package/dist/GraphStore-DvbqwKy1.mjs +212 -0
- package/dist/GraphStore-DvbqwKy1.mjs.map +1 -0
- package/dist/Iri-BB8Ks-BF.d.mts +84 -0
- package/dist/Iri-Cr92gsQV.mjs +232 -0
- package/dist/Iri-Cr92gsQV.mjs.map +1 -0
- package/dist/Iri.d.mts +2 -0
- package/dist/Iri.mjs +1 -0
- package/dist/Isomorphism-B6qTY-xy.d.mts +28 -0
- package/dist/Isomorphism-BmqxhKyJ.mjs +232 -0
- package/dist/Isomorphism-BmqxhKyJ.mjs.map +1 -0
- package/dist/Isomorphism-DInKnWIy.mjs +390 -0
- package/dist/Isomorphism-DInKnWIy.mjs.map +1 -0
- package/dist/Isomorphism-DvSfZXLR.d.mts +37 -0
- package/dist/Isomorphism.d.mts +2 -0
- package/dist/Isomorphism.mjs +1 -0
- package/dist/JsonLd-DOwS2FHg.mjs +2836 -0
- package/dist/JsonLd-DOwS2FHg.mjs.map +1 -0
- package/dist/JsonLd-DobFrQNa.d.mts +242 -0
- package/dist/JsonLdError-C9J-BxfG.mjs +106 -0
- package/dist/JsonLdError-C9J-BxfG.mjs.map +1 -0
- package/dist/JsonLdError-DSOfHkOy.d.mts +43 -0
- package/dist/LanguageTag-BCu8rcmX.d.mts +38 -0
- package/dist/LanguageTag-BcOpMGZ4.mjs +89 -0
- package/dist/LanguageTag-BcOpMGZ4.mjs.map +1 -0
- package/dist/LanguageTag.d.mts +2 -0
- package/dist/LanguageTag.mjs +1 -0
- package/dist/Lexical-Cg0JHrf6.mjs +243 -0
- package/dist/Lexical-Cg0JHrf6.mjs.map +1 -0
- package/dist/Lexical-D3zySYVS.d.mts +163 -0
- package/dist/Manifest-B6xf6mUc.mjs +148 -0
- package/dist/Manifest-B6xf6mUc.mjs.map +1 -0
- package/dist/Manifest-DQUMRBFr.d.mts +98 -0
- package/dist/Mapping-BgG74x3U.d.mts +63 -0
- package/dist/Mapping-Dc1ZGirk.mjs +259 -0
- package/dist/Mapping-Dc1ZGirk.mjs.map +1 -0
- package/dist/Mcp-1DwTTKOK.mjs +48 -0
- package/dist/Mcp-1DwTTKOK.mjs.map +1 -0
- package/dist/Mcp-d-pX9erx.d.mts +25 -0
- package/dist/Message-CK_DGQuu.mjs +95 -0
- package/dist/Message-CK_DGQuu.mjs.map +1 -0
- package/dist/Message-fIvTJSXM.d.mts +49 -0
- package/dist/Metadata-BbffwGDZ.mjs +445 -0
- package/dist/Metadata-BbffwGDZ.mjs.map +1 -0
- package/dist/Metadata-CEt3yc1-.d.mts +901 -0
- package/dist/Metadata-D4HsQNXr.mjs +1273 -0
- package/dist/Metadata-D4HsQNXr.mjs.map +1 -0
- package/dist/Metadata-nzS7QKRj.d.mts +350 -0
- package/dist/Model-DaMmxurZ.d.mts +293 -0
- package/dist/Model-DlPzRYhF.mjs +528 -0
- package/dist/Model-DlPzRYhF.mjs.map +1 -0
- package/dist/N3-BzyV-KIH.mjs +974 -0
- package/dist/N3-BzyV-KIH.mjs.map +1 -0
- package/dist/N3-DSLnonDn.d.mts +100 -0
- package/dist/NQuads-C1VBOJ3-.mjs +117 -0
- package/dist/NQuads-C1VBOJ3-.mjs.map +1 -0
- package/dist/NQuads-FjFZikFg.d.mts +76 -0
- package/dist/NTriples-D-kLSEAf.mjs +120 -0
- package/dist/NTriples-D-kLSEAf.mjs.map +1 -0
- package/dist/NTriples-D34OspfW.d.mts +76 -0
- package/dist/Namespace-ClTUO_ya.d.mts +42 -0
- package/dist/Namespace-DHFIsORd.mjs +75 -0
- package/dist/Namespace-DHFIsORd.mjs.map +1 -0
- package/dist/Namespace.d.mts +2 -0
- package/dist/Namespace.mjs +1 -0
- package/dist/Namespaces-Bz85vpjW.mjs +235 -0
- package/dist/Namespaces-Bz85vpjW.mjs.map +1 -0
- package/dist/Namespaces-C1jW6EDo.d.mts +178 -0
- package/dist/Optimizer-BWWQRQPY.mjs +168 -0
- package/dist/Optimizer-BWWQRQPY.mjs.map +1 -0
- package/dist/Optimizer-DUpUow6k.d.mts +26 -0
- package/dist/Options-BLBGL4HE.mjs +72 -0
- package/dist/Options-BLBGL4HE.mjs.map +1 -0
- package/dist/Options-BommQwP9.d.mts +127 -0
- package/dist/Packet-CA76wVX3.mjs +197 -0
- package/dist/Packet-CA76wVX3.mjs.map +1 -0
- package/dist/Packet-Cy5g6XuW.d.mts +130 -0
- package/dist/Parser-p1Gyr0QN.d.mts +85 -0
- package/dist/Parser-xARsOWXk.mjs +1317 -0
- package/dist/Parser-xARsOWXk.mjs.map +1 -0
- package/dist/Path-B20Yp8KE.mjs +284 -0
- package/dist/Path-B20Yp8KE.mjs.map +1 -0
- package/dist/Path-DRB8e-Zn.d.mts +181 -0
- package/dist/Pdf-B9RZn--8.d.mts +77 -0
- package/dist/Pdf-CKK6dkZn.mjs +89 -0
- package/dist/Pdf-CKK6dkZn.mjs.map +1 -0
- package/dist/PdfA-CUjSuntT.d.mts +109 -0
- package/dist/PdfA-CleOhuL6.mjs +124 -0
- package/dist/PdfA-CleOhuL6.mjs.map +1 -0
- package/dist/Photoshop-CiHo80qV.mjs +233 -0
- package/dist/Photoshop-CiHo80qV.mjs.map +1 -0
- package/dist/Photoshop-udKZ0I3N.d.mts +204 -0
- package/dist/PrefixMap-BHFPDLO-.mjs +103 -0
- package/dist/PrefixMap-BHFPDLO-.mjs.map +1 -0
- package/dist/PrefixMap-BMlXrWNd.d.mts +64 -0
- package/dist/PrefixMap.d.mts +2 -0
- package/dist/PrefixMap.mjs +1 -0
- package/dist/Processor-CMmecFsb.mjs +198 -0
- package/dist/Processor-CMmecFsb.mjs.map +1 -0
- package/dist/Processor-FJPvO0CB.d.mts +435 -0
- package/dist/Protocol-BA7OkNgp.mjs +202 -0
- package/dist/Protocol-BA7OkNgp.mjs.map +1 -0
- package/dist/Protocol-DlSoiIKB.d.mts +108 -0
- package/dist/ProtocolErrors-Ckfejnl6.d.mts +84 -0
- package/dist/ProtocolErrors-czDPVcX5.mjs +129 -0
- package/dist/ProtocolErrors-czDPVcX5.mjs.map +1 -0
- package/dist/Query-D9A6LOpP.mjs +364 -0
- package/dist/Query-D9A6LOpP.mjs.map +1 -0
- package/dist/Query-KqSkTYyG.d.mts +96 -0
- package/dist/QueryBuilder-BLK9Vfbz.mjs +674 -0
- package/dist/QueryBuilder-BLK9Vfbz.mjs.map +1 -0
- package/dist/QueryBuilder-DUqh4ECe.d.mts +529 -0
- package/dist/RdfJs-D6-49XB5.mjs +86 -0
- package/dist/RdfJs-D6-49XB5.mjs.map +1 -0
- package/dist/RdfJs-DXFqdWrd.d.mts +76 -0
- package/dist/RdfJs.d.mts +2 -0
- package/dist/RdfJs.mjs +1 -0
- package/dist/RdfJson-5aKPDlPS.d.mts +297 -0
- package/dist/RdfJson-BNocgW4f.mjs +548 -0
- package/dist/RdfJson-BNocgW4f.mjs.map +1 -0
- package/dist/RdfXml-DJ9G4gOq.mjs +1014 -0
- package/dist/RdfXml-DJ9G4gOq.mjs.map +1 -0
- package/dist/RdfXml-_N7yxWEp.d.mts +149 -0
- package/dist/Rdfs-BRVPsAjc.d.mts +84 -0
- package/dist/Rdfs-CyY2wVHI.mjs +167 -0
- package/dist/Rdfs-CyY2wVHI.mjs.map +1 -0
- package/dist/Rdfs.d.mts +2 -0
- package/dist/Rdfs.mjs +1 -0
- package/dist/Reasoner-BxYhx9s7.d.mts +94 -0
- package/dist/Reasoner-Cw90zrjv.mjs +798 -0
- package/dist/Reasoner-Cw90zrjv.mjs.map +1 -0
- package/dist/Reification-BmN4EfnM.d.mts +40 -0
- package/dist/Reification-dpqQvjDE.mjs +82 -0
- package/dist/Reification-dpqQvjDE.mjs.map +1 -0
- package/dist/Reification.d.mts +2 -0
- package/dist/Reification.mjs +1 -0
- package/dist/Report-XHs8htzK.mjs +121 -0
- package/dist/Report-XHs8htzK.mjs.map +1 -0
- package/dist/Report-hcXsc_19.d.mts +115 -0
- package/dist/Resource-B1cI8FyJ.d.mts +218 -0
- package/dist/Resource-sIEeNh15.mjs +374 -0
- package/dist/Resource-sIEeNh15.mjs.map +1 -0
- package/dist/Resource.d.mts +2 -0
- package/dist/Resource.mjs +1 -0
- package/dist/Results-BVNEC-Wt.d.mts +277 -0
- package/dist/Results-peJjGA2V.mjs +621 -0
- package/dist/Results-peJjGA2V.mjs.map +1 -0
- package/dist/ResultsStream-BhF0OcNn.mjs +639 -0
- package/dist/ResultsStream-BhF0OcNn.mjs.map +1 -0
- package/dist/ResultsStream-toYMXrOe.d.mts +100 -0
- package/dist/SemAct-CDchtk49.d.mts +96 -0
- package/dist/SemAct-CmyT4yI8.mjs +118 -0
- package/dist/SemAct-CmyT4yI8.mjs.map +1 -0
- package/dist/Serialization-DP9H5bYQ.mjs +514 -0
- package/dist/Serialization-DP9H5bYQ.mjs.map +1 -0
- package/dist/Serialization-Df8iVauT.d.mts +392 -0
- package/dist/Serialization.d.mts +2 -0
- package/dist/Serialization.mjs +1 -0
- package/dist/ServerFormats-CrRnjjf6.mjs +64 -0
- package/dist/ServerFormats-CrRnjjf6.mjs.map +1 -0
- package/dist/ServerFormats-DjC9NsO_.d.mts +36 -0
- package/dist/ServiceDescription-BERsvg-k.d.mts +54 -0
- package/dist/ServiceDescription-Dq5hxeGy.mjs +97 -0
- package/dist/ServiceDescription-Dq5hxeGy.mjs.map +1 -0
- package/dist/ShExC-Ctf-06CL.d.mts +67 -0
- package/dist/ShExC-DJbB19i3.mjs +1181 -0
- package/dist/ShExC-DJbB19i3.mjs.map +1 -0
- package/dist/ShExError-BeYFD9rv.d.mts +61 -0
- package/dist/ShExError-CVtq2NnM.mjs +64 -0
- package/dist/ShExError-CVtq2NnM.mjs.map +1 -0
- package/dist/ShExJ-C1u_wgyD.d.mts +531 -0
- package/dist/ShExJ-COiPd9Xw.mjs +532 -0
- package/dist/ShExJ-COiPd9Xw.mjs.map +1 -0
- package/dist/ShExR-ByR4mCh-.mjs +480 -0
- package/dist/ShExR-ByR4mCh-.mjs.map +1 -0
- package/dist/ShExR-CqONNNBz.d.mts +40 -0
- package/dist/ShapeMap-C422pxKl.d.mts +140 -0
- package/dist/ShapeMap-CsgKxB2G.mjs +181 -0
- package/dist/ShapeMap-CsgKxB2G.mjs.map +1 -0
- package/dist/Shapes-18GjfyBV.mjs +597 -0
- package/dist/Shapes-18GjfyBV.mjs.map +1 -0
- package/dist/Shapes-BQFDFc4Q.d.mts +306 -0
- package/dist/Sparql-BiYFMSpl.mjs +29 -0
- package/dist/Sparql-BiYFMSpl.mjs.map +1 -0
- package/dist/Sparql-DecpWTPh.d.mts +97 -0
- package/dist/SparqlClient-C_CjXbwj.mjs +333 -0
- package/dist/SparqlClient-C_CjXbwj.mjs.map +1 -0
- package/dist/SparqlClient-UPc88SHy.d.mts +290 -0
- package/dist/SparqlServer-CbUW-pVj.d.mts +71 -0
- package/dist/SparqlServer-Db7w7Cll.mjs +308 -0
- package/dist/SparqlServer-Db7w7Cll.mjs.map +1 -0
- package/dist/SqlStore-BBqFx-Wl.mjs +684 -0
- package/dist/SqlStore-BBqFx-Wl.mjs.map +1 -0
- package/dist/SqlStore-CCJo5I-e.d.mts +117 -0
- package/dist/Store-D0jmVfb3.d.mts +166 -0
- package/dist/Store-DH3Ow1GO.mjs +162 -0
- package/dist/Store-DH3Ow1GO.mjs.map +1 -0
- package/dist/Structure-BjMo4Bkc.mjs +334 -0
- package/dist/Structure-BjMo4Bkc.mjs.map +1 -0
- package/dist/Structure-n4CmDiab.d.mts +63 -0
- package/dist/Table-BGgm9nbM.mjs +538 -0
- package/dist/Table-BGgm9nbM.mjs.map +1 -0
- package/dist/Table-C3reiVrb.d.mts +261 -0
- package/dist/Term-B_4ezyXq.d.mts +619 -0
- package/dist/Term-CFLG1qu4.mjs +991 -0
- package/dist/Term-CFLG1qu4.mjs.map +1 -0
- package/dist/Term.d.mts +2 -0
- package/dist/Term.mjs +1 -0
- package/dist/TermCodec-CDZiEztW.mjs +397 -0
- package/dist/TermCodec-CDZiEztW.mjs.map +1 -0
- package/dist/TermCodec-_03bDXr0.d.mts +209 -0
- package/dist/TermCodec.d.mts +2 -0
- package/dist/TermCodec.mjs +1 -0
- package/dist/TermJson-BOPe0yve.d.mts +232 -0
- package/dist/TermJson-FAg3lvjl.mjs +142 -0
- package/dist/TermJson-FAg3lvjl.mjs.map +1 -0
- package/dist/TermJson.d.mts +2 -0
- package/dist/TermJson.mjs +1 -0
- package/dist/TermSchema-Bn9CoaYA.mjs +30 -0
- package/dist/TermSchema-Bn9CoaYA.mjs.map +1 -0
- package/dist/TermSchema-DBO6MroX.d.mts +6 -0
- package/dist/Testing-B-aPCpmu.mjs +63 -0
- package/dist/Testing-B-aPCpmu.mjs.map +1 -0
- package/dist/Testing-CF6s8P3O.d.mts +53 -0
- package/dist/Tiff-CR-2QeSI.d.mts +148 -0
- package/dist/Tiff-DlsOlZPM.mjs +169 -0
- package/dist/Tiff-DlsOlZPM.mjs.map +1 -0
- package/dist/Tools-7MdRKccr.d.mts +583 -0
- package/dist/Tools-ryxphZbI.mjs +329 -0
- package/dist/Tools-ryxphZbI.mjs.map +1 -0
- package/dist/Translate-B0YKKANS.d.mts +37 -0
- package/dist/Translate-gzWPq0Ia.mjs +308 -0
- package/dist/Translate-gzWPq0Ia.mjs.map +1 -0
- package/dist/Translation-DC9rLm2y.mjs +1535 -0
- package/dist/Translation-DC9rLm2y.mjs.map +1 -0
- package/dist/Translation-K4L9XBqX.d.mts +103 -0
- package/dist/TriG-BkqtqZ6Y.mjs +125 -0
- package/dist/TriG-BkqtqZ6Y.mjs.map +1 -0
- package/dist/TriG-xDjdDatp.d.mts +86 -0
- package/dist/Turtle-Bv1_bisW.d.mts +85 -0
- package/dist/Turtle-CZVUOtwl.mjs +133 -0
- package/dist/Turtle-CZVUOtwl.mjs.map +1 -0
- package/dist/ValidationReport-DBdJshW5.mjs +285 -0
- package/dist/ValidationReport-DBdJshW5.mjs.map +1 -0
- package/dist/ValidationReport-Dx3WxY0h.d.mts +192 -0
- package/dist/Validator-227ff9Rn.d.mts +179 -0
- package/dist/Validator-BzXMKDeJ.mjs +1162 -0
- package/dist/Validator-BzXMKDeJ.mjs.map +1 -0
- package/dist/Validator-Dl8cih5V.d.mts +207 -0
- package/dist/Validator-DmUfMbpL.mjs +568 -0
- package/dist/Validator-DmUfMbpL.mjs.map +1 -0
- package/dist/Vocab-DceKywpq.mjs +168 -0
- package/dist/Vocab-DceKywpq.mjs.map +1 -0
- package/dist/Vocab-Df-L-IwZ.d.mts +46 -0
- package/dist/Vocab-Do56UgBX.d.mts +81 -0
- package/dist/Vocab-TfpWG1Ne.mjs +118 -0
- package/dist/Vocab-TfpWG1Ne.mjs.map +1 -0
- package/dist/Vocab.d.mts +2 -0
- package/dist/Vocab.mjs +1 -0
- package/dist/Vocabulary-C6-GPOy4.d.mts +22 -0
- package/dist/Vocabulary-CnQl-_Z4.mjs +179 -0
- package/dist/Vocabulary-CnQl-_Z4.mjs.map +1 -0
- package/dist/Xml-B7iihYCS.mjs +976 -0
- package/dist/Xml-B7iihYCS.mjs.map +1 -0
- package/dist/Xml-CmfHS7SW.d.mts +267 -0
- package/dist/Xmp-D7CKA7MZ.d.mts +111 -0
- package/dist/Xmp-DCGN9pOD.mjs +307 -0
- package/dist/Xmp-DCGN9pOD.mjs.map +1 -0
- package/dist/XmpBasic-CP38jpR_.mjs +73 -0
- package/dist/XmpBasic-CP38jpR_.mjs.map +1 -0
- package/dist/XmpBasic-Cmbe53rQ.d.mts +64 -0
- package/dist/XmpMM-BfL_TgJF.mjs +73 -0
- package/dist/XmpMM-BfL_TgJF.mjs.map +1 -0
- package/dist/XmpMM-Dqm3IX8p.d.mts +63 -0
- package/dist/XmpRights-BKPtoI5L.mjs +73 -0
- package/dist/XmpRights-BKPtoI5L.mjs.map +1 -0
- package/dist/XmpRights-CaALZQz2.d.mts +63 -0
- package/dist/Xsd-Cdgx5zRB.mjs +405 -0
- package/dist/Xsd-Cdgx5zRB.mjs.map +1 -0
- package/dist/Xsd-D2elNhSm.d.mts +187 -0
- package/dist/Xsd.d.mts +2 -0
- package/dist/Xsd.mjs +1 -0
- package/dist/accessors-CEjaojuQ.mjs +28 -0
- package/dist/accessors-CEjaojuQ.mjs.map +1 -0
- package/dist/codec-Lb2T96rv.d.mts +20 -0
- package/dist/codec-QNo7IdJF.mjs +389 -0
- package/dist/codec-QNo7IdJF.mjs.map +1 -0
- package/dist/csvw/Csv2Json.d.mts +2 -0
- package/dist/csvw/Csv2Json.mjs +1 -0
- package/dist/csvw/Csv2Rdf.d.mts +2 -0
- package/dist/csvw/Csv2Rdf.mjs +1 -0
- package/dist/csvw/Datatype.d.mts +2 -0
- package/dist/csvw/Datatype.mjs +1 -0
- package/dist/csvw/Metadata.d.mts +2 -0
- package/dist/csvw/Metadata.mjs +1 -0
- package/dist/csvw/Processor.d.mts +2 -0
- package/dist/csvw/Processor.mjs +1 -0
- package/dist/csvw/Report.d.mts +2 -0
- package/dist/csvw/Report.mjs +1 -0
- package/dist/csvw/Table.d.mts +2 -0
- package/dist/csvw/Table.mjs +1 -0
- package/dist/csvw/index.d.mts +8 -0
- package/dist/csvw/index.mjs +8 -0
- package/dist/index-Cms2TYfC.d.mts +16 -0
- package/dist/index-Ct8xFmRs.d.mts +7 -0
- package/dist/index-D4QFwOjm.d.mts +28 -0
- package/dist/index.d.mts +18 -0
- package/dist/index.mjs +17 -0
- package/dist/jsonld/DocumentLoader.d.mts +2 -0
- package/dist/jsonld/DocumentLoader.mjs +1 -0
- package/dist/jsonld/JsonLd.d.mts +2 -0
- package/dist/jsonld/JsonLd.mjs +1 -0
- package/dist/jsonld/JsonLdError.d.mts +2 -0
- package/dist/jsonld/JsonLdError.mjs +1 -0
- package/dist/jsonld/index.d.mts +4 -0
- package/dist/jsonld/index.mjs +4 -0
- package/dist/lists-D-OpQ0Ir.mjs +77 -0
- package/dist/lists-D-OpQ0Ir.mjs.map +1 -0
- package/dist/loop-D5-gNx9K.mjs +21 -0
- package/dist/loop-D5-gNx9K.mjs.map +1 -0
- package/dist/loop-DZ2hXlr_.mjs +21 -0
- package/dist/loop-DZ2hXlr_.mjs.map +1 -0
- package/dist/n3/Isomorphism.d.mts +2 -0
- package/dist/n3/Isomorphism.mjs +1 -0
- package/dist/n3/Mapping.d.mts +2 -0
- package/dist/n3/Mapping.mjs +1 -0
- package/dist/n3/Model.d.mts +2 -0
- package/dist/n3/Model.mjs +1 -0
- package/dist/n3/N3.d.mts +2 -0
- package/dist/n3/N3.mjs +1 -0
- package/dist/n3/Reasoner.d.mts +2 -0
- package/dist/n3/Reasoner.mjs +2 -0
- package/dist/n3/Vocab.d.mts +2 -0
- package/dist/n3/Vocab.mjs +1 -0
- package/dist/n3/index.d.mts +7 -0
- package/dist/n3/index.mjs +7 -0
- package/dist/ntriples/Grammar.d.mts +2 -0
- package/dist/ntriples/Grammar.mjs +1 -0
- package/dist/ntriples/Lexical.d.mts +2 -0
- package/dist/ntriples/Lexical.mjs +1 -0
- package/dist/ntriples/NQuads.d.mts +2 -0
- package/dist/ntriples/NQuads.mjs +1 -0
- package/dist/ntriples/NTriples.d.mts +2 -0
- package/dist/ntriples/NTriples.mjs +1 -0
- package/dist/ntriples/index.d.mts +5 -0
- package/dist/ntriples/index.mjs +5 -0
- package/dist/rdfjson/RdfJson.d.mts +2 -0
- package/dist/rdfjson/RdfJson.mjs +1 -0
- package/dist/rdfjson/index.d.mts +2 -0
- package/dist/rdfjson/index.mjs +1 -0
- package/dist/rdfxml/RdfXml.d.mts +2 -0
- package/dist/rdfxml/RdfXml.mjs +1 -0
- package/dist/rdfxml/Xml.d.mts +2 -0
- package/dist/rdfxml/Xml.mjs +1 -0
- package/dist/rdfxml/index.d.mts +3 -0
- package/dist/rdfxml/index.mjs +3 -0
- package/dist/rolldown-runtime-D8jQpDG7.mjs +12 -0
- package/dist/serialize-96KBvKaf.mjs +1463 -0
- package/dist/serialize-96KBvKaf.mjs.map +1 -0
- package/dist/serialize-DsoXdM6n.d.mts +37 -0
- package/dist/shacl/Message.d.mts +2 -0
- package/dist/shacl/Message.mjs +1 -0
- package/dist/shacl/Path.d.mts +2 -0
- package/dist/shacl/Path.mjs +1 -0
- package/dist/shacl/Shapes.d.mts +2 -0
- package/dist/shacl/Shapes.mjs +1 -0
- package/dist/shacl/Sparql.d.mts +2 -0
- package/dist/shacl/Sparql.mjs +1 -0
- package/dist/shacl/ValidationReport.d.mts +2 -0
- package/dist/shacl/ValidationReport.mjs +1 -0
- package/dist/shacl/Validator.d.mts +2 -0
- package/dist/shacl/Validator.mjs +1 -0
- package/dist/shacl/Vocabulary.d.mts +2 -0
- package/dist/shacl/Vocabulary.mjs +1 -0
- package/dist/shacl/index.d.mts +9 -0
- package/dist/shacl/index.mjs +8 -0
- package/dist/shex/SemAct.d.mts +2 -0
- package/dist/shex/SemAct.mjs +1 -0
- package/dist/shex/ShExC.d.mts +2 -0
- package/dist/shex/ShExC.mjs +1 -0
- package/dist/shex/ShExError.d.mts +2 -0
- package/dist/shex/ShExError.mjs +1 -0
- package/dist/shex/ShExJ.d.mts +2 -0
- package/dist/shex/ShExJ.mjs +2 -0
- package/dist/shex/ShExR.d.mts +2 -0
- package/dist/shex/ShExR.mjs +1 -0
- package/dist/shex/ShapeMap.d.mts +2 -0
- package/dist/shex/ShapeMap.mjs +1 -0
- package/dist/shex/Structure.d.mts +2 -0
- package/dist/shex/Structure.mjs +2 -0
- package/dist/shex/Validator.d.mts +2 -0
- package/dist/shex/Validator.mjs +4 -0
- package/dist/shex/index.d.mts +9 -0
- package/dist/shex/index.mjs +9 -0
- package/dist/sparql/Algebra.d.mts +2 -0
- package/dist/sparql/Algebra.mjs +1 -0
- package/dist/sparql/Ast.d.mts +2 -0
- package/dist/sparql/Ast.mjs +1 -0
- package/dist/sparql/Bindings.d.mts +2 -0
- package/dist/sparql/Bindings.mjs +1 -0
- package/dist/sparql/ClientErrors.d.mts +2 -0
- package/dist/sparql/ClientErrors.mjs +1 -0
- package/dist/sparql/ClientFormats.d.mts +2 -0
- package/dist/sparql/ClientFormats.mjs +1 -0
- package/dist/sparql/Engine.d.mts +2 -0
- package/dist/sparql/Engine.mjs +1 -0
- package/dist/sparql/Errors.d.mts +2 -0
- package/dist/sparql/Errors.mjs +1 -0
- package/dist/sparql/Expression.d.mts +2 -0
- package/dist/sparql/Expression.mjs +1 -0
- package/dist/sparql/Federation.d.mts +2 -0
- package/dist/sparql/Federation.mjs +1 -0
- package/dist/sparql/Functions.d.mts +2 -0
- package/dist/sparql/Functions.mjs +1 -0
- package/dist/sparql/Generator.d.mts +2 -0
- package/dist/sparql/Generator.mjs +1 -0
- package/dist/sparql/GraphStore.d.mts +2 -0
- package/dist/sparql/GraphStore.mjs +1 -0
- package/dist/sparql/Optimizer.d.mts +2 -0
- package/dist/sparql/Optimizer.mjs +1 -0
- package/dist/sparql/Options.d.mts +2 -0
- package/dist/sparql/Options.mjs +1 -0
- package/dist/sparql/Parser.d.mts +2 -0
- package/dist/sparql/Parser.mjs +1 -0
- package/dist/sparql/Protocol.d.mts +2 -0
- package/dist/sparql/Protocol.mjs +1 -0
- package/dist/sparql/ProtocolErrors.d.mts +2 -0
- package/dist/sparql/ProtocolErrors.mjs +1 -0
- package/dist/sparql/QueryBuilder.d.mts +2 -0
- package/dist/sparql/QueryBuilder.mjs +1 -0
- package/dist/sparql/Results.d.mts +2 -0
- package/dist/sparql/Results.mjs +1 -0
- package/dist/sparql/ResultsStream.d.mts +2 -0
- package/dist/sparql/ResultsStream.mjs +1 -0
- package/dist/sparql/ServerFormats.d.mts +2 -0
- package/dist/sparql/ServerFormats.mjs +1 -0
- package/dist/sparql/ServiceDescription.d.mts +2 -0
- package/dist/sparql/ServiceDescription.mjs +1 -0
- package/dist/sparql/SparqlClient.d.mts +2 -0
- package/dist/sparql/SparqlClient.mjs +1 -0
- package/dist/sparql/SparqlServer.d.mts +2 -0
- package/dist/sparql/SparqlServer.mjs +1 -0
- package/dist/sparql/Store.d.mts +2 -0
- package/dist/sparql/Store.mjs +1 -0
- package/dist/sparql/TermSchema.d.mts +3 -0
- package/dist/sparql/TermSchema.mjs +2 -0
- package/dist/sparql/Testing.d.mts +2 -0
- package/dist/sparql/Testing.mjs +1 -0
- package/dist/sparql/Translate.d.mts +2 -0
- package/dist/sparql/Translate.mjs +1 -0
- package/dist/sparql/ai/Mcp.d.mts +2 -0
- package/dist/sparql/ai/Mcp.mjs +1 -0
- package/dist/sparql/ai/Tools.d.mts +2 -0
- package/dist/sparql/ai/Tools.mjs +1 -0
- package/dist/sparql/ai/index.d.mts +3 -0
- package/dist/sparql/ai/index.mjs +3 -0
- package/dist/sparql/index.d.mts +30 -0
- package/dist/sparql/index.mjs +29 -0
- package/dist/sparql/shacl/Evaluator.d.mts +2 -0
- package/dist/sparql/shacl/Evaluator.mjs +1 -0
- package/dist/sparql/shacl/Query.d.mts +2 -0
- package/dist/sparql/shacl/Query.mjs +1 -0
- package/dist/sparql/shacl/index.d.mts +3 -0
- package/dist/sparql/shacl/index.mjs +3 -0
- package/dist/sparql/sql/Dialect.d.mts +2 -0
- package/dist/sparql/sql/Dialect.mjs +1 -0
- package/dist/sparql/sql/SqlStore.d.mts +2 -0
- package/dist/sparql/sql/SqlStore.mjs +1 -0
- package/dist/sparql/sql/Translation.d.mts +2 -0
- package/dist/sparql/sql/Translation.mjs +1 -0
- package/dist/sparql/sql/index.d.mts +4 -0
- package/dist/sparql/sql/index.mjs +4 -0
- package/dist/stringMap-D5YIpYtR.mjs +38 -0
- package/dist/stringMap-D5YIpYtR.mjs.map +1 -0
- package/dist/tokens-C6BzeodQ.mjs +24 -0
- package/dist/tokens-C6BzeodQ.mjs.map +1 -0
- package/dist/turtle/Grammar.d.mts +3 -0
- package/dist/turtle/Grammar.mjs +3 -0
- package/dist/turtle/Manifest.d.mts +2 -0
- package/dist/turtle/Manifest.mjs +1 -0
- package/dist/turtle/TriG.d.mts +2 -0
- package/dist/turtle/TriG.mjs +1 -0
- package/dist/turtle/Turtle.d.mts +2 -0
- package/dist/turtle/Turtle.mjs +1 -0
- package/dist/turtle/index.d.mts +5 -0
- package/dist/turtle/index.mjs +5 -0
- package/dist/xmp/DublinCore.d.mts +2 -0
- package/dist/xmp/DublinCore.mjs +1 -0
- package/dist/xmp/Exif.d.mts +2 -0
- package/dist/xmp/Exif.mjs +1 -0
- package/dist/xmp/Extract.d.mts +2 -0
- package/dist/xmp/Extract.mjs +1 -0
- package/dist/xmp/Metadata.d.mts +2 -0
- package/dist/xmp/Metadata.mjs +1 -0
- package/dist/xmp/Namespaces.d.mts +2 -0
- package/dist/xmp/Namespaces.mjs +1 -0
- package/dist/xmp/Packet.d.mts +2 -0
- package/dist/xmp/Packet.mjs +1 -0
- package/dist/xmp/Pdf.d.mts +2 -0
- package/dist/xmp/Pdf.mjs +1 -0
- package/dist/xmp/PdfA.d.mts +2 -0
- package/dist/xmp/PdfA.mjs +1 -0
- package/dist/xmp/Photoshop.d.mts +2 -0
- package/dist/xmp/Photoshop.mjs +1 -0
- package/dist/xmp/Tiff.d.mts +2 -0
- package/dist/xmp/Tiff.mjs +1 -0
- package/dist/xmp/Xmp.d.mts +2 -0
- package/dist/xmp/Xmp.mjs +3 -0
- package/dist/xmp/XmpBasic.d.mts +2 -0
- package/dist/xmp/XmpBasic.mjs +1 -0
- package/dist/xmp/XmpMM.d.mts +2 -0
- package/dist/xmp/XmpMM.mjs +1 -0
- package/dist/xmp/XmpRights.d.mts +2 -0
- package/dist/xmp/XmpRights.mjs +1 -0
- package/dist/xmp/index.d.mts +15 -0
- package/dist/xmp/index.mjs +15 -0
- package/package.json +195 -3
- package/src/Dataset.ts +1085 -0
- package/src/Iri.ts +322 -0
- package/src/Isomorphism.ts +319 -0
- package/src/LanguageTag.ts +98 -0
- package/src/Namespace.ts +100 -0
- package/src/PrefixMap.ts +117 -0
- package/src/RdfJs.ts +146 -0
- package/src/Rdfs.ts +241 -0
- package/src/Reification.ts +103 -0
- package/src/Resource.ts +873 -0
- package/src/Serialization.ts +775 -0
- package/src/Term.ts +1300 -0
- package/src/TermCodec.ts +505 -0
- package/src/TermJson.ts +313 -0
- package/src/Vocab.ts +161 -0
- package/src/Xsd.ts +573 -0
- package/src/csvw/Csv2Json.ts +265 -0
- package/src/csvw/Csv2Rdf.ts +268 -0
- package/src/csvw/Datatype.ts +589 -0
- package/src/csvw/Metadata.ts +1523 -0
- package/src/csvw/Processor.ts +276 -0
- package/src/csvw/Report.ts +135 -0
- package/src/csvw/Table.ts +759 -0
- package/src/csvw/index.ts +22 -0
- package/src/csvw/internal/dateFormat.ts +202 -0
- package/src/csvw/internal/json.ts +104 -0
- package/src/csvw/internal/numberFormat.ts +369 -0
- package/src/csvw/internal/object.ts +23 -0
- package/src/csvw/internal/uriTemplate.ts +130 -0
- package/src/csvw/internal/url.ts +93 -0
- package/src/csvw/internal/vocab.ts +282 -0
- package/src/index.ts +40 -0
- package/src/internal/arbitrary.ts +148 -0
- package/src/internal/loop.ts +24 -0
- package/src/internal/pending.ts +20 -0
- package/src/internal/textDecoder.ts +183 -0
- package/src/jsonld/DocumentLoader.ts +512 -0
- package/src/jsonld/JsonLd.ts +847 -0
- package/src/jsonld/JsonLdError.ts +105 -0
- package/src/jsonld/index.ts +13 -0
- package/src/jsonld/internal/compact.ts +852 -0
- package/src/jsonld/internal/context.ts +781 -0
- package/src/jsonld/internal/expand.ts +614 -0
- package/src/jsonld/internal/flatten.ts +243 -0
- package/src/jsonld/internal/frame.ts +559 -0
- package/src/jsonld/internal/iri.ts +52 -0
- package/src/jsonld/internal/json.ts +19 -0
- package/src/jsonld/internal/linkHeader.ts +60 -0
- package/src/jsonld/internal/rdf.ts +481 -0
- package/src/jsonld/internal/util.ts +367 -0
- package/src/n3/Isomorphism.ts +476 -0
- package/src/n3/Mapping.ts +332 -0
- package/src/n3/Model.ts +696 -0
- package/src/n3/N3.ts +237 -0
- package/src/n3/Reasoner.ts +568 -0
- package/src/n3/Vocab.ts +111 -0
- package/src/n3/index.ts +21 -0
- package/src/n3/internal/builtins.ts +668 -0
- package/src/n3/internal/guards.ts +23 -0
- package/src/n3/internal/lists.ts +106 -0
- package/src/n3/internal/loop.ts +28 -0
- package/src/n3/internal/parser.ts +1032 -0
- package/src/n3/internal/writer.ts +344 -0
- package/src/ntriples/Grammar.ts +317 -0
- package/src/ntriples/Lexical.ts +321 -0
- package/src/ntriples/NQuads.ts +140 -0
- package/src/ntriples/NTriples.ts +143 -0
- package/src/ntriples/index.ts +14 -0
- package/src/ntriples/internal/codec.ts +229 -0
- package/src/ntriples/internal/lineParser.ts +326 -0
- package/src/ntriples/internal/loop.ts +14 -0
- package/src/rdfjson/RdfJson.ts +806 -0
- package/src/rdfjson/index.ts +9 -0
- package/src/rdfjson/internal/json.ts +19 -0
- package/src/rdfxml/RdfXml.ts +1408 -0
- package/src/rdfxml/Xml.ts +419 -0
- package/src/rdfxml/index.ts +11 -0
- package/src/rdfxml/internal/chars.ts +73 -0
- package/src/rdfxml/internal/loop.ts +24 -0
- package/src/rdfxml/internal/parser.ts +1265 -0
- package/src/shacl/Message.ts +102 -0
- package/src/shacl/Path.ts +483 -0
- package/src/shacl/Shapes.ts +913 -0
- package/src/shacl/Sparql.ts +128 -0
- package/src/shacl/ValidationReport.ts +438 -0
- package/src/shacl/Validator.ts +1156 -0
- package/src/shacl/Vocabulary.ts +180 -0
- package/src/shacl/index.ts +22 -0
- package/src/shacl/internal/compare.ts +128 -0
- package/src/shacl/internal/regex.ts +56 -0
- package/src/shex/SemAct.ts +197 -0
- package/src/shex/ShExC.ts +415 -0
- package/src/shex/ShExError.ts +71 -0
- package/src/shex/ShExJ.ts +893 -0
- package/src/shex/ShExR.ts +640 -0
- package/src/shex/ShapeMap.ts +385 -0
- package/src/shex/Structure.ts +467 -0
- package/src/shex/Validator.ts +395 -0
- package/src/shex/index.ts +24 -0
- package/src/shex/internal/engine.ts +682 -0
- package/src/shex/internal/iterate.ts +14 -0
- package/src/shex/internal/json.ts +12 -0
- package/src/shex/internal/lexer.ts +56 -0
- package/src/shex/internal/nodeConstraint.ts +368 -0
- package/src/shex/internal/shexcLexer.ts +387 -0
- package/src/shex/internal/shexcParser.ts +1312 -0
- package/src/shex/internal/tokens.ts +41 -0
- package/src/shex/internal/xpathRegex.ts +290 -0
- package/src/sparql/Algebra.ts +914 -0
- package/src/sparql/Ast.ts +1344 -0
- package/src/sparql/Bindings.ts +272 -0
- package/src/sparql/ClientErrors.ts +156 -0
- package/src/sparql/ClientFormats.ts +70 -0
- package/src/sparql/Engine.ts +699 -0
- package/src/sparql/Errors.ts +30 -0
- package/src/sparql/Expression.ts +360 -0
- package/src/sparql/Federation.ts +187 -0
- package/src/sparql/Functions.ts +689 -0
- package/src/sparql/Generator.ts +426 -0
- package/src/sparql/GraphStore.ts +341 -0
- package/src/sparql/Optimizer.ts +230 -0
- package/src/sparql/Options.ts +191 -0
- package/src/sparql/Parser.ts +173 -0
- package/src/sparql/Protocol.ts +342 -0
- package/src/sparql/ProtocolErrors.ts +113 -0
- package/src/sparql/QueryBuilder.ts +953 -0
- package/src/sparql/Results.ts +844 -0
- package/src/sparql/ResultsStream.ts +771 -0
- package/src/sparql/ServerFormats.ts +75 -0
- package/src/sparql/ServiceDescription.ts +130 -0
- package/src/sparql/SparqlClient.ts +947 -0
- package/src/sparql/SparqlServer.ts +528 -0
- package/src/sparql/Store.ts +311 -0
- package/src/sparql/TermSchema.ts +20 -0
- package/src/sparql/Testing.ts +114 -0
- package/src/sparql/Translate.ts +407 -0
- package/src/sparql/ai/Mcp.ts +43 -0
- package/src/sparql/ai/Tools.ts +481 -0
- package/src/sparql/ai/index.ts +11 -0
- package/src/sparql/index.ts +64 -0
- package/src/sparql/internal/evaluator.ts +947 -0
- package/src/sparql/internal/hash.ts +418 -0
- package/src/sparql/internal/json.ts +12 -0
- package/src/sparql/internal/lexer.ts +488 -0
- package/src/sparql/internal/loop.ts +24 -0
- package/src/sparql/internal/parser.ts +2215 -0
- package/src/sparql/internal/prefetch.ts +46 -0
- package/src/sparql/internal/stringMap.ts +39 -0
- package/src/sparql/internal/textResults.ts +226 -0
- package/src/sparql/internal/values.ts +550 -0
- package/src/sparql/shacl/Evaluator.ts +478 -0
- package/src/sparql/shacl/Query.ts +574 -0
- package/src/sparql/shacl/index.ts +12 -0
- package/src/sparql/sql/Dialect.ts +246 -0
- package/src/sparql/sql/SqlStore.ts +1080 -0
- package/src/sparql/sql/Translation.ts +1898 -0
- package/src/sparql/sql/index.ts +17 -0
- package/src/sparql/sql/internal/encoding.ts +313 -0
- package/src/turtle/Grammar.ts +286 -0
- package/src/turtle/Manifest.ts +215 -0
- package/src/turtle/TriG.ts +158 -0
- package/src/turtle/Turtle.ts +166 -0
- package/src/turtle/index.ts +14 -0
- package/src/turtle/internal/loop.ts +23 -0
- package/src/turtle/internal/parse.ts +112 -0
- package/src/turtle/internal/parser.ts +1303 -0
- package/src/turtle/internal/serialize.ts +79 -0
- package/src/turtle/internal/streamWriter.ts +128 -0
- package/src/turtle/internal/writer.ts +898 -0
- package/src/xmp/DublinCore.ts +147 -0
- package/src/xmp/Exif.ts +109 -0
- package/src/xmp/Extract.ts +351 -0
- package/src/xmp/Metadata.ts +703 -0
- package/src/xmp/Namespaces.ts +228 -0
- package/src/xmp/Packet.ts +297 -0
- package/src/xmp/Pdf.ts +99 -0
- package/src/xmp/PdfA.ts +280 -0
- package/src/xmp/Photoshop.ts +275 -0
- package/src/xmp/Tiff.ts +196 -0
- package/src/xmp/Xmp.ts +430 -0
- package/src/xmp/XmpBasic.ts +90 -0
- package/src/xmp/XmpMM.ts +82 -0
- package/src/xmp/XmpRights.ts +83 -0
- package/src/xmp/index.ts +36 -0
- package/src/xmp/internal/accessors.ts +72 -0
- package/src/xmp/internal/xml.ts +63 -0
|
@@ -0,0 +1,976 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.mjs";
|
|
2
|
+
import * as Arr from "effect/Array";
|
|
3
|
+
import { constFalse } from "effect/Function";
|
|
4
|
+
import * as HashMap from "effect/HashMap";
|
|
5
|
+
import * as HashSet from "effect/HashSet";
|
|
6
|
+
import * as Iterable from "effect/Iterable";
|
|
7
|
+
import * as MutableHashMap from "effect/MutableHashMap";
|
|
8
|
+
import * as MutableHashSet from "effect/MutableHashSet";
|
|
9
|
+
import * as Option from "effect/Option";
|
|
10
|
+
import * as Predicate from "effect/Predicate";
|
|
11
|
+
import * as Schema from "effect/Schema";
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
13
|
+
import * as Match from "effect/Match";
|
|
14
|
+
import * as Order from "effect/Order";
|
|
15
|
+
import * as Result from "effect/Result";
|
|
16
|
+
import * as Compiler from "@thomasfosterau/effect-parse/Compiler";
|
|
17
|
+
import * as Parser from "@thomasfosterau/effect-parse/Parser";
|
|
18
|
+
import * as Token from "@thomasfosterau/effect-parse/Token";
|
|
19
|
+
// src/rdfxml/internal/chars.ts
|
|
20
|
+
/**
|
|
21
|
+
* XML 1.0 character classes, as regular expressions (for the predicates) and
|
|
22
|
+
* as `@thomasfosterau/effect-parse` token sets (for the grammar).
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
/** @internal */
|
|
27
|
+
const NAME_START$1 = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}";
|
|
28
|
+
/** @internal */
|
|
29
|
+
const NAME_CHAR$1 = `${NAME_START$1}\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040`;
|
|
30
|
+
const NAME_RE = new RegExp(`^[:${NAME_START$1}][:${NAME_CHAR$1}]*$`, "u");
|
|
31
|
+
const NCNAME_RE = new RegExp(`^[${NAME_START$1}][${NAME_CHAR$1}]*$`, "u");
|
|
32
|
+
/** @internal */
|
|
33
|
+
const NMTOKEN_RE = new RegExp(`^[:${NAME_CHAR$1}]+$`, "u");
|
|
34
|
+
/** @internal */
|
|
35
|
+
const INVALID_CHAR_RE = /* @__PURE__ */ new RegExp("[^\\t\\n\\r\\u0020-\\uD7FF\\uE000-\\uFFFD\\u{10000}-\\u{10FFFF}]", "u");
|
|
36
|
+
/** @internal */
|
|
37
|
+
const PUBID_RE = /^[ \r\na-zA-Z0-9\-'()+,./:=?;!*#@$_%]*$/;
|
|
38
|
+
/** @internal */
|
|
39
|
+
const isNCName$1 = (value) => NCNAME_RE.test(value);
|
|
40
|
+
/** @internal */
|
|
41
|
+
const isName$1 = (value) => NAME_RE.test(value);
|
|
42
|
+
/** @internal */
|
|
43
|
+
const isValidText$1 = (value) => !INVALID_CHAR_RE.test(value);
|
|
44
|
+
/** `NameStartChar` (with `:`). */
|
|
45
|
+
const nameStart = [[
|
|
46
|
+
Token.range("A", "Z"),
|
|
47
|
+
"_",
|
|
48
|
+
Token.range("a", "z"),
|
|
49
|
+
Token.range("À", "Ö"),
|
|
50
|
+
Token.range("Ø", "ö"),
|
|
51
|
+
Token.range("ø", "˿"),
|
|
52
|
+
Token.range("Ͱ", "ͽ"),
|
|
53
|
+
Token.range("Ϳ", ""),
|
|
54
|
+
Token.range("", ""),
|
|
55
|
+
Token.range("⁰", ""),
|
|
56
|
+
Token.range("Ⰰ", ""),
|
|
57
|
+
Token.range("、", ""),
|
|
58
|
+
Token.range("豈", "﷏"),
|
|
59
|
+
Token.range("ﷰ", "�"),
|
|
60
|
+
Token.range("𐀀", "")
|
|
61
|
+
], ":"];
|
|
62
|
+
/** `NameChar` (with `:`). */
|
|
63
|
+
const nameChar = [
|
|
64
|
+
nameStart,
|
|
65
|
+
"-.",
|
|
66
|
+
Token.range("0", "9"),
|
|
67
|
+
"·",
|
|
68
|
+
Token.range("̀", "ͯ"),
|
|
69
|
+
Token.range("‿", "⁀")
|
|
70
|
+
];
|
|
71
|
+
/** `S` */
|
|
72
|
+
const space = " \n\r";
|
|
73
|
+
// src/rdfxml/internal/loop.ts
|
|
74
|
+
/**
|
|
75
|
+
* A loop as a function, for the scans that step a cursor until a condition
|
|
76
|
+
* holds (the line starts of a document, the canonical form of a long run of
|
|
77
|
+
* nodes).
|
|
78
|
+
*
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
const BLOCK = 1024;
|
|
82
|
+
/** `0 … BLOCK - 1`: the steps of one block run as an array scan, which engines optimise well. */
|
|
83
|
+
const offsets = Array.from({ length: BLOCK }, (_, i) => i);
|
|
84
|
+
/** The first step of each block after the first: `BLOCK, 2 * BLOCK, …`. */
|
|
85
|
+
const blocks = Iterable.makeBy((b) => (b + 1) * BLOCK);
|
|
86
|
+
/** Calls `step` with 0, 1, 2, … until it returns `false`. */
|
|
87
|
+
const loop = (step) => {
|
|
88
|
+
if (offsets.every((i) => step(i))) Iterable.some(blocks, (base) => offsets.some((i) => !step(base + i)));
|
|
89
|
+
};
|
|
90
|
+
// src/rdfxml/internal/parser.ts
|
|
91
|
+
/**
|
|
92
|
+
* The XML 1.0 parser behind `Xml.parse`: a compiled
|
|
93
|
+
* `@thomasfosterau/effect-parse` grammar over the (line-end normalised)
|
|
94
|
+
* input, building the document tree as it reads.
|
|
95
|
+
*
|
|
96
|
+
* Element content is read by one loop over start tags, end tags, text and
|
|
97
|
+
* the other markup, with the open elements on an explicit stack, so deeply
|
|
98
|
+
* nested documents cannot exhaust the call stack. Errors are thrown (as a
|
|
99
|
+
* `Failure` at an offset) out of the grammar.
|
|
100
|
+
*
|
|
101
|
+
* The parser guards against hostile documents:
|
|
102
|
+
*
|
|
103
|
+
* - external entities and parameter entities are never loaded;
|
|
104
|
+
* - the replacement text of entity references may add up to at most
|
|
105
|
+
* `MAX_ENTITY_EXPANSION` characters (which defeats "billion laughs");
|
|
106
|
+
* - entity references nest at most `MAX_ENTITY_DEPTH` deep, and elements at
|
|
107
|
+
* most `MAX_ELEMENT_DEPTH` deep;
|
|
108
|
+
* - the replacement text of an entity that contains markup is parsed with
|
|
109
|
+
* the document's tables, not copies of them, so that many such entities
|
|
110
|
+
* and references cost time in proportion to the text expanded.
|
|
111
|
+
*
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
const XML_NAMESPACE$1 = "http://www.w3.org/XML/1998/namespace";
|
|
115
|
+
const XMLNS_NAMESPACE$1 = "http://www.w3.org/2000/xmlns/";
|
|
116
|
+
/** A well-formedness error at an offset, thrown out of the grammar. */
|
|
117
|
+
var Failure = class {
|
|
118
|
+
message;
|
|
119
|
+
offset;
|
|
120
|
+
/** Where in the document the error is: set by `parseText`, from `offset`. */
|
|
121
|
+
position;
|
|
122
|
+
constructor(message, offset) {
|
|
123
|
+
this.message = message;
|
|
124
|
+
this.offset = offset;
|
|
125
|
+
this.position = {
|
|
126
|
+
offset,
|
|
127
|
+
line: 0,
|
|
128
|
+
column: 0
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
/** The replacement text of a predefined entity, or `''` if `entity` is not one. */
|
|
133
|
+
const predefined = (entity) => entity === "lt" ? "<" : entity === "gt" ? ">" : entity === "amp" ? "&" : entity === "apos" ? "'" : entity === "quot" ? "\"" : "";
|
|
134
|
+
const baseFrame = (inScope) => ({
|
|
135
|
+
qname: "",
|
|
136
|
+
position: {
|
|
137
|
+
offset: 0,
|
|
138
|
+
line: 0,
|
|
139
|
+
column: 0
|
|
140
|
+
},
|
|
141
|
+
prefix: "",
|
|
142
|
+
localName: "",
|
|
143
|
+
namespace: Option.none(),
|
|
144
|
+
attributes: [],
|
|
145
|
+
declarations: [],
|
|
146
|
+
inScope,
|
|
147
|
+
children: [],
|
|
148
|
+
text: "",
|
|
149
|
+
textStart: -1,
|
|
150
|
+
endsWithText: false,
|
|
151
|
+
floor: 0
|
|
152
|
+
});
|
|
153
|
+
/** Whether `offset` is on line `l` (from 0) of the text whose line starts are `starts`. */
|
|
154
|
+
const onLine = (starts, l, offset) => (starts[l] ?? Infinity) <= offset && offset < (starts[l + 1] ?? Infinity);
|
|
155
|
+
/** The line (from 0) of `offset` among lines `lo … hi` of the text whose line starts are `starts`. */
|
|
156
|
+
const lineIndex = (starts, offset, lo, hi) => {
|
|
157
|
+
if (lo >= hi) return lo;
|
|
158
|
+
const mid = lo + hi + 1 >> 1;
|
|
159
|
+
return (starts[mid] ?? 0) <= offset ? lineIndex(starts, offset, mid, hi) : lineIndex(starts, offset, lo, mid - 1);
|
|
160
|
+
};
|
|
161
|
+
const keepChild = () => false;
|
|
162
|
+
/** Up to how many attributes a start tag's duplicates are found by searching its list. */
|
|
163
|
+
const SMALL = 16;
|
|
164
|
+
/** Stands for the declarations of an `<!ATTLIST>` until one is read. */
|
|
165
|
+
const NO_ATTRIBUTE_LIST = {
|
|
166
|
+
types: MutableHashMap.empty(),
|
|
167
|
+
defaults: []
|
|
168
|
+
};
|
|
169
|
+
/** Stands for the set of a start tag's expanded names while it has too few to need one. */
|
|
170
|
+
const UNUSED = MutableHashSet.empty();
|
|
171
|
+
/** The document being parsed. */
|
|
172
|
+
var Context = class {
|
|
173
|
+
/** The text being parsed: the document, or an entity's replacement text. */
|
|
174
|
+
src;
|
|
175
|
+
lineStarts;
|
|
176
|
+
entities = MutableHashMap.empty();
|
|
177
|
+
externalEntities = MutableHashSet.empty();
|
|
178
|
+
/** The `<!ATTLIST>` declarations, by element name. */
|
|
179
|
+
attributeLists = MutableHashMap.empty();
|
|
180
|
+
expanded = 0;
|
|
181
|
+
hasExternalSubset = false;
|
|
182
|
+
/** Takes a finished child of the root element instead of adding it to the root (`true`). */
|
|
183
|
+
onRootChild = keepChild;
|
|
184
|
+
/** The frames of the open elements; those below `base` belong to enclosing text. */
|
|
185
|
+
stack;
|
|
186
|
+
base = 1;
|
|
187
|
+
/** The entities whose replacement text is being parsed. */
|
|
188
|
+
entityStack = HashSet.empty();
|
|
189
|
+
version = Option.none();
|
|
190
|
+
encoding = Option.none();
|
|
191
|
+
standalone = Option.none();
|
|
192
|
+
doctype = Option.none();
|
|
193
|
+
prolog = [];
|
|
194
|
+
epilog = [];
|
|
195
|
+
root = Option.none();
|
|
196
|
+
tagStart = 0;
|
|
197
|
+
qname = "";
|
|
198
|
+
raw = [];
|
|
199
|
+
/** The qualified names read so far, split (`nameParts`). */
|
|
200
|
+
qnames = MutableHashMap.empty();
|
|
201
|
+
/** The names in `namesOf`, once it is too long to search. */
|
|
202
|
+
names = MutableHashSet.empty();
|
|
203
|
+
/** The attributes whose names `names` holds (cleared and refilled for each long start tag). */
|
|
204
|
+
namesOf = [];
|
|
205
|
+
/** The declarations of the `<!ATTLIST>` being read (set as each is begun). */
|
|
206
|
+
attributeList = NO_ATTRIBUTE_LIST;
|
|
207
|
+
attributeName = "";
|
|
208
|
+
attributeType = "";
|
|
209
|
+
tokenized = false;
|
|
210
|
+
constructor(src, lineStarts) {
|
|
211
|
+
this.src = src;
|
|
212
|
+
this.lineStarts = lineStarts;
|
|
213
|
+
this.stack = [baseFrame(/* @__PURE__ */ new Map())];
|
|
214
|
+
}
|
|
215
|
+
/** The line of the last position, where the next one usually is (offsets mostly increase). */
|
|
216
|
+
line = 0;
|
|
217
|
+
position(offset) {
|
|
218
|
+
const starts = this.lineStarts;
|
|
219
|
+
const line = this.line;
|
|
220
|
+
const lo = onLine(starts, line, offset) ? line : onLine(starts, line + 1, offset) ? line + 1 : line > 0 && onLine(starts, line - 1, offset) ? line - 1 : lineIndex(starts, offset, 0, starts.length - 1);
|
|
221
|
+
this.line = lo;
|
|
222
|
+
return {
|
|
223
|
+
offset,
|
|
224
|
+
line: lo + 1,
|
|
225
|
+
column: offset - (starts[lo] ?? 0) + 1
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/** Whether the start tag being read has an attribute `name` (adding it if not). */
|
|
229
|
+
hasAttribute(attribute) {
|
|
230
|
+
if (this.raw.length < SMALL) return this.raw.some((a) => a.name === attribute);
|
|
231
|
+
const names = this.names;
|
|
232
|
+
if (this.namesOf !== this.raw) {
|
|
233
|
+
MutableHashSet.clear(names);
|
|
234
|
+
this.raw.forEach((a) => MutableHashSet.add(names, a.name));
|
|
235
|
+
this.namesOf = this.raw;
|
|
236
|
+
}
|
|
237
|
+
if (MutableHashSet.has(names, attribute)) return true;
|
|
238
|
+
MutableHashSet.add(names, attribute);
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
top() {
|
|
242
|
+
return Arr.lastNonEmpty(this.stack);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
let x = new Context("", [0]);
|
|
246
|
+
const fail = (message, offset) => {
|
|
247
|
+
throw new Failure(message, offset);
|
|
248
|
+
};
|
|
249
|
+
const lit = Token.literal;
|
|
250
|
+
/** Runs `f` at the current offset, consuming nothing. */
|
|
251
|
+
const act = (f) => Parser.tap(Parser.location, f);
|
|
252
|
+
/** Throws `message` at the current offset. */
|
|
253
|
+
const failHere = (message) => Parser.map(Parser.location, (pos) => fail(message, pos));
|
|
254
|
+
const at = (s) => Parser.peek(lit(s));
|
|
255
|
+
const ws = Token.takeWhile(space);
|
|
256
|
+
const requireWs = Parser.alt(Token.takeWhile(space, { min: 1 }), failHere("Expected white space"));
|
|
257
|
+
/** Fails unless white space was just read (`ws` may have read none). */
|
|
258
|
+
const afterWs = Parser.make((state) => {
|
|
259
|
+
const c = state.input.charCodeAt(state.pos - 1);
|
|
260
|
+
if (c !== 32 && c !== 9 && c !== 10 && c !== 13) fail("Expected white space", state.pos);
|
|
261
|
+
});
|
|
262
|
+
const expect = (s) => Parser.alt(lit(s), failHere(`Expected "${s}"`));
|
|
263
|
+
const xmlName = Parser.alt(Parser.taken(Parser.seq(Token.oneOf(nameStart), Token.takeWhile(nameChar))), failHere("Expected a name"));
|
|
264
|
+
const eq = Parser.seq(ws, expect("="), ws);
|
|
265
|
+
/** A quoted string, without its quotes. */
|
|
266
|
+
const quoted = Parser.alt(Parser.preceded(Parser.peek(Token.oneOf("\"'")), Parser.alt(Parser.delimited(lit("\""), Token.takeTill("\""), lit("\"")), Parser.delimited(lit("'"), Token.takeTill("'"), lit("'")), failHere("Unterminated quoted string"))), failHere("Expected a quoted string"));
|
|
267
|
+
/** `p`, then `check` with its value and the offset after it. */
|
|
268
|
+
const checked = (p, check) => Parser.seq(p, Parser.location).pipe(Parser.tap(([a, pos]) => check(a, pos)), Parser.map(([a]) => a));
|
|
269
|
+
const collapse = (value) => value.replace(/ +/g, " ").replace(/^ | $/g, "");
|
|
270
|
+
const CHAR_REF_RE = /^#(x[0-9a-fA-F]+|[0-9]+)$/;
|
|
271
|
+
const charRef = (body, offset) => {
|
|
272
|
+
const code = body.startsWith("#x") ? parseInt(body.slice(2), 16) : parseInt(body.slice(1), 10);
|
|
273
|
+
if (!(code <= 1114111)) fail("Invalid character reference", offset);
|
|
274
|
+
const ch = String.fromCodePoint(code);
|
|
275
|
+
if (!isValidText$1(ch)) fail("Character reference to an invalid character", offset);
|
|
276
|
+
return ch;
|
|
277
|
+
};
|
|
278
|
+
/** Expands the character references in an entity value, leaving entity references. */
|
|
279
|
+
const expandCharRefs = (raw, offset) => raw.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[^;]*);|&/g, (m, body, i) => {
|
|
280
|
+
if (m.length === 1) fail("Invalid reference", offset + i);
|
|
281
|
+
if (body.startsWith("#")) return charRef(body, offset + i);
|
|
282
|
+
if (!isName$1(body)) fail("Invalid entity reference", offset + i);
|
|
283
|
+
return m;
|
|
284
|
+
});
|
|
285
|
+
/** The replacement text of a reference to `entity`, counted against the expansion limit. */
|
|
286
|
+
const entityText = (entity, offset, stack) => {
|
|
287
|
+
if (!isName$1(entity)) fail("Invalid entity reference", offset);
|
|
288
|
+
const builtIn = predefined(entity);
|
|
289
|
+
if (builtIn !== "") return builtIn === "<" ? "<" : builtIn === "&" ? "&" : builtIn;
|
|
290
|
+
if (MutableHashSet.has(x.externalEntities, entity)) fail(`External entity "${entity}" is not supported`, offset);
|
|
291
|
+
const value = Option.getOrElse(MutableHashMap.get(x.entities, entity), () => fail(`Undefined entity "${entity}"`, offset));
|
|
292
|
+
if (HashSet.has(stack, entity)) fail(`Recursive entity "${entity}"`, offset);
|
|
293
|
+
if (HashSet.size(stack) >= 64) fail("Entity references are nested too deeply", offset);
|
|
294
|
+
x.expanded += value.length;
|
|
295
|
+
if (x.expanded > 1e6) fail("Entity expansion limit exceeded", offset);
|
|
296
|
+
return value;
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* What attribute-value normalisation replaces: a reference (to the first `;`
|
|
300
|
+
* after its `&`), an `&` with no `;` after it, `<`, and white space other
|
|
301
|
+
* than a space. The matches are found before any is replaced, so the nested
|
|
302
|
+
* normalisation of an entity's replacement text may reuse it.
|
|
303
|
+
*/
|
|
304
|
+
const ATTRIBUTE_SPECIAL_RE = /&([^;]*);|[&<\t\n\r]/g;
|
|
305
|
+
const ATTRIBUTE_SPECIAL_TEST_RE = /[&<\t\n\r]/;
|
|
306
|
+
/** Normalises an attribute value (XML 1.0 §3.3.3). */
|
|
307
|
+
const normalizeAttribute = (raw, offset, stack) => !ATTRIBUTE_SPECIAL_TEST_RE.test(raw) ? raw : raw.replace(ATTRIBUTE_SPECIAL_RE, (m, body, i) => {
|
|
308
|
+
if (m === "<") return fail("\"<\" is not allowed in attribute values", offset + i);
|
|
309
|
+
if (m === "&") return fail("Unterminated reference", offset + i);
|
|
310
|
+
if (m.length === 1) return " ";
|
|
311
|
+
if (body.startsWith("#")) {
|
|
312
|
+
if (!CHAR_REF_RE.test(body)) fail("Invalid character reference", offset + i);
|
|
313
|
+
return charRef(body, offset + i);
|
|
314
|
+
}
|
|
315
|
+
const replacement = entityText(body, offset + i, stack);
|
|
316
|
+
return normalizeAttribute(replacement, offset + i, HashSet.add(stack, body));
|
|
317
|
+
});
|
|
318
|
+
/** An attribute value literal, normalised. */
|
|
319
|
+
const attributeValue = Parser.alt(Parser.preceded(Parser.peek(Token.oneOf("\"'")), Parser.alt(Parser.seq(Parser.location, Parser.delimited(lit("\""), Token.takeTill("\""), lit("\""))), Parser.seq(Parser.location, Parser.delimited(lit("'"), Token.takeTill("'"), lit("'"))), failHere("Unterminated attribute value"))), failHere("Expected a quoted attribute value")).pipe(Parser.map(([quote, raw]) => normalizeAttribute(raw, quote + 1, HashSet.empty())));
|
|
320
|
+
const comment = Parser.terminated(Parser.seq(Parser.location, Parser.preceded(lit("<!--"), Parser.opt(Token.takeUntil("--"))), Parser.location).pipe(Parser.map(([start, body, end]) => {
|
|
321
|
+
const value = Option.getOrElse(body, () => fail("Unterminated comment", start));
|
|
322
|
+
if (x.src.charCodeAt(end + 2) !== 62) fail("\"--\" is not allowed in comments", end);
|
|
323
|
+
return {
|
|
324
|
+
_tag: "Comment",
|
|
325
|
+
value,
|
|
326
|
+
position: x.position(start)
|
|
327
|
+
};
|
|
328
|
+
})), lit("-->"));
|
|
329
|
+
const pi = Parser.terminated(Parser.seq(Parser.location, Parser.preceded(lit("<?"), checked(xmlName, (target, pos) => {
|
|
330
|
+
if (target.toLowerCase() === "xml") fail("Reserved processing instruction target", pos - target.length - 2);
|
|
331
|
+
if (target.includes(":")) fail("Processing instruction targets cannot contain \":\"", pos);
|
|
332
|
+
})), Parser.alt(Parser.preceded(at("?>"), Parser.succeed(Option.some(""))), Parser.preceded(requireWs, Parser.opt(Token.takeUntil("?>"))))).pipe(Parser.map(([start, target, data]) => ({
|
|
333
|
+
_tag: "ProcessingInstruction",
|
|
334
|
+
target,
|
|
335
|
+
data: Option.getOrElse(data, () => fail("Unterminated processing instruction", start)),
|
|
336
|
+
position: x.position(start)
|
|
337
|
+
}))), lit("?>"));
|
|
338
|
+
/** `ExternalID`: `[publicId, systemId]`. */
|
|
339
|
+
const externalId = Parser.alt(Parser.preceded(Parser.seq(lit("SYSTEM"), requireWs), quoted).pipe(Parser.map((system) => [Option.none(), Option.some(system)])), Parser.preceded(Parser.seq(expect("PUBLIC"), requireWs), Parser.seq(checked(quoted, (pub, pos) => {
|
|
340
|
+
if (!PUBID_RE.test(pub)) fail("Invalid public identifier", pos);
|
|
341
|
+
}), Parser.preceded(Parser.seq(ws, afterWs), quoted)).pipe(Parser.map(([pub, system]) => [Option.some(pub), Option.some(system)]))));
|
|
342
|
+
const skipParens = Parser.preceded(expect("("), Parser.seq(Parser.location, Token.takeTill(")"), Parser.opt(lit(")"))).pipe(Parser.tap(([pos, tokens, close]) => {
|
|
343
|
+
if (Option.isNone(close)) fail("Unterminated enumeration", pos);
|
|
344
|
+
if (tokens.split("|").some((t) => !NMTOKEN_RE.test(t.trim()))) fail("Invalid enumeration", pos);
|
|
345
|
+
})));
|
|
346
|
+
const TOKENIZED_TYPES = HashSet.make("ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS");
|
|
347
|
+
const defaultDecl = Parser.alt(Parser.preceded(lit("#REQUIRED"), Parser.succeed(Option.none())), Parser.preceded(lit("#IMPLIED"), Parser.succeed(Option.none())), Parser.preceded(Parser.opt(Parser.seq(lit("#FIXED"), requireWs)), Parser.map(attributeValue, Option.some)));
|
|
348
|
+
const notation = Parser.make((state) => x.attributeType === "NOTATION" ? void 0 : state.backtrack("Verify", ["NOTATION"]));
|
|
349
|
+
const attributeDef = Parser.seq(Parser.tap(xmlName, (n) => {
|
|
350
|
+
x.attributeName = n;
|
|
351
|
+
x.tokenized = true;
|
|
352
|
+
}), requireWs, Parser.alt(Parser.preceded(at("("), skipParens), Parser.seq(checked(xmlName, (type, pos) => {
|
|
353
|
+
x.attributeType = type;
|
|
354
|
+
if (type === "CDATA") x.tokenized = false;
|
|
355
|
+
else if (type !== "NOTATION" && !HashSet.has(TOKENIZED_TYPES, type)) fail(`Unknown attribute type "${type}"`, pos);
|
|
356
|
+
}), Parser.opt(Parser.preceded(notation, Parser.seq(requireWs, skipParens))))), requireWs, defaultDecl).pipe(Parser.tap(([, , , , defaultValue]) => {
|
|
357
|
+
const { types, defaults } = x.attributeList;
|
|
358
|
+
const attribute = x.attributeName;
|
|
359
|
+
if (MutableHashMap.has(types, attribute)) return;
|
|
360
|
+
const tokenized = x.tokenized;
|
|
361
|
+
MutableHashMap.set(types, attribute, tokenized);
|
|
362
|
+
if (Option.isSome(defaultValue)) {
|
|
363
|
+
const value = defaultValue.value;
|
|
364
|
+
defaults.push({
|
|
365
|
+
name: attribute,
|
|
366
|
+
value: tokenized ? collapse(value) : value,
|
|
367
|
+
tokenized
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}));
|
|
371
|
+
const attlistDecl = Parser.preceded(Parser.seq(lit("<!ATTLIST"), requireWs), Parser.seq(Parser.tap(xmlName, (element) => {
|
|
372
|
+
const known = MutableHashMap.get(x.attributeLists, element);
|
|
373
|
+
if (Option.isSome(known)) x.attributeList = known.value;
|
|
374
|
+
else {
|
|
375
|
+
const list = {
|
|
376
|
+
types: MutableHashMap.empty(),
|
|
377
|
+
defaults: []
|
|
378
|
+
};
|
|
379
|
+
MutableHashMap.set(x.attributeLists, element, list);
|
|
380
|
+
x.attributeList = list;
|
|
381
|
+
}
|
|
382
|
+
}), Parser.repeat(Parser.preceded(Parser.seq(ws, Parser.not(lit(">")), afterWs), attributeDef)), ws, lit(">")));
|
|
383
|
+
const entityDecl = Parser.preceded(Parser.seq(lit("<!ENTITY"), requireWs), Parser.seq(Parser.alt(Parser.preceded(Parser.seq(lit("%"), requireWs), Parser.succeed(true)), Parser.succeed(false)), checked(xmlName, (n, pos) => {
|
|
384
|
+
if (n.includes(":")) fail("Entity names cannot contain \":\"", pos);
|
|
385
|
+
}), requireWs, Parser.alt(Parser.preceded(Parser.peek(Token.oneOf("\"'")), Parser.seq(Parser.location, quoted).pipe(Parser.map(([quote, raw]) => {
|
|
386
|
+
if (raw.includes("%")) fail("Parameter entity references are not supported", quote + 1);
|
|
387
|
+
return Option.some(expandCharRefs(raw, quote + 1));
|
|
388
|
+
}))), Parser.preceded(externalId, Parser.opt(Parser.preceded(Parser.seq(Token.takeWhile(space, { min: 1 }), lit("NDATA")), Parser.seq(requireWs, xmlName)))).pipe(Parser.as(Option.none()))), ws, expect(">"))).pipe(Parser.tap(([parameter, entity, , value]) => {
|
|
389
|
+
if (parameter) return;
|
|
390
|
+
if (MutableHashMap.has(x.entities, entity) || MutableHashSet.has(x.externalEntities, entity)) return;
|
|
391
|
+
if (Option.isSome(value)) MutableHashMap.set(x.entities, entity, value.value);
|
|
392
|
+
else MutableHashSet.add(x.externalEntities, entity);
|
|
393
|
+
}));
|
|
394
|
+
/** `<!ELEMENT …>` and `<!NOTATION …>`, skipped. */
|
|
395
|
+
const skippedDecl = Parser.seq(Parser.repeat(Parser.alt(Parser.preceded(Parser.peek(Token.oneOf("\"'")), quoted), Token.takeTill(">\"'", { min: 1 }))), Parser.alt(lit(">"), failHere("Unterminated markup declaration")));
|
|
396
|
+
const internalSubset = Parser.terminated(Parser.repeat(Parser.preceded(Parser.seq(ws, Parser.not(lit("]"))), Parser.alt(Parser.preceded(Parser.eof, failHere("Unterminated internal subset")), Parser.preceded(at("<!ENTITY"), entityDecl), Parser.preceded(at("<!ATTLIST"), attlistDecl), Parser.preceded(Parser.alt(at("<!ELEMENT"), at("<!NOTATION")), skippedDecl), Parser.preceded(at("<!--"), comment), Parser.preceded(at("<?"), pi), Parser.preceded(at("%"), failHere("Parameter entity references are not supported")), failHere("Invalid markup in the internal subset")))), Parser.seq(ws, lit("]")));
|
|
397
|
+
const doctype = Parser.seq(Parser.preceded(Parser.seq(lit("<!DOCTYPE"), requireWs), xmlName), Parser.alt(Parser.preceded(Parser.seq(ws, Parser.peek(Parser.alt(lit("SYSTEM"), lit("PUBLIC"))), afterWs), Parser.terminated(externalId, ws)).pipe(Parser.tap(() => {
|
|
398
|
+
x.hasExternalSubset = true;
|
|
399
|
+
})), Parser.preceded(ws, Parser.succeed([Option.none(), Option.none()]))), Parser.opt(Parser.preceded(lit("["), Parser.terminated(internalSubset, ws))), expect(">")).pipe(Parser.tap(([doctypeName, [publicId, systemId]]) => {
|
|
400
|
+
x.doctype = Option.some({
|
|
401
|
+
name: doctypeName,
|
|
402
|
+
publicId: Option.getOrUndefined(publicId),
|
|
403
|
+
systemId: Option.getOrUndefined(systemId),
|
|
404
|
+
entities: new Map(x.entities)
|
|
405
|
+
});
|
|
406
|
+
}));
|
|
407
|
+
const pushText = (frame, s, offset) => {
|
|
408
|
+
if (s === "") return;
|
|
409
|
+
if (frame.textStart === -1) frame.textStart = offset;
|
|
410
|
+
frame.text += s;
|
|
411
|
+
};
|
|
412
|
+
const isText = Predicate.isTagged("Text");
|
|
413
|
+
const flush = (frame) => {
|
|
414
|
+
if (frame.text !== "") {
|
|
415
|
+
const children = frame.children;
|
|
416
|
+
const prev = frame.endsWithText && children.length > frame.floor ? children.at(-1) : void 0;
|
|
417
|
+
if (isText(prev)) children[children.length - 1] = {
|
|
418
|
+
...prev,
|
|
419
|
+
value: prev.value + frame.text
|
|
420
|
+
};
|
|
421
|
+
else {
|
|
422
|
+
children.push({
|
|
423
|
+
_tag: "Text",
|
|
424
|
+
value: frame.text,
|
|
425
|
+
position: x.position(frame.textStart)
|
|
426
|
+
});
|
|
427
|
+
frame.endsWithText = true;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
frame.text = "";
|
|
431
|
+
frame.textStart = -1;
|
|
432
|
+
};
|
|
433
|
+
/** Adds a child that is not text to `frame`, after its text. */
|
|
434
|
+
const pushChild = (frame, node) => {
|
|
435
|
+
flush(frame);
|
|
436
|
+
frame.children.push(node);
|
|
437
|
+
frame.endsWithText = false;
|
|
438
|
+
};
|
|
439
|
+
/** A child that is not text. */
|
|
440
|
+
const pushNode = (node) => {
|
|
441
|
+
pushChild(x.top(), node);
|
|
442
|
+
};
|
|
443
|
+
/**
|
|
444
|
+
* The prefix (`''` if none) and local part of a valid qualified name. The
|
|
445
|
+
* names of a document repeat, so each is checked and split once, and its
|
|
446
|
+
* parts are the same strings each time.
|
|
447
|
+
*/
|
|
448
|
+
const splitName = (qname, offset) => {
|
|
449
|
+
const i = qname.indexOf(":");
|
|
450
|
+
if (i === -1) {
|
|
451
|
+
if (!isNCName$1(qname)) fail(`Invalid name "${qname}"`, offset);
|
|
452
|
+
return ["", qname];
|
|
453
|
+
}
|
|
454
|
+
const prefix = qname.slice(0, i);
|
|
455
|
+
const local = qname.slice(i + 1);
|
|
456
|
+
if (!isNCName$1(prefix) || !isNCName$1(local)) fail(`Invalid qualified name "${qname}"`, offset);
|
|
457
|
+
if (prefix === "xmlns") fail("Elements and attributes cannot use the \"xmlns\" prefix", offset);
|
|
458
|
+
return [prefix, local];
|
|
459
|
+
};
|
|
460
|
+
const nameParts = (qname, offset) => {
|
|
461
|
+
const known = MutableHashMap.get(x.qnames, qname);
|
|
462
|
+
if (Option.isSome(known)) return known.value;
|
|
463
|
+
const parts = splitName(qname, offset);
|
|
464
|
+
MutableHashMap.set(x.qnames, qname, parts);
|
|
465
|
+
return parts;
|
|
466
|
+
};
|
|
467
|
+
const XML_NAMESPACE_OPTION = Option.some(XML_NAMESPACE$1);
|
|
468
|
+
/** The namespace of a name with `prefix` (an element's default namespace if `''`). */
|
|
469
|
+
const namespaceOf = (prefix, ns, isElement, offset) => {
|
|
470
|
+
if (prefix === "") return isElement ? Option.fromUndefinedOr(ns.get("")) : Option.none();
|
|
471
|
+
if (prefix === "xml") return XML_NAMESPACE_OPTION;
|
|
472
|
+
const uri = ns.get(prefix);
|
|
473
|
+
if (uri === void 0) fail(`Unbound namespace prefix "${prefix}"`, offset);
|
|
474
|
+
return Option.some(uri);
|
|
475
|
+
};
|
|
476
|
+
/** The namespace prefix an `xmlns` / `xmlns:…` attribute declares, or none for any other attribute. */
|
|
477
|
+
const declaredPrefix = (attribute) => attribute === "xmlns" ? Option.some("") : attribute.startsWith("xmlns:") ? Option.some(attribute.slice(6)) : Option.none();
|
|
478
|
+
const isDeclaration = (attribute) => attribute === "xmlns" || attribute.startsWith("xmlns:");
|
|
479
|
+
/** The namespaces in scope of an element that makes `declarations` (which are not empty). */
|
|
480
|
+
const declare = (parentNs, declarations) => {
|
|
481
|
+
const own = new Map(parentNs);
|
|
482
|
+
declarations.forEach((d) => {
|
|
483
|
+
if (d.namespace === "") own.delete("");
|
|
484
|
+
else own.set(d.prefix, d.namespace);
|
|
485
|
+
});
|
|
486
|
+
return own;
|
|
487
|
+
};
|
|
488
|
+
/** Checks a namespace declaration, which declares `prefix` to be `uri`. */
|
|
489
|
+
const checkDeclaration = (prefix, uri, offset) => {
|
|
490
|
+
if (prefix !== "" && !isNCName$1(prefix)) fail("Invalid namespace prefix", offset);
|
|
491
|
+
if (prefix === "xmlns") fail("The \"xmlns\" prefix cannot be declared", offset);
|
|
492
|
+
if (prefix === "xml" && uri !== XML_NAMESPACE$1) fail("The \"xml\" prefix cannot be rebound", offset);
|
|
493
|
+
if (prefix !== "xml" && uri === XML_NAMESPACE$1) fail("The XML namespace cannot be bound to another prefix", offset);
|
|
494
|
+
if (uri === XMLNS_NAMESPACE$1) fail("The xmlns namespace cannot be declared", offset);
|
|
495
|
+
if (prefix !== "" && uri === "") fail("Prefixed namespace declarations cannot be empty", offset);
|
|
496
|
+
};
|
|
497
|
+
/** Opens the element whose start tag was just read (closing it too if it was empty). */
|
|
498
|
+
const openElement = (empty) => {
|
|
499
|
+
const start = x.tagStart;
|
|
500
|
+
const qname = x.qname;
|
|
501
|
+
const raw = x.raw;
|
|
502
|
+
if (!MutableHashMap.isEmpty(x.attributeLists)) {
|
|
503
|
+
const list = MutableHashMap.get(x.attributeLists, qname);
|
|
504
|
+
if (Option.isSome(list)) {
|
|
505
|
+
const { types, defaults } = list.value;
|
|
506
|
+
raw.forEach((a) => {
|
|
507
|
+
if (Option.getOrElse(MutableHashMap.get(types, a.name), constFalse)) a.value = collapse(a.value);
|
|
508
|
+
});
|
|
509
|
+
defaults.forEach((d) => {
|
|
510
|
+
if (!x.hasAttribute(d.name)) raw.push({
|
|
511
|
+
name: d.name,
|
|
512
|
+
value: d.value,
|
|
513
|
+
offset: start,
|
|
514
|
+
defaulted: true
|
|
515
|
+
});
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
const parent = x.top();
|
|
520
|
+
const parentNs = parent.inScope;
|
|
521
|
+
const declarations = [];
|
|
522
|
+
raw.forEach((a) => {
|
|
523
|
+
const declared = declaredPrefix(a.name);
|
|
524
|
+
if (Option.isNone(declared)) return;
|
|
525
|
+
const prefix = declared.value;
|
|
526
|
+
checkDeclaration(prefix, a.value, a.offset);
|
|
527
|
+
if (prefix !== "xml") declarations.push({
|
|
528
|
+
prefix,
|
|
529
|
+
namespace: a.value
|
|
530
|
+
});
|
|
531
|
+
});
|
|
532
|
+
const inScope = Arr.isArrayNonEmpty(declarations) ? declare(parentNs, declarations) : parentNs;
|
|
533
|
+
const [prefix, localName] = nameParts(qname, start + 1);
|
|
534
|
+
const namespace = namespaceOf(prefix, inScope, true, start + 1);
|
|
535
|
+
const attributes = [];
|
|
536
|
+
const large = raw.length >= SMALL;
|
|
537
|
+
const expanded = large ? MutableHashSet.empty() : UNUSED;
|
|
538
|
+
raw.forEach((a) => {
|
|
539
|
+
if (isDeclaration(a.name)) return;
|
|
540
|
+
const [ap, al] = nameParts(a.name, a.offset);
|
|
541
|
+
const ans = Option.getOrUndefined(namespaceOf(ap, inScope, false, a.offset));
|
|
542
|
+
const key = `${ans ?? ""} ${al}`;
|
|
543
|
+
if (large ? MutableHashSet.has(expanded, key) : attributes.some((b) => b.localName === al && b.namespace === ans)) fail(`Duplicate attribute "{${ans ?? ""}}${al}"`, a.offset);
|
|
544
|
+
if (large) MutableHashSet.add(expanded, key);
|
|
545
|
+
attributes.push({
|
|
546
|
+
_tag: "Attribute",
|
|
547
|
+
name: a.name,
|
|
548
|
+
prefix: ap,
|
|
549
|
+
localName: al,
|
|
550
|
+
namespace: ans,
|
|
551
|
+
value: a.value,
|
|
552
|
+
defaulted: a.defaulted,
|
|
553
|
+
position: x.position(a.offset)
|
|
554
|
+
});
|
|
555
|
+
});
|
|
556
|
+
flush(parent);
|
|
557
|
+
const frame = {
|
|
558
|
+
qname,
|
|
559
|
+
position: x.position(start),
|
|
560
|
+
prefix,
|
|
561
|
+
localName,
|
|
562
|
+
namespace,
|
|
563
|
+
attributes,
|
|
564
|
+
declarations,
|
|
565
|
+
inScope,
|
|
566
|
+
children: [],
|
|
567
|
+
text: "",
|
|
568
|
+
textStart: -1,
|
|
569
|
+
endsWithText: false,
|
|
570
|
+
floor: 0
|
|
571
|
+
};
|
|
572
|
+
if (empty) {
|
|
573
|
+
closeElement(frame);
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (x.stack.length - x.base >= 1024) fail("Elements are nested too deeply", start);
|
|
577
|
+
x.stack.push(frame);
|
|
578
|
+
};
|
|
579
|
+
/** The element an open frame stands for (with the children it has so far). */
|
|
580
|
+
const elementOf = (frame) => ({
|
|
581
|
+
_tag: "Element",
|
|
582
|
+
name: frame.qname,
|
|
583
|
+
prefix: frame.prefix,
|
|
584
|
+
localName: frame.localName,
|
|
585
|
+
namespace: Option.getOrUndefined(frame.namespace),
|
|
586
|
+
attributes: frame.attributes,
|
|
587
|
+
namespaceDeclarations: frame.declarations,
|
|
588
|
+
inScopeNamespaces: frame.inScope,
|
|
589
|
+
children: frame.children,
|
|
590
|
+
position: frame.position
|
|
591
|
+
});
|
|
592
|
+
/** Adds a finished element to its parent. */
|
|
593
|
+
const closeElement = (frame) => {
|
|
594
|
+
flush(frame);
|
|
595
|
+
const element = elementOf(frame);
|
|
596
|
+
const inDocument = HashSet.isEmpty(x.entityStack);
|
|
597
|
+
if (x.stack.length === 1 && inDocument) {
|
|
598
|
+
x.root = Option.some(element);
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
if (x.stack.length === 2 && inDocument && x.onRootChild(element, elementOf(x.top()))) {
|
|
602
|
+
const root = x.top();
|
|
603
|
+
root.floor = root.children.length;
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
pushChild(x.top(), element);
|
|
607
|
+
};
|
|
608
|
+
const attribute = Parser.seq(Parser.location, xmlName, eq, attributeValue).pipe(Parser.tap(([offset, attributeName, , value]) => {
|
|
609
|
+
if (x.hasAttribute(attributeName)) fail(`Duplicate attribute "${attributeName}"`, offset);
|
|
610
|
+
x.raw.push({
|
|
611
|
+
name: attributeName,
|
|
612
|
+
value,
|
|
613
|
+
offset,
|
|
614
|
+
defaulted: false
|
|
615
|
+
});
|
|
616
|
+
}));
|
|
617
|
+
const startTag = Parser.seq(Parser.tap(Parser.seq(Parser.location, Parser.preceded(lit("<"), xmlName)), ([start, qname]) => {
|
|
618
|
+
x.tagStart = start;
|
|
619
|
+
x.qname = qname;
|
|
620
|
+
x.raw = [];
|
|
621
|
+
}), Parser.repeat(Parser.preceded(Parser.seq(ws, Parser.not(Parser.alt(lit(">"), lit("/>")))), Parser.preceded(Parser.make((state) => {
|
|
622
|
+
const c = state.input.charCodeAt(state.pos - 1);
|
|
623
|
+
if (c !== 32 && c !== 9 && c !== 10 && c !== 13) fail("Expected white space between attributes", state.pos);
|
|
624
|
+
}), attribute))), Parser.preceded(ws, Parser.alt(Parser.tap(lit("/>"), () => openElement(true)), Parser.tap(lit(">"), () => openElement(false)))));
|
|
625
|
+
const endTag = Parser.seq(Parser.seq(act((offset) => {
|
|
626
|
+
if (x.stack.length === x.base) fail("Unbalanced end tag in entity replacement text", offset);
|
|
627
|
+
}), Parser.preceded(lit("</"), xmlName)).pipe(Parser.tap(([offset, endName]) => {
|
|
628
|
+
const frame = x.top();
|
|
629
|
+
if (endName !== frame.qname) fail(`Mismatched end tag: expected </${frame.qname}> but found </${endName}>`, offset);
|
|
630
|
+
})), ws, expect(">")).pipe(Parser.tap(() => {
|
|
631
|
+
const frame = x.top();
|
|
632
|
+
x.stack.pop();
|
|
633
|
+
closeElement(frame);
|
|
634
|
+
}));
|
|
635
|
+
const cdata = Parser.seq(Parser.location, Parser.preceded(lit("<![CDATA["), Parser.opt(Parser.terminated(Token.takeUntil("]]>"), lit("]]>"))))).pipe(Parser.tap(([start, text]) => {
|
|
636
|
+
pushText(x.top(), Option.getOrElse(text, () => fail("Unterminated CDATA section", start)), start);
|
|
637
|
+
}));
|
|
638
|
+
const charData = Parser.seq(Parser.location, Token.takeTill("<&", { min: 1 })).pipe(Parser.tap(([start, text]) => {
|
|
639
|
+
const bad = text.indexOf("]]>");
|
|
640
|
+
if (bad !== -1) fail("\"]]>\" is not allowed in character data", start + bad);
|
|
641
|
+
pushText(x.top(), text, start);
|
|
642
|
+
}));
|
|
643
|
+
/** The content an entity's replacement text adds (parsed interpreted: it may nest). */
|
|
644
|
+
const entityContent = Parser.suspend(() => Parser.terminated(Parser.repeat(Parser.preceded(Parser.not(Parser.eof), contentItem)), act((pos) => {
|
|
645
|
+
if (x.stack.length > x.base) fail("Unexpected end of input: unclosed element", pos);
|
|
646
|
+
})));
|
|
647
|
+
/** Parses the replacement text of an entity that contains markup. */
|
|
648
|
+
const replacementNodes = (body, replacement, start) => {
|
|
649
|
+
const { src, lineStarts, stack, base, entityStack } = x;
|
|
650
|
+
const frame = baseFrame(x.top().inScope);
|
|
651
|
+
x.src = replacement;
|
|
652
|
+
x.lineStarts = [0];
|
|
653
|
+
x.stack = [frame];
|
|
654
|
+
x.base = 1;
|
|
655
|
+
x.entityStack = HashSet.add(entityStack, body);
|
|
656
|
+
const outcome = Result.try({
|
|
657
|
+
try: () => {
|
|
658
|
+
const result = Parser.parse(entityContent, replacement);
|
|
659
|
+
if (Result.isFailure(result)) fail("Invalid markup", result.failure.offset);
|
|
660
|
+
flush(frame);
|
|
661
|
+
return frame.children;
|
|
662
|
+
},
|
|
663
|
+
catch: (e) => e
|
|
664
|
+
});
|
|
665
|
+
x.src = src;
|
|
666
|
+
x.lineStarts = lineStarts;
|
|
667
|
+
x.stack = stack;
|
|
668
|
+
x.base = base;
|
|
669
|
+
x.entityStack = entityStack;
|
|
670
|
+
if (Result.isSuccess(outcome)) return outcome.success;
|
|
671
|
+
if (outcome.failure instanceof Failure) fail(`In entity "${body}": ${outcome.failure.message}`, start);
|
|
672
|
+
throw outcome.failure;
|
|
673
|
+
};
|
|
674
|
+
const reference = Parser.seq(Parser.location, Parser.preceded(lit("&"), Token.takeTill(";")), Parser.opt(lit(";"))).pipe(Parser.tap(([start, body, semi]) => {
|
|
675
|
+
if (Option.isNone(semi)) fail("Unterminated reference", start);
|
|
676
|
+
const frame = x.top();
|
|
677
|
+
if (body.startsWith("#")) {
|
|
678
|
+
if (!CHAR_REF_RE.test(body)) fail("Invalid character reference", start);
|
|
679
|
+
pushText(frame, charRef(body, start), start);
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
const builtIn = predefined(body);
|
|
683
|
+
if (builtIn !== "") {
|
|
684
|
+
pushText(frame, builtIn, start);
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
const replacement = entityText(body, start, x.entityStack);
|
|
688
|
+
if (!replacement.includes("<") && !replacement.includes("&")) {
|
|
689
|
+
pushText(frame, replacement, start);
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
flush(frame);
|
|
693
|
+
const position = x.position(start);
|
|
694
|
+
replacementNodes(body, replacement, start).forEach((n) => {
|
|
695
|
+
if (isText(n)) pushText(frame, n.value, start);
|
|
696
|
+
else pushChild(frame, {
|
|
697
|
+
...n,
|
|
698
|
+
position
|
|
699
|
+
});
|
|
700
|
+
});
|
|
701
|
+
}));
|
|
702
|
+
const contentItem = Parser.alt(Parser.preceded(at("</"), endTag), Parser.preceded(at("<!--"), Parser.tap(comment, pushNode)), Parser.preceded(at("<![CDATA["), cdata), Parser.preceded(at("<?"), Parser.tap(pi, pushNode)), Parser.preceded(at("<!"), failHere("Unexpected markup declaration in content")), Parser.preceded(at("<"), startTag), Parser.preceded(at("&"), reference), charData);
|
|
703
|
+
/** The root element: its start tag, then content until it is closed. */
|
|
704
|
+
const rootElement = Parser.asVoid(Parser.seq(startTag, Parser.repeat(Parser.preceded(Parser.make((state) => x.stack.length > x.base ? void 0 : state.backtrack("Verify", ["content"])), Parser.alt(Parser.preceded(Parser.eof, failHere("Unexpected end of input: unclosed element")), contentItem)))));
|
|
705
|
+
const xmlDecl = Parser.preceded(Parser.seq(lit("<?xml"), Parser.peek(Token.oneOf(space))), Parser.seq(requireWs, expect("version"), eq, checked(quoted, (version, pos) => {
|
|
706
|
+
if (!/^1\.[0-9]+$/.test(version)) fail(`Unsupported XML version "${version}"`, pos);
|
|
707
|
+
x.version = Option.some(version);
|
|
708
|
+
}), ws, Parser.opt(Parser.preceded(Parser.seq(at("encoding"), afterWs, lit("encoding"), eq), Parser.terminated(checked(quoted, (encoding, pos) => {
|
|
709
|
+
if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(encoding)) fail("Invalid encoding name", pos);
|
|
710
|
+
x.encoding = Option.some(encoding);
|
|
711
|
+
}), ws))), Parser.opt(Parser.preceded(Parser.seq(at("standalone"), afterWs, lit("standalone"), eq), Parser.terminated(checked(quoted, (sd, pos) => {
|
|
712
|
+
if (sd !== "yes" && sd !== "no") fail("standalone must be \"yes\" or \"no\"", pos);
|
|
713
|
+
x.standalone = Option.some(sd === "yes");
|
|
714
|
+
}), ws))), expect("?>")));
|
|
715
|
+
const prologOrEpilog = (node) => {
|
|
716
|
+
(Option.isNone(x.root) ? x.prolog : x.epilog).push(node);
|
|
717
|
+
};
|
|
718
|
+
const document = Compiler.jit(Parser.asVoid(Parser.seq(Parser.opt(xmlDecl), Parser.repeat(Parser.preceded(Parser.not(Parser.eof), Parser.alt(Token.takeWhile(space, { min: 1 }), Parser.preceded(at("<!--"), Parser.tap(comment, prologOrEpilog)), Parser.preceded(at("<?"), Parser.tap(pi, prologOrEpilog)), Parser.preceded(at("<!DOCTYPE"), Parser.preceded(act((pos) => {
|
|
719
|
+
if (Option.isSome(x.doctype) || Option.isSome(x.root)) fail("Unexpected DOCTYPE", pos);
|
|
720
|
+
}), doctype)), Parser.preceded(at("<"), Parser.preceded(act((pos) => {
|
|
721
|
+
if (Option.isSome(x.root)) fail("Only one root element is allowed", pos);
|
|
722
|
+
}), rootElement)), act((pos) => fail(Option.isNone(x.root) ? "Expected the root element" : "Content after the root element", pos))))), act((pos) => {
|
|
723
|
+
if (Option.isNone(x.root)) fail("No root element", pos);
|
|
724
|
+
}))));
|
|
725
|
+
/** Parses a (line-end normalised) document, throwing a `Failure`. */
|
|
726
|
+
const parse$1 = (text, lineStarts, onRootChild) => {
|
|
727
|
+
x = new Context(text, lineStarts);
|
|
728
|
+
x.onRootChild = onRootChild;
|
|
729
|
+
const result = Parser.parse(document, text);
|
|
730
|
+
if (Result.isFailure(result)) fail("Invalid XML", result.failure.offset);
|
|
731
|
+
return {
|
|
732
|
+
_tag: "Document",
|
|
733
|
+
version: Option.getOrUndefined(x.version),
|
|
734
|
+
encoding: Option.getOrUndefined(x.encoding),
|
|
735
|
+
standalone: Option.getOrUndefined(x.standalone),
|
|
736
|
+
doctype: Option.getOrUndefined(x.doctype),
|
|
737
|
+
prolog: x.prolog,
|
|
738
|
+
root: Option.getOrElse(x.root, () => fail("No root element", text.length)),
|
|
739
|
+
epilog: x.epilog
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
/** The line and column of an offset, given the offsets at which lines start. */
|
|
743
|
+
const positionAt = (lineStarts, offset) => {
|
|
744
|
+
const lo = lineIndex(lineStarts, offset, 0, lineStarts.length - 1);
|
|
745
|
+
return {
|
|
746
|
+
offset,
|
|
747
|
+
line: lo + 1,
|
|
748
|
+
column: offset - (lineStarts[lo] ?? 0) + 1
|
|
749
|
+
};
|
|
750
|
+
};
|
|
751
|
+
const lineStartsOf = (text) => {
|
|
752
|
+
const starts = [0];
|
|
753
|
+
let i = text.indexOf("\n");
|
|
754
|
+
loop(() => {
|
|
755
|
+
if (i === -1) return false;
|
|
756
|
+
starts.push(i + 1);
|
|
757
|
+
i = text.indexOf("\n", i + 1);
|
|
758
|
+
return true;
|
|
759
|
+
});
|
|
760
|
+
return starts;
|
|
761
|
+
};
|
|
762
|
+
/** @internal */
|
|
763
|
+
const normalizeInput$1 = (input) => {
|
|
764
|
+
const noBom = input.charCodeAt(0) === 65279 ? input.slice(1) : input;
|
|
765
|
+
return noBom.includes("\r") ? noBom.replace(/\r\n?/g, "\n") : noBom;
|
|
766
|
+
};
|
|
767
|
+
/**
|
|
768
|
+
* Parses a document (normalising its line ends first), throwing a `Failure`
|
|
769
|
+
* with its position. `onRootChild` may take the root's children as they are
|
|
770
|
+
* read.
|
|
771
|
+
*
|
|
772
|
+
* @internal
|
|
773
|
+
*/
|
|
774
|
+
const parseText = (input, onRootChild = keepChild) => {
|
|
775
|
+
const text = normalizeInput$1(input);
|
|
776
|
+
const lineStarts = lineStartsOf(text);
|
|
777
|
+
const outcome = Result.try({
|
|
778
|
+
try: () => {
|
|
779
|
+
const bad = INVALID_CHAR_RE.exec(text);
|
|
780
|
+
if (bad !== null) fail("Invalid XML character", bad.index);
|
|
781
|
+
return parse$1(text, lineStarts, onRootChild);
|
|
782
|
+
},
|
|
783
|
+
catch: (e) => e
|
|
784
|
+
});
|
|
785
|
+
if (Result.isSuccess(outcome)) return outcome.success;
|
|
786
|
+
const e = outcome.failure;
|
|
787
|
+
if (e instanceof Failure) e.position = positionAt(lineStarts, Math.min(e.offset, text.length));
|
|
788
|
+
throw e;
|
|
789
|
+
};
|
|
790
|
+
// src/rdfxml/Xml.ts
|
|
791
|
+
/**
|
|
792
|
+
* A small, namespace-aware, non-validating XML 1.0 parser producing an
|
|
793
|
+
* immutable document tree, plus Exclusive XML Canonicalization (with
|
|
794
|
+
* comments) of element content.
|
|
795
|
+
*
|
|
796
|
+
* Supported: the XML declaration, a document type declaration whose internal
|
|
797
|
+
* subset may declare general entities and attribute defaults, elements,
|
|
798
|
+
* attributes (with attribute-value normalisation), Namespaces in XML 1.0,
|
|
799
|
+
* CDATA sections, comments, processing instructions, and character and
|
|
800
|
+
* entity references. External entities and parameter entities are not
|
|
801
|
+
* loaded (they are reported as errors when referenced).
|
|
802
|
+
*
|
|
803
|
+
* The parser is a compiled `@thomasfosterau/effect-parse` grammar; it is
|
|
804
|
+
* pure and synchronous internally, and the public `parse` API returns an
|
|
805
|
+
* `Effect` failing with `XmlParseError`. It is safe on hostile input:
|
|
806
|
+
* entity replacement text may add at most 1,000,000 characters to a
|
|
807
|
+
* document, entity references nest at most 64 deep and elements at most
|
|
808
|
+
* 1,024 deep, and the time it takes grows with the text it expands.
|
|
809
|
+
*
|
|
810
|
+
* @since 0.1.0
|
|
811
|
+
*/
|
|
812
|
+
var Xml_exports = /* @__PURE__ */ __exportAll({
|
|
813
|
+
NAME_CHAR: () => NAME_CHAR,
|
|
814
|
+
NAME_START: () => NAME_START,
|
|
815
|
+
XMLNS_NAMESPACE: () => XMLNS_NAMESPACE,
|
|
816
|
+
XML_NAMESPACE: () => XML_NAMESPACE,
|
|
817
|
+
XmlParseError: () => XmlParseError,
|
|
818
|
+
canonicalize: () => canonicalize,
|
|
819
|
+
escapeAttribute: () => escapeAttribute,
|
|
820
|
+
escapeText: () => escapeText,
|
|
821
|
+
isNCName: () => isNCName,
|
|
822
|
+
isName: () => isName,
|
|
823
|
+
isValidText: () => isValidText,
|
|
824
|
+
isWhitespace: () => isWhitespace,
|
|
825
|
+
normalizeInput: () => normalizeInput,
|
|
826
|
+
parse: () => parse,
|
|
827
|
+
parseResult: () => parseResult
|
|
828
|
+
});
|
|
829
|
+
/**
|
|
830
|
+
* The XML namespace, bound to the `xml` prefix.
|
|
831
|
+
*
|
|
832
|
+
* @since 0.1.0
|
|
833
|
+
* @category constants
|
|
834
|
+
*/
|
|
835
|
+
const XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
|
|
836
|
+
/**
|
|
837
|
+
* The namespace of namespace declarations (`xmlns`).
|
|
838
|
+
*
|
|
839
|
+
* @since 0.1.0
|
|
840
|
+
* @category constants
|
|
841
|
+
*/
|
|
842
|
+
const XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
|
|
843
|
+
/**
|
|
844
|
+
* A well-formedness or namespace error.
|
|
845
|
+
*
|
|
846
|
+
* @since 0.1.0
|
|
847
|
+
* @category errors
|
|
848
|
+
*/
|
|
849
|
+
var XmlParseError = class extends Schema.TaggedError()("XmlParseError", {
|
|
850
|
+
message: Schema.String,
|
|
851
|
+
offset: Schema.Number,
|
|
852
|
+
line: Schema.Number,
|
|
853
|
+
column: Schema.Number
|
|
854
|
+
}) {};
|
|
855
|
+
/**
|
|
856
|
+
* The XML `NameStartChar` production as a regular expression character
|
|
857
|
+
* class body (without brackets), excluding `:`. Requires the `u` flag.
|
|
858
|
+
*
|
|
859
|
+
* @since 0.1.0
|
|
860
|
+
* @category constants
|
|
861
|
+
*/
|
|
862
|
+
const NAME_START = NAME_START$1;
|
|
863
|
+
/**
|
|
864
|
+
* The XML `NameChar` production as a regular expression character class
|
|
865
|
+
* body (without brackets), excluding `:`. Requires the `u` flag.
|
|
866
|
+
*
|
|
867
|
+
* @since 0.1.0
|
|
868
|
+
* @category constants
|
|
869
|
+
*/
|
|
870
|
+
const NAME_CHAR = NAME_CHAR$1;
|
|
871
|
+
/**
|
|
872
|
+
* Whether a string is an XML `NCName` (a name without colons), as required
|
|
873
|
+
* for namespace prefixes, local names, `rdf:ID` and `rdf:nodeID`.
|
|
874
|
+
*
|
|
875
|
+
* @since 0.1.0
|
|
876
|
+
* @category predicates
|
|
877
|
+
*/
|
|
878
|
+
const isNCName = isNCName$1;
|
|
879
|
+
/**
|
|
880
|
+
* Whether a string is an XML `Name`.
|
|
881
|
+
*
|
|
882
|
+
* @since 0.1.0
|
|
883
|
+
* @category predicates
|
|
884
|
+
*/
|
|
885
|
+
const isName = isName$1;
|
|
886
|
+
/**
|
|
887
|
+
* Whether a string consists only of characters allowed in XML 1.0 documents.
|
|
888
|
+
*
|
|
889
|
+
* @since 0.1.0
|
|
890
|
+
* @category predicates
|
|
891
|
+
*/
|
|
892
|
+
const isValidText = isValidText$1;
|
|
893
|
+
const WHITESPACE = /^[ \t\r\n]*$/;
|
|
894
|
+
/**
|
|
895
|
+
* Whether a string consists only of XML white space (`S`).
|
|
896
|
+
*
|
|
897
|
+
* @since 0.1.0
|
|
898
|
+
* @category predicates
|
|
899
|
+
*/
|
|
900
|
+
const isWhitespace = (value) => WHITESPACE.test(value);
|
|
901
|
+
/**
|
|
902
|
+
* Normalises line ends (`\r\n` and `\r` become `\n`) and strips a leading
|
|
903
|
+
* byte order mark, as an XML processor does before parsing.
|
|
904
|
+
*
|
|
905
|
+
* @since 0.1.0
|
|
906
|
+
* @category parsing
|
|
907
|
+
*/
|
|
908
|
+
const normalizeInput = normalizeInput$1;
|
|
909
|
+
/**
|
|
910
|
+
* Parses an XML document, returning a `Result`.
|
|
911
|
+
*
|
|
912
|
+
* @since 0.1.0
|
|
913
|
+
* @category parsing
|
|
914
|
+
*/
|
|
915
|
+
const parseResult = (input) => Result.try({
|
|
916
|
+
try: () => parseText(input),
|
|
917
|
+
catch: (e) => {
|
|
918
|
+
if (e instanceof Failure) return new XmlParseError({
|
|
919
|
+
message: e.message,
|
|
920
|
+
offset: e.position.offset,
|
|
921
|
+
line: e.position.line,
|
|
922
|
+
column: e.position.column
|
|
923
|
+
});
|
|
924
|
+
throw e;
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
/**
|
|
928
|
+
* Parses an XML document.
|
|
929
|
+
*
|
|
930
|
+
* @since 0.1.0
|
|
931
|
+
* @category parsing
|
|
932
|
+
*/
|
|
933
|
+
const parse = (input) => Effect.suspend(() => Effect.fromResult(parseResult(input)));
|
|
934
|
+
/**
|
|
935
|
+
* Escapes character data as in Canonical XML.
|
|
936
|
+
*
|
|
937
|
+
* @since 0.1.0
|
|
938
|
+
* @category canonicalization
|
|
939
|
+
*/
|
|
940
|
+
const escapeText = (value) => value.replace(/[&<>\r]/g, (c) => c === "&" ? "&" : c === "<" ? "<" : c === ">" ? ">" : "
");
|
|
941
|
+
/**
|
|
942
|
+
* Escapes an attribute value as in Canonical XML.
|
|
943
|
+
*
|
|
944
|
+
* @since 0.1.0
|
|
945
|
+
* @category canonicalization
|
|
946
|
+
*/
|
|
947
|
+
const escapeAttribute = (value) => value.replace(/[&<"\t\n\r]/g, (c) => c === "&" ? "&" : c === "<" ? "<" : c === "\"" ? """ : c === " " ? "	" : c === "\n" ? "
" : "
");
|
|
948
|
+
const compareStrings = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
949
|
+
/**
|
|
950
|
+
* Serialises a sequence of nodes (with all their descendants, but none of
|
|
951
|
+
* their ancestors) using Exclusive XML Canonicalization 1.0 with comments
|
|
952
|
+
* and an empty InclusiveNamespaces PrefixList. This is how RDF/XML computes
|
|
953
|
+
* the lexical form of `rdf:parseType="Literal"` content.
|
|
954
|
+
*
|
|
955
|
+
* @since 0.1.0
|
|
956
|
+
* @category canonicalization
|
|
957
|
+
*/
|
|
958
|
+
const canonicalize = (nodes) => nodes.map((n) => canonicalNode(n, HashMap.empty())).join("");
|
|
959
|
+
const byPrefix = Order.make((a, b) => compareStrings(a[0], b[0]));
|
|
960
|
+
const byExpandedName = Order.make((a, b) => compareStrings(a.namespace ?? "", b.namespace ?? "") || compareStrings(a.localName, b.localName));
|
|
961
|
+
/** The prefixes an element visibly utilises: its own, and those of its prefixed attributes. */
|
|
962
|
+
const utilizedPrefixes = (node) => Arr.dedupe(Arr.filter([node.prefix, ...node.attributes.map((a) => a.prefix).filter((p) => p !== "")], (p) => p !== "xml"));
|
|
963
|
+
const canonicalNode = Match.fn((node, _rendered) => node).pipe(Match.withReturnType(), Match.tag("Text", (node) => escapeText(node.value)), Match.tag("Comment", (node) => `<!--${node.value}-->`), Match.tag("ProcessingInstruction", (node) => node.data === "" ? `<?${node.target}?>` : `<?${node.target} ${node.data}?>`), Match.tag("Element", (node, _node, rendered) => {
|
|
964
|
+
const decls = Arr.sort(Arr.filterMap(utilizedPrefixes(node), (p) => {
|
|
965
|
+
const uri = node.inScopeNamespaces.get(p) ?? "";
|
|
966
|
+
return Option.getOrElse(HashMap.get(rendered, p), () => "") === uri ? Result.failVoid : Result.succeed([p, uri]);
|
|
967
|
+
}), byPrefix);
|
|
968
|
+
const next = decls.reduce((m, [p, uri]) => HashMap.set(m, p, uri), rendered);
|
|
969
|
+
const namespaces = decls.map(([p, uri]) => p === "" ? ` xmlns="${escapeAttribute(uri)}"` : ` xmlns:${p}="${escapeAttribute(uri)}"`).join("");
|
|
970
|
+
const attributes = Arr.sort(node.attributes, byExpandedName).map((a) => ` ${a.name}="${escapeAttribute(a.value)}"`).join("");
|
|
971
|
+
const children = node.children.map((c) => canonicalNode(c, next)).join("");
|
|
972
|
+
return `<${node.name}${namespaces}${attributes}>${children}</${node.name}>`;
|
|
973
|
+
}), Match.exhaustive);
|
|
974
|
+
export { Failure as _, XmlParseError as a, escapeAttribute as c, isName as d, isValidText as f, parseResult as g, parse as h, XML_NAMESPACE as i, escapeText as l, normalizeInput as m, NAME_START as n, Xml_exports as o, isWhitespace as p, XMLNS_NAMESPACE as r, canonicalize as s, NAME_CHAR as t, isNCName as u, parseText as v };
|
|
975
|
+
|
|
976
|
+
//# sourceMappingURL=Xml-B7iihYCS.mjs.map
|