@vuepress/core 2.0.0-beta.4 → 2.0.0-beta.40

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.
Files changed (146) hide show
  1. package/lib/app/appInit.js +6 -16
  2. package/lib/app/appPrepare.js +12 -15
  3. package/lib/app/appUse.d.ts +2 -2
  4. package/lib/app/appUse.js +17 -15
  5. package/lib/app/createBaseApp.d.ts +5 -0
  6. package/lib/app/createBaseApp.js +46 -0
  7. package/lib/app/createBuildApp.d.ts +5 -0
  8. package/lib/app/createBuildApp.js +13 -0
  9. package/lib/app/createDevApp.d.ts +5 -0
  10. package/lib/app/createDevApp.js +13 -0
  11. package/lib/app/index.d.ts +13 -12
  12. package/lib/app/index.js +18 -13
  13. package/lib/app/prepare/index.d.ts +1 -3
  14. package/lib/app/prepare/index.js +6 -4
  15. package/lib/app/prepare/prepareLayoutComponents.js +2 -2
  16. package/lib/app/prepare/preparePageComponent.js +6 -1
  17. package/lib/app/prepare/preparePageData.js +7 -11
  18. package/lib/app/prepare/{preparePagesComponent.d.ts → preparePagesComponents.d.ts} +1 -1
  19. package/lib/app/prepare/preparePagesComponents.js +24 -0
  20. package/lib/app/prepare/preparePagesData.js +5 -4
  21. package/lib/app/prepare/preparePagesRoutes.js +61 -11
  22. package/lib/app/prepare/prepareSiteData.js +19 -1
  23. package/lib/app/{createAppDir.d.ts → resolveAppDir.d.ts} +2 -2
  24. package/lib/app/resolveAppDir.js +32 -0
  25. package/lib/app/resolveAppEnv.d.ts +5 -0
  26. package/lib/app/resolveAppEnv.js +12 -0
  27. package/lib/app/resolveAppMarkdown.d.ts +6 -0
  28. package/lib/app/resolveAppMarkdown.js +16 -0
  29. package/lib/app/resolveAppOptions.d.ts +5 -0
  30. package/lib/app/{createAppOptions.js → resolveAppOptions.js} +16 -20
  31. package/lib/app/resolveAppPages.d.ts +5 -0
  32. package/lib/app/resolveAppPages.js +31 -0
  33. package/lib/app/resolveAppSiteData.d.ts +7 -0
  34. package/lib/app/resolveAppSiteData.js +17 -0
  35. package/lib/app/resolveAppVersion.d.ts +4 -0
  36. package/lib/app/resolveAppVersion.js +10 -0
  37. package/lib/app/resolveAppWriteTemp.d.ts +5 -0
  38. package/lib/app/{createAppWriteTemp.js → resolveAppWriteTemp.js} +5 -5
  39. package/lib/app/resolvePluginObject.d.ts +5 -0
  40. package/lib/app/resolvePluginObject.js +9 -0
  41. package/lib/app/resolveThemeInfo.d.ts +5 -0
  42. package/lib/app/resolveThemeInfo.js +32 -0
  43. package/lib/app/resolveThemeLayouts.d.ts +5 -0
  44. package/lib/app/resolveThemeLayouts.js +25 -0
  45. package/lib/app/setupAppThemeAndPlugins.d.ts +5 -0
  46. package/lib/app/setupAppThemeAndPlugins.js +22 -0
  47. package/lib/index.d.ts +0 -1
  48. package/lib/index.js +5 -2
  49. package/lib/page/createPage.js +75 -39
  50. package/lib/page/index.d.ts +4 -3
  51. package/lib/page/index.js +9 -4
  52. package/lib/page/inferPagePath.js +2 -2
  53. package/lib/page/renderPageContent.d.ts +19 -0
  54. package/lib/page/renderPageContent.js +26 -0
  55. package/lib/page/renderPageExcerpt.d.ts +11 -0
  56. package/lib/page/renderPageExcerpt.js +17 -0
  57. package/lib/page/resolvePageComponentInfo.d.ts +2 -9
  58. package/lib/page/resolvePageComponentInfo.js +2 -24
  59. package/lib/page/resolvePageContent.js +1 -2
  60. package/lib/page/resolvePageDataInfo.d.ts +2 -1
  61. package/lib/page/resolvePageDataInfo.js +2 -2
  62. package/lib/page/resolvePageDate.d.ts +1 -1
  63. package/lib/page/resolvePageDate.js +6 -6
  64. package/lib/page/resolvePageFileContent.js +2 -2
  65. package/lib/page/resolvePageFilePath.d.ts +1 -1
  66. package/lib/page/resolvePageFilePath.js +6 -11
  67. package/lib/page/resolvePageHtmlInfo.d.ts +11 -0
  68. package/lib/page/resolvePageHtmlInfo.js +18 -0
  69. package/lib/page/resolvePageKey.js +1 -1
  70. package/lib/page/resolvePageLang.js +3 -3
  71. package/lib/page/resolvePagePath.js +12 -1
  72. package/lib/page/resolvePagePermalink.js +3 -3
  73. package/lib/page/resolvePageRouteMeta.d.ts +7 -0
  74. package/lib/page/resolvePageRouteMeta.js +8 -0
  75. package/lib/pluginApi/createHookQueue.d.ts +1 -1
  76. package/lib/pluginApi/createHookQueue.js +7 -46
  77. package/lib/pluginApi/createPluginApi.js +2 -2
  78. package/lib/pluginApi/createPluginApiHooks.js +14 -14
  79. package/lib/pluginApi/createPluginApiRegisterHooks.js +6 -6
  80. package/lib/pluginApi/index.js +5 -1
  81. package/lib/pluginApi/normalizeClientFilesHook.js +5 -2
  82. package/lib/pluginApi/normalizeReturnObjectHook.js +1 -1
  83. package/lib/types/app/app.d.ts +82 -14
  84. package/lib/types/app/index.js +5 -1
  85. package/lib/types/app/options.d.ts +78 -27
  86. package/lib/types/app/utils.d.ts +10 -3
  87. package/lib/types/bundler.d.ts +3 -24
  88. package/lib/types/index.d.ts +2 -3
  89. package/lib/types/index.js +6 -3
  90. package/lib/types/page.d.ts +78 -32
  91. package/lib/types/plugin.d.ts +5 -24
  92. package/lib/types/{plugin-api → pluginApi}/hooks.d.ts +7 -9
  93. package/lib/types/{plugin-api → pluginApi}/hooks.js +0 -0
  94. package/lib/types/{plugin-api → pluginApi}/index.d.ts +0 -0
  95. package/lib/types/{plugin-api → pluginApi}/index.js +5 -1
  96. package/lib/types/{plugin-api → pluginApi}/pluginApi.d.ts +0 -0
  97. package/lib/types/{plugin-api → pluginApi}/pluginApi.js +0 -0
  98. package/lib/types/theme.d.ts +42 -14
  99. package/package.json +17 -14
  100. package/CHANGELOG.md +0 -260
  101. package/lib/app/appUseByConfig.d.ts +0 -2
  102. package/lib/app/appUseByConfig.js +0 -14
  103. package/lib/app/createApp.d.ts +0 -5
  104. package/lib/app/createApp.js +0 -44
  105. package/lib/app/createAppDir.js +0 -32
  106. package/lib/app/createAppEnv.d.ts +0 -5
  107. package/lib/app/createAppEnv.js +0 -14
  108. package/lib/app/createAppOptions.d.ts +0 -5
  109. package/lib/app/createAppPages.d.ts +0 -5
  110. package/lib/app/createAppPages.js +0 -33
  111. package/lib/app/createAppSiteData.d.ts +0 -7
  112. package/lib/app/createAppSiteData.js +0 -19
  113. package/lib/app/createAppVersion.d.ts +0 -4
  114. package/lib/app/createAppVersion.js +0 -11
  115. package/lib/app/createAppWriteTemp.d.ts +0 -5
  116. package/lib/app/normalizePlugin.d.ts +0 -2
  117. package/lib/app/normalizePlugin.js +0 -19
  118. package/lib/app/normalizePluginConfig.d.ts +0 -2
  119. package/lib/app/normalizePluginConfig.js +0 -18
  120. package/lib/app/prepare/preparePageRoutes.d.ts +0 -5
  121. package/lib/app/prepare/preparePageRoutes.js +0 -57
  122. package/lib/app/prepare/preparePagesComponent.js +0 -23
  123. package/lib/app/prepare/resolvePageData.d.ts +0 -5
  124. package/lib/app/prepare/resolvePageData.js +0 -18
  125. package/lib/app/resolveBundler.d.ts +0 -2
  126. package/lib/app/resolveBundler.js +0 -10
  127. package/lib/app/resolvePlugin.d.ts +0 -5
  128. package/lib/app/resolvePlugin.js +0 -20
  129. package/lib/page/resolvePageExcerpt.d.ts +0 -9
  130. package/lib/page/resolvePageExcerpt.js +0 -15
  131. package/lib/page/resolvePageRoutesInfo.d.ts +0 -11
  132. package/lib/page/resolvePageRoutesInfo.js +0 -16
  133. package/lib/page/resolvePageTitle.d.ts +0 -9
  134. package/lib/page/resolvePageTitle.js +0 -26
  135. package/lib/themeApi/createThemeApi.d.ts +0 -7
  136. package/lib/themeApi/createThemeApi.js +0 -30
  137. package/lib/themeApi/index.d.ts +0 -1
  138. package/lib/themeApi/index.js +0 -13
  139. package/lib/themeApi/resolveThemeInfo.d.ts +0 -2
  140. package/lib/themeApi/resolveThemeInfo.js +0 -34
  141. package/lib/themeApi/resolveThemeLayouts.d.ts +0 -5
  142. package/lib/themeApi/resolveThemeLayouts.js +0 -33
  143. package/lib/types/theme-api/index.d.ts +0 -1
  144. package/lib/types/theme-api/index.js +0 -13
  145. package/lib/types/theme-api/themeApi.d.ts +0 -44
  146. package/lib/types/theme-api/themeApi.js +0 -2
