The original path of the file to be updated.
The outgoing path of the file once updated.
Additional configuration options.
Recursive conversions started for discovered imports are pushed here as promises, so the caller can await them before considering the current file done. makeCommon's own recursive calls don't block; without this, a file could be reported "finished" before its own dependencies (or their dependencies, arbitrarily deep) have actually finished being written.
Tracks recursive conversions already started (by destination path), shared across the whole call tree. A dependency reachable from multiple import chains would otherwise be independently, redundantly re-converted every time it's encountered again while its first conversion is still in flight (the fileExists check below can't catch this - the file isn't written yet) - each duplicate spawning its own full sub-tree of further duplicates, which is what caused this function's historical OOM crash. Reusing the same in-flight promise instead of starting a new one avoids that entirely.
Source files currently being converted above this one, in this same branch. Real packages can have genuine circular imports (two files that import each other) - waiting for such a target's conversion to finish before this file is done would deadlock, since its own conversion is simultaneously waiting on this one. A target already in this set is already in flight further up the same chain - don't wait on it again here.
Take a srcPath, destPath, then return a function to reduce the content for replacing file imports.