@riboseinc/anafero-cli 0.0.45 → 0.0.47

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