@next-core/brick-utils 2.34.0 → 2.34.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.34.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.34.0...@next-core/brick-utils@2.34.1) (2022-02-15)
7
+
8
+ **Note:** Version bump only for package @next-core/brick-utils
9
+
10
+
11
+
12
+
13
+
6
14
  # [2.34.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.33.1...@next-core/brick-utils@2.34.0) (2022-02-14)
7
15
 
8
16
 
@@ -21434,14 +21434,14 @@
21434
21434
  convertUnitValueByPrecision: convertValueByPrecision
21435
21435
  } = pipes.utils;
21436
21436
 
21437
- var CTX = "CTX";
21438
21437
  function resolveContextConcurrently(_x, _x2) {
21439
21438
  return _resolveContextConcurrently.apply(this, arguments);
21440
21439
  }
21441
21440
 
21442
21441
  function _resolveContextConcurrently() {
21443
21442
  _resolveContextConcurrently = _asyncToGenerator__default["default"](function* (contextConfs, resolveContext) {
21444
- var dependencyMap = getDependencyMapOfContext(contextConfs);
21443
+ var keyword = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "CTX";
21444
+ var dependencyMap = getDependencyMapOfContext(contextConfs, keyword);
21445
21445
  var pendingDeps = new Set(Array.from(dependencyMap.keys()).map(contextConf => contextConf.name));
21446
21446
  var includesComputed = Array.from(dependencyMap.values()).some(stats => stats.includesComputed);
21447
21447
  var processed = new WeakSet();
@@ -21489,7 +21489,7 @@
21489
21489
 
21490
21490
  if (dependencyMap.size > 0) {
21491
21491
  // This will throw if circular contexts detected.
21492
- detectCircularContexts(dependencyMap);
21492
+ detectCircularContexts(dependencyMap, keyword);
21493
21493
  scheduleAsSerial = true;
21494
21494
  yield scheduleNext();
21495
21495
  }
@@ -21498,7 +21498,8 @@
21498
21498
  }
21499
21499
 
21500
21500
  function syncResolveContextConcurrently(contextConfs, resolveContext) {
21501
- var dependencyMap = getDependencyMapOfContext(contextConfs);
21501
+ var keyword = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "CTX";
21502
+ var dependencyMap = getDependencyMapOfContext(contextConfs, keyword);
21502
21503
  var pendingDeps = new Set(Array.from(dependencyMap.keys()).map(contextConf => contextConf.name));
21503
21504
  var includesComputed = Array.from(dependencyMap.values()).some(stats => stats.includesComputed);
21504
21505
  var scheduleAsSerial = includesComputed;
@@ -21530,7 +21531,7 @@
21530
21531
 
21531
21532
  if (dependencyMap.size > 0) {
21532
21533
  // This will throw if circular contexts detected.
21533
- detectCircularContexts(dependencyMap);
21534
+ detectCircularContexts(dependencyMap, keyword);
21534
21535
  scheduleAsSerial = true;
21535
21536
  scheduleNext();
21536
21537
  }
@@ -21544,6 +21545,7 @@
21544
21545
  }
21545
21546
 
21546
21547
  function getDependencyMapOfContext(contextConfs) {
21548
+ var keyword = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "CTX";
21547
21549
  var depsMap = new Map();
21548
21550
 
21549
21551
  for (var _contextConf2 of contextConfs) {
@@ -21553,7 +21555,7 @@
21553
21555
  };
21554
21556
 
21555
21557
  if (!_contextConf2.property) {
21556
- visitStoryboardExpressions([_contextConf2.if, _contextConf2.value, _contextConf2.resolve], beforeVisitContextFactory(stats), CTX);
21558
+ visitStoryboardExpressions([_contextConf2.if, _contextConf2.value, _contextConf2.resolve], beforeVisitContextFactory(stats, keyword), keyword);
21557
21559
  }
21558
21560
 
21559
21561
  depsMap.set(_contextConf2, stats);
@@ -21562,9 +21564,9 @@
21562
21564
  return depsMap;
21563
21565
  }
21564
21566
 
21565
- function beforeVisitContextFactory(stats) {
21567
+ function beforeVisitContextFactory(stats, keyword) {
21566
21568
  return function beforeVisitContext(node, parent) {
21567
- if (node.name === CTX) {
21569
+ if (node.name === keyword) {
21568
21570
  var memberParent = parent[parent.length - 1];
21569
21571
 
21570
21572
  if ((memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object") {
@@ -21587,7 +21589,7 @@
21587
21589
  };
21588
21590
  }
21589
21591
 
21590
- function detectCircularContexts(dependencyMap) {
21592
+ function detectCircularContexts(dependencyMap, keyword) {
21591
21593
  var duplicatedMap = new Map(dependencyMap);
21592
21594
  var pendingDeps = new Set(Array.from(duplicatedMap.keys()).map(contextConf => contextConf.name));
21593
21595
 
@@ -21610,7 +21612,7 @@
21610
21612
  next();
21611
21613
 
21612
21614
  if (duplicatedMap.size > 0) {
21613
- throw new ReferenceError("Circular CTX detected: ".concat(Array.from(duplicatedMap.keys()).map(contextConf => contextConf.name).join(", ")));
21615
+ throw new ReferenceError("Circular ".concat(keyword, " detected: ").concat(Array.from(duplicatedMap.keys()).map(contextConf => contextConf.name).join(", ")));
21614
21616
  }
21615
21617
  }
21616
21618