alexanderGugel / ied

:package: Like npm, but faster - an alternative package manager for Node
http://alexandergugel.github.io/ied
MIT License
1.99k stars 53 forks source link

Use resolved package version as uid #79

Closed just-boris closed 8 years ago

just-boris commented 8 years ago

The fix is very small, but can bring a big performance profit.

Consider the following dependency tree:

packageA
├── packageB
│   └── packageC (^1.0.0)
└── packageC (1.1.1)

Now package uid generated by specified version from package.json. That means that you get different packages as packageC@^1.0.0 and packageC@1.1.1 even if it will be resolved to the same version 1.1.1

After this fix, the resolved version will be used and packageC instances will be merged and we will make fewer requests.

alexanderGugel commented 8 years ago

We should use pkg.dist.shasum for registry dependencies I think. Changing it to use the name/version from the package.json was a bad idea. It's not really consistent and not really a CAS anymore (which is not nice :sob: ).

just-boris commented 8 years ago

Why does it really matter?

Now npm registry doesn't allow to publish new package over existing version (just checked it to be sure), so you can probably trust package-name+version pair as a unique identifier.

We can't rely on shasum for tarballs, the same thing with incoming git and github dependencies. So, I'd like to have the same behavior for all resolvers.

Also, there is an issue #48. Now it seems that we can provide very good folder names without any suffixes.

alexanderGugel commented 8 years ago

Hmmm... yeah, fair point. git dependencies are a problem with the CAS (which is pretty funny considering the fact that git itself is a CAS).

I'm gonna merge this, but I'm gonna play a little bit around with alternative solutions,.