Merge pull request #1051 from ing-bank/fix/babel-windows-slash

fix(babel-plugin-extend-docs): consider windows paths
This commit is contained in:
Joren Broekema 2020-10-26 15:06:07 +01:00 committed by GitHub
commit 38abc0e283
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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) {