diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-05-04 20:25:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-04 20:25:52 +0800 |
commit | 354fec8a9c3c8540d7e964ecbfcb38deaae86a3e (patch) | |
tree | fed20f61e163195ad4d8eb632e79212e6dcb5587 /bin/uglifyjs | |
parent | 11cdab745d29313a4e1799c65d13f7d6d5a45938 (diff) | |
download | tracifyjs-354fec8a9c3c8540d7e964ecbfcb38deaae86a3e.tar.gz tracifyjs-354fec8a9c3c8540d7e964ecbfcb38deaae86a3e.zip |
make `enclose` & `wrap` work with `sourceMap` (#3396)
fixes #3313
Diffstat (limited to 'bin/uglifyjs')
-rwxr-xr-x | bin/uglifyjs | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs index 35207bf7..ace94e7e 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -215,24 +215,26 @@ function run() { var ex = result.error; if (ex.name == "SyntaxError") { print_error("Parse error at " + ex.filename + ":" + ex.line + "," + ex.col); - var col = ex.col; - var lines = files[ex.filename].split(/\r?\n/); - var line = lines[ex.line - 1]; - if (!line && !col) { - line = lines[ex.line - 2]; - col = line.length; - } - if (line) { - var limit = 70; - if (col > limit) { - line = line.slice(col - limit); - col = limit; + var file = files[ex.filename]; + if (file) { + var col = ex.col; + var lines = file.split(/\r?\n/); + var line = lines[ex.line - 1]; + if (!line && !col) { + line = lines[ex.line - 2]; + col = line.length; + } + if (line) { + var limit = 70; + if (col > limit) { + line = line.slice(col - limit); + col = limit; + } + print_error(line.slice(0, 80)); + print_error(line.slice(0, col).replace(/\S/g, " ") + "^"); } - print_error(line.slice(0, 80)); - print_error(line.slice(0, col).replace(/\S/g, " ") + "^"); } - } - if (ex.defs) { + } else if (ex.defs) { print_error("Supported options:"); print_error(format_object(ex.defs)); } |