efront 4.5.16 → 4.5.17

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.
@@ -1,48 +1,10 @@
1
- var checkPort = async function (p, ip) {
2
- if (!p.host) {
3
- if (/^::ffff:\d+\.\d+\.\d+\.\d+$/i.test(ip)) {
4
- ip = ip.slice(7);
5
- }
6
- else {
7
- ip = `[${ip}]`;
8
- }
9
- p.locate(ip);
10
- }
11
- try {
12
- p.locate("/:version");
13
- var xhr = await cross("@options", p.href);
14
- if (/^efront/.test(xhr.response)) {
15
- p.ok = true;
16
- }
17
- else {
18
- p.error = '异常';
19
- }
20
- } catch (e) {
21
- p.error = e;
22
- }
23
-
24
- }
25
1
  var fields = refilm`
26
2
  IP地址/ip text/120
27
- 地理位置/address/查看 act/80 ${async function (a) {
28
- var ip = a.ip;
29
- var m = /(\d+\.){3}\d+$/.exec(ip);
30
- var { address } = await data.from("iplocation", { ip: m ? m[0] : ip });
31
- a.address = address;
32
- }}
3
+ 地理位置/address/查看 act/80 ${checkGeo}
33
4
  启动时间/time ${function (e) {
34
5
  e.innerHTML = filterTime(e.data[e.field.key]);
35
6
  }}
36
- 绑定地址/port 120/${async function (e) {
37
- var { data, field } = e;
38
- var ports = data[field.key].split(/,/).map(p => parseURL(p));
39
- e.innerHTML = `<a -repeat="p in ports" @click="checkPort(p,ip)" -class="{ok:p.ok,error:p.error}"><span -bind=p></span></a>`;
40
- render(e, {
41
- ports,
42
- ip: data.ip,
43
- checkPort,
44
- })
45
- }}
7
+ 绑定地址/port 120/${checkPort}
46
8
  版本/version input
47
9
  进程/pid
48
10
  `;