@@ -1,4 +1,4 @@
1
- import type { Plugin, PluginFunction, PluginObject } from './plugin';
1
+ import type { Plugin, PluginConfig, PluginFunction, PluginObject } from './plugin';
2
2
  /**
3
3
  * Vuepress theme
4
4
  *
@@ -8,26 +8,54 @@ import type { Plugin, PluginFunction, PluginObject } from './plugin';
8
8
  *
9
9
  * A theme package should have a `Theme` as the default export
10
10
  */
11
- export declare type Theme<T extends ThemeConfig = ThemeConfig> = Plugin<T, ThemeObject>;
11
+ export declare type Theme = Plugin<ThemeObject>;
12
12
  /**
13
13
  * Vuepress theme function
14
14
  */
15
- export declare type ThemeFunction<T extends ThemeConfig = ThemeConfig> = PluginFunction<T, ThemeObject>;
15
+ export declare type ThemeFunction = PluginFunction<ThemeObject>;
16
16
  /**
17
17
  * Vuepress theme object
18
18
  */
19
- export interface ThemeObject extends PluginObject {
20
- multiple?: false;
21
- extends?: string;
19
+ export interface ThemeObject extends Omit<PluginObject, 'multiple'> {
20
+ /**
21
+ * Extended parent theme
22
+ */
23
+ extends?: Theme;
24
+ /**
25
+ * Specify the layouts directory or components map
26
+ */
22
27
  layouts?: string | Record<string, string>;
28
+ /**
29
+ * Allow using plugins in theme
30
+ */
31
+ plugins?: PluginConfig;
32
+ /**
33
+ * Allow overriding default templateBuild
34
+ */
35
+ templateBuild?: string;
36
+ /**
37
+ * Allow overriding default templateDev
38
+ */
39
+ templateDev?: string;
23
40
  }
24
41
  /**
25
- * Theme config to be used in user config file
26
- *
27
- * It will be used by a theme itself, but not by vuepress.
28
- *
29
- * Vuepress will only transfer this config to theme
30
- *
31
- * @remark suffix `Config` means this is for user config
42
+ * Resolved theme info
32
43
  */
33
- export declare type ThemeConfig = Record<string, any>;
44
+ export interface ThemeInfo {
45
+ /**
46
+ * Layout components
47
+ */
48
+ layouts: Record<string, string>;
49
+ /**
50
+ * Plugins, including theme itself and plugins used by theme
51
+ */
52
+ plugins: PluginConfig;
53
+ /**
54
+ * Default build template
55
+ */
56
+ templateBuild?: string;
57
+ /**
58
+ * Default dev template
59
+ */
60
+ templateDev?: string;
61
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/core",
3
- "version": "2.0.0-beta.4",
3
+ "version": "2.0.0-beta.40",
4
4
  "description": "Core package of VuePress",
5
5
  "keywords": [
6
6
  "vuepress",
@@ -15,26 +15,29 @@
15
15
  "url": "git+https://github.com/vuepress/vuepress-next.git"
16
16
  },
17
17
  "license": "MIT",
18
- "author": "Evan You",
18
+ "author": "meteorlxy",
19
19
  "main": "lib/index.js",
20
20
  "types": "lib/index.d.ts",
21
21
  "files": [
22
22
  "lib"
23
23
  ],
24
- "scripts": {
25
- "build": "tsc -b tsconfig.build.json",
26
- "clean": "rimraf lib *.tsbuildinfo"
27
- },
28
24
  "dependencies": {
29
- "@vuepress/client": "2.0.0-beta.4",
30
- "@vuepress/markdown": "2.0.0-beta.4",
31
- "@vuepress/shared": "2.0.0-beta.4",
32
- "@vuepress/utils": "2.0.0-beta.4",
33
- "gray-matter": "^4.0.2",
34
- "toml": "^3.0.0"
25
+ "@vuepress/client": "2.0.0-beta.40",
26
+ "@vuepress/markdown": "2.0.0-beta.40",
27
+ "@vuepress/shared": "2.0.0-beta.40",
28
+ "@vuepress/utils": "2.0.0-beta.40",
29
+ "gray-matter": "^4.0.3",
30
+ "toml": "^3.0.0",
31
+ "vue": "^3.2.33"
32
+ },
33
+ "peerDependencies": {
34
+ "vue": "^3.2.33"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "d42716e1b5b682ffb5d7cf124d0a24344493c467"
40
- }
39
+ "scripts": {
40
+ "build": "tsc -b tsconfig.build.json",
41
+ "clean": "rimraf lib *.tsbuildinfo"
42
+ }
43
+ }
package/CHANGELOG.md DELETED
@@ -1,260 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [2.0.0-beta.4](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.3...v2.0.0-beta.4) (2021-03-20)
7
-
8
- **Note:** Version bump only for package @vuepress/core
9
-
10
-
11
-
12
-
13
-
14
- # [2.0.0-beta.1](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.0...v2.0.0-beta.1) (2021-03-13)
15
-
16
- **Note:** Version bump only for package @vuepress/core
17
-
18
-
19
-
20
-
21
-
22
- # [2.0.0-beta.0](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.26...v2.0.0-beta.0) (2021-03-13)
23
-
24
-
25
- ### Features
26
-
27
- * implement vite hmr ([525c18d](https://github.com/vuepress/vuepress-next/commit/525c18d5a64fbdbdeb5ce1348ec1e1ead3dbd8f9))
28
-
29
-
30
-
31
-
32
-
33
- # [2.0.0-alpha.25](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.24...v2.0.0-alpha.25) (2021-02-20)
34
-
35
-
36
- ### Code Refactoring
37
-
38
- * **core:** remove theme data from site data ([187aef3](https://github.com/vuepress/vuepress-next/commit/187aef36607efc62d7b2d5c773553f89685cf64c))
39
-
40
-
41
- ### BREAKING CHANGES
42
-
43
- * **core:** `themeConfig` is not available in site data any more
44
-
45
-
46
-
47
-
48
-
49
- # [2.0.0-alpha.24](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.23...v2.0.0-alpha.24) (2021-02-13)
50
-
51
-
52
- ### Code Refactoring
53
-
54
- * **core:** change page default date to 0000-00-00 ([1ce602e](https://github.com/vuepress/vuepress-next/commit/1ce602ef811f29f083a8d10695a7b212ed82cae5))
55
- * **core:** remove permalink and pattern from page options ([9534989](https://github.com/vuepress/vuepress-next/commit/9534989a82e620b1c09b4a09d4cfee1e99d145fc))
56
-
57
-
58
- ### Features
59
-
60
- * **core:** add extendsPageOptions hook ([19b7e83](https://github.com/vuepress/vuepress-next/commit/19b7e83cb25ec523857d34c415782d595a05d0ff))
61
- * **core:** add watchers parameter to onWatched hook ([0bcd594](https://github.com/vuepress/vuepress-next/commit/0bcd594d1645fe9994d1456e86803e5619057bfb))
62
-
63
-
64
- ### BREAKING CHANGES
65
-
66
- * **core:** remove permalink and pattern from page options
67
- * **core:** change page default date from 1970-01-01 to 0000-00-00
68
-
69
-
70
-
71
-
72
-
73
- # [2.0.0-alpha.23](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.22...v2.0.0-alpha.23) (2021-02-10)
74
-
75
- **Note:** Version bump only for package @vuepress/core
76
-
77
-
78
-
79
-
80
-
81
- # [2.0.0-alpha.22](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.21...v2.0.0-alpha.22) (2021-02-10)
82
-
83
- **Note:** Version bump only for package @vuepress/core
84
-
85
-
86
-
87
-
88
-
89
- # [2.0.0-alpha.20](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.19...v2.0.0-alpha.20) (2021-02-04)
90
-
91
-
92
- ### Features
93
-
94
- * **core:** create siteData in vuepress app ([05b87dd](https://github.com/vuepress/vuepress-next/commit/05b87ddf32f32c94cc131e0074365aeba70f85f2))
95
- * **core:** make language available in page data ([03bb09f](https://github.com/vuepress/vuepress-next/commit/03bb09fd51aeaff56d26820a1401b87ea8bdeb38))
96
-
97
-
98
-
99
-
100
-
101
- # [2.0.0-alpha.19](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.18...v2.0.0-alpha.19) (2021-01-24)
102
-
103
-
104
- ### Features
105
-
106
- * **core:** add onWatched hook ([9725a10](https://github.com/vuepress/vuepress-next/commit/9725a101599363094a85916317109b67d365dff4))
107
-
108
-
109
-
110
-
111
-
112
- # [2.0.0-alpha.18](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.17...v2.0.0-alpha.18) (2021-01-17)
113
-
114
- **Note:** Version bump only for package @vuepress/core
115
-
116
-
117
-
118
-
119
-
120
- # [2.0.0-alpha.17](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.16...v2.0.0-alpha.17) (2021-01-13)
121
-
122
- **Note:** Version bump only for package @vuepress/core
123
-
124
-
125
-
126
-
127
-
128
- # [2.0.0-alpha.16](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.15...v2.0.0-alpha.16) (2021-01-11)
129
-
130
-
131
- ### Bug Fixes
132
-
133
- * **core:** support special characters in filename and permalink ([c3e68ef](https://github.com/vuepress/vuepress-next/commit/c3e68ef6a4aa3f6722d5bc4079bafe5d3b176e5e))
134
-
135
-
136
-
137
-
138
-
139
- # [2.0.0-alpha.15](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.14...v2.0.0-alpha.15) (2021-01-04)
140
-
141
-
142
- ### Features
143
-
144
- * **core:** provide app in all plugin hooks ([21cc3a6](https://github.com/vuepress/vuepress-next/commit/21cc3a608e54d38de8de8f453b5e88031b4cedb1))
145
-
146
-
147
-
148
-
149
-
150
- # [2.0.0-alpha.14](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.13...v2.0.0-alpha.14) (2021-01-03)
151
-
152
-
153
- ### Bug Fixes
154
-
155
- * **core:** fix page date resolving ([de6c5c8](https://github.com/vuepress/vuepress-next/commit/de6c5c8ca89347bea4ba2925e283a7b710a5b5d3))
156
-
157
-
158
-
159
-
160
-
161
- # [2.0.0-alpha.13](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.12...v2.0.0-alpha.13) (2020-12-23)
162
-
163
- **Note:** Version bump only for package @vuepress/core
164
-
165
-
166
-
167
-
168
-
169
- # [2.0.0-alpha.12](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.11...v2.0.0-alpha.12) (2020-12-19)
170
-
171
- **Note:** Version bump only for package @vuepress/core
172
-
173
-
174
-
175
-
176
-
177
- # [2.0.0-alpha.8](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.7...v2.0.0-alpha.8) (2020-12-11)
178
-
179
- **Note:** Version bump only for package @vuepress/core
180
-
181
-
182
-
183
-
184
-
185
- # [2.0.0-alpha.7](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.6...v2.0.0-alpha.7) (2020-12-09)
186
-
187
- **Note:** Version bump only for package @vuepress/core
188
-
189
-
190
-
191
-
192
-
193
- # [2.0.0-alpha.6](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.5...v2.0.0-alpha.6) (2020-12-09)
194
-
195
- **Note:** Version bump only for package @vuepress/core
196
-
197
-
198
-
199
-
200
-
201
- # [2.0.0-alpha.5](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.4...v2.0.0-alpha.5) (2020-12-03)
202
-
203
- **Note:** Version bump only for package @vuepress/core
204
-
205
-
206
-
207
-
208
-
209
- # [2.0.0-alpha.4](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.3...v2.0.0-alpha.4) (2020-12-02)
210
-
211
-
212
- ### Bug Fixes
213
-
214
- * **core:** failed to resolve local theme ([4d836e2](https://github.com/vuepress/vuepress-next/commit/4d836e2bc3e7affe17f63df1c4ce40c464a7e6fb))
215
- * **core:** warn if layout directory does not exist ([3d2d414](https://github.com/vuepress/vuepress-next/commit/3d2d4148024963521b9e1ebbc29aa19697ac3452))
216
-
217
-
218
-
219
-
220
-
221
- # [2.0.0-alpha.3](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2020-12-01)
222
-
223
-
224
- ### Bug Fixes
225
-
226
- * **core:** avoid runtime warning for empty template (close [#10](https://github.com/vuepress/vuepress-next/issues/10)) ([bcbf703](https://github.com/vuepress/vuepress-next/commit/bcbf703e6e449f7753697b7dfc503bd643bfd240))
227
-
228
-
229
-
230
-
231
-
232
- # 2.0.0-alpha.1 (2020-12-01)
233
-
234
-
235
- ### Bug Fixes
236
-
237
- * **core:** default value of base and lang ([5a5df27](https://github.com/vuepress/vuepress-next/commit/5a5df274de4691315e567e932a6cffe4a04d88c1))
238
- * **core:** infer page locale path correctly ([8f2b10b](https://github.com/vuepress/vuepress-next/commit/8f2b10bc8c9fa58ee4181bbfc50ade3e45e382ff))
239
- * **core:** resolve page date ([bd627d7](https://github.com/vuepress/vuepress-next/commit/bd627d79482e77c573654db699ff58f93e8d8dd5))
240
- * **core:** resolve page excerpt with correct markdown env ([e0f4066](https://github.com/vuepress/vuepress-next/commit/e0f406625baf085ced29ea88328069fb0a1d0cf4))
241
- * **core:** resolve page title from markdown content as fallback ([b216012](https://github.com/vuepress/vuepress-next/commit/b2160129b175013518b9fb7d82d034694509ae86))
242
- * **core:** resolve plugin and theme by name ([3031324](https://github.com/vuepress/vuepress-next/commit/30313247958f9e1d4a7214a18ce6e17bc582bc3e))
243
- * **core:** respect page options ([d8dbbb7](https://github.com/vuepress/vuepress-next/commit/d8dbbb777161130634fe5cadf0be571ed830a7ab))
244
-
245
-
246
- ### Features
247
-
248
- * **core:** add 404 page if not exist ([0297a9e](https://github.com/vuepress/vuepress-next/commit/0297a9ed96acb0b792dac44f72f4d549a5930841))
249
- * **core:** add clientAppRootComponentFiles hook ([7f640c8](https://github.com/vuepress/vuepress-next/commit/7f640c879f53b5dff67a2c6d374360f3e19aa679))
250
- * **core:** add extendsPageData hook ([5a10994](https://github.com/vuepress/vuepress-next/commit/5a109943ed1beb3ddfd07c018e0cba33cb46fdb2))
251
- * **core:** add pagePatterns option ([9a8855d](https://github.com/vuepress/vuepress-next/commit/9a8855d86683e95e2dae33493d0321fa14bfee9d))
252
- * **core:** add public directory config ([1b52ffe](https://github.com/vuepress/vuepress-next/commit/1b52ffe89a7f87d3c6822d07b6b75f2675b8745f))
253
- * **core:** add theme layouts option ([bf96cc3](https://github.com/vuepress/vuepress-next/commit/bf96cc3a2ab9133d3606231e3f9d0c46b2a2103c))
254
- * **core:** allow disable prefetch and preload links ([2991b6a](https://github.com/vuepress/vuepress-next/commit/2991b6a7025eefac21846eb520aa5ca2ea2dc594))
255
- * **core:** allow plugins and themes use export default ([874979d](https://github.com/vuepress/vuepress-next/commit/874979d6d86e308469488c8405e6f7bbc80d1391))
256
- * **core:** enable evergreen option by default ([fa67dbb](https://github.com/vuepress/vuepress-next/commit/fa67dbb9474c27ff10e4061ac15171bc4936d274))
257
- * **core:** export LocaleConfig type from shared ([04de925](https://github.com/vuepress/vuepress-next/commit/04de925326ad1101702e57fd9903de808a72bb97))
258
- * **core:** inject page title into route meta ([0d9e7e3](https://github.com/vuepress/vuepress-next/commit/0d9e7e3b3a0a78504fc586887cf1a777ae434846))
259
- * **core:** remove plugins from app options ([fe411e7](https://github.com/vuepress/vuepress-next/commit/fe411e7ef8a5802876f55246a9937825e802f538))
260
- * **core:** remove webpack related hooks ([9613f69](https://github.com/vuepress/vuepress-next/commit/9613f69ace1413b3776a6012319cf7c6fe1d3469))
@@ -1,2 +0,0 @@
1
- import type { App, PluginOptions, PluginConfig } from '../types';
2
- export declare const appUseByConfig: <T extends PluginOptions>(app: App, pluginConfig: PluginConfig<T>) => void;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.appUseByConfig = void 0;
4
- const normalizePluginConfig_1 = require("./normalizePluginConfig");
5
- const appUseByConfig = (app, pluginConfig) => {
6
- const normalizedPluginConfig = normalizePluginConfig_1.normalizePluginConfig(pluginConfig);
7
- if (normalizedPluginConfig === false)
8
- return;
9
- const [plugin, config] = normalizedPluginConfig;
10
- if (config === false)
11
- return;
12
- return app.use(plugin, config === true ? {} : config);
13
- };
14
- exports.appUseByConfig = appUseByConfig;
@@ -1,5 +0,0 @@
1
- import type { App, AppConfig } from '../types';
2
- /**
3
- * Create vuepress app
4
- */
5
- export declare const createApp: (config: AppConfig) => App;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createApp = void 0;
4
- const markdown_1 = require("@vuepress/markdown");
5
- const pluginApi_1 = require("../pluginApi");
6
- const appInit_1 = require("./appInit");
7
- const appPrepare_1 = require("./appPrepare");
8
- const appUse_1 = require("./appUse");
9
- const appUseByConfig_1 = require("./appUseByConfig");
10
- const createAppDir_1 = require("./createAppDir");
11
- const createAppEnv_1 = require("./createAppEnv");
12
- const createAppOptions_1 = require("./createAppOptions");
13
- const createAppSiteData_1 = require("./createAppSiteData");
14
- const createAppVersion_1 = require("./createAppVersion");
15
- const resolveBundler_1 = require("./resolveBundler");
16
- /**
17
- * Create vuepress app
18
- */
19
- const createApp = (config) => {
20
- const version = createAppVersion_1.createAppVersion();
21
- const options = createAppOptions_1.createAppOptions(config);
22
- const dir = createAppDir_1.createAppDir(options);
23
- const env = createAppEnv_1.createAppEnv(options);
24
- const siteData = createAppSiteData_1.createAppSiteData(options);
25
- const markdown = markdown_1.createMarkdown(options.markdown);
26
- const pluginApi = pluginApi_1.createPluginApi();
27
- const app = {
28
- version,
29
- options,
30
- dir,
31
- env,
32
- siteData,
33
- markdown,
34
- pluginApi,
35
- use: (...args) => appUse_1.appUse(app, ...args),
36
- useByConfig: (...args) => appUseByConfig_1.appUseByConfig(app, ...args),
37
- init: () => appInit_1.appInit(app),
38
- prepare: () => appPrepare_1.appPrepare(app),
39
- dev: () => resolveBundler_1.resolveBundler(options).dev(app),
40
- build: () => resolveBundler_1.resolveBundler(options).build(app),
41
- };
42
- return app;
43
- };
44
- exports.createApp = createApp;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAppDir = exports.createAppDirFunction = void 0;
4
- const utils_1 = require("@vuepress/utils");
5
- /**
6
- * Create directory util function
7
- */
8
- const createAppDirFunction = (baseDir) => {
9
- return (...args) => utils_1.path.resolve(baseDir, ...args);
10
- };
11
- exports.createAppDirFunction = createAppDirFunction;
12
- /**
13
- * Create directory utils for vuepress app
14
- */
15
- const createAppDir = (options) => {
16
- const cache = exports.createAppDirFunction(options.cache);
17
- const temp = exports.createAppDirFunction(options.temp);
18
- const source = exports.createAppDirFunction(options.source);
19
- const dest = exports.createAppDirFunction(options.dest);
20
- const publicDir = exports.createAppDirFunction(options.public);
21
- // @vuepress/client
22
- const client = exports.createAppDirFunction(utils_1.path.resolve(require.resolve('@vuepress/client/package.json'), '..'));
23
- return {
24
- cache,
25
- temp,
26
- source,
27
- dest,
28
- client,
29
- public: publicDir,
30
- };
31
- };
32
- exports.createAppDir = createAppDir;
@@ -1,5 +0,0 @@
1
- import type { AppEnv, AppOptions } from '../types';
2
- /**
3
- * Create environment flags for vuepress app
4
- */
5
- export declare const createAppEnv: (options: AppOptions) => AppEnv;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAppEnv = void 0;
4
- /**
5
- * Create environment flags for vuepress app
6
- */
7
- const createAppEnv = (options) => ({
8
- isProd: process.env.NODE_ENV === 'production',
9
- isTest: process.env.NODE_ENV === 'test',
10
- isDev: process.env.NODE_ENV === 'development',
11
- isDebug: options.debug,
12
- nodeEnv: process.env.NODE_ENV,
13
- });
14
- exports.createAppEnv = createAppEnv;
@@ -1,5 +0,0 @@
1
- import type { AppConfig, AppOptions } from '../types';
2
- /**
3
- * Create app options with default values
4
- */
5
- export declare const createAppOptions: ({ base, lang, title, description, head, locales, theme, themeConfig, bundler, bundlerConfig, source, dest, temp, cache, public: publicDir, markdown, host, port, debug, open, evergreen, pagePatterns, templateDev, templateSSR, shouldPreload, shouldPrefetch, }: AppConfig) => AppOptions;
@@ -1,5 +0,0 @@
1
- import type { App, Page } from '../types';
2
- /**
3
- * Create pages for vuepress app
4
- */
5
- export declare const createAppPages: (app: App) => Promise<Page[]>;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAppPages = void 0;
4
- const utils_1 = require("@vuepress/utils");
5
- const page_1 = require("../page");
6
- /**
7
- * Create pages for vuepress app
8
- */
9
- const createAppPages = async (app) => {
10
- // resolve page file paths according to the page patterns
11
- const pagePaths = await utils_1.globby(app.options.pagePatterns, {
12
- cwd: app.dir.source(),
13
- });
14
- // create pages from files
15
- const pages = await Promise.all(pagePaths.map(async (filePath) => {
16
- const pageOptions = { filePath };
17
- // plugin hook: extendsPageOptions
18
- const extendsPageOptions = await app.pluginApi.hooks.extendsPageOptions.process(filePath, app);
19
- extendsPageOptions.forEach((item) => Object.assign(pageOptions, item));
20
- return page_1.createPage(app, pageOptions);
21
- }));
22
- // if there is no 404 page, add one
23
- if (!pages.some((page) => page.path === '/404.html')) {
24
- pages.push(await page_1.createPage(app, {
25
- path: '/404.html',
26
- frontmatter: {
27
- layout: '404',
28
- },
29
- }));
30
- }
31
- return pages;
32
- };
33
- exports.createAppPages = createAppPages;
@@ -1,7 +0,0 @@
1
- import type { AppOptions, SiteData } from '../types';
2
- /**
3
- * Create site data for vuepress app
4
- *
5
- * Site data will also be used in client
6
- */
7
- export declare const createAppSiteData: (options: AppOptions) => SiteData;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAppSiteData = void 0;
4
- /**
5
- * Create site data for vuepress app
6
- *
7
- * Site data will also be used in client
8
- */
9
- const createAppSiteData = (options) => {
10
- return {
11
- base: options.base,
12
- lang: options.lang,
13
- title: options.title,
14
- description: options.description,
15
- head: options.head,
16
- locales: options.locales,
17
- };
18
- };
19
- exports.createAppSiteData = createAppSiteData;
@@ -1,4 +0,0 @@
1
- /**
2
- * Create version of vuepress app
3
- */
4
- export declare const createAppVersion: () => string;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAppVersion = void 0;
4
- /**
5
- * Create version of vuepress app
6
- */
7
- const createAppVersion = () => {
8
- var _a;
9
- return ((_a = require('../../package.json')) === null || _a === void 0 ? void 0 : _a.version) || '';
10
- };
11
- exports.createAppVersion = createAppVersion;
@@ -1,5 +0,0 @@
1
- import type { App, AppWriteTemp } from '../types';
2
- /**
3
- * Create write temp file util for vuepress app
4
- */
5
- export declare const createAppWriteTemp: (app: App) => Promise<AppWriteTemp>;
@@ -1,2 +0,0 @@
1
- import type { App, Plugin, PluginObject, PluginOptions } from '../types';
2
- export declare const normalizePlugin: <T extends PluginOptions = PluginOptions, U extends PluginObject = PluginObject>(app: App, plugin: string | Plugin<T, U>, config?: Partial<T> | undefined) => U;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizePlugin = void 0;
4
- const shared_1 = require("@vuepress/shared");
5
- const utils_1 = require("@vuepress/utils");
6
- const resolvePlugin_1 = require("./resolvePlugin");
7
- const normalizePlugin = (app, plugin, config) => {
8
- const resolvedPlugin = shared_1.isString(plugin) ? resolvePlugin_1.resolvePlugin(plugin) : plugin;
9
- if (resolvedPlugin === null) {
10
- const message = `plugin ${plugin} is not found`;
11
- utils_1.logger.error(message);
12
- throw new Error(message);
13
- }
14
- const pluginObject = shared_1.isFunction(resolvedPlugin)
15
- ? resolvedPlugin(config !== null && config !== void 0 ? config : {}, app)
16
- : resolvedPlugin;
17
- return pluginObject;
18
- };
19
- exports.normalizePlugin = normalizePlugin;
@@ -1,2 +0,0 @@
1
- import type { PluginOptions, PluginConfig, PluginConfigNormalized } from '../types';
2
- export declare const normalizePluginConfig: <T extends PluginOptions>(pluginConfig: PluginConfig<T>) => false | PluginConfigNormalized<T>;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizePluginConfig = void 0;
4
- const shared_1 = require("@vuepress/shared");
5
- const normalizePluginConfig = (pluginConfig) => {
6
- var _a;
7
- // 'container' -> ['container', {}]
8
- if (shared_1.isString(pluginConfig)) {
9
- return [pluginConfig, {}];
10
- }
11
- // ['container'] -> ['container', {}]
12
- // ['container', options] -> ['container', options]
13
- if (shared_1.isArray(pluginConfig)) {
14
- return [pluginConfig[0], (_a = pluginConfig[1]) !== null && _a !== void 0 ? _a : {}];
15
- }
16
- return false;
17
- };
18
- exports.normalizePluginConfig = normalizePluginConfig;
@@ -1,5 +0,0 @@
1
- import type { App, Page } from '../../types';
2
- /**
3
- * Generate page routes temp file of a single page
4
- */
5
- export declare const preparePageRoutes: (app: App, { key, path, pathInferred, filePathRelative, title, routesFilePathRelative, }: Page) => Promise<void>;