@riboseinc/anafero-cli 0.0.52 → 0.0.54

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
@@ -44507,7 +44507,7 @@ var require_react_reconciler_development = __commonJS({
44507
44507
  var supportsTestSelectors = $$$hostConfig.supportsTestSelectors;
44508
44508
  var findFiberRoot = $$$hostConfig.findFiberRoot;
44509
44509
  var getBoundingRect = $$$hostConfig.getBoundingRect;
44510
- var getTextContent = $$$hostConfig.getTextContent;
44510
+ var getTextContent2 = $$$hostConfig.getTextContent;
44511
44511
  var isHiddenSubtree = $$$hostConfig.isHiddenSubtree;
44512
44512
  var matchAccessibilityRole = $$$hostConfig.matchAccessibilityRole;
44513
44513
  var setFocusIfFocusable = $$$hostConfig.setFocusIfFocusable;
@@ -55971,7 +55971,7 @@ var require_react_reconciler_development = __commonJS({
55971
55971
  break;
55972
55972
  case TEXT_TYPE:
55973
55973
  if (fiber.tag === HostComponent || fiber.tag === HostText) {
55974
- var textContent = getTextContent(fiber);
55974
+ var textContent = getTextContent2(fiber);
55975
55975
  if (textContent !== null && textContent.indexOf(selector.value) >= 0) {
55976
55976
  return true;
55977
55977
  }
@@ -313499,9 +313499,11 @@ __export(anafero_exports, {
313499
313499
  gatherDescribedResourcesFromJsonifiedProseMirrorNode: () => gatherDescribedResourcesFromJsonifiedProseMirrorNode,
313500
313500
  gatherTextFromJsonifiedProseMirrorNode: () => gatherTextFromJsonifiedProseMirrorNode,
313501
313501
  getAllParentPaths: () => getAllParentPaths,
313502
+ getTextContent: () => getTextContent,
313502
313503
  isURIString: () => isURIString,
313503
313504
  makeDummyInMemoryCache: () => makeDummyInMemoryCache,
313504
313505
  parseModuleRef: () => parseModuleRef,
313506
+ resolveChain: () => resolveChain,
313505
313507
  stripLeadingSlash: () => stripLeadingSlash,
313506
313508
  stripTrailingSlash: () => stripTrailingSlash,
313507
313509
  titleSchema: () => titleSchema
@@ -313568,6 +313570,9 @@ function getAllParentPaths(aPath) {
313568
313570
  return parents;
313569
313571
  }
313570
313572
 
313573
+ // ../anafero/util/graph-query.mts
313574
+ init_cjs_shim();
313575
+
313571
313576
  // ../anafero/URI.mts
313572
313577
  init_cjs_shim();
313573
313578
  function makeURI(input) {
@@ -313600,6 +313605,41 @@ function isURIString(input) {
313600
313605
  }
313601
313606
  var pattern2 = new RegExp("([A-Za-z][A-Za-z0-9+\\-.]{2,6}):(?:(//)(?:((?:[A-Za-z0-9\\-._~!$&'()*+,;=:]|%[0-9A-Fa-f]{2})*)@)?((?:\\[(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){6}|::(?:[0-9A-Fa-f]{1,4}:){5}|(?:[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){3}|(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){2}|(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}:|(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?::)(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)|[Vv][0-9A-Fa-f]+\\.[A-Za-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(?:[A-Za-z0-9\\-._~!$&'()*+,;=]|%[0-9A-Fa-f]{2})*))(?::([0-9]*))?((?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|/((?:(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)?)|((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:/(?:[A-Za-z0-9\\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)|)(?:\\?((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?(?:\\#((?:[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*))?");
313602
313607
 
313608
+ // ../anafero/util/graph-query.mts
313609
+ function resolveChain(relations, chain, subj_) {
313610
+ if (chain.length === 1) {
313611
+ return relations.filter((rel) => rel[1] === chain[0] && (!subj_ || rel[0] === subj_)).map((rel) => [rel[0], rel[2]]);
313612
+ } else {
313613
+ return relations.filter((rel) => rel[1] === chain[0] && (!subj_ || rel[0] === subj_)).map((rel) => resolveChain(
313614
+ relations,
313615
+ chain.slice(1),
313616
+ rel[2]
313617
+ )).flat();
313618
+ }
313619
+ }
313620
+ function getTextContent(graph, subject, partPredicate) {
313621
+ const allSubparts = (
313622
+ // TODO: subject is really only used to resolve relations,
313623
+ // maybe this can be refactored out of this function.
313624
+ resolveChain(graph, ["hasPart"], subject).flatMap(([partID, partValue]) => {
313625
+ if (!isURIString(partValue)) {
313626
+ if (partValue.startsWith("data:")) {
313627
+ return [""];
313628
+ } else if (partPredicate && !partPredicate(partValue)) {
313629
+ return [""];
313630
+ } else if (partValue.trim() === "") {
313631
+ return [""];
313632
+ } else {
313633
+ return [partValue];
313634
+ }
313635
+ } else {
313636
+ return getTextContent(graph, partValue, partPredicate);
313637
+ }
313638
+ })
313639
+ );
313640
+ return allSubparts;
313641
+ }
313642
+
313603
313643
  // ../firelight-gui/loader.mts
313604
313644
  init_cjs_shim();
313605
313645
 
@@ -316934,6 +316974,15 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
316934
316974
  const canonicalURIs = {};
316935
316975
  const originalURIs = {};
316936
316976
  const contentAdapters = {};
316977
+ function getAdapter(canonicalURI) {
316978
+ const adapter3 = contentAdapters[canonicalURI];
316979
+ if (adapter3) {
316980
+ return adapter3;
316981
+ } else {
316982
+ console.error("Resource does not have associated content adapter on record", canonicalURI);
316983
+ throw new Error("Resource does not have associated content adapter on record");
316984
+ }
316985
+ }
316937
316986
  const resourceReaders = {};
316938
316987
  let totalPathCount = 0;
316939
316988
  let totalRelationCount = 0;
@@ -316942,15 +316991,15 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
316942
316991
  const [relationsProgress] = reportProgress("read resources");
316943
316992
  await processRelations(entryPointURI, relationsProgress);
316944
316993
  relationsProgress(null);
316945
- const [hierarchyProgress] = reportProgress("prepare site structure");
316946
- processHierarchy(
316994
+ const [pageProgress] = reportProgress("prepare page structure");
316995
+ processPage(
316947
316996
  canonicalURIs[entryPointURI] ?? entryPointURI,
316948
316997
  "",
316949
- function reportHierarchyProgress(state) {
316950
- hierarchyProgress({ state });
316998
+ function reportPageProgress(state) {
316999
+ pageProgress({ state });
316951
317000
  }
316952
317001
  );
316953
- hierarchyProgress(null);
317002
+ pageProgress(null);
316954
317003
  }
316955
317004
  await process14();
316956
317005
  async function processRelations(entryPointURI2, onProgress, _seenEntryPoints) {
@@ -317040,7 +317089,6 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
317040
317089
  } else {
317041
317090
  }
317042
317091
  } else {
317043
- console.debug("URI relation is seen again", relation.target);
317044
317092
  }
317045
317093
  }
317046
317094
  }
@@ -317119,14 +317167,38 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
317119
317167
  return false;
317120
317168
  }
317121
317169
  }
317170
+ function describeResource(resourceURI) {
317171
+ if (!cache3.has(`metadata/${resourceURI}`)) {
317172
+ const graph = getResourceGraph(resourceURI);
317173
+ const contentAdapter = getAdapter(resourceURI);
317174
+ const meta = contentAdapter.describe(graph);
317175
+ const path3 = cache3.get(`path-for/${resourceURI}`);
317176
+ if (!meta.primaryLanguageID && !path3.includes("#")) {
317177
+ if (cache3.has(`${path3}/parents`)) {
317178
+ const parentResourcePaths = cache3.get(`${path3}/parents`);
317179
+ for (const p3 of parentResourcePaths) {
317180
+ const parentURI = cache3.get(p3);
317181
+ const parentMeta = describeResource(parentURI);
317182
+ if (parentMeta.primaryLanguageID) {
317183
+ meta.primaryLanguageID = parentMeta.primaryLanguageID;
317184
+ break;
317185
+ }
317186
+ console.warn("describeResource: no language, and no parents with language, for", path3);
317187
+ }
317188
+ } else {
317189
+ console.warn("describeResource: no language, and no parents, for", path3);
317190
+ }
317191
+ }
317192
+ cache3.set({
317193
+ [`metadata/${resourceURI}`]: meta
317194
+ });
317195
+ }
317196
+ return cache3.get(`metadata/${resourceURI}`);
317197
+ }
317122
317198
  function getResourceGraph(resourceURI) {
317123
317199
  if (!cache3.has(`graphs/${resourceURI}`)) {
317124
317200
  cache3.add(`graphs/${resourceURI}`, []);
317125
- const contentAdapter = contentAdapters[resourceURI];
317126
- if (!contentAdapter) {
317127
- console.error("Resource does not have associated content adapter on record", resourceURI);
317128
- throw new Error("Resource does not have associated content adapter on record");
317129
- }
317201
+ const contentAdapter = getAdapter(resourceURI);
317130
317202
  const queue = [resourceURI];
317131
317203
  while (queue.length > 0) {
317132
317204
  const currentResource = queue.pop();
@@ -317153,7 +317225,7 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
317153
317225
  }
317154
317226
  return cache3.list(`graphs/${resourceURI}`);
317155
317227
  }
317156
- function processResourceContents(contentAdapter, resourceURI, containingResourcePath, _seen) {
317228
+ function processFragment(contentAdapter, resourceURI, containingResourcePath, _seen) {
317157
317229
  contentAdapters[resourceURI] = contentAdapter;
317158
317230
  const seen = _seen ?? /* @__PURE__ */ new Set();
317159
317231
  cache3.set({
@@ -317167,12 +317239,12 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
317167
317239
  continue;
317168
317240
  } else {
317169
317241
  seen.add(key);
317170
- processResourceContents(contentAdapter, rel.target, containingResourcePath, seen);
317242
+ processFragment(contentAdapter, rel.target, containingResourcePath, seen);
317171
317243
  }
317172
317244
  }
317173
317245
  }
317174
317246
  }
317175
- function processHierarchy(resourceURI, pathPrefix, onProgress) {
317247
+ function processPage(resourceURI, pathPrefix, onProgress, meta) {
317176
317248
  const canonicalURI = canonicalURIs[resourceURI] ?? resourceURI;
317177
317249
  const contentAdapter = findContentAdapter(canonicalURI);
317178
317250
  contentAdapters[canonicalURI] = contentAdapter;
@@ -317204,9 +317276,9 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
317204
317276
  throw new Error("Generated path component is not valid");
317205
317277
  }
317206
317278
  const newPath = pathPrefix ? `${pathPrefix}/${maybePathComponent}` : maybePathComponent;
317207
- processHierarchy(rel.target, newPath, onProgress);
317279
+ processPage(rel.target, newPath, onProgress, meta);
317208
317280
  } else if (isURIString(rel.target)) {
317209
- processResourceContents(contentAdapter, rel.target, pathPrefix);
317281
+ processFragment(contentAdapter, rel.target, pathPrefix);
317210
317282
  }
317211
317283
  }
317212
317284
  }
@@ -317224,13 +317296,14 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
317224
317296
  yield {
317225
317297
  path: path3,
317226
317298
  resourceURI,
317299
+ meta: describeResource(resourceURI),
317227
317300
  directDescendants: cache3.has(`${path3}/direct-descendants`) ? cache3.list(`${path3}/direct-descendants`).map((path4) => {
317228
317301
  const res = getCachedResourceURIForPath(path4);
317229
- return [`/${path4}`, res, getResourceGraph(res)];
317302
+ return [`/${path4}`, res, describeResource(res)];
317230
317303
  }) : [],
317231
317304
  parentChain: path3 !== "" ? cache3.list(`${path3}/parents`).map((path4) => {
317232
317305
  const res = getCachedResourceURIForPath(path4);
317233
- return [`/${path4}`, res, getResourceGraph(res)];
317306
+ return [`/${path4}`, res, describeResource(res)];
317234
317307
  }) : []
317235
317308
  };
317236
317309
  }
@@ -317264,6 +317337,12 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
317264
317337
  throw new Error("Unable to find URL for resource");
317265
317338
  }
317266
317339
  },
