@alauda/doom 1.9.1 → 1.9.2

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.
@@ -1,4 +1,3 @@
1
- import { withBase } from '@rspress/core/runtime';
2
1
  function removeIndex(link) {
3
2
  if (link.endsWith('/index')) {
4
3
  return link.slice(0, -5);
@@ -21,14 +20,9 @@ export function findItemByRoutePath(items, routePath) {
21
20
  if (isSidebarDivider(item) || isSidebarSectionHeader(item)) {
22
21
  return false;
23
22
  }
24
- const withBaseUrl = withBase(item.link);
25
- const removeIndexUrl = removeIndex(withBaseUrl);
23
+ const removeIndexUrl = removeIndex(item.link || '/');
26
24
  const removeBackSlashedRoutePath = routePath.replace(/\/$/, '');
27
- return (
28
- // FIXME: 😅 we should refactor all the path logic, /index.html / or no /, l
29
- withBaseUrl === routePath ||
30
- removeIndexUrl === routePath ||
31
- withBaseUrl === removeBackSlashedRoutePath ||
25
+ return (removeIndexUrl === routePath ||
32
26
  removeIndexUrl === removeBackSlashedRoutePath);
33
27
  }
34
28
  const matchRoutePathItemIndex = items.findIndex((item) => {
@@ -1,8 +1,7 @@
1
- import { isProduction } from '@rspress/core/runtime';
1
+ import { isProduction, withBase } from '@rspress/core/runtime';
2
2
  import virtual from 'doom-@global-virtual';
3
3
  import { merge } from 'es-toolkit/compat';
4
4
  import { useEffect, useMemo, useState } from 'react';
5
- import { base } from 'virtual-runtime-config';
6
5
  import { parse } from 'yaml';
7
6
  import { isUnversioned } from '../../shared/index.js';
8
7
  import { namedTerms } from '../../terms.js';
@@ -20,14 +19,14 @@ const normalizeOverrides = (origin) => Object.keys(origin).reduce((acc, key_) =>
20
19
  }, { en: {}, zh: {}, ru: {} });
21
20
  let normalizedSiteOverrides;
22
21
  let promise;
23
- const fetchSiteOverrides = async (base, version, acpSite) => {
22
+ const fetchSiteOverrides = async (version, acpSite) => {
24
23
  if (promise) {
25
24
  return promise;
26
25
  }
27
26
  const acpSiteOverridesUrl = acpSite && isProduction()
28
27
  ? `${(virtual.prefix || '') + acpSite.base}${isUnversioned(version) ? '' : acpSite.version + '/'}overrides.yaml`
29
28
  : null;
30
- const siteOverridesUrl = `${base}/overrides.yaml`;
29
+ const siteOverridesUrl = withBase('overrides.yaml');
31
30
  const urls = [acpSiteOverridesUrl];
32
31
  if (acpSiteOverridesUrl !== siteOverridesUrl) {
33
32
  urls.push(siteOverridesUrl);
@@ -70,7 +69,7 @@ export const useSiteOverrides = () => {
70
69
  if (normalizedSiteOverrides) {
71
70
  return;
72
71
  }
73
- void fetchSiteOverrides(base, virtual.version, acpSite).then(setSiteOverrides);
72
+ void fetchSiteOverrides(virtual.version, acpSite).then(setSiteOverrides);
74
73
  }, [acpSite]);
75
74
  return siteOverrides?.[lang] || {};
76
75
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": "git+https://github.com/alauda/doom.git",