@riboseinc/anafero-cli 0.0.65 → 0.0.67

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/build-site.mjs CHANGED
@@ -313648,12 +313648,48 @@ function getTextContent(graph, subject, partPredicate) {
313648
313648
  // ../anafero/search.mts
313649
313649
  init_cjs_shim();
313650
313650
  function preprocessStringForIndexing(text9) {
313651
- return text9.normalize("NFKD").replace(/\p{Diacritic}/gu, "").trim();
313651
+ return text9.normalize("NFKD").replace(/\p{Diacritic}/gu, "").replace(/[\p{P}$+<=>^`|~]/gu, " ").replace(/[\u200B-\u200D\uFEFF]/g, "").trim();
313652
313652
  }
313653
- function extractRelationsForIndexing(uri, graph, isDefinedSubject) {
313654
- return graph.filter(
313655
- ([s2, p3, o2]) => p3 === "hasPart" && (s2 === uri || s2 === ROOT_SUBJECT) && !o2.startsWith("data:") && (!isURIString(o2) || !isDefinedSubject(o2))
313653
+ function extractRelationsForIndexing(uri, graph, isIndexable, isAlreadyIndexed, _seen, _log) {
313654
+ const seen = _seen ?? /* @__PURE__ */ new Set();
313655
+ seen.add(uri);
313656
+ const nonData = graph.filter(
313657
+ ([, , o2]) => !o2.startsWith("data:")
313656
313658
  );
313659
+ const immediateGraph = nonData.filter(
313660
+ ([s2, ,]) => s2 === uri || s2 === ROOT_SUBJECT
313661
+ );
313662
+ const references = immediateGraph.filter(
313663
+ ([, , o2]) => isURIString(o2)
313664
+ );
313665
+ const indexable = immediateGraph.filter(
313666
+ ([s2, p3, o2]) => !isURIString(o2) && isIndexable([s2, p3, o2])
313667
+ ).map(([, , o2]) => o2).filter((o2) => o2.trim() !== "");
313668
+ for (const [, , o2] of references) {
313669
+ if (_log) {
313670
+ console.debug(
313671
+ "search: processing triple object",
313672
+ { o: o2, isAlreadyIndexed: isAlreadyIndexed(o2) }
313673
+ );
313674
+ }
313675
+ if (!isAlreadyIndexed(o2) && !seen.has(o2)) {
313676
+ indexable.push(...extractRelationsForIndexing(
313677
+ o2,
313678
+ graph,
313679
+ isIndexable,
313680
+ isAlreadyIndexed,
313681
+ seen,
313682
+ _log
313683
+ ));
313684
+ }
313685
+ }
313686
+ if (_log) {
313687
+ console.debug(
313688
+ "search: obtained indexable from graph",
313689
+ { uri, graph, indexable }
313690
+ );
313691
+ }
313692
+ return indexable;
313657
313693
  }
313658
313694
 
313659
313695
  // ../anafero-gui/loader.mts
@@ -317656,10 +317692,19 @@ ${inject.head ?? ""}`;
317656
317692
  );
317657
317693
  pathProgress({ state: "updating artifacts" });
317658
317694
  if (content?.content) {
317695
+ let isIndexable2 = function(rel) {
317696
+ return rel[1] === "hasPart";
317697
+ }, isIndexed2 = function(uri) {
317698
+ return reader.exists(uri) && describedResourceIDs.has(uri);
317699
+ };
317700
+ var isIndexable = isIndexable2, isIndexed = isIndexed2;
317659
317701
  if (meta.primaryLanguageID) {
317660
317702
  allLanguages.add(meta.primaryLanguageID);
317661
317703
  }
317662
317704
  pathProgress({ state: "indexing page resource" });
317705
+ const describedResourceIDs = gatherDescribedResourcesFromJsonifiedProseMirrorNode(
317706
+ content.content.contentDoc
317707
+ );
317663
317708
  resourceMap[path3] = resourceURI;
317664
317709
  resourceGraph.push([resourceURI, "isDefinedBy", `${path3}/resource.json`]);
317665
317710
  resourceDescriptions[resourceURI] = resourceMeta;
@@ -317668,13 +317713,15 @@ ${inject.head ?? ""}`;
317668
317713
  title: preprocessStringForIndexing(meta.labelInPlainText),
317669
317714
  lang: meta.primaryLanguageID || "",
317670
317715
  body: preprocessStringForIndexing(
317671
- extractRelationsForIndexing(resourceURI, relations, reader.exists).join("").trim()
317716
+ extractRelationsForIndexing(
317717
+ resourceURI,
317718
+ relations,
317719
+ isIndexable2,
317720
+ isIndexed2
317721
+ ).join("\n").trim()
317672
317722
  )
317673
317723
  };
317674
317724
  pathProgress({ state: "indexing on-page subresources" });
317675
- const describedResourceIDs = gatherDescribedResourcesFromJsonifiedProseMirrorNode(
317676
- content.content.contentDoc
317677
- );
317678
317725
  for (const inPageResourceID of describedResourceIDs) {
317679
317726
  if (reader.exists(inPageResourceID)) {
317680
317727
  const pathWithFragment = `${path3}#${encodeURIComponent(inPageResourceID)}`;
@@ -317684,13 +317731,19 @@ ${inject.head ?? ""}`;
317684
317731
  resourceGraph.push([inPageResourceID, "isDefinedBy", `${path3}/resource.json`]);
317685
317732
  resourceDescriptions[inPageResourceID] = meta2;
317686
317733
  if (inPageResourceID !== resourceURI) {
317734
+ const body = preprocessStringForIndexing(
317735
+ extractRelationsForIndexing(
317736
+ inPageResourceID,
317737
+ graph2,
317738
+ isIndexable2,
317739
+ isIndexed2
317740
+ ).join("\n").trim()
317741
+ );
317687
317742
  searchableResources.resources[inPageResourceID] = {
317688
317743
  name: inPageResourceID,
317689
317744
  title: preprocessStringForIndexing(meta2.labelInPlainText),
317690
317745
  lang: meta2.primaryLanguageID || "",
317691
- body: preprocessStringForIndexing(
317692
- extractRelationsForIndexing(inPageResourceID, graph2, reader.exists).join("").trim()
317693
- )
317746
+ body
317694
317747
  };
317695
317748
  }
317696
317749
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riboseinc/anafero-cli",
3
3
  "type": "module",
4
- "version": "0.0.65",
4
+ "version": "0.0.67",
5
5
  "packageManager": "yarn@4.5.0",
6
6
  "bin": {
7
7
  "build-site": "build-site.mjs"