Simplify sourceURL code and ensure source maps work avoid compat issues.

Former-commit-id: 5b64703eaebc65c443d6b9d3699d448c253e70c1
This commit is contained in:
John-David Dalton
2013-01-22 21:51:10 -08:00
parent 607abf89f7
commit 6774d46a6f
5 changed files with 6 additions and 43 deletions

View File

@@ -371,7 +371,7 @@
fs.unlinkSync(mapPath);
output = output
.replace(/[\s;]*$/, '\n//@ sourceMappingURL=' + path.basename(mapPath));
.replace(/[\s;]*$/, '\n/*\n//@ sourceMappingURL=' + path.basename(mapPath)) + '\n*/';
mapOutput = mapOutput
.replace(/("file":)""/, '$1"' + path.basename(outputPath) + '"')

View File

@@ -41,7 +41,7 @@
// add trailing semicolon
if (source) {
source = source.replace(/[\s;]*(\n\/\/.+)?$/, ';$1');
source = source.replace(/[\s;]*?(\s*\/\/.*\s*|\s*\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/\s*)*$/, ';$1');
}
// exit early if version snippet isn't found
var snippet = /VERSION\s*[=:]\s*([\'"])(.*?)\1/.exec(source);

View File

@@ -252,9 +252,6 @@
.replace('"__p += \'"', '"__p+=\'"')
.replace('"\';\n"', '"\';"')
// remove `useSourceURL` variable
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *try *{(?:\s*\/\/.*)*\n *var useSourceURL[\s\S]+?catch[^}]+}\n/, '');
// remove debug sourceURL use in `_.template`
source = source.replace(/(?:\s*\/\/.*\n)* *var sourceURL[^;]+;|\+ *sourceURL/g, '');