@riboseinc/anafero-cli 0.0.43 → 0.0.45
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/bootstrap.css +4 -0
- package/bootstrap.css.map +2 -2
- package/bootstrap.js +13 -3
- package/bootstrap.js.map +2 -2
- package/build-site.css +4 -0
- package/build-site.mjs +146 -52
- package/package.json +1 -1
- package/riboseinc-anafero-cli-0.0.45.tgz +0 -0
- package/riboseinc-anafero-cli-0.0.43.tgz +0 -0
package/build-site.css
CHANGED
|
@@ -31102,6 +31102,10 @@ tbody.vars_bd693cb4_hm005a_spectrum-Table-body .vars_bd693cb4_hm005a_spectrum-Ta
|
|
|
31102
31102
|
margin-bottom: 10px;
|
|
31103
31103
|
}
|
|
31104
31104
|
.style_resource {
|
|
31105
|
+
::highlight(search-results) {
|
|
31106
|
+
background-color: #f06;
|
|
31107
|
+
color: white;
|
|
31108
|
+
}
|
|
31105
31109
|
padding: 0 2em 2em;
|
|
31106
31110
|
font-size: 16px;
|
|
31107
31111
|
font-weight: 330;
|
package/build-site.mjs
CHANGED
|
@@ -313148,7 +313148,8 @@ init_cjs_shim();
|
|
|
313148
313148
|
var import_react123 = __toESM(require_react(), 1);
|
|
313149
313149
|
var ResourceNavigationContext = (0, import_react123.createContext)({
|
|
313150
313150
|
locateResource: (uri) => "",
|
|
313151
|
-
resolvePlainTitle: async (uri, signal) => uri
|
|
313151
|
+
resolvePlainTitle: async (uri, signal) => uri,
|
|
313152
|
+
requestedResourceURI: void 0
|
|
313152
313153
|
});
|
|
313153
313154
|
|
|
313154
313155
|
// ../anafero/moduleRef.mts
|
|
@@ -316260,6 +316261,8 @@ var ResourceHelmet = function(props) {
|
|
|
316260
316261
|
var reactKeysPlugin = reactKeys();
|
|
316261
316262
|
var Resource = import_react127.default.forwardRef(function({
|
|
316262
316263
|
className,
|
|
316264
|
+
requestedResourceURI,
|
|
316265
|
+
searchQueryText,
|
|
316263
316266
|
useDependency,
|
|
316264
316267
|
locateResource,
|
|
316265
316268
|
document: document2,
|
|
@@ -316391,7 +316394,11 @@ var Resource = import_react127.default.forwardRef(function({
|
|
|
316391
316394
|
dangerouslySetInnerHTML: { __html: preRenderedHTML }
|
|
316392
316395
|
}
|
|
316393
316396
|
) : /* @__PURE__ */ import_react127.default.createElement(import_react127.default.Fragment, null, "\u2026");
|
|
316394
|
-
const mainView = somethingStillLoading || typeof window?.document?.createElement === "undefined" ? fallback : /* @__PURE__ */ import_react127.default.createElement(ResourceNavigationContext.Provider, { value: {
|
|
316397
|
+
const mainView = somethingStillLoading || typeof window?.document?.createElement === "undefined" ? fallback : /* @__PURE__ */ import_react127.default.createElement(ResourceNavigationContext.Provider, { value: {
|
|
316398
|
+
locateResource,
|
|
316399
|
+
resolvePlainTitle,
|
|
316400
|
+
requestedResourceURI
|
|
316401
|
+
} }, /* @__PURE__ */ import_react127.default.createElement(ErrorBoundaryWithCustomView_default, { fallback }, /* @__PURE__ */ import_react127.default.createElement(
|
|
316395
316402
|
ProseMirror,
|
|
316396
316403
|
{
|
|
316397
316404
|
defaultState: initialState3,
|
|
@@ -316479,7 +316486,11 @@ function processAttributes(el, locateResource, reverseResource, onIntegrityViola
|
|
|
316479
316486
|
|
|
316480
316487
|
// ../anafero/ContentReader.mts
|
|
316481
316488
|
init_cjs_shim();
|
|
316482
|
-
var makeContentReader = async function(entryPointURI, storeAdapters,
|
|
316489
|
+
var makeContentReader = async function(entryPointURI, storeAdapters, findContentAdapter, { fetchBlob, reportProgress, decodeXML, cache: cache3 }) {
|
|
316490
|
+
const canonicalURIs = {};
|
|
316491
|
+
const originalURIs = {};
|
|
316492
|
+
const contentAdapters = {};
|
|
316493
|
+
const resourceReaders = {};
|
|
316483
316494
|
let totalPathCount = 0;
|
|
316484
316495
|
let totalRelationCount = 0;
|
|
316485
316496
|
let doneRelationCount = 0;
|
|
@@ -316488,54 +316499,110 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316488
316499
|
await processRelations(entryPointURI, relationsProgress);
|
|
316489
316500
|
relationsProgress(null);
|
|
316490
316501
|
const [hierarchyProgress] = reportProgress("prepare site structure");
|
|
316491
|
-
processHierarchy(
|
|
316492
|
-
|
|
316493
|
-
|
|
316502
|
+
processHierarchy(
|
|
316503
|
+
canonicalURIs[entryPointURI] ?? entryPointURI,
|
|
316504
|
+
"",
|
|
316505
|
+
function reportHierarchyProgress(state) {
|
|
316506
|
+
hierarchyProgress({ state });
|
|
316507
|
+
}
|
|
316508
|
+
);
|
|
316494
316509
|
hierarchyProgress(null);
|
|
316495
316510
|
}
|
|
316496
316511
|
await process14();
|
|
316497
|
-
async function processRelations(entryPointURI2, onProgress) {
|
|
316512
|
+
async function processRelations(entryPointURI2, onProgress, _seenEntryPoints) {
|
|
316513
|
+
const seenEntryPoints = _seenEntryPoints ?? /* @__PURE__ */ new Set();
|
|
316514
|
+
async function expandURI(uri) {
|
|
316515
|
+
const originalURI2 = originalURIs[uri];
|
|
316516
|
+
const isFileURI = (originalURI2 ?? uri).startsWith("file:");
|
|
316517
|
+
let expanded;
|
|
316518
|
+
if (isFileURI) {
|
|
316519
|
+
const fullFileURI = originalURI2 ?? (entryPointURI2 === uri ? originalURI2 ?? uri : joinFileURI(entryPointURI2, uri));
|
|
316520
|
+
try {
|
|
316521
|
+
resourceReaders[fullFileURI] ??= await startReader(fullFileURI);
|
|
316522
|
+
const canonicalRootResourceURI = resourceReaders[fullFileURI]?.getCanonicalRootURI?.() ?? uri;
|
|
316523
|
+
canonicalURIs[fullFileURI] = canonicalRootResourceURI;
|
|
316524
|
+
originalURIs[canonicalRootResourceURI] = fullFileURI;
|
|
316525
|
+
expanded = canonicalRootResourceURI;
|
|
316526
|
+
} catch (e3) {
|
|
316527
|
+
expanded = fullFileURI;
|
|
316528
|
+
}
|
|
316529
|
+
} else {
|
|
316530
|
+
expanded = `${uri}---${entryPointURI2}`;
|
|
316531
|
+
}
|
|
316532
|
+
return expanded;
|
|
316533
|
+
}
|
|
316534
|
+
const subjectRelations = {};
|
|
316498
316535
|
function handleRelations(triples) {
|
|
316499
|
-
const
|
|
316500
|
-
for (const [s2, predicate, target] of triples) {
|
|
316536
|
+
for (const [s2, predicate, t3] of triples) {
|
|
316501
316537
|
const subject = s2 === ROOT_SUBJECT ? entryPointURI2 : s2;
|
|
316538
|
+
const target = t3;
|
|
316502
316539
|
subjectRelations[subject] ??= [];
|
|
316503
316540
|
subjectRelations[subject].push({ predicate, target });
|
|
316504
|
-
cache3.add(`edges-from/${subject}/${predicate}`, [target]);
|
|
316505
|
-
}
|
|
316506
|
-
for (const [subject, relations] of Object.entries(subjectRelations)) {
|
|
316507
|
-
cache3.add(`edges-from/${subject}`, relations);
|
|
316508
|
-
cache3.add(`${entryPointURI2}/subjects`, [subject]);
|
|
316509
316541
|
}
|
|
316510
316542
|
doneRelationCount += triples.length;
|
|
316511
316543
|
onProgress({ done: doneRelationCount, total: totalRelationCount });
|
|
316512
316544
|
}
|
|
316513
|
-
const
|
|
316514
|
-
|
|
316515
|
-
|
|
316516
|
-
reader
|
|
316517
|
-
|
|
316518
|
-
|
|
316519
|
-
|
|
316520
|
-
|
|
316545
|
+
const canonicalURI = await expandURI(entryPointURI2);
|
|
316546
|
+
const originalURI = originalURIs[canonicalURI] ?? canonicalURI;
|
|
316547
|
+
const reader = resourceReaders[originalURI];
|
|
316548
|
+
if (reader) {
|
|
316549
|
+
totalRelationCount += reader.estimateRelationCount();
|
|
316550
|
+
onProgress({ total: totalRelationCount });
|
|
316551
|
+
reader.discoverAllResources(handleRelations, {
|
|
316552
|
+
onProgress: function(msg) {
|
|
316553
|
+
onProgress({
|
|
316554
|
+
state: `${decodeURIComponent(canonicalURI)}->\u2026->${msg}`
|
|
316555
|
+
});
|
|
316556
|
+
}
|
|
316557
|
+
});
|
|
316558
|
+
}
|
|
316559
|
+
for (const [subject, relations] of Object.entries(subjectRelations)) {
|
|
316560
|
+
delete subjectRelations[subject];
|
|
316561
|
+
const expandedSubject = await expandURI(subject);
|
|
316562
|
+
const expandedRelations = [];
|
|
316563
|
+
for (const { predicate, target } of relations) {
|
|
316564
|
+
let expandedTarget;
|
|
316565
|
+
expandedTarget = isURIString(target) ? await expandURI(target) : target;
|
|
316566
|
+
cache3.add(`edges-from/${expandedSubject}/${predicate}`, [expandedTarget]);
|
|
316567
|
+
expandedRelations.push({ predicate, target: expandedTarget });
|
|
316521
316568
|
}
|
|
316522
|
-
|
|
316569
|
+
cache3.add(`edges-from/${expandedSubject}`, expandedRelations);
|
|
316570
|
+
cache3.add(`${entryPointURI2}/subjects`, [expandedSubject]);
|
|
316571
|
+
}
|
|
316523
316572
|
for (const subject of cache3.iterate(`${entryPointURI2}/subjects`)) {
|
|
316524
316573
|
for (const relation of cache3.iterate(`edges-from/${subject}`)) {
|
|
316525
316574
|
if (isURIString(relation.target)) {
|
|
316526
|
-
if (!
|
|
316527
|
-
|
|
316528
|
-
|
|
316529
|
-
|
|
316530
|
-
|
|
316531
|
-
|
|
316575
|
+
if (!seenEntryPoints.has(relation.target)) {
|
|
316576
|
+
seenEntryPoints.add(relation.target);
|
|
316577
|
+
const originalURI2 = originalURIs[relation.target] ?? relation.target;
|
|
316578
|
+
const isFileURI = originalURI2.startsWith("file:");
|
|
316579
|
+
if (isFileURI) {
|
|
316580
|
+
if (resourceReaders[originalURI2]) {
|
|
316581
|
+
await processRelations(
|
|
316582
|
+
relation.target,
|
|
316583
|
+
onProgress,
|
|
316584
|
+
seenEntryPoints
|
|
316585
|
+
);
|
|
316586
|
+
} else {
|
|
316587
|
+
cache3.add(
|
|
316588
|
+
"unresolved-relations",
|
|
316589
|
+
[[subject, relation.predicate, relation.target]]
|
|
316590
|
+
);
|
|
316591
|
+
console.debug(
|
|
316592
|
+
"Not processing relations for",
|
|
316593
|
+
relation.target,
|
|
316594
|
+
originalURI2
|
|
316595
|
+
);
|
|
316596
|
+
}
|
|
316532
316597
|
}
|
|
316598
|
+
} else {
|
|
316599
|
+
console.debug("URI relation is seen again", relation.target);
|
|
316533
316600
|
}
|
|
316534
316601
|
}
|
|
316535
316602
|
}
|
|
316536
316603
|
}
|
|
316537
316604
|
}
|
|
316538
|
-
function maybeGetPathComponent(relation) {
|
|
316605
|
+
function maybeGetPathComponent(contentAdapter, relation) {
|
|
316539
316606
|
if (!isURIString(relation.target) || contentAdapter.crossReferences?.(relation)) {
|
|
316540
316607
|
return null;
|
|
316541
316608
|
}
|
|
@@ -316611,6 +316678,11 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316611
316678
|
function getResourceGraph(resourceURI) {
|
|
316612
316679
|
if (!cache3.has(`graphs/${resourceURI}`)) {
|
|
316613
316680
|
cache3.add(`graphs/${resourceURI}`, []);
|
|
316681
|
+
const contentAdapter = contentAdapters[resourceURI];
|
|
316682
|
+
if (!contentAdapter) {
|
|
316683
|
+
console.error("Resource does not have associated content adapter on record", resourceURI);
|
|
316684
|
+
throw new Error("Resource does not have associated content adapter on record");
|
|
316685
|
+
}
|
|
316614
316686
|
const queue = [resourceURI];
|
|
316615
316687
|
while (queue.length > 0) {
|
|
316616
316688
|
const currentResource = queue.pop();
|
|
@@ -316637,7 +316709,8 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316637
316709
|
}
|
|
316638
316710
|
return cache3.list(`graphs/${resourceURI}`);
|
|
316639
316711
|
}
|
|
316640
|
-
function processResourceContents(resourceURI, containingResourcePath, _seen) {
|
|
316712
|
+
function processResourceContents(contentAdapter, resourceURI, containingResourcePath, _seen) {
|
|
316713
|
+
contentAdapters[resourceURI] = contentAdapter;
|
|
316641
316714
|
const seen = _seen ?? /* @__PURE__ */ new Set();
|
|
316642
316715
|
cache3.set({
|
|
316643
316716
|
[`path-for/${resourceURI}`]: `${containingResourcePath}#${resourceURI}`
|
|
@@ -316650,15 +316723,18 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316650
316723
|
continue;
|
|
316651
316724
|
} else {
|
|
316652
316725
|
seen.add(key);
|
|
316653
|
-
processResourceContents(rel.target, containingResourcePath, seen);
|
|
316726
|
+
processResourceContents(contentAdapter, rel.target, containingResourcePath, seen);
|
|
316654
316727
|
}
|
|
316655
316728
|
}
|
|
316656
316729
|
}
|
|
316657
316730
|
}
|
|
316658
316731
|
function processHierarchy(resourceURI, pathPrefix, onProgress) {
|
|
316732
|
+
const canonicalURI = canonicalURIs[resourceURI] ?? resourceURI;
|
|
316733
|
+
const contentAdapter = findContentAdapter(canonicalURI);
|
|
316734
|
+
contentAdapters[canonicalURI] = contentAdapter;
|
|
316659
316735
|
cache3.add("all-paths", [pathPrefix]);
|
|
316660
|
-
cache3.set({ [pathPrefix]:
|
|
316661
|
-
cache3.set({ [`path-for/${
|
|
316736
|
+
cache3.set({ [pathPrefix]: canonicalURI });
|
|
316737
|
+
cache3.set({ [`path-for/${canonicalURI}`]: pathPrefix });
|
|
316662
316738
|
onProgress(`${pathPrefix ?? "/"}: ${resourceURI}`);
|
|
316663
316739
|
totalPathCount += 1;
|
|
316664
316740
|
const parentPath = pathPrefix !== "" ? pathPrefix.includes("/") ? pathPrefix.slice(0, pathPrefix.lastIndexOf("/")) : "" : null;
|
|
@@ -316676,8 +316752,8 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316676
316752
|
[`${pathPrefix}/parents`]: parentPaths
|
|
316677
316753
|
});
|
|
316678
316754
|
}
|
|
316679
|
-
for (const rel of generateRelations(
|
|
316680
|
-
const maybePathComponent = maybeGetPathComponent(rel);
|
|
316755
|
+
for (const rel of generateRelations(canonicalURI)) {
|
|
316756
|
+
const maybePathComponent = maybeGetPathComponent(contentAdapter, rel);
|
|
316681
316757
|
if (maybePathComponent) {
|
|
316682
316758
|
if (!isValidPathComponent(maybePathComponent)) {
|
|
316683
316759
|
console.error("Generated path component is not valid", maybePathComponent, rel);
|
|
@@ -316685,26 +316761,31 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316685
316761
|
}
|
|
316686
316762
|
const newPath = pathPrefix ? `${pathPrefix}/${maybePathComponent}` : maybePathComponent;
|
|
316687
316763
|
processHierarchy(rel.target, newPath, onProgress);
|
|
316688
|
-
} else {
|
|
316689
|
-
processResourceContents(rel.target, pathPrefix);
|
|
316764
|
+
} else if (isURIString(rel.target)) {
|
|
316765
|
+
processResourceContents(contentAdapter, rel.target, pathPrefix);
|
|
316690
316766
|
}
|
|
316691
316767
|
}
|
|
316692
316768
|
}
|
|
316769
|
+
function getCachedResourceURIForPath(path3) {
|
|
316770
|
+
const resourceURI = cache3.get(path3);
|
|
316771
|
+
if (!resourceURI) {
|
|
316772
|
+
throw new Error("Unable to obtain resource URI for path");
|
|
316773
|
+
}
|
|
316774
|
+
const canonicalURI = canonicalURIs[resourceURI] ?? resourceURI;
|
|
316775
|
+
return canonicalURI;
|
|
316776
|
+
}
|
|
316693
316777
|
function* generateAllPaths() {
|
|
316694
316778
|
for (const path3 of cache3.iterate("all-paths")) {
|
|
316695
|
-
const resourceURI =
|
|
316696
|
-
if (!resourceURI) {
|
|
316697
|
-
throw new Error("Have path, but not its resource URI during processing");
|
|
316698
|
-
}
|
|
316779
|
+
const resourceURI = getCachedResourceURIForPath(path3);
|
|
316699
316780
|
yield {
|
|
316700
316781
|
path: path3,
|
|
316701
316782
|
resourceURI,
|
|
316702
316783
|
directDescendants: cache3.has(`${path3}/direct-descendants`) ? cache3.list(`${path3}/direct-descendants`).map((path4) => {
|
|
316703
|
-
const res =
|
|
316784
|
+
const res = getCachedResourceURIForPath(path4);
|
|
316704
316785
|
return [`/${path4}`, res, getResourceGraph(res)];
|
|
316705
316786
|
}) : [],
|
|
316706
316787
|
parentChain: path3 !== "" ? cache3.list(`${path3}/parents`).map((path4) => {
|
|
316707
|
-
const res =
|
|
316788
|
+
const res = getCachedResourceURIForPath(path4);
|
|
316708
316789
|
return [`/${path4}`, res, getResourceGraph(res)];
|
|
316709
316790
|
}) : []
|
|
316710
316791
|
};
|
|
@@ -316905,15 +316986,21 @@ async function* generateVersion(cfg, fetchBlobAtThisVersion, {
|
|
|
316905
316986
|
).join("\n");
|
|
316906
316987
|
const extraHead = `${dependencyCSS}
|
|
316907
316988
|
${inject.head ?? ""}`;
|
|
316908
|
-
const
|
|
316909
|
-
|
|
316910
|
-
|
|
316989
|
+
const findContentAdapter = function(resourceURI) {
|
|
316990
|
+
for (const [moduleID, contentAdapter] of Object.entries(contentAdapters)) {
|
|
316991
|
+
if (contentAdapter.canGenerateContent(resourceURI)) {
|
|
316992
|
+
return [moduleID, contentAdapter];
|
|
316993
|
+
}
|
|
316994
|
+
}
|
|
316995
|
+
throw new Error(`No content adapters report capability to generate content for ${resourceURI}`);
|
|
316911
316996
|
};
|
|
316912
316997
|
const [contentReaderInitProgress, contentReaderSubtask] = reportProgress("read source data");
|
|
316913
316998
|
const reader = await makeContentReader(
|
|
316914
316999
|
cfg.entryPoint,
|
|
316915
317000
|
Object.values(storeAdapters),
|
|
316916
|
-
|
|
317001
|
+
function _findContentAdapter(resourceURI) {
|
|
317002
|
+
return findContentAdapter(resourceURI)[1];
|
|
317003
|
+
},
|
|
316917
317004
|
{
|
|
316918
317005
|
fetchBlob: fetchBlobAtThisVersion,
|
|
316919
317006
|
decodeXML,
|
|
@@ -316947,6 +317034,13 @@ ${inject.head ?? ""}`;
|
|
|
316947
317034
|
const [allPathProgress, pathSubtask] = reportProgress("build page content", { total: totalPaths, done: done11 });
|
|
316948
317035
|
const hierarchicalResources = reader.generatePaths();
|
|
316949
317036
|
for (const { path: path3, resourceURI, parentChain, directDescendants } of hierarchicalResources) {
|
|
317037
|
+
let contentAdapter;
|
|
317038
|
+
try {
|
|
317039
|
+
contentAdapter = findContentAdapter(resourceURI)?.[1];
|
|
317040
|
+
} catch (e3) {
|
|
317041
|
+
console.error("Unable to find content adapter for resource", resourceURI, e3);
|
|
317042
|
+
continue;
|
|
317043
|
+
}
|
|
316950
317044
|
done11 += 1;
|
|
316951
317045
|
allPathProgress({ total: totalPaths, done: done11 });
|
|
316952
317046
|
if (path3.startsWith("/")) {
|
|
@@ -317024,14 +317118,14 @@ ${inject.head ?? ""}`;
|
|
|
317024
317118
|
{ head: extraHead, tail: inject.tail, htmlAttrs: inject.htmlAttrs },
|
|
317025
317119
|
maybeMainTitle ?? "Workspace",
|
|
317026
317120
|
resourceMeta.primaryLanguageID ?? maybePrimaryLanguageID ?? "en",
|
|
317027
|
-
function describe(relations2) {
|
|
317028
|
-
const maybeAdapter = findContentAdapter(
|
|
317121
|
+
function describe(relations2, uri) {
|
|
317122
|
+
const maybeAdapter = findContentAdapter(uri);
|
|
317029
317123
|
return maybeAdapter ? maybeAdapter[1].describe(relations2) : null;
|
|
317030
317124
|
},
|
|
317031
317125
|
function generateContent(relations2, uri) {
|
|
317032
317126
|
if (!contentCache[uri]) {
|
|
317033
317127
|
let content;
|
|
317034
|
-
const maybeAdapter = findContentAdapter(
|
|
317128
|
+
const maybeAdapter = findContentAdapter(uri);
|
|
317035
317129
|
if (maybeAdapter) {
|
|
317036
317130
|
try {
|
|
317037
317131
|
content = maybeAdapter[1].generateContent(
|
|
@@ -317060,7 +317154,7 @@ ${inject.head ?? ""}`;
|
|
|
317060
317154
|
resourceGraph.push([inPageResourceID, "isDefinedBy", `${path3}/resource.json`]);
|
|
317061
317155
|
resourceDescriptions[inPageResourceID] = {
|
|
317062
317156
|
primaryLanguageID: maybePrimaryLanguageID,
|
|
317063
|
-
...
|
|
317157
|
+
...maybeAdapter[1].describe(relativeGraph(relations2, inPageResourceID))
|
|
317064
317158
|
};
|
|
317065
317159
|
} else {
|
|
317066
317160
|
console.warn(
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|