@riboseinc/anafero-cli 0.0.42 → 0.0.44
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.js +81 -39
- package/bootstrap.js.map +4 -4
- package/build-site.mjs +194 -98
- package/package.json +1 -1
- package/riboseinc-anafero-cli-0.0.44.tgz +0 -0
- package/riboseinc-anafero-cli-0.0.42.tgz +0 -0
package/build-site.mjs
CHANGED
|
@@ -313125,6 +313125,7 @@ __export(anafero_exports, {
|
|
|
313125
313125
|
gatherDescribedResourcesFromJsonifiedProseMirrorNode: () => gatherDescribedResourcesFromJsonifiedProseMirrorNode,
|
|
313126
313126
|
gatherTextFromJsonifiedProseMirrorNode: () => gatherTextFromJsonifiedProseMirrorNode,
|
|
313127
313127
|
getAllParentPaths: () => getAllParentPaths,
|
|
313128
|
+
isURIString: () => isURIString,
|
|
313128
313129
|
makeDummyInMemoryCache: () => makeDummyInMemoryCache,
|
|
313129
313130
|
parseModuleRef: () => parseModuleRef,
|
|
313130
313131
|
stripLeadingSlash: () => stripLeadingSlash,
|
|
@@ -313192,6 +313193,38 @@ function getAllParentPaths(aPath) {
|
|
|
313192
313193
|
return parents;
|
|
313193
313194
|
}
|
|
313194
313195
|
|
|
313196
|
+
// ../anafero/URI.mts
|
|
313197
|
+
init_cjs_shim();
|
|
313198
|
+
function makeURI(input) {
|
|
313199
|
+
const match19 = ("" + input).match(pattern2);
|
|
313200
|
+
if (!match19) {
|
|
313201
|
+
throw new SyntaxError("Invalid URI");
|
|
313202
|
+
}
|
|
313203
|
+
return {
|
|
313204
|
+
protocol: match19[1],
|
|
313205
|
+
slashes: match19[2],
|
|
313206
|
+
authority: match19[3],
|
|
313207
|
+
host: match19[4],
|
|
313208
|
+
port: match19[5],
|
|
313209
|
+
path: match19[6] || match19[7] || match19[8],
|
|
313210
|
+
query: match19[9],
|
|
313211
|
+
hash: match19[10]
|
|
313212
|
+
};
|
|
313213
|
+
}
|
|
313214
|
+
function isURIString(input) {
|
|
313215
|
+
return ["urn:", "http:", "https:", "ftp:", "file:"].find((prefix) => input.startsWith(prefix)) !== void 0;
|
|
313216
|
+
if (input.startsWith("urn:")) {
|
|
313217
|
+
return true;
|
|
313218
|
+
}
|
|
313219
|
+
try {
|
|
313220
|
+
makeURI(input);
|
|
313221
|
+
return true;
|
|
313222
|
+
} catch (e3) {
|
|
313223
|
+
return false;
|
|
313224
|
+
}
|
|
313225
|
+
}
|
|
313226
|
+
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})*))?");
|
|
313227
|
+
|
|
313195
313228
|
// ../firelight-gui/loader.mts
|
|
313196
313229
|
init_cjs_shim();
|
|
313197
313230
|
|
|
@@ -316446,41 +316479,11 @@ function processAttributes(el, locateResource, reverseResource, onIntegrityViola
|
|
|
316446
316479
|
|
|
316447
316480
|
// ../anafero/ContentReader.mts
|
|
316448
316481
|
init_cjs_shim();
|
|
316449
|
-
|
|
316450
|
-
|
|
316451
|
-
|
|
316452
|
-
|
|
316453
|
-
const
|
|
316454
|
-
if (!match19) {
|
|
316455
|
-
throw new SyntaxError("Invalid URI");
|
|
316456
|
-
}
|
|
316457
|
-
return {
|
|
316458
|
-
protocol: match19[1],
|
|
316459
|
-
slashes: match19[2],
|
|
316460
|
-
authority: match19[3],
|
|
316461
|
-
host: match19[4],
|
|
316462
|
-
port: match19[5],
|
|
316463
|
-
path: match19[6] || match19[7] || match19[8],
|
|
316464
|
-
query: match19[9],
|
|
316465
|
-
hash: match19[10]
|
|
316466
|
-
};
|
|
316467
|
-
}
|
|
316468
|
-
function isURIString(input) {
|
|
316469
|
-
return ["urn:", "http:", "https:", "ftp:", "file:"].find((prefix) => input.startsWith(prefix)) !== void 0;
|
|
316470
|
-
if (input.startsWith("urn:")) {
|
|
316471
|
-
return true;
|
|
316472
|
-
}
|
|
316473
|
-
try {
|
|
316474
|
-
makeURI(input);
|
|
316475
|
-
return true;
|
|
316476
|
-
} catch (e3) {
|
|
316477
|
-
return false;
|
|
316478
|
-
}
|
|
316479
|
-
}
|
|
316480
|
-
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})*))?");
|
|
316481
|
-
|
|
316482
|
-
// ../anafero/ContentReader.mts
|
|
316483
|
-
var makeContentReader = async function(entryPointURI, storeAdapters, contentAdapter, { fetchBlob, reportProgress, decodeXML, cache: cache3 }) {
|
|
316482
|
+
var makeContentReader = async function(entryPointURI, storeAdapters, findContentAdapter, { fetchBlob, reportProgress, decodeXML, cache: cache3 }) {
|
|
316483
|
+
const canonicalURIs = {};
|
|
316484
|
+
const originalURIs = {};
|
|
316485
|
+
const contentAdapters = {};
|
|
316486
|
+
const resourceReaders = {};
|
|
316484
316487
|
let totalPathCount = 0;
|
|
316485
316488
|
let totalRelationCount = 0;
|
|
316486
316489
|
let doneRelationCount = 0;
|
|
@@ -316489,54 +316492,110 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316489
316492
|
await processRelations(entryPointURI, relationsProgress);
|
|
316490
316493
|
relationsProgress(null);
|
|
316491
316494
|
const [hierarchyProgress] = reportProgress("prepare site structure");
|
|
316492
|
-
processHierarchy(
|
|
316493
|
-
|
|
316494
|
-
|
|
316495
|
+
processHierarchy(
|
|
316496
|
+
canonicalURIs[entryPointURI] ?? entryPointURI,
|
|
316497
|
+
"",
|
|
316498
|
+
function reportHierarchyProgress(state) {
|
|
316499
|
+
hierarchyProgress({ state });
|
|
316500
|
+
}
|
|
316501
|
+
);
|
|
316495
316502
|
hierarchyProgress(null);
|
|
316496
316503
|
}
|
|
316497
316504
|
await process14();
|
|
316498
|
-
async function processRelations(entryPointURI2, onProgress) {
|
|
316505
|
+
async function processRelations(entryPointURI2, onProgress, _seenEntryPoints) {
|
|
316506
|
+
const seenEntryPoints = _seenEntryPoints ?? /* @__PURE__ */ new Set();
|
|
316507
|
+
async function expandURI(uri) {
|
|
316508
|
+
const originalURI2 = originalURIs[uri];
|
|
316509
|
+
const isFileURI = (originalURI2 ?? uri).startsWith("file:");
|
|
316510
|
+
let expanded;
|
|
316511
|
+
if (isFileURI) {
|
|
316512
|
+
const fullFileURI = originalURI2 ?? (entryPointURI2 === uri ? originalURI2 ?? uri : joinFileURI(entryPointURI2, uri));
|
|
316513
|
+
try {
|
|
316514
|
+
resourceReaders[fullFileURI] ??= await startReader(fullFileURI);
|
|
316515
|
+
const canonicalRootResourceURI = resourceReaders[fullFileURI]?.getCanonicalRootURI?.() ?? uri;
|
|
316516
|
+
canonicalURIs[fullFileURI] = canonicalRootResourceURI;
|
|
316517
|
+
originalURIs[canonicalRootResourceURI] = fullFileURI;
|
|
316518
|
+
expanded = canonicalRootResourceURI;
|
|
316519
|
+
} catch (e3) {
|
|
316520
|
+
expanded = fullFileURI;
|
|
316521
|
+
}
|
|
316522
|
+
} else {
|
|
316523
|
+
expanded = `${uri}---${entryPointURI2}`;
|
|
316524
|
+
}
|
|
316525
|
+
return expanded;
|
|
316526
|
+
}
|
|
316527
|
+
const subjectRelations = {};
|
|
316499
316528
|
function handleRelations(triples) {
|
|
316500
|
-
const
|
|
316501
|
-
for (const [s2, predicate, target] of triples) {
|
|
316529
|
+
for (const [s2, predicate, t3] of triples) {
|
|
316502
316530
|
const subject = s2 === ROOT_SUBJECT ? entryPointURI2 : s2;
|
|
316531
|
+
const target = t3;
|
|
316503
316532
|
subjectRelations[subject] ??= [];
|
|
316504
316533
|
subjectRelations[subject].push({ predicate, target });
|
|
316505
|
-
cache3.add(`edges-from/${subject}/${predicate}`, [target]);
|
|
316506
|
-
}
|
|
316507
|
-
for (const [subject, relations] of Object.entries(subjectRelations)) {
|
|
316508
|
-
cache3.add(`edges-from/${subject}`, relations);
|
|
316509
|
-
cache3.add(`${entryPointURI2}/subjects`, [subject]);
|
|
316510
316534
|
}
|
|
316511
316535
|
doneRelationCount += triples.length;
|
|
316512
316536
|
onProgress({ done: doneRelationCount, total: totalRelationCount });
|
|
316513
316537
|
}
|
|
316514
|
-
const
|
|
316515
|
-
|
|
316516
|
-
|
|
316517
|
-
reader
|
|
316518
|
-
|
|
316519
|
-
|
|
316520
|
-
|
|
316521
|
-
|
|
316538
|
+
const canonicalURI = await expandURI(entryPointURI2);
|
|
316539
|
+
const originalURI = originalURIs[canonicalURI] ?? canonicalURI;
|
|
316540
|
+
const reader = resourceReaders[originalURI];
|
|
316541
|
+
if (reader) {
|
|
316542
|
+
totalRelationCount += reader.estimateRelationCount();
|
|
316543
|
+
onProgress({ total: totalRelationCount });
|
|
316544
|
+
reader.discoverAllResources(handleRelations, {
|
|
316545
|
+
onProgress: function(msg) {
|
|
316546
|
+
onProgress({
|
|
316547
|
+
state: `${decodeURIComponent(canonicalURI)}->\u2026->${msg}`
|
|
316548
|
+
});
|
|
316549
|
+
}
|
|
316550
|
+
});
|
|
316551
|
+
}
|
|
316552
|
+
for (const [subject, relations] of Object.entries(subjectRelations)) {
|
|
316553
|
+
delete subjectRelations[subject];
|
|
316554
|
+
const expandedSubject = await expandURI(subject);
|
|
316555
|
+
const expandedRelations = [];
|
|
316556
|
+
for (const { predicate, target } of relations) {
|
|
316557
|
+
let expandedTarget;
|
|
316558
|
+
expandedTarget = isURIString(target) ? await expandURI(target) : target;
|
|
316559
|
+
cache3.add(`edges-from/${expandedSubject}/${predicate}`, [expandedTarget]);
|
|
316560
|
+
expandedRelations.push({ predicate, target: expandedTarget });
|
|
316522
316561
|
}
|
|
316523
|
-
|
|
316562
|
+
cache3.add(`edges-from/${expandedSubject}`, expandedRelations);
|
|
316563
|
+
cache3.add(`${entryPointURI2}/subjects`, [expandedSubject]);
|
|
316564
|
+
}
|
|
316524
316565
|
for (const subject of cache3.iterate(`${entryPointURI2}/subjects`)) {
|
|
316525
316566
|
for (const relation of cache3.iterate(`edges-from/${subject}`)) {
|
|
316526
316567
|
if (isURIString(relation.target)) {
|
|
316527
|
-
if (!
|
|
316528
|
-
|
|
316529
|
-
|
|
316530
|
-
|
|
316531
|
-
|
|
316532
|
-
|
|
316568
|
+
if (!seenEntryPoints.has(relation.target)) {
|
|
316569
|
+
seenEntryPoints.add(relation.target);
|
|
316570
|
+
const originalURI2 = originalURIs[relation.target] ?? relation.target;
|
|
316571
|
+
const isFileURI = originalURI2.startsWith("file:");
|
|
316572
|
+
if (isFileURI) {
|
|
316573
|
+
if (resourceReaders[originalURI2]) {
|
|
316574
|
+
await processRelations(
|
|
316575
|
+
relation.target,
|
|
316576
|
+
onProgress,
|
|
316577
|
+
seenEntryPoints
|
|
316578
|
+
);
|
|
316579
|
+
} else {
|
|
316580
|
+
cache3.add(
|
|
316581
|
+
"unresolved-relations",
|
|
316582
|
+
[[subject, relation.predicate, relation.target]]
|
|
316583
|
+
);
|
|
316584
|
+
console.debug(
|
|
316585
|
+
"Not processing relations for",
|
|
316586
|
+
relation.target,
|
|
316587
|
+
originalURI2
|
|
316588
|
+
);
|
|
316589
|
+
}
|
|
316533
316590
|
}
|
|
316591
|
+
} else {
|
|
316592
|
+
console.debug("URI relation is seen again", relation.target);
|
|
316534
316593
|
}
|
|
316535
316594
|
}
|
|
316536
316595
|
}
|
|
316537
316596
|
}
|
|
316538
316597
|
}
|
|
316539
|
-
function maybeGetPathComponent(relation) {
|
|
316598
|
+
function maybeGetPathComponent(contentAdapter, relation) {
|
|
316540
316599
|
if (!isURIString(relation.target) || contentAdapter.crossReferences?.(relation)) {
|
|
316541
316600
|
return null;
|
|
316542
316601
|
}
|
|
@@ -316545,10 +316604,11 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316545
316604
|
}
|
|
316546
316605
|
const maybeContributingRelations = contentAdapter.contributingToHierarchy.filter((r4) => r4[0] === relation.predicate).map((r4) => r4.slice(1));
|
|
316547
316606
|
if (maybeContributingRelations.length > 0) {
|
|
316548
|
-
|
|
316607
|
+
const result = resolvePredicateChainsToFirstValue(
|
|
316549
316608
|
relation.target,
|
|
316550
316609
|
maybeContributingRelations
|
|
316551
316610
|
);
|
|
316611
|
+
return result ? result.replaceAll(":", "_").replaceAll("/", "_") : result;
|
|
316552
316612
|
}
|
|
316553
316613
|
return null;
|
|
316554
316614
|
}
|
|
@@ -316610,6 +316670,12 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316610
316670
|
}
|
|
316611
316671
|
function getResourceGraph(resourceURI) {
|
|
316612
316672
|
if (!cache3.has(`graphs/${resourceURI}`)) {
|
|
316673
|
+
cache3.add(`graphs/${resourceURI}`, []);
|
|
316674
|
+
const contentAdapter = contentAdapters[resourceURI];
|
|
316675
|
+
if (!contentAdapter) {
|
|
316676
|
+
console.error("Resource does not have associated content adapter on record", resourceURI);
|
|
316677
|
+
throw new Error("Resource does not have associated content adapter on record");
|
|
316678
|
+
}
|
|
316613
316679
|
const queue = [resourceURI];
|
|
316614
316680
|
while (queue.length > 0) {
|
|
316615
316681
|
const currentResource = queue.pop();
|
|
@@ -316636,7 +316702,8 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316636
316702
|
}
|
|
316637
316703
|
return cache3.list(`graphs/${resourceURI}`);
|
|
316638
316704
|
}
|
|
316639
|
-
function processResourceContents(resourceURI, containingResourcePath, _seen) {
|
|
316705
|
+
function processResourceContents(contentAdapter, resourceURI, containingResourcePath, _seen) {
|
|
316706
|
+
contentAdapters[resourceURI] = contentAdapter;
|
|
316640
316707
|
const seen = _seen ?? /* @__PURE__ */ new Set();
|
|
316641
316708
|
cache3.set({
|
|
316642
316709
|
[`path-for/${resourceURI}`]: `${containingResourcePath}#${resourceURI}`
|
|
@@ -316649,15 +316716,18 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316649
316716
|
continue;
|
|
316650
316717
|
} else {
|
|
316651
316718
|
seen.add(key);
|
|
316652
|
-
processResourceContents(rel.target, containingResourcePath, seen);
|
|
316719
|
+
processResourceContents(contentAdapter, rel.target, containingResourcePath, seen);
|
|
316653
316720
|
}
|
|
316654
316721
|
}
|
|
316655
316722
|
}
|
|
316656
316723
|
}
|
|
316657
316724
|
function processHierarchy(resourceURI, pathPrefix, onProgress) {
|
|
316725
|
+
const canonicalURI = canonicalURIs[resourceURI] ?? resourceURI;
|
|
316726
|
+
const contentAdapter = findContentAdapter(canonicalURI);
|
|
316727
|
+
contentAdapters[canonicalURI] = contentAdapter;
|
|
316658
316728
|
cache3.add("all-paths", [pathPrefix]);
|
|
316659
|
-
cache3.set({ [pathPrefix]:
|
|
316660
|
-
cache3.set({ [`path-for/${
|
|
316729
|
+
cache3.set({ [pathPrefix]: canonicalURI });
|
|
316730
|
+
cache3.set({ [`path-for/${canonicalURI}`]: pathPrefix });
|
|
316661
316731
|
onProgress(`${pathPrefix ?? "/"}: ${resourceURI}`);
|
|
316662
316732
|
totalPathCount += 1;
|
|
316663
316733
|
const parentPath = pathPrefix !== "" ? pathPrefix.includes("/") ? pathPrefix.slice(0, pathPrefix.lastIndexOf("/")) : "" : null;
|
|
@@ -316675,35 +316745,40 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316675
316745
|
[`${pathPrefix}/parents`]: parentPaths
|
|
316676
316746
|
});
|
|
316677
316747
|
}
|
|
316678
|
-
for (const rel of generateRelations(
|
|
316679
|
-
const maybePathComponent = maybeGetPathComponent(rel);
|
|
316748
|
+
for (const rel of generateRelations(canonicalURI)) {
|
|
316749
|
+
const maybePathComponent = maybeGetPathComponent(contentAdapter, rel);
|
|
316680
316750
|
if (maybePathComponent) {
|
|
316681
316751
|
if (!isValidPathComponent(maybePathComponent)) {
|
|
316752
|
+
console.error("Generated path component is not valid", maybePathComponent, rel);
|
|
316682
316753
|
throw new Error("Generated path component is not valid");
|
|
316683
316754
|
}
|
|
316684
|
-
const
|
|
316685
|
-
const newPath = pathPrefix ? `${pathPrefix}/${encodedComponent}` : encodedComponent;
|
|
316755
|
+
const newPath = pathPrefix ? `${pathPrefix}/${maybePathComponent}` : maybePathComponent;
|
|
316686
316756
|
processHierarchy(rel.target, newPath, onProgress);
|
|
316687
|
-
} else {
|
|
316688
|
-
processResourceContents(rel.target, pathPrefix);
|
|
316757
|
+
} else if (isURIString(rel.target)) {
|
|
316758
|
+
processResourceContents(contentAdapter, rel.target, pathPrefix);
|
|
316689
316759
|
}
|
|
316690
316760
|
}
|
|
316691
316761
|
}
|
|
316762
|
+
function getCachedResourceURIForPath(path3) {
|
|
316763
|
+
const resourceURI = cache3.get(path3);
|
|
316764
|
+
if (!resourceURI) {
|
|
316765
|
+
throw new Error("Unable to obtain resource URI for path");
|
|
316766
|
+
}
|
|
316767
|
+
const canonicalURI = canonicalURIs[resourceURI] ?? resourceURI;
|
|
316768
|
+
return canonicalURI;
|
|
316769
|
+
}
|
|
316692
316770
|
function* generateAllPaths() {
|
|
316693
316771
|
for (const path3 of cache3.iterate("all-paths")) {
|
|
316694
|
-
const resourceURI =
|
|
316695
|
-
if (!resourceURI) {
|
|
316696
|
-
throw new Error("Have path, but not its resource URI during processing");
|
|
316697
|
-
}
|
|
316772
|
+
const resourceURI = getCachedResourceURIForPath(path3);
|
|
316698
316773
|
yield {
|
|
316699
316774
|
path: path3,
|
|
316700
316775
|
resourceURI,
|
|
316701
316776
|
directDescendants: cache3.has(`${path3}/direct-descendants`) ? cache3.list(`${path3}/direct-descendants`).map((path4) => {
|
|
316702
|
-
const res =
|
|
316777
|
+
const res = getCachedResourceURIForPath(path4);
|
|
316703
316778
|
return [`/${path4}`, res, getResourceGraph(res)];
|
|
316704
316779
|
}) : [],
|
|
316705
316780
|
parentChain: path3 !== "" ? cache3.list(`${path3}/parents`).map((path4) => {
|
|
316706
|
-
const res =
|
|
316781
|
+
const res = getCachedResourceURIForPath(path4);
|
|
316707
316782
|
return [`/${path4}`, res, getResourceGraph(res)];
|
|
316708
316783
|
}) : []
|
|
316709
316784
|
};
|
|
@@ -316751,16 +316826,16 @@ var makeContentReader = async function(entryPointURI, storeAdapters, contentAdap
|
|
|
316751
316826
|
const validAdapters = storeAdapters.filter((mod) => mod.canResolve(resourceURI) && mod.readerFromBlob !== void 0);
|
|
316752
316827
|
for (const mod of validAdapters) {
|
|
316753
316828
|
try {
|
|
316754
|
-
|
|
316829
|
+
const reader = (await mod.readerFromBlob(blob, { decodeXML }))[1];
|
|
316830
|
+
return reader;
|
|
316755
316831
|
} catch (e3) {
|
|
316756
|
-
console.warn("Failed to create resource reader for URI", mod.name, resourceURI);
|
|
316757
316832
|
}
|
|
316758
316833
|
}
|
|
316759
|
-
throw new Error(
|
|
316834
|
+
throw new Error(`Failed to initialize resource reader for ${resourceURI}`);
|
|
316760
316835
|
}
|
|
316761
316836
|
};
|
|
316762
316837
|
function isValidPathComponent(val) {
|
|
316763
|
-
return val.indexOf("/") < 0 && val.indexOf("#") < 0;
|
|
316838
|
+
return val.indexOf("/") < 0 && val.indexOf(":") < 0 && val.indexOf("#") < 0;
|
|
316764
316839
|
}
|
|
316765
316840
|
function joinFileURI(baseFileURI, fileURI) {
|
|
316766
316841
|
const baseFilePath = baseFileURI.startsWith("file:") ? baseFileURI.split("file:")[1] : void 0;
|
|
@@ -316904,15 +316979,21 @@ async function* generateVersion(cfg, fetchBlobAtThisVersion, {
|
|
|
316904
316979
|
).join("\n");
|
|
316905
316980
|
const extraHead = `${dependencyCSS}
|
|
316906
316981
|
${inject.head ?? ""}`;
|
|
316907
|
-
const
|
|
316908
|
-
|
|
316909
|
-
|
|
316982
|
+
const findContentAdapter = function(resourceURI) {
|
|
316983
|
+
for (const [moduleID, contentAdapter] of Object.entries(contentAdapters)) {
|
|
316984
|
+
if (contentAdapter.canGenerateContent(resourceURI)) {
|
|
316985
|
+
return [moduleID, contentAdapter];
|
|
316986
|
+
}
|
|
316987
|
+
}
|
|
316988
|
+
throw new Error(`No content adapters report capability to generate content for ${resourceURI}`);
|
|
316910
316989
|
};
|
|
316911
316990
|
const [contentReaderInitProgress, contentReaderSubtask] = reportProgress("read source data");
|
|
316912
316991
|
const reader = await makeContentReader(
|
|
316913
316992
|
cfg.entryPoint,
|
|
316914
316993
|
Object.values(storeAdapters),
|
|
316915
|
-
|
|
316994
|
+
function _findContentAdapter(resourceURI) {
|
|
316995
|
+
return findContentAdapter(resourceURI)[1];
|
|
316996
|
+
},
|
|
316916
316997
|
{
|
|
316917
316998
|
fetchBlob: fetchBlobAtThisVersion,
|
|
316918
316999
|
decodeXML,
|
|
@@ -316946,6 +317027,13 @@ ${inject.head ?? ""}`;
|
|
|
316946
317027
|
const [allPathProgress, pathSubtask] = reportProgress("build page content", { total: totalPaths, done: done11 });
|
|
316947
317028
|
const hierarchicalResources = reader.generatePaths();
|
|
316948
317029
|
for (const { path: path3, resourceURI, parentChain, directDescendants } of hierarchicalResources) {
|
|
317030
|
+
let contentAdapter;
|
|
317031
|
+
try {
|
|
317032
|
+
contentAdapter = findContentAdapter(resourceURI)?.[1];
|
|
317033
|
+
} catch (e3) {
|
|
317034
|
+
console.error("Unable to find content adapter for resource", resourceURI, e3);
|
|
317035
|
+
continue;
|
|
317036
|
+
}
|
|
316949
317037
|
done11 += 1;
|
|
316950
317038
|
allPathProgress({ total: totalPaths, done: done11 });
|
|
316951
317039
|
if (path3.startsWith("/")) {
|
|
@@ -316982,14 +317070,22 @@ ${inject.head ?? ""}`;
|
|
|
316982
317070
|
for (const [, , o2] of relations) {
|
|
316983
317071
|
if (o2.startsWith("file:")) {
|
|
316984
317072
|
const filePath = o2.split("file:")[1];
|
|
316985
|
-
const filename =
|
|
317073
|
+
const filename = o2.replaceAll("/", "_").replaceAll(":", "_");
|
|
316986
317074
|
if (!assetsToWrite[filename]) {
|
|
316987
|
-
|
|
316988
|
-
|
|
316989
|
-
|
|
316990
|
-
|
|
316991
|
-
|
|
316992
|
-
|
|
317075
|
+
try {
|
|
317076
|
+
assetsToWrite[filename] = await fetchBlobAtThisVersion(filePath);
|
|
317077
|
+
resourceGraph.push([
|
|
317078
|
+
o2,
|
|
317079
|
+
"isDownloadableAt",
|
|
317080
|
+
filename
|
|
317081
|
+
]);
|
|
317082
|
+
resourceMap[filename] = o2;
|
|
317083
|
+
resourceDescriptions[o2] = {
|
|
317084
|
+
labelInPlainText: filePath
|
|
317085
|
+
};
|
|
317086
|
+
} catch (e3) {
|
|
317087
|
+
console.error("Failed to fetch asset", filePath);
|
|
317088
|
+
}
|
|
316993
317089
|
}
|
|
316994
317090
|
}
|
|
316995
317091
|
}
|
|
@@ -317015,14 +317111,14 @@ ${inject.head ?? ""}`;
|
|
|
317015
317111
|
{ head: extraHead, tail: inject.tail, htmlAttrs: inject.htmlAttrs },
|
|
317016
317112
|
maybeMainTitle ?? "Workspace",
|
|
317017
317113
|
resourceMeta.primaryLanguageID ?? maybePrimaryLanguageID ?? "en",
|
|
317018
|
-
function describe(relations2) {
|
|
317019
|
-
const maybeAdapter = findContentAdapter(
|
|
317114
|
+
function describe(relations2, uri) {
|
|
317115
|
+
const maybeAdapter = findContentAdapter(uri);
|
|
317020
317116
|
return maybeAdapter ? maybeAdapter[1].describe(relations2) : null;
|
|
317021
317117
|
},
|
|
317022
317118
|
function generateContent(relations2, uri) {
|
|
317023
317119
|
if (!contentCache[uri]) {
|
|
317024
317120
|
let content;
|
|
317025
|
-
const maybeAdapter = findContentAdapter(
|
|
317121
|
+
const maybeAdapter = findContentAdapter(uri);
|
|
317026
317122
|
if (maybeAdapter) {
|
|
317027
317123
|
try {
|
|
317028
317124
|
content = maybeAdapter[1].generateContent(
|
|
@@ -317051,7 +317147,7 @@ ${inject.head ?? ""}`;
|
|
|
317051
317147
|
resourceGraph.push([inPageResourceID, "isDefinedBy", `${path3}/resource.json`]);
|
|
317052
317148
|
resourceDescriptions[inPageResourceID] = {
|
|
317053
317149
|
primaryLanguageID: maybePrimaryLanguageID,
|
|
317054
|
-
...
|
|
317150
|
+
...maybeAdapter[1].describe(relativeGraph(relations2, inPageResourceID))
|
|
317055
317151
|
};
|
|
317056
317152
|
} else {
|
|
317057
317153
|
console.warn(
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|