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

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,15 @@ 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
+ }
4476
4488
  var withContext = function(model) {
4477
4489
  return {
4478
4490
  get: function(binding, options) {
@@ -4595,7 +4607,7 @@ var AsyncNodePlugin = function() {
4595
4607
  key: "computeTree",
4596
4608
  value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
4597
4609
  var _this = this;
4598
- var _partiallyResolvedParent_parent;
4610
+ var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
4599
4611
  var dependencyModel = new DependencyModel(options.data.model);
4600
4612
  dependencyModel.trackSubset("core");
4601
4613
  var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
@@ -4621,7 +4633,8 @@ var AsyncNodePlugin = function() {
4621
4633
  var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4622
4634
  type: "empty"
4623
4635
  };
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";
4636
+ 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");
4637
+ 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
4638
  if (previousResult && shouldUseLastValue) {
4626
4639
  var update2 = _object_spread_props(_object_spread({}, previousResult), {
4627
4640
  updated: false
@@ -4655,7 +4668,11 @@ var AsyncNodePlugin = function() {
4655
4668
  repopulateASTMapFromCache(previousResult, node, rawParent);
4656
4669
  return update2;
4657
4670
  }
4658
- resolvedAST.parent = partiallyResolvedParent;
4671
+ if (isNestedMultiNodeWithAsync) {
4672
+ resolvedAST.parent = partiallyResolvedParent.parent;
4673
+ } else {
4674
+ resolvedAST.parent = partiallyResolvedParent;
4675
+ }
4659
4676
  resolveOptions.node = resolvedAST;
4660
4677
  this.ASTMap.set(resolvedAST, node);
4661
4678
  var resolved = this.hooks.resolve.call(void 0, resolvedAST, resolveOptions);
@@ -4693,7 +4710,11 @@ var AsyncNodePlugin = function() {
4693
4710
  var newValues = resolvedAST.values.map(function(mValue) {
4694
4711
  var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
4695
4712
  if (mTree.value !== void 0 && mTree.value !== null) {
4696
- childValue.push(mTree.value);
4713
+ if (mValue.type === "async" && mValue.flatten && mTree.value.asset && Array.isArray(mTree.value.asset.values)) {
4714
+ unpackAndPush(mTree.value, childValue);
4715
+ } else {
4716
+ childValue.push(mTree.value);
4717
+ }
4697
4718
  }
4698
4719
  mTree.dependencies.forEach(function(bindingDep) {
4699
4720
  return childDependencies.add(bindingDep);
@@ -4848,6 +4869,112 @@ var AsyncNodePlugin = function() {
4848
4869
  ]);
4849
4870
  return ViewInstance;
4850
4871
  }();
4872
+ var Builder = /*#__PURE__*/ function() {
4873
+ function _Builder() {
4874
+ _class_call_check(this, _Builder);
4875
+ }
4876
+ _create_class(_Builder, null, [
4877
+ {
4878
+ key: "asset",
4879
+ value: /**
4880
+ * Creates an asset node
4881
+ *
4882
+ * @param value - the value to put in the asset node
4883
+ */ function asset(value) {
4884
+ return {
4885
+ type: "asset",
4886
+ value: value
4887
+ };
4888
+ }
4889
+ },
4890
+ {
4891
+ key: "assetWrapper",
4892
+ value: function assetWrapper(value) {
4893
+ var valueNode = _Builder.value();
4894
+ _Builder.addChild(valueNode, "asset", value);
4895
+ return valueNode;
4896
+ }
4897
+ },
4898
+ {
4899
+ key: "value",
4900
+ value: /**
4901
+ * Creates a value node
4902
+ *
4903
+ * @param v - The object to put in the value node
4904
+ */ function value(v) {
4905
+ return {
4906
+ type: "value",
4907
+ value: v
4908
+ };
4909
+ }
4910
+ },
4911
+ {
4912
+ key: "multiNode",
4913
+ value: /**
4914
+ * Creates a multiNode and associates the multiNode as the parent
4915
+ * of all the value nodes
4916
+ *
4917
+ * @param values - the value, applicability or async nodes to put in the multinode
4918
+ */ function multiNode() {
4919
+ for(var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++){
4920
+ values[_key] = arguments[_key];
4921
+ }
4922
+ var m = {
4923
+ type: "multi-node",
4924
+ override: true,
4925
+ values: values
4926
+ };
4927
+ values.forEach(function(v) {
4928
+ v.parent = m;
4929
+ });
4930
+ return m;
4931
+ }
4932
+ },
4933
+ {
4934
+ key: "asyncNode",
4935
+ value: /**
4936
+ * Creates an async node
4937
+ *
4938
+ * @param id - the id of async node. It should be identical for each async node
4939
+ */ function asyncNode(id) {
4940
+ var flatten2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
4941
+ return {
4942
+ id: id,
4943
+ type: "async",
4944
+ flatten: flatten2,
4945
+ value: {
4946
+ type: "value",
4947
+ value: {
4948
+ id: id
4949
+ }
4950
+ }
4951
+ };
4952
+ }
4953
+ },
4954
+ {
4955
+ key: "addChild",
4956
+ value: /**
4957
+ * Adds a child node to a node
4958
+ *
4959
+ * @param node - The node to add a child to
4960
+ * @param path - The path at which to add the child
4961
+ * @param child - The child node
4962
+ */ function addChild(node, path, child) {
4963
+ child.parent = node;
4964
+ var newChild = {
4965
+ path: Array.isArray(path) ? path : [
4966
+ path
4967
+ ],
4968
+ value: child
4969
+ };
4970
+ node.children = node.children || [];
4971
+ node.children.push(newChild);
4972
+ return node;
4973
+ }
4974
+ }
4975
+ ]);
4976
+ return _Builder;
4977
+ }();
4851
4978
  var TemplatePlugin = /*#__PURE__*/ function() {
4852
4979
  function TemplatePlugin(options) {
4853
4980
  _class_call_check(this, TemplatePlugin);
@@ -7485,6 +7612,28 @@ var AsyncNodePlugin = function() {
7485
7612
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/index.ts
7486
7613
  var import_queue_microtask2 = __toESM(require_queue_microtask());
7487
7614
  var import_timm10 = __toESM(require_timm());
7615
+ // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/transform.ts
7616
+ var asyncTransform = function(assetId, wrapperAssetType, asset, flatten2) {
7617
+ var id = "async-" + assetId;
7618
+ var asyncNode = Builder.asyncNode(id, flatten2);
7619
+ var multiNode;
7620
+ var assetNode;
7621
+ if (asset) {
7622
+ assetNode = Builder.assetWrapper(asset);
7623
+ multiNode = Builder.multiNode(assetNode, asyncNode);
7624
+ } else {
7625
+ multiNode = Builder.multiNode(asyncNode);
7626
+ }
7627
+ var wrapperAsset = Builder.asset({
7628
+ id: wrapperAssetType + "-" + id,
7629
+ type: wrapperAssetType
7630
+ });
7631
+ Builder.addChild(wrapperAsset, [
7632
+ "values"
7633
+ ], multiNode);
7634
+ return wrapperAsset;
7635
+ };
7636
+ // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/index.ts
7488
7637
  var AsyncNodePlugin = /*#__PURE__*/ function() {
7489
7638
  function AsyncNodePlugin(options) {
7490
7639
  var _this = this;