I need to figure out how to use the mapping file that the coffeescript compiler provides to map through my changes, and through the coffeescript compiler, all the way back to the original coffeescript source.
Use the APIs provided by the Mozilla source-map project.
Use the applySourceMap
method. It does the following:
Applies a SourceMap for a source file to the SourceMap. Each mapping to the supplied source file is rewritten using the supplied SourceMap. Note: The resolution for the resulting mappings is the minimum of this map and the supplied map.
and the allGeneratedPostionsfor
method. It does the following:
Returns all generated line and column information for the original source, line, and column provided. If no column is provided, returns all mappings corresponding to a either the line we are searching for or the next closest line that has any mappings. Otherwise, returns all mappings corresponding to the given line and either the column we are searching for or the next closest column that has any offsets.