@player-ui/async-node-plugin 0.10.5--canary.597.21388 → 0.10.5--canary.623.21604

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.
@@ -2038,6 +2038,9 @@ var AsyncNodePlugin = function() {
2038
2038
  },
2039
2039
  AsyncNodePluginPlugin: function() {
2040
2040
  return AsyncNodePluginPlugin;
2041
+ },
2042
+ asyncTransform: function() {
2043
+ return asyncTransform;
2041
2044
  }
2042
2045
  });
2043
2046
  var InterceptionManager = /*#__PURE__*/ function() {
@@ -4324,18 +4327,18 @@ var AsyncNodePlugin = function() {
4324
4327
  ]);
4325
4328
  return ValidatorRegistry;
4326
4329
  }();
4327
- var NodeType = /* @__PURE__ */ function(NodeType2) {
4328
- NodeType2["Asset"] = "asset";
4329
- NodeType2["View"] = "view";
4330
- NodeType2["Applicability"] = "applicability";
4331
- NodeType2["Template"] = "template";
4332
- NodeType2["Value"] = "value";
4333
- NodeType2["MultiNode"] = "multi-node";
4334
- NodeType2["Switch"] = "switch";
4335
- NodeType2["Async"] = "async";
4336
- NodeType2["Unknown"] = "unknown";
4337
- NodeType2["Empty"] = "empty";
4338
- return NodeType2;
4330
+ var NodeType = /* @__PURE__ */ function(NodeType22) {
4331
+ NodeType22["Asset"] = "asset";
4332
+ NodeType22["View"] = "view";
4333
+ NodeType22["Applicability"] = "applicability";
4334
+ NodeType22["Template"] = "template";
4335
+ NodeType22["Value"] = "value";
4336
+ NodeType22["MultiNode"] = "multi-node";
4337
+ NodeType22["Switch"] = "switch";
4338
+ NodeType22["Async"] = "async";
4339
+ NodeType22["Unknown"] = "unknown";
4340
+ NodeType22["Empty"] = "empty";
4341
+ return NodeType22;
4339
4342
  }(NodeType || {});
4340
4343
  var EMPTY_NODE = {
4341
4344
  type: "empty"
@@ -4473,6 +4476,33 @@ var AsyncNodePlugin = function() {
4473
4476
  ]);
4474
4477
  return Parser;
4475
4478
  }();
