@riboseinc/anafero-cli 0.0.47 → 0.0.48

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 CHANGED
@@ -130837,13 +130837,13 @@ schema (${ast._tag}): ${ast}`;
130837
130837
  const [initialResourceData, setInitialResourceData] = (0, import_react212.useState)(void 0);
130838
130838
  const resourceMap = versionDeps?.["/resource-map.json"];
130839
130839
  const reverseResourceMap = (0, import_react212.useMemo)(() => !resourceMap ? void 0 : Object.fromEntries(Object.entries(resourceMap).map(([k, v]) => [v, k])), [resourceMap]);
130840
+ const resourceDescriptions = versionDeps?.["/resource-descriptions.json"];
130840
130841
  const nonCurrentActiveVersionID = (0, import_react212.useMemo)(
130841
130842
  () => !sharedDeps?.["/versions.json"] ? void 0 : Object.keys(sharedDeps["/versions.json"].versions).find(
130842
130843
  (vID) => window.location.pathname.startsWith(`${pathPrefix ?? "/"}${vID}/`)
130843
130844
  ) ?? null,
130844
130845
  [sharedDeps?.["/versions.json"]]
130845
130846
  );
130846
- const resourceDescriptions = versionDeps?.["/resource-descriptions.json"];
130847
130847
  const versioning = (0, import_react212.useMemo)(() => {
130848
130848
  if (!sharedDeps?.["/versions.json"] || nonCurrentActiveVersionID === void 0) {
130849
130849
  return void 0;
@@ -130855,33 +130855,33 @@ schema (${ast._tag}): ${ast}`;
130855
130855
  });
130856
130856
  }, [nonCurrentActiveVersionID, sharedDeps?.["/versions.json"]]);
130857
130857
  const versionPrefix = nonCurrentActiveVersionID === void 0 ? void 0 : nonCurrentActiveVersionID ? `/${nonCurrentActiveVersionID}` : "";
