Skip to content

Commit 5709c57

Browse files
committed
refactor(core): improve comments
1 parent 017abb3 commit 5709c57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+225
-9
lines changed

e2e/docs/.vuepress/plugins/foo/fooPlugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import type { Plugin } from 'vuepress/core'
12
import { getDirname, path } from 'vuepress/utils'
23

34
const __dirname = getDirname(import.meta.url)
45

5-
export const fooPlugin = {
6+
export const fooPlugin: Plugin = {
67
name: 'test-plugin',
78
clientConfigFile: path.resolve(
89
__dirname,

packages/core/src/app/appInit.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const log = debug('vuepress:core/app')
99
* Initialize a vuepress app
1010
*
1111
* Plugins should be used before initialization.
12+
*
13+
* @internal
1214
*/
1315
export const appInit = async (app: App): Promise<void> => {
1416
log('init start')

packages/core/src/app/appPrepare.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const log = debug('vuepress:core/app')
1818
* - routes
1919
* - site data
2020
* - other files that generated by plugins
21+
*
22+
* @internal
2123
*/
2224
export const appPrepare = async (app: App): Promise<void> => {
2325
log('prepare start')

packages/core/src/app/appUse.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ import { resolvePluginObject } from './resolvePluginObject.js'
44

55
const log = debug('vuepress:core/app')
66

7+
/**
8+
* Use a plugin in vuepress app.
9+
*
10+
* Should be called before initialization.
11+
*
12+
* @internal
13+
*/
714
export const appUse = (app: App, rawPlugin: Plugin): App => {
815
const pluginObject = resolvePluginObject(app, rawPlugin)
916

packages/core/src/app/createBaseApp.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ import { resolveAppWriteTemp } from './resolveAppWriteTemp.js'
1717
import { setupAppThemeAndPlugins } from './setupAppThemeAndPlugins.js'
1818

1919
/**
20-
* Create vuepress app
20+
* Create base vuepress app.
21+
*
22+
* Notice that the base app could not be used for dev nor build.
23+
*
24+
* It would be used for creating dev app or build app, or for testing.
2125
*/
2226
export const createBaseApp = (config: AppConfig): App => {
2327
const options = resolveAppOptions(config)

packages/core/src/app/createBuildApp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { AppConfig, BuildApp } from '../types/index.js'
22
import { createBaseApp } from './createBaseApp.js'
33

44
/**
5-
* Create vuepress build app
5+
* Create vuepress build app.
66
*/
77
export const createBuildApp = (config: AppConfig): BuildApp => {
88
const app = createBaseApp(config) as BuildApp

packages/core/src/app/createDevApp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { AppConfig, DevApp } from '../types/index.js'
22
import { createBaseApp } from './createBaseApp.js'
33

44
/**
5-
* Create vuepress dev app
5+
* Create vuepress dev app.
66
*/
77
export const createDevApp = (config: AppConfig): DevApp => {
88
const app = createBaseApp(config) as DevApp

packages/core/src/app/prepare/prepareClientConfigs.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import type { App } from '../../types/index.js'
22

33
/**
44
* Generate client configs temp file
5+
*
6+
* @internal
57
*/
68
export const prepareClientConfigs = async (app: App): Promise<void> => {
79
// plugin hook: clientConfigFile

packages/core/src/app/prepare/prepareSiteData.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ if (import.meta.hot) {
1717

1818
/**
1919
* Generate site data temp file
20+
*
21+
* @internal
2022
*/
2123
export const prepareSiteData = async (app: App): Promise<void> => {
2224
let content = `\

packages/core/src/app/resolveAppDir.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ const require = createRequire(import.meta.url)
66

77
/**
88
* Create directory util function
9+
*
10+
* @internal
911
*/
1012
export const createAppDirFunction =
1113
(baseDir: string): AppDirFunction =>

0 commit comments

Comments
 (0)