Treat urls as module request when root starts with ~

Originally implemented as a one-off feature in webpack/css-loader#20, this is now a proposed change in loader-utils.

Adds some test coverage for this function too.