{
  "name": "source-map",
  "description": "Generates and consumes source maps",
  "version": "0.1.8",
  "homepage": "https://github.com/mozilla/source-map",
  "author": {
    "name": "Nick Fitzgerald",
    "email": "nfitzgerald@mozilla.com"
  },
  "contributors": [],
  "repository": {
    "type": "git",
    "url": "http://github.com/mozilla/source-map.git"
  },
  "directories": {
    "lib": "./lib"
  },
  "main": "./lib/source-map.js",
  "engines": {
    "node": ">=0.8.0"
  },
  "licenses": [
    {
      "type": "BSD",
      "url": "http://opensource.org/licenses/BSD-3-Clause"
    }
  ],
  "dependencies": {
    "amdefine": ">=0.0.4"
  },
  "devDependencies": {
    "dryice": ">=0.4.8"
  },
  "readme": "# Source Map\n\nThis is a library to generate and consume the source map format\n[described here][format].\n\n[Learn more here][feature].\n\nThis library was written in the Asynchronous Module Definition\nformat. It should work in the following environments:\n\n* Modern Browsers (either after the build, or with an AMD loader such as\n  RequireJS)\n\n* Inside Firefox (as a JSM file, after the build)\n\n* With NodeJS versions 0.4.X and higher\n\n## Installing with NPM (for use with NodeJS)\n\nSimply\n\n    $ npm install source-map\n\nOr, if you'd like to hack on this library and have it installed via npm so you\ncan try out your changes:\n\n    $ git clone https://fitzgen@github.com/mozilla/source-map.git\n    $ cd source-map\n    $ npm link .\n\n## Building from Source (for everywhere else)\n\nInstall Node and then run\n\n    $ git clone https://fitzgen@github.com/mozilla/source-map.git\n    $ cd source-map\n    $ npm link .\n\nNext, run\n\n    $ node Makefile.dryice.js`\n\nThis should create the following files:\n\n* `dist/source-map.js` - The unminified browser version.\n\n* `dist/source-map.min.js` - The minified browser version.\n\n* `dist/SourceMap.jsm` - The JavaScript Module for inclusion in Firefox\n  source.\n\n## API\n\nGet a reference to the module:\n\n    // NodeJS\n    var sourceMap = require('source-map');\n\n    // Browser builds\n    var sourceMap = window.sourceMap;\n\n    // Inside Firefox\n    let sourceMap = {};\n    Components.utils.import('resource:///modules/devtools/SourceMap.jsm', sourceMap);\n\n### SourceMapConsumer\n\nA SourceMapConsumer instance represents a parsed source map which we can query\nfor information about the original file positions by giving it a file position\nin the generated source.\n\n#### new SourceMapConsumer(rawSourceMap)\n\nThe only parameter is the raw source map (either as a string which can be\n`JSON.parse`'d, or an object). According to the spec, source maps have the\nfollowing attributes:\n\n* `version`: Which version of the source map spec this map is following.\n\n* `sources`: An array of URLs to the original source files.\n\n* `names`: An array of identifiers which can be referrenced by individual\n  mappings.\n\n* `sourceRoot`: Optional. The URL root from which all sources are relative.\n\n* `mappings`: A string of base64 VLQs which contain the actual mappings.\n\n* `file`: The generated filename this source map is associated with.\n\n#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition)\n\nReturns the original source, line, and column information for the generated\nsource's line and column positions provided. The only argument is an object with\nthe following properties:\n\n* `line`: The line number in the generated source.\n\n* `column`: The column number in the generated source.\n\nand an object is returned with the following properties:\n\n* `source`: The original source file, or null if this information is not\n  available.\n\n* `line`: The line number in the original source, or null if this information is\n  not available.\n\n* `column`: The column number in the original source, or null or null if this\n  information is not available.\n\n* `name`: The original identifier, or null if this information is not available.\n\n#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition)\n\nReturns the generated line and column information for the original source,\nline, and column positions provided. The only argument is an object with\nthe following properties:\n\n* `source`: The filename of the original source.\n\n* `line`: The line number in the original source.\n\n* `column`: The column number in the original source.\n\nand an object is returned with the following properties:\n\n* `line`: The line number in the generated source, or null.\n\n* `column`: The column number in the generated source, or null.\n\n#### SourceMapConsumer.prototype.eachMapping(callback, context, order)\n\nIterate over each mapping between an original source/line/column and a\ngenerated line/column in this source map.\n\n* `callback`: The function that is called with each mapping. This function\n  should not mutate the mapping.\n\n* `context`: Optional. If specified, this object will be the value of `this`\n  every time that `callback` is called.\n\n* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or\n  `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over\n  the mappings sorted by the generated file's line/column order or the\n  original's source/line/column order, respectively. Defaults to\n  `SourceMapConsumer.GENERATED_ORDER`.\n\n### SourceMapGenerator\n\nAn instance of the SourceMapGenerator represents a source map which is being\nbuilt incrementally.\n\n#### new SourceMapGenerator(startOfSourceMap)\n\nTo create a new one, you must pass an object with the following properties:\n\n* `file`: The filename of the generated source that this source map is\n  associated with.\n\n* `sourceRoot`: An optional root for all relative URLs in this source map.\n\n#### SourceMapGenerator.prototype.addMapping(mapping)\n\nAdd a single mapping from original source line and column to the generated\nsource's line and column for this source map being created. The mapping object\nshould have the following properties:\n\n* `generated`: An object with the generated line and column positions.\n\n* `original`: An object with the original line and column positions.\n\n* `source`: The original source file (relative to the sourceRoot).\n\n* `name`: An optional original token name for this mapping.\n\n#### SourceMapGenerator.prototype.toString()\n\nRenders the source map being generated to a string.\n\n### SourceNode\n\nSourceNodes provide a way to abstract over interpolating and/or concatenating\nsnippets of generated JavaScript source code, while maintaining the line and\ncolumn information associated between those snippets and the original source\ncode. This is useful as the final intermediate representation a compiler might\nuse before outputting the generated JS and source map.\n\n#### new SourceNode(line, column, source[, chunk])\n\n* `line`: The original line number associated with this source node, or null if\n  it isn't associated with an original line.\n\n* `column`: The original column number associated with this source node, or null\n  if it isn't associated with an original column.\n\n* `source`: The original source's filename.\n\n* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see\n  below.\n\n#### SourceNode.prototype.add(chunk)\n\nAdd a chunk of generated JS to this source node.\n\n* `chunk`: A string snippet of generated JS code, another instance of\n   `SourceNode`, or an array where each member is one of those things.\n\n#### SourceNode.prototype.prepend(chunk)\n\nPrepend a chunk of generated JS to this source node.\n\n* `chunk`: A string snippet of generated JS code, another instance of\n   `SourceNode`, or an array where each member is one of those things.\n\n#### SourceNode.prototype.walk(fn)\n\nWalk over the tree of JS snippets in this node and its children. The walking\nfunction is called once for each snippet of JS and is passed that snippet and\nthe its original associated source's line/column location.\n\n* `fn`: The traversal function.\n\n#### SourceNode.prototype.join(sep)\n\nLike `Array.prototype.join` except for SourceNodes. Inserts the separator\nbetween each of this source node's children.\n\n* `sep`: The separator.\n\n#### SourceNode.prototype.replaceRight(pattern, replacement)\n\nCall `String.prototype.replace` on the very right-most source snippet. Useful\nfor trimming whitespace from the end of a source node, etc.\n\n* `pattern`: The pattern to replace.\n\n* `replacement`: The thing to replace the pattern with.\n\n#### SourceNode.prototype.toString()\n\nReturn the string representation of this source node. Walks over the tree and\nconcatenates all the various snippets together to one string.\n\n### SourceNode.prototype.toStringWithSourceMap(startOfSourceMap)\n\nReturns the string representation of this tree of source nodes, plus a\nSourceMapGenerator which contains all the mappings between the generated and\noriginal sources.\n\nThe arguments are the same as those to `new SourceMapGenerator`.\n\n## Tests\n\nInstall NodeJS version 0.4.0 or greater, then run `node test/run-tests.js`.\n\nTo add new tests, create a new file named `test/test-<your new test name>.js`\nand export your test functions with names that start with \"test\", for example\n\n    exports[\"test doing the foo bar\"] = function () {\n      ...\n    };\n\nThe new test will be located automatically when you run the suite.\n\n[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit\n[feature]: https://wiki.mozilla.org/DevTools/Features/SourceMap\n[Dryice]: https://github.com/mozilla/dryice\n",
  "readmeFilename": "README.md",
  "_id": "source-map@0.1.8",
  "_from": "source-map@~0.1.7"
}
