Skip to content

Commit 2f707a6

Browse files
committed
refactor(types): move helpers to @vuepress/types
1 parent 84250cc commit 2f707a6

File tree

5 files changed

+40
-37
lines changed

5 files changed

+40
-37
lines changed

packages/@vuepress/types/index.d.ts

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import {
2+
UserConfig,
3+
ThemeConfig,
4+
DefaultThemeConfig,
5+
ThemeEntry
6+
} from './lib'
7+
8+
export * from './lib'
9+
10+
/**
11+
* A helper function to define VuePress config file.
12+
*
13+
* @see https://vuepress.vuejs.org/config/
14+
*/
15+
export function defineConfig(config: UserConfig<DefaultThemeConfig>): void;
16+
17+
/**
18+
* A helper function to define VuePress config file, for custom theme.
19+
*
20+
* @see https://vuepress.vuejs.org/config/
21+
*/
22+
export function defineConfig4CustomTheme<T extends ThemeConfig = ThemeConfig>(
23+
config: UserConfig<T>
24+
): void;
25+
26+
/**
27+
* A helper function to define VuePress theme entry file.
28+
*
29+
* @see https://vuepress.vuejs.org/theme/option-api.html
30+
*/
31+
export function defineThemeEntry(config: ThemeEntry): void;

packages/@vuepress/types/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function define(config) {
2+
config;
3+
}
4+
exports.defineConfig = define;
5+
exports.defineConfig4CustomTheme = define;
6+
exports.defineThemeEntry = define;

packages/@vuepress/types/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
},
2121
"license": "MIT",
2222
"author": "ULIVZ",
23-
"types": "lib/index.ts",
23+
"main": "index.js",
24+
"types": "index.d.ts",
2425
"dependencies": {
2526
"webpack-chain": "^6.0.0"
2627
},

packages/vuepress/config.d.ts

-30
Original file line numberDiff line numberDiff line change
@@ -1,31 +1 @@
1-
import {
2-
UserConfig,
3-
ThemeConfig,
4-
DefaultThemeConfig,
5-
ThemeEntry
6-
} from '@vuepress/types'
7-
81
export * from '@vuepress/types'
9-
10-
/**
11-
* A helper function to define VuePress config file.
12-
*
13-
* @see https://vuepress.vuejs.org/config/
14-
*/
15-
export function defineConfig(config: UserConfig<DefaultThemeConfig>): void;
16-
17-
/**
18-
* A helper function to define VuePress config file, for custom theme.
19-
*
20-
* @see https://vuepress.vuejs.org/config/
21-
*/
22-
export function defineConfig4CustomTheme<T extends ThemeConfig = ThemeConfig>(
23-
config: UserConfig<T>
24-
): void;
25-
26-
/**
27-
* A helper function to define VuePress theme entry file.
28-
*
29-
* @see https://vuepress.vuejs.org/theme/option-api.html
30-
*/
31-
export function defineThemeEntry(config: ThemeEntry): void;

packages/vuepress/config.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
function define (config) {
2-
config
3-
}
4-
exports.defineConfig = define
5-
exports.defineConfig4CustomTheme = define
6-
exports.defineThemeEntry = define
1+
module.exports = require('@vuepress/types')

0 commit comments

Comments
 (0)