docus 4.1.0 → 4.1.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.
package/app/app.vue CHANGED
@@ -31,14 +31,16 @@ useSeoMeta({
31
31
  twitterCard: 'summary_large_image',
32
32
  })
33
33
 
34
- const route = useRoute()
35
- const defaultLocale = useRuntimeConfig().public.i18n.defaultLocale
36
- onMounted(() => {
37
- const currentLocale = route.path.split('/')[1]
38
- if (!locales.some(locale => locale.code === currentLocale)) {
39
- return navigateTo(switchLocalePath(defaultLocale) as string)
40
- }
41
- })
34
+ if (isEnabled.value) {
35
+ const route = useRoute()
36
+ const defaultLocale = useRuntimeConfig().public.i18n.defaultLocale
37
+ onMounted(() => {
38
+ const currentLocale = route.path.split('/')[1]
39
+ if (!locales.some(locale => locale.code === currentLocale)) {
40
+ return navigateTo(switchLocalePath(defaultLocale) as string)
41
+ }
42
+ })
43
+ }
42
44
 
43
45
  const { data: navigation } = await useAsyncData(`navigation_${collectionName.value}`, () => queryCollectionNavigation(collectionName.value as keyof PageCollections), {
44
46
  transform: (data) => {
package/app/error.vue CHANGED
@@ -30,14 +30,16 @@ useSeoMeta({
30
30
  description: () => t('common.error.description'),
31
31
  })
32
32
 
33
- const route = useRoute()
34
- const defaultLocale = useRuntimeConfig().public.i18n.defaultLocale
35
- onMounted(() => {
36
- const currentLocale = route.path.split('/')[1]
37
- if (!locales.some(locale => locale.code === currentLocale)) {
38
- return navigateTo(switchLocalePath(defaultLocale) as string)
39
- }
40
- })
33
+ if (isEnabled.value) {
34
+ const route = useRoute()
35
+ const defaultLocale = useRuntimeConfig().public.i18n.defaultLocale
36
+ onMounted(() => {
37
+ const currentLocale = route.path.split('/')[1]
38
+ if (!locales.some(locale => locale.code === currentLocale)) {
39
+ return navigateTo(switchLocalePath(defaultLocale) as string)
40
+ }
41
+ })
42
+ }
41
43
 
42
44
  const collectionName = computed(() => isEnabled.value ? `docs_${locale.value}` : 'docs')
43
45
 
@@ -9,10 +9,15 @@ export default defineNuxtModule({
9
9
 
10
10
  const isI18nEnabled = !!(nuxt.options.i18n && nuxt.options.i18n.locales)
11
11
 
12
- // addImports({
13
- // name: 'useDocusI18n',
14
- // from: resolve('../app/composables/useDocusI18n'),
15
- // })
12
+ // Ensure useDocusI18n is available in the app
13
+ nuxt.hook('imports:extend', (imports) => {
14
+ if (imports.some(i => i.name === 'useDocusI18n')) return
15
+
16
+ imports.push({
17
+ name: 'useDocusI18n',
18
+ from: resolve('../app/composables/useDocusI18n'),
19
+ })
20
+ })
16
21
 
17
22
  extendPages((pages) => {
18
23
  const landingTemplate = resolve('../app/templates/landing.vue')
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docus",
3
3
  "description": "Nuxt layer for Docus documentation theme",
4
- "version": "4.1.0",
4
+ "version": "4.1.2",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
7
7
  "repository": {