2014-09-28 16:55:01 -04:00
|
|
|
function file2moduleName(filePath) {
|
2014-11-20 02:57:32 -05:00
|
|
|
return filePath.replace(/\\/g, '/')
|
2014-09-28 16:55:01 -04:00
|
|
|
// module name should be relative to `modules` and `tools` folder
|
|
|
|
.replace(/.*\/modules\//, '')
|
|
|
|
.replace(/.*\/tools\//, '')
|
2015-04-27 19:11:20 -04:00
|
|
|
// and 'dist' folder
|
|
|
|
.replace(/.*\/dist\/js\/dev\/es5\//, '')
|
2015-02-02 19:25:34 -05:00
|
|
|
// module name should not include `lib`, `web` folders
|
|
|
|
// as they are wrapper packages for dart
|
2014-12-05 19:26:30 -05:00
|
|
|
.replace(/\/web\//, '/')
|
2014-09-28 16:55:01 -04:00
|
|
|
.replace(/\/lib\//, '/')
|
|
|
|
// module name should not have a suffix
|
|
|
|
.replace(/\.\w*$/, '');
|
|
|
|
}
|
|
|
|
if (typeof module !== 'undefined') {
|
|
|
|
module.exports = file2moduleName;
|
2014-10-06 20:35:00 -04:00
|
|
|
}
|