{ "name": "convert-source-map", "version": "0.2.5", "description": "Converts a source-map from/to different formats and allows adding/changing properties.", "main": "convert-source-map.js", "scripts": { "test": "node-trap test/*.js" }, "repository": { "type": "git", "url": "git://github.com/thlorenz/convert-source-map.git" }, "homepage": "https://github.com/thlorenz/convert-source-map", "dependencies": {}, "devDependencies": { "trap": "~0.4.2", "inline-source-map": "~0.2.1" }, "keywords": [], "author": { "name": "Thorsten Lorenz", "email": "thlorenz@gmx.de", "url": "http://thlorenz.com" }, "license": "MIT", "engine": { "node": ">=0.6" }, "readme": "# convert-source-map [![build status](https://secure.travis-ci.org/thlorenz/convert-source-map.png)](http://travis-ci.org/thlorenz/convert-source-map)\n\nConverts a source-map from/to different formats and allows adding/changing properties.\n\n```js\nvar convert = require('convert-source-map');\n\nvar json = convert\n .fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')\n .toJSON();\n\nvar modified = convert\n .fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')\n .setProperty('sources', [ 'CONSOLE.LOG(\"HI\");' ])\n .toJSON();\n\nconsole.log(json);\nconsole.log(modified);\n```\n\n```json\n{\"version\":3,\"file\":\"foo.js\",\"sources\":[\"console.log(\\\"hi\\\");\"],\"names\":[],\"mappings\":\"AAAA\",\"sourceRoot\":\"/\"}\n{\"version\":3,\"file\":\"foo.js\",\"sources\":[\"CONSOLE.LOG(\\\"HI\\\");\"],\"names\":[],\"mappings\":\"AAAA\",\"sourceRoot\":\"/\"}\n```\n\n## API\n\n### fromObject(obj)\n\nReturns source map converter from given object.\n\n### fromJSON(json)\n\nReturns source map converter from given json string.\n\n### fromBase64(base64)\n\nReturns source map converter from given base64 encoded json string.\n\n### fromComment()\n\nReturns source map converter from given base64 encoded json string prefixed with `//@ sourceMappintURL=...`.\n\n### fromSource()\n\nFinds last sourcemap comment in file and returns source map converter or returns null if no source map comment was\nfound.\n\n### toObject()\n\nReturns a copy of the underlying source map.\n\n### toJSON([space])\n\nConverts source map to json string. If `space` is given (optional), this will be passed to\n[JSON.stringify](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify) when the\nJSON string is generated.\n\n### toBase64()\n\nConverts source map to base64 encoded json string.\n\n### toComment()\n\nConverts source map to base64 encoded json string prefixed with `//@ sourceMappingURL=...`.\n\n### addProperty(key, value)\n\nAdds given property to the source map. Throws an error if property already exists.\n\n### setProperty(key, value)\n\nSets given property to the source map. If property doesn't exist it is added, otherwise its value is updated.\n\n### getProperty(key)\n\nGets given property of the source map.\n\n### removeComments(src)\n\nReturns `src` with all source map comments removed\n\n### commentRegex\n\nReturns the regex used to find source map comments.\n", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/thlorenz/convert-source-map/issues" }, "_id": "convert-source-map@0.2.5", "dist": { "shasum": "bcbcb50f1fba6c9acd0e7c2b5e1bf168b1e41bd4" }, "_from": "convert-source-map@~0.2.3", "_resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-0.2.5.tgz" }