4479
+ function unpackAndPush(item, initial) {
4480
+ if (item.asset.values && Array.isArray(item.asset.values)) {
4481
+ item.asset.values.forEach(function(i) {
4482
+ unpackAndPush(i, initial);
4483
+ });
4484
+ } else {
4485
+ initial.push(item);
4486
+ }
4487
+ }
4488
+ function unpackAndPushNode(item, initial) {
4489
+ if (Array.isArray(item)) {
4490
+ item.forEach(function(node) {
4491
+ var _node_children_, _node_children, _node_children_1, _node_children1;
4492
+ if ("children" in node && ((_node_children = node.children) === null || _node_children === void 0 ? void 0 : (_node_children_ = _node_children[0]) === null || _node_children_ === void 0 ? void 0 : _node_children_.value.type) === "asset" && ((_node_children1 = node.children) === null || _node_children1 === void 0 ? void 0 : (_node_children_1 = _node_children1[0]) === null || _node_children_1 === void 0 ? void 0 : _node_children_1.value).children) {
4493
+ var _node_children__value_children_, _node_children__value_children, _node_children_2, _node_children2;
4494
+ if (((_node_children__value_children = ((_node_children2 = node.children) === null || _node_children2 === void 0 ? void 0 : (_node_children_2 = _node_children2[0]) === null || _node_children_2 === void 0 ? void 0 : _node_children_2.value).children) === null || _node_children__value_children === void 0 ? void 0 : (_node_children__value_children_ = _node_children__value_children[0]) === null || _node_children__value_children_ === void 0 ? void 0 : _node_children__value_children_.value.type) === "multi-node") {
4495
+ var _node_children__value_children_1, _node_children__value_children1, _node_children_3, _node_children3;
4496
+ unpackAndPushNode(((_node_children__value_children1 = ((_node_children3 = node.children) === null || _node_children3 === void 0 ? void 0 : (_node_children_3 = _node_children3[0]) === null || _node_children_3 === void 0 ? void 0 : _node_children_3.value).children) === null || _node_children__value_children1 === void 0 ? void 0 : (_node_children__value_children_1 = _node_children__value_children1[0]) === null || _node_children__value_children_1 === void 0 ? void 0 : _node_children__value_children_1.value).values, initial);
4497
+ }
4498
+ } else {
4499
+ initial.push(node);
4500
+ }
4501
+ });
4502
+ } else {
4503
+ initial.push(item);
4504
+ }
4505
+ }
4476
4506
  var withContext = function(model) {
4477
4507
  return {
4478
4508
  get: function(binding, options) {
@@ -4595,7 +4625,7 @@ var AsyncNodePlugin = function() {
4595
4625
  key: "computeTree",
4596
4626
  value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
4597
4627
  var _this = this;
4598
- var _partiallyResolvedParent_parent;
4628
+ var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
4599
4629
  var dependencyModel = new DependencyModel(options.data.model);
4600
4630
  dependencyModel.trackSubset("core");
4601
4631
  var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
@@ -4621,7 +4651,8 @@ var AsyncNodePlugin = function() {
4621
4651
  var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4622
4652
  type: "empty"
4623
4653
  };
4624
- 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";
4654
+ 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");
4655
+ 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";
4625
4656
  if (previousResult && shouldUseLastValue) {
4626
4657
  var update2 = _object_spread_props(_object_spread({}, previousResult), {
4627
4658
  updated: false
@@ -4655,7 +4686,11 @@ var AsyncNodePlugin = function() {
4655
4686
  repopulateASTMapFromCache(previousResult, node, rawParent);
4656
4687
  return update2;
4657
4688
  }
4658
- resolvedAST.parent = partiallyResolvedParent;
4689
+ if (isNestedMultiNodeWithAsync) {
4690
+ resolvedAST.parent = partiallyResolvedParent.parent;
4691
+ } else {
4692
+ resolvedAST.parent = partiallyResolvedParent;
4693
+ }
4659
4694
  resolveOptions.node = resolvedAST;
4660
4695
  this.ASTMap.set(resolvedAST, node);
4661
4696
  var resolved = this.hooks.resolve.call(void 0, resolvedAST, resolveOptions);
@@ -4690,10 +4725,17 @@ var AsyncNodePlugin = function() {
4690
4725
  } else if (resolvedAST.type === "multi-node") {
4691
4726
  var childValue = [];
4692
4727
  var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
4728
+ var hasAsync = resolvedAST.values.find(function(node2) {
4729
+ return node2.type === "async";
4730
+ });
4693
4731
  var newValues = resolvedAST.values.map(function(mValue) {
4694
4732
  var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
4695
4733
  if (mTree.value !== void 0 && mTree.value !== null) {
4696
- childValue.push(mTree.value);
4734
+ if (mValue.type === "async" && mValue.flatten && mTree.value.asset && Array.isArray(mTree.value.asset.values)) {
4735
+ unpackAndPush(mTree.value, childValue);
4736
+ } else {
4737
+ childValue.push(mTree.value);
4738
+ }
4697
4739
  }
4698
4740
  mTree.dependencies.forEach(function(bindingDep) {
4699
4741
  return childDependencies.add(bindingDep);
@@ -4701,7 +4743,13 @@ var AsyncNodePlugin = function() {
4701
4743
  updated = updated || mTree.updated;
4702
4744
  return mTree.node;
4703
4745
  });
4704
- resolvedAST.values = newValues;
4746
+ if (hasAsync) {
4747
+ var childNodes = [];
4748
+ unpackAndPushNode(newValues, childNodes);
4749
+ resolvedAST.values = childNodes;
4750
+ } else {
4751
+ resolvedAST.values = newValues;
4752
+ }
4705
4753
  resolved = childValue;
4706
4754
  }
4707
4755
  childDependencies.forEach(function(bindingDep) {
@@ -4848,6 +4896,112 @@ var AsyncNodePlugin = function() {
4848
4896
  ]);
4849
4897
  return ViewInstance;
4850
4898
  }();
4899
+ var Builder = /*#__PURE__*/ function() {
4900
+ function _Builder() {
4901
+ _class_call_check(this, _Builder);
4902
+ }
4903
+ _create_class(_Builder, null, [
4904
+ {
4905
+ key: "asset",
4906
+ value: /**
4907
+ * Creates an asset node
4908
+ *
4909
+ * @param value - the value to put in the asset node
4910
+ */ function asset(value) {
4911
+ return {
4912
+ type: "asset",
4913
+ value: value
4914
+ };
4915
+ }
4916
+ },
4917
+ {
4918
+ key: "assetWrapper",
4919
+ value: function assetWrapper(value) {
4920
+ var valueNode = _Builder.value();
4921
+ _Builder.addChild(valueNode, "asset", value);
4922
+ return valueNode;
4923
+ }
4924
+ },
4925
+ {
4926
+ key: "value",
4927
+ value: /**
4928
+ * Creates a value node
4929
+ *
4930
+ * @param v - The object to put in the value node
4931
+ */ function value(v) {
4932
+ return {
4933
+ type: "value",
4934
+ value: v
4935
+ };
4936
+ }
4937
+ },
4938
+ {
4939
+ key: "multiNode",
4940
+ value: /**
4941
+ * Creates a multiNode and associates the multiNode as the parent
4942
+ * of all the value nodes
4943
+ *
4944
+ * @param values - the value, applicability or async nodes to put in the multinode
4945
+ */ function multiNode() {
4946
+ for(var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++){
4947
+ values[_key] = arguments[_key];
4948
+ }
4949
+ var m = {
4950
+ type: "multi-node",
4951
+ override: true,
4952
+ values: values
4953
+ };
4954
+ values.forEach(function(v) {
4955
+ v.parent = m;
4956
+ });
4957
+ return m;
4958
+ }
4959
+ },
4960
+ {
4961
+ key: "asyncNode",
4962
+ value: /**
4963
+ * Creates an async node
4964
+ *
4965
+ * @param id - the id of async node. It should be identical for each async node
4966
+ */ function asyncNode(id) {
4967
+ var flatten2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
4968
+ return {
4969
+ id: id,
4970
+ type: "async",
4971
+ flatten: flatten2,
4972
+ value: {
4973
+ type: "value",
4974
+ value: {
4975
+ id: id
4976
+ }
4977
+ }
4978
+ };
4979
+ }
4980
+ },
4981
+ {
4982
+ key: "addChild",
4983
+ value: /**
4984
+ * Adds a child node to a node
4985
+ *
4986
+ * @param node - The node to add a child to
4987
+ * @param path - The path at which to add the child
4988
+ * @param child - The child node
4989
+ */ function addChild(node, path, child) {
4990
+ child.parent = node;
4991
+ var newChild = {
4992
+ path: Array.isArray(path) ? path : [
4993
+ path
4994
+ ],
4995
+ value: child
4996
+ };
4997
+ node.children = node.children || [];
4998
+ node.children.push(newChild);
4999
+ return node;
5000
+ }
5001
+ }
5002
+ ]);
5003
+ return _Builder;
5004
+ }();
4851
5005
  var TemplatePlugin = /*#__PURE__*/ function() {
4852
5006
  function TemplatePlugin(options) {
4853
5007
  _class_call_check(this, TemplatePlugin);
@@ -7485,6 +7639,28 @@ var AsyncNodePlugin = function() {
7485
7639
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/index.ts
7486
7640
  var import_queue_microtask2 = __toESM(require_queue_microtask());
7487
7641
  var import_timm10 = __toESM(require_timm());
7642
+ // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/transform.ts
7643
+ var asyncTransform = function(assetId, wrapperAssetType, asset, flatten2) {
7644
+ var id = "async-" + assetId;
7645
+ var asyncNode = Builder.asyncNode(id, flatten2);
7646
+ var multiNode;
7647
+ var assetNode;
7648
+ if (asset) {
7649
+ assetNode = Builder.assetWrapper(asset);
7650
+ multiNode = Builder.multiNode(assetNode, asyncNode);
7651
+ } else {
7652
+ multiNode = Builder.multiNode(asyncNode);
7653
+ }
7654
+ var wrapperAsset = Builder.asset({
7655
+ id: wrapperAssetType + "-" + id,
7656
+ type: wrapperAssetType
7657
+ });
7658
+ Builder.addChild(wrapperAsset, [
7659
+ "values"
7660
+ ], multiNode);
7661
+ return wrapperAsset;
7662
+ };
7663
+ // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/index.ts
7488
7664
  var AsyncNodePlugin = /*#__PURE__*/ function() {
7489
7665
  function AsyncNodePlugin(options) {
7490
7666
  var _this = this;