An optimization to avoid writing the same files over and over again.
Tested only on Mac OS X.
There is a potential problem with this approach on Windows, since the
way processes retain open files is different.
On Linux (and I assume, OS X, too), when a process has a file open, it
reads the file from a memory snapshot loaded by OS. The OS also would
increment the reference count for that file, so even if it is unlinked
from the FS, OS would still keep it available as long as the process
keeps it open.
When we want to replace a file under a running Meteor app process, we
first delete the old built file and then write a new file to the same
path. In my understanding, it would force the OS to assign a different
inode for the new file, so the old file and the new file will be
different. Then, we either restart the app process, or signal it to
reload its assets, so it reads the new files, releasing the older ones.
I need to verify this understanding with somebody who actually knows how
OS and FS work.