Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit eb1c863

Browse files
committed
fix: Add deprecation warning for *CustomBlocks options
1 parent 8707e70 commit eb1c863

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

src/index.ts

+33-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,27 @@ export interface VuePluginOptions {
7676
*/
7777
customBlocks?: string[] | ((tag: string) => boolean)
7878

79+
/**
80+
* Exclude customBlocks for final build.
81+
* @default `['*']`
82+
* @deprecated
83+
* @example
84+
* ```js
85+
* VuePlugin({ blackListCustomBlocks: ['markdown', 'test'] })
86+
* ```
87+
*/
88+
blackListCustomBlocks?: string[]
89+
/**
90+
* Include customBlocks for final build.
91+
* @default `[]`
92+
* @deprecated
93+
* @example
94+
* ```js
95+
* VuePlugin({ blackListCustomBlocks: ['markdown', 'test'] })
96+
* ```
97+
*/
98+
whiteListCustomBlocks?: string[]
99+
79100
/**
80101
* Prepend CSS.
81102
* @default `undefined`
@@ -164,8 +185,17 @@ export default function vue(opts: VuePluginOptions = {}): Plugin {
164185
}
165186

166187
const shouldExtractCss = opts.css === false
188+
const customBlocks: string[] = []
167189

168-
const isAllowed = createCustomBlockFilter(opts.customBlocks)
190+
if (opts.blackListCustomBlocks) {
191+
console.warn('`blackListCustomBlocks` option is deprecated use `customBlocks`. See https://rollup-plugin-vue.vuejs.org/options.html#customblocks.')
192+
customBlocks.push(...opts.blackListCustomBlocks.map(tag => '!' + tag))
193+
}
194+
if (opts.whiteListCustomBlocks) {
195+
console.warn('`whiteListCustomBlocks` option is deprecated use `customBlocks`. See https://rollup-plugin-vue.vuejs.org/options.html#customblocks.')
196+
customBlocks.push(...opts.whiteListCustomBlocks)
197+
}
198+
const isAllowed = createCustomBlockFilter(opts.customBlocks || customBlocks)
169199

170200
const beforeAssemble =
171201
opts.beforeAssemble ||
@@ -181,6 +211,8 @@ export default function vue(opts: VuePluginOptions = {}): Plugin {
181211
delete opts.css
182212
delete opts.exposeFilename
183213
delete opts.customBlocks
214+
delete opts.blackListCustomBlocks
215+
delete opts.whiteListCustomBlocks
184216
delete opts.defaultLang
185217
delete opts.include
186218
delete opts.exclude

0 commit comments

Comments
 (0)