Skip to content

Commit

Permalink
refactor(types): move helpers to @vuepress/types
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Dec 23, 2021
1 parent 84250cc commit 2f707a6
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 37 deletions.
31 changes: 31 additions & 0 deletions packages/@vuepress/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {
UserConfig,
ThemeConfig,
DefaultThemeConfig,
ThemeEntry
} from './lib'

export * from './lib'

/**
* A helper function to define VuePress config file.
*
* @see https://vuepress.vuejs.org/config/
*/
export function defineConfig(config: UserConfig<DefaultThemeConfig>): void;

/**
* A helper function to define VuePress config file, for custom theme.
*
* @see https://vuepress.vuejs.org/config/
*/
export function defineConfig4CustomTheme<T extends ThemeConfig = ThemeConfig>(
config: UserConfig<T>
): void;

/**
* A helper function to define VuePress theme entry file.
*
* @see https://vuepress.vuejs.org/theme/option-api.html
*/
export function defineThemeEntry(config: ThemeEntry): void;
6 changes: 6 additions & 0 deletions packages/@vuepress/types/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function define(config) {
config;
}
exports.defineConfig = define;
exports.defineConfig4CustomTheme = define;
exports.defineThemeEntry = define;
3 changes: 2 additions & 1 deletion packages/@vuepress/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
},
"license": "MIT",
"author": "ULIVZ",
"types": "lib/index.ts",
"main": "index.js",
"types": "index.d.ts",
"dependencies": {
"webpack-chain": "^6.0.0"
},
Expand Down
30 changes: 0 additions & 30 deletions packages/vuepress/config.d.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1 @@
import {
UserConfig,
ThemeConfig,
DefaultThemeConfig,
ThemeEntry
} from '@vuepress/types'

export * from '@vuepress/types'

/**
* A helper function to define VuePress config file.
*
* @see https://vuepress.vuejs.org/config/
*/
export function defineConfig(config: UserConfig<DefaultThemeConfig>): void;

/**
* A helper function to define VuePress config file, for custom theme.
*
* @see https://vuepress.vuejs.org/config/
*/
export function defineConfig4CustomTheme<T extends ThemeConfig = ThemeConfig>(
config: UserConfig<T>
): void;

/**
* A helper function to define VuePress theme entry file.
*
* @see https://vuepress.vuejs.org/theme/option-api.html
*/
export function defineThemeEntry(config: ThemeEntry): void;
7 changes: 1 addition & 6 deletions packages/vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
function define (config) {
config
}
exports.defineConfig = define
exports.defineConfig4CustomTheme = define
exports.defineThemeEntry = define
module.exports = require('@vuepress/types')

0 comments on commit 2f707a6

Please sign in to comment.