meteor_npm: don't lose interesting resolved

If an indirect dependency resolves to something other than a semver (or
a GitHub tarball), it will be stored in the 'resolved'. Our shrinkwrap
minifier (which helps to reduce spurious shrinkwrap file changes) needs
to recognize that.

Also, consistently use the "version" field in the minified shrinkwrap
file (which a comment already claimed we could do).

Fixes #1684.
This commit is contained in:
David Glasser
2013-12-17 18:55:28 -08:00
parent ebb729f0f6
commit 0f4a21f89f
4 changed files with 13 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
{
"dependencies": {
"handlebars": {
"from": "https://github.com/meteor/handlebars.js/tarball/543ec6689cf663cfda2d8f26c3c27de40aad7bd5",
"version": "https://github.com/meteor/handlebars.js/tarball/543ec6689cf663cfda2d8f26c3c27de40aad7bd5",
"dependencies": {
"optimist": {
"version": "0.3.7",

View File

@@ -1,7 +1,7 @@
{
"dependencies": {
"esprima": {
"from": "https://github.com/ariya/esprima/tarball/2a41dbf0ddadade0b09a9a7cc9a0c8df9c434018"
"version": "https://github.com/ariya/esprima/tarball/2a41dbf0ddadade0b09a9a7cc9a0c8df9c434018"
},
"escope": {
"version": "1.0.0",

View File

@@ -1,7 +1,7 @@
{
"dependencies": {
"mongodb": {
"from": "https://github.com/meteor/node-mongodb-native/tarball/779bbac916a751f305d84c727a6cc7dfddab7924",
"version": "https://github.com/meteor/node-mongodb-native/tarball/779bbac916a751f305d84c727a6cc7dfddab7924",
"dependencies": {
"bson": {
"version": "0.2.2"

View File

@@ -543,11 +543,16 @@ _.extend(exports, {
var topLevel = self._shrinkwrappedDependenciesTree(dir);
var minimizeModule = function (module) {
var minimized = {};
if (self._isGitHubTarball(module.from))
minimized.from = module.from;
else
minimized.version = module.version;
var version;
if (module.resolved &&
!module.resolved.match(/^https:\/\/registry.npmjs.org\//)) {
version = module.resolved;
} else if (self._isGitHubTarball(module.from)) {
version = module.from;
} else {
version = module.version;
}
var minimized = {version: version};
if (module.dependencies) {
minimized.dependencies = {};