@riboseinc/anafero-cli 0.0.45 → 0.0.46

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
@@ -316514,17 +316514,21 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
316514
316514
  async function expandURI(uri) {
316515
316515
  const originalURI2 = originalURIs[uri];
316516
316516
  const isFileURI = (originalURI2 ?? uri).startsWith("file:");
316517
+ console.debug("Expanding URI", uri, originalURI2, entryPointURI2);
316517
316518
  let expanded;
316518
316519
  if (isFileURI) {
316519
- const fullFileURI = originalURI2 ?? (entryPointURI2 === uri ? originalURI2 ?? uri : joinFileURI(entryPointURI2, uri));
316520
+ const normalizedFileURI = originalURI2 ?? normalizeFileURI(
316521
+ uri,
316522
+ uri === entryPointURI2 ? void 0 : entryPointURI2
316523
+ );
316520
316524
  try {
316521
- resourceReaders[fullFileURI] ??= await startReader(fullFileURI);
316522
- const canonicalRootResourceURI = resourceReaders[fullFileURI]?.getCanonicalRootURI?.() ?? uri;
316523
- canonicalURIs[fullFileURI] = canonicalRootResourceURI;
316524
- originalURIs[canonicalRootResourceURI] = fullFileURI;
316525
+ resourceReaders[normalizedFileURI] ??= await startReader(normalizedFileURI);
316526
+ const canonicalRootResourceURI = resourceReaders[normalizedFileURI]?.getCanonicalRootURI?.() ?? uri;
316527
+ canonicalURIs[normalizedFileURI] = canonicalRootResourceURI;
316528
+ originalURIs[canonicalRootResourceURI] = normalizedFileURI;
316525
316529
  expanded = canonicalRootResourceURI;
316526
316530
  } catch (e3) {
316527
- expanded = fullFileURI;
316531
+ expanded = normalizedFileURI;
316528
316532
  }
316529
316533
  } else {
316530
316534
  expanded = `${uri}---${entryPointURI2}`;
@@ -316584,16 +316588,13 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
316584
316588
  seenEntryPoints
316585
316589
  );
316586
316590
  } else {
316591
+ console.warn("Unable to follow relation", relation.target, originalURI2);
316587
316592
  cache3.add(
316588
316593
  "unresolved-relations",
316589
316594
  [[subject, relation.predicate, relation.target]]
316590
316595
  );
316591
- console.debug(
316592
- "Not processing relations for",
316593
- relation.target,
316594
- originalURI2
316595
- );
316596
316596
  }
316597
+ } else {
316597
316598
  }
316598
316599
  } else {
316599
316600
  console.debug("URI relation is seen again", relation.target);
@@ -316844,10 +316845,17 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
316844
316845
  function isValidPathComponent(val) {
316845
316846
  return val.indexOf("/") < 0 && val.indexOf(":") < 0 && val.indexOf("#") < 0;
316846
316847
  }
316847
- function joinFileURI(baseFileURI, fileURI) {
316848
+ function normalizeFileURI(rawFileURI, baseFileURI) {
316849
+ const fileURI = rawFileURI.startsWith("./") ? rawFileURI.split("./")[1] : rawFileURI;
316850
+ if (fileURI.startsWith("./") || fileURI.startsWith("../")) {
316851
+ throw new Error("Malformed file URI");
316852
+ }
316853
+ if (baseFileURI === void 0) {
316854
+ return fileURI;
316855
+ }
316848
316856
  const baseFilePath = baseFileURI.startsWith("file:") ? baseFileURI.split("file:")[1] : void 0;
316849
316857
  if (!baseFilePath) {
316850
- throw new Error("Trying to expand a file: URI, but respective entry point is not using that scheme");
316858
+ throw new Error("Trying to normalize a file: URI, but base URI is not using that scheme");
316851
316859
  }
316852
316860
  const filePath = fileURI.split("file:")[1];
316853
316861
  const dirname3 = baseFilePath.indexOf("/") >= 1 ? baseFilePath.slice(0, baseFilePath.lastIndexOf("/")) : "";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riboseinc/anafero-cli",
3
3
  "type": "module",
4
- "version": "0.0.45",
4
+ "version": "0.0.46",
5
5
  "packageManager": "yarn@4.5.0",
6
6
  "bin": {
7
7
  "build-site": "build-site.mjs"
index be961a6..aa16391 100644
Binary file