File tree 3 files changed +7
-6
lines changed
3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -400,3 +400,5 @@ export class Analysis<K extends keyof TemplateTypes> {
400
400
return optAnalysis ;
401
401
}
402
402
}
403
+
404
+ export interface IAnalysis < K extends keyof TemplateTypes > extends Analysis < K > { }
Original file line number Diff line number Diff line change 1
- export { Analysis , SerializedAnalysis } from "./Analysis" ;
1
+ export { IAnalysis as Analysis , SerializedAnalysis } from "./Analysis" ;
2
2
export { Analyzer , AnalysisOptions , SerializedAnalyzer } from "./Analyzer" ;
3
3
export * from "./ElementAnalysis" ;
4
4
export {
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export interface CssBlocksVisitor {
46
46
elementAnalyzer : JSXElementAnalyzer ;
47
47
filename : string ;
48
48
mapping : StyleMapping < TEMPLATE_TYPE > ;
49
- analysis : Analysis < TEMPLATE_TYPE > ;
49
+ analysis : Analysis < TEMPLATE_TYPE > | undefined ;
50
50
cssBlockOptions : CSSBlocksConfiguration ;
51
51
shouldProcess : boolean ;
52
52
}
@@ -78,15 +78,14 @@ export function makePlugin(transformOpts: { rewriter: Rewriter }): () => PluginO
78
78
79
79
this . mapping = rewriter . blocks [ this . filename ] ;
80
80
if ( this . mapping && this . mapping . analyses ) {
81
- let a = this . mapping . analyses . find ( a => a . template . identifier === this . filename ) ;
82
- if ( a instanceof Analysis ) this . analysis = a ;
81
+ this . analysis = this . mapping . analyses . find ( a => a . template . identifier === this . filename ) ;
83
82
} else {
84
83
this . shouldProcess = false ;
85
84
}
86
85
let ext = parse ( this . filename ) . ext ;
87
- this . shouldProcess = CAN_PARSE_EXTENSIONS [ ext ] && this . analysis && this . analysis . blockCount ( ) > 0 ;
86
+ this . shouldProcess = CAN_PARSE_EXTENSIONS [ ext ] && this . analysis && this . analysis . blockCount ( ) > 0 || false ;
88
87
89
- if ( this . shouldProcess ) {
88
+ if ( this . analysis && this . shouldProcess ) {
90
89
debug ( `Rewriting discovered dependency ${ this . filename } ` ) ;
91
90
// TODO: We use this to re-analyze elements in the rewriter.
92
91
// We've already done this work and should be able to
You can’t perform that action at this time.
0 commit comments