2015-02-20 04:10:52 +00:00
|
|
|
/**
|
2015-03-23 18:48:02 +00:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
2015-02-20 04:10:52 +00:00
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2015-06-26 23:18:49 +00:00
|
|
|
var path = require('path');
|
|
|
|
|
2016-01-08 14:51:45 +00:00
|
|
|
// Don't forget to everything listed here to `package.json`
|
2015-02-20 04:10:52 +00:00
|
|
|
// modulePathIgnorePatterns.
|
|
|
|
var sharedBlacklist = [
|
2015-12-30 19:38:44 +00:00
|
|
|
/node_modules[/\\]react[/\\]dist[/\\].*/,
|
2015-09-26 02:22:21 +00:00
|
|
|
|
2015-12-30 19:38:44 +00:00
|
|
|
/website\/node_modules\/.*/,
|
2016-01-30 02:17:16 +00:00
|
|
|
|
|
|
|
// TODO(jkassens, #9876132): Remove this rule when it's no longer needed.
|
2016-02-02 04:10:12 +00:00
|
|
|
'Libraries/Relay/relay/tools/relayUnstableBatchedUpdates.js',
|
2016-11-30 20:43:46 +00:00
|
|
|
|
|
|
|
/heapCapture\/bundle\.js/,
|
2015-09-11 22:48:35 +00:00
|
|
|
];
|
|
|
|
|
2015-12-30 19:38:44 +00:00
|
|
|
function escapeRegExp(pattern) {
|
|
|
|
if (Object.prototype.toString.call(pattern) === '[object RegExp]') {
|
2016-01-02 08:56:32 +00:00
|
|
|
return pattern.source.replace(/\//g, path.sep);
|
2015-12-30 19:38:44 +00:00
|
|
|
} else if (typeof pattern === 'string') {
|
|
|
|
var escaped = pattern.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
|
|
// convert the '/' into an escaped local file separator
|
2017-03-01 16:05:59 +00:00
|
|
|
return escaped.replace(/\//g, '\\' + path.sep);
|
2015-12-30 19:38:44 +00:00
|
|
|
} else {
|
|
|
|
throw new Error('Unexpected packager blacklist pattern: ' + pattern);
|
|
|
|
}
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
2016-09-23 14:59:59 +00:00
|
|
|
function blacklist(additionalBlacklist) {
|
2015-02-20 04:10:52 +00:00
|
|
|
return new RegExp('(' +
|
2015-03-12 00:44:49 +00:00
|
|
|
(additionalBlacklist || []).concat(sharedBlacklist)
|
2015-02-20 04:10:52 +00:00
|
|
|
.map(escapeRegExp)
|
|
|
|
.join('|') +
|
|
|
|
')$'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = blacklist;
|