@player-ui/reference-assets-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.
@@ -1497,6 +1497,22 @@ var ReferenceAssetsPlugin = function() {
1497
1497
  }
1498
1498
  });
1499
1499
  };
1500
+ var unpackNode = function unpackNode(item) {
1501
+ var _item_children_, _item_children, _item_children_1, _item_children1;
1502
+ var unpacked = [];
1503
+ 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) {
1504
+ var _item_children__value_children_, _item_children__value_children, _item_children_2, _item_children2;
1505
+ 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") {
1506
+ var _item_children__value_children_1, _item_children__value_children1, _item_children_3, _item_children3;
1507
+ ((_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) {
1508
+ unpacked.push(value);
1509
+ });
1510
+ }
1511
+ } else {
1512
+ unpacked.push(item);
1513
+ }
1514
+ return unpacked;
1515
+ };
1500
1516
  var hasSomethingToResolve = function hasSomethingToResolve(str) {
1501
1517
  return bindingResolveLookup(str) || expressionResolveLookup(str);
1502
1518
  };
@@ -4690,15 +4706,6 @@ var ReferenceAssetsPlugin = function() {
4690
4706
  ]);
4691
4707
  return Parser;
4692
4708
  }();
4693
- function unpackAndPush(item, initial) {
4694
- if (item.asset.values && Array.isArray(item.asset.values)) {
4695
- item.asset.values.forEach(function(i) {
4696
- unpackAndPush(i, initial);
4697
- });
4698
- } else {
4699
- initial.push(item);
4700
- }
4701
- }
4702
4709
  var withContext = function(model) {
4703
4710
  return {
4704
4711
  get: function(binding, options) {
@@ -4821,7 +4828,7 @@ var ReferenceAssetsPlugin = function() {
4821
4828
  key: "computeTree",
4822
4829
  value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
4823
4830
  var _this = this;
4824
- var _partiallyResolvedParent_parent;
4831
+ var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
4825
4832
  var dependencyModel = new DependencyModel(options.data.model);
4826
4833
  dependencyModel.trackSubset("core");
4827
4834
  var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
@@ -4847,7 +4854,8 @@ var ReferenceAssetsPlugin = function() {
4847
4854
  var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4848
4855
  type: "empty"
4849
4856
  };
4850
- 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";
4857
+ 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");
4858
+ 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";
4851
4859
  if (previousResult && shouldUseLastValue) {
4852
4860
  var update2 = _object_spread_props(_object_spread({}, previousResult), {
4853
4861
  updated: false
@@ -4881,7 +4889,11 @@ var ReferenceAssetsPlugin = function() {
4881
4889
  repopulateASTMapFromCache(previousResult, node, rawParent);
4882
4890
  return update2;
4883
4891
  }
4884
- resolvedAST.parent = partiallyResolvedParent;
4892
+ if (isNestedMultiNodeWithAsync) {
4893
+ resolvedAST.parent = partiallyResolvedParent.parent;
4894
+ } else {
4895
+ resolvedAST.parent = partiallyResolvedParent;
4896
+ }
4885
4897
  resolveOptions.node = resolvedAST;
4886
4898
  this.ASTMap.set(resolvedAST, node);
4887
4899
  var resolved = this.hooks.resolve.call(void 0, resolvedAST, resolveOptions);
@@ -4916,6 +4928,11 @@ var ReferenceAssetsPlugin = function() {
4916
4928
  } else if (resolvedAST.type === "multi-node") {
4917
4929
  var childValue = [];
4918
4930
  var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
4931
+ var hasAsync = resolvedAST.values.map(function(value, index) {
4932
+ return value.type === "async" ? index : -1;
4933
+ }).filter(function(index) {
4934
+ return index !== -1;
4935
+ });
4919
4936
  var newValues = resolvedAST.values.map(function(mValue) {
4920
4937
  var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
4921
4938
  if (mTree.value !== void 0 && mTree.value !== null) {
@@ -4931,7 +4948,19 @@ var ReferenceAssetsPlugin = function() {
4931
4948
  updated = updated || mTree.updated;
4932
4949
  return mTree.node;
4933
4950
  });
4934
- resolvedAST.values = newValues;
4951
+ if (hasAsync.length > 0) {
4952
+ var copy = newValues;
4953
+ hasAsync.forEach(function(index) {
4954
+ var _copy;
4955
+ if (copy[index]) (_copy = copy).splice.apply(_copy, [
4956
+ index,
4957
+ 1
4958
+ ].concat(_to_consumable_array(unpackNode(copy[index]))));
4959
+ });
4960
+ resolvedAST.values = copy;
4961
+ } else {
4962
+ resolvedAST.values = newValues;
4963
+ }
4935
4964
  resolved = childValue;
4936
4965
  }
4937
4966
  childDependencies.forEach(function(bindingDep) {
@@ -4960,6 +4989,15 @@ var ReferenceAssetsPlugin = function() {
4960
4989
  ]);
4961
4990
  return Resolver;
4962
4991
  }();
4992
+ function unpackAndPush(item, initial) {
4993
+ if (item.asset.values && Array.isArray(item.asset.values)) {
4994
+ item.asset.values.forEach(function(i) {
4995
+ unpackAndPush(i, initial);
4996
+ });
4997
+ } else {
4998
+ initial.push(item);
4999
+ }
5000
+ }
4963
5001
  var CrossfieldProvider = /*#__PURE__*/ function() {
4964
5002
  function CrossfieldProvider(initialView, parser, logger) {
4965
5003
  _class_call_check(this, CrossfieldProvider);