mirror of
https://github.com/status-im/react-native.git
synced 2025-02-04 13:44:04 +00:00
Remove platform blacklists
Summary: File platform identifiers (`fileName.<platform>.js`) are no longer part of the blacklist regular expression. This allows the upcoming `jest-haste-map` to include all files for all platforms, therefore enabling Packager to build bundles for different platforms using the same `HasteMap`(jest-haste-map) instance. Reviewed By: davidaurelio Differential Revision: D3907508 fbshipit-source-id: d7d7f3bd93287a634a1ef0590a736d021be2aaa5
This commit is contained in:
parent
17219720e4
commit
23d84c8df8
@ -49,7 +49,7 @@ function buildBundle(args, config, output = outputBundle, packagerInstance) {
|
|||||||
projectRoots: config.getProjectRoots(),
|
projectRoots: config.getProjectRoots(),
|
||||||
assetExts: defaultAssetExts.concat(assetExts),
|
assetExts: defaultAssetExts.concat(assetExts),
|
||||||
assetRoots: config.getAssetRoots(),
|
assetRoots: config.getAssetRoots(),
|
||||||
blacklistRE: config.getBlacklistRE(args.platform),
|
blacklistRE: config.getBlacklistRE(),
|
||||||
getTransformOptionsModulePath: config.getTransformOptionsModulePath,
|
getTransformOptionsModulePath: config.getTransformOptionsModulePath,
|
||||||
transformModulePath: transformModulePath,
|
transformModulePath: transformModulePath,
|
||||||
extraNodeModules: config.extraNodeModules,
|
extraNodeModules: config.extraNodeModules,
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var blacklist = require('../packager/blacklist');
|
var blacklist = require('../packager/blacklist');
|
||||||
@ -41,8 +49,8 @@ var config = {
|
|||||||
* Returns a regular expression for modules that should be ignored by the
|
* Returns a regular expression for modules that should be ignored by the
|
||||||
* packager on a given platform.
|
* packager on a given platform.
|
||||||
*/
|
*/
|
||||||
getBlacklistRE(platform) {
|
getBlacklistRE() {
|
||||||
return blacklist(platform);
|
return blacklist();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +26,7 @@ function dependencies(argv, config, args, packagerInstance) {
|
|||||||
const packageOpts = {
|
const packageOpts = {
|
||||||
projectRoots: config.getProjectRoots(),
|
projectRoots: config.getProjectRoots(),
|
||||||
assetRoots: config.getAssetRoots(),
|
assetRoots: config.getAssetRoots(),
|
||||||
blacklistRE: config.getBlacklistRE(args.platform),
|
blacklistRE: config.getBlacklistRE(),
|
||||||
getTransformOptionsModulePath: config.getTransformOptionsModulePath,
|
getTransformOptionsModulePath: config.getTransformOptionsModulePath,
|
||||||
transformModulePath: transformModulePath,
|
transformModulePath: transformModulePath,
|
||||||
extraNodeModules: config.extraNodeModules,
|
extraNodeModules: config.extraNodeModules,
|
||||||
|
@ -23,29 +23,6 @@ var sharedBlacklist = [
|
|||||||
'Libraries/Relay/relay/tools/relayUnstableBatchedUpdates.js',
|
'Libraries/Relay/relay/tools/relayUnstableBatchedUpdates.js',
|
||||||
];
|
];
|
||||||
|
|
||||||
var platformBlacklists = {
|
|
||||||
web: [
|
|
||||||
'.ios.js',
|
|
||||||
'.android.js',
|
|
||||||
'.windows.js'
|
|
||||||
],
|
|
||||||
ios: [
|
|
||||||
'.web.js',
|
|
||||||
'.android.js',
|
|
||||||
'.windows.js',
|
|
||||||
],
|
|
||||||
android: [
|
|
||||||
'.web.js',
|
|
||||||
'.ios.js',
|
|
||||||
'.windows.js'
|
|
||||||
],
|
|
||||||
windows: [
|
|
||||||
'.web.js',
|
|
||||||
'.ios.js',
|
|
||||||
'.android.js'
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
function escapeRegExp(pattern) {
|
function escapeRegExp(pattern) {
|
||||||
if (Object.prototype.toString.call(pattern) === '[object RegExp]') {
|
if (Object.prototype.toString.call(pattern) === '[object RegExp]') {
|
||||||
return pattern.source.replace(/\//g, path.sep);
|
return pattern.source.replace(/\//g, path.sep);
|
||||||
@ -58,10 +35,9 @@ function escapeRegExp(pattern) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function blacklist(platform, additionalBlacklist) {
|
function blacklist(additionalBlacklist) {
|
||||||
return new RegExp('(' +
|
return new RegExp('(' +
|
||||||
(additionalBlacklist || []).concat(sharedBlacklist)
|
(additionalBlacklist || []).concat(sharedBlacklist)
|
||||||
.concat(platformBlacklists[platform] || [])
|
|
||||||
.map(escapeRegExp)
|
.map(escapeRegExp)
|
||||||
.join('|') +
|
.join('|') +
|
||||||
')$'
|
')$'
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
* React Native CLI configuration file
|
* React Native CLI configuration file
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
@ -21,8 +26,8 @@ module.exports = {
|
|||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
|
|
||||||
getBlacklistRE(platform) {
|
getBlacklistRE() {
|
||||||
return blacklist(platform);
|
return blacklist();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getRoots() {
|
_getRoots() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user