@@ -94,7 +94,9 @@ export class SFCCompiler {
94
94
const template =
95
95
descriptor . template && this . compileTemplate ( filename , descriptor . template )
96
96
97
- const styles = descriptor . styles . map ( style => this . compileStyle ( filename , scopeId , style ) )
97
+ const styles = descriptor . styles . map ( style =>
98
+ this . compileStyle ( filename , scopeId , style )
99
+ )
98
100
99
101
const { script : rawScript , customBlocks } = descriptor
100
102
const script = rawScript && {
@@ -113,7 +115,10 @@ export class SFCCompiler {
113
115
}
114
116
}
115
117
116
- private compileTemplate ( filename : string , template : SFCBlock ) {
118
+ compileTemplate (
119
+ filename : string ,
120
+ template : SFCBlock
121
+ ) : TemplateCompileResult & { functional : boolean } {
117
122
const { preprocessOptions, ...options } = this . template
118
123
const functional = 'functional' in template . attrs
119
124
@@ -136,18 +141,23 @@ export class SFCCompiler {
136
141
}
137
142
}
138
143
139
- private compileStyle ( filename : string , scopeId : string , style : SFCBlock ) {
144
+ compileStyle (
145
+ filename : string ,
146
+ scopeId : string ,
147
+ style : SFCBlock
148
+ ) : StyleCompileResult {
140
149
let tokens = undefined
141
- const needsCSSModules = style . module === true || typeof style . module === 'string'
150
+ const needsCSSModules =
151
+ style . module === true || typeof style . module === 'string'
142
152
const postcssPlugins = [
143
153
needsCSSModules
144
154
? postcssModules ( {
145
- generateScopedName : '[path][local]-[hash:base64:4]' ,
146
- ...this . style . postcssModulesOptions ,
147
- getJSON : ( t : any ) => {
148
- tokens = t
149
- }
150
- } )
155
+ generateScopedName : '[path][local]-[hash:base64:4]' ,
156
+ ...this . style . postcssModulesOptions ,
157
+ getJSON : ( t : any ) => {
158
+ tokens = t
159
+ }
160
+ } )
151
161
: undefined ,
152
162
this . template . isProduction
153
163
? postcssClean ( this . style . postcssCleanOptions )
@@ -165,10 +175,10 @@ export class SFCCompiler {
165
175
postcssOptions : this . style . postcssOptions ,
166
176
preprocessLang : style . lang ,
167
177
preprocessOptions :
168
- ( style . lang &&
169
- this . style . preprocessOptions &&
170
- this . style . preprocessOptions [ style . lang ] ) ||
171
- { } ,
178
+ ( style . lang &&
179
+ this . style . preprocessOptions &&
180
+ this . style . preprocessOptions [ style . lang ] ) ||
181
+ { } ,
172
182
trim : this . style . trim
173
183
} )
174
184
0 commit comments