{ "name": "combine-source-map", "version": "0.1.2", "description": "Add source maps of multiple files, offset them and then combine them into one source map", "main": "combine-source-map.js", "scripts": { "test": "node-trap test/*.js" }, "repository": { "type": "git", "url": "git://github.com/thlorenz/combine-source-map.git" }, "homepage": "https://github.com/thlorenz/combine-source-map", "dependencies": { "convert-source-map": "~0.2.3", "parse-base64vlq-mappings": "~0.1.1", "inline-source-map": "~0.2.1" }, "devDependencies": { "trap": "~0.4.2" }, "keywords": [ "source", "map", "sourcemap", "bundle", "combine", "cat", "sourceMappingUrl", "browserify" ], "author": { "name": "Thorsten Lorenz", "email": "thlorenz@gmx.de", "url": "http://thlorenz.com" }, "license": "MIT", "engine": { "node": ">=0.6" }, "readme": "# combine-source-map [![build status](https://secure.travis-ci.org/thlorenz/combine-source-map.png)](http://travis-ci.org/thlorenz/combine-source-map)\n\nAdd source maps of multiple files, offset them and then combine them into one source map.\n\n```js\nvar convert = require('convert-source-map');\nvar combine = require('combine-source-map');\n\nvar fooComment = '//@ sourceMappingURL=data:application/json;base64,eyJ2Z [..] pzJylcbiJdfQ==';\nvar barComment = '//@ sourceMappingURL=data:application/json;base64,eyJ2Z [..] VjaycpXG4iXX0=';\n\nvar fooFile = {\n source: '(function() {\\n\\n console.log(require(\\'./bar.js\\'));\\n\\n}).call(this);\\n' + '\\n' + fooComment\n , sourceFile: 'foo.js'\n};\nvar barFile = {\n source: '(function() {\\n\\n console.log(alert(\\'alerts suck\\'));\\n\\n}).call(this);\\n' + '\\n' + barComment\n , sourceFile: 'bar.js'\n};\n\nvar offset = { line: 2 };\nvar base64 = combine\n .create('bundle.js')\n .addFile(fooFile, offset)\n .addFile(barFile, { line: offset.line + 8 })\n .base64();\n\nvar sm = convert.fromBase64(base64).toObject();\nconsole.log(sm);\n```\n\n```\n{ version: 3,\n file: 'bundle.js',\n sources: [ 'foo.coffee', 'bar.coffee' ],\n names: [],\n mappings: ';;;AAAA;CAAA;CAAA,CAAA,CAAA,IAAO,GAAK;CAAZ;;;;;ACAA;CAAA;CAAA,CAAA,CAAA,IAAO,GAAK;CAAZ',\n sourcesContent:\n [ 'console.log(require \\'./bar.js\\')\\n',\n 'console.log(alert \\'alerts suck\\')\\n' ] }\n```\n\n## Installation\n\n npm install combine-source-map\n\n## API\n\n### create()\n\n```\n/**\n * @name create\n * @function\n * @param file {String} optional name of the generated file\n * @param sourceRoot { String} optional sourceRoot of the map to be generated\n * @return {Object} Combiner instance to which source maps can be added and later combined\n */\n```\n\n### Combiner.prototype.addFile(opts, offset)\n\n```\n/**\n * Adds map to underlying source map.\n * If source contains a source map comment that has the source of the original file inlined it will offset these\n * mappings and include them.\n * If no source map comment is found or it has no source inlined, mappings for the file will be generated and included\n * \n * @name addMap\n * @function\n * @param opts {Object} { sourceFile: {String}, source: {String} }\n * @param offset {Object} { line: {Number}, column: {Number} }\n */\n```\n\n### Combiner.prototype.base64()\n\n```\n/**\n* @name base64\n* @function\n* @return {String} base64 encoded combined source map\n*/\n```\n\n### Combiner.prototype.comment()\n\n```\n/**\n * @name comment\n * @function\n * @return {String} base64 encoded sourceMappingUrl comment of the combined source map\n */\n```\n\n### removeComments(src)\n\n```\n/**\n * @name removeComments\n * @function\n * @param src \n * @return {String} src with all sourceMappingUrl comments removed\n */\n```\n\n## Example \n\nRead and run the [more elaborate example](https://github.com/thlorenz/combine-source-map/blob/master/example/two-files.js) \nin order to get a better idea how things work.\n", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/thlorenz/combine-source-map/issues" }, "_id": "combine-source-map@0.1.2", "dist": { "shasum": "882fa1c374681089977ea050159422c4206f79ec" }, "_from": "combine-source-map@~0.1.1", "_resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.1.2.tgz" }