diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-04-15 10:25:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-15 17:25:58 +0800 |
commit | 6e9afdc94fd51a827e9d9db51d650e15681866d3 (patch) | |
tree | ae59f88dc3900c24fa47b2a86fb34e097eaa95c3 /lib | |
parent | c4d28e3b2a2d82c7e5e3b398513755b507a75e76 (diff) | |
download | tracifyjs-6e9afdc94fd51a827e9d9db51d650e15681866d3.tar.gz tracifyjs-6e9afdc94fd51a827e9d9db51d650e15681866d3.zip |
prevent input source map mutation (#3781)
fixes #3780
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sourcemap.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/sourcemap.js b/lib/sourcemap.js index 232cfabd..25fbe3bf 100644 --- a/lib/sourcemap.js +++ b/lib/sourcemap.js @@ -103,12 +103,16 @@ function SourceMap(options) { if (options.orig) Object.keys(options.orig).forEach(function(name) { var map = options.orig[name]; var indices = [ 0, 0, 1, 0, 0 ]; - map.mappings = map.mappings.split(/;/).map(function(line) { - indices[0] = 0; - return line.split(/,/).map(function(segment) { - return indices.slice(0, vlq_decode(indices, segment)); - }); - }); + options.orig[name] = { + names: map.names, + mappings: map.mappings.split(/;/).map(function(line) { + indices[0] = 0; + return line.split(/,/).map(function(segment) { + return indices.slice(0, vlq_decode(indices, segment)); + }); + }), + sources: map.sources, + }; if (!sources_content || !map.sourcesContent) return; for (var i = 0; i < map.sources.length; i++) { var content = map.sourcesContent[i]; |