{"_id":"source-map-compactor","_rev":"4-90a7f6fb813df51428c77e2315e34e8d","name":"source-map-compactor","description":"Compacts sourcemaps, merging spurious mappings.","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"source-map-compactor","version":"1.0.0","description":"Compacts sourcemaps, merging spurious mappings.","main":"index.js","bin":{"source-map-compactor":"./cli"},"author":{"name":"Iván Sánchez Ortega","email":"ivan@sanchezortega.es"},"license":"Beerware","repository":{"type":"git","url":"git+https://gitlab.com/IvanSanchez/source-map-compactor.git"},"keywords":["sourcemap"],"homepage":"https://gitlab.com/IvanSanchez/source-map-compactor","dependencies":{"source-map":"^0.5.6"},"gitHead":"0fe969bd83a7fa5ca9abb10d88faa0e39d27650b","_id":"source-map-compactor@1.0.0","scripts":{},"_shasum":"9cf5564b6f57a4c4f6d334ba507fa0704a58a033","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"ivansanchez","email":"ivan@sanchezortega.es"},"maintainers":[{"name":"ivansanchez","email":"ivan@sanchezortega.es"}],"dist":{"shasum":"9cf5564b6f57a4c4f6d334ba507fa0704a58a033","tarball":"https://registry.npmjs.org/source-map-compactor/-/source-map-compactor-1.0.0.tgz","integrity":"sha512-/aNEyIQqnvrVUXBo5g047s9fh/lReucvLteFr+i3BzKZwzMNi73oi2C8oycucJ/ug+xkhuijCsbhC4qa7RQ15g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHTOsC8VvhKK5g7y3o5FspykqC4Y43pqMKCzU7jMKvoWAiEA7+JQ1V0U8QlJs+7zVF7W5hmBr2zapMgiJYdNicnCp5M="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/source-map-compactor-1.0.0.tgz_1477396881019_0.6879846889059991"}},"1.0.1":{"name":"source-map-compactor","version":"1.0.1","description":"Compacts sourcemaps, merging spurious mappings.","main":"index.js","bin":{"source-map-compactor":"./cli"},"author":{"name":"Iván Sánchez Ortega","email":"ivan@sanchezortega.es"},"license":"Beerware","repository":{"type":"git","url":"git+https://gitlab.com/IvanSanchez/source-map-compactor.git"},"keywords":["sourcemap"],"homepage":"https://gitlab.com/IvanSanchez/source-map-compactor","dependencies":{"source-map":"^0.5.6"},"gitHead":"8522396e437214926227dfa3c3d1c7df66693099","_id":"source-map-compactor@1.0.1","scripts":{},"_shasum":"94372d27d1fca2d8f0ebf7ddbd210c783c3494fc","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"ivansanchez","email":"ivan@sanchezortega.es"},"maintainers":[{"name":"ivansanchez","email":"ivan@sanchezortega.es"}],"dist":{"shasum":"94372d27d1fca2d8f0ebf7ddbd210c783c3494fc","tarball":"https://registry.npmjs.org/source-map-compactor/-/source-map-compactor-1.0.1.tgz","integrity":"sha512-r/JctkyY9xUNGtiO1bx6J3gmjhi5TSK5Rr/qw+TQOzejTNrIEj12jCpNP0qtJrUGPGNOwvSDoogrYMz/G4ekxQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCME84m4iBjJhDpD8i0woYrjiyu4b2KGkHZvI/zP8/62wIgSzTkkOaJb2BhsbXPd094tYdDaPr7dN1JRvTxOPPK3pc="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/source-map-compactor-1.0.1.tgz_1477397390882_0.3326669349335134"}}},"readme":"\n# source-map-compactor\n\nCompacts sourcemaps, merging spurious mappings.\n\n### Rationale\n\nI love [Rollup](http://rollupjs.org). I really do.\n\nBut.\n\nSometimes the sourcemaps look crazy, and make my browser choke on them, confuse variable scopes, prevent setting breakpoints, and generally misbehave.\n\nThis is due to the way [`magic-string`](https://github.com/rich-harris/magic-string) handles sourcemap mappings.\n\nTo remedy that, `source-map-compactor` looks at a sourcemap and performs four naïve optimizations:\n\n* Inserts blank line mappings when there is no mapping for a generated line.\n* Inserts blank character mappings at column 0 if there is no mapping for column 0 in a generated line.\n* Removes duplicated mappings to the same generated line-column (happens when `magic-string` replaces something with an empty string)\n* Removes duplicated mappings for contiguous segments of the same length (happens when `magic-string` copies several tokens in succesion)\n\nThese optimizations are not exhaustive, but they should create simpler and more reliable sourcemaps in most workflows.\n\n### Demo\n\nThe optimizations are easier to see with something like [`source-map-visualization`](https://github.com/sokra/source-map-visualization):\n\n#### Before:\n![Sourcemap visualization before](before.png)\n\n#### After:\n![Sourcemap visualization after](after.png)\n\n\n### Usage\n\nInstall it from NPM:\n```\nyarn add source-map-compactor\n```\n\nIn JS, require it and call it. It expects a string representing the sourcemap JSON, and returns a string representing a sourcemap JSON.\n\n```js\nvar compactor = require('source-map-compactor');\nvar fs = require('fs');\n\nvar sourceMapText = fs.readFileSync('bundle.js.map').toString();\nvar compactedSourceMapText = compactor(sourceMapText);\nfs.writeFileSync('bundle.js.map', compactedSourceMap);\n```\n\nIn a shell, run `source-map-compactor` with the filenames for input and output files, e.g.:\n\n```\n./node_modules/source-map-compactor build/bundle.js.map build/bundle.js.compacted.map\n```\n\n\n### License\n\n\"THE BEER-WARE LICENSE\":\n wrote this file. As long as you retain this notice you\ncan do whatever you want with this stuff. If we meet some day, and you think\nthis stuff is worth it, you can buy me a beer in return.\n","maintainers":[{"name":"ivansanchez","email":"ivan@sanchezortega.es"}],"time":{"modified":"2022-06-26T22:22:37.736Z","created":"2016-10-25T12:01:22.876Z","1.0.0":"2016-10-25T12:01:22.876Z","1.0.1":"2016-10-25T12:09:53.122Z"},"homepage":"https://gitlab.com/IvanSanchez/source-map-compactor","keywords":["sourcemap"],"repository":{"type":"git","url":"git+https://gitlab.com/IvanSanchez/source-map-compactor.git"},"author":{"name":"Iván Sánchez Ortega","email":"ivan@sanchezortega.es"},"license":"Beerware","readmeFilename":"README.md"}