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[/\\].*/,
|
|
|
|
'node_modules/react/lib/React.js',
|
|
|
|
'node_modules/react/lib/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.
|
2015-12-30 19:38:44 +00:00
|
|
|
//
|
|
|
|
// fbjs forks:
|
|
|
|
'node_modules/fbjs/lib/Map.js',
|
|
|
|
'node_modules/fbjs/lib/Promise.js',
|
|
|
|
'node_modules/fbjs/lib/fetch.js',
|
|
|
|
// fbjs stubs:
|
|
|
|
'node_modules/fbjs/lib/ErrorUtils.js',
|
|
|
|
'node_modules/fbjs/lib/URI.js',
|
|
|
|
// fbjs modules:
|
|
|
|
'node_modules/fbjs/lib/Deferred.js',
|
|
|
|
'node_modules/fbjs/lib/PromiseMap.js',
|
|
|
|
'node_modules/fbjs/lib/UserAgent.js',
|
|
|
|
'node_modules/fbjs/lib/areEqual.js',
|
|
|
|
'node_modules/fbjs/lib/base62.js',
|
|
|
|
'node_modules/fbjs/lib/crc32.js',
|
|
|
|
'node_modules/fbjs/lib/everyObject.js',
|
|
|
|
'node_modules/fbjs/lib/fetchWithRetries.js',
|
|
|
|
'node_modules/fbjs/lib/filterObject.js',
|
|
|
|
'node_modules/fbjs/lib/flattenArray.js',
|
|
|
|
'node_modules/fbjs/lib/forEachObject.js',
|
|
|
|
'node_modules/fbjs/lib/isEmpty.js',
|
|
|
|
'node_modules/fbjs/lib/nullthrows.js',
|
|
|
|
'node_modules/fbjs/lib/removeFromArray.js',
|
|
|
|
'node_modules/fbjs/lib/resolveImmediate.js',
|
|
|
|
'node_modules/fbjs/lib/someObject.js',
|
|
|
|
'node_modules/fbjs/lib/sprintf.js',
|
|
|
|
'node_modules/fbjs/lib/xhrSimpleDataSerializer.js',
|
2015-11-07 03:50:10 +00:00
|
|
|
|
2015-12-30 19:38:44 +00:00
|
|
|
// Those conflicts with the ones in fbjs/. 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',
|
2015-02-20 04:10:52 +00:00
|
|
|
|
2015-12-30 19:38:44 +00:00
|
|
|
/website\/node_modules\/.*/,
|
2015-09-11 22:48:35 +00:00
|
|
|
];
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
return escaped.replace(/\//g,'\\' + path.sep);
|
|
|
|
} else {
|
|
|
|
throw new Error('Unexpected packager blacklist pattern: ' + pattern);
|
|
|
|
}
|
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)
|
|
|
|
.join('|') +
|
|
|
|
')$'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = blacklist;
|