From 14ae30df8a6d6b629c4e1fa647b4c6989377aec8 Mon Sep 17 00:00:00 2001 From: tmcdos Date: Sun, 3 May 2020 17:05:25 +0300 Subject: [PATCH] fix: avoiding https://github.com/mrmlnc/fast-glob/issues/158 (#209) * Avoiding https://github.com/mrmlnc/fast-glob/issues/158 * Fixed the linter issues * chore: converted CRLF line endings to LF * Regenerated the lock file * chore: update lock file Co-authored-by: Ricardo Gobbo de Souza --- src/utils.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/utils.js b/src/utils.js index a9c84a0..177144f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,10 +1,16 @@ -import { join } from 'path'; +// import { join } from 'path'; import arrify from 'arrify'; +const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g; + export function parseFiles(files, context) { - return arrify(files).map((file) => - replaceBackslashes(join(context, '/', file)) + return arrify(files).map( + (file) => + `${replaceBackslashes(context).replace( + UNESCAPED_GLOB_SYMBOLS_RE, + '\\$2' + )}/${replaceBackslashes(file)}` ); }