@riboseinc/anafero-cli 0.0.27 → 0.0.28

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
@@ -31050,6 +31050,9 @@ tbody.vars_bd693cb4_hm005a_spectrum-Table-body .vars_bd693cb4_hm005a_spectrum-Ta
31050
31050
  #resources > * {
31051
31051
  background: transparent;
31052
31052
  }
31053
+ #resources {
31054
+ padding-bottom: 40vh;
31055
+ }
31053
31056
  }
31054
31057
  .style_floatingSubresourceLink {
31055
31058
  .style_floatingSubresourceLinkAnchor {
package/build-site.mjs CHANGED
@@ -28274,7 +28274,7 @@ var require_parser = __commonJS({
28274
28274
  }
28275
28275
  }
28276
28276
  function fromCodePoint() {
28277
- var MAX_SIZE2 = 16384;
28277
+ var MAX_SIZE = 16384;
28278
28278
  var codeUnits = [];
28279
28279
  var highSurrogate;
28280
28280
  var lowSurrogate;
@@ -28294,7 +28294,7 @@ var require_parser = __commonJS({
28294
28294
  lowSurrogate = codePoint % 1024 + 56320;
28295
28295
  codeUnits.push(highSurrogate, lowSurrogate);
28296
28296
  }
28297
- if (index + 1 == length3 || codeUnits.length > MAX_SIZE2) {
28297
+ if (index + 1 == length3 || codeUnits.length > MAX_SIZE) {
28298
28298
  result += String.fromCharCode.apply(null, codeUnits);
28299
28299
  codeUnits.length = 0;
28300
28300
  }
@@ -312877,6 +312877,17 @@ function gatherDescribedResourcesFromJsonifiedProseMirrorNode(jsonifiedNode, _ac
312877
312877
  }
312878
312878
  return accumulator;
312879
312879
  }
312880
+ function gatherTextFromJsonifiedProseMirrorNode(jsonifiedNode) {
312881
+ if (jsonifiedNode?.type === "text") {
312882
+ return typeof jsonifiedNode.text === "string" ? jsonifiedNode.text ?? "" : "";
312883
+ } else {
312884
+ if (Array.isArray(jsonifiedNode?.content) && jsonifiedNode.content.length > 0) {
312885
+ return jsonifiedNode.content.map(gatherTextFromJsonifiedProseMirrorNode).join("\n");
312886
+ } else {
312887
+ return "";
312888
+ }
312889
+ }
312890
+ }
312880
312891
  function fillInLocale(langID) {
312881
312892
  if (langID.indexOf("-") >= 1) {
312882
312893
  return langID;
@@ -313046,44 +313057,15 @@ __export(anafero_exports, {
313046
313057
  VersioningSchema: () => VersioningSchema,
313047
313058
  dedupeGraph: () => dedupeGraph,
313048
313059
  dedupeResourceRelationList: () => dedupeResourceRelationList,
313049
- enableNewLunrJaTokenizer: () => enableNewLunrJaTokenizer,
313050
313060
  fillInLocale: () => fillInLocale,
313051
313061
  gatherDescribedResourcesFromJsonifiedProseMirrorNode: () => gatherDescribedResourcesFromJsonifiedProseMirrorNode,
313062
+ gatherTextFromJsonifiedProseMirrorNode: () => gatherTextFromJsonifiedProseMirrorNode,
313052
313063
  makeDummyInMemoryCache: () => makeDummyInMemoryCache,
313053
313064
  parseModuleRef: () => parseModuleRef,
313054
313065
  titleSchema: () => titleSchema
313055
313066
  });
313056
313067
  init_cjs_shim();
313057
313068
 
313058
- // ../anafero/search.mts
313059
- init_cjs_shim();
313060
- var MIN_SIZE = 2;
313061
- var MAX_SIZE = 6;
313062
- function enableNewLunrJaTokenizer(lunr2) {
313063
- lunr2.ja.tokenizer = function(obj) {
313064
- if (!arguments.length || obj == null || obj === void 0) return [];
313065
- let str = obj.toString().toLowerCase().replace(/^\s+/, "").replace(/\s+$/, "");
313066
- if (str.length === 0) return [];
313067
- const ngrams = (text9, minSize = 2, maxSize = 6) => {
313068
- let results = [];
313069
- for (let size17 = minSize; size17 <= maxSize; size17++) {
313070
- for (let i2 = 0; i2 <= text9.length - size17; i2++) {
313071
- let token = text9.substring(i2, i2 + size17);
313072
- results.push({
313073
- str: token,
313074
- metadata: { position: [i2, i2 + size17 - 1], index: i2 }
313075
- });
313076
- }
313077
- }
313078
- return results;
313079
- };
313080
- const tokens = ngrams(str, MIN_SIZE, Math.min(MAX_SIZE, str.length));
313081
- return tokens.map(
313082
- (tokenData) => new lunr2.Token(tokenData.str, tokenData.metadata)
313083
- );
313084
- };
313085
- }
313086
-
313087
313069
  // ../anafero/TitleSchema.mts
313088
313070
  init_cjs_shim();
313089
313071
  var titleSchema = new Schema({
@@ -316074,6 +316056,7 @@ var BrowserBar = function({
316074
316056
  {
316075
316057
  "aria-label": "Loading\u2026",
316076
316058
  minValue: 0,
316059
+ isIndeterminate: loadProgress.total - 0.1 < loadProgress.total - loadProgress.done || loadProgress.total - loadProgress.done < 0.1,
316077
316060
  maxValue: loadProgress.total,
316078
316061
  value: loadProgress.done
316079
316062
  }
@@ -316556,7 +316539,8 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
316556
316539
  if (isURIString(rel.target) && !contentAdapter.crossReferences?.(rel)) {
316557
316540
  const key = JSON.stringify({ rel, resourceURI, containingResourcePath });
316558
316541
  if (seen.has(key)) {
316559
- throw new Error(`Duplicate ${rel.predicate} to ${rel.target} from ${resourceURI} at ${containingResourcePath}`);
316542
+ console.warn(`Ignoring duplicate relation ${rel.predicate} to ${rel.target} from ${resourceURI} at ${containingResourcePath}`);
316543
+ continue;
316560
316544
  } else {
316561
316545
  seen.add(key);
316562
316546
  processResourceContents(rel.target, containingResourcePath, seen);
@@ -316629,6 +316613,17 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
316629
316613
  return [];
316630
316614
  }
316631
316615
  },
316616
+ exists: function exists4(resourceURI) {
316617
+ return cache3.has(`path-for/${resourceURI}`);
316618
+ },
316619
+ findContainingPageResourceURI: function findPageURI(resourceURI) {
316620
+ const path3 = cache3.get(`path-for/${resourceURI}`);
316621
+ if (path3.indexOf("#")) {
316622
+ return cache3.get(path3.split("#")[0]);
316623
+ } else {
316624
+ return resourceURI;
316625
+ }
316626
+ },
316632
316627
  findURL: function findURL(resourceURI) {
316633
316628
  const maybePath = cache3.get(`path-for/${resourceURI}`);
316634
316629
  if (maybePath) {
@@ -316674,9 +316669,10 @@ function joinFileURI(baseFileURI, fileURI) {
316674
316669
  // ../anafero/process.mts
316675
316670
  (0, import_lunr_stemmer.default)(import_lunr.default);
316676
316671
  (0, import_tinyseg.default)(import_lunr.default);
316677
- (0, import_lunr2.default)(import_lunr.default);
316678
- (0, import_lunr3.default)(import_lunr.default);
316679
- (0, import_lunr4.default)(import_lunr.default);
316672
+ var lunrLanguageSupport = {
316673
+ ja: import_lunr3.default,
316674
+ fr: import_lunr2.default
316675
+ };
316680
316676
  var encoder = new TextEncoder();
316681
316677
  var decoder = new TextDecoder();
316682
316678
  function* generateResourceAssets(resourceURI, relations, parentChain, directDescendants, resourceProps, expandVersionedPath, getDOMStub, inject, workspaceTitle, primaryLanguageID, describe, generateContent) {
@@ -316863,6 +316859,12 @@ ${inject.head ?? ""}`;
316863
316859
  }
316864
316860
  if (!maybePrimaryLanguageID) {
316865
316861
  if (resourceMeta.primaryLanguageID) {
316862
+ console.debug(
316863
+ "Setting primary language ID:",
316864
+ resourceMeta.primaryLanguageID,
316865
+ "based on resource",
316866
+ resourceURI
316867
+ );
316866
316868
  maybePrimaryLanguageID = resourceMeta.primaryLanguageID;
316867
316869
  }
316868
316870
  } else if (!resourceMeta.primaryLanguageID) {
@@ -316936,13 +316938,21 @@ ${inject.head ?? ""}`;
316936
316938
  if (content) {
316937
316939
  const describedResourceIDs = gatherDescribedResourcesFromJsonifiedProseMirrorNode(content.contentDoc);
316938
316940
  for (const inPageResourceID of describedResourceIDs) {
316939
- const pathWithFragment = `${path3}#${encodeURIComponent(inPageResourceID)}`;
316940
- resourceMap[pathWithFragment] = inPageResourceID;
316941
- resourceGraph.push([inPageResourceID, "isDefinedBy", `${path3}/resource.json`]);
316942
- resourceDescriptions[inPageResourceID] = {
316943
- primaryLanguageID: maybePrimaryLanguageID,
316944
- ...contentAdapter.describe(relativeGraph(relations2, inPageResourceID))
316945
- };
316941
+ if (reader.exists(inPageResourceID)) {
316942
+ const pathWithFragment = `${path3}#${encodeURIComponent(inPageResourceID)}`;
316943
+ resourceMap[pathWithFragment] = inPageResourceID;
316944
+ resourceGraph.push([inPageResourceID, "isDefinedBy", `${path3}/resource.json`]);
316945
+ resourceDescriptions[inPageResourceID] = {
316946
+ primaryLanguageID: maybePrimaryLanguageID,
316947
+ ...contentAdapter.describe(relativeGraph(relations2, inPageResourceID))
316948
+ };
316949
+ } else {
316950
+ console.warn(
316951
+ "Subresource on page does not exist in the graph",
316952
+ path3,
316953
+ inPageResourceID
316954
+ );
316955
+ }
316946
316956
  }
316947
316957
  }
316948
316958
  } else {
@@ -316973,8 +316983,11 @@ ${inject.head ?? ""}`;
316973
316983
  const [indexProgress] = reportProgress("build search index");
316974
316984
  import_lunr.default.utils.warn = console.warn;
316975
316985
  const lunrIndex = (0, import_lunr.default)(function() {
316976
- if (maybePrimaryLanguageID && import_lunr.default.hasOwnProperty(maybePrimaryLanguageID)) {
316977
- console.debug(`Primary language is \u201C${maybePrimaryLanguageID}\u201D, enabling multi-language Lunr mode & mixed tokenizer`);
316986
+ console.debug(`Search index: primary language is \u201C${maybePrimaryLanguageID}\u201D`);
316987
+ if (maybePrimaryLanguageID && maybePrimaryLanguageID !== "en" && lunrLanguageSupport[maybePrimaryLanguageID]) {
316988
+ console.debug("Search index: enabling multi-language Lunr mode & mixed tokenizer");
316989
+ lunrLanguageSupport[maybePrimaryLanguageID](import_lunr.default);
316990
+ (0, import_lunr4.default)(import_lunr.default);
316978
316991
  this.use(import_lunr.default.multiLanguage("en", maybePrimaryLanguageID));
316979
316992
  this.tokenizer = function(x2) {
316980
316993
  return import_lunr.default.tokenizer(x2).concat(import_lunr.default[maybePrimaryLanguageID].tokenizer(x2));
@@ -316982,37 +316995,31 @@ ${inject.head ?? ""}`;
316982
316995
  }
316983
316996
  this.ref("name");
316984
316997
  this.field("body");
316985
- for (const [uri, content] of Object.entries(contentCache)) {
316998
+ for (const [uri, desc] of Object.entries(resourceDescriptions)) {
316986
316999
  indexProgress({ state: `adding entry for ${uri}` });
316987
- const lang = resourceDescriptions[uri]?.primaryLanguageID;
317000
+ const lang = desc.primaryLanguageID;
316988
317001
  if (lang && lang !== maybePrimaryLanguageID && lang !== "en" && import_lunr.default.hasOwnProperty(lang)) {
316989
317002
  console.warn("Resource language is different from primary language, this may not work");
316990
317003
  this.use(import_lunr.default.multiLanguage("en", lang));
316991
317004
  }
316992
- if (content?.content) {
316993
- const { contentDoc, labelInPlainText } = content.content;
317005
+ const rels = reader.resolve(uri);
317006
+ const relationsExcludingReferences = rels.filter(
317007
+ ([s2, p3, o]) => p3 === "hasPart" && (s2 === ROOT_SUBJECT || s2 === uri) && !o.startsWith("data:") && (!isURIString(o) || !reader.exists(o))
317008
+ );
317009
+ const body = relationsExcludingReferences.map(([s2, p3, o]) => o).join("").trim();
317010
+ if (body) {
316994
317011
  const entry = {
316995
317012
  name: uri,
316996
- body: `${labelInPlainText} \u2014 ${gatherTextFromJsonifiedProseMirrorNode(contentDoc)}`
317013
+ body
316997
317014
  };
316998
317015
  this.add(entry);
317016
+ } else {
316999
317017
  }
317000
317018
  }
317001
317019
  });
317002
317020
  indexProgress(null);
317003
317021
  yield { "/search-index.json": encoder.encode(JSON.stringify(lunrIndex, null, 4)) };
317004
317022
  }
317005
- function gatherTextFromJsonifiedProseMirrorNode(jsonifiedNode) {
317006
- if (jsonifiedNode?.type === "text") {
317007
- return typeof jsonifiedNode.text === "string" ? jsonifiedNode.text ?? "" : "";
317008
- } else {
317009
- if (Array.isArray(jsonifiedNode?.content) && jsonifiedNode.content.length > 0) {
317010
- return jsonifiedNode.content.map(gatherTextFromJsonifiedProseMirrorNode).join("\n");
317011
- } else {
317012
- return "";
317013
- }
317014
- }
317015
- }
317016
317023
  async function* generateStaticSiteAssets(versions, currentVersionID, opts) {
317017
317024
  const versionIDsSorted = Array.from(Object.entries(versions)).toSorted(
317018
317025
  ([, ver1], [, ver2]) => ver2.timestamp.getTime() - ver1.timestamp.getTime()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riboseinc/anafero-cli",
3
3
  "type": "module",
4
- "version": "0.0.27",
4
+ "version": "0.0.28",
5
5
  "packageManager": "yarn@4.5.0",
6
6
  "bin": {
7
7
  "build-site": "build-site.mjs"
Binary file
Binary file