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');
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
// Don't forget to everything listed here to `testConfig.json`
|
|
|
|
// modulePathIgnorePatterns.
|
|
|
|
var sharedBlacklist = [
|
2015-07-24 00:50:16 +00:00
|
|
|
'node_modules/react-tools/src/React.js',
|
|
|
|
'node_modules/react-tools/src/renderers/shared/event/EventPropagators.js',
|
|
|
|
'node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js',
|
|
|
|
'node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js',
|
2015-02-20 04:10:52 +00:00
|
|
|
];
|
|
|
|
|
2015-09-11 22:48:35 +00:00
|
|
|
// Raw unescaped patterns in case you need to use wildcards
|
|
|
|
var sharedBlacklistWildcards = [
|
|
|
|
'website\/node_modules\/.*',
|
|
|
|
];
|
|
|
|
|
2015-04-14 15:52:40 +00:00
|
|
|
var platformBlacklists = {
|
|
|
|
web: [
|
2015-09-11 22:48:35 +00:00
|
|
|
'.ios.js',
|
|
|
|
'.android.js',
|
2015-04-14 15:52:40 +00:00
|
|
|
],
|
|
|
|
ios: [
|
|
|
|
'.web.js',
|
|
|
|
'.android.js',
|
|
|
|
],
|
|
|
|
android: [
|
|
|
|
'.web.js',
|
|
|
|
'.ios.js',
|
|
|
|
],
|
|
|
|
};
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
function escapeRegExp(str) {
|
2015-06-26 23:18:49 +00:00
|
|
|
var escaped = str.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
|
|
// convert the '/' into an escaped local file separator
|
|
|
|
return escaped.replace(/\//g,'\\' + path.sep);
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
2015-04-14 15:52:40 +00:00
|
|
|
function blacklist(platform, additionalBlacklist) {
|
2015-02-20 04:10:52 +00:00
|
|
|
return new RegExp('(' +
|
2015-03-12 00:44:49 +00:00
|
|
|
(additionalBlacklist || []).concat(sharedBlacklist)
|
2015-04-14 15:52:40 +00:00
|
|
|
.concat(platformBlacklists[platform] || [])
|
2015-02-20 04:10:52 +00:00
|
|
|
.map(escapeRegExp)
|
2015-09-11 22:48:35 +00:00
|
|
|
.concat(sharedBlacklistWildcards)
|
2015-02-20 04:10:52 +00:00
|
|
|
.join('|') +
|
|
|
|
')$'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = blacklist;
|