js-beautify 1.14.0 → 1.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,16 +1,12 @@
1
- # JS Beautifier
2
- ![CI](https://github.com/beautify-web/js-beautify/workflows/CI/badge.svg)
1
+ <p align="center"><img src="https://raw.githubusercontent.com/beautify-web/js-beautify/7db71fc/web/wordmark-light.svg" height="200px" align="center" alt="JS Beautifier"/></p>
3
2
 
4
- [![PyPI version](https://img.shields.io/pypi/v/jsbeautifier.svg)](https://pypi.python.org/pypi/jsbeautifier)
5
- [![CDNJS version](https://img.shields.io/cdnjs/v/js-beautify.svg)](https://cdnjs.com/libraries/js-beautify)
6
- [![NPM @latest](https://img.shields.io/npm/v/js-beautify.svg)](https://www.npmjs.com/package/js-beautify)
7
- [![NPM @next](https://img.shields.io/npm/v/js-beautify/next.svg)](https://www.npmjs.com/package/js-beautify?activeTab=versions)
3
+ <p align="center"><a href="https://github.com/beautify-web/js-beautify/actions/workflows/main.yml"><img alt="CI" src="https://github.com/beautify-web/js-beautify/workflows/CI/badge.svg"/></a>&#32;<a href="https://greenkeeper.io/" target="_blank"><img alt="Greenkeeper badge" src="https://badges.greenkeeper.io/beautify-web/js-beautify.svg"/></a></p>
8
4
 
9
- [![Join the chat at https://gitter.im/beautify-web/js-beautify](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/beautify-web/js-beautify?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
10
- [![Twitter Follow](https://img.shields.io/twitter/follow/js_beautifier.svg?style=social&label=Follow)](https://twitter.com/intent/user?screen_name=js_beautifier)
5
+ <p align="center"><a href="https://pypi.python.org/pypi/jsbeautifier" target="_blank"><img alt="PyPI version" src="https://img.shields.io/pypi/v/jsbeautifier.svg"/></a>&#32;<a href="https://cdnjs.com/libraries/js-beautify" target="_blank"><img alt="CDNJS version" src="https://img.shields.io/cdnjs/v/js-beautify.svg"/></a>&#32;<a href="https://www.npmjs.com/package/js-beautify" target="_blank"><img alt="NPM @latest" src="https://img.shields.io/npm/v/js-beautify.svg"/></a>&#32;<a href="https://www.npmjs.com/package/js-beautify?activeTab=versions" target="_blank"><img alt="NPM @next" src="https://img.shields.io/npm/v/js-beautify/next.svg"/></a></p>
11
6
 
12
- [![NPM stats](https://nodei.co/npm/js-beautify.svg?downloadRank=true&downloads=true)](https://www.npmjs.org/package/js-beautify) [![Greenkeeper badge](https://badges.greenkeeper.io/beautify-web/js-beautify.svg)](https://greenkeeper.io/)
7
+ <p align="center"><a href="https://gitter.im/beautify-web/js-beautify?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge" target="_blank"><img alt="Join the chat at https://gitter.im/beautify-web/js-beautify" src="https://badges.gitter.im/Join%20Chat.svg"></a>&#32;<a href="https://twitter.com/intent/user?screen_name=js_beautifier" target="_blank"><img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/js_beautifier.svg?style=social&label=Follow"/></a></p>
13
8
 
9
+ <p align="center"><a href="https://www.npmjs.org/package/js-beautify" target="_blank"><img alt="NPM stats" src=https://nodei.co/npm/js-beautify.svg?downloadRank=true&downloads=true"/></a></p>
14
10
 
15
11
  This little beautifier will reformat and re-indent bookmarklets, ugly
16
12
  JavaScript, unpack scripts packed by Dean Edward’s popular packer,
@@ -19,6 +15,7 @@ as well as partly deobfuscate scripts processed by the npm package
19
15
 
20
16
  Open [beautifier.io](https://beautifier.io/) to try it out. Options are available via the UI.
21
17
 
18
+
22
19
  # Contributors Needed
23
20
  I'm putting this front and center above because existing owners have very limited time to work on this project currently.
24
21
  This is a popular project and widely used but it desperately needs contributors who have time to commit to fixing both
@@ -61,17 +58,17 @@ JS Beautifier is hosted on two CDN services: [cdnjs](https://cdnjs.com/libraries
61
58
 
62
59
  To pull the latest version from one of these services include one set of the script tags below in your document:
63
60
  ```html
64
- <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.0/beautify.js"></script>
65
- <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.0/beautify-css.js"></script>
66
- <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.0/beautify-html.js"></script>
61
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.3/beautify.js"></script>
62
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.3/beautify-css.js"></script>
63
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.3/beautify-html.js"></script>
67
64
 
68
- <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.0/beautify.min.js"></script>
69
- <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.0/beautify-css.min.js"></script>
70
- <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.0/beautify-html.min.js"></script>
65
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.3/beautify.min.js"></script>
66
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.3/beautify-css.min.js"></script>
67
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.3/beautify-html.min.js"></script>
71
68
 
72
- <script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.14.0/js/lib/beautify.js"></script>
73
- <script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.14.0/js/lib/beautify-css.js"></script>
74
- <script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.14.0/js/lib/beautify-html.js"></script>
69
+ <script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.14.3/js/lib/beautify.js"></script>
70
+ <script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.14.3/js/lib/beautify-css.js"></script>
71
+ <script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.14.3/js/lib/beautify-html.js"></script>
75
72
  ```
76
73
 
77
74
  Older versions are available by changing the version number.
@@ -404,4 +401,4 @@ Thanks also to Jason Diamond, Patrick Hof, Nochum Sossonko, Andreas Schneider, D
404
401
  Vasilevsky, Vital Batmanov, Ron Baldwin, Gabriel Harrison, Chris J. Shull,
405
402
  Mathias Bynens, Vittorio Gambaletta and others.
406
403
 
407
- (README.md: js-beautify@1.14.0)
404
+ (README.md: js-beautify@1.14.3)
@@ -94,8 +94,8 @@ module.exports.html = style_html;
94
94
 
95
95
 
96
96
 
97
- var Beautifier = __webpack_require__(2).Beautifier,
98
- Options = __webpack_require__(6).Options;
97
+ var Beautifier = (__webpack_require__(2).Beautifier),
98
+ Options = (__webpack_require__(6).Options);
99
99
 
100
100
  function js_beautify(js_source_text, options) {
101
101
  var beautifier = new Beautifier(js_source_text, options);
@@ -142,14 +142,14 @@ module.exports.defaultOptions = function() {
142
142
 
143
143
 
144
144
 
145
- var Output = __webpack_require__(3).Output;
146
- var Token = __webpack_require__(4).Token;
145
+ var Output = (__webpack_require__(3).Output);
146
+ var Token = (__webpack_require__(4).Token);
147
147
  var acorn = __webpack_require__(5);
148
- var Options = __webpack_require__(6).Options;
149
- var Tokenizer = __webpack_require__(8).Tokenizer;
150
- var line_starters = __webpack_require__(8).line_starters;
151
- var positionable_operators = __webpack_require__(8).positionable_operators;
152
- var TOKEN = __webpack_require__(8).TOKEN;
148
+ var Options = (__webpack_require__(6).Options);
149
+ var Tokenizer = (__webpack_require__(8).Tokenizer);
150
+ var line_starters = (__webpack_require__(8).line_starters);
151
+ var positionable_operators = (__webpack_require__(8).positionable_operators);
152
+ var TOKEN = (__webpack_require__(8).TOKEN);
153
153
 
154
154
 
155
155
  function in_array(what, arr) {
@@ -305,6 +305,7 @@ Beautifier.prototype.create_flags = function(flags_base, mode) {
305
305
  in_case_statement: false, // switch(..){ INSIDE HERE }
306
306
  in_case: false, // we're on the exact line with "case 0:"
307
307
  case_body: false, // the indented case-action block
308
+ case_block: false, // the indented case-action block is wrapped with {}
308
309
  indentation_level: next_indent_level,
309
310
  alignment: 0,
310
311
  line_indent_level: flags_base ? flags_base.line_indent_level : next_indent_level,
@@ -804,10 +805,10 @@ Beautifier.prototype.handle_start_block = function(current_token) {
804
805
  )) {
805
806
  // We don't support TypeScript,but we didn't break it for a very long time.
806
807
  // We'll try to keep not breaking it.
807
- if (!in_array(this._last_last_text, ['class', 'interface'])) {
808
- this.set_mode(MODE.ObjectLiteral);
809
- } else {
808
+ if (in_array(this._last_last_text, ['class', 'interface']) && !in_array(second_token.text, [':', ','])) {
810
809
  this.set_mode(MODE.BlockStatement);
810
+ } else {
811
+ this.set_mode(MODE.ObjectLiteral);
811
812
  }
812
813
  } else if (this._flags.last_token.type === TOKEN.OPERATOR && this._flags.last_token.text === '=>') {
813
814
  // arrow function: (param1, paramN) => { statements }
@@ -923,7 +924,7 @@ Beautifier.prototype.handle_word = function(current_token) {
923
924
  if (current_token.type === TOKEN.RESERVED) {
924
925
  if (in_array(current_token.text, ['set', 'get']) && this._flags.mode !== MODE.ObjectLiteral) {
925
926
  current_token.type = TOKEN.WORD;
926
- } else if (current_token.text === 'import' && this._tokens.peek().text === '(') {
927
+ } else if (current_token.text === 'import' && in_array(this._tokens.peek().text, ['(', '.'])) {
927
928
  current_token.type = TOKEN.WORD;
928
929
  } else if (in_array(current_token.text, ['as', 'from']) && !this._flags.import_block) {
929
930
  current_token.type = TOKEN.WORD;
@@ -983,7 +984,7 @@ Beautifier.prototype.handle_word = function(current_token) {
983
984
 
984
985
  if (this._flags.in_case_statement && reserved_array(current_token, ['case', 'default'])) {
985
986
  this.print_newline();
986
- if (this._flags.last_token.type !== TOKEN.END_BLOCK && (this._flags.case_body || this._options.jslint_happy)) {
987
+ if (!this._flags.case_block && (this._flags.case_body || this._options.jslint_happy)) {
987
988
  // switch cases following one another
988
989
  this.deindent();
989
990
  }
@@ -1297,7 +1298,9 @@ Beautifier.prototype.handle_operator = function(current_token) {
1297
1298
  if (this._tokens.peek().type !== TOKEN.START_BLOCK) {
1298
1299
  this.indent();
1299
1300
  this.print_newline();
1301
+ this._flags.case_block = false;
1300
1302
  } else {
1303
+ this._flags.case_block = true;
1301
1304
  this._output.space_before_token = true;
1302
1305
  }
1303
1306
  return;
@@ -1395,7 +1398,7 @@ Beautifier.prototype.handle_operator = function(current_token) {
1395
1398
 
1396
1399
  // http://www.ecma-international.org/ecma-262/5.1/#sec-7.9.1
1397
1400
  // if there is a newline between -- or ++ and anything else we should preserve it.
1398
- if (current_token.newlines && (current_token.text === '--' || current_token.text === '++')) {
1401
+ if (current_token.newlines && (current_token.text === '--' || current_token.text === '++' || current_token.text === '~')) {
1399
1402
  this.print_newline(false, true);
1400
1403
  }
1401
1404
 
@@ -2155,7 +2158,7 @@ exports.allLineBreaks = new RegExp(exports.lineBreak.source, 'g');
2155
2158
 
2156
2159
 
2157
2160
 
2158
- var BaseOptions = __webpack_require__(7).Options;
2161
+ var BaseOptions = (__webpack_require__(7).Options);
2159
2162
 
2160
2163
  var validPositionValues = ['before-newline', 'after-newline', 'preserve-newline'];
2161
2164
 
@@ -2453,13 +2456,13 @@ module.exports.mergeOpts = _mergeOpts;
2453
2456
 
2454
2457
 
2455
2458
 
2456
- var InputScanner = __webpack_require__(9).InputScanner;
2457
- var BaseTokenizer = __webpack_require__(10).Tokenizer;
2458
- var BASETOKEN = __webpack_require__(10).TOKEN;
2459
- var Directives = __webpack_require__(14).Directives;
2459
+ var InputScanner = (__webpack_require__(9).InputScanner);
2460
+ var BaseTokenizer = (__webpack_require__(10).Tokenizer);
2461
+ var BASETOKEN = (__webpack_require__(10).TOKEN);
2462
+ var Directives = (__webpack_require__(14).Directives);
2460
2463
  var acorn = __webpack_require__(5);
2461
- var Pattern = __webpack_require__(13).Pattern;
2462
- var TemplatablePattern = __webpack_require__(15).TemplatablePattern;
2464
+ var Pattern = (__webpack_require__(13).Pattern);
2465
+ var TemplatablePattern = (__webpack_require__(15).TemplatablePattern);
2463
2466
 
2464
2467
 
2465
2468
  function in_array(what, arr) {
@@ -2499,7 +2502,7 @@ var digit = /[0-9]/;
2499
2502
  var dot_pattern = /[^\d\.]/;
2500
2503
 
2501
2504
  var positionable_operators = (
2502
- ">>> === !== " +
2505
+ ">>> === !== &&= ??= ||= " +
2503
2506
  "<< && >= ** != == <= >> || ?? |> " +
2504
2507
  "< / - + > : & % ? ^ | *").split(' ');
2505
2508
 
@@ -2507,7 +2510,7 @@ var positionable_operators = (
2507
2510
  // Also, you must update possitionable operators separately from punct
2508
2511
  var punct =
2509
2512
  ">>>= " +
2510
- "... >>= <<= === >>> !== **= " +
2513
+ "... >>= <<= === >>> !== **= &&= ??= ||= " +
2511
2514
  "=> ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> " +
2512
2515
  "= ! ? > < : / ^ - + * & % ~ |";
2513
2516
 
@@ -2551,7 +2554,7 @@ var Tokenizer = function(input_string, options) {
2551
2554
  html_comment_end: pattern_reader.matching(/-->/),
2552
2555
  include: pattern_reader.starting_with(/#include/).until_after(acorn.lineBreak),
2553
2556
  shebang: pattern_reader.starting_with(/#!/).until_after(acorn.lineBreak),
2554
- xml: pattern_reader.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[\s\S]+?}|!\[CDATA\[[\s\S]*?\]\]|)(\s+{[\s\S]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{[\s\S]+?}))*\s*(\/?)\s*>/),
2557
+ xml: pattern_reader.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),
2555
2558
  single_quote: templatable.until(/['\\\n\r\u2028\u2029]/),
2556
2559
  double_quote: templatable.until(/["\\\n\r\u2028\u2029]/),
2557
2560
  template_text: templatable.until(/[`\\$]/),
@@ -3223,10 +3226,10 @@ module.exports.InputScanner = InputScanner;
3223
3226
 
3224
3227
 
3225
3228
 
3226
- var InputScanner = __webpack_require__(9).InputScanner;
3227
- var Token = __webpack_require__(4).Token;
3228
- var TokenStream = __webpack_require__(11).TokenStream;
3229
- var WhitespacePattern = __webpack_require__(12).WhitespacePattern;
3229
+ var InputScanner = (__webpack_require__(9).InputScanner);
3230
+ var Token = (__webpack_require__(4).Token);
3231
+ var TokenStream = (__webpack_require__(11).TokenStream);
3232
+ var WhitespacePattern = (__webpack_require__(12).WhitespacePattern);
3230
3233
 
3231
3234
  var TOKEN = {
3232
3235
  START: 'TK_START',
@@ -3453,7 +3456,7 @@ module.exports.TokenStream = TokenStream;
3453
3456
 
3454
3457
 
3455
3458
 
3456
- var Pattern = __webpack_require__(13).Pattern;
3459
+ var Pattern = (__webpack_require__(13).Pattern);
3457
3460
 
3458
3461
  function WhitespacePattern(input_scanner, parent) {
3459
3462
  Pattern.call(this, input_scanner, parent);
@@ -3732,7 +3735,7 @@ module.exports.Directives = Directives;
3732
3735
 
3733
3736
 
3734
3737
 
3735
- var Pattern = __webpack_require__(13).Pattern;
3738
+ var Pattern = (__webpack_require__(13).Pattern);
3736
3739
 
3737
3740
 
3738
3741
  var template_names = {
@@ -3949,8 +3952,8 @@ module.exports.TemplatablePattern = TemplatablePattern;
3949
3952
 
3950
3953
 
3951
3954
 
3952
- var Beautifier = __webpack_require__(17).Beautifier,
3953
- Options = __webpack_require__(18).Options;
3955
+ var Beautifier = (__webpack_require__(17).Beautifier),
3956
+ Options = (__webpack_require__(18).Options);
3954
3957
 
3955
3958
  function css_beautify(source_text, options) {
3956
3959
  var beautifier = new Beautifier(source_text, options);
@@ -3997,10 +4000,10 @@ module.exports.defaultOptions = function() {
3997
4000
 
3998
4001
 
3999
4002
 
4000
- var Options = __webpack_require__(18).Options;
4001
- var Output = __webpack_require__(3).Output;
4002
- var InputScanner = __webpack_require__(9).InputScanner;
4003
- var Directives = __webpack_require__(14).Directives;
4003
+ var Options = (__webpack_require__(18).Options);
4004
+ var Output = (__webpack_require__(3).Output);
4005
+ var InputScanner = (__webpack_require__(9).InputScanner);
4006
+ var Directives = (__webpack_require__(14).Directives);
4004
4007
 
4005
4008
  var directives_core = new Directives(/\/\*/, /\*\//);
4006
4009
 
@@ -4036,6 +4039,9 @@ function Beautifier(source_text, options) {
4036
4039
  "@supports": true,
4037
4040
  "@document": true
4038
4041
  };
4042
+ this.NON_SEMICOLON_NEWLINE_PROPERTY = [
4043
+ "grid-template"
4044
+ ];
4039
4045
 
4040
4046
  }
4041
4047
 
@@ -4160,7 +4166,9 @@ Beautifier.prototype.beautify = function() {
4160
4166
  var enteringConditionalGroup = false;
4161
4167
  var insideAtExtend = false;
4162
4168
  var insideAtImport = false;
4169
+ var insideScssMap = false;
4163
4170
  var topCharacter = this._ch;
4171
+ var insideNonSemiColonValues = false;
4164
4172
  var whitespace;
4165
4173
  var isAfterSpace;
4166
4174
  var previous_ch;
@@ -4212,7 +4220,7 @@ Beautifier.prototype.beautify = function() {
4212
4220
 
4213
4221
  // Ensures any new lines following the comment are preserved
4214
4222
  this.eatWhitespace(true);
4215
- } else if (this._ch === '@') {
4223
+ } else if (this._ch === '@' || this._ch === '$') {
4216
4224
  this.preserveSingleSpace(isAfterSpace);
4217
4225
 
4218
4226
  // deal with less propery mixins @{...}
@@ -4283,7 +4291,12 @@ Beautifier.prototype.beautify = function() {
4283
4291
  this.indent();
4284
4292
  this._output.set_indent(this._indentLevel);
4285
4293
  } else {
4286
- this.indent();
4294
+ // inside mixin and first param is object
4295
+ if (previous_ch === '(') {
4296
+ this._output.space_before_token = false;
4297
+ } else if (previous_ch !== ',') {
4298
+ this.indent();
4299
+ }
4287
4300
  this.print_string(this._ch);
4288
4301
  }
4289
4302
 
@@ -4315,7 +4328,21 @@ Beautifier.prototype.beautify = function() {
4315
4328
  this._output.add_new_line(true);
4316
4329
  }
4317
4330
  }
4331
+ if (this._input.peek() === ')') {
4332
+ this._output.trim(true);
4333
+ if (this._options.brace_style === "expand") {
4334
+ this._output.add_new_line(true);
4335
+ }
4336
+ }
4318
4337
  } else if (this._ch === ":") {
4338
+
4339
+ for (var i = 0; i < this.NON_SEMICOLON_NEWLINE_PROPERTY.length; i++) {
4340
+ if (this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[i])) {
4341
+ insideNonSemiColonValues = true;
4342
+ break;
4343
+ }
4344
+ }
4345
+
4319
4346
  if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && parenLevel === 0) {
4320
4347
  // 'property: value' delimiter
4321
4348
  // which could be in a conditional group query
@@ -4348,6 +4375,7 @@ Beautifier.prototype.beautify = function() {
4348
4375
  this.print_string(this._ch + this.eatString(this._ch));
4349
4376
  this.eatWhitespace(true);
4350
4377
  } else if (this._ch === ';') {
4378
+ insideNonSemiColonValues = false;
4351
4379
  if (parenLevel === 0) {
4352
4380
  if (insidePropertyValue) {
4353
4381
  this.outdent();
@@ -4389,20 +4417,32 @@ Beautifier.prototype.beautify = function() {
4389
4417
  } else {
4390
4418
  this.preserveSingleSpace(isAfterSpace);
4391
4419
  this.print_string(this._ch);
4392
- this.eatWhitespace();
4393
- parenLevel++;
4394
- this.indent();
4420
+
4421
+ // handle scss/sass map
4422
+ if (insidePropertyValue && previous_ch === "$" && this._options.selector_separator_newline) {
4423
+ this._output.add_new_line();
4424
+ insideScssMap = true;
4425
+ } else {
4426
+ this.eatWhitespace();
4427
+ parenLevel++;
4428
+ this.indent();
4429
+ }
4395
4430
  }
4396
4431
  } else if (this._ch === ')') {
4397
4432
  if (parenLevel) {
4398
4433
  parenLevel--;
4399
4434
  this.outdent();
4400
4435
  }
4436
+ if (insideScssMap && this._input.peek() === ";" && this._options.selector_separator_newline) {
4437
+ insideScssMap = false;
4438
+ this.outdent();
4439
+ this._output.add_new_line();
4440
+ }
4401
4441
  this.print_string(this._ch);
4402
4442
  } else if (this._ch === ',') {
4403
4443
  this.print_string(this._ch);
4404
4444
  this.eatWhitespace(true);
4405
- if (this._options.selector_separator_newline && !insidePropertyValue && parenLevel === 0 && !insideAtImport && !insideAtExtend) {
4445
+ if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideAtImport && !insideAtExtend) {
4406
4446
  this._output.add_new_line();
4407
4447
  } else {
4408
4448
  this._output.space_before_token = true;
@@ -4436,8 +4476,13 @@ Beautifier.prototype.beautify = function() {
4436
4476
  this.print_string(' ');
4437
4477
  this.print_string(this._ch);
4438
4478
  } else {
4439
- this.preserveSingleSpace(isAfterSpace);
4479
+ var preserveAfterSpace = previous_ch === '"' || previous_ch === '\'';
4480
+ this.preserveSingleSpace(preserveAfterSpace || isAfterSpace);
4440
4481
  this.print_string(this._ch);
4482
+
4483
+ if (!this._output.just_added_newline() && this._input.peek() === '\n' && insideNonSemiColonValues) {
4484
+ this._output.add_new_line();
4485
+ }
4441
4486
  }
4442
4487
  }
4443
4488
 
@@ -4483,7 +4528,7 @@ module.exports.Beautifier = Beautifier;
4483
4528
 
4484
4529
 
4485
4530
 
4486
- var BaseOptions = __webpack_require__(7).Options;
4531
+ var BaseOptions = (__webpack_require__(7).Options);
4487
4532
 
4488
4533
  function Options(options) {
4489
4534
  BaseOptions.call(this, options, 'css');
@@ -4545,8 +4590,8 @@ module.exports.Options = Options;
4545
4590
 
4546
4591
 
4547
4592
 
4548
- var Beautifier = __webpack_require__(20).Beautifier,
4549
- Options = __webpack_require__(21).Options;
4593
+ var Beautifier = (__webpack_require__(20).Beautifier),
4594
+ Options = (__webpack_require__(21).Options);
4550
4595
 
4551
4596
  function style_html(html_source, options, js_beautify, css_beautify) {
4552
4597
  var beautifier = new Beautifier(html_source, options, js_beautify, css_beautify);
@@ -4593,10 +4638,10 @@ module.exports.defaultOptions = function() {
4593
4638
 
4594
4639
 
4595
4640
 
4596
- var Options = __webpack_require__(21).Options;
4597
- var Output = __webpack_require__(3).Output;
4598
- var Tokenizer = __webpack_require__(22).Tokenizer;
4599
- var TOKEN = __webpack_require__(22).TOKEN;
4641
+ var Options = (__webpack_require__(21).Options);
4642
+ var Output = (__webpack_require__(3).Output);
4643
+ var Tokenizer = (__webpack_require__(22).Tokenizer);
4644
+ var TOKEN = (__webpack_require__(22).TOKEN);
4600
4645
 
4601
4646
  var lineBreak = /\r\n|[\r\n]/;
4602
4647
  var allLineBreaks = /\r\n|[\r\n]/g;
@@ -5177,7 +5222,7 @@ var TagOpenParserToken = function(parent, raw_token) {
5177
5222
 
5178
5223
  // handle "{{#> myPartial}}
5179
5224
  if (raw_token.text === '{{#>' && this.tag_check === '>' && raw_token.next !== null) {
5180
- this.tag_check = raw_token.next.text;
5225
+ this.tag_check = raw_token.next.text.split(' ')[0];
5181
5226
  }
5182
5227
  }
5183
5228
  this.tag_check = this.tag_check.toLowerCase();
@@ -5464,7 +5509,7 @@ module.exports.Beautifier = Beautifier;
5464
5509
 
5465
5510
 
5466
5511
 
5467
- var BaseOptions = __webpack_require__(7).Options;
5512
+ var BaseOptions = (__webpack_require__(7).Options);
5468
5513
 
5469
5514
  function Options(options) {
5470
5515
  BaseOptions.call(this, options, 'html');
@@ -5561,11 +5606,11 @@ module.exports.Options = Options;
5561
5606
 
5562
5607
 
5563
5608
 
5564
- var BaseTokenizer = __webpack_require__(10).Tokenizer;
5565
- var BASETOKEN = __webpack_require__(10).TOKEN;
5566
- var Directives = __webpack_require__(14).Directives;
5567
- var TemplatablePattern = __webpack_require__(15).TemplatablePattern;
5568
- var Pattern = __webpack_require__(13).Pattern;
5609
+ var BaseTokenizer = (__webpack_require__(10).Tokenizer);
5610
+ var BASETOKEN = (__webpack_require__(10).TOKEN);
5611
+ var Directives = (__webpack_require__(14).Directives);
5612
+ var TemplatablePattern = (__webpack_require__(15).TemplatablePattern);
5613
+ var Pattern = (__webpack_require__(13).Pattern);
5569
5614
 
5570
5615
  var TOKEN = {
5571
5616
  TAG_OPEN: 'TK_TAG_OPEN',