130858
- const getVersionedPath = (0, import_react212.useMemo)(() => versionPrefix !== void 0 || pathPrefix !== "" ? function(slashPrependedPath) {
130858
+ const getAbsolutePath = (0, import_react212.useMemo)(() => versionPrefix !== void 0 || pathPrefix !== "" ? function(slashPrependedPath) {
130859
130859
  const versioned = `${pathPrefix}${versionPrefix}${slashPrependedPath}`;
130860
130860
  return versioned;
130861
130861
  } : void 0, [pathPrefix, versionPrefix]);
130862
- const getUnversionedPath = (0, import_react212.useMemo)(() => versionPrefix !== void 0 ? function(slashPrependedPath) {
130862
+ const getVersionRelativePath = (0, import_react212.useMemo)(() => versionPrefix !== void 0 ? function getVersionRelativePath2(slashPrependedPath) {
130863
130863
  const siteRootRelative = getSiteRootRelativePath(slashPrependedPath);
130864
130864
  if (!versionPrefix) {
130865
130865
  return siteRootRelative;
130866
130866
  }
130867
130867
  const unversioned = versionPrefix !== "" && versionPrefix !== void 0 && siteRootRelative.startsWith(versionPrefix) ? siteRootRelative.replace(versionPrefix, "") : siteRootRelative;
130868
130868
  if (!unversioned.startsWith("/")) {
130869
- console.error("Non-slash-prepended path in getUnversionedPath!");
130869
+ console.error("Non-slash-prepended path in getVersionRelativePath!");
130870
130870
  }
130871
130871
  return unversioned;
130872
130872
  } : void 0, [versionPrefix, getSiteRootRelativePath]);
130873
- const initialResourceURI_ = resourceMap && getUnversionedPath ? resourceMap[stripLeadingSlash(
130874
- getUnversionedPath(
130873
+ const initialResourceURI_ = resourceMap && getVersionRelativePath ? resourceMap[stripLeadingSlash(
130874
+ getVersionRelativePath(
130875
130875
  stripTrailingSlash(decodeURIComponent(window.location.pathname)) + window.location.hash
130876
130876
  )
130877
130877
  )] : void 0;
130878
130878
  const initialResourceURI = initialResourceURI_ ?? // Try once again but without the fragment (in case it is malformed)
130879
- (getUnversionedPath && resourceMap ? resourceMap[stripLeadingSlash(
130880
- getUnversionedPath(
130879
+ (getVersionRelativePath && resourceMap ? resourceMap[stripLeadingSlash(
130880
+ getVersionRelativePath(
130881
130881
  stripTrailingSlash(decodeURIComponent(window.location.pathname))
130882
130882
  )
130883
130883
  )] : void 0);
130884
- if (resourceMap && getUnversionedPath && !initialResourceURI) {
130884
+ if (resourceMap && getVersionRelativePath && !initialResourceURI) {
130885
130885
  throw new Error("Unable to obtain initial resource URI based on URL");
130886
130886
  }
130887
130887
  const fetchJSON = (0, import_react212.useCallback)(function fetchJSON2(paths, onProgress, onDone) {
@@ -130900,15 +130900,15 @@ schema (${ast._tag}): ${ast}`;
130900
130900
  onDone
130901
130901
  ).load();
130902
130902
  }, []);
130903
- const locateResource = (0, import_react212.useMemo)(() => !reverseResourceMap || !getVersionedPath ? void 0 : (uri) => {
130903
+ const locateResource = (0, import_react212.useMemo)(() => !reverseResourceMap || !getAbsolutePath ? void 0 : (uri) => {
130904
130904
  if (reverseResourceMap[uri] !== void 0) {
130905
- return getVersionedPath(`/${reverseResourceMap[uri]}`);
130905
+ return getAbsolutePath(`/${reverseResourceMap[uri]}`);
130906
130906
  } else {
130907
130907
  console.error("Failed to get path for resource", uri, reverseResourceMap);
130908
130908
  throw new Error("Failed to get path for resource");
130909
130909
  }
130910
- }, [getVersionedPath, reverseResourceMap]);
130911
- const reverseResource = (0, import_react212.useMemo)(() => !resourceMap || !getUnversionedPath ? void 0 : (path) => resourceMap[stripLeadingSlash(getUnversionedPath(path))], [resourceMap, getUnversionedPath]);
130910
+ }, [getAbsolutePath, reverseResourceMap]);
130911
+ const reverseResource = (0, import_react212.useMemo)(() => !resourceMap || !getVersionRelativePath ? void 0 : (path) => resourceMap[stripLeadingSlash(getVersionRelativePath(path))], [resourceMap, getVersionRelativePath]);
130912
130912
  const getResourceDataPaths = (0, import_react212.useMemo)(
130913
130913
  () => !locateResource ? void 0 : function getResourceDataPaths2(uri) {
130914
130914
  const rpath = locateResource(uri).split("#")[0];
@@ -130965,11 +130965,11 @@ schema (${ast._tag}): ${ast}`;
130965
130965
  );
130966
130966
  }, [fetchJSON, getSiteRootRelativePath, getDomainRelativePath]);
130967
130967
  (0, import_react212.useEffect)(() => {
130968
- if (!getVersionedPath || !getUnversionedPath) {
130968
+ if (!getAbsolutePath || !getVersionRelativePath) {
130969
130969
  return;
130970
130970
  }
130971
130971
  return fetchJSON(
130972
- VERSION_DEPS.map((dep) => getVersionedPath(dep)),
130972
+ VERSION_DEPS.map((dep) => getAbsolutePath(dep)),
130973
130973
  (done4, total) => setLoadProgressThrottled({
130974
130974
  done: done4,
130975
130975
  total
@@ -130979,13 +130979,13 @@ schema (${ast._tag}): ${ast}`;
130979
130979
  done: 100,
130980
130980
  total: 100
130981
130981
  });
130982
- setVersionDeps(Object.entries(results).filter(([src]) => VERSION_DEPS.includes(getUnversionedPath(src))).map(([src, resp]) => ({ [getUnversionedPath(src)]: resp })).reduce(
130982
+ setVersionDeps(Object.entries(results).filter(([src]) => VERSION_DEPS.includes(getVersionRelativePath(src))).map(([src, resp]) => ({ [getVersionRelativePath(src)]: resp })).reduce(
130983
130983
  (prev, curr) => ({ ...prev, ...curr }),
130984
130984
  {}
130985
130985
  ));
130986
130986
  }
130987
130987
  );
130988
- }, [fetchJSON, getVersionedPath, getUnversionedPath]);
130988
+ }, [fetchJSON, getAbsolutePath, getVersionRelativePath]);
130989
130989
  const primaryLanguageDetected = (0, import_react212.useMemo)(() => resourceMap && resourceMap[""] && resourceDescriptions[resourceMap[""]] ? resourceDescriptions[resourceMap[""]]?.primaryLanguageID ?? "en" : void 0, [resourceDescriptions, resourceMap]);
130990
130990
  const primaryLanguage = primaryLanguageDetected ?? "en";
130991
130991
  const lunrIndex = (0, import_react212.useMemo)(() => {
@@ -131061,7 +131061,7 @@ schema (${ast._tag}): ${ast}`;
131061
131061
  }, [versionDeps?.["/dependencies.json"]]);
131062
131062
  const dependencyIndex = versionDeps?.["/dependency-index.json"];
131063
131063
  const [loadedDependencies, setLoadedDependencies] = (0, import_react212.useState)(void 0);
131064
- const mainView = resourceMap && primaryLanguage && getUnversionedPath && locateResource && reverseResource && fetchResourceData && versioning && lunrIndex && initialResourceURI && initialResourceData && loadedDependencies && dependencyIndex && getVersionedPath ? /* @__PURE__ */ import_react212.default.createElement(
131064
+ const mainView = resourceMap && primaryLanguage && getVersionRelativePath && locateResource && reverseResource && fetchResourceData && versioning && lunrIndex && initialResourceURI && initialResourceData && loadedDependencies && dependencyIndex && getAbsolutePath ? /* @__PURE__ */ import_react212.default.createElement(
131065
131065
  VersionWorkspace,
131066
131066
  {
131067
131067
  workspaceTitle,
@@ -131069,8 +131069,8 @@ schema (${ast._tag}): ${ast}`;
131069
131069
  dependencies: loadedDependencies,
131070
131070
  locateResource,
131071
131071
  reverseResource,
131072
- expandUnversionedPath: getVersionedPath,
131073
- getVersionLocalPath: getUnversionedPath,
131072
+ getAbsolutePath,
131073
+ getVersionRelativePath,
131074
131074
  dependencyIndex,
131075
131075
  initialResource: initialResourceURI,
131076
131076
  initialResourceData,
@@ -131082,7 +131082,14 @@ schema (${ast._tag}): ${ast}`;
131082
131082
  storedState: restoredState,
131083
131083
  onStoreState: handleStoreState
131084
131084
  }
131085
- ) : /* @__PURE__ */ import_react212.default.createElement(import_react212.default.Fragment, null, /* @__PURE__ */ import_react212.default.createElement(BrowserBar, { rootURL: `${pathPrefix}/`, title: workspaceTitle, loadProgress }), /* @__PURE__ */ import_react212.default.createElement("main", { id: "resources" }, /* @__PURE__ */ import_react212.default.createElement(
131085
+ ) : /* @__PURE__ */ import_react212.default.createElement(import_react212.default.Fragment, null, /* @__PURE__ */ import_react212.default.createElement(
131086
+ BrowserBar,
131087
+ {
131088
+ rootURL: `${pathPrefix}/`,
131089
+ title: workspaceTitle,
131090
+ loadProgress
131091
+ }
131092
+ ), /* @__PURE__ */ import_react212.default.createElement("main", { id: "resources" }, /* @__PURE__ */ import_react212.default.createElement(
131086
131093
  "div",
131087
131094
  {
131088
131095
  dangerouslySetInnerHTML: { __html: "" },
@@ -131103,8 +131110,8 @@ schema (${ast._tag}): ${ast}`;
131103
131110
  initialResourceData,
131104
131111
  fetchResourceData,
131105
131112
  dependencies,
131106
- expandUnversionedPath,
131107
- getVersionLocalPath,
131113
+ getAbsolutePath,
131114
+ getVersionRelativePath,
131108
131115
  dependencyIndex,
131109
131116
  searchIndex,
131110
131117
  locateResource,
@@ -131224,7 +131231,7 @@ schema (${ast._tag}): ${ast}`;
131224
131231
  // shadowDom: true,
131225
131232
  }, function handleIntercept(evt, el) {
131226
131233
  const href = el.getAttribute("href");
131227
- if (!href || !getVersionLocalPath) {
131234
+ if (!href || !getVersionRelativePath) {
131228
131235
  return;
131229
131236
  }
131230
131237
  const url2 = new URL(href, document.baseURI);
@@ -131239,12 +131246,12 @@ schema (${ast._tag}): ${ast}`;
131239
131246
  console.error(
131240
131247
  "Failed to get resource URI",
131241
131248
  maybePrefixedURL,
131242
- stripLeadingSlash(getVersionLocalPath(stripTrailingSlash(maybePrefixedURL)))
131249
+ stripLeadingSlash(getVersionRelativePath(stripTrailingSlash(maybePrefixedURL)))
131243
131250
  );
131244
131251
  return true;
131245
131252
  }
131246
131253
  });
131247
- }, [reverseResource, getVersionLocalPath, getContainingPageResourceURI]);
131254
+ }, [reverseResource, getVersionRelativePath, getContainingPageResourceURI]);
131248
131255
  const [queuedFragment, setQueuedFragment] = (0, import_react212.useState)("");
131249
131256
  const jumpTo = (0, import_react212.useCallback)((uri) => {
131250
131257
  if (getContainingPageResourceURI(uri) === uri) {
@@ -131420,7 +131427,7 @@ schema (${ast._tag}): ${ast}`;
131420
131427
  providerProps: routerProps,
131421
131428
  versioning,
131422
131429
  activeBrowsingMode: state.browsingMode,
131423
- rootURL: expandUnversionedPath("/"),
131430
+ rootURL: getAbsolutePath("/"),
131424
131431
  onActivateBrowsingMode: (0, import_react212.useCallback)((mode) => dispatch({
131425
131432
  type: "activated_browsing_mode",
131426
131433
  mode