efront 4.0.48 → 4.0.50

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.
@@ -438,3 +438,4 @@ function olinde(v, vector) {
438
438
  }
439
439
  return v;
440
440
  }
441
+ Matrix.norm = norm;
@@ -1,6 +1,7 @@
1
1
  var d = 0b10000000, s = 0b00111111;
2
+ var keep0 = true;
2
3
  function numberUTF8(t, dist = []) {
3
- if (t < 128) {//0b0xxxxxxx - 0b10xxxxxx
4
+ if (t < 128 && (keep0 || t > 0)) {//0b0xxxxxxx - 0b10xxxxxx
4
5
  dist.push(0b00000000 | t)
5
6
  }
6
7
  else if (t < 2048) {// 0b110xxxxx 10xxxxxx
@@ -43,11 +44,11 @@ function numberUTF8(t, dist = []) {
43
44
  }
44
45
  return dist;
45
46
  }
46
- function encodeUTF8(string) {
47
+ function encodeUTF8(string, encode0) {
48
+ keep0 = !encode0;
47
49
  var dist = [], t;
48
50
  for (var cx = 0, dx = string.length; cx < dx; cx++) {
49
- t = string.codePointAt(cx);
50
- if (t > 0xffff) cx++;
51
+ t = string.charCodeAt(cx);
51
52
  numberUTF8(t, dist);
52
53
  }
53
54
  return dist;
@@ -507,7 +507,21 @@ function detour(o, ie) {
507
507
  if (o) o = o.next;
508
508
  }
509
509
  };
510
-
510
+ var _splice_keepspace = function (a, i) {
511
+ var res = splice.apply(null, arguments);
512
+ if (res.length) {
513
+ var start = res[0].prev;
514
+ var end = res[res.length - 1].next;
515
+ if (!start) start = 0;
516
+ else start = start.row;
517
+ if (end) end = end.row;
518
+ var delta = end - start;
519
+ if (delta > 0) {
520
+ splice(a, i, 0, { type: SPACE, text: Array(delta + 1).join('\r\n') });
521
+ }
522
+ }
523
+ return res;
524
+ }
511
525
  var removeImport = function (c, i, code) {
512
526
  var next = c.next;
513
527
  var { used, envs, vars } = code;
@@ -591,7 +605,7 @@ var removeImport = function (c, i, code) {
591
605
  });
592
606
  });
593
607
  var u = { type: EXPRESS, text: name };
594
- code.splice(i + 1, oi - i - 1, u);
608
+ _splice_keepspace(code, i + 1, oi - i - 1, u);
595
609
  used[name].push(u);
596
610
  return u;
597
611
  };
@@ -343,6 +343,10 @@ var pushstep = function (result, step) {
343
343
  if (q.await__) step.awaited = true;
344
344
  result.push(step);
345
345
  }
346
+ else if (isempty(step, COMMENT)) {
347
+ q.push(...step);
348
+ step = q;
349
+ }
346
350
  else {
347
351
  if (needcomma(q)) q.push({ type: STAMP, text: ';' });
348
352
  if (!ishalf(q)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.0.48",
3
+ "version": "4.0.50",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {
@@ -10,7 +10,7 @@
10
10
  "efront": "public/efront.js"
11
11
  },
12
12
  "scripts": {
13
- "prepare": "node tools/build-efront.js --uplevel --node --deno",
13
+ "prepack": "node tools/build-efront.js --uplevel --node --deno",
14
14
  "start": "efront ./efront/ --libs=typescript,esprima,escodegen,esmangle,pngjs,less-node"
15
15
  },
16
16
  "repository": {