Use realize package specifier

The goal here is to clean up the special cases around local package handling and put it all in a module so I can use it outside of cache (for multi-stage install)
It's not necessary to change this, but I'm really not a fan of the way npm uses the comma operator and would like to start moving away from it.