@next-core/brick-utils 2.45.16 → 2.45.18
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/index.esm.js
CHANGED
|
@@ -18145,6 +18145,7 @@ function collectBricksByCustomTemplates(customTemplates) {
|
|
|
18145
18145
|
return collectionByTpl;
|
|
18146
18146
|
}
|
|
18147
18147
|
|
|
18148
|
+
var widgetRegExp = /\.tpl-/;
|
|
18148
18149
|
function getDllAndDepsOfStoryboard(storyboard, brickPackages, options) {
|
|
18149
18150
|
var _storyboard$meta;
|
|
18150
18151
|
var {
|
|
@@ -18153,11 +18154,13 @@ function getDllAndDepsOfStoryboard(storyboard, brickPackages, options) {
|
|
|
18153
18154
|
} = scanStoryboard(storyboard, options);
|
|
18154
18155
|
var customTemplates = (_storyboard$meta = storyboard.meta) === null || _storyboard$meta === void 0 ? void 0 : _storyboard$meta.customTemplates;
|
|
18155
18156
|
var processors = scanProcessorsInAny([storyboard.routes, options !== null && options !== void 0 && options.ignoreBricksInUnusedCustomTemplates ? customTemplates === null || customTemplates === void 0 ? void 0 : customTemplates.filter(tpl => usedTemplates.includes(tpl.name)) : customTemplates]);
|
|
18157
|
+
var widgets = bricks.filter(brick => widgetRegExp.test(brick));
|
|
18156
18158
|
return _objectSpread(_objectSpread({}, getDllAndDepsByResource({
|
|
18157
18159
|
bricks,
|
|
18158
18160
|
processors
|
|
18159
18161
|
}, brickPackages)), {}, {
|
|
18160
|
-
|
|
18162
|
+
eager: getDllAndDepsByResource({
|
|
18163
|
+
bricks: widgets,
|
|
18161
18164
|
processors
|
|
18162
18165
|
}, brickPackages),
|
|
18163
18166
|
bricks
|
|
@@ -19558,7 +19561,13 @@ function collectContextUsage(data, variableName) {
|
|
|
19558
19561
|
function deferResolveContextConcurrently(contextConfs, resolveContext) {
|
|
19559
19562
|
var keyword = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "CTX";
|
|
19560
19563
|
var dependencyMap = getDependencyMapOfContext(contextConfs, keyword);
|
|
19561
|
-
|
|
19564
|
+
// There maybe multiple context confs for a specific name, since there are conditional contexts.
|
|
19565
|
+
// This is a map of how many pending context confs for each context name.
|
|
19566
|
+
var pendingDeps = new Map();
|
|
19567
|
+
for (var contextName of Array.from(dependencyMap.keys()).map(contextConf => contextConf.name)) {
|
|
19568
|
+
var _pendingDeps$get;
|
|
19569
|
+
pendingDeps.set(contextName, ((_pendingDeps$get = pendingDeps.get(contextName)) !== null && _pendingDeps$get !== void 0 ? _pendingDeps$get : 0) + 1);
|
|
19570
|
+
}
|
|
19562
19571
|
var includesComputed = Array.from(dependencyMap.values()).some(stats => stats.includesComputed);
|
|
19563
19572
|
var processed = new WeakSet();
|
|
19564
19573
|
var deferredContexts = new Map();
|
|
@@ -19570,14 +19579,25 @@ function deferResolveContextConcurrently(contextConfs, resolveContext) {
|
|
|
19570
19579
|
})]));
|
|
19571
19580
|
var wrapResolve = /*#__PURE__*/function () {
|
|
19572
19581
|
var _ref = _asyncToGenerator(function* (contextConf) {
|
|
19582
|
+
var _pendingDeps$get2;
|
|
19573
19583
|
processed.add(contextConf);
|
|
19574
19584
|
var resolved = yield resolveContext(contextConf);
|
|
19575
19585
|
dependencyMap.delete(contextConf);
|
|
19586
|
+
var left = (_pendingDeps$get2 = pendingDeps.get(contextConf.name)) !== null && _pendingDeps$get2 !== void 0 ? _pendingDeps$get2 : 0;
|
|
19576
19587
|
if (resolved) {
|
|
19577
19588
|
deferredContexts.get(contextConf.name).resolve();
|
|
19578
|
-
|
|
19589
|
+
pendingDeps.delete(contextConf.name);
|
|
19590
|
+
if (left === 0) {
|
|
19579
19591
|
throw new Error("Duplicated context defined: ".concat(contextConf.name));
|
|
19580
19592
|
}
|
|
19593
|
+
} else {
|
|
19594
|
+
// Assert: left >= 1
|
|
19595
|
+
if (left === 1) {
|
|
19596
|
+
deferredContexts.get(contextConf.name).resolve();
|
|
19597
|
+
pendingDeps.delete(contextConf.name);
|
|
19598
|
+
} else {
|
|
19599
|
+
pendingDeps.set(contextConf.name, left - 1);
|
|
19600
|
+
}
|
|
19581
19601
|
}
|
|
19582
19602
|
yield scheduleNext();
|
|
19583
19603
|
});
|
|
@@ -19634,18 +19654,32 @@ function _resolveContextConcurrently() {
|
|
|
19634
19654
|
_resolveContextConcurrently = _asyncToGenerator(function* (contextConfs, resolveContext) {
|
|
19635
19655
|
var keyword = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "CTX";
|
|
19636
19656
|
var dependencyMap = getDependencyMapOfContext(contextConfs, keyword);
|
|
19637
|
-
var pendingDeps = new
|
|
19657
|
+
var pendingDeps = new Map();
|
|
19658
|
+
for (var contextName of Array.from(dependencyMap.keys()).map(contextConf => contextConf.name)) {
|
|
19659
|
+
var _pendingDeps$get5;
|
|
19660
|
+
pendingDeps.set(contextName, ((_pendingDeps$get5 = pendingDeps.get(contextName)) !== null && _pendingDeps$get5 !== void 0 ? _pendingDeps$get5 : 0) + 1);
|
|
19661
|
+
}
|
|
19638
19662
|
var includesComputed = Array.from(dependencyMap.values()).some(stats => stats.includesComputed);
|
|
19639
19663
|
var processed = new WeakSet();
|
|
19640
19664
|
var wrapResolve = /*#__PURE__*/function () {
|
|
19641
19665
|
var _ref3 = _asyncToGenerator(function* (contextConf) {
|
|
19666
|
+
var _pendingDeps$get6;
|
|
19642
19667
|
processed.add(contextConf);
|
|
19643
19668
|
var resolved = yield resolveContext(contextConf);
|
|
19644
19669
|
dependencyMap.delete(contextConf);
|
|
19670
|
+
var left = (_pendingDeps$get6 = pendingDeps.get(contextConf.name)) !== null && _pendingDeps$get6 !== void 0 ? _pendingDeps$get6 : 0;
|
|
19645
19671
|
if (resolved) {
|
|
19646
|
-
|
|
19672
|
+
pendingDeps.delete(contextConf.name);
|
|
19673
|
+
if (left === 0) {
|
|
19647
19674
|
throw new Error("Duplicated context defined: ".concat(contextConf.name));
|
|
19648
19675
|
}
|
|
19676
|
+
} else {
|
|
19677
|
+
// Assert: left >= 1
|
|
19678
|
+
if (left === 1) {
|
|
19679
|
+
pendingDeps.delete(contextConf.name);
|
|
19680
|
+
} else {
|
|
19681
|
+
pendingDeps.set(contextConf.name, left - 1);
|
|
19682
|
+
}
|
|
19649
19683
|
}
|
|
19650
19684
|
yield scheduleNext();
|
|
19651
19685
|
});
|
|
@@ -19684,19 +19718,33 @@ function _resolveContextConcurrently() {
|
|
|
19684
19718
|
function syncResolveContextConcurrently(contextConfs, resolveContext) {
|
|
19685
19719
|
var keyword = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "CTX";
|
|
19686
19720
|
var dependencyMap = getDependencyMapOfContext(contextConfs, keyword);
|
|
19687
|
-
var pendingDeps = new
|
|
19721
|
+
var pendingDeps = new Map();
|
|
19722
|
+
for (var contextName of Array.from(dependencyMap.keys()).map(contextConf => contextConf.name)) {
|
|
19723
|
+
var _pendingDeps$get3;
|
|
19724
|
+
pendingDeps.set(contextName, ((_pendingDeps$get3 = pendingDeps.get(contextName)) !== null && _pendingDeps$get3 !== void 0 ? _pendingDeps$get3 : 0) + 1);
|
|
19725
|
+
}
|
|
19688
19726
|
var includesComputed = Array.from(dependencyMap.values()).some(stats => stats.includesComputed);
|
|
19689
19727
|
var scheduleAsSerial = includesComputed;
|
|
19690
19728
|
function scheduleNext() {
|
|
19691
19729
|
var dep = Array.from(dependencyMap.entries()).find(predicateNextResolveFactory(pendingDeps, scheduleAsSerial));
|
|
19692
19730
|
if (dep) {
|
|
19731
|
+
var _pendingDeps$get4;
|
|
19693
19732
|
var [_contextConf] = dep;
|
|
19694
19733
|
var resolved = resolveContext(_contextConf);
|
|
19695
19734
|
dependencyMap.delete(_contextConf);
|
|
19735
|
+
var left = (_pendingDeps$get4 = pendingDeps.get(_contextConf.name)) !== null && _pendingDeps$get4 !== void 0 ? _pendingDeps$get4 : 0;
|
|
19696
19736
|
if (resolved) {
|
|
19697
|
-
|
|
19737
|
+
pendingDeps.delete(_contextConf.name);
|
|
19738
|
+
if (left === 0) {
|
|
19698
19739
|
throw new Error("Duplicated context defined: ".concat(_contextConf.name));
|
|
19699
19740
|
}
|
|
19741
|
+
} else {
|
|
19742
|
+
// Assert: left >= 1
|
|
19743
|
+
if (left === 1) {
|
|
19744
|
+
pendingDeps.delete(_contextConf.name);
|
|
19745
|
+
} else {
|
|
19746
|
+
pendingDeps.set(_contextConf.name, left - 1);
|
|
19747
|
+
}
|
|
19700
19748
|
}
|
|
19701
19749
|
scheduleNext();
|
|
19702
19750
|
}
|