You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							33 lines
						
					
					
						
							666 B
						
					
					
				
			
		
		
	
	
							33 lines
						
					
					
						
							666 B
						
					
					
				/** | 
						|
 * Both used by zrender and echarts. | 
						|
 */ | 
						|
 | 
						|
module.exports = function ({types, template}, options) { | 
						|
    return { | 
						|
        visitor: { | 
						|
            IfStatement: { | 
						|
                exit(path) { | 
						|
                    removeDEV(path); | 
						|
                } | 
						|
            } | 
						|
        } | 
						|
    }; | 
						|
}; | 
						|
 | 
						|
module.exports.recheckDEV = function (code) { | 
						|
    let result = code.match(/.if\s*\([^()]*__DEV__/); | 
						|
    if (result | 
						|
        && result[0].indexOf('`if') < 0 | 
						|
        && result[0].indexOf('if (typeof __DEV__') < 0 | 
						|
    ) { | 
						|
        throw new Error('__DEV__ is not removed.'); | 
						|
    } | 
						|
}; | 
						|
 | 
						|
function removeDEV(path) { | 
						|
    if (path.node.test.name === '__DEV__') { | 
						|
        path.remove(); | 
						|
    } | 
						|
} | 
						|
 | 
						|
 | 
						|
 |