From e3c18c3990aed32e35fb5ccd4c0774088ee85781 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Thu, 28 Apr 2016 06:32:52 -0700 Subject: [PATCH] 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 --- local-cli/bundle/buildBundle.js | 1 + local-cli/dependencies/dependencies.js | 1 + local-cli/server/runServer.js | 1 + package.json | 2 +- packager/react-packager/src/Bundler/index.js | 5 +++++ packager/react-packager/src/Resolver/index.js | 5 +++++ packager/react-packager/src/Server/index.js | 6 +++++- 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/local-cli/bundle/buildBundle.js b/local-cli/bundle/buildBundle.js index ae29aa7ea..5458877f1 100644 --- a/local-cli/bundle/buildBundle.js +++ b/local-cli/bundle/buildBundle.js @@ -32,6 +32,7 @@ function buildBundle(args, config, output = outputBundle, packagerInstance) { blacklistRE: config.getBlacklistRE(args.platform), getTransformOptionsModulePath: config.getTransformOptionsModulePath, transformModulePath: args.transformer, + extraNodeModules: config.extraNodeModules, nonPersistent: true, }; diff --git a/local-cli/dependencies/dependencies.js b/local-cli/dependencies/dependencies.js index a9ac19118..d9ad3da1d 100644 --- a/local-cli/dependencies/dependencies.js +++ b/local-cli/dependencies/dependencies.js @@ -60,6 +60,7 @@ function _dependencies(argv, config, resolve, reject, packagerInstance) { blacklistRE: config.getBlacklistRE(args.platform), getTransformOptionsModulePath: config.getTransformOptionsModulePath, transformModulePath: args.transformer, + extraNodeModules: config.extraNodeModules, verbose: config.verbose, }; diff --git a/local-cli/server/runServer.js b/local-cli/server/runServer.js index 2aa9d208b..79992f7f7 100644 --- a/local-cli/server/runServer.js +++ b/local-cli/server/runServer.js @@ -78,6 +78,7 @@ function getPackagerServer(args, config) { cacheVersion: '3', getTransformOptionsModulePath: config.getTransformOptionsModulePath, transformModulePath: transformerPath, + extraNodeModules: config.extraNodeModules, assetRoots: args.assetRoots, assetExts: [ 'bmp', 'gif', 'jpg', 'jpeg', 'png', 'psd', 'svg', 'webp', // Image formats diff --git a/package.json b/package.json index 6e8c88a3e..fe562dca6 100644 --- a/package.json +++ b/package.json @@ -156,7 +156,7 @@ "mkdirp": "^0.5.1", "module-deps": "^3.9.1", "node-fetch": "^1.3.3", - "node-haste": "~2.9.6", + "node-haste": "~2.10.0", "opn": "^3.0.2", "optimist": "^0.6.1", "progress": "^1.1.8", diff --git a/packager/react-packager/src/Bundler/index.js b/packager/react-packager/src/Bundler/index.js index a6041e40f..c718bb40b 100644 --- a/packager/react-packager/src/Bundler/index.js +++ b/packager/react-packager/src/Bundler/index.js @@ -57,6 +57,10 @@ const validateOpts = declareOpts({ type:'string', required: false, }, + extraNodeModules: { + type: 'object', + required: false, + }, nonPersistent: { type: 'boolean', default: false, @@ -141,6 +145,7 @@ class Bundler { transformCode: (module, code, options) => this._transformer.transformFile(module.path, code, options), + extraNodeModules: opts.extraNodeModules, minifyCode: this._transformer.minify, }); diff --git a/packager/react-packager/src/Resolver/index.js b/packager/react-packager/src/Resolver/index.js index f508c9b62..f2cad3e6b 100644 --- a/packager/react-packager/src/Resolver/index.js +++ b/packager/react-packager/src/Resolver/index.js @@ -54,6 +54,10 @@ const validateOpts = declareOpts({ transformCode: { type: 'function', }, + extraNodeModules: { + type: 'object', + required: false, + }, minifyCode: { type: 'function', }, @@ -107,6 +111,7 @@ class Resolver { cache: opts.cache, shouldThrowOnUnresolvedErrors: (_, platform) => platform === 'ios', transformCode: opts.transformCode, + extraNodeModules: opts.extraNodeModules, assetDependencies: ['react-native/Libraries/Image/AssetRegistry'], }); diff --git a/packager/react-packager/src/Server/index.js b/packager/react-packager/src/Server/index.js index 1856fc96f..608919b72 100644 --- a/packager/react-packager/src/Server/index.js +++ b/packager/react-packager/src/Server/index.js @@ -45,7 +45,11 @@ const validateOpts = declareOpts({ default: false, }, transformModulePath: { - type:'string', + type: 'string', + required: false, + }, + extraNodeModules: { + type: 'object', required: false, }, nonPersistent: {