import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
+import typedocSidebar from '../../api/typedoc-sidebar.json'
export const META_URL = 'https://router.vuejs.org'
export const META_TITLE = 'Vue Router'
],
sidebar: {
+ '/api/': [
+ {
+ text: 'API',
+ items: typedocSidebar,
+ },
+ ],
// catch-all fallback
'/': [
{
],
},
],
-
- '/api/': [
- {
- text: 'packages',
- items: [{ text: 'vue-router', link: '/api/' }],
- },
- ],
},
},
}
import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
+import typedocSidebar from '../../api/typedoc-sidebar.json'
+// TODO: rework the typedoc sidebar to include the /zh/ prefix
export const META_URL = 'https://router.vuejs.org'
export const META_TITLE = 'Vue Router'
],
sidebar: {
+ '/zh/api/': [
+ {
+ text: 'API',
+ items: typedocSidebar,
+ },
+ ],
'/zh/': [
{
text: '设置',
],
},
],
-
- '/zh/api/': [
- {
- text: 'packages',
- items: [{ text: 'vue-router', link: '/zh/api/' }],
- },
- ],
},
},
}
},
"dependencies": {
"simple-git": "^3.28.0",
+ "typedoc-vitepress-theme": "^1.1.2",
"vitepress": "1.6.3",
- "vitepress-translation-helper": "^0.2.1",
+ "vitepress-translation-helper": "^0.2.2",
"vue-router": "workspace:*"
}
}
import path from 'node:path'
-import { fileURLToPath } from 'node:url'
import { createTypeDocApp } from './typedoc-markdown.mjs'
-const __dirname = path.dirname(fileURLToPath(import.meta.url))
+const __dirname = path.dirname(new URL(import.meta.url).pathname)
createTypeDocApp({
- name: 'API Documentation',
+ textContentMappings: {
+ 'title.indexPage': 'API Reference',
+ 'title.memberPage': '{name}',
+ },
tsconfig: path.resolve(__dirname, './typedoc.tsconfig.json'),
+ // entryPointStrategy: 'packages',
categorizeByGroup: true,
githubPages: false,
- disableSources: true, // some links are in node_modules and it's ugly
- plugin: ['typedoc-plugin-markdown'],
+ readme: 'none',
+ indexFormat: 'table',
+ disableSources: true,
+ plugin: ['typedoc-plugin-markdown', 'typedoc-vitepress-theme'],
+ useCodeBlocks: true,
entryPoints: [path.resolve(__dirname, '../router/src/index.ts')],
}).then(app => app.build())
// @ts-check
import fs from 'node:fs/promises'
import path from 'node:path'
-import { fileURLToPath } from 'node:url'
-import { Application, PageEvent, TSConfigReader } from 'typedoc'
+import { Application, TSConfigReader, PageEvent } from 'typedoc'
-const __dirname = path.dirname(fileURLToPath(import.meta.url))
+const __dirname = path.dirname(new URL(import.meta.url).pathname)
+/** @satisfies {Partial<import('typedoc').TypeDocOptions & import('typedoc-plugin-markdown').PluginOptions>} */
const DEFAULT_OPTIONS = {
- // disableOutputCheck: true,
cleanOutputDir: true,
excludeInternal: false,
readme: 'none',
if (project) {
// Rendered docs
try {
- await app.generateDocs(project, options.out)
+ await app.generateOutputs(project)
app.logger.info(`generated at ${options.out}.`)
} catch (error) {
app.logger.error(error)
}
}
+/**
+ * checks if a path exists
+ *
+ * @async
+ * @param {string} path
+ */
async function exists(path) {
try {
await fs.access(path)
*/
function prependYAML(contents, vars) {
return contents
- .replace(/^/, `${toYAML(vars)}\n\n`)
+ .replace(/^/, toYAML(vars) + '\n\n')
.replace(/[\r\n]{3,}/g, '\n\n')
}
"removeComments": false,
"jsx": "preserve",
"lib": ["esnext", "dom"],
- "types": ["node"]
+ "types": ["vitest", "node", "vite/client"]
}
}
simple-git:
specifier: ^3.28.0
version: 3.28.0
+ typedoc-vitepress-theme:
+ specifier: ^1.1.2
+ version: 1.1.2(typedoc-plugin-markdown@4.7.0(typedoc@0.28.7(typescript@5.8.3)))
vitepress:
specifier: 1.6.3
version: 1.6.3(@algolia/client-search@5.34.0)(@types/node@24.0.14)(axios@1.10.0)(postcss@8.5.6)(search-insights@2.17.3)(terser@5.43.1)(typescript@5.8.3)
vitepress-translation-helper:
- specifier: ^0.2.1
- version: 0.2.1(vitepress@1.6.3(@algolia/client-search@5.34.0)(@types/node@24.0.14)(axios@1.10.0)(postcss@8.5.6)(search-insights@2.17.3)(terser@5.43.1)(typescript@5.8.3))(vue@3.5.17(typescript@5.8.3))
+ specifier: ^0.2.2
+ version: 0.2.2(vitepress@1.6.3(@algolia/client-search@5.34.0)(@types/node@24.0.14)(axios@1.10.0)(postcss@8.5.6)(search-insights@2.17.3)(terser@5.43.1)(typescript@5.8.3))(vue@3.5.17(typescript@5.8.3))
vue-router:
specifier: workspace:*
version: link:../router
peerDependencies:
typedoc: 0.28.x
+ typedoc-vitepress-theme@1.1.2:
+ resolution: {integrity: sha512-hQvCZRr5uKDqY1bRuY1+eNTNn6d4TE4OP5pnw65Y7WGgajkJW9X1/lVJK2UJpcwCmwkdjw1QIO49H9JQlxWhhw==}
+ peerDependencies:
+ typedoc-plugin-markdown: '>=4.4.0'
+
typedoc@0.28.7:
resolution: {integrity: sha512-lpz0Oxl6aidFkmS90VQDQjk/Qf2iw0IUvFqirdONBdj7jPSN9mGXhy66BcGNDxx5ZMyKKiBVAREvPEzT6Uxipw==}
engines: {node: '>= 18', pnpm: '>= 10'}
terser:
optional: true
- vitepress-translation-helper@0.2.1:
- resolution: {integrity: sha512-zYjakGIdVDonT1P85OkeQcdE6e8vdmKiVclHB7DGcTzFUwb2D0w+hcC31AGneB5wa5IiqEoipycSTYNKM0YKJg==}
+ vitepress-translation-helper@0.2.2:
+ resolution: {integrity: sha512-xqE4p1iUmsADKyA8W/02POtEwL0ZMcY2Ogj4Shuh70392UslB5JhrgCdF1j61NIQhgy/wgAGhn33QZdksN6IqQ==}
hasBin: true
peerDependencies:
vitepress: ^1.0.0
dependencies:
typedoc: 0.28.7(typescript@5.8.3)
+ typedoc-vitepress-theme@1.1.2(typedoc-plugin-markdown@4.7.0(typedoc@0.28.7(typescript@5.8.3))):
+ dependencies:
+ typedoc-plugin-markdown: 4.7.0(typedoc@0.28.7(typescript@5.8.3))
+
typedoc@0.28.7(typescript@5.8.3):
dependencies:
'@gerrit0/mini-shiki': 3.8.0
fsevents: 2.3.3
terser: 5.43.1
- vitepress-translation-helper@0.2.1(vitepress@1.6.3(@algolia/client-search@5.34.0)(@types/node@24.0.14)(axios@1.10.0)(postcss@8.5.6)(search-insights@2.17.3)(terser@5.43.1)(typescript@5.8.3))(vue@3.5.17(typescript@5.8.3)):
+ vitepress-translation-helper@0.2.2(vitepress@1.6.3(@algolia/client-search@5.34.0)(@types/node@24.0.14)(axios@1.10.0)(postcss@8.5.6)(search-insights@2.17.3)(terser@5.43.1)(typescript@5.8.3))(vue@3.5.17(typescript@5.8.3)):
dependencies:
minimist: 1.2.8
simple-git: 3.28.0