05ffdc9b44
Export files are now directly under the module folder, e.g. `core/core.js`. With this, an import like `core/core` won’t need a path mapping (e.g. via `System.paths`) any more. This adds the `src` folder to all other import statements as well.
16 lines
522 B
JavaScript
16 lines
522 B
JavaScript
function file2moduleName(filePath) {
|
|
return filePath.replace(/\\/g, '/')
|
|
// module name should be relative to `modules` and `tools` folder
|
|
.replace(/.*\/modules\//, '')
|
|
.replace(/.*\/tools\//, '')
|
|
// 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;
|
|
}
|