UNPKG

617 BJavaScriptView Raw
1/**
2 * Copyright (c) 2015-present, Facebook, Inc.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8'use strict';
9
10const path = require('path');
11const escape = require('escape-string-regexp');
12
13//Modifed to allow for multiple paths to be watched.
14module.exports = function ignoredFiles(watches) {
15 var watched = watches.map(watch=>escape(path.normalize(watch + '/').replace(/[\\]+/g, '/'))).join("|");
16
17 const reg = new RegExp(
18 `^(?!${watched}).+/node_modules/`,
19 'g'
20 );
21
22 return reg;
23};