New released yii-pjax 2.0.7 breaks my compressed JavaScript which generated by asset/compress command. JS files are joined with no separators after jquery.pjax.js.
Create an Yii project, then simply use yii asset/compress.
At least a semicolon should be inserted. I prefer wrapping each scripts by function(){ ... }();.

| Q | A
| ---------------- | ---
| Yii version | 2.0.12
| PHP version | 7.0.15, 7.1.8
| Operating system |Ubuntu, MacOS
I like semicolon but certain semicolon haters who can lead trends really exist -- GitHub, Twitter Bootstrap, Vue.js ...
Wrapping with (function(){ ... })(); will change code behavior - some scripts are intended to work in global scope.
@rob006 right! I will change my PR.
Isn't https://github.com/yiisoft/jquery-pjax/commit/0d4cc3f479d4b7b800aefca1275a852c8d3dd3c6 fixing the problem?
@samdark It will fix it for pjax, but any other library can have similar issues. Compressing assets should not depend on trailing semicolon.
Right. Makes sense to fix that. Would checking for trailing semicolon when concatenating files and adding it if it's not there do?
Sorry for being late to the party...
@samdark The semicolon does not hurt, but shouldn't a simple new-line be OK for this?
It's JavaScript 😏 http://www.bradoncode.com/blog/2015/08/26/javascript-semi-colon-insertion/
[edit] Hmm, not quite sure after reading this https://stackoverflow.com/a/1169596/291573
[edit2] A problematic use-case might be, that if you are passing the generated, concatenated code to another tool, it might complain about the additional semicolons.
@tanakahisateru I wonder why the comments are not visible in the screenshot above. Is the source from concatenating the files with Yii or is there another tool involved?
@schmunk42 I can't think of a case where it won't work as expected...
Yes, after some more research, it looks like this is the right thing to do.
@samdark Can you reopen this issue? I found the case for trailing line comment, e.g:
(function($) {
})(jQuery) // trailing line comment 👻
... will be combined and compressed with the next file as:
/*** BEGIN FILE: 1st.js ***/
(function($) {
})(jQuery) // Trailing line comment 👻;
/*** END FILE: 1st.js ***/
/*** BEGIN FILE: 2nd.js ***/
(function($) {
})(jQuery)
/*** END FILE: 2nd.js ***/
↓
$ node_modules/.bin/uglifyjs conbined.js
(function($){})(jQuery)(function($){})(jQuery);
It needs a new line before inserted semicolon.
})(jQuery) // Trailing line comment 👻
;
/*** END FILE: 1st.js ***/
Would you please create a pull request? Thanks.