efront 4.10.0 → 4.10.2

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.
@@ -37,7 +37,7 @@ var hasRupt = function (a) {
37
37
  a = skipAssignment(a);
38
38
  }
39
39
  else if (a.type === SCOPED) {
40
- if (a.entry === "{") {
40
+ if (a.brace) {
41
41
  if (!a.isObject) {
42
42
  if (hasRupt(a)) return true;
43
43
  }
@@ -37,6 +37,11 @@ var createRefId = function (o) {
37
37
  })
38
38
  }
39
39
  else {
40
+ if (o.needle) {
41
+ ids.push(o.text);
42
+ o = o.next;
43
+ continue;
44
+ }
40
45
  break;
41
46
  }
42
47
  var n = o.next;
@@ -199,7 +204,7 @@ function enumref(refitem, scoped) {
199
204
  if (q !== scoped.body) {
200
205
  if (q.entry === '(' && q.queue === scoped.body) {
201
206
  var qp = q.prev;
202
- if (qp.type === EXPRESS) qp = qp.prev;
207
+ if (qp?.type === EXPRESS) qp = qp.prev;
203
208
  if (qp && qp.type === STRAP && qp.text === "await") qp = qp.prev;
204
209
  if (qp && qp.type === STRAP && qp.text === 'for') {
205
210
  var f = q.first;
@@ -6,6 +6,8 @@ var cloneNode = function (o) {
6
6
  c.entry = o.entry;
7
7
  c.leave = o.leave;
8
8
  c.type = o.type;
9
+ c.istype = o.istype;
10
+ c.brace = o.brace;
9
11
  c.isExpress = o.isExpress;
10
12
  relink(c);
11
13
  }
@@ -16,7 +16,8 @@ const [
16
16
  // --------------//1//2/////////////////////////22/////////////2//2//3//4/////4////////3/////3//////3//3//////3///////211/////////////2//////2//////1///
17
17
  var number_reg = /^(?:(?:0x[0-9a-f]+|0b[01]+|0o?[0-7]+)(?:_[0-9a-f]+)*|(?:(?:(?:\d+_)*\d+|\d*)\.\d+(?:_\d+)*|(?:\d+_)*\d+\.?))(?:e[\+\-]?\d+(?:_\d+)*|[hijklmnu]+)?/i;
18
18
  var equal_reg = /^(?:[\+\-\*\/~\^&\|%]|\*\*|>>>?|<<)?\=$|^(?:\+\+|\-\-)$/;
19
- var needhead_reg = /^\?\.|^\.(?:[^\.]|$)|^\[/;
19
+ var needhead_reg = /^\?|^\.(?:[^\.]|$)|^\[/;
20
+ var needfoot_reg = /(\:\:|([^\.]|^)\.)$/;
20
21
  var skipAssignment = function (o, cx) {
21
22
  if (!o) return;
22
23
  var next = arguments.length === 1 ? function () {
@@ -96,7 +97,7 @@ var skipAssignment = function (o, cx) {
96
97
  }
97
98
  break;
98
99
  case SCOPED:
99
- if (needpunc && o.entry === "{") break loop;
100
+ if (needpunc && o.brace) break loop;
100
101
  next();
101
102
  needpunc = true;
102
103
  break;
@@ -104,18 +105,18 @@ var skipAssignment = function (o, cx) {
104
105
  if (needpunc) break loop;
105
106
  next();
106
107
  break;
107
- case EXPRESS:
108
- if (needhead_reg.test(o.text)) {
108
+ case ELEMENT:
109
+ if (o.istype) {
109
110
  next();
110
111
  break;
111
112
  }
112
- if (/\.$/.test(o.text)) {
113
- needpunc = false;
113
+ case EXPRESS:
114
+ if (needhead_reg.test(o.text)) {
114
115
  next();
115
116
  break;
116
117
  }
117
- if (/^\[/.test(o.text)) {
118
- needpunc = true;
118
+ var prev = o.prev;
119
+ if (prev?.type === EXPRESS && needfoot_reg.test(prev.text)) {
119
120
  next();
120
121
  break;
121
122
  }
@@ -299,7 +300,7 @@ function snapSentenceHead(o) {
299
300
  while (o && o.prev) {
300
301
  var p = o.prev;
301
302
  if (o.entry === '(') {
302
- if (!(p.type & (STAMP | STRAP))) {
303
+ if (p.type & ~(STAMP | STRAP)) {
303
304
  o = p;
304
305
  p = o.prev;
305
306
  if (!p) break;
@@ -314,9 +315,9 @@ function snapSentenceHead(o) {
314
315
  continue
315
316
  };
316
317
  }
317
- var maybeprop = o.type === SCOPED && o.entry !== "{" || o.type === EXPRESS && /^[\.\[]/.test(o.text);
318
+ var maybeprop = o.type === SCOPED && !o.brace || o.type === EXPRESS && /^[\.\[]/.test(o.text);
318
319
  if (p.type === EXPRESS) {
319
- if (maybeprop || /\.$/.test(p.text)) {
320
+ if (maybeprop || p.needle || needfoot_reg.test(p.text)) {
320
321
  o = p;
321
322
  continue;
322
323
  }
@@ -329,7 +330,7 @@ function snapSentenceHead(o) {
329
330
  if (p.type & (VALUE | QUOTED)) {
330
331
  if (maybeprop) {
331
332
  o = p;
332
- if (p.entry === '`' && p.prev && !(p.prev.type & (STAMP | STRAP))) o = p.prev;
333
+ if (p.entry === '`' && p.prev && p.prev.type & ~(STAMP | STRAP)) o = p.prev;
333
334
  continue;
334
335
  }
335
336
  break;
@@ -418,18 +419,22 @@ var getStrapHead = function (o) {
418
419
  return null;
419
420
  }
420
421
  var snapExpressHead = function (o) {
421
- if (!o || o.type & ~(EXPRESS | SCOPED | QUOTED)) return o;
422
+ if (!o || o.type & ~(EXPRESS | SCOPED | QUOTED) && !o.needle) return o;
422
423
  var a = o;
423
424
  while (o && o.prev) {
424
425
  var p = o.prev;
426
+ if (p.type === STAMP && p.needle || o.type === STAMP && o.needle) {
427
+ o = p;
428
+ continue;
429
+ }
425
430
  if (p && p.type === STRAP && p.text === 'new') return p;
426
431
  if (o.type === SCOPED && o.entry === '(') {
427
432
  var h = getStrapHead(o);
428
433
  if (h) return h;
429
434
  }
430
435
  if (o.type === SCOPED && o.entry !== '{'
431
- || o.type === EXPRESS && needhead_reg.test(o.text)
432
- || /\.$/.test(p.text) && !p.isdigit
436
+ || needhead_reg.test(o.text) && !o.isdigit
437
+ || needfoot_reg.test(p.text) && !p.isdigit
433
438
  || o.type === QUOTED && (o.length || /^\`/.test(o.text))
434
439
  ) {
435
440
  if (p.type === SCOPED && p.entry === '(') {
@@ -477,6 +482,10 @@ var snapExpressHead = function (o) {
477
482
 
478
483
  var snapExpressFoot = function (o) {
479
484
  while (o && o.next) {
485
+ if (o.needle) {
486
+ o = o.next;
487
+ continue;
488
+ }
480
489
  var n = null;
481
490
  var isExpress = o.isExpress;
482
491
  if (o.type & STRAP) {
@@ -499,8 +508,8 @@ var snapExpressFoot = function (o) {
499
508
  }
500
509
  if (!n) break;
501
510
  if (n.type === SCOPED && (o.entry !== '{' || isExpress)
502
- || /\.$/.test(o.text) && !o.isdigit
503
- || n.type === EXPRESS && needhead_reg.test(n.text)
511
+ || needfoot_reg.test(o.text) && !o.isdigit
512
+ || n.needle || n.type === EXPRESS && needhead_reg.test(n.text)
504
513
  || n.type === QUOTED && (n.length || /^\`/.test(n.text))
505
514
  ) {
506
515
  o = n;
@@ -516,6 +525,23 @@ var createScoped = function (parsed, wash) {
516
525
  funcbody.isroot = true;
517
526
  scoped.body = parsed;
518
527
  scoped.isfunc = true;
528
+ var dec = function (map, o) {
529
+ var kind = o.text;
530
+ o = o.next;
531
+ while (o && o.type === STRAP) o = o.next;
532
+ var [declared, used0, o0, skiped] = getDeclared(o, kind);
533
+ if (o0 !== o) {
534
+ mergeTo(used, used0);
535
+ while (skiped.length) {
536
+ var o1 = run(skiped[0], 0);
537
+ let sindex = skiped.indexOf(o1);
538
+ if (sindex < 0) break;
539
+ skiped.splice(0, sindex + 1);
540
+ }
541
+ mapDeclared(map, declared);
542
+ }
543
+ return o0;
544
+ };
519
545
  var run = function (o, id, body) {
520
546
  loop: while (o) {
521
547
  var isCatch = false;
@@ -560,9 +586,21 @@ var createScoped = function (parsed, wash) {
560
586
  if (o.isdigit || /^(null|false|true)$/.test(o.text)) break;
561
587
  case EXPRESS:
562
588
  if (needhead_reg.test(o.text)) break;
563
- // if (o.text === 'readFileAsync') console.log(o)
564
- if (o.prev && o.prev.type === EXPRESS) {
565
- if (/\.$/.test(o.prev.text)) break;
589
+
590
+ var prev = o.prev;
591
+ if (prev) {
592
+ if (prev.needle || prev.type === EXPRESS && needfoot_reg.test(prev.text)) break;
593
+ if (prev.type === STRAP && prev.istype) {
594
+ var o0 = dec(lets, prev);
595
+ if (o0 && o0.type === SCOPED && o0.entry === "(") {
596
+ isFunction = true;
597
+ isScope = true;
598
+ break;
599
+ }
600
+ if (o === o0) o = o.next;
601
+ else o = o0;
602
+ continue;
603
+ }
566
604
  }
567
605
  if (o.next && o.next.type === STAMP && o.next.text === "=>") {
568
606
  isScope = true;
@@ -572,7 +610,7 @@ var createScoped = function (parsed, wash) {
572
610
  else {
573
611
  var u = o.text;
574
612
  if (/^\.\.\./.test(u)) u = u.slice(3);
575
- var u = u.replace(/^([^\.\[\?\s]*)[\s\S]*$/, '$1');
613
+ var u = u.replace(/^([^\.\[\?\s\:]*)[\s\S]*$/, '$1');
576
614
  if (!u) break;
577
615
  var prev = o.prev;
578
616
  if (prev && prev.type === STAMP && /^(?:\+\+|\-\-)$/.test(prev.text)) {
@@ -617,27 +655,27 @@ var createScoped = function (parsed, wash) {
617
655
  case "let":
618
656
  case "const":
619
657
  m = lets;
620
- if (!o.next || o.next.type !== EXPRESS && (o.next.type !== SCOPED || o.next.entry === "(")) {
658
+ if (!o.next || o.next.type & ~(EXPRESS | STRAP) && (o.next.type !== SCOPED || o.next.entry === "(")) {
621
659
  o.type = EXPRESS;
622
660
  continue;
623
661
  }
624
662
  case "import":
663
+ case "use":
625
664
  if (!o.next || o.next.type === QUOTED) break;
665
+ if (o.next.needle) {
666
+ o.type = EXPRESS;
667
+ continue;
668
+ }
626
669
  case "var":
627
670
  m = m || vars;
628
- var [declared, used0, o0, skiped] = getDeclared(o.next, s);
629
- mergeTo(used, used0);
630
- while (skiped.length) {
631
- var o1 = run(skiped[0], 0);
632
- let sindex = skiped.indexOf(o1);
633
- if (sindex < 0) break;
634
- skiped.splice(0, sindex + 1);
635
- }
636
- o = o0;
637
- mapDeclared(m, declared);
671
+ var o0 = dec(m, o);
672
+ if (o0 === o) o = o.next;
673
+ else o = o0;
638
674
  continue loop;
639
675
  case "static":
640
676
  case "function":
677
+ case "fn":
678
+ case "func":
641
679
  isFunction = true;
642
680
  var op = o.prev;
643
681
  if (op?.type === STRAP && op.text === 'async') {
@@ -653,7 +691,8 @@ var createScoped = function (parsed, wash) {
653
691
  case "catch":
654
692
  if (s === 'catch') isCatch = true;
655
693
  case "class":
656
- if (s === 'class') isClass = true;
694
+ case "interface":
695
+ if (/^interface|class$/.test(s)) isClass = true;
657
696
  if (!o.isExpress) {
658
697
  o = o.next;
659
698
 
@@ -662,6 +701,7 @@ var createScoped = function (parsed, wash) {
662
701
  o.kind = isFunction ? 'function' : 'class';
663
702
  saveTo(used, o.text, o);
664
703
  o = o.next;
704
+ if (o?.type === ELEMENT) o = o.next;
665
705
  }
666
706
  }
667
707
  isScope = true;
@@ -680,14 +720,15 @@ var createScoped = function (parsed, wash) {
680
720
  break;
681
721
  case SCOPED:
682
722
  if (o.entry === "(") {
723
+ var prev = o.prev;
683
724
  if (o.next && o.next.type === STAMP && o.next.text === "=>") {
684
725
  isArrow = true;
685
726
  isScope = true;
686
- if (o.prev?.type === STRAP && o.prev.text === 'async') {
727
+ if (prev?.type === STRAP && prev.text === 'async') {
687
728
  isAsync = true;
688
729
  }
689
730
  }
690
- else if (o.prev && (o.prev.type === PROPERTY || o.prev.isprop)) {
731
+ else if (prev?.isprop) {
691
732
  isFunction = true;
692
733
  isScope = true;
693
734
  var pp = o.prev.prev;
@@ -702,7 +743,7 @@ var createScoped = function (parsed, wash) {
702
743
  run(o.first);
703
744
  }
704
745
  }
705
- else if (o.entry === "{" && !o.isObject) {
746
+ else if (o.brace && !o.isObject) {
706
747
  isScope = true;
707
748
  }
708
749
  else {
@@ -799,7 +840,7 @@ var createScoped = function (parsed, wash) {
799
840
  o = o.next.next;
800
841
  }
801
842
  if (!o);
802
- else if (o.type === SCOPED && o.entry === "{") {
843
+ else if (o.type === SCOPED && o.brace) {
803
844
  scoped.body = o;
804
845
  o.scoped = scoped;
805
846
  o.isExpress = isExpress;
@@ -839,10 +880,10 @@ var createScoped = function (parsed, wash) {
839
880
  var e = o;
840
881
  if (o.type === STAMP && /^(\+\+|\-\-)$/.test(o.text) && o.prev && o.prev.type === EXPRESS
841
882
  || (VALUE | QUOTED | SCOPED) & o.type
842
- || EXPRESS === o.type && !/\.$/.test(o.text)) {
883
+ || EXPRESS === o.type && !needfoot_reg.test(o.text)) {
843
884
  if ((VALUE | QUOTED | PROPERTY | LABEL) & next.type) break;
844
885
  if (EXPRESS === next.type && !/^[\.\[]/.test(next.text)) break;
845
- if (next.type === SCOPED && next.entry === "{") break;
886
+ if (next.type === SCOPED && next.brace) break;
846
887
  if (next.type === STRAP && !next.isExpress) break;
847
888
  }
848
889
  o = next;
@@ -942,6 +983,11 @@ var getDeclared = function (o, kind, queue) {
942
983
  index--;
943
984
  break;
944
985
  }
986
+ var next = o.next;
987
+ if (next?.needle) {
988
+ o = next.next;
989
+ continue;
990
+ }
945
991
  if (o.isprop) {
946
992
  prop = createString([o]).trim();
947
993
  if (/^(['"`])[\s\S]*\1$/.test(prop)) {
@@ -970,13 +1016,19 @@ var getDeclared = function (o, kind, queue) {
970
1016
  break;
971
1017
  }
972
1018
  case STAMP:
973
- if (o.text === "*" && o.next) {
974
- if (o.next.type === STRAP && o.next.text === 'as') {
975
- o = o.next.next;
1019
+ var next = o.next;
1020
+ if (o.text === "*" && next) {
1021
+ if (next.type === STRAP && next.text === 'as') {
1022
+ o = next.next;
976
1023
  prop = "*";
977
1024
  continue;
978
1025
  }
979
1026
  }
1027
+ if (o.text === '...') {
1028
+ o = o.next;
1029
+ continue;
1030
+ }
1031
+ break;
980
1032
  case PROPERTY:
981
1033
  if (o.next) {
982
1034
  if (o.next.type === STAMP && o.next.text === ":" || o.next.type === STRAP && o.next.text === "as") {
@@ -993,6 +1045,12 @@ var getDeclared = function (o, kind, queue) {
993
1045
  var k = o.text;
994
1046
  if (isrest) declared.push(k = k.slice(3))
995
1047
  else if (o.text) declared.push(k);
1048
+ if (!isrest) {
1049
+ var prev = o.prev;
1050
+ if (prev?.type === STAMP && prev.text === '...') {
1051
+ isrest = true;
1052
+ }
1053
+ }
996
1054
  if (!isrest && !prop) {
997
1055
  if (queue && queue.entry === '{') {
998
1056
  if (o.type & (EXPRESS | STRAP)) {
@@ -1042,6 +1100,14 @@ var getDeclared = function (o, kind, queue) {
1042
1100
  break;
1043
1101
  }
1044
1102
  break;
1103
+ case EXPRESS:
1104
+ if (o.text === '?') o = o.next;
1105
+ break;
1106
+ }
1107
+ if (o?.type === STAMP) {
1108
+ while (o?.istype) {
1109
+ o = o.next;
1110
+ }
1045
1111
  }
1046
1112
  if (!o) break;
1047
1113
  if (o.type !== STAMP) break;
@@ -1091,7 +1157,7 @@ var hasBreakBetween = function (prev, next) {
1091
1157
  if (!prev || !next) return true;
1092
1158
  if (prev.type === STAMP && /^[,;]/.test(prev.text)) return true;
1093
1159
  if (next.type === STAMP && /^[,;]/.test(next.text)) return true;
1094
- if (prev.type === EXPRESS && /\.$/.test(prev.text)) return true;
1160
+ if (prev.type === EXPRESS && needfoot_reg.test(prev.text)) return true;
1095
1161
  if (next.type === EXPRESS && /^[\.\[]/.test(next.text)) return true;
1096
1162
  };
1097
1163
  var getSemicolonBetween = function (prev, next) {
@@ -1104,7 +1170,7 @@ var getSemicolonBetween = function (prev, next) {
1104
1170
  ) {
1105
1171
  if ((EXPRESS | VALUE | QUOTED | LABEL) & next.type) return ";";
1106
1172
  if (next.type === STRAP) {
1107
- if (!/^(in|of|extends|instanceof|as)$/.test(next.text)) return ";";
1173
+ if (!/^(in|of|extends|implements|instanceof|as|is|from)$/.test(next.text)) return ";";
1108
1174
  return " ";
1109
1175
  }
1110
1176
  if (next.type === SCOPED && next.entry === '{') {
@@ -1119,7 +1185,7 @@ var getSemicolonBetween = function (prev, next) {
1119
1185
  }
1120
1186
  var needBreakBetween = function (prev, next) {
1121
1187
  if (hasBreakBetween(prev, next)) return;
1122
- return getSemicolonBetween(prev, next);
1188
+ return getSemicolonBetween(prev, next) === ';' ? ';' : '';
1123
1189
  };
1124
1190
  var relink = function (list) {
1125
1191
  var pi = 0, p = null;
@@ -1164,7 +1230,6 @@ var setqueue = function (list, queue = list) {
1164
1230
  var v = { value: queue, configurable: true, enumerable: false };
1165
1231
  for (var o of list) delete o.queue, Object.defineProperty(o, 'queue', v);
1166
1232
  };
1167
-
1168
1233
  var createString = function (parsed) {
1169
1234
  var autospace = parsed.autospace !== false;
1170
1235
  var keepspace = parsed.keepspace !== false;
@@ -1185,12 +1250,12 @@ var createString = function (parsed) {
1185
1250
  var intag = false;
1186
1251
  var run = (o, i, a) => {
1187
1252
  var prev = o.prev;
1188
- a: if (!((SPACE | COMMENT | STAMP | PIECE | SCOPED) & o.type) && prev && lasttype !== SPACE && patchspace) {
1189
- if ((QUOTED | SCOPED | STRAP | LABEL | COMMENT | ELEMENT) & lasttype
1190
- || prev.type === STAMP && !prev.unary
1253
+ a: if (prev && lasttype !== SPACE && patchspace && ~(SPACE | COMMENT | STAMP | PIECE | SCOPED) & o.type) {
1254
+ if ((QUOTED | SCOPED | STRAP | LABEL | COMMENT | ELEMENT | PROPERTY) & lasttype
1255
+ || prev.type === STAMP && !prev.unary && !prev.needle && !prev.isprop
1191
1256
  ) {
1192
1257
  if (intag || prev.type === ELEMENT && o.type === ELEMENT) break a;
1193
- if (o.type !== EXPRESS || !needhead_reg.test(o.text) && !prev.tag && !o.tag) {
1258
+ if ((o.type & ~(EXPRESS | PROPERTY) || !needhead_reg.test(o.text)) && (!prev.tag && !o.tag || prev.type === STAMP || o.type === STAMP)) {
1194
1259
  result.push(" ");
1195
1260
  lasttype = SPACE
1196
1261
  }
@@ -1245,6 +1310,7 @@ var createString = function (parsed) {
1245
1310
  result.push(o.entry);
1246
1311
  result.push(o.tag);
1247
1312
  if (o.attributes) {
1313
+ var _intag = intag;
1248
1314
  intag = 0;
1249
1315
  var attributes = o.attributes;
1250
1316
  var needvalue = false;
@@ -1256,14 +1322,14 @@ var createString = function (parsed) {
1256
1322
  }
1257
1323
  else {
1258
1324
  if (a.type === PIECE && !a.text) continue;
1259
- if (!needvalue && (a.type !== PIECE || !/^\=/.test(a.text))) result.push(" ");
1325
+ if (!needvalue && !/\s$/.test(result[result.length - 1]) && a.type !== ELEMENT && (a.type !== PIECE || !/^[\=\s]/.test(a.text))) result.push(" ");
1260
1326
  run(a);
1261
1327
  needvalue = a.type === PIECE && /[\=]$/.test(a.text);
1262
1328
  }
1263
1329
  }
1264
- intag = 0;
1265
- if (o.short && attributes.length > 0 && !(lasttype & (SPACE | QUOTED))) {
1266
- if (!/[\s'"]$/.test(result[result.length - 1])) result.push(' ');
1330
+ intag = _intag;
1331
+ if (o.short && attributes.length > 0 && lasttype & ~(SPACE | QUOTED)) {
1332
+ if (!o.istype && !/[\s'"]$/.test(result[result.length - 1])) result.push(' ');
1267
1333
  }
1268
1334
  }
1269
1335
  if (o.closed) {
@@ -1278,7 +1344,7 @@ var createString = function (parsed) {
1278
1344
  result.push(o.leave);
1279
1345
  }
1280
1346
  else {
1281
- result.push(o.tag_leave);
1347
+ if (o.tag_leave) result.push(o.tag_leave);
1282
1348
  if (o.length) o.forEach(run);
1283
1349
  }
1284
1350
  break;
@@ -1289,14 +1355,15 @@ var createString = function (parsed) {
1289
1355
  break;
1290
1356
  }
1291
1357
  case SCOPED:
1292
- if (patchspace && o.type !== QUOTED && (lasttype & (STRAP | COMMENT | STAMP)
1293
- && (!o.prev || !/[\+\-\~\!]$/.test(o.prev.text) || /[\+\-]$/.test(o.prev.text) && (!o.prev.prev || !((STAMP | STRAP) & o.prev.prev.type)))
1294
- || lasttype === SCOPED && o.entry === "{"
1358
+ var prev = o.prev;
1359
+ if (patchspace && prev && o.type !== QUOTED && (lasttype === STAMP && !prev.unary && !prev.needle
1360
+ || lasttype & ~(SPACE | STAMP | COMMENT) && o.brace
1361
+ || lasttype === STRAP && !/^(this|arguments|import)$/.test(prev.text)
1295
1362
  )) result.push(" ");
1296
1363
  result.push(o.entry);
1297
1364
  if (o.length > 0) {
1298
1365
  var fillspace = patchspace && lasttype !== PIECE && !intag;
1299
- if (o.entry === "{" && o[0].type !== SPACE) {
1366
+ if (o.brace && o[0].type !== SPACE) {
1300
1367
  if (fillspace) {
1301
1368
  result.push(" ");
1302
1369
  }
@@ -1314,7 +1381,7 @@ var createString = function (parsed) {
1314
1381
  else result.pop();
1315
1382
  }
1316
1383
  }
1317
- if (o.leave === "}" && o.entry === "{" && o[o.length - 1].type !== SPACE) {
1384
+ if (o.brace && o[o.length - 1].type !== SPACE) {
1318
1385
  if (fillspace) result.push(" ");
1319
1386
  }
1320
1387
  }
@@ -1322,11 +1389,11 @@ var createString = function (parsed) {
1322
1389
  break;
1323
1390
  default:
1324
1391
  if (o && typeof o === "object") {
1325
- if (intag || o.type === EXPRESS && (needhead_reg.test(o.text) || o.prev?.type === EXPRESS && /\.$/.test(o.prev.text))) {
1326
- if (o.prev?.isdigit && /^\./.test(o.text) && !/^0[\dxbo]|[mni]$|[e\.]/.test(o.prev.text)) result.push(" ");
1392
+ if (intag || o.needle || o.type & (EXPRESS | PROPERTY) && (needhead_reg.test(o.text) || lasttype & EXPRESS && needfoot_reg.test(prev?.text))) {
1393
+ if (prev?.isdigit && !/^0[\dxbo]|[mni]$|[e\.]/.test(prev.text) && lasttype & ~(SPACE | COMMENT)) result.push(" ");
1327
1394
  }
1328
1395
  else if ((STRAP | EXPRESS | PROPERTY | COMMENT | VALUE) & lasttype && (STRAP | EXPRESS | PROPERTY | VALUE | LABEL) & o.type) {
1329
- if (autospace) result.push(" ");
1396
+ if (autospace || o.prev?.isdigit) result.push(" ");
1330
1397
  }
1331
1398
  else if (o.prev && o.type === STAMP && !/^[,;]/.test(o.text)) {
1332
1399
  if (result[result.length - 1] === " " || (lasttype === PROPERTY || !o.isExpress && o.prev && o.prev.type !== LABEL) && o.text === ':') { }
@@ -1344,11 +1411,8 @@ var createString = function (parsed) {
1344
1411
  }
1345
1412
  }
1346
1413
 
1347
- else if (o.text === '*') {
1348
- if (patchspace && lasttype !== SPACE && (lasttype !== STRAP || o.prev && o.prev.text !== 'function')) result.push(" ");
1349
- }
1350
1414
  else if (!/^(\+\+|\-\-)$/.test(o.text) || o.prev && o.prev.type & (STAMP | STRAP)) {
1351
- if (patchspace && lasttype !== SPACE) result.push(" ");
1415
+ if (patchspace && lasttype !== SPACE && !o.needle) result.push(" ");
1352
1416
  }
1353
1417
  }
1354
1418
  if (o.isdigit) {
@@ -1363,7 +1427,6 @@ var createString = function (parsed) {
1363
1427
  }
1364
1428
  }
1365
1429
  lasttype = o.type;
1366
- if (o.isprop) lasttype = PROPERTY;
1367
1430
  };
1368
1431
  parsed.forEach(run);
1369
1432
  return finalresult.join("");
@@ -1632,7 +1695,7 @@ var unshort = function (o, text) {
1632
1695
  };
1633
1696
  var getFuncBody = function (o) {
1634
1697
  var q = o.queue;
1635
- while (q && !(q.scoped?.isfunc)) q = q.queue;
1698
+ while (q && !q.scoped?.isfunc) q = q.queue;
1636
1699
  return q;
1637
1700
  };
1638
1701
  var getBodyWith = function (o, k) {
@@ -1710,6 +1773,8 @@ module.exports = {
1710
1773
  /*2048 */ELEMENT,
1711
1774
  number_reg,
1712
1775
  equal_reg,
1776
+ needhead_reg,
1777
+ needfoot_reg,
1713
1778
  unshort,
1714
1779
  skipAssignment,
1715
1780
  getDeclared,