fix(babel-plugin-extend-docs): consider windows paths

This commit is contained in:
Joren Broekema 2020-10-26 14:41:32 +01:00
parent 75c1b22760
commit 82c6cce62a
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'babel-plugin-extend-docs': patch
---
Take into account that paths can be windows-based with backslashes, when analyzing folder depth

View file

@ -7,7 +7,7 @@ const { joinPaths } = require('./helpers.js');
* @param {*} filePath
*/
function getFolderDepth(filePath) {
return [...filePath.match(new RegExp('/', 'g'))].length - 1;
return [...filePath.match(new RegExp(/\/|\\/, 'g'))].length - 1;
}
function getImportAs(specifier, newImportName) {