File tree Expand file tree Collapse file tree 7 files changed +25
-19
lines changed
packages/@vuepress/core/src Expand file tree Collapse file tree 7 files changed +25
-19
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { appUseByConfig } from './appUseByConfig'
8
8
import { createAppDir } from './createAppDir'
9
9
import { createAppEnv } from './createAppEnv'
10
10
import { createAppOptions } from './createAppOptions'
11
+ import { createAppSiteData } from './createAppSiteData'
11
12
import { createAppVersion } from './createAppVersion'
12
13
import { resolveBundler } from './resolveBundler'
13
14
@@ -19,6 +20,7 @@ export const createApp = (config: AppConfig): App => {
19
20
const options = createAppOptions ( config )
20
21
const dir = createAppDir ( options )
21
22
const env = createAppEnv ( options )
23
+ const siteData = createAppSiteData ( options )
22
24
const markdown = createMarkdown ( options . markdown )
23
25
const pluginApi = createPluginApi ( )
24
26
@@ -27,6 +29,7 @@ export const createApp = (config: AppConfig): App => {
27
29
options,
28
30
dir,
29
31
env,
32
+ siteData,
30
33
markdown,
31
34
pluginApi,
32
35
Original file line number Diff line number Diff line change
1
+ import type { AppOptions , SiteData } from '../types'
2
+
3
+ /**
4
+ * Create site data for vuepress app
5
+ *
6
+ * Site data will also be used in client
7
+ */
8
+ export const createAppSiteData = ( options : AppOptions ) : SiteData => {
9
+ return {
10
+ base : options . base ,
11
+ lang : options . lang ,
12
+ title : options . title ,
13
+ description : options . description ,
14
+ head : options . head ,
15
+ locales : options . locales ,
16
+ themeConfig : options . themeConfig ,
17
+ }
18
+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export * from './createAppDir'
8
8
export * from './createAppEnv'
9
9
export * from './createAppOptions'
10
10
export * from './createAppPages'
11
+ export * from './createAppSiteData'
11
12
export * from './createAppVersion'
12
13
export * from './createAppWriteTemp'
13
14
export * from './normalizePlugin'
Original file line number Diff line number Diff line change @@ -10,4 +10,3 @@ export * from './preparePagesData'
10
10
export * from './preparePagesRoutes'
11
11
export * from './prepareSiteData'
12
12
export * from './resolvePageData'
13
- export * from './resolveSiteData'
Original file line number Diff line number Diff line change 1
1
import type { App } from '../../types'
2
- import { resolveSiteData } from './resolveSiteData'
3
2
4
3
/**
5
4
* Generate site data temp file
6
5
*/
7
6
export const prepareSiteData = async ( app : App ) : Promise < void > => {
8
7
const content = `\
9
- export const siteData = ${ JSON . stringify ( resolveSiteData ( app ) , null , 2 ) }
8
+ export const siteData = ${ JSON . stringify ( app . siteData , null , 2 ) }
10
9
`
11
10
12
11
await app . writeTemp ( 'internal/siteData.js' , content )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
import type { Markdown } from '@vuepress/markdown'
2
+ import type { SiteData } from '@vuepress/shared'
2
3
import type { BundlerDev , BundlerBuild } from '../bundler'
3
4
import type { Page } from '../page'
4
5
import type { Plugin , PluginOptions , PluginConfig } from '../plugin'
@@ -16,6 +17,7 @@ export interface App {
16
17
options : AppOptions
17
18
dir : AppDir
18
19
env : AppEnv
20
+ siteData : SiteData
19
21
markdown : Markdown
20
22
pluginApi : PluginApi
21
23
use : < T extends PluginOptions > (
You can’t perform that action at this time.
0 commit comments