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