@movk/nuxt-docs 1.16.1 → 1.16.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.config.ts +0 -1
- package/modules/module.ts +82 -2
- package/nuxt.config.ts +10 -4
- package/package.json +2 -1
- package/modules/config.ts +0 -84
package/app/app.config.ts
CHANGED
package/modules/module.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { addComponentsDir, createResolver, defineNuxtModule, logger } from '@nuxt/kit'
|
|
2
2
|
import type { ModuleDependencies } from 'nuxt/schema'
|
|
3
|
+
import { defu } from 'defu'
|
|
4
|
+
import { getGitBranch, getGitEnv, getLocalGitInfo } from '../utils/git'
|
|
5
|
+
import { getPackageJsonMetadata, inferSiteURL } from '../utils/meta'
|
|
6
|
+
import { createComponentMetaExcludeFilters } from '../utils/component-meta'
|
|
7
|
+
import { startCase, kebabCase } from '@movk/core'
|
|
8
|
+
import { updateSiteConfig } from 'nuxt-site-config/kit'
|
|
3
9
|
|
|
4
10
|
export interface ModuleOptions {
|
|
5
11
|
/**
|
|
@@ -29,17 +35,23 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
29
35
|
},
|
|
30
36
|
moduleDependencies(nuxt): ModuleDependencies {
|
|
31
37
|
const userOptions = nuxt.options.movkNuxtDocs || {}
|
|
38
|
+
|
|
32
39
|
return {
|
|
33
40
|
...userOptions.a11y !== false && {
|
|
34
41
|
'@nuxt/a11y': {
|
|
35
|
-
version: '^1.0.0-alpha.1'
|
|
42
|
+
version: '^1.0.0-alpha.1',
|
|
43
|
+
defaults: {
|
|
44
|
+
logIssues: false
|
|
45
|
+
}
|
|
36
46
|
}
|
|
37
47
|
}
|
|
38
48
|
}
|
|
39
49
|
},
|
|
40
|
-
setup(options, nuxt) {
|
|
50
|
+
async setup(options, nuxt) {
|
|
41
51
|
const { resolve } = createResolver(import.meta.url)
|
|
42
52
|
|
|
53
|
+
nuxt.options.alias['#ai-chat'] = resolve('./ai-chat/runtime')
|
|
54
|
+
|
|
43
55
|
if (options.mermaid) {
|
|
44
56
|
let mermaidAvailable = true
|
|
45
57
|
try {
|
|
@@ -93,6 +105,74 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
93
105
|
log.info('mermaid diagram support enabled')
|
|
94
106
|
}
|
|
95
107
|
}
|
|
108
|
+
|
|
109
|
+
const dir = nuxt.options.rootDir
|
|
110
|
+
const url = inferSiteURL()
|
|
111
|
+
const meta = await getPackageJsonMetadata(dir)
|
|
112
|
+
const gitInfo = await getLocalGitInfo(dir) || getGitEnv()
|
|
113
|
+
|
|
114
|
+
const site = defu(nuxt.options.site, {
|
|
115
|
+
url,
|
|
116
|
+
name: kebabCase(meta.name || gitInfo?.name || ''),
|
|
117
|
+
debug: false
|
|
118
|
+
})
|
|
119
|
+
updateSiteConfig(site)
|
|
120
|
+
|
|
121
|
+
const siteName = (typeof nuxt.options.site === 'object' && nuxt.options.site?.name) || meta.name || gitInfo?.name || ''
|
|
122
|
+
|
|
123
|
+
nuxt.options.llms = defu(nuxt.options.llms, {
|
|
124
|
+
domain: url || 'https://example.com',
|
|
125
|
+
title: siteName,
|
|
126
|
+
description: meta.description || '',
|
|
127
|
+
full: {
|
|
128
|
+
title: siteName,
|
|
129
|
+
description: meta.description || ''
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
nuxt.options.appConfig.header = defu(nuxt.options.appConfig.header, {
|
|
134
|
+
title: startCase(siteName)
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
nuxt.options.appConfig.seo = defu(nuxt.options.appConfig.seo, {
|
|
138
|
+
titleTemplate: `%s - ${siteName}`,
|
|
139
|
+
title: siteName,
|
|
140
|
+
description: meta.description || ''
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
nuxt.options.appConfig.github = defu(nuxt.options.appConfig.github, {
|
|
144
|
+
owner: gitInfo?.owner,
|
|
145
|
+
name: gitInfo?.name,
|
|
146
|
+
url: gitInfo?.url,
|
|
147
|
+
commitPath: 'src',
|
|
148
|
+
suffix: 'vue',
|
|
149
|
+
since: '2025-01-31T04:00:00Z',
|
|
150
|
+
branch: getGitBranch(),
|
|
151
|
+
per_page: 100,
|
|
152
|
+
until: new Date().toISOString()
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
const layerPath = resolve('..')
|
|
156
|
+
|
|
157
|
+
// @ts-ignore - component-meta is not typed
|
|
158
|
+
nuxt.hook('component-meta:extend', (options: any) => {
|
|
159
|
+
const userInclude = (nuxt.options.componentMeta && typeof nuxt.options.componentMeta === 'object')
|
|
160
|
+
? nuxt.options.componentMeta.include || []
|
|
161
|
+
: []
|
|
162
|
+
|
|
163
|
+
options.exclude = [
|
|
164
|
+
...(options.exclude || []),
|
|
165
|
+
...createComponentMetaExcludeFilters(resolve, dir, layerPath, userInclude)
|
|
166
|
+
]
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
nuxt.hook('nitro:config', (nitroConfig) => {
|
|
170
|
+
nitroConfig.publicAssets ||= []
|
|
171
|
+
nitroConfig.publicAssets.push({
|
|
172
|
+
dir: resolve('./runtime/public'),
|
|
173
|
+
maxAge: 60 * 60 * 24 * 30
|
|
174
|
+
})
|
|
175
|
+
})
|
|
96
176
|
}
|
|
97
177
|
})
|
|
98
178
|
|
package/nuxt.config.ts
CHANGED
|
@@ -145,10 +145,6 @@ export default defineNuxtConfig({
|
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
147
|
|
|
148
|
-
a11y: {
|
|
149
|
-
logIssues: false
|
|
150
|
-
},
|
|
151
|
-
|
|
152
148
|
componentMeta: {
|
|
153
149
|
metaFields: {
|
|
154
150
|
type: false,
|
|
@@ -198,5 +194,15 @@ export default defineNuxtConfig({
|
|
|
198
194
|
|
|
199
195
|
ogImage: {
|
|
200
196
|
zeroRuntime: true
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
robots: {
|
|
200
|
+
groups: [
|
|
201
|
+
{
|
|
202
|
+
userAgent: '*',
|
|
203
|
+
allow: '/'
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
sitemap: '/sitemap.xml'
|
|
201
207
|
}
|
|
202
208
|
})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movk/nuxt-docs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Modern Nuxt 4 documentation theme with auto-generated component docs, AI chat assistant, MCP server, and complete developer experience optimization.",
|
|
7
7
|
"author": "YiXuan <mhaibaraai@gmail.com>",
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"nuxt-component-meta": "^0.17.2",
|
|
72
72
|
"nuxt-llms": "^0.2.0",
|
|
73
73
|
"nuxt-og-image": "^6.3.0",
|
|
74
|
+
"nuxt-site-config": "^4.0.7",
|
|
74
75
|
"ohash": "^2.0.11",
|
|
75
76
|
"pathe": "^2.0.3",
|
|
76
77
|
"pkg-types": "^2.3.0",
|
package/modules/config.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { createResolver, defineNuxtModule } from '@nuxt/kit'
|
|
2
|
-
import { defu } from 'defu'
|
|
3
|
-
import { getGitBranch, getGitEnv, getLocalGitInfo } from '../utils/git'
|
|
4
|
-
import { getPackageJsonMetadata, inferSiteURL } from '../utils/meta'
|
|
5
|
-
import { createComponentMetaExcludeFilters } from '../utils/component-meta'
|
|
6
|
-
|
|
7
|
-
export default defineNuxtModule({
|
|
8
|
-
meta: {
|
|
9
|
-
name: 'config'
|
|
10
|
-
},
|
|
11
|
-
async setup(_options, nuxt) {
|
|
12
|
-
const { resolve } = createResolver(import.meta.url)
|
|
13
|
-
|
|
14
|
-
nuxt.options.alias['#ai-chat'] = resolve('./ai-chat/runtime')
|
|
15
|
-
|
|
16
|
-
const dir = nuxt.options.rootDir
|
|
17
|
-
const url = inferSiteURL()
|
|
18
|
-
const meta = await getPackageJsonMetadata(dir)
|
|
19
|
-
const gitInfo = await getLocalGitInfo(dir) || getGitEnv()
|
|
20
|
-
|
|
21
|
-
const site = nuxt.options.site
|
|
22
|
-
const siteName = (site && site.name) || meta.name || gitInfo?.name || ''
|
|
23
|
-
|
|
24
|
-
nuxt.options.site = defu(nuxt.options.site, {
|
|
25
|
-
url,
|
|
26
|
-
name: siteName,
|
|
27
|
-
debug: false
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
nuxt.options.llms = defu(nuxt.options.llms, {
|
|
31
|
-
domain: url || 'https://example.com',
|
|
32
|
-
title: siteName,
|
|
33
|
-
description: meta.description || '',
|
|
34
|
-
full: {
|
|
35
|
-
title: siteName,
|
|
36
|
-
description: meta.description || ''
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
nuxt.options.appConfig.header = defu(nuxt.options.appConfig.header, {
|
|
41
|
-
title: siteName
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
nuxt.options.appConfig.seo = defu(nuxt.options.appConfig.seo, {
|
|
45
|
-
titleTemplate: `%s - ${siteName}`,
|
|
46
|
-
title: siteName,
|
|
47
|
-
description: meta.description || ''
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
nuxt.options.appConfig.github = defu(nuxt.options.appConfig.github, {
|
|
51
|
-
owner: gitInfo?.owner,
|
|
52
|
-
name: gitInfo?.name,
|
|
53
|
-
url: gitInfo?.url,
|
|
54
|
-
commitPath: 'src',
|
|
55
|
-
suffix: 'vue',
|
|
56
|
-
since: '2025-01-31T04:00:00Z',
|
|
57
|
-
branch: getGitBranch(),
|
|
58
|
-
per_page: 100,
|
|
59
|
-
until: new Date().toISOString()
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
const layerPath = resolve('..')
|
|
63
|
-
|
|
64
|
-
// @ts-ignore - component-meta is not typed
|
|
65
|
-
nuxt.hook('component-meta:extend', (options: any) => {
|
|
66
|
-
const userInclude = (nuxt.options.componentMeta && typeof nuxt.options.componentMeta === 'object')
|
|
67
|
-
? nuxt.options.componentMeta.include || []
|
|
68
|
-
: []
|
|
69
|
-
|
|
70
|
-
options.exclude = [
|
|
71
|
-
...(options.exclude || []),
|
|
72
|
-
...createComponentMetaExcludeFilters(resolve, dir, layerPath, userInclude)
|
|
73
|
-
]
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
nuxt.hook('nitro:config', (nitroConfig) => {
|
|
77
|
-
nitroConfig.publicAssets ||= []
|
|
78
|
-
nitroConfig.publicAssets.push({
|
|
79
|
-
dir: resolve('./runtime/public'),
|
|
80
|
-
maxAge: 60 * 60 * 24 * 30
|
|
81
|
-
})
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
})
|