317340
+ describe: function describe(resourceURI) {
317341
+ return describeResource(resourceURI);
317342
+ },
317343
+ describeRoot: function describeRoot() {
317344
+ return describeResource(cache3.get(""));
317345
+ },
317267
317346
  resolve: function resolveGraph(resourceURI) {
317268
317347
  return getResourceGraph(resourceURI);
317269
317348
  }
@@ -317312,21 +317391,21 @@ var lunrLanguageSupport = {
317312
317391
  };
317313
317392
  var encoder = new TextEncoder();
317314
317393
  var decoder = new TextDecoder();
317315
- function* generateResourceAssets(resourceURI, relations, parentChain, directDescendants, resourceProps, expandVersionedPath, getDOMStub, inject, workspaceTitle, primaryLanguageID, describe, generateContent) {
317394
+ function* generateResourceAssets(resourceURI, relations, parentChain, directDescendants, resourceProps, expandVersionedPath, getDOMStub, inject, workspaceTitle, primaryLanguageID, generateContent) {
317316
317395
  const generatedContent = generateContent(relations, resourceURI);
317317
317396
  if (!generatedContent) {
317318
317397
  console.warn("Resource has no content", resourceURI);
317319
317398
  return;
317320
317399
  }
317321
- const generateNavLink = function generateNavLink2(path3, uri, graph) {
317400
+ const generateNavLink = function generateNavLink2(path3, uri, meta) {
317322
317401
  return {
317323
317402
  path: expandVersionedPath(path3),
317324
- plainTitle: describe(graph, uri)?.labelInPlainText ?? uri
317403
+ plainTitle: meta?.labelInPlainText ?? uri
317325
317404
  };
317326
317405
  };
317327
317406
  const resourceNav = {
317328
- breadcrumbs: parentChain.map(([path3, uri, graph]) => generateNavLink(path3, uri, graph)),
317329
- children: directDescendants.map(([path3, uri, graph]) => generateNavLink(path3, uri, graph))
317407
+ breadcrumbs: parentChain.map(([path3, uri, meta]) => generateNavLink(path3, uri, meta)),
317408
+ children: directDescendants.map(([path3, uri, meta]) => generateNavLink(path3, uri, meta))
317330
317409
  };
317331
317410
  yield {
317332
317411
  "/resource.json": encoder.encode(JSON.stringify(relations, null, 4)),
@@ -317467,8 +317546,10 @@ ${inject.head ?? ""}`;
317467
317546
  const resourceDescriptions = {};
317468
317547
  const contentCache = {};
317469
317548
  const assetsToWrite = {};
317470
- let maybePrimaryLanguageID = void 0;
317471
- let maybeMainTitle = void 0;
317549
+ const rootMeta = reader.describeRoot();
317550
+ const maybePrimaryLanguageID = rootMeta.primaryLanguageID ?? "en";
317551
+ const maybeMainTitle = rootMeta.labelInPlainText ?? "Document";
317552
+ const allLanguages = /* @__PURE__ */ new Set();
317472
317553
  function getReverseResourceMap() {
317473
317554
  return Object.fromEntries(Object.entries(resourceMap).map(([k, v]) => [v, k]));
317474
317555
  }
@@ -317482,14 +317563,7 @@ ${inject.head ?? ""}`;
317482
317563
  let done11 = 0;
317483
317564
  const [allPathProgress, pathSubtask] = reportProgress("build page content", { total: totalPaths, done: done11 });
317484
317565
  const hierarchicalResources = reader.generatePaths();
317485
- for (const { path: path3, resourceURI, parentChain, directDescendants } of hierarchicalResources) {
317486
- let contentAdapter;
317487
- try {
317488
- contentAdapter = findContentAdapter(resourceURI)?.[1];
317489
- } catch (e3) {
317490
- console.error("Unable to find content adapter for resource", resourceURI, e3);
317491
- continue;
317492
- }
317566
+ for (const { path: path3, resourceURI, meta, parentChain, directDescendants } of hierarchicalResources) {
317493
317567
  done11 += 1;
317494
317568
  allPathProgress({ total: totalPaths, done: done11 });
317495
317569
  if (path3.startsWith("/")) {
@@ -317504,23 +317578,7 @@ ${inject.head ?? ""}`;
317504
317578
  const relations = reader.resolve(resourceURI);
317505
317579
  resourceMap[path3] = resourceURI;
317506
317580
  resourceGraph.push([resourceURI, "isDefinedBy", `${path3}/resource.json`]);
317507
- const resourceMeta = contentAdapter.describe(relations);
317508
- if (path3 === "" && !maybeMainTitle) {
317509
- maybeMainTitle = resourceMeta.labelInPlainText ?? "Workspace";
317510
- }
317511
- if (!maybePrimaryLanguageID) {
317512
- if (resourceMeta.primaryLanguageID) {
317513
- console.debug(
317514
- "Setting primary language ID:",
317515
- resourceMeta.primaryLanguageID,
317516
- "based on resource",
317517
- resourceURI
317518
- );
317519
- maybePrimaryLanguageID = resourceMeta.primaryLanguageID;
317520
- }
317521
- } else if (!resourceMeta.primaryLanguageID) {
317522
- resourceMeta.primaryLanguageID = maybePrimaryLanguageID;
317523
- }
317581
+ const resourceMeta = meta;
317524
317582
  resourceDescriptions[resourceURI] = resourceMeta;
317525
317583
  pathProgress({ state: "processing referenced files" });
317526
317584
  for (const [, , o2] of relations) {
@@ -317565,12 +317623,8 @@ ${inject.head ?? ""}`;
317565
317623
  expandVersionedPath,
317566
317624
  getDOMStub,
317567
317625
  { head: extraHead, tail: inject.tail, htmlAttrs: inject.htmlAttrs },
317568
- maybeMainTitle ?? "Workspace",
317569
- resourceMeta.primaryLanguageID ?? maybePrimaryLanguageID ?? "en",
317570
- function describe(relations2, uri) {
317571
- const maybeAdapter = findContentAdapter(uri);
317572
- return maybeAdapter ? maybeAdapter[1].describe(relations2) : null;
317573
- },
317626
+ maybeMainTitle,
317627
+ resourceMeta.primaryLanguageID ?? maybePrimaryLanguageID,
317574
317628
  function generateContent(relations2, uri) {
317575
317629
  if (!contentCache[uri]) {
317576
317630
  let content;
@@ -317590,9 +317644,10 @@ ${inject.head ?? ""}`;
317590
317644
  );
317591
317645
  throw e3;
317592
317646
  }
317647
+ const primaryLanguageID = resourceMeta.primaryLanguageID ?? maybePrimaryLanguageID;
317593
317648
  contentCache[uri] = {
317594
317649
  adapterID: maybeAdapter[0],
317595
- content: content ? { primaryLanguageID: maybePrimaryLanguageID, ...content } : null
317650
+ content: content ? { primaryLanguageID, ...content } : null
317596
317651
  };
317597
317652
  if (content) {
317598
317653
  const describedResourceIDs = gatherDescribedResourcesFromJsonifiedProseMirrorNode(content.contentDoc);
@@ -317601,10 +317656,7 @@ ${inject.head ?? ""}`;
317601
317656
  const pathWithFragment = `${path3}#${encodeURIComponent(inPageResourceID)}`;
317602
317657
  resourceMap[pathWithFragment] = inPageResourceID;
317603
317658
  resourceGraph.push([inPageResourceID, "isDefinedBy", `${path3}/resource.json`]);
317604
- resourceDescriptions[inPageResourceID] = {
317605
- primaryLanguageID: maybePrimaryLanguageID,
317606
- ...maybeAdapter[1].describe(relativeGraph(relations2, inPageResourceID))
317607
- };
317659
+ resourceDescriptions[inPageResourceID] = reader.describe(inPageResourceID);
317608
317660
  } else {
317609
317661
  console.warn(
317610
317662
  "Subresource on page does not exist in the graph",
@@ -317643,14 +317695,30 @@ ${inject.head ?? ""}`;
317643
317695
  import_lunr.default.utils.warn = console.warn;
317644
317696
  const lunrIndex = (0, import_lunr.default)(function() {
317645
317697
  console.debug(`Search index: primary language is \u201C${maybePrimaryLanguageID}\u201D`);
317646
- if (maybePrimaryLanguageID && maybePrimaryLanguageID !== "en" && lunrLanguageSupport[maybePrimaryLanguageID]) {
317647
- console.debug("Search index: enabling multi-language Lunr mode & mixed tokenizer");
317648
- lunrLanguageSupport[maybePrimaryLanguageID](import_lunr.default);
317698
+ const supportedLanguages = [...allLanguages].filter((lang) => !!lunrLanguageSupport[lang]);
317699
+ const supportedNonDefaultLanguages = supportedLanguages.filter((lang) => lang !== "en");
317700
+ if (supportedLanguages.length > 1) {
317649
317701
  (0, import_lunr4.default)(import_lunr.default);
317650
- this.use(import_lunr.default.multiLanguage("en", maybePrimaryLanguageID));
317651
- this.tokenizer = function(x2) {
317652
- return import_lunr.default.tokenizer(x2).concat(import_lunr.default[maybePrimaryLanguageID].tokenizer(x2));
317653
- };
317702
+ }
317703
+ if (maybePrimaryLanguageID) {
317704
+ if (supportedLanguages.length > 1) {
317705
+ for (const lang of supportedNonDefaultLanguages) {
317706
+ lunrLanguageSupport[lang](import_lunr.default);
317707
+ }
317708
+ for (const lang of supportedNonDefaultLanguages) {
317709
+ this.use(import_lunr.default[lang]);
317710
+ }
317711
+ console.debug(
317712
+ "Search index: enabling multi-language Lunr mode & mixed tokenizer",
317713
+ supportedLanguages.join(", ")
317714
+ );
317715
+ this.use(import_lunr.default.multiLanguage(...supportedLanguages));
317716
+ this.tokenizer = function(x2) {
317717
+ return import_lunr.default.tokenizer(x2).concat(...supportedNonDefaultLanguages.map((lang) => import_lunr.default[lang].tokenizer(x2)));
317718
+ };
317719
+ } else if (maybePrimaryLanguageID !== "en") {
317720
+ this.use(import_lunr.default[maybePrimaryLanguageID]);
317721
+ }
317654
317722
  }
317655
317723
  this.ref("name");
317656
317724
  this.field("body");
@@ -317659,7 +317727,7 @@ ${inject.head ?? ""}`;
317659
317727
  for (const [uri, content] of Object.entries(contentCache)) {
317660
317728
  done12 += 1;
317661
317729
  indexProgress({ state: `adding entry for ${uri}`, total, done: done12 });
317662
- const label = content?.content?.labelInPlainText;
317730
+ const label = content?.content?.labelInPlainText?.normalize("NFKD").replace(/\p{Diacritic}/gu, "");
317663
317731
  if (label) {
317664
317732
  const entry = {
317665
317733
  name: uri,
@@ -317669,20 +317737,21 @@ ${inject.head ?? ""}`;
317669
317737
  } else {
317670
317738
  console.warn("No label for", uri);
317671
317739
  }
317740
+ if (label?.includes("echelle")) {
317741
+ console.debug("Entry", uri, label);
317742
+ }
317672
317743
  }
317673
- for (const [uri, desc] of Object.entries(resourceDescriptions)) {
317744
+ for (const [uri] of Object.entries(resourceDescriptions)) {
317674
317745
  done12 += 1;
317675
317746
  indexProgress({ state: "adding entries for subresources", total, done: done12 });
317676
- const lang = desc.primaryLanguageID;
317677
- if (lang && lang !== maybePrimaryLanguageID && lang !== "en" && import_lunr.default.hasOwnProperty(lang)) {
317678
- console.warn("Resource language is different from primary language, this may not work");
317679
- this.use(import_lunr.default.multiLanguage("en", lang));
317680
- }
317681
317747
  const rels = reader.resolve(uri);
317682
317748
  const relationsExcludingReferences = rels.filter(
317683
317749
  ([s2, p3, o2]) => p3 === "hasPart" && (s2 === ROOT_SUBJECT || s2 === uri) && !o2.startsWith("data:") && (!isURIString(o2) || !reader.exists(o2))
317684
317750
  );
317685
- const body = relationsExcludingReferences.map(([s2, p3, o2]) => o2).join("").trim();
317751
+ const body = relationsExcludingReferences.map(([, , o2]) => o2).join("").trim().normalize("NFKD").replace(/\p{Diacritic}/gu, "").trim();
317752
+ if (body.includes("echelle")) {
317753
+ console.debug("Subresource", uri, body);
317754
+ }
317686
317755
  if (body) {
317687
317756
  const entry = {
317688
317757
  name: uri,
@@ -317797,9 +317866,6 @@ async function* generateStaticSiteAssets(versions, currentVersionID, opts) {
317797
317866
  versionProgress(null);
317798
317867
  }
317799
317868
  }
317800
- function relativeGraph(relations, subj) {
317801
- return relations.filter(([s2]) => s2 !== ROOT_SUBJECT).map(([s2, p3, o2]) => [s2 === subj ? ROOT_SUBJECT : s2, p3, o2]);
317802
- }
317803
317869
 
317804
317870
  // dependencies.mts
317805
317871
  init_cjs_shim();
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@riboseinc/anafero-cli",
3
3
  "type": "module",
4
- "version": "0.0.52",
4
+ "version": "0.0.54",
5
5
  "packageManager": "yarn@4.5.0",
6
6
  "bin": {
7
7
  "build-site": "build-site.mjs"
8
8
  },
9
9
  "scripts": {
10
- "cbp": "yarn clean-all; yarn compile; yarn build-generator-builder && yarn build-generator -- --debug && sed 's#^import devtools#//import devtools#' build-site.mjs > ._tmp && mv ._tmp build-site.mjs && npm pack",
11
- "bp": "rm -f riboseinc-anafero-*.tgz; yarn build-generator -- --debug && npm pack",
10
+ "cbp": "yarn clean-all; yarn compile; yarn build-generator-builder && yarn build-generator -- --debug && sed 's#^import devtools#//import devtools#' build-site.mjs > ._tmp && mv ._tmp build-site.mjs && npm pack && mv *.tgz dist/",
11
+ "bp": "rm -f dist/riboseinc-anafero-*.tgz; yarn build-generator -- --debug && npm pack",
12
12
  "build-generator-builder": "yarn esbuild build-generator.mts --log-level=debug --packages=external --platform=node --target=node18 --minify=false --bundle --format=esm --outfile=build-generator.mjs",
13
13
  "build-generator": "yarn node build-generator.mjs --",
14
- "clean-all": "rm -f riboseinc-anafero-*.tgz build-generator.mjs build-site.mjs bootstrap.js *.css",
14
+ "clean-all": "find compiled -name 'README.rst' -prune -o -delete; rm -f dist/riboseinc-anafero-*.tgz build-generator.mjs build-site.mjs bootstrap.js *.css",
15
15
  "compile": "tsc --outdir compiled"
16
16
  },
17
17
  "dependencies": {
package/tsconfig.json CHANGED
@@ -18,9 +18,6 @@
18
18
  "exactOptionalPropertyTypes": true,
19
19
  "skipLibCheck": true,
20
20
 
21
- "allowImportingTsExtensions": true, // XXX
22
- "noEmit": true, // XXX
23
-
24
21
  "isolatedModules": true,
25
22
  "esModuleInterop": true,
26
23
 
Binary file