improve source mapping of console output and errors (#47388)
### What?
* see https://github.com/vercel/turbo/pull/4284
* also adds a test case
* fixes some bugs with app dir (e. g. fixes https://github.com/vercel/turbo/issues/2496)
### Why?
* Stack traces pointing to generated code are not very useful
### How?
* Source Maps
* Code context
* Replacing magic identifiers
fixes WEB-745