Lines Matching refs:source
3 …uild Status](https://travis-ci.org/mozilla/source-map.png?branch=master)](https://travis-ci.org/mo…
5 [](https://www.npmjs.co…
7 This is a library to generate and consume the source map format
14 $ npm install source-map
18 …<script src="https://raw.githubusercontent.com/mozilla/source-map/master/dist/source-map.min.js" d…
29 - [Consuming a source map](#consuming-a-source-map)
30 - [Generating a source map](#generating-a-source-map)
41 …- [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumer…
51 …- [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chun…
67 ### Consuming a source map
89 // { source: 'http://example.com/www/js/two.js',
95 source: 'http://example.com/www/js/two.js',
106 ### Generating a source map
109 … Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/)
120 ast.location.source,
127 ast.location.source,
148 file: "source-mapped.js"
156 source: "foo.js",
165 // '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":…
174 var sourceMap = require('source-map');
180 const sourceMap = require("devtools/toolkit/sourcemap/source-map.js");
185 A SourceMapConsumer instance represents a parsed source map which we can query
187 in the generated source.
191 The only parameter is the raw source map (either as a string which can be
192 `JSON.parse`'d, or an object). According to the spec, source maps have the
195 * `version`: Which version of the source map spec this map is following.
197 * `sources`: An array of URLs to the original source files.
204 * `sourcesContent`: Optional. An array of contents of the original source files.
208 * `file`: Optional. The generated filename this source map is associated with.
221 consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
232 consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
247 Returns the original source, line, and column information for the generated
248 source's line and column positions provided. The only argument is an object with
251 * `line`: The line number in the generated source. Line numbers in
252 this library are 1-based (note that the underlying source map
256 * `column`: The column number in the generated source. Column numbers
267 * `source`: The original source file, or null if this information is not
270 * `line`: The line number in the original source, or null if this information is
273 * `column`: The column number in the original source, or null if this
280 // { source: 'foo.coffee',
286 // { source: null,
294 Returns the generated line and column information for the original source,
298 * `source`: The filename of the original source.
300 * `line`: The line number in the original source. The line number is
303 * `column`: The column number in the original source. The column
308 * `line`: The line number in the generated source, or null. The line
311 * `column`: The column number in the generated source, or null. The
315 consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 })
322 Returns all generated line and column information for the original source, line,
331 * `source`: The filename of the original source.
333 * `line`: The line number in the original source. The line number is
336 * `column`: Optional. The column number in the original source. The
341 * `line`: The line number in the generated source, or null. The line
344 * `column`: The column number in the generated source, or null. The
348 consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" })
359 Return true if we have the embedded source content for every source listed in
360 the source map, false otherwise.
363 `consumer.sourceContentFor(s)` will succeed for every source `s` in
376 #### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])
378 Returns the original source content for the source provided. The only
379 argument is the URL of the original source file.
381 If the source content for the given source is not found, then an error is
392 consumer.sourceContentFor("this is not in the source map");
393 // Error: "this is not in the source map" is not in the source map
395 consumer.sourceContentFor("this is not in the source map", true);
401 Iterate over each mapping between an original source/line/column and a
402 generated line/column in this source map.
405 form `{ source, generatedLine, generatedColumn, originalLine, originalColumn,
414 original's source/line/column order, respectively. Defaults to
420 // { source: 'illmatic.js',
426 // { source: 'illmatic.js',
436 An instance of the SourceMapGenerator represents a source map which is being
443 * `file`: The filename of the generated source that this source map is
446 * `sourceRoot`: A root for all relative URLs in this source map.
472 Add a single mapping from original source line and column to the generated
473 source's line and column for this source map being created. The mapping object
480 * `source`: The original source file (relative to the sourceRoot).
486 source: "module-one.scm",
494 Set the source content for an original source file.
496 * `sourceFile` the URL of the original source file.
498 * `sourceContent` the content of the source file.
507 Applies a SourceMap for a source file to the SourceMap.
508 Each mapping to the supplied source file is rewritten using the
514 * `sourceFile`: Optional. The filename of the source file.
522 directory, and the SourceMap to be applied contains relative source
523 paths. If so, those relative source paths need to be rewritten
531 Renders the source map being generated to a string.
541 snippets of generated JavaScript source code, while maintaining the line and
542 column information associated between those snippets and the original source
544 use before outputting the generated JS and source map.
546 #### new SourceNode([line, column, source[, chunk[, name]]])
548 * `line`: The original line number associated with this source node, or null if
551 * `column`: The original column number associated with this source node, or null
555 * `source`: The original source's filename; null if no filename is provided.
589 Add a chunk of generated JS to this source node.
602 Prepend a chunk of generated JS to this source node.
613 Set the source content for a source file. This will be added to the
616 * `sourceFile`: The filename of the source file
618 * `sourceContent`: The content of the source file
629 the its original associated source's line/column location.
644 // WALK: uno { source: 'b.js', line: 3, column: 4, name: null }
645 // WALK: dos { source: 'a.js', line: 1, column: 2, name: null }
646 // WALK: tres { source: 'a.js', line: 1, column: 2, name: null }
647 // WALK: quatro { source: 'c.js', line: 5, column: 6, name: null }
653 source file content and is passed the filename and source content.
666 node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); …
675 between each of this source node's children.
690 Call `String.prototype.replace` on the very right-most source snippet. Useful
691 for trimming white space from the end of a source node, etc.
704 Return the string representation of this source node. Walks over the tree and
723 Returns the string representation of this tree of source nodes, plus a