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