@@ -6,6 +6,7 @@ var fields2 = refilm`
6
6
  域名/host text/100
7
7
  路径/path text/80
8
8
  远程地址/remote text/100
9
+ 地理位置/address/查看 act/80 ${checkGeo}
9
10
  时间/time timestamp
10
11
  来源/referer text/100
11
12
  客户端/agent text/200
@@ -20,6 +20,7 @@ const {
20
20
  getDeclared,
21
21
  createScoped,
22
22
  snapExpressHead,
23
+ patchArrawScope,
23
24
  snapExpressFoot,
24
25
  splice,
25
26
  relink,
@@ -481,11 +482,6 @@ Javascript.prototype.detour = function (body, ie) {
481
482
  context = null;
482
483
  return envs;
483
484
  }
484
- var getfunc = function (o, k) {
485
- var q = o.queue;
486
- while (q && (!q.scoped || !q.scoped.used[k])) q = q.queue;
487
- return q;
488
- };
489
485
  var context = null, rootenvs = null;
490
486
  function detour(o, ie) {
491
487
  while (o) {
@@ -514,15 +510,7 @@ function detour(o, ie) {
514
510
  if (hasdot) text = "..." + text;
515
511
  var o1 = scan(text);
516
512
  detour(o1.first, ie);
517
- var s1 = createScoped(o1);
518
- if (s1.used.this) {
519
- var s = getfunc(o, 'this').scoped;
520
- s.used.this.push(...s1.used.this);
521
- }
522
- if (s1.used.arguments) {
523
- var s = getfunc(o, 'arguments').scoped;
524
- s.used.arguments.push(...s1.used.arguments);
525
- };
513
+ patchArrawScope(o1, o);
526
514
  replace(o, ...o1);
527
515
  o = o1.last;
528
516
  continue;
@@ -1483,7 +1483,27 @@ var unshort = function (o, text) {
1483
1483
  o.isprop = false;
1484
1484
  o.type = EXPRESS;
1485
1485
  delete o.short;
1486
- }
1486
+ };
1487
+ var getScopeWith = function (o, k) {
1488
+ var q = o.queue;
1489
+ while (q && (!q.scoped || !q.scoped.used[k])) q = q.queue;
1490
+ return q;
1491
+ };
1492
+
1493
+ var patchArrawScope = function (arraw, origin) {
1494
+ var s1 = createScoped(arraw);
1495
+ if (s1.used.this) {
1496
+ var s = getScopeWith(origin, 'this').scoped;
1497
+ s.used.this.push(...s1.used.this);
1498
+ s.insett = true;
1499
+ }
1500
+ if (s1.used.arguments) {
1501
+ s.inseta = true;
1502
+ var s = getScopeWith(origin, 'arguments').scoped;
1503
+ s.used.arguments.push(...s1.used.arguments);
1504
+ };
1505
+ };
1506
+
1487
1507
  module.exports = {
1488
1508
  /* 1 */COMMENT,
1489
1509
  /* 2 */SPACE,
@@ -1502,6 +1522,8 @@ module.exports = {
1502
1522
  unshort,
1503
1523
  skipAssignment,
1504
1524
  getDeclared,
1525
+ getScopeWith,
1526
+ patchArrawScope,
1505
1527
  remove,
1506
1528
  createString,
1507
1529
  createScoped,
@@ -1,5 +1,5 @@
1
1
  var scanner2 = require("./scanner2");
2
- var { SCOPED, QUOTED, SCOPED, PROPERTY, STAMP, PIECE, setqueue, splice, relink, number_reg, replace, canbeDuplicate, createString } = require("./common");
2
+ var { SCOPED, QUOTED, SCOPED, PROPERTY, STAMP, PIECE, setqueue, splice, relink, patchArrawScope, number_reg, replace, canbeDuplicate, createString } = require("./common");
3
3
  var strings = require("../basic/strings");
4
4
  var program = null;
5
5
  var patchTranslate = function (c) {
@@ -88,7 +88,8 @@ var ctn = function (tt, t) {
88
88
  if (e in t) n[i] = t[e];
89
89
  });
90
90
  relink(n);
91
- })
91
+ });
92
+ patchArrawScope(tn, t);
92
93
  return tn;
93
94
  }
94
95
  var warningMap = Object.create(null);
@@ -0,0 +1,6 @@
1
+ return async function (a) {
2
+ var ip = a.ip || a.remote;
3
+ var m = /(\d+\.){3}\d+$/.exec(ip);
4
+ var { address } = await data.from("iplocation", { ip: m ? m[0] : ip });
5
+ a.address = address;
6
+ }
@@ -0,0 +1,35 @@
1
+ var checkPort = async function (p, ip) {
2
+ if (!p.host) {
3
+ if (/^::ffff:\d+\.\d+\.\d+\.\d+$/i.test(ip)) {
4
+ ip = ip.slice(7);
5
+ }
6
+ else {
7
+ ip = `[${ip}]`;
8
+ }
9
+ p.locate(ip);
10
+ }
11
+ try {
12
+ p.locate("/:version");
13
+ var xhr = await cross("@options", p.href);
14
+ if (/^efront/.test(xhr.response)) {
15
+ p.ok = true;
16
+ }
17
+ else {
18
+ p.error = '异常';
19
+ }
20
+ } catch (e) {
21
+ p.error = e;
22
+ }
23
+
24
+ }
25
+
26
+ return async function (e) {
27
+ var { data, field } = e;
28
+ var ports = data[field.key].split(/,/).map(p => parseURL(p));
29
+ e.innerHTML = `<a -repeat="p in ports" @click="checkPort(p,ip)" -class="{ok:p.ok,error:p.error}"><span -bind=p></span></a>`;
30
+ render(e, {
31
+ ports,
32
+ ip: data.ip,
33
+ checkPort,
34
+ })
35
+ }
@@ -18,6 +18,6 @@ if (preventCache && navigator) {
18
18
  } else {
19
19
  search = "=" + mark_time.toString(36);
20
20
  }
21
- if (!/Safari|Firefox|Sciter/.test(navigator.userAgent)) location.replace(location.pathname + "?" + search);
21
+ if (!/Safari|Firefox|Sciter|Baiduspider|PetalBot|Googlebot|Odin/.test(navigator.userAgent)) location.replace(location.pathname + "?" + search);
22
22
  }
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.5.16",
3
+ "version": "4.5.17",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {