Skip to content

Commit dcf2aeb

Browse files
committed
Fixes requirejs#297, uglifyjs on command line adds trailing semicolon. Match that behavior.
1 parent c7c6898 commit dcf2aeb

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

build/jslib/optimize.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ function (lang, logger, envOptimize, file, parse,
1616
var optimize,
1717
cssImportRegExp = /\@import\s+(url\()?\s*([^);]+)\s*(\))?([\w, ]*)(;)?/g,
1818
cssCommentImportRegExp = /\/\*[^\*]*@import[^\*]*\*\//g,
19-
cssUrlRegExp = /\url\(\s*([^\)]+)\s*\)?/g;
19+
cssUrlRegExp = /\url\(\s*([^\)]+)\s*\)?/g,
20+
endSemicolonRegExp = /;\s*$/;
2021

2122
/**
2223
* If an URL from a CSS url value contains start/end quotes, remove them.
@@ -362,6 +363,9 @@ function (lang, logger, envOptimize, file, parse,
362363
if (config.max_line_length) {
363364
fileContents = processor.split_lines(fileContents, config.max_line_length);
364365
}
366+
367+
//Add trailing semicolon to match uglifyjs command line version
368+
fileContents += ';';
365369
} catch (e) {
366370
errMessage = e.toString();
367371
errMatch = /\nError(\r)?\n/.exec(errMessage);

build/tests/lib/comments/expected.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010

1111
//@license comment to be found
1212

13-
define("bang",[],function(){return{name:"bang"}}),define("license",{name:"license"})
13+
define("bang",[],function(){return{name:"bang"}}),define("license",{name:"license"});

build/tests/lib/comments/noPartialDupe/expected.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
// For all details and documentation:
77
// http://documentcloud.github.com/underscore
88

9-
(function(){})()
9+
(function(){})();

build/tests/lib/comments/unique/expected.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
* sdf sdf
1919
*/
2020

21-
define("main",function(){})
21+
define("main",function(){});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy