1- import { createFilter } from 'rollup-pluginutils' ;
2- import { writeFile } from 'fs' ;
3- import MagicString from 'magic-string' ;
1+ import { createFilter } from 'rollup-pluginutils'
42
5- import vueTransform from './vueTransform' ;
6- import DEFAULT_OPTIONS from './options' ;
7- import compileStyle from './style' ;
8- import debug from './debug' ;
3+ import vueTransform from './vueTransform'
4+ import DEFAULT_OPTIONS from './options'
5+ import compileStyle from './style'
6+ import debug from './debug'
97
10- function mergeOptions ( options , defaults ) {
8+ function mergeOptions ( options , defaults ) {
119 Object . keys ( defaults ) . forEach ( ( key ) => {
12- const val = defaults [ key ] ;
10+ const val = defaults [ key ]
1311
1412 if ( key in options ) {
1513 if ( typeof options [ key ] === 'object' ) {
16- mergeOptions ( options [ key ] , val ) ;
14+ mergeOptions ( options [ key ] , val )
1715 }
1816 } else {
19- options [ key ] = val ;
17+ options [ key ] = val
2018 }
21- } ) ;
19+ } )
2220
23- return options ;
21+ return options
2422}
2523
26- export default function vue ( options = { } ) {
27- debug ( 'Yo! rolling vue!' ) ;
28- const filter = createFilter ( options . include , options . exclude ) ;
24+ export default function vue ( options = { } ) {
25+ debug ( 'Yo! rolling vue!' )
26+ const filter = createFilter ( options . include , options . exclude )
2927
30- delete options . include ;
31- delete options . exclude ;
28+ delete options . include
29+ delete options . exclude
3230
3331 /* eslint-disable */
3432 try {
@@ -47,31 +45,31 @@ export default function vue(options = {}) {
4745 } catch ( e ) { }
4846 /* eslint-enable */
4947
50- options = mergeOptions ( options , DEFAULT_OPTIONS ) ;
48+ options = mergeOptions ( options , DEFAULT_OPTIONS )
5149
52- const styles = { } ;
50+ const styles = { }
5351
5452 return {
5553 name : 'vue' ,
56- transform ( source , id ) {
54+ transform ( source , id ) {
5755 if ( ! filter ( id ) || ! id . endsWith ( '.vue' ) ) {
58- debug ( `Ignore: ${ id } ` ) ;
59- return null ;
56+ debug ( `Ignore: ${ id } ` )
57+ return null
6058 }
6159
62- debug ( `Transform: ${ id } ` ) ;
60+ debug ( `Transform: ${ id } ` )
6361
64- const { code, css, map } = vueTransform ( source , id , options ) ;
62+ const { code, css, map } = vueTransform ( source , id , options )
6563
66- styles [ id ] = css ;
64+ styles [ id ] = css
6765
68- debug ( `Transformed: ${ id } ` ) ;
66+ debug ( `Transformed: ${ id } ` )
6967
70- return { code, map } ;
68+ return { code, map }
7169 } ,
7270
73- ongenerate ( ) {
74- compileStyle ( styles , options ) ;
71+ ongenerate ( ) {
72+ compileStyle ( styles , options )
7573 }
76- } ;
74+ }
7775}
0 commit comments