Skip to content

Commit

Permalink
chore: update documentation for new features option
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 18, 2024
1 parent 3e839e2 commit 7fc7994
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 22 deletions.
56 changes: 46 additions & 10 deletions packages/plugin-vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,47 @@ export interface Options {

isProduction?: boolean

// options to pass on to vue/compiler-sfc
/**
* Requires @vitejs/plugin-vue@^5.1.0
*/
features?: {
/**
* Enable reactive destructure for `defineProps`.
* - Available in Vue 3.4 and later.
* - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+
*/
propsDestructure?: boolean
/**
* Transform Vue SFCs into custom elements.
* - `true`: all `*.vue` imports are converted into custom elements
* - `string | RegExp`: matched files are converted into custom elements
* - **default:** /\.ce\.vue$/
*/
customElement?: boolean | string | RegExp | (string | RegExp)[]
/**
* Set to `false` to disable Options API support and allow related code in
* Vue core to be dropped via dead-code elimination in production builds,
* resulting in smaller bundles.
* - **default:** `true`
*/
optionsAPI?: boolean
/**
* Set to `true` to enable devtools support in production builds.
* Results in slightly larger bundles.
* - **default:** `false`
*/
prodDevtools?: boolean
/**
* Set to `true` to enable detailed information for hydration mismatch
* errors in production builds. Results in slightly larger bundles.
* - **default:** `false`
*/
prodHydrationMismatchDetails?: boolean
}

// `script`, `template` and `style` are lower-level compiler options
// to pass on to respective APIs of `vue/compiler-sfc`

script?: Partial<
Omit<
SFCScriptCompileOptions,
Expand All @@ -33,7 +73,6 @@ export interface Options {
| 'sourceMap'
| 'genDefaultAs'
| 'customElement'
| 'defineModel'
>
>

Expand All @@ -53,6 +92,7 @@ export interface Options {
| 'preprocessLang'
>
>

style?: Partial<
Omit<
SFCStyleCompileOptions,
Expand All @@ -72,18 +112,14 @@ export interface Options {
>

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

/**
* Use custom compiler-sfc instance. Can be used to force a specific version.
* @deprecated moved to `features.customElement`.
*/
compiler?: typeof _compiler
customElements?: boolean | string | RegExp | (string | RegExp)[]
}
```

Expand Down
41 changes: 29 additions & 12 deletions packages/plugin-vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,36 +93,53 @@ export interface Options {
>
>

/**
* @deprecated moved to `features.customElement`.
*/
customElement?: boolean | string | RegExp | (string | RegExp)[]

/**
* Use custom compiler-sfc instance. Can be used to force a specific version.
*/
compiler?: typeof _compiler

/**
* Requires @vitejs/plugin-vue@^5.1.0
*/
features?: {
optionsAPI?: boolean
prodDevtools?: boolean
prodHydrationMismatchDetails?: boolean
/**
* Enable reactive destructure for `defineProps`.
* - Available in Vue 3.4 and later.
* - Defaults to true in Vue 3.5+
* - Defaults to false in Vue 3.4 (**experimental**)
* - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+
*/
propsDestructure?: boolean
/**
* Transform Vue SFCs into custom elements.
* - `true`: all `*.vue` imports are converted into custom elements
* - `string | RegExp`: matched files are converted into custom elements
*
* @default /\.ce\.vue$/
* - **default:** /\.ce\.vue$/
*/
customElement?: boolean | string | RegExp | (string | RegExp)[]
/**
* Set to `false` to disable Options API support and allow related code in
* Vue core to be dropped via dead-code elimination in production builds,
* resulting in smaller bundles.
* - **default:** `true`
*/
optionsAPI?: boolean
/**
* Set to `true` to enable devtools support in production builds.
* Results in slightly larger bundles.
* - **default:** `false`
*/
prodDevtools?: boolean
/**
* Set to `true` to enable detailed information for hydration mismatch
* errors in production builds. Results in slightly larger bundles.
* - **default:** `false`
*/
prodHydrationMismatchDetails?: boolean
}

/**
* @deprecated moved to `features.customElement`.
*/
customElement?: boolean | string | RegExp | (string | RegExp)[]
}

export interface ResolvedOptions extends Options {
Expand Down

0 comments on commit 7fc7994

Please sign in to comment.