diff --git a/packages/@vuepress/types/index.d.ts b/packages/@vuepress/types/index.d.ts new file mode 100644 index 0000000000..f7f629ec60 --- /dev/null +++ b/packages/@vuepress/types/index.d.ts @@ -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): void; + +/** + * A helper function to define VuePress config file, for custom theme. + * + * @see https://vuepress.vuejs.org/config/ + */ +export function defineConfig4CustomTheme( + config: UserConfig +): 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; diff --git a/packages/@vuepress/types/index.js b/packages/@vuepress/types/index.js new file mode 100644 index 0000000000..7d9ae61e6d --- /dev/null +++ b/packages/@vuepress/types/index.js @@ -0,0 +1,6 @@ +function define(config) { + config; +} +exports.defineConfig = define; +exports.defineConfig4CustomTheme = define; +exports.defineThemeEntry = define; diff --git a/packages/@vuepress/types/package.json b/packages/@vuepress/types/package.json index 308b5de7ba..68826f468e 100644 --- a/packages/@vuepress/types/package.json +++ b/packages/@vuepress/types/package.json @@ -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" }, diff --git a/packages/vuepress/config.d.ts b/packages/vuepress/config.d.ts index 84829078de..8accc4911f 100644 --- a/packages/vuepress/config.d.ts +++ b/packages/vuepress/config.d.ts @@ -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): void; - -/** - * A helper function to define VuePress config file, for custom theme. - * - * @see https://vuepress.vuejs.org/config/ - */ -export function defineConfig4CustomTheme( - config: UserConfig -): 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; diff --git a/packages/vuepress/config.js b/packages/vuepress/config.js index e9aff7a4b3..51cce319d2 100644 --- a/packages/vuepress/config.js +++ b/packages/vuepress/config.js @@ -1,6 +1 @@ -function define (config) { - config -} -exports.defineConfig = define -exports.defineConfig4CustomTheme = define -exports.defineThemeEntry = define +module.exports = require('@vuepress/types')