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-11-07 03:50:10 +00:00
|
|
|
'node_modules/react-haste/renderers/shared/event/eventPlugins/ResponderEventPlugin.js',
|
|
|
|
'node_modules/react-haste/React.js',
|
2015-11-07 19:39:11 +00:00
|
|
|
'node_modules/react-haste/renderers/dom/ReactDOM.js',
|
2015-09-26 02:22:21 +00:00
|
|
|
|
2015-11-07 03:50:10 +00:00
|
|
|
// For each of these fbjs files (especially the non-forks/stubs), we should
|
|
|
|
// consider deleting the conflicting copy and just using the fbjs version.
|
|
|
|
'node_modules/fbjs-haste/__forks__/Map.js',
|
|
|
|
'node_modules/fbjs-haste/__forks__/Promise.js',
|
|
|
|
'node_modules/fbjs-haste/__forks__/fetch.js',
|
|
|
|
'node_modules/fbjs-haste/core/Deferred.js',
|
|
|
|
'node_modules/fbjs-haste/core/PromiseMap.js',
|
|
|
|
'node_modules/fbjs-haste/core/areEqual.js',
|
|
|
|
'node_modules/fbjs-haste/core/flattenArray.js',
|
|
|
|
'node_modules/fbjs-haste/core/isEmpty.js',
|
|
|
|
'node_modules/fbjs-haste/core/removeFromArray.js',
|
|
|
|
'node_modules/fbjs-haste/core/resolveImmediate.js',
|
|
|
|
'node_modules/fbjs-haste/core/sprintf.js',
|
|
|
|
'node_modules/fbjs-haste/crypto/crc32.js',
|
|
|
|
'node_modules/fbjs-haste/fetch/fetchWithRetries.js',
|
|
|
|
'node_modules/fbjs-haste/functional/everyObject.js',
|
|
|
|
'node_modules/fbjs-haste/functional/filterObject.js',
|
|
|
|
'node_modules/fbjs-haste/functional/forEachObject.js',
|
|
|
|
'node_modules/fbjs-haste/functional/someObject.js',
|
|
|
|
'node_modules/fbjs-haste/request/xhrSimpleDataSerializer.js',
|
|
|
|
'node_modules/fbjs-haste/stubs/ErrorUtils.js',
|
|
|
|
'node_modules/fbjs-haste/stubs/URI.js',
|
|
|
|
'node_modules/fbjs-haste/useragent/UserAgent.js',
|
|
|
|
'node_modules/fbjs-haste/utils/nullthrows.js',
|
|
|
|
|
|
|
|
// Those conflicts with the ones in fbjs-haste/. We need to blacklist the
|
2015-09-26 02:22:21 +00:00
|
|
|
// internal version otherwise they won't work in open source.
|
2015-11-07 03:50:10 +00:00
|
|
|
'downstream/core/CSSCore.js',
|
2015-09-26 02:22:21 +00:00
|
|
|
'downstream/core/TouchEventUtils.js',
|
|
|
|
'downstream/core/camelize.js',
|
|
|
|
'downstream/core/createArrayFromMixed.js',
|
2015-11-07 03:50:10 +00:00
|
|
|
'downstream/core/createNodesFromMarkup.js',
|
|
|
|
'downstream/core/dom/containsNode.js',
|
2015-09-30 04:57:46 +00:00
|
|
|
'downstream/core/dom/focusNode.js',
|
2015-11-07 03:50:10 +00:00
|
|
|
'downstream/core/dom/getActiveElement.js',
|
2015-09-30 04:57:46 +00:00
|
|
|
'downstream/core/dom/getUnboundedScrollPosition.js',
|
2015-11-07 03:50:10 +00:00
|
|
|
'downstream/core/dom/isNode.js',
|
|
|
|
'downstream/core/dom/isTextNode.js',
|
|
|
|
'downstream/core/emptyFunction.js',
|
|
|
|
'downstream/core/emptyObject.js',
|
2015-09-30 04:57:46 +00:00
|
|
|
'downstream/core/getMarkupWrap.js',
|
2015-11-07 03:50:10 +00:00
|
|
|
'downstream/core/hyphenate.js',
|
2015-09-30 04:57:46 +00:00
|
|
|
'downstream/core/hyphenateStyleName.js',
|
2015-11-07 03:50:10 +00:00
|
|
|
'downstream/core/invariant.js',
|
|
|
|
'downstream/core/nativeRequestAnimationFrame.js',
|
|
|
|
'downstream/core/toArray.js',
|
|
|
|
'downstream/functional/mapObject.js',
|
|
|
|
'downstream/key-mirror/keyMirror.js',
|
|
|
|
'downstream/key-mirror/keyOf.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;
|