Upgrade to node-haste@2.10.0 and allow to specify extra node modules

Summary: This upgrades to node-haste@2.10.0 and allows to expose folders as additional node modules from rn-cli.config.js

Reviewed By: bestander

Differential Revision: D3232595

fb-gh-sync-id: dffca66fec55a79a2b3af1d6ec1b8799b2bbcf59
fbshipit-source-id: dffca66fec55a79a2b3af1d6ec1b8799b2bbcf59
This commit is contained in:
David Aurelio 2016-04-28 06:32:52 -07:00 committed by Facebook Github Bot 9
parent feda8ce2ee
commit e3c18c3990
7 changed files with 19 additions and 2 deletions

View File

@ -32,6 +32,7 @@ function buildBundle(args, config, output = outputBundle, packagerInstance) {
blacklistRE: config.getBlacklistRE(args.platform), blacklistRE: config.getBlacklistRE(args.platform),
getTransformOptionsModulePath: config.getTransformOptionsModulePath, getTransformOptionsModulePath: config.getTransformOptionsModulePath,
transformModulePath: args.transformer, transformModulePath: args.transformer,
extraNodeModules: config.extraNodeModules,
nonPersistent: true, nonPersistent: true,
}; };

View File

@ -60,6 +60,7 @@ function _dependencies(argv, config, resolve, reject, packagerInstance) {
blacklistRE: config.getBlacklistRE(args.platform), blacklistRE: config.getBlacklistRE(args.platform),
getTransformOptionsModulePath: config.getTransformOptionsModulePath, getTransformOptionsModulePath: config.getTransformOptionsModulePath,
transformModulePath: args.transformer, transformModulePath: args.transformer,
extraNodeModules: config.extraNodeModules,
verbose: config.verbose, verbose: config.verbose,
}; };

View File

@ -78,6 +78,7 @@ function getPackagerServer(args, config) {
cacheVersion: '3', cacheVersion: '3',
getTransformOptionsModulePath: config.getTransformOptionsModulePath, getTransformOptionsModulePath: config.getTransformOptionsModulePath,
transformModulePath: transformerPath, transformModulePath: transformerPath,
extraNodeModules: config.extraNodeModules,
assetRoots: args.assetRoots, assetRoots: args.assetRoots,
assetExts: [ assetExts: [
'bmp', 'gif', 'jpg', 'jpeg', 'png', 'psd', 'svg', 'webp', // Image formats 'bmp', 'gif', 'jpg', 'jpeg', 'png', 'psd', 'svg', 'webp', // Image formats

View File

@ -156,7 +156,7 @@
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"module-deps": "^3.9.1", "module-deps": "^3.9.1",
"node-fetch": "^1.3.3", "node-fetch": "^1.3.3",
"node-haste": "~2.9.6", "node-haste": "~2.10.0",
"opn": "^3.0.2", "opn": "^3.0.2",
"optimist": "^0.6.1", "optimist": "^0.6.1",
"progress": "^1.1.8", "progress": "^1.1.8",

View File

@ -57,6 +57,10 @@ const validateOpts = declareOpts({
type:'string', type:'string',
required: false, required: false,
}, },
extraNodeModules: {
type: 'object',
required: false,
},
nonPersistent: { nonPersistent: {
type: 'boolean', type: 'boolean',
default: false, default: false,
@ -141,6 +145,7 @@ class Bundler {
transformCode: transformCode:
(module, code, options) => (module, code, options) =>
this._transformer.transformFile(module.path, code, options), this._transformer.transformFile(module.path, code, options),
extraNodeModules: opts.extraNodeModules,
minifyCode: this._transformer.minify, minifyCode: this._transformer.minify,
}); });

View File

@ -54,6 +54,10 @@ const validateOpts = declareOpts({
transformCode: { transformCode: {
type: 'function', type: 'function',
}, },
extraNodeModules: {
type: 'object',
required: false,
},
minifyCode: { minifyCode: {
type: 'function', type: 'function',
}, },
@ -107,6 +111,7 @@ class Resolver {
cache: opts.cache, cache: opts.cache,
shouldThrowOnUnresolvedErrors: (_, platform) => platform === 'ios', shouldThrowOnUnresolvedErrors: (_, platform) => platform === 'ios',
transformCode: opts.transformCode, transformCode: opts.transformCode,
extraNodeModules: opts.extraNodeModules,
assetDependencies: ['react-native/Libraries/Image/AssetRegistry'], assetDependencies: ['react-native/Libraries/Image/AssetRegistry'],
}); });

View File

@ -45,7 +45,11 @@ const validateOpts = declareOpts({
default: false, default: false,
}, },
transformModulePath: { transformModulePath: {
type:'string', type: 'string',
required: false,
},
extraNodeModules: {
type: 'object',
required: false, required: false,
}, },
nonPersistent: { nonPersistent: {