Skip to content

Commit 62d7cd6

Browse files
committed
[ReactNative] allow running JS app server for Android from fbobjc
1 parent 320605e commit 62d7cd6

2 files changed

Lines changed: 28 additions & 15 deletions

File tree

packager/blacklist.js

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,35 @@ var sharedBlacklist = [
1818
'node_modules/react-tools/src/event/EventPropagators.js'
1919
];
2020

21-
var webBlacklist = [
22-
'.ios.js'
23-
];
24-
25-
var iosBlacklist = [
26-
'node_modules/react-tools/src/browser/ui/React.js',
27-
'node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js',
28-
// 'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js',
29-
'.web.js',
30-
'.android.js',
31-
];
21+
var platformBlacklists = {
22+
web: [
23+
'.ios.js'
24+
],
25+
ios: [
26+
'node_modules/react-tools/src/browser/ui/React.js',
27+
'node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js',
28+
// 'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js',
29+
'.web.js',
30+
'.android.js',
31+
],
32+
android: [
33+
'node_modules/react-tools/src/browser/ui/React.js',
34+
'node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js',
35+
'node_modules/react-tools/src/browser/ReactTextComponent.js',
36+
// 'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js',
37+
'.web.js',
38+
'.ios.js',
39+
],
40+
};
3241

3342
function escapeRegExp(str) {
3443
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
3544
}
3645

37-
function blacklist(isWeb, additionalBlacklist) {
46+
function blacklist(platform, additionalBlacklist) {
3847
return new RegExp('(' +
3948
(additionalBlacklist || []).concat(sharedBlacklist)
40-
.concat(isWeb ? webBlacklist : iosBlacklist)
49+
.concat(platformBlacklists[platform] || [])
4150
.map(escapeRegExp)
4251
.join('|') +
4352
')$'

packager/packager.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ var options = parseCommandLine([{
4242
}, {
4343
command: 'assetRoots',
4444
description: 'specify the root directories of app assets'
45+
}, {
46+
command: 'platform',
47+
default: 'ios',
48+
description: 'Specify the platform-specific blacklist (ios, android, web).'
4549
}, {
4650
command: 'skipflow',
4751
description: 'Disable flow checks'
@@ -192,15 +196,15 @@ function statusPageMiddleware(req, res, next) {
192196
function getAppMiddleware(options) {
193197
return ReactPackager.middleware({
194198
projectRoots: options.projectRoots,
195-
blacklistRE: blacklist(false),
199+
blacklistRE: blacklist(options.platform),
196200
cacheVersion: '2',
197201
transformModulePath: require.resolve('./transformer.js'),
198202
assetRoots: options.assetRoots,
199203
});
200204
}
201205

202206
function runServer(
203-
options, /* {[]string projectRoot, bool web} */
207+
options,
204208
readyCallback
205209
) {
206210
var app = connect()

0 commit comments

Comments
 (0)