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

Commit e19d910

Browse files
authored
chore: Add inline docs (#193)
1 parent 05176a8 commit e19d910

File tree

4 files changed

+102
-25
lines changed

4 files changed

+102
-25
lines changed

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="text-xs-center" align="center" style="margin: 20px">
2-
<img src="logo.png">
2+
<img src="https://raw.githubusercontent.com/vuejs/rollup-plugin-vue/master/logo.png">
33
</div>
44

55
## Introduction
@@ -19,12 +19,14 @@ With rollup you can break your application into reusable modules.
1919

2020
## Usage
2121

22+
> 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)
23+
2224
```js
23-
import vue from 'rollup-plugin-vue'
25+
import VuePlugin from 'rollup-plugin-vue'
2426

2527
export default {
2628
entry: 'main.js',
27-
plugins: [vue(/* options */)]
29+
plugins: [VuePlugin(/* VuePluginOptions */)]
2830
}
2931
```
3032

package.json

+20-19
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,37 @@
22
"name": "rollup-plugin-vue",
33
"version": "4.0.2",
44
"description": "Roll .vue files",
5+
"author": "Rahul Kadyan <[email protected]>",
6+
"bugs": {
7+
"url": "https://github.com/znck/rollup-plugin-vue/issues"
8+
},
9+
"homepage": "https://github.com/znck/rollup-plugin-vue#readme",
10+
"keywords": [
11+
"rollup-plugin",
12+
"vue"
13+
],
14+
"license": "MIT",
515
"main": "dist/rollup-plugin-vue.common.js",
616
"module": "dist/rollup-plugin-vue.js",
17+
"repository": {
18+
"type": "git",
19+
"url": "git+https://github.com/znck/rollup-plugin-vue.git"
20+
},
721
"scripts": {
822
"prebuild": "npm run lint",
923
"build": "tsc",
10-
"lint": "prettier --no-semi --single-quote --write **/*.js **/*.vue !test/target/** !dist/**",
11-
"test": "jest",
1224
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
25+
"docs": "typedoc typings src/index.ts",
26+
"lint": "prettier --no-semi --single-quote --write **/*.js **/*.vue !test/target/** !dist/**",
1327
"preversion": "npm run build",
14-
"version": "npm run changelog && git add CHANGELOG.md",
15-
"postversion": "npm publish && git push && git push --tags"
16-
},
17-
"repository": {
18-
"type": "git",
19-
"url": "git+https://github.com/znck/rollup-plugin-vue.git"
28+
"version": "yarn changelog && yarn build && git add docs/ CHANGELOG.md",
29+
"postversion": "npm publish && git push && git push --tags",
30+
"test": "jest"
2031
},
21-
"keywords": [
22-
"rollup-plugin",
23-
"vue"
24-
],
2532
"files": [
2633
"dist/",
2734
"src/"
2835
],
29-
"author": "Rahul Kadyan <[email protected]>",
30-
"license": "MIT",
31-
"bugs": {
32-
"url": "https://github.com/znck/rollup-plugin-vue/issues"
33-
},
34-
"homepage": "https://github.com/znck/rollup-plugin-vue#readme",
3536
"dependencies": {
3637
"@babel/runtime": "^7.0.0-beta.46",
3738
"@vue/component-compiler": "^3.3.1",
@@ -73,4 +74,4 @@
7374
"peerDependencies": {
7475
"vue-template-compiler": "*"
7576
}
76-
}
77+
}

src/index.ts

+66-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
import {
99
createDefaultCompiler,
1010
assemble,
11-
AssembleOptions,
1211
ScriptOptions,
1312
StyleOptions,
1413
TemplateOptions,
@@ -20,20 +19,84 @@ import {parse, SFCDescriptor} from '@vue/component-compiler-utils'
2019

2120
const hash = require('hash-sum')
2221

23-
export type VuePluginOptions = AssembleOptions & {
22+
export interface VuePluginOptions {
23+
/**
24+
* Include files or directories.
25+
* @default `'.vue'`
26+
*/
2427
include?: string
28+
/**
29+
* Exclude files or directories.
30+
* @default `undefined`
31+
*/
2532
exclude?: string
33+
/**
34+
* Default language for blocks.
35+
*
36+
* @default `{}`
37+
* @example
38+
* ```js
39+
* VuePlugin({ defaultLang: { script: 'ts' } })
40+
* ```
41+
*/
2642
defaultLang?: {
2743
[key: string]: string
2844
},
45+
/**
46+
* Exclude customBlocks for final build.
47+
* @default `['*']`
48+
* @example
49+
* ```js
50+
* VuePlugin({ blackListCustomBlocks: ['markdown', 'test'] })
51+
* ```
52+
*/
2953
blackListCustomBlocks?: string[]
54+
/**
55+
* Include customBlocks for final build.
56+
* @default `[]`
57+
* @example
58+
* ```js
59+
* VuePlugin({ blackListCustomBlocks: ['markdown', 'test'] })
60+
* ```
61+
*/
3062
whiteListCustomBlocks?: string[]
63+
/**
64+
* Inject CSS in JavaScript.
65+
* @default `true`
66+
* @example
67+
* ```js
68+
* VuePlugin({ css: false }) // to extract css
69+
* ```
70+
*/
3171
css?: boolean
72+
/**
73+
* @@vue/component-compiler [#](https://github.com/vuejs/vue-component-compiler#api) script processing options.
74+
*/
3275
script?: ScriptOptions
76+
/**
77+
* @@vue/component-compiler [#](https://github.com/vuejs/vue-component-compiler#api) style processing options.
78+
*/
3379
style?: StyleOptions
80+
/**
81+
* @@vue/component-compiler [#](https://github.com/vuejs/vue-component-compiler#api) template processing options.
82+
*/
3483
template?: TemplateOptions
84+
/**
85+
* @@vue/component-compiler [#](https://github.com/vuejs/vue-component-compiler#api) module name or global function for custom runtime component normalizer.
86+
*/
87+
normalizer?: string
88+
/**
89+
* @@vue/component-compiler [#](https://github.com/vuejs/vue-component-compiler#api) module name or global function for custom style injector factory.
90+
*/
91+
styleInjector?: string
92+
/**
93+
* @@vue/component-compiler [#](https://github.com/vuejs/vue-component-compiler#api) module name or global function for custom style injector factory for SSR environment.
94+
*/
95+
styleInjectorSSR?: string
3596
}
36-
97+
/**
98+
* Rollup plugin for handling .vue files.
99+
*/
37100
export default function VuePlugin(opts: VuePluginOptions = {}): Plugin {
38101
const isVue = createVueFilter(opts.include, opts.exclude)
39102
const isProduction = process.env.NODE_ENV === 'production'

typedoc.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const { version } = require('./package.json')
2+
3+
module.exports = {
4+
out: 'docs/',
5+
excludeExternals: true,
6+
excludePrivate: true,
7+
mode: 'file',
8+
hideGenerator: true,
9+
gitRevision: 'v' + version,
10+
exclude: ['src/utils.ts']
11+
}

0 commit comments

Comments
 (0)