diff --git a/lib/node-conversion.js b/lib/node-conversion.js index ec73ef4..f40bd35 100644 --- a/lib/node-conversion.js +++ b/lib/node-conversion.js @@ -18,7 +18,7 @@ var nodeCoreModules = { 'crypto': 'npm:crypto-browserify@^3.11.0', // (fork required) 'dgram': 'nodelibs/dgram', 'dns': 'nodelibs/dns', - 'domain': 'npm:domain-browser@^1.1.4', // https://github.com/bevry/domain-browser/pull/7 + 'domain': 'npm:domain-browser@^1.1.5', 'events': 'npm:events@^1.1.0', // (fork required) 'fs': 'nodelibs/fs', 'http': 'npm:stream-http@^2.0.2', // https://github.com/jhiesey/stream-http/pull/31 @@ -28,7 +28,7 @@ var nodeCoreModules = { 'os': 'npm:os-browserify@^0.2.0', 'path': 'npm:path-browserify@^0.0.0', // https://github.com/substack/path-browserify/pull/7 'process': 'nodelibs/process', - 'punycode': 'npm:punycode@^1.3.2', // pending 1.3.3 release + 'punycode': 'npm:punycode@^1.4.0', 'querystring': 'npm:querystring@^0.2.0', // https://github.com/Gozala/querystring/pull/13 'readline': 'nodelibs/readline', 'repl': 'nodelibs/repl', @@ -224,16 +224,15 @@ exports.convertPackage = function(packageConfig, packageName, packageDir, ui) { * * Currently we cater to (1) by creating a directory map for any index.js file present * in a directory where the directory.js file does not exist. - * We then cater to (2 - 4) above by parsing all CommonJS requires of all JS files in - * the package and where a resolution matches one of these cases, we include meta: true + * We then cater to (2 - 5) above by parsing all CommonJS requires of all JS files in + * the package and where a resolution matches one of these cases, we include map or meta * config for these files. * - * We only cater to these assumptions for CommonJS modules + * We cater to these assumptions for CommonJS modules only * - * It may turn out to be useful to do (2 - 4) for external requires as well, in which + * It may turn out to be useful to do (2 - 5) for external requires as well, in which * case we can switch this algorithm to a comprehensive correction configuration * being constructed against the entire fileTree to handle all resolution differences. - * * Even better may turn out to have a post-install hook phase, which can actually investigate * the contents of dependencies to do a similar analysis above to avoid config bloat */ diff --git a/lib/npm.js b/lib/npm.js index 891795a..045ec37 100644 --- a/lib/npm.js +++ b/lib/npm.js @@ -248,6 +248,13 @@ NPMLocation.prototype = { packageConfig.dependencies = parseDependencies(packageConfig.dependencies, this.ui); packageConfig.peerDependencies = parseDependencies(packageConfig.peerDependencies, this.ui); + packageConfig.optionalDependencies = parseDependencies(packageConfig.optionalDependencies, this.ui); + + // remove optionalDependencies from dependencies, which are merged into dependencies by the npm registry + if (packageConfig.optionalDependencies) + Object.keys(packageConfig.optionalDependencies).forEach(function(d) { + delete packageConfig.dependencies[d]; + }); // ignore directory flattening for NodeJS, as npm doesn't do it // we do allow if there was an override through the jspm property though