@ampernic/vitepress-theme-alt-docs 0.1.5 → 0.1.6

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,10 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  import { onKeyStroke, useScrollLock } from '@vueuse/core'
3
- import { useData, useRouter } from 'vitepress'
3
+ import { useRouter } from 'vitepress'
4
4
  import { computed, nextTick, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue'
5
5
 
6
6
  const emit = defineEmits<{ (e: 'close'): void }>()
7
- const { site } = useData()
8
7
  const router = useRouter()
9
8
 
10
9
  const ALL_DISTROS = [
@@ -43,8 +42,8 @@ const availableDistros = ref<string[]>([])
43
42
  const availableVersions = ref<string[]>([])
44
43
 
45
44
  async function loadIndexes() {
46
- // base = '' for index site (/), '/alt-domain' for distro sites
47
- const base = site.value.base === '/' ? '' : site.value.base.replace(/\/+$/, '')
45
+ // Always use absolute paths from origin root current site base is irrelevant
46
+ // (on /alt-platform/ we still need to load /alt-domain/pagefind/pagefind.js)
48
47
 
49
48
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
49
  let pf: any = null
@@ -53,7 +52,7 @@ async function loadIndexes() {
53
52
  for (let i = 0; i < ALL_DISTROS.length; i++) {
54
53
  try {
55
54
  // @vite-ignore
56
- pf = await import(/* @vite-ignore */ `${base}/${ALL_DISTROS[i]}/pagefind/pagefind.js`)
55
+ pf = await import(/* @vite-ignore */ `/${ALL_DISTROS[i]}/pagefind/pagefind.js`)
57
56
  firstIdx = i
58
57
  break
59
58
  } catch { /* distro not deployed yet */ }
@@ -63,7 +62,7 @@ async function loadIndexes() {
63
62
 
64
63
  for (let i = firstIdx + 1; i < ALL_DISTROS.length; i++) {
65
64
  try {
66
- await pf.mergeIndex(`${base}/${ALL_DISTROS[i]}/pagefind`)
65
+ await pf.mergeIndex(`/${ALL_DISTROS[i]}/pagefind`)
67
66
  } catch { /* skip */ }
68
67
  }
69
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampernic/vitepress-theme-alt-docs",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Shared VitePress theme for ALT Linux documentation",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "author": "Ampernic",
@@ -35,8 +35,8 @@
35
35
  "vitepress-plugin-tabs": "^0.6.0",
36
36
  "@ampernic/vitepress-plugin-alt-docs-versioning": "0.1.2",
37
37
  "@ampernic/vitepress-plugin-html-image": "0.1.2",
38
- "@ampernic/vitepress-plugin-pagefind": "0.1.5",
39
- "@ampernic/vitepress-plugin-cross-site-router": "0.1.2"
38
+ "@ampernic/vitepress-plugin-cross-site-router": "0.1.2",
39
+ "@ampernic/vitepress-plugin-pagefind": "0.1.5"
40
40
  },
41
41
  "devDependencies": {
42
42
  "builtin-modules": "^3.3.0",