evanw/node-source-map-support — pull request #18 by glasser (2013-07-17 18:38:33+00:00)
Title: Allow overriding the mapping from source file to source map.

This is done with the new retrieveSourceMap option to sourcemap.install.

This is useful if you have another way of finding your source maps (and can avoid sync reads).

Also, allow source maps to not have an URL, and don't write to a global named mapSourcePosition.

(We're using this in Meteor. Meteor builds a set of JS files into an app and builds source maps as it goes. It has a manifest file telling the app executor where to find source maps. So rather than parse the source for the comment and then do readFileSyncs, the app executor just keeps the source maps in memory and has its own mapping from JS filename to source map. This change should be fully backwards-compatible if you don't pass the new option (other than fixing the bug where it was writing to `mapSourcePosition` in the global namespace).)