efront 3.13.3 → 3.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.
@@ -4,10 +4,15 @@ var fields = refilm`
4
4
  var ip = e.data[e.field.key];
5
5
  var m = /(\d+\.){3}\d+$/.exec(ip);
6
6
  if (m) {
7
- data.from("iplocation", { ip: m[0] }, function (a) {
7
+ var setAddress = function (a) {
8
8
  var l = document.createElement('label');
9
- l.innerText = a.address;
9
+ l.innerText = a;
10
10
  appendChild(e, l);
11
+ };
12
+ if (e.data.address) setAddress(e.data.address);
13
+ else data.from("iplocation", { ip: m[0] }, function (a) {
14
+ e.data.address = a.address;
15
+ setAddress(a.address);
11
16
  });
12
17
  }
13
18
  return e;
@@ -1,7 +1,7 @@
1
1
  首页: /home/welcome
2
2
  WEB:
3
3
  共享目录: /share/list
4
- 短链接: /home/short
4
+ 短链接: /proxy/list
5
5
  文件管理: /wow/root
6
6
  长连接管理: /link/list
7
7
  任务:
@@ -0,0 +1 @@
1
+ pedit.bind(null, "短链接", "proxy");
@@ -0,0 +1,12 @@
1
+ var fields = refilm`
2
+ *代理路径/url input/20
3
+ 真实路径/realpath url/2000
4
+ / - ${[{
5
+ name: "访问",
6
+ do(o) {
7
+ var url = o.url;
8
+ if (!/^\//.test(url)) url = "/" + url;
9
+ window.open(url,null);
10
+ }
11
+ }]}`;
12
+ return plist.bind(null, '短链接', "proxy", fields, "/proxy/edit");
@@ -277,27 +277,20 @@ function pack2(buff) {
277
277
  var result = [];
278
278
  for (var cx = 0, dx = buff.length, bx = 32 * 1024 * 1024; cx < dx; cx += bx) {
279
279
  var b = buff.slice(cx, cx + bx);
280
- var [l, p, b] = scan(b);
281
- l = encodeRange(l);
282
- p = encodeRange(p);
280
+ var b = scan(b);
283
281
  var e = encodeRange(b);
284
282
  var el = int(e.length);
285
283
  result.push(concatTypedArray([
286
284
  [
287
285
  range_compress,
288
286
  other_compress << 5 | el.length,
289
- l.length >> 8,
290
- l.length & 0xff,
291
- p.length >> 8,
292
- p.length & 0xff
293
287
  ],
294
- el, l, p, e]));
288
+ el, e]));
295
289
  }
296
290
  result = concatTypedArray(result);
297
291
  return pack0(buff, result);
298
292
  }
299
293
  module.exports = function (buff, type) {
300
- type = 1;
301
294
  switch (type) {
302
295
  case 1:
303
296
  return pack(buff);
@@ -110,7 +110,7 @@ var skipAssignment = function (o) {
110
110
  }
111
111
  return o;
112
112
  };
113
- var createScoped = function (parsed) {
113
+ var createScoped = function (parsed, wash) {
114
114
  var used = Object.create(null); var vars = Object.create(null), lets = vars;
115
115
  var scoped = [], funcbody = scoped;
116
116
  scoped.isfunc = true;
@@ -206,7 +206,7 @@ var createScoped = function (parsed) {
206
206
  }
207
207
  o = o0;
208
208
  mergeTo(used, used0);
209
- Object.assign(m, declared);
209
+ mapDeclared(m, declared);
210
210
  continue loop;
211
211
  case "function":
212
212
  isFunction = true;
@@ -308,6 +308,7 @@ var createScoped = function (parsed) {
308
308
  o.isExpress = isExpress;
309
309
  if (isFunction || isCatch) {
310
310
  var [declared, used0, o0, skiped] = getDeclared(o.first, 'argument');
311
+ scoped.args = declared;
311
312
  mergeTo(used, used0);
312
313
  while (skiped.length) {
313
314
  var o1 = run(skiped[0], 0);
@@ -315,7 +316,7 @@ var createScoped = function (parsed) {
315
316
  if (sindex < 0) break;
316
317
  skiped.splice(0, sindex + 1);
317
318
  }
318
- Object.assign(isCatch ? lets : vars, declared);
319
+ mapDeclared(isCatch ? lets : vars, declared);
319
320
  }
320
321
  else {
321
322
  run(o.first);
@@ -334,6 +335,19 @@ var createScoped = function (parsed) {
334
335
  if (o.type === SCOPED && o.entry === "{") {
335
336
  o.isExpress = isExpress;
336
337
  run(o.first);
338
+ if (wash && isFunction) {
339
+ var e = o.next;
340
+ if (e && e.type === EXPRESS && /^[\.\[]/.test(e.text) || e && e.type === SCOPED && e.entry === "[") {
341
+ scoped.target = true;
342
+ e = e.next;
343
+ }
344
+ if (e && e.type === SCOPED && e.entry === '(') {
345
+ if (e.first) {
346
+ scoped.pass = getDeclared(e.first)[0];
347
+ }
348
+ if (scoped.target) scoped.target = scoped.pass.shift();
349
+ }
350
+ }
337
351
  }
338
352
  else {
339
353
  do {
@@ -407,7 +421,8 @@ var createScoped = function (parsed) {
407
421
  return scoped;
408
422
  };
409
423
  var getDeclared = function (o, kind) {
410
- var declared = Object.create(null), used = Object.create(null); var skiped = [];
424
+ var declared = [], used = Object.create(null); var skiped = [];
425
+ var prop = null;
411
426
  loop: while (o) {
412
427
  while (o && o.type === STAMP && o.text === ',') o = o.next;
413
428
  if (!o) break;
@@ -423,12 +438,14 @@ var getDeclared = function (o, kind) {
423
438
  if (o.text === "*" && o.next) {
424
439
  if (o.next.type === STRAP && o.next.text === 'as') {
425
440
  o = o.next.next;
441
+ prop = "*";
426
442
  continue;
427
443
  }
428
444
  }
429
445
  case PROPERTY:
430
446
  if (o.next) {
431
447
  if (o.next.type === STAMP && o.next.text === ":" || o.next.type === STRAP && o.next.text === "as") {
448
+ prop = "." + o.text;
432
449
  o = o.next.next;
433
450
  continue;
434
451
  }
@@ -437,7 +454,9 @@ var getDeclared = function (o, kind) {
437
454
  case VALUE:
438
455
  case EXPRESS:
439
456
  var n = o.text.replace(/^\.\.\.|\.\.\.$/g, '');
440
- declared[n] = true;
457
+ declared.push(n);
458
+ if (n !== o.text) declared["..."] = n;
459
+ else if (prop) declared[prop] = n;
441
460
  o.kind = kind;
442
461
  saveTo(used, n, o);
443
462
  o = o.next;
@@ -446,7 +465,8 @@ var getDeclared = function (o, kind) {
446
465
  var [d, u, _, s] = getDeclared(o.first, kind);
447
466
  while (s.length) skiped.push.apply(skiped, s.splice(0, 1024));
448
467
  mergeTo(used, u);
449
- Object.assign(declared, d);
468
+ declared.push(d);
469
+ if (prop) declared[prop] = d;
450
470
  o = o.next;
451
471
  break;
452
472
  default:
@@ -483,9 +503,21 @@ var getDeclared = function (o, kind) {
483
503
  if (!o) break;
484
504
  if (o.type !== STAMP) break;
485
505
  if (o.text !== ',') break;
506
+ prop = null;
486
507
  }
487
508
  return [declared, used, o, skiped];
488
509
  };
510
+ var mapDeclared = function (map, declared) {
511
+ var rest = [declared];
512
+ while (rest.length) {
513
+ var r = rest.pop();
514
+ for (var d of r) {
515
+ if (d instanceof Array) rest.push(d);
516
+ else map[d] = true;
517
+ }
518
+ }
519
+ return map;
520
+ };
489
521
  var saveTo = function (used, k, o) {
490
522
  if (!(used[k] instanceof Array)) used[k] = [];
491
523
  used[k].push(o);
@@ -498,6 +530,132 @@ var mergeTo = function (used, used0) {
498
530
  }
499
531
  };
500
532
 
533
+ var needBreak = function (prev, next) {
534
+ if (!prev || !next) return;
535
+ if (prev.type === STAMP && /^[,;]$/.test(prev.text)) return;
536
+ if (next.type === STAMP && /^[,;]$/.test(next.text)) return;
537
+ if (prev.type === EXPRESS && /\.$/.test(prev.text)) return;
538
+ if (next.type === EXPRESS && /^\./.test(next.text)) return;
539
+ if (next.type === PROPERTY) return ";";
540
+ if (next.type === STAMP && next.text === "*") return ";";
541
+ if (
542
+ [EXPRESS, VALUE, QUOTED].indexOf(prev.type) >= 0
543
+ || prev.type === STAMP && /^(\+\+|\-\-)$/.test(prev.text)
544
+ || prev.type === SCOPED && (prev.isExpress || prev.isObject)
545
+ ) {
546
+ if ([EXPRESS, VALUE, QUOTED, LABEL].indexOf(next.type) >= 0) return ";";
547
+ if (next.type === STRAP) {
548
+ if (!/^(in|of|extends|instanceof|as)$/.test(next.text)) return ";";
549
+ return " ";
550
+ }
551
+ if (next.type === SCOPED) {
552
+ if (!next.isExpress) return ";";
553
+ }
554
+ return;
555
+ }
556
+ if (prev.type === STRAP) {
557
+ if ([STRAP, EXPRESS, VALUE, QUOTED].indexOf(next.type) >= 0) return " ";
558
+ if (next.type === LABEL) return ";";
559
+ }
560
+ };
561
+
562
+ var createString = function (parsed) {
563
+ var pressed = parsed.pressed;
564
+ var lasttype;
565
+ var result = [];
566
+ var run = (o, i, a) => {
567
+ var prev = o.prev;
568
+ if (!~[SPACE, COMMENT, STAMP, PIECE].indexOf(o.type) && prev && lasttype !== SPACE && !pressed) {
569
+ if (~[QUOTED, SCOPED, STRAP, LABEL, COMMENT].indexOf(lasttype)
570
+ || prev.type === STAMP
571
+ && (!/[\+\-\~\!]$/.test(prev.text) || /[\+\-]$/.test(prev.text) && prev.prev
572
+ && (!~[STAMP, STRAP, SCOPED].indexOf(prev.prev.type) || prev.prev.type === SCOPED && prev.prev.isExpress)
573
+ )) {
574
+ if (o.type !== SCOPED && (o.type !== EXPRESS || !/^\./.test(o.text))) {
575
+ result.push(" ");
576
+ lasttype = SPACE
577
+ }
578
+ }
579
+ }
580
+ switch (o.type) {
581
+ case COMMENT:
582
+ // 每一次要远行,我都不得不对自己的物品去粗取精。取舍之间,什么重要,什么不是那么重要,都有了一道明显的分界线。
583
+ if (!pressed) {
584
+ if (lasttype !== SPACE && o.prev) result.push(' ');
585
+ result.push(o.text);
586
+ }
587
+ break;
588
+ case SPACE:
589
+ if (!pressed) {
590
+ result.push(o.text);
591
+ lasttype = SPACE;
592
+ break;
593
+ }
594
+ var b = needBreak(o.prev, o.next);
595
+ if (b) result.push(b);
596
+ break;
597
+ case QUOTED:
598
+ if (!o.length) {
599
+ result.push(o.text);
600
+ break;
601
+ }
602
+ case SCOPED:
603
+ if (!pressed && o.type !== QUOTED && (lasttype === STRAP || lasttype === COMMENT || lasttype === STAMP
604
+ && (!o.prev || !/[\+\-\~\!]$/.test(o.prev.text) || /[\+\-]$/.test(o.prev.text) && (!o.prev.prev || !~[STAMP, STRAP].indexOf(o.prev.prev.type)))
605
+ || lasttype === SCOPED && o.entry === "{"
606
+ )) result.push(" ");
607
+ result.push(o.entry);
608
+ if (o.length > 0) {
609
+ if (o.entry === "{" && result[0].type !== SPACE) {
610
+ if (!pressed) {
611
+ result.push(" ");
612
+ }
613
+ }
614
+ lasttype = undefined;
615
+ o.forEach(run);
616
+ if (/^[,;]$/.test(result[result.length - 1]) && pressed) {
617
+ if (!o.prev || o.prev.text !== 'for') result.pop();
618
+ }
619
+ if (o.leave === "}" && (!o.next || o.next.type !== PIECE) && o[o.length - 1].type !== SPACE) {
620
+ if (!pressed) result.push(" ");
621
+ }
622
+ }
623
+ result.push(o.leave);
624
+ break;
625
+ default:
626
+ if (o instanceof Object) {
627
+ if ([STRAP, EXPRESS, PROPERTY, VALUE, COMMENT].indexOf(lasttype) >= 0 && [STRAP, EXPRESS, PROPERTY, VALUE].indexOf(o.type) >= 0) {
628
+ result.push(" ");
629
+ }
630
+ else if (o.prev && o.type === STAMP && !/^([,;])$/.test(o.text)) {
631
+ if (result[result.length - 1] === " " || (lasttype === PROPERTY || !o.isExpress && o.prev && o.prev.type !== LABEL) && o.text === ':') { }
632
+ else if (lasttype === STAMP) {
633
+ result.push(" ");
634
+ }
635
+ else if (/^(\+\+|\-\-)$/.test(o.prev.text) && o.prev.prev) {
636
+ var prev_prev = o.prev.prev;
637
+ if (
638
+ prev_prev.type === STRAP && !prev_prev.isExpress
639
+ || prev_prev.type === EXPRESS
640
+ || prev_prev.type === VALUE
641
+ ) result.push(";");
642
+ }
643
+ else if (!/^(\+\+|\-\-)$/.test(o.text)) {
644
+ if (!pressed && lasttype !== SPACE) result.push(" ");
645
+ }
646
+ }
647
+ result.push(o.text);
648
+ }
649
+ else {
650
+ result.push(o);
651
+ }
652
+ }
653
+ lasttype = o.type;
654
+ if (o.isprop) lasttype = PROPERTY;
655
+ };
656
+ parsed.forEach(run);
657
+ return result.join("");
658
+ }
501
659
 
502
660
  module.exports = {
503
661
  /*-1 */COMMENT,
@@ -514,6 +672,7 @@ module.exports = {
514
672
  number_reg,
515
673
  skipAssignment,
516
674
  getDeclared,
675
+ createString,
517
676
  createScoped,
518
677
  saveTo,
519
678
  mergeTo
@@ -293,9 +293,9 @@ function single_comment_scanner2(index) {
293
293
  // single_comment_scanner2.call(string, 0);
294
294
  // }, count); //3354+
295
295
  // console.log(t1, t2);
296
- function block_code_scanner(index, blocks = []) {
296
+ function block_code_scanner(index, blocks = [], keepdeep = Infinity) {
297
297
  var save = (blocks instanceof Array) ? function (scanner, children) {
298
- if (saved_index < index) {
298
+ if (deep < keepdeep && saved_index < index) {
299
299
  blocks.push(new Block(scanner, saved_index, index, children));
300
300
  saved_index = index;
301
301
  }
@@ -618,7 +618,7 @@ function lookback_scanner(blockIndex, blocks) {
618
618
  return tempIndex;
619
619
  }
620
620
 
621
- var scanner = module.exports = function (s) {
621
+ var scanner = module.exports = function (s, keepdeep) {
622
622
  var blocks = [];
623
623
  var s = String(s);
624
624
  // var time = Date.now();
@@ -626,10 +626,13 @@ var scanner = module.exports = function (s) {
626
626
  // block_code_scanner.call(s, 0, blocks);
627
627
  // }//angular 1.5.3 x1000 7.0s
628
628
  // console.log(Date.now() - time);
629
- block_code_scanner.call(s, 0, blocks);
629
+ block_code_scanner.call(s, 0, blocks, keepdeep);
630
630
  // console.log(blocks.map(a => s.slice(a.start, a.end)).join())
631
631
  return blocks;
632
632
  };
633
+ scanner.autoskip = function (code, start) {
634
+ return block_code_scanner.call(code, start, null);
635
+ };
633
636
  function Block(scanner, start, end, children) {
634
637
  this.type = scanner;
635
638
  this.start = start;
@@ -15,38 +15,11 @@ const {
15
15
  number_reg,
16
16
  skipAssignment,
17
17
  createScoped,
18
+ createString,
18
19
  } = require("./common");
19
20
 
20
21
 
21
22
 
22
- var needBreak = function (prev, next) {
23
- if (!prev || !next) return;
24
- if (prev.type === STAMP && /^[,;]$/.test(prev.text)) return;
25
- if (next.type === STAMP && /^[,;]$/.test(next.text)) return;
26
- if (prev.type === EXPRESS && /\.$/.test(prev.text)) return;
27
- if (next.type === EXPRESS && /^\./.test(next.text)) return;
28
- if (next.type === PROPERTY) return ";";
29
- if (next.type === STAMP && next.text === "*") return ";";
30
- if (
31
- [EXPRESS, VALUE, QUOTED].indexOf(prev.type) >= 0
32
- || prev.type === STAMP && /^(\+\+|\-\-)$/.test(prev.text)
33
- || prev.type === SCOPED && (prev.isExpress || prev.isObject)
34
- ) {
35
- if ([EXPRESS, VALUE, QUOTED, LABEL].indexOf(next.type) >= 0) return ";";
36
- if (next.type === STRAP) {
37
- if (!/^(in|of|extends|instanceof|as)$/.test(next.text)) return ";";
38
- return " ";
39
- }
40
- if (next.type === SCOPED) {
41
- if (!next.isExpress) return ";";
42
- }
43
- return;
44
- }
45
- if (prev.type === STRAP) {
46
- if ([STRAP, EXPRESS, VALUE, QUOTED].indexOf(next.type) >= 0) return " ";
47
- if (next.type === LABEL) return ";";
48
- }
49
- };
50
23
 
51
24
 
52
25
  var compress = function (scoped, maped) {
@@ -266,95 +239,7 @@ class Program extends Array {
266
239
  }
267
240
 
268
241
  toString() {
269
- var lasttype;
270
- var result = [];
271
- var run = (o, i, a) => {
272
- if (!~[SPACE, COMMENT, STAMP, PIECE].indexOf(o.type) && lasttype !== SPACE && !this.pressed) {
273
- var prev = o.prev;
274
- if (~[QUOTED, SCOPED, STRAP].indexOf(lasttype)
275
- || prev && prev.type === STAMP && !/(\+\+|\-\-|~|!)$/.test(prev.text) && prev.prev && prev.prev.type !== STAMP) {
276
- if (o.type !== SCOPED && (o.type !== EXPRESS || !/^\./.test(o.text))) {
277
- result.push(" ");
278
- lasttype = SPACE
279
- }
280
- }
281
- }
282
- switch (o.type) {
283
- case COMMENT:
284
- // 每一次要远行,我都不得不对自己的物品去粗取精。取舍之间,什么重要,什么不是那么重要,都有了一道明显的分界线。
285
- if (!this.pressed) {
286
- result.push(o.text);
287
- if (this.pressed && /^\/\//.test(o.text)) {
288
- result.push("\r\n");
289
- }
290
- }
291
- break;
292
- case SPACE:
293
- if (!this.pressed) {
294
- result.push(o.text);
295
- break;
296
- }
297
- var b = needBreak(o.prev, o.next);
298
- if (b) result.push(b);
299
- break;
300
- case QUOTED:
301
- if (!o.length) {
302
- result.push(o.text);
303
- break;
304
- }
305
- case SCOPED:
306
- if (!this.pressed && (lasttype === STRAP || lasttype === STAMP || lasttype === SCOPED && o.entry === "{") && o.type !== QUOTED) result.push(" ");
307
- result.push(o.entry);
308
- if (o.length > 0) {
309
- if (o.entry === "{" && result[0].type !== SPACE) {
310
- if (!this.pressed) {
311
- result.push(" ");
312
- }
313
- }
314
- lasttype = undefined;
315
- o.forEach(run);
316
- if (/^[,;]$/.test(result[result.length - 1]) && this.pressed) {
317
- if (!o.prev || o.prev.text !== 'for') result.pop();
318
- }
319
- if (o.leave === "}" && (!o.next || o.next.type !== PIECE) && o[o.length - 1].type !== SPACE) {
320
- if (!this.pressed) result.push(" ");
321
- }
322
- }
323
- result.push(o.leave);
324
- break;
325
- default:
326
- if (o instanceof Object) {
327
- if ([STRAP, EXPRESS, PROPERTY, VALUE].indexOf(lasttype) >= 0 && [STRAP, EXPRESS, PROPERTY, VALUE].indexOf(o.type) >= 0) {
328
- result.push(" ");
329
- }
330
- else if (o.prev && o.type === STAMP && !/^([,;])$/.test(o.text)) {
331
- if (result[result.length - 1] === " " || lasttype === PROPERTY && o.text === ':') { }
332
- else if (lasttype === STAMP) {
333
- result.push(" ");
334
- }
335
- else if (/^(\+\+|\-\-)$/.test(o.prev.text) && o.prev.prev) {
336
- var prev_prev = o.prev.prev;
337
- if (
338
- prev_prev.type === STRAP && !prev_prev.isExpress
339
- || prev_prev.type === EXPRESS
340
- || prev_prev.type === VALUE
341
- ) result.push(";");
342
- }
343
- else if (!/^(\+\+|\-\-)$/.test(o.text)) {
344
- if (!this.pressed && lasttype !== SPACE) result.push(" ");
345
- }
346
- }
347
- result.push(o.text);
348
- }
349
- else {
350
- result.push(o);
351
- }
352
- }
353
- lasttype = o.type;
354
- if (o.isprop) lasttype = PROPERTY;
355
- };
356
- this.forEach(run);
357
- return result.join("");
242
+ return createString(this);
358
243
  }
359
244
  get envs() {
360
245
  return this.scoped.envs;