2014-09-28 16:55:01 -04:00
|
|
|
function file2moduleName(filePath) {
|
2016-10-04 17:06:41 -04:00
|
|
|
return filePath.replace(/\\/g, '/')
|
|
|
|
// module name should be relative to `modules` and `tools` folder
|
|
|
|
.replace(/.*\/modules\//, '')
|
|
|
|
// 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*$/, '');
|
2014-09-28 16:55:01 -04:00
|
|
|
}
|
|
|
|
if (typeof module !== 'undefined') {
|
|
|
|
module.exports = file2moduleName;
|
2014-10-06 20:35:00 -04:00
|
|
|
}
|