getsentry / rust-sourcemap

A library for rust that implements basic sourcemap handling
Other
224 stars 27 forks source link

feat: Skip encoding range mappings if it's empty #86

Closed kdy1 closed 7 months ago

kdy1 commented 7 months ago

The current code generates source map like

{
  "mappings": ";;UAAUA;MACOC,IAAI;IACV,SAASC;QACZC,QAAQC,GAAG,GAACH;IAChB;MAFgBC,IAAAA;AAGpB,GALUF,MAAAA",
  "names": [
    "A",
    "v",
    "a",
    "console",
    "log"
  ],
  "rangeMappings": ";;;;;;;;",
  "sources": [
    "../../input/index.ts"
  ],
  "sourcesContent": [
    "namespace A {\n    export const v = 25;\n    export function a() {\n        console.log(v);\n    }\n}\n"
  ],
  "version": 3
}

where rangeMappings is useless. This PR modifies the encoder to skip encoding if there's no meaningful data

kdy1 commented 7 months ago

Can you publish a new version, please?