efront 4.0.23 → 4.0.25

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.
@@ -164,7 +164,7 @@ var readFile = function (names, then) {
164
164
 
165
165
  };
166
166
  var createFunction = function (name, body, args, isAsync, isYield) {
167
- return window.eval(`[${isAsync ? 'async ' : ''}function${isYield ? "*" : ""}/*${name}*/(${args || ''}){\r\n${body}\r\n}][0]`);
167
+ return window.eval(`[${isAsync ? 'async ' : ''}function${isYield ? "*" : ""}/*${name}*/(${args || ''}){\r\n${body}\r\n}][0]`, name);
168
168
  };
169
169
 
170
170
  var FILE_NAME_REG = /^https?\:|\.(html?|css|asp|jsp|php)$/i;
@@ -18,14 +18,11 @@ if (!Promise) {
18
18
  var queue = [];
19
19
  var running = false;
20
20
  var run = function (q) {
21
- running = true;
22
21
  while (queue.length) {
23
22
  var threads = queue.splice(0, queue.length);
24
23
  for (var t of threads) {
25
- if (!t.oked && !t.ohed) continue;
26
24
  var PromiseRejectReactions = t.PromiseRejectReactions.splice(0, t.PromiseRejectReactions.length);
27
25
  var PromiseFulfillReactions = t.PromiseFulfillReactions.splice(0, t.PromiseFulfillReactions.length);
28
-
29
26
  if (t.oked) {
30
27
  for (var r of PromiseFulfillReactions) {
31
28
  r.call(null, t.oked[0]);
@@ -49,8 +46,9 @@ if (!Promise) {
49
46
  running = false;
50
47
  };
51
48
  var fire = function (p) {
52
- if (running) return queue.push(p);
53
49
  queue.push(p);
50
+ if (running) return;
51
+ running = true;
54
52
  requestAnimationFrame(run);
55
53
  };
56
54
  var Promise = function (executor) {
@@ -72,39 +70,38 @@ if (!Promise) {
72
70
  p.ohed = arguments;
73
71
  fire(p);
74
72
  };
75
- fire(p);
76
73
  executor(ResolvingFunctions_resolve, ResolvingFunctions_reject);
77
74
  };
78
- Promise.prototype = {
79
- then(onok, onoh) {
80
- var resolve, reject;
81
- var promise = new Promise(function (ok, oh) {
82
- if (onok) resolve = function (a) {
83
- try {
84
- a = onok(a);
85
- ok(a);
86
- } catch (e) {
87
- oh(e, onok, onoh);
88
- }
89
- };
90
- if (onoh) reject = function (a) {
91
- try {
92
- a = onoh.apply(null, arguments);
93
- ok(a);
94
- } catch (e) {
95
- oh(e, onok, onoh);
96
- }
97
- };
98
- })
99
- if (resolve) this.PromiseFulfillReactions.push(resolve);
100
- if (reject) this.PromiseRejectReactions.push(reject);
101
- if (this.oked || this.ohed) fire(this);
102
- return promise;
103
- },
104
- "catch"(f) {
105
- return this.then(null, f);
106
- },
75
+ Promise.prototype.then = function (onok, onoh) {
76
+ var resolve, reject;
77
+ var promise = new Promise(function (ok, oh) {
78
+ if (onok) resolve = function (a) {
79
+ try {
80
+ a = onok(a);
81
+ ok(a);
82
+ } catch (e) {
83
+ oh(e, onok, onoh);
84
+ }
85
+ };
86
+ else resolve = ok;
87
+ if (onoh) reject = function (a) {
88
+ try {
89
+ a = onoh.apply(null, arguments);
90
+ ok(a);
91
+ } catch (e) {
92
+ oh(e, onok, onoh);
93
+ }
94
+ };
95
+ else reject = oh;
96
+ })
97
+ if (resolve) this.PromiseFulfillReactions.push(resolve);
98
+ if (reject) this.PromiseRejectReactions.push(reject);
99
+ if (this.oked || this.ohed) fire(this);
100
+ return promise;
107
101
  }
102
+ Promise.prototype.catch = function (f) {
103
+ return this.then(null, f);
104
+ };
108
105
  Promise.all = function (penddings) {
109
106
  return new Promise(function (ok, oh) {
110
107
  if (!(penddings && penddings.length)) {
@@ -11,6 +11,7 @@ async function testCatch(Promise) {
11
11
  }).then(null, function () {
12
12
  console.log("catch2");
13
13
  });
14
+ console.log("done");
14
15
  } catch (e) {
15
16
  console.log(e)
16
17
  }
@@ -81,7 +81,7 @@ var arrayFillMap = function (a, i, as) {
81
81
  if (!nnn || nnn.type !== SCOPED || nnn.entry !== '(') return;
82
82
  var mn = nnn.next;
83
83
  var f = n.first;
84
- var mnn = mn.next;
84
+ var mnn = mn && mn.next;
85
85
  if (!f || f.type !== VALUE || !f.isdigit ||
86
86
  !mn || mn.type !== EXPRESS || mn.text !== '.map' ||
87
87
  !mnn || mnn.type !== SCOPED || mnn.entry !== "(" ||
@@ -97,17 +97,19 @@ var getFromScopeList = function (name, varsList, value) {
97
97
  var fixBase = function (b, a) {
98
98
  return a.split(/,\s*/).map(a => {
99
99
  var replaced = false;
100
- a = a.replace(/(:scope|&)/g, function (match) {
101
- replaced = true;
102
- return b;
103
- });
104
- if (!replaced) {
105
- if (/^[>~+]/.test(a)) {
106
- a = b + a;
100
+ return b.split(/\s*,\s*/).map(b => {
101
+ var a1 = a.replace(/(:scope|&)/g, function (match) {
102
+ replaced = true;
103
+ return b;
104
+ });
105
+ if (!replaced) {
106
+ if (/^[>~+]/.test(a)) {
107
+ a1 = b + a;
108
+ }
109
+ else a1 = b + " " + a;
107
110
  }
108
- else a = b + " " + a;
109
- }
110
- return a;
111
+ return a1;
112
+ }).join(",");
111
113
  }).join(",");
112
114
  }
113
115
  function evalscoped(scoped, scopeNames, base = '') {
@@ -11,4 +11,5 @@ test(`a{ &>b{a:1}}`,`a>b{a:1;}`);
11
11
  test(`a{ &b{a:1}}`,`ab{a:1;}`);
12
12
  test(`a{ &.b{a:1}}`,`a.b{a:1;}`);
13
13
  test(`a{ &[b]{a:1}}`,`a[b]{a:1;}`);
14
- test(`a{ &[b]:nth-child(1){a:1}}`,`a[b]:nth-child(1){a:1;}`);
14
+ test(`a{ &[b]:nth-child(1){a:1}}`,`a[b]:nth-child(1){a:1;}`);
15
+ test(`a,b{c{a:1}}`,`a c,b c{a:1;}`);
@@ -512,7 +512,7 @@ var _invoke = function (t, getname) {
512
512
  if (!iseval || m[m.length - 1] === o.last) {
513
513
  var q = toqueue(m, getdeepname, 1);
514
514
  var qe = q[q.length - 1];
515
- splice(o, by, ey - by, ...qe ? [{ text: qe.name, type: EXPRESS }] : []);
515
+ splice(o, by, ey - by, ...qe ? scanner2(qe.name) : []);
516
516
  cy = by + 1;
517
517
  }
518
518
  else {
@@ -641,7 +641,7 @@ var popexp = function (explist) {
641
641
  }
642
642
  else {
643
643
  n = asn.name;
644
- asn = [{ type: EXPRESS, text: n }];
644
+ asn = scanner2(n);
645
645
  }
646
646
  return [asn, n];
647
647
  }
@@ -759,7 +759,7 @@ var ternary = function (body, getname, ret) {
759
759
  if (isSimpleAssign && eq.text === '=') {
760
760
  [asn, n = createString(ass)] = popexp(explist);
761
761
  }
762
- else if (n) var asn = [{ type: EXPRESS, text: n }];
762
+ else if (n) var asn = scanner2(n);
763
763
  else asn = explist.pop();
764
764
  var an = '';
765
765
  if (eq.text.length > 1) {
@@ -18,7 +18,9 @@ if (cookiesData) {
18
18
  }
19
19
 
20
20
  var digest = function () {
21
- dispatch('render', window);
21
+ Promise.resolve().then(function(){
22
+ dispatch('render', window);
23
+ });
22
24
  };
23
25
  if (/Trident/i.test(navigator.userAgent)) digest = lazy(digest, 60);
24
26
  var cross = cross_.bind(function (callback, onerror) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.0.23",
3
+ "version": "4.0.25",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {