@player-ui/metrics-plugin 0.11.1 → 0.11.2-next.0

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.
@@ -1405,6 +1405,22 @@ var MetricsPlugin = function() {
1405
1405
  }
1406
1406
  });
1407
1407
  };
1408
+ var unpackNode = function unpackNode(item) {
1409
+ var _item_children_, _item_children, _item_children_1, _item_children1;
1410
+ var unpacked = [];
1411
+ if ("children" in item && ((_item_children = item.children) === null || _item_children === void 0 ? void 0 : (_item_children_ = _item_children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.value.type) === "asset" && ((_item_children1 = item.children) === null || _item_children1 === void 0 ? void 0 : (_item_children_1 = _item_children1[0]) === null || _item_children_1 === void 0 ? void 0 : _item_children_1.value).children) {
1412
+ var _item_children__value_children_, _item_children__value_children, _item_children_2, _item_children2;
1413
+ if (((_item_children__value_children = ((_item_children2 = item.children) === null || _item_children2 === void 0 ? void 0 : (_item_children_2 = _item_children2[0]) === null || _item_children_2 === void 0 ? void 0 : _item_children_2.value).children) === null || _item_children__value_children === void 0 ? void 0 : (_item_children__value_children_ = _item_children__value_children[0]) === null || _item_children__value_children_ === void 0 ? void 0 : _item_children__value_children_.value.type) === "multi-node") {
1414
+ var _item_children__value_children_1, _item_children__value_children1, _item_children_3, _item_children3;
1415
+ ((_item_children__value_children1 = ((_item_children3 = item.children) === null || _item_children3 === void 0 ? void 0 : (_item_children_3 = _item_children3[0]) === null || _item_children_3 === void 0 ? void 0 : _item_children_3.value).children) === null || _item_children__value_children1 === void 0 ? void 0 : (_item_children__value_children_1 = _item_children__value_children1[0]) === null || _item_children__value_children_1 === void 0 ? void 0 : _item_children__value_children_1.value).values.forEach(function(value) {
1416
+ unpacked.push(value);
1417
+ });
1418
+ }
1419
+ } else {
1420
+ unpacked.push(item);
1421
+ }
1422
+ return unpacked;
1423
+ };
1408
1424
  var hasSomethingToResolve = function hasSomethingToResolve(str) {
1409
1425
  return bindingResolveLookup(str) || expressionResolveLookup(str);
1410
1426
  };
@@ -4491,15 +4507,6 @@ var MetricsPlugin = function() {
4491
4507
  ]);
4492
4508
  return Parser;
4493
4509
  }();
4494
- function unpackAndPush(item, initial) {
4495
- if (item.asset.values && Array.isArray(item.asset.values)) {
4496
- item.asset.values.forEach(function(i) {
4497
- unpackAndPush(i, initial);
4498
- });
4499
- } else {
4500
- initial.push(item);
4501
- }
4502
- }
4503
4510
  var withContext = function(model) {
4504
4511
  return {
4505
4512
  get: function(binding, options) {
@@ -4622,7 +4629,7 @@ var MetricsPlugin = function() {
4622
4629
  key: "computeTree",
4623
4630
  value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
4624
4631
  var _this = this;
4625
- var _partiallyResolvedParent_parent;
4632
+ var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
4626
4633
  var dependencyModel = new DependencyModel(options.data.model);
4627
4634
  dependencyModel.trackSubset("core");
4628
4635
  var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
@@ -4648,7 +4655,8 @@ var MetricsPlugin = function() {
4648
4655
  var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4649
4656
  type: "empty"
4650
4657
  };
4651
- var isNestedMultiNode = resolvedAST.type === "multi-node" && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent === void 0 ? void 0 : _partiallyResolvedParent_parent.type) === "multi-node" && partiallyResolvedParent.type === "value";
4658
+ var isNestedMultiNodeWithAsync = resolvedAST.type === "multi-node" && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent === void 0 ? void 0 : (_partiallyResolvedParent_parent_parent = _partiallyResolvedParent_parent.parent) === null || _partiallyResolvedParent_parent_parent === void 0 ? void 0 : _partiallyResolvedParent_parent_parent.type) === "multi-node" && partiallyResolvedParent.parent.type === "value" && ((_resolvedAST_parent = resolvedAST.parent) === null || _resolvedAST_parent === void 0 ? void 0 : _resolvedAST_parent.type) === "asset" && resolvedAST.parent.value.id.includes("async");
4659
+ var isNestedMultiNode = resolvedAST.type === "multi-node" && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent1 = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent1 === void 0 ? void 0 : _partiallyResolvedParent_parent1.type) === "multi-node" && partiallyResolvedParent.type === "value";
4652
4660
  if (previousResult && shouldUseLastValue) {
4653
4661
  var update2 = _object_spread_props(_object_spread({}, previousResult), {
4654
4662
  updated: false
@@ -4682,7 +4690,11 @@ var MetricsPlugin = function() {
4682
4690
  repopulateASTMapFromCache(previousResult, node, rawParent);
4683
4691
  return update2;
4684
4692
  }
4685
- resolvedAST.parent = partiallyResolvedParent;
4693
+ if (isNestedMultiNodeWithAsync) {
4694
+ resolvedAST.parent = partiallyResolvedParent.parent;
4695
+ } else {
4696
+ resolvedAST.parent = partiallyResolvedParent;
4697
+ }
4686
4698
  resolveOptions.node = resolvedAST;
4687
4699
  this.ASTMap.set(resolvedAST, node);
4688
4700
  var resolved = this.hooks.resolve.call(void 0, resolvedAST, resolveOptions);
@@ -4717,6 +4729,11 @@ var MetricsPlugin = function() {
4717
4729
  } else if (resolvedAST.type === "multi-node") {
4718
4730
  var childValue = [];
4719
4731
  var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
4732
+ var hasAsync = resolvedAST.values.map(function(value, index) {
4733
+ return value.type === "async" ? index : -1;
4734
+ }).filter(function(index) {
4735
+ return index !== -1;
4736
+ });
4720
4737
  var newValues = resolvedAST.values.map(function(mValue) {
4721
4738
  var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
4722
4739
  if (mTree.value !== void 0 && mTree.value !== null) {
@@ -4732,7 +4749,19 @@ var MetricsPlugin = function() {
4732
4749
  updated = updated || mTree.updated;
4733
4750
  return mTree.node;
4734
4751
  });
4735
- resolvedAST.values = newValues;
4752
+ if (hasAsync.length > 0) {
4753
+ var copy = newValues;
4754
+ hasAsync.forEach(function(index) {
4755
+ var _copy;
4756
+ if (copy[index]) (_copy = copy).splice.apply(_copy, [
4757
+ index,
4758
+ 1
4759
+ ].concat(_to_consumable_array(unpackNode(copy[index]))));
4760
+ });
4761
+ resolvedAST.values = copy;
4762
+ } else {
4763
+ resolvedAST.values = newValues;
4764
+ }
4736
4765
  resolved = childValue;
4737
4766
  }
4738
4767
  childDependencies.forEach(function(bindingDep) {
@@ -4761,6 +4790,15 @@ var MetricsPlugin = function() {
4761
4790
  ]);
4762
4791
  return Resolver;
4763
4792
  }();
4793
+ function unpackAndPush(item, initial) {
4794
+ if (item.asset.values && Array.isArray(item.asset.values)) {
4795
+ item.asset.values.forEach(function(i) {
4796
+ unpackAndPush(i, initial);
4797
+ });
4798
+ } else {
4799
+ initial.push(item);
4800
+ }
4801
+ }
4764
4802
  var CrossfieldProvider = /*#__PURE__*/ function() {
4765
4803
  function CrossfieldProvider(initialView, parser, logger) {
4766
4804
  _class_call_check(this, CrossfieldProvider);