diff --git a/README.md b/README.md
index 63303e5..0f1ba50 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-

+
## Introduction
@@ -19,12 +19,14 @@ With rollup you can break your application into reusable modules.
## Usage
+> This document applies to v4.0+. If you are looking for older versions, docs are [here](https://github.com/vuejs/rollup-plugin-vue/tree/2.2/docs)
+
```js
-import vue from 'rollup-plugin-vue'
+import VuePlugin from 'rollup-plugin-vue'
export default {
entry: 'main.js',
- plugins: [vue(/* options */)]
+ plugins: [VuePlugin(/* VuePluginOptions */)]
}
```
diff --git a/package.json b/package.json
index 05b5d9a..f7ed6fc 100644
--- a/package.json
+++ b/package.json
@@ -2,36 +2,37 @@
"name": "rollup-plugin-vue",
"version": "4.0.2",
"description": "Roll .vue files",
+ "author": "Rahul Kadyan ",
+ "bugs": {
+ "url": "https://github.com/znck/rollup-plugin-vue/issues"
+ },
+ "homepage": "https://github.com/znck/rollup-plugin-vue#readme",
+ "keywords": [
+ "rollup-plugin",
+ "vue"
+ ],
+ "license": "MIT",
"main": "dist/rollup-plugin-vue.common.js",
"module": "dist/rollup-plugin-vue.js",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/znck/rollup-plugin-vue.git"
+ },
"scripts": {
"prebuild": "npm run lint",
"build": "tsc",
- "lint": "prettier --no-semi --single-quote --write **/*.js **/*.vue !test/target/** !dist/**",
- "test": "jest",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
+ "docs": "typedoc typings src/index.ts",
+ "lint": "prettier --no-semi --single-quote --write **/*.js **/*.vue !test/target/** !dist/**",
"preversion": "npm run build",
- "version": "npm run changelog && git add CHANGELOG.md",
- "postversion": "npm publish && git push && git push --tags"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/znck/rollup-plugin-vue.git"
+ "version": "yarn changelog && yarn build && git add docs/ CHANGELOG.md",
+ "postversion": "npm publish && git push && git push --tags",
+ "test": "jest"
},
- "keywords": [
- "rollup-plugin",
- "vue"
- ],
"files": [
"dist/",
"src/"
],
- "author": "Rahul Kadyan ",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/znck/rollup-plugin-vue/issues"
- },
- "homepage": "https://github.com/znck/rollup-plugin-vue#readme",
"dependencies": {
"@babel/runtime": "^7.0.0-beta.46",
"@vue/component-compiler": "^3.3.1",
@@ -73,4 +74,4 @@
"peerDependencies": {
"vue-template-compiler": "*"
}
-}
+}
\ No newline at end of file
diff --git a/src/index.ts b/src/index.ts
index ced6041..7644cce 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -7,7 +7,6 @@ import {
import {
createDefaultCompiler,
assemble,
- AssembleOptions,
ScriptOptions,
StyleOptions,
TemplateOptions,
@@ -19,20 +18,84 @@ import {parse, SFCDescriptor} from '@vue/component-compiler-utils'
const hash = require('hash-sum')
-export type VuePluginOptions = AssembleOptions & {
+export interface VuePluginOptions {
+ /**
+ * Include files or directories.
+ * @default `'.vue'`
+ */
include?: string
+ /**
+ * Exclude files or directories.
+ * @default `undefined`
+ */
exclude?: string
+ /**
+ * Default language for blocks.
+ *
+ * @default `{}`
+ * @example
+ * ```js
+ * VuePlugin({ defaultLang: { script: 'ts' } })
+ * ```
+ */
defaultLang?: {
[key: string]: string
},
+ /**
+ * Exclude customBlocks for final build.
+ * @default `['*']`
+ * @example
+ * ```js
+ * VuePlugin({ blackListCustomBlocks: ['markdown', 'test'] })
+ * ```
+ */
blackListCustomBlocks?: string[]
+ /**
+ * Include customBlocks for final build.
+ * @default `[]`
+ * @example
+ * ```js
+ * VuePlugin({ blackListCustomBlocks: ['markdown', 'test'] })
+ * ```
+ */
whiteListCustomBlocks?: string[]
+ /**
+ * Inject CSS in JavaScript.
+ * @default `true`
+ * @example
+ * ```js
+ * VuePlugin({ css: false }) // to extract css
+ * ```
+ */
css?: boolean
+ /**
+ * @@vue/component-compiler [#](https://github.com/vuejs/vue-component-compiler#api) script processing options.
+ */
script?: ScriptOptions
+ /**
+ * @@vue/component-compiler [#](https://github.com/vuejs/vue-component-compiler#api) style processing options.
+ */
style?: StyleOptions
+ /**
+ * @@vue/component-compiler [#](https://github.com/vuejs/vue-component-compiler#api) template processing options.
+ */
template?: TemplateOptions
+ /**
+ * @@vue/component-compiler [#](https://github.com/vuejs/vue-component-compiler#api) module name or global function for custom runtime component normalizer.
+ */
+ normalizer?: string
+ /**
+ * @@vue/component-compiler [#](https://github.com/vuejs/vue-component-compiler#api) module name or global function for custom style injector factory.
+ */
+ styleInjector?: string
+ /**
+ * @@vue/component-compiler [#](https://github.com/vuejs/vue-component-compiler#api) module name or global function for custom style injector factory for SSR environment.
+ */
+ styleInjectorSSR?: string
}
-
+/**
+ * Rollup plugin for handling .vue files.
+ */
export default function VuePlugin(opts: VuePluginOptions = {}): Plugin {
const isVue = createVueFilter(opts.include, opts.exclude)
const isProduction = process.env.NODE_ENV === 'production'
diff --git a/typedoc.js b/typedoc.js
new file mode 100644
index 0000000..bdaf06f
--- /dev/null
+++ b/typedoc.js
@@ -0,0 +1,11 @@
+const { version } = require('./package.json')
+
+module.exports = {
+ out: 'docs/',
+ excludeExternals: true,
+ excludePrivate: true,
+ mode: 'file',
+ hideGenerator: true,
+ gitRevision: 'v' + version,
+ exclude: ['src/utils.ts']
+}
\ No newline at end of file