@riboseinc/anafero-cli 0.0.56 → 0.0.58

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.css CHANGED
@@ -31820,7 +31820,7 @@ tbody.table_0cdc494a_hm005a_spectrum-Table-body .table_0cdc494a_hm005a_spectrum-
31820
31820
  background-color: #f06;
31821
31821
  color: white;
31822
31822
  }
31823
- padding: 0 2em 2em;
31823
+ padding: 0;
31824
31824
  font-size: 16px;
31825
31825
  font-weight: 330;
31826
31826
  overflow-x: auto;
@@ -31859,16 +31859,21 @@ tbody.table_0cdc494a_hm005a_spectrum-Table-body .table_0cdc494a_hm005a_spectrum-
31859
31859
  }
31860
31860
  }
31861
31861
  .style_resourceBreadcrumbsNav {
31862
- margin: 0.5em 0;
31862
+ margin: 0;
31863
+ padding: 0.5em 2em 0 2em;
31863
31864
  list-style: none;
31864
- padding: 0;
31865
- color: var(--spectrum-alias-text-color-disabled);
31865
+ background-image:
31866
+ linear-gradient(
31867
+ 178deg,
31868
+ transparent,
31869
+ var(--spectrum-alias-highlight-hover) 2rem);
31870
+ color: var(--spectrum-accent-color-1300);
31866
31871
  > li {
31867
31872
  display: inline-block;
31868
31873
  > a {
31869
31874
  &:link,
31870
31875
  &:visited {
31871
- color: var(--spectrum-alias-text-color-disabled);
31876
+ color: var(--spectrum-accent-color-1300);
31872
31877
  text-decoration: none;
31873
31878
  }
31874
31879
  &:hover {
@@ -31876,7 +31881,7 @@ tbody.table_0cdc494a_hm005a_spectrum-Table-body .table_0cdc494a_hm005a_spectrum-
31876
31881
  }
31877
31882
  }
31878
31883
  &:first-child {
31879
- font-weight: 400;
31884
+ font-weight: bold;
31880
31885
  }
31881
31886
  &::after {
31882
31887
  margin: 0 0.5em;
package/build-site.mjs CHANGED
@@ -294383,7 +294383,8 @@ var Tasks = function({ tasks }) {
294383
294383
  };
294384
294384
  var TaskTree = function({ task, progress, error: error4, subtasks }) {
294385
294385
  const hasProgressEstimate = progress && progress.total !== void 0 && progress.done !== void 0;
294386
- return /* @__PURE__ */ import_react54.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react54.default.createElement(Box_default, { height: hasProgressEstimate ? 2 : 1, flexDirection: "column" }, progress ? /* @__PURE__ */ import_react54.default.createElement(import_react54.default.Fragment, null, /* @__PURE__ */ import_react54.default.createElement(Box_default, { height: 1, gap: 2, flexGrow: 0 }, /* @__PURE__ */ import_react54.default.createElement(Spinner, { label: task }), /* @__PURE__ */ import_react54.default.createElement(Box_default, { flexGrow: 0 }, /* @__PURE__ */ import_react54.default.createElement(Text, null, progress.state ?? "working\u2026"))), /* @__PURE__ */ import_react54.default.createElement(Box_default, { height: 1, flexGrow: 0 }, hasProgressEstimate ? /* @__PURE__ */ import_react54.default.createElement(ProgressBar, { value: 100 / progress.total * progress.done }) : null)) : error4 ? /* @__PURE__ */ import_react54.default.createElement(StatusMessage, { variant: "error" }, task, ": ", error4) : /* @__PURE__ */ import_react54.default.createElement(StatusMessage, { variant: "success" }, task)), Object.keys(subtasks ?? []).length > 0 ? /* @__PURE__ */ import_react54.default.createElement(Box_default, { marginLeft: 2, flexDirection: "column" }, /* @__PURE__ */ import_react54.default.createElement(Tasks, { tasks: subtasks })) : null);
294386
+ const progressLabel = hasProgressEstimate ? `${task}: ${progress.done} of ${progress.total}` : task;
294387
+ return /* @__PURE__ */ import_react54.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react54.default.createElement(Box_default, { height: hasProgressEstimate ? 2 : 1, flexDirection: "column" }, progress ? /* @__PURE__ */ import_react54.default.createElement(import_react54.default.Fragment, null, /* @__PURE__ */ import_react54.default.createElement(Box_default, { height: 1, gap: 2, flexGrow: 0 }, /* @__PURE__ */ import_react54.default.createElement(Spinner, { label: progressLabel }), /* @__PURE__ */ import_react54.default.createElement(Box_default, { flexGrow: 0 }, /* @__PURE__ */ import_react54.default.createElement(Text, null, progress.state ?? "working\u2026"))), /* @__PURE__ */ import_react54.default.createElement(Box_default, { height: 1, flexGrow: 0 }, hasProgressEstimate ? /* @__PURE__ */ import_react54.default.createElement(ProgressBar, { value: 100 / progress.total * progress.done }) : null)) : error4 ? /* @__PURE__ */ import_react54.default.createElement(StatusMessage, { variant: "error" }, task, ": ", error4) : /* @__PURE__ */ import_react54.default.createElement(StatusMessage, { variant: "success" }, task)), Object.keys(subtasks ?? []).length > 0 ? /* @__PURE__ */ import_react54.default.createElement(Box_default, { marginLeft: 2, flexDirection: "column" }, /* @__PURE__ */ import_react54.default.createElement(Tasks, { tasks: subtasks })) : null);
294387
294388
  };
294388
294389
 
294389
294390
  // ../anafero/cache.mts
@@ -313497,6 +313498,7 @@ __export(anafero_exports, {
313497
313498
  VersioningSchema: () => VersioningSchema,
313498
313499
  dedupeGraph: () => dedupeGraph,
313499
313500
  dedupeResourceRelationList: () => dedupeResourceRelationList,
313501
+ extractRelationsForIndexing: () => extractRelationsForIndexing,
313500
313502
  fillInLocale: () => fillInLocale,
313501
313503
  gatherDescribedResourcesFromJsonifiedProseMirrorNode: () => gatherDescribedResourcesFromJsonifiedProseMirrorNode,
313502
313504
  gatherTextFromJsonifiedProseMirrorNode: () => gatherTextFromJsonifiedProseMirrorNode,
@@ -313505,6 +313507,7 @@ __export(anafero_exports, {
313505
313507
  isURIString: () => isURIString,
313506
313508
  makeDummyInMemoryCache: () => makeDummyInMemoryCache,
313507
313509
  parseModuleRef: () => parseModuleRef,
313510
+ preprocessStringForIndexing: () => preprocessStringForIndexing,
313508
313511
  resolveChain: () => resolveChain,
313509
313512
  stripLeadingSlash: () => stripLeadingSlash,
313510
313513
  stripTrailingSlash: () => stripTrailingSlash,
@@ -313642,6 +313645,17 @@ function getTextContent(graph, subject, partPredicate) {
313642
313645
  return allSubparts;
313643
313646
  }
313644
313647
 
313648
+ // ../anafero/search.mts
313649
+ init_cjs_shim();
313650
+ function preprocessStringForIndexing(text9) {
313651
+ return text9.normalize("NFKD").replace(/\p{Diacritic}/gu, "").trim();
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))
313656
+ );
313657
+ }
313658
+
313645
313659
  // ../firelight-gui/loader.mts
313646
313660
  init_cjs_shim();
313647
313661
 
@@ -316679,6 +316693,7 @@ var Resource = import_react127.default.forwardRef(function({
316679
316693
  className,
316680
316694
  requestedResourceURI,
316681
316695
  searchQueryText,
316696
+ hideBreadcrumbs,
316682
316697
  useDependency,
316683
316698
  locateResource,
316684
316699
  document: document2,
@@ -316830,7 +316845,7 @@ var Resource = import_react127.default.forwardRef(function({
316830
316845
  className: `${style_default.resource} ${className ?? ""}`,
316831
316846
  "aria-selected": ariaSelected
316832
316847
  },
316833
- /* @__PURE__ */ import_react127.default.createElement(ResourceBreadcrumbs, { parents: resourceNav.breadcrumbs }),
316848
+ !hideBreadcrumbs ? /* @__PURE__ */ import_react127.default.createElement(ResourceBreadcrumbs, { parents: resourceNav.breadcrumbs }) : null,
316834
316849
  content.content ? /* @__PURE__ */ import_react127.default.createElement(ResourceHelmet, { ...content.content }) : null,
316835
316850
  /* @__PURE__ */ import_react127.default.createElement(
316836
316851
  Layout,
@@ -317540,8 +317555,8 @@ ${inject.head ?? ""}`;
317540
317555
  }
317541
317556
  const resourceMap = {};
317542
317557
  const resourceGraph = [];
317558
+ const searchableResources = { pages: {}, resources: {} };
317543
317559
  const resourceDescriptions = {};
317544
- const contentCache = {};
317545
317560
  const assetsToWrite = {};
317546
317561
  const rootMeta = reader.describeRoot();
317547
317562
  const maybePrimaryLanguageID = rootMeta.primaryLanguageID ?? "en";
@@ -317575,60 +317590,87 @@ ${inject.head ?? ""}`;
317575
317590
  const resourceMeta = meta;
317576
317591
  const relations = reader.resolve(resourceURI);
317577
317592
  pathProgress({ state: "generating resource page content" });
317578
- const content = function generateContent(graph, metadata, uri, cache4) {
317579
- if (!cache4[uri]) {
317580
- let content2;
317581
- const maybeAdapter = findContentAdapter(uri);
317582
- if (maybeAdapter) {
317583
- try {
317584
- content2 = maybeAdapter[1].generateContent(graph) ?? null;
317585
- } catch (e3) {
317586
- console.error(
317587
- "Failed to generate resource content",
317588
- path3,
317589
- uri,
317590
- graph.slice(0, 40).join("\n")
317591
- );
317592
- throw e3;
317593
- }
317594
- if (content2) {
317595
- contentCache[uri] = {
317596
- adapterID: maybeAdapter[0],
317597
- content: { ...metadata, ...content2 }
317598
- };
317599
- if (metadata.primaryLanguageID) {
317600
- allLanguages.add(metadata.primaryLanguageID);
317601
- }
317602
- const describedResourceIDs = gatherDescribedResourcesFromJsonifiedProseMirrorNode(content2.contentDoc);
317603
- for (const inPageResourceID of describedResourceIDs) {
317604
- if (reader.exists(inPageResourceID)) {
317605
- const pathWithFragment = `${path3}#${encodeURIComponent(inPageResourceID)}`;
317606
- resourceMap[pathWithFragment] = inPageResourceID;
317607
- resourceGraph.push([inPageResourceID, "isDefinedBy", `${path3}/resource.json`]);
317608
- resourceDescriptions[inPageResourceID] = reader.describe(inPageResourceID);
317609
- } else {
317610
- console.warn(
317611
- "Subresource on page does not exist in the graph",
317612
- path3,
317613
- inPageResourceID
317614
- );
317615
- }
317616
- }
317617
- }
317593
+ const content = function generateContent(uri, metadata, graph) {
317594
+ let result;
317595
+ let content2;
317596
+ const maybeAdapter = findContentAdapter(uri);
317597
+ if (maybeAdapter) {
317598
+ try {
317599
+ content2 = maybeAdapter[1].generateContent(graph) ?? null;
317600
+ } catch (e3) {
317601
+ console.error(
317602
+ "Failed to generate resource content",
317603
+ path3,
317604
+ uri,
317605
+ graph.slice(0, 40).join("\n")
317606
+ );
317607
+ throw e3;
317608
+ }
317609
+ if (content2) {
317610
+ result = {
317611
+ adapterID: maybeAdapter[0],
317612
+ content: { ...metadata, ...content2 }
317613
+ };
317618
317614
  } else {
317619
- console.warn("No adapter found to render", uri);
317620
- return null;
317615
+ console.warn("No content was generated", uri);
317616
+ result = null;
317621
317617
  }
317622
317618
  } else {
317623
- console.debug("contentCache hit", uri);
317619
+ console.warn("No adapter found to render", uri);
317620
+ result = null;
317624
317621
  }
317625
- return cache4[uri];
317626
- }(relations, meta, resourceURI, contentCache);
317622
+ return result;
317623
+ }(
317624
+ resourceURI,
317625
+ meta,
317626
+ relations
317627
+ );
317627
317628
  pathProgress({ state: "generating page content & assets" });
317628
- if (content !== null) {
317629
+ if (content?.content) {
317630
+ if (meta.primaryLanguageID) {
317631
+ allLanguages.add(meta.primaryLanguageID);
317632
+ }
317629
317633
  resourceMap[path3] = resourceURI;
317630
317634
  resourceGraph.push([resourceURI, "isDefinedBy", `${path3}/resource.json`]);
317631
317635
  resourceDescriptions[resourceURI] = resourceMeta;
317636
+ searchableResources.pages[resourceURI] = {
317637
+ name: resourceURI,
317638
+ title: preprocessStringForIndexing(meta.labelInPlainText),
317639
+ lang: meta.primaryLanguageID || "",
317640
+ body: preprocessStringForIndexing(
317641
+ extractRelationsForIndexing(resourceURI, relations, reader.exists).join("").trim()
317642
+ )
317643
+ };
317644
+ pathProgress({ state: "processing on-page subresources" });
317645
+ const describedResourceIDs = gatherDescribedResourcesFromJsonifiedProseMirrorNode(
317646
+ content.content.contentDoc
317647
+ );
317648
+ for (const inPageResourceID of describedResourceIDs) {
317649
+ if (reader.exists(inPageResourceID)) {
317650
+ const pathWithFragment = `${path3}#${encodeURIComponent(inPageResourceID)}`;
317651
+ const meta2 = reader.describe(inPageResourceID);
317652
+ const graph = reader.resolve(inPageResourceID);
317653
+ resourceMap[pathWithFragment] = inPageResourceID;
317654
+ resourceGraph.push([inPageResourceID, "isDefinedBy", `${path3}/resource.json`]);
317655
+ resourceDescriptions[inPageResourceID] = meta2;
317656
+ if (inPageResourceID !== resourceURI) {
317657
+ searchableResources.resources[inPageResourceID] = {
317658
+ name: inPageResourceID,
317659
+ title: preprocessStringForIndexing(meta2.labelInPlainText),
317660
+ lang: meta2.primaryLanguageID || "",
317661
+ body: preprocessStringForIndexing(
317662
+ extractRelationsForIndexing(inPageResourceID, graph, reader.exists).join("").trim()
317663
+ )
317664
+ };
317665
+ }
317666
+ } else {
317667
+ console.warn(
317668
+ "Subresource on page does not exist in the graph",
317669
+ path3,
317670
+ inPageResourceID
317671
+ );
317672
+ }
317673
+ }
317632
317674
  pathProgress({ state: "processing resource assets" });
317633
317675
  for (const [, , o2] of relations) {
317634
317676
  if (o2.startsWith("file:")) {
@@ -317735,41 +317777,22 @@ ${inject.head ?? ""}`;
317735
317777
  };
317736
317778
  }
317737
317779
  this.ref("name");
317780
+ this.field("title", { boost: 2 });
317738
317781
  this.field("body");
317782
+ this.field("lang");
317739
317783
  let done12 = 0;
317740
- const total = Object.keys(contentCache).length + Object.keys(resourceDescriptions).length;
317784
+ const total = Object.keys(searchableResources.pages).length + Object.keys(searchableResources.resources).length;
317741
317785
  console.debug("Index pipeline functions during", this.pipeline._stack.map((f3) => f3.label));
317742
317786
  console.debug("Index search pipeline functions during", this.searchPipeline._stack.map((f3) => f3.label));
317743
- for (const [uri, content] of Object.entries(contentCache)) {
317787
+ for (const entry of Object.values(searchableResources.pages)) {
317744
317788
  done12 += 1;
317745
- indexProgress({ state: `adding entry for ${uri}`, total, done: done12 });
317746
- const label = content?.content?.labelInPlainText?.normalize("NFKD").replace(/\p{Diacritic}/gu, "").trim();
317747
- if (label) {
317748
- const entry = {
317749
- name: uri,
317750
- body: label
317751
- };
317752
- this.add(entry, { boost: 5 });
317753
- } else {
317754
- console.warn("No label for", uri);
317755
- }
317789
+ indexProgress({ state: "adding entries for pages", total, done: done12 });
317790
+ this.add(entry, { boost: 2 });
317756
317791
  }
317757
- for (const [uri] of Object.entries(resourceDescriptions)) {
317792
+ for (const entry of Object.values(searchableResources.resources)) {
317758
317793
  done12 += 1;
317759
317794
  indexProgress({ state: "adding entries for subresources", total, done: done12 });
317760
- const rels = reader.resolve(uri);
317761
- const relationsExcludingReferences = rels.filter(
317762
- ([s2, p3, o2]) => p3 === "hasPart" && (s2 === ROOT_SUBJECT || s2 === uri) && !o2.startsWith("data:") && (!isURIString(o2) || !reader.exists(o2))
317763
- );
317764
- const body = relationsExcludingReferences.map(([, , o2]) => o2).join("").trim().normalize("NFKD").replace(/\p{Diacritic}/gu, "").trim();
317765
- if (body) {
317766
- const entry = {
317767
- name: uri,
317768
- body
317769
- };
317770
- this.add(entry);
317771
- } else {
317772
- }
317795
+ this.add(entry);
317773
317796
  }
317774
317797
  });
317775
317798
  console.debug("Index pipeline functions after", lunrIndex.pipeline._stack.map((f3) => f3.label));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riboseinc/anafero-cli",
3
3
  "type": "module",
4
- "version": "0.0.56",
4
+ "version": "0.0.58",
5
5
  "packageManager": "yarn@4.5.0",
6
6
  "bin": {
7
7
  "build-site": "build-site.mjs"