fix(runtime): source map maybe cjs modules (#35013)
Fix source-map lookup for maybe-CJS modules by making the sync
source-map path emit CJS modules with ModuleKind::Cjs instead of
returning no prepared source.
Adds a regression spec that throws from a .cts module and expects stack
frames to map back to the original .cts source lines.
Verification:
- cargo fmt --check
- cargo check -p deno_resolver
- cargo build -p deno --bin deno -p test_server
- cargo test specs::run::maybe_cjs_source_map -- --no-capture (failed:
local disk filled while Cargo compiled unrelated test targets)
- ../../../../target/debug/deno run --quiet main.ts from
tests/specs/run/maybe_cjs_source_map (produced mapped mod.cts stack
frames)
Closes #26679
Closes denoland/divybot#540
Co-authored-by: divybot <divybot@users.noreply.github.com>
Co-authored-by: Divy Srivastava <me@littledivy.com>