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

chore: Add inline docs #193

Merged
merged 1 commit into from
May 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="text-xs-center" align="center" style="margin: 20px">
<img src="logo.png">
<img src="https://raw.githubusercontent.com/vuejs/rollup-plugin-vue/master/logo.png">
</div>

## Introduction
Expand All @@ -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 */)]
}
```

Expand Down
39 changes: 20 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,37 @@
"name": "rollup-plugin-vue",
"version": "4.0.2",
"description": "Roll .vue files",
"author": "Rahul Kadyan <hi@znck.me>",
"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 <hi@znck.me>",
"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",
Expand Down Expand Up @@ -73,4 +74,4 @@
"peerDependencies": {
"vue-template-compiler": "*"
}
}
}
69 changes: 66 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
import {
createDefaultCompiler,
assemble,
AssembleOptions,
ScriptOptions,
StyleOptions,
TemplateOptions,
Expand All @@ -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'
Expand Down
11 changes: 11 additions & 0 deletions typedoc.js
Original file line number Diff line number Diff line change
@@ -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']
}