But inverse way was also one of the ideas - DUB would search for import statements and query the registry for matching packages. Additional comments or pragmas could be used for fine tuning (selecting specific version ranges).

A minor issue would be that import module name might not be the same with registered dub package name, adding another indirection.

But overall i think this approach is better.

  1. Is it sane to include a D parser into DUB?
  2. I don't really want all my source files to be parsed each time I build. With which parser?