angular-cn/tools/build/file2modulename.js
Chuck Jazdzewski 43d3a84df3 Revert "refactor: add license header to JS files & format files (#12035)"
This reverts commit 8310c918236c2bc085a0fd4278ee96106c5c2f1a.
2016-10-04 14:06:41 -07:00

17 lines
561 B
JavaScript

function file2moduleName(filePath) {
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*$/, '');
}
if (typeof module !== 'undefined') {
module.exports = file2moduleName;
}