aoye 0.0.22 → 0.0.23
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.
- package/dist/aoye.cjs.js +68 -93
- package/dist/aoye.cjs.js.map +1 -1
- package/dist/aoye.esm.js +68 -93
- package/dist/aoye.esm.js.map +1 -1
- package/dist/index.umd.js +68 -93
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -341,66 +341,6 @@
|
|
|
341
341
|
globalThis["sche"] = _scheduler[Scheduler.Sync];
|
|
342
342
|
const registerScheduler = (key, Ctor) => _scheduler[key] = new Ctor();
|
|
343
343
|
|
|
344
|
-
const DefaultDFSOpt = {
|
|
345
|
-
isUp: false,
|
|
346
|
-
begin: null,
|
|
347
|
-
complete: null,
|
|
348
|
-
breakStack: [],
|
|
349
|
-
breakLine: null,
|
|
350
|
-
breakNode: null
|
|
351
|
-
};
|
|
352
|
-
function dfs(root, opt = {}) {
|
|
353
|
-
const _DefaultDFSOpt$opt = {
|
|
354
|
-
...DefaultDFSOpt,
|
|
355
|
-
...opt
|
|
356
|
-
},
|
|
357
|
-
isUp = _DefaultDFSOpt$opt.isUp,
|
|
358
|
-
begin = _DefaultDFSOpt$opt.begin,
|
|
359
|
-
complete = _DefaultDFSOpt$opt.complete,
|
|
360
|
-
lineStack = _DefaultDFSOpt$opt.breakStack,
|
|
361
|
-
breakLine = _DefaultDFSOpt$opt.breakLine;
|
|
362
|
-
let node = opt.breakNode || root;
|
|
363
|
-
let line = breakLine;
|
|
364
|
-
const listKey = isUp ? "recStart" : "emitStart";
|
|
365
|
-
const nodeKey = isUp ? "upstream" : "downstream";
|
|
366
|
-
const nextLineKey = isUp ? "nextRecLine" : "nextEmitLine";
|
|
367
|
-
const reverseNodeKey = isUp ? "downstream" : "upstream";
|
|
368
|
-
while (true) {
|
|
369
|
-
let notGoDeep = begin?.({
|
|
370
|
-
node,
|
|
371
|
-
lineFromUp: line,
|
|
372
|
-
walkedLine: lineStack
|
|
373
|
-
});
|
|
374
|
-
lineStack.push(line);
|
|
375
|
-
line = node[listKey];
|
|
376
|
-
if (line && !notGoDeep) {
|
|
377
|
-
const firstChild = line[nodeKey];
|
|
378
|
-
node = firstChild;
|
|
379
|
-
continue;
|
|
380
|
-
}
|
|
381
|
-
while (true) {
|
|
382
|
-
const noGoSibling = complete?.({
|
|
383
|
-
node,
|
|
384
|
-
lineToDeep: line,
|
|
385
|
-
walkedLine: lineStack,
|
|
386
|
-
notGoDeep
|
|
387
|
-
});
|
|
388
|
-
line = lineStack.pop();
|
|
389
|
-
if (node === root) {
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
notGoDeep = false;
|
|
393
|
-
const nextLine = line[nextLineKey];
|
|
394
|
-
if (!noGoSibling && nextLine) {
|
|
395
|
-
line = nextLine;
|
|
396
|
-
node = nextLine[nodeKey];
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
node = line[reverseNodeKey];
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
344
|
class Line {
|
|
405
345
|
constructor() {
|
|
406
346
|
/** 上游顶点 */
|
|
@@ -589,29 +529,46 @@
|
|
|
589
529
|
}
|
|
590
530
|
function unlinkSingleRefedNode(delRoot) {
|
|
591
531
|
let toUnlink;
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
node
|
|
605
|
-
|
|
606
|
-
|
|
532
|
+
let node = delRoot,
|
|
533
|
+
i = -1,
|
|
534
|
+
parent;
|
|
535
|
+
const stack = [];
|
|
536
|
+
outer: do {
|
|
537
|
+
let noGoDeep = false;
|
|
538
|
+
doUnlink(toUnlink);
|
|
539
|
+
toUnlink = null;
|
|
540
|
+
noGoDeep = node.emitStart !== node.emitEnd;
|
|
541
|
+
const recStart = node.recStart;
|
|
542
|
+
if (recStart && !noGoDeep) {
|
|
543
|
+
stack[++i] = recStart;
|
|
544
|
+
parent = node;
|
|
545
|
+
node = recStart.upstream;
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
while (true) {
|
|
607
549
|
doUnlink(toUnlink);
|
|
608
550
|
toUnlink = null;
|
|
609
|
-
|
|
610
|
-
if (isSingleRefed) {
|
|
551
|
+
if (!noGoDeep) {
|
|
611
552
|
toUnlink = node.emitStart;
|
|
612
553
|
}
|
|
554
|
+
noGoDeep = false;
|
|
555
|
+
if (i === -1) {
|
|
556
|
+
break outer;
|
|
557
|
+
}
|
|
558
|
+
const backLine = stack[i];
|
|
559
|
+
const nextLine = backLine.nextRecLine;
|
|
560
|
+
if (nextLine) {
|
|
561
|
+
node = nextLine.upstream;
|
|
562
|
+
stack[i] = nextLine;
|
|
563
|
+
break;
|
|
564
|
+
} else {
|
|
565
|
+
node = parent;
|
|
566
|
+
if (--i !== -1) {
|
|
567
|
+
parent = stack[i].downstream;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
613
570
|
}
|
|
614
|
-
});
|
|
571
|
+
} while (true);
|
|
615
572
|
doUnlink(toUnlink);
|
|
616
573
|
}
|
|
617
574
|
function doUnlink(line) {
|
|
@@ -626,23 +583,41 @@
|
|
|
626
583
|
const memoNext = toDel.nextRecLine;
|
|
627
584
|
const upstream = toDel.upstream;
|
|
628
585
|
if (upstream.state & State.IsScope) {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
586
|
+
let node = upstream,
|
|
587
|
+
i = -1,
|
|
588
|
+
parent;
|
|
589
|
+
const stack = [];
|
|
590
|
+
outer: do {
|
|
591
|
+
let noGoDeep = (node.state & State.IsScope) === 0 || node.state & ScopeAbort;
|
|
592
|
+
const recStart = node.recStart;
|
|
593
|
+
if (recStart && !noGoDeep) {
|
|
594
|
+
stack[++i] = recStart;
|
|
595
|
+
parent = node;
|
|
596
|
+
node = recStart.upstream;
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
while (true) {
|
|
600
|
+
if (!noGoDeep) {
|
|
601
|
+
releaseScope(node);
|
|
602
|
+
}
|
|
603
|
+
noGoDeep = false;
|
|
604
|
+
if (i === -1) {
|
|
605
|
+
break outer;
|
|
606
|
+
}
|
|
607
|
+
const backLine = stack[i];
|
|
608
|
+
const nextLine = backLine.nextRecLine;
|
|
609
|
+
if (nextLine) {
|
|
610
|
+
node = nextLine.upstream;
|
|
611
|
+
stack[i] = nextLine;
|
|
612
|
+
break;
|
|
613
|
+
} else {
|
|
614
|
+
node = parent;
|
|
615
|
+
if (--i !== -1) {
|
|
616
|
+
parent = stack[i].downstream;
|
|
617
|
+
}
|
|
643
618
|
}
|
|
644
619
|
}
|
|
645
|
-
});
|
|
620
|
+
} while (true);
|
|
646
621
|
} else {
|
|
647
622
|
unlinkSingleLine(toDel);
|
|
648
623
|
}
|