support sourceMappingURL being located at the beginning of the file

This commit is contained in:
Brock Pytlik 2013-03-04 15:47:32 -08:00
parent dee77a507c
commit fe649c7493

View File

@ -7,7 +7,7 @@ function mapSourcePosition(cache, position) {
if (!sourceMap && fs.existsSync(position.source)) { if (!sourceMap && fs.existsSync(position.source)) {
// Get the URL of the source map // Get the URL of the source map
var fileData = fs.readFileSync(position.source, 'utf8'); var fileData = fs.readFileSync(position.source, 'utf8');
var match = /\/\/@\s*sourceMappingURL=(.*)\s*$/.exec(fileData); var match = /\/\/@\s*sourceMappingURL=(.*)\s*$/m.exec(fileData);
if (!match) return position; if (!match) return position;
var sourceMappingURL = match[1]; var sourceMappingURL = match[1];