Skip to content

Commit

Permalink
Upgrade to [email protected] and allow to specify extra node modules
Browse files Browse the repository at this point in the history
Summary: This upgrades to [email protected] 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
  • Loading branch information
davidaurelio authored and Facebook Github Bot 9 committed Apr 28, 2016
1 parent feda8ce commit e3c18c3
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions local-cli/bundle/buildBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
1 change: 1 addition & 0 deletions local-cli/dependencies/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
1 change: 1 addition & 0 deletions local-cli/server/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions packager/react-packager/src/Bundler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ const validateOpts = declareOpts({
type:'string',
required: false,
},
extraNodeModules: {
type: 'object',
required: false,
},
nonPersistent: {
type: 'boolean',
default: false,
Expand Down Expand Up @@ -141,6 +145,7 @@ class Bundler {
transformCode:
(module, code, options) =>
this._transformer.transformFile(module.path, code, options),
extraNodeModules: opts.extraNodeModules,
minifyCode: this._transformer.minify,
});

Expand Down
5 changes: 5 additions & 0 deletions packager/react-packager/src/Resolver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ const validateOpts = declareOpts({
transformCode: {
type: 'function',
},
extraNodeModules: {
type: 'object',
required: false,
},
minifyCode: {
type: 'function',
},
Expand Down Expand Up @@ -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'],
});

Expand Down
6 changes: 5 additions & 1 deletion packager/react-packager/src/Server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ const validateOpts = declareOpts({
default: false,
},
transformModulePath: {
type:'string',
type: 'string',
required: false,
},
extraNodeModules: {
type: 'object',
required: false,
},
nonPersistent: {
Expand Down

0 comments on commit e3c18c3

Please sign in to comment.