fix(codegen): keep one source map mapping per generated position
Fixes #28843
Summary
Some printed tokens map to removed text, for example verify in public verify() {} maps to public. See the issue for details.
Fix
SourcemapBuilder::add_source_mapping skipped a new mapping only if it had the same original position as the last one. Now, if a new mapping has the same generated position as the last token, it replaces the last token. Nothing was printed between the two mappings, so the new mapping is for the printed token.
TypeScript's source map generator also overwrites a pending mapping at the same generated position, unless the original position moves backward (addMapping in TypeScript 7).
packages/codegen/src-js/print/write.ts gets the same rule.
Three existing unit tests in sourcemap_builder.rs passed the full output to both calls, so both mappings had the same generated position. Codegen does not do this: it passes the output that is printed so far. I changed the tests to do the same as codegen. The assertions do not change.
On 3,508 TypeScript files from 251 npm packages, oxc-transform 0.157.0 gives duplicate mappings in 690 files. With this change, no file has them.
I wrote this change with AI assistance (Claude Code). I reviewed the code and ran the tests.