Skip to content

Commit 7fc7994

Browse files
committedJun 18, 2024·
chore: update documentation for new features option
1 parent 3e839e2 commit 7fc7994

File tree

2 files changed

+75
-22
lines changed

2 files changed

+75
-22
lines changed
 

‎packages/plugin-vue/README.md

+46-10
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,47 @@ export interface Options {
2222

2323
isProduction?: boolean
2424

25-
// options to pass on to vue/compiler-sfc
25+
/**
26+
* Requires @vitejs/plugin-vue@^5.1.0
27+
*/
28+
features?: {
29+
/**
30+
* Enable reactive destructure for `defineProps`.
31+
* - Available in Vue 3.4 and later.
32+
* - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+
33+
*/
34+
propsDestructure?: boolean
35+
/**
36+
* Transform Vue SFCs into custom elements.
37+
* - `true`: all `*.vue` imports are converted into custom elements
38+
* - `string | RegExp`: matched files are converted into custom elements
39+
* - **default:** /\.ce\.vue$/
40+
*/
41+
customElement?: boolean | string | RegExp | (string | RegExp)[]
42+
/**
43+
* Set to `false` to disable Options API support and allow related code in
44+
* Vue core to be dropped via dead-code elimination in production builds,
45+
* resulting in smaller bundles.
46+
* - **default:** `true`
47+
*/
48+
optionsAPI?: boolean
49+
/**
50+
* Set to `true` to enable devtools support in production builds.
51+
* Results in slightly larger bundles.
52+
* - **default:** `false`
53+
*/
54+
prodDevtools?: boolean
55+
/**
56+
* Set to `true` to enable detailed information for hydration mismatch
57+
* errors in production builds. Results in slightly larger bundles.
58+
* - **default:** `false`
59+
*/
60+
prodHydrationMismatchDetails?: boolean
61+
}
62+
63+
// `script`, `template` and `style` are lower-level compiler options
64+
// to pass on to respective APIs of `vue/compiler-sfc`
65+
2666
script?: Partial<
2767
Omit<
2868
SFCScriptCompileOptions,
@@ -33,7 +73,6 @@ export interface Options {
3373
| 'sourceMap'
3474
| 'genDefaultAs'
3575
| 'customElement'
36-
| 'defineModel'
3776
>
3877
>
3978

@@ -53,6 +92,7 @@ export interface Options {
5392
| 'preprocessLang'
5493
>
5594
>
95+
5696
style?: Partial<
5797
Omit<
5898
SFCStyleCompileOptions,
@@ -72,18 +112,14 @@ export interface Options {
72112
>
73113

74114
/**
75-
* Transform Vue SFCs into custom elements.
76-
* - `true`: all `*.vue` imports are converted into custom elements
77-
* - `string | RegExp`: matched files are converted into custom elements
78-
*
79-
* @default /\.ce\.vue$/
115+
* Use custom compiler-sfc instance. Can be used to force a specific version.
80116
*/
81-
customElement?: boolean | string | RegExp | (string | RegExp)[]
117+
compiler?: typeof _compiler
82118

83119
/**
84-
* Use custom compiler-sfc instance. Can be used to force a specific version.
120+
* @deprecated moved to `features.customElement`.
85121
*/
86-
compiler?: typeof _compiler
122+
customElements?: boolean | string | RegExp | (string | RegExp)[]
87123
}
88124
```
89125

‎packages/plugin-vue/src/index.ts

+29-12
Original file line numberDiff line numberDiff line change
@@ -93,36 +93,53 @@ export interface Options {
9393
>
9494
>
9595

96-
/**
97-
* @deprecated moved to `features.customElement`.
98-
*/
99-
customElement?: boolean | string | RegExp | (string | RegExp)[]
100-
10196
/**
10297
* Use custom compiler-sfc instance. Can be used to force a specific version.
10398
*/
10499
compiler?: typeof _compiler
105100

101+
/**
102+
* Requires @vitejs/plugin-vue@^5.1.0
103+
*/
106104
features?: {
107-
optionsAPI?: boolean
108-
prodDevtools?: boolean
109-
prodHydrationMismatchDetails?: boolean
110105
/**
111106
* Enable reactive destructure for `defineProps`.
112107
* - Available in Vue 3.4 and later.
113-
* - Defaults to true in Vue 3.5+
114-
* - Defaults to false in Vue 3.4 (**experimental**)
108+
* - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+
115109
*/
116110
propsDestructure?: boolean
117111
/**
118112
* Transform Vue SFCs into custom elements.
119113
* - `true`: all `*.vue` imports are converted into custom elements
120114
* - `string | RegExp`: matched files are converted into custom elements
121-
*
122-
* @default /\.ce\.vue$/
115+
* - **default:** /\.ce\.vue$/
123116
*/
124117
customElement?: boolean | string | RegExp | (string | RegExp)[]
118+
/**
119+
* Set to `false` to disable Options API support and allow related code in
120+
* Vue core to be dropped via dead-code elimination in production builds,
121+
* resulting in smaller bundles.
122+
* - **default:** `true`
123+
*/
124+
optionsAPI?: boolean
125+
/**
126+
* Set to `true` to enable devtools support in production builds.
127+
* Results in slightly larger bundles.
128+
* - **default:** `false`
129+
*/
130+
prodDevtools?: boolean
131+
/**
132+
* Set to `true` to enable detailed information for hydration mismatch
133+
* errors in production builds. Results in slightly larger bundles.
134+
* - **default:** `false`
135+
*/
136+
prodHydrationMismatchDetails?: boolean
125137
}
138+
139+
/**
140+
* @deprecated moved to `features.customElement`.
141+
*/
142+
customElement?: boolean | string | RegExp | (string | RegExp)[]
126143
}
127144

128145
export interface ResolvedOptions extends Options {

0 commit comments

Comments
 (0)
Please sign in to comment.