This is a prerequisite for switching to TypeScript. We need to remove the Traceur preprocessor from Karma, so we have the build specified in a single place (broccoli tree def'n).
		
			
				
	
	
		
			18 lines
		
	
	
		
			593 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			593 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| function file2moduleName(filePath) {
 | |
|   return filePath.replace(/\\/g, '/')
 | |
|     // module name should be relative to `modules` and `tools` folder
 | |
|     .replace(/.*\/modules\//, '')
 | |
|     .replace(/.*\/tools\//, '')
 | |
|     //  and 'dist' folder
 | |
|     .replace(/.*\/dist\/js\/dev\/es5\//, '')
 | |
|     // module name should not include `lib`, `web` folders
 | |
|     // as they are wrapper packages for dart
 | |
|     .replace(/\/web\//, '/')
 | |
|     .replace(/\/lib\//, '/')
 | |
|     // module name should not have a suffix
 | |
|     .replace(/\.\w*$/, '');
 | |
| }
 | |
| if (typeof module !== 'undefined') {
 | |
|   module.exports = file2moduleName;
 | |
| }
 |