It's complicated.
V8 has a so-called "snapshotting" mechanism which is used to speed up startup. Recently people have been working on using it to cache other code as well.
That said, this is no silver bullet, as there are a number of inherent challenges:
- dynamic languages like JavaScript are not well-suited for ahead-of-time compilation
- generating optimized code depends on having collected type feedback, so it can't happen up front; it also by definition bakes in a number of non-cacheable assumptions
- generating non-optimized code, on the other hand, is relatively fast anyway (unless there's a huge amount of it), so caching it only helps so much
- assuming you have a working caching mechanism, you need reasonable rules when to use it, how much disk space you're giving it, how you're making sure it isn't stale, and so on.
- caching generated code doesn't affect sustained performance (possibly on the contrary), it can only improve startup time.
So having an explicit and time-consuming "installation"/pre-compilation phase for JS packages isn't going to happen. However, more automatic caching under the hood is something you're likely to see in the future (regardless of where scripts came from -- there's no reason this couldn't work with regular scripts found on web sites.)