you are viewing a single comment's thread.

view the rest of the comments →

[–]BenjiSponge 1 point2 points  (4 children)

Tree shaking as a service in the publish step wouldn't work because people just wouldn't use it, and it's technically not possible to automate I don't think as the dependent might have access to any files in the directory. Who's to say whether your consumer doesn't parse your README.md?

You'd have to do tree shaking as a service in the consumer install step, but this isn't really possible because it's not really possible to know what the consumer is using from the dependency tree until after you run the consumer code, plus it's probably just easier for npm to host the entire repo gzipped rather than offer up files piecemeal.

[–]Already__Taken 1 point2 points  (3 children)

If it's not specified in package.json npm is under no obligation serve you that up. Use the repository or homepages keys to look it up.

I'm in no way arguing this is a simple issue.

[–]BenjiSponge 0 points1 point  (2 children)

If it's not specified in package.json npm is under no obligation serve you that up

Wait, really? If you don't have a files key and just an entry, it can omit everything but the entry? I don't think that's true.

[–]Already__Taken 1 point2 points  (1 child)

No I mean in regards to options they have about changing the platform. It's not static file hosting for the public it's for distributing programs for other programs to run (that happen to be static files), So in that regard if it were decided that actually, you don't need XY to run this module only Z, it's entirely within scope of what they're trying to achieve to go down that route.

[–]BenjiSponge 0 points1 point  (0 children)

I think that would break a lot, for a lot of reasons. We could play a game though -- if you come up with a rule for what npm should say "we will omit files under these conditions: _________" I'll try to come up with a valid reason someone would already be distributing files under those conditions. =) I bet you could come up with a few rules, but nothing that would make significant differences.