Repository: deno
Issue: [Feature Request] `deno test --coverage` should output transpiled code and sourcemap
Labels: feat,testing

Deno currently supports collecting raw V8 coverage data through the `--coverage` flag, which is fantastic. 

As a result, we have the opportunity to use third-party tools to directly convert from raw V8 coverage data and generate various other coverage reports, not just the `lcov` and simple `html` provided by the official.
- With raw V8 coverage data, more types of common coverage reports, such as [V8](https://cenfun.github.io/monocart-coverage-reports/v8/) coverage reports, can be generated directly, and custom coverage reports are also supported.
- With raw V8 coverage data, it can be merged with other V8 coverage reports, such as e2e test ([Playwright](https://playwright.dev/docs/api/class-coverage)/[Puppeteer](https://pptr.dev/api/puppeteer.coverage)) coverage, and even Node.js ([Jest V8 provider](https://jestjs.io/docs/configuration#coverageprovider-string)) or Istanbul ([v8-to-istanbul](https://github.com/istanbuljs/v8-to-istanbul)) coverage.

## The problem
However, Deno's V8 coverage data does not include transpiled code and sourcemap, or we can not get the transpiled code and sourcemap for these V8 coverage data.
- The `startOffset` and `endOffset` in the coverage data are matched to the position of the transpiled code. Without the transpiled code, the position cannot be matched.
- Without a sourcemap, the position of the original code cannot be found.

For example, after providing the transpiled code and sourcemap, the coverage json could be following
```js
{
  "scriptId": "310",
  "url": "file:///E:/workspace/deno-coverage-reports/src/main.ts",
  "source": "<the transpiled source code>",
  "sourceMap": "<the sourcemap for the transpiled source code>",
  "functions": [
    ...
  ]
}
```

## Expectation
In fact, the transpiled code and sourcemap should be separated because multiple coverage data may exist for the same file. For example, we expect to get the coverage files like following:
```js
- coverage // coverage dir
  - coverage-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.json // coverage data 1 for source file 1
  - coverage-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.json // coverage data 2 for source file 1
  - coverage-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.json // coverage data 3 for source file 2
  - source-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.json // source file 1, include transpiled code and sourcemap 
  - source-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.json // source file 2, include transpiled code and sourcemap 
```

## Attempt
I tried to use the tool [MCR](https://github.com/cenfun/monocart-coverage-reports) to generate native V8 coverage reports from Deno's coverage data, but due to the above problem, it was unsuccessful. For details, refer to the repo: 
https://github.com/cenfun/deno-coverage-reports

```js
// coverage-report.js
import MCR from "npm:monocart-coverage-reports@latest";
import { fileURLToPath } from "node:url";

const mcr = MCR({
  //logging: "debug",
  name: "My Deno Coverage Report",
  outputDir: "./coverage-reports/",
  reports: ["v8", "console-details"],
});

const coverageList = [];
const coverageDataDir = "coverage";
for (const dirEntry of Deno.readDirSync(coverageDataDir)) {
  const data = Deno.readTextFileSync(`${coverageDataDir}/${dirEntry.name}`);
  const fileCoverage = JSON.parse(data);
  if (fileCoverage.url.startsWith("file://")) {
    const source = Deno.readTextFileSync(fileURLToPath(fileCoverage.url));
    // NOTE: It requires transpiled source code and sourcemap. Unfortunately, Deno doesn't provide.
    // The source is original code not transpiled code.
    // Because of the offset in coverage is mapping to transpiled code. So, the source is wrong here.
    fileCoverage.source = source;
    coverageList.push(fileCoverage);
  }
}

await mcr.add(coverageList);
await mcr.generate();
```
CLI
```sh
deno run --allow-env --allow-read --allow-sys --allow-write tasks/coverage-report.js
```

## Related issues
#21325 
#18147
#21582
#20007
#16626