@player-ui/metrics-plugin 0.8.0-next.4 → 0.8.0-next.6

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.
@@ -1354,8 +1354,16 @@ var MetricsPlugin = function() {
1354
1354
  }
1355
1355
  return targetMap;
1356
1356
  };
1357
- var hasAsync = function hasAsync(obj) {
1358
- return Object.prototype.hasOwnProperty.call(obj, "async");
1357
+ var hasTemplateValues = function hasTemplateValues(obj, localKey) {
1358
+ return Object.hasOwnProperty.call(obj, "template") && Array.isArray(obj === null || obj === void 0 ? void 0 : obj.template) && obj.template.length && obj.template.find(function(tmpl) {
1359
+ return tmpl.output === localKey;
1360
+ });
1361
+ };
1362
+ var hasSwitchKey = function hasSwitchKey(localKey) {
1363
+ return localKey === "staticSwitch" || localKey === "dynamicSwitch";
1364
+ };
1365
+ var hasTemplateKey = function hasTemplateKey(localKey) {
1366
+ return localKey === "template";
1359
1367
  };
1360
1368
  var getNodeID = function getNodeID(node) {
1361
1369
  var _node_value;
@@ -1645,7 +1653,7 @@ var MetricsPlugin = function() {
1645
1653
  exports.merge = merge;
1646
1654
  exports.mergeDeep = mergeDeep;
1647
1655
  exports.mergeIn = mergeIn;
1648
- exports.omit = omit4;
1656
+ exports.omit = omit3;
1649
1657
  exports.addDefaults = addDefaults;
1650
1658
  exports.default = void 0;
1651
1659
  var INVALID_ARGS = "INVALID_ARGS";
@@ -1819,7 +1827,7 @@ var MetricsPlugin = function() {
1819
1827
  }
1820
1828
  return setIn9(a, path, nextVal);
1821
1829
  }
1822
- function omit4(obj, attrs) {
1830
+ function omit3(obj, attrs) {
1823
1831
  var omitList = Array.isArray(attrs) ? attrs : [
1824
1832
  attrs
1825
1833
  ];
@@ -1905,7 +1913,7 @@ var MetricsPlugin = function() {
1905
1913
  merge: merge,
1906
1914
  mergeDeep: mergeDeep,
1907
1915
  mergeIn: mergeIn,
1908
- omit: omit4,
1916
+ omit: omit3,
1909
1917
  addDefaults: addDefaults
1910
1918
  };
1911
1919
  var _default = timm;
@@ -4366,7 +4374,6 @@ var MetricsPlugin = function() {
4366
4374
  * If undefined, the original value is used.
4367
4375
  * If null, we ignore this node all together
4368
4376
  */ onCreateASTNode: new SyncWaterfallHook(),
4369
- determineNodeType: new SyncBailHook(),
4370
4377
  parseNode: new SyncBailHook()
4371
4378
  };
4372
4379
  }
@@ -4381,21 +4388,6 @@ var MetricsPlugin = function() {
4381
4388
  return viewNode;
4382
4389
  }
4383
4390
  },
4384
- {
4385
- key: "parseAsync",
4386
- value: function parseAsync(obj, type, options) {
4387
- var parsedAsync = this.parseObject((0, import_timm5.omit)(obj, "async"), type, options);
4388
- var parsedNodeId = getNodeID(parsedAsync);
4389
- if (parsedAsync !== null && parsedNodeId) {
4390
- return this.createASTNode({
4391
- id: parsedNodeId,
4392
- type: "async",
4393
- value: parsedAsync
4394
- }, obj);
4395
- }
4396
- return null;
4397
- }
4398
- },
4399
4391
  {
4400
4392
  key: "createASTNode",
4401
4393
  value: function createASTNode(node, value) {
@@ -4406,25 +4398,6 @@ var MetricsPlugin = function() {
4406
4398
  return tapped;
4407
4399
  }
4408
4400
  },
4409
- {
4410
- /**
4411
- * Checks if there are templated values in the object
4412
- *
4413
- * @param obj - The Parsed Object to check to see if we have a template array type for
4414
- * @param localKey - The key being checked
4415
- */ key: "hasTemplateValues",
4416
- value: function hasTemplateValues(obj, localKey) {
4417
- return Object.hasOwnProperty.call(obj, "template") && Array.isArray(obj === null || obj === void 0 ? void 0 : obj.template) && obj.template.length && obj.template.find(function(tmpl) {
4418
- return tmpl.output === localKey;
4419
- });
4420
- }
4421
- },
4422
- {
4423
- key: "hasSwitchKey",
4424
- value: function hasSwitchKey(localKey) {
4425
- return localKey === "staticSwitch";
4426
- }
4427
- },
4428
4401
  {
4429
4402
  key: "parseObject",
4430
4403
  value: function parseObject(obj) {
@@ -4432,12 +4405,9 @@ var MetricsPlugin = function() {
4432
4405
  templateDepth: 0
4433
4406
  };
4434
4407
  var _this = this;
4435
- var nodeType = this.hooks.determineNodeType.call(obj);
4436
- if (nodeType !== void 0) {
4437
- var parsedNode = this.hooks.parseNode.call(obj, type, options, nodeType);
4438
- if (parsedNode) {
4439
- return parsedNode;
4440
- }
4408
+ var parsedNode = this.hooks.parseNode.call(obj, type, options);
4409
+ if (parsedNode || parsedNode === null) {
4410
+ return parsedNode;
4441
4411
  }
4442
4412
  var parseLocalObject = function(currentValue, objToParse) {
4443
4413
  var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
@@ -4467,166 +4437,42 @@ var MetricsPlugin = function() {
4467
4437
  value: currentValue
4468
4438
  };
4469
4439
  var newValue = objEntries.reduce(function(accumulation, current) {
4470
- var children2 = accumulation.children, rest = _object_without_properties(accumulation, [
4471
- "children"
4472
- ]);
4440
+ var value2 = accumulation.value;
4441
+ var children2 = accumulation.children;
4473
4442
  var _current = _sliced_to_array(current, 2), localKey = _current[0], localValue = _current[1];
4474
- if (localKey === "asset" && typeof localValue === "object") {
4475
- var assetAST = _this.parseObject(localValue, "asset", options);
4476
- if (assetAST) {
4477
- return _object_spread_props(_object_spread({}, rest), {
4478
- children: _to_consumable_array(children2).concat([
4479
- {
4480
- path: _to_consumable_array(path).concat([
4481
- "asset"
4482
- ]),
4483
- value: assetAST
4484
- }
4485
- ])
4486
- });
4487
- }
4488
- } else if (_this.hooks.determineNodeType.call(localKey) === "template" && Array.isArray(localValue)) {
4489
- var templateChildren = localValue.map(function(template) {
4490
- var _options_templateDepth, _template_dynamic;
4491
- var templateAST = _this.hooks.onCreateASTNode.call({
4492
- type: "template",
4493
- depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
4494
- data: template.data,
4495
- template: template.value,
4496
- dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
4497
- }, template);
4498
- if ((templateAST === null || templateAST === void 0 ? void 0 : templateAST.type) === "multi-node") {
4499
- templateAST.values.forEach(function(v) {
4500
- v.parent = templateAST;
4501
- });
4502
- }
4503
- if (templateAST) {
4504
- return {
4505
- path: _to_consumable_array(path).concat([
4506
- template.output
4507
- ]),
4508
- value: templateAST
4509
- };
4510
- }
4511
- return;
4512
- }).filter(function(element) {
4513
- return !!element;
4514
- });
4515
- return _object_spread_props(_object_spread({}, rest), {
4516
- children: _to_consumable_array(children2).concat(_to_consumable_array(templateChildren))
4517
- });
4518
- } else if (localValue && _this.hooks.determineNodeType.call(localValue) === "switch" || _this.hasSwitchKey(localKey)) {
4519
- var _localSwitch_children;
4520
- var localSwitch = _this.hooks.parseNode.call(_this.hasSwitchKey(localKey) ? _define_property({}, localKey, localValue) : localValue, "value", options, "switch");
4521
- if (localSwitch && localSwitch.type === "value" && ((_localSwitch_children = localSwitch.children) === null || _localSwitch_children === void 0 ? void 0 : _localSwitch_children.length) === 1 && localSwitch.value === void 0) {
4522
- var firstChild = localSwitch.children[0];
4523
- return _object_spread_props(_object_spread({}, rest), {
4524
- children: _to_consumable_array(children2).concat([
4525
- {
4526
- path: _to_consumable_array(path).concat([
4527
- localKey
4528
- ], _to_consumable_array(firstChild.path)),
4529
- value: firstChild.value
4530
- }
4531
- ])
4532
- });
4533
- }
4534
- if (localSwitch) {
4535
- return _object_spread_props(_object_spread({}, rest), {
4536
- children: _to_consumable_array(children2).concat([
4537
- {
4538
- path: _to_consumable_array(path).concat([
4539
- localKey
4540
- ]),
4541
- value: localSwitch
4542
- }
4543
- ])
4544
- });
4545
- }
4546
- } else if (localValue && hasAsync(localValue)) {
4547
- var localAsync = _this.parseAsync(localValue, "value", options);
4548
- if (localAsync) {
4549
- children2.push({
4550
- path: _to_consumable_array(path).concat([
4551
- localKey
4552
- ]),
4553
- value: localAsync
4554
- });
4555
- }
4556
- } else if (localValue && Array.isArray(localValue)) {
4557
- var childValues = localValue.map(function(childVal) {
4558
- return _this.parseObject(childVal, "value", options);
4559
- }).filter(function(child) {
4560
- return !!child;
4561
- });
4562
- if (childValues.length > 0) {
4563
- var multiNode = _this.hooks.onCreateASTNode.call({
4564
- type: "multi-node",
4565
- override: !_this.hasTemplateValues(localObj, localKey),
4566
- values: childValues
4567
- }, localValue);
4568
- if ((multiNode === null || multiNode === void 0 ? void 0 : multiNode.type) === "multi-node") {
4569
- multiNode.values.forEach(function(v) {
4570
- v.parent = multiNode;
4571
- });
4572
- }
4573
- if (multiNode) {
4574
- return _object_spread_props(_object_spread({}, rest), {
4575
- children: _to_consumable_array(children2).concat([
4576
- {
4577
- path: _to_consumable_array(path).concat([
4578
- localKey
4579
- ]),
4580
- value: multiNode
4581
- }
4582
- ])
4583
- });
4584
- }
4585
- }
4443
+ var newChildren = _this.hooks.parseNode.call(localValue, "value", options, {
4444
+ path: path,
4445
+ key: localKey,
4446
+ parentObj: localObj
4447
+ });
4448
+ if (newChildren) {
4449
+ var _children2;
4450
+ (_children2 = children2).push.apply(_children2, _to_consumable_array(newChildren));
4586
4451
  } else if (localValue && typeof localValue === "object") {
4587
- var determineNodeType = _this.hooks.determineNodeType.call(localValue);
4588
- if (determineNodeType === "applicability") {
4589
- var parsedNode = _this.hooks.parseNode.call(localValue, "value", options, determineNodeType);
4590
- if (parsedNode) {
4591
- return _object_spread_props(_object_spread({}, rest), {
4592
- children: _to_consumable_array(children2).concat([
4593
- {
4594
- path: _to_consumable_array(path).concat([
4595
- localKey
4596
- ]),
4597
- value: parsedNode
4598
- }
4599
- ])
4600
- });
4601
- }
4602
- } else {
4603
- var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
4604
- localKey
4605
- ]));
4606
- return {
4607
- value: result.value,
4608
- children: _to_consumable_array(children2).concat(_to_consumable_array(result.children))
4609
- };
4610
- }
4452
+ var _children21;
4453
+ var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
4454
+ localKey
4455
+ ]));
4456
+ value2 = result.value;
4457
+ (_children21 = children2).push.apply(_children21, _to_consumable_array(result.children));
4611
4458
  } else {
4612
- var value2 = (0, import_timm5.setIn)(accumulation.value, _to_consumable_array(path).concat([
4459
+ value2 = (0, import_timm5.setIn)(accumulation.value, _to_consumable_array(path).concat([
4613
4460
  localKey
4614
4461
  ]), localValue);
4615
- return {
4616
- children: children2,
4617
- value: value2
4618
- };
4619
4462
  }
4620
- return accumulation;
4463
+ return {
4464
+ value: value2,
4465
+ children: children2
4466
+ };
4621
4467
  }, defaultValue);
4622
4468
  return newValue;
4623
4469
  };
4624
4470
  var _parseLocalObject = parseLocalObject(void 0, obj), value = _parseLocalObject.value, children = _parseLocalObject.children;
4625
- var baseAst = value === void 0 && children.length === 0 ? void 0 : {
4471
+ var baseAst = value === void 0 && !children.length ? void 0 : {
4626
4472
  type: type,
4627
4473
  value: value
4628
4474
  };
4629
- if (baseAst !== void 0 && children.length > 0) {
4475
+ if (baseAst && children.length) {
4630
4476
  var parent = baseAst;
4631
4477
  parent.children = children;
4632
4478
  children.forEach(function(child) {
@@ -5114,24 +4960,30 @@ var MetricsPlugin = function() {
5114
4960
  }
5115
4961
  return node;
5116
4962
  });
5117
- parser.hooks.determineNodeType.tap("template", function(obj) {
5118
- if (obj === "template") {
5119
- return "template";
5120
- }
5121
- });
5122
- parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, determinedNodeType) {
5123
- if (determinedNodeType === "template") {
5124
- var _options_templateDepth, _obj_dynamic;
5125
- var templateNode = parser.createASTNode({
5126
- type: "template",
5127
- depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
5128
- data: obj.data,
5129
- template: obj.value,
5130
- dynamic: (_obj_dynamic = obj.dynamic) !== null && _obj_dynamic !== void 0 ? _obj_dynamic : false
5131
- }, obj);
5132
- if (templateNode) {
5133
- return templateNode;
5134
- }
4963
+ parser.hooks.parseNode.tap("template", function(obj, _nodeType, options, childOptions) {
4964
+ if (childOptions && hasTemplateKey(childOptions.key)) {
4965
+ return obj.map(function(template) {
4966
+ var _options_templateDepth, _template_dynamic;
4967
+ var templateAST = parser.createASTNode({
4968
+ type: "template",
4969
+ depth: (_options_templateDepth = options.templateDepth) !== null && _options_templateDepth !== void 0 ? _options_templateDepth : 0,
4970
+ data: template.data,
4971
+ template: template.value,
4972
+ dynamic: (_template_dynamic = template.dynamic) !== null && _template_dynamic !== void 0 ? _template_dynamic : false
4973
+ }, template);
4974
+ if (!templateAST) return;
4975
+ if (templateAST.type === "multi-node") {
4976
+ templateAST.values.forEach(function(v) {
4977
+ v.parent = templateAST;
4978
+ });
4979
+ }
4980
+ return {
4981
+ path: _to_consumable_array(childOptions.path).concat([
4982
+ template.output
4983
+ ]),
4984
+ value: templateAST
4985
+ };
4986
+ }).filter(Boolean);
5135
4987
  }
5136
4988
  });
5137
4989
  }
@@ -5275,6 +5127,12 @@ var MetricsPlugin = function() {
5275
5127
  _class_call_check(this, ApplicabilityPlugin);
5276
5128
  }
5277
5129
  _create_class(ApplicabilityPlugin, [
5130
+ {
5131
+ key: "isApplicability",
5132
+ value: function isApplicability(obj) {
5133
+ return obj && Object.prototype.hasOwnProperty.call(obj, "applicability");
5134
+ }
5135
+ },
5278
5136
  {
5279
5137
  key: "applyResolver",
5280
5138
  value: function applyResolver(resolver) {
@@ -5294,25 +5152,32 @@ var MetricsPlugin = function() {
5294
5152
  {
5295
5153
  key: "applyParser",
5296
5154
  value: function applyParser(parser) {
5297
- parser.hooks.determineNodeType.tap("applicability", function(obj) {
5298
- if (Object.prototype.hasOwnProperty.call(obj, "applicability")) {
5299
- return "applicability";
5300
- }
5301
- });
5302
- parser.hooks.parseNode.tap("applicability", function(obj, nodeType, options, determinedNodeType) {
5303
- if (determinedNodeType === "applicability") {
5155
+ var _this = this;
5156
+ parser.hooks.parseNode.tap("applicability", function(obj, nodeType, options, childOptions) {
5157
+ if (_this.isApplicability(obj)) {
5304
5158
  var parsedApplicability = parser.parseObject((0, import_timm7.omit)(obj, "applicability"), nodeType, options);
5305
- if (parsedApplicability !== null) {
5306
- var applicabilityNode = parser.createASTNode({
5307
- type: "applicability",
5308
- expression: obj.applicability,
5309
- value: parsedApplicability
5310
- }, obj);
5311
- if ((applicabilityNode === null || applicabilityNode === void 0 ? void 0 : applicabilityNode.type) === "applicability") {
5312
- applicabilityNode.value.parent = applicabilityNode;
5313
- }
5314
- return applicabilityNode;
5159
+ if (!parsedApplicability) {
5160
+ return childOptions ? [] : null;
5315
5161
  }
5162
+ var applicabilityNode = parser.createASTNode({
5163
+ type: "applicability",
5164
+ expression: obj.applicability,
5165
+ value: parsedApplicability
5166
+ }, obj);
5167
+ if (!applicabilityNode) {
5168
+ return childOptions ? [] : null;
5169
+ }
5170
+ if (applicabilityNode.type === "applicability") {
5171
+ applicabilityNode.value.parent = applicabilityNode;
5172
+ }
5173
+ return childOptions ? [
5174
+ {
5175
+ path: _to_consumable_array(childOptions.path).concat([
5176
+ childOptions.key
5177
+ ]),
5178
+ value: applicabilityNode
5179
+ }
5180
+ ] : applicabilityNode;
5316
5181
  }
5317
5182
  });
5318
5183
  }
@@ -5362,6 +5227,12 @@ var MetricsPlugin = function() {
5362
5227
  return EMPTY_NODE;
5363
5228
  }
5364
5229
  },
5230
+ {
5231
+ key: "isSwitch",
5232
+ value: function isSwitch(obj) {
5233
+ return obj && (Object.prototype.hasOwnProperty.call(obj, "dynamicSwitch") || Object.prototype.hasOwnProperty.call(obj, "staticSwitch"));
5234
+ }
5235
+ },
5365
5236
  {
5366
5237
  key: "applyParser",
5367
5238
  value: function applyParser(parser) {
@@ -5372,42 +5243,56 @@ var MetricsPlugin = function() {
5372
5243
  }
5373
5244
  return node;
5374
5245
  });
5375
- parser.hooks.determineNodeType.tap("switch", function(obj) {
5376
- if (Object.prototype.hasOwnProperty.call(obj, "dynamicSwitch") || Object.prototype.hasOwnProperty.call(obj, "staticSwitch")) {
5377
- return "switch";
5378
- }
5379
- });
5380
- parser.hooks.parseNode.tap("switch", function(obj, _nodeType, options, determinedNodeType) {
5381
- if (determinedNodeType === "switch") {
5382
- var dynamic = "dynamicSwitch" in obj;
5383
- var switchContent = "dynamicSwitch" in obj ? obj.dynamicSwitch : obj.staticSwitch;
5384
- var cases = [];
5385
- switchContent.forEach(function(switchCase) {
5246
+ parser.hooks.parseNode.tap("switch", function(obj, _nodeType, options, childOptions) {
5247
+ if (_this.isSwitch(obj) || childOptions && hasSwitchKey(childOptions.key)) {
5248
+ var objToParse = childOptions && hasSwitchKey(childOptions.key) ? _define_property({}, childOptions.key, obj) : obj;
5249
+ var dynamic = "dynamicSwitch" in objToParse;
5250
+ var switchContent = dynamic ? objToParse.dynamicSwitch : objToParse.staticSwitch;
5251
+ var cases = switchContent.map(function(switchCase) {
5386
5252
  var switchCaseExpr = switchCase.case, switchBody = _object_without_properties(switchCase, [
5387
5253
  "case"
5388
5254
  ]);
5389
5255
  var value = parser.parseObject(switchBody, "value", options);
5390
5256
  if (value) {
5391
- cases.push({
5257
+ return {
5392
5258
  case: switchCaseExpr,
5393
5259
  value: value
5394
- });
5260
+ };
5395
5261
  }
5396
- });
5397
- var switchAST = parser.hooks.onCreateASTNode.call({
5262
+ return;
5263
+ }).filter(Boolean);
5264
+ var switchAST = parser.createASTNode({
5398
5265
  type: "switch",
5399
5266
  dynamic: dynamic,
5400
5267
  cases: cases
5401
- }, obj);
5402
- if ((switchAST === null || switchAST === void 0 ? void 0 : switchAST.type) === "switch") {
5268
+ }, objToParse);
5269
+ if (!switchAST || switchAST.type === "empty") {
5270
+ return childOptions ? [] : null;
5271
+ }
5272
+ if (switchAST.type === "switch") {
5403
5273
  switchAST.cases.forEach(function(sCase) {
5404
5274
  sCase.value.parent = switchAST;
5405
5275
  });
5406
5276
  }
5407
- if ((switchAST === null || switchAST === void 0 ? void 0 : switchAST.type) === "empty") {
5408
- return null;
5277
+ if (childOptions) {
5278
+ var _switchAST_children;
5279
+ var path = _to_consumable_array(childOptions.path).concat([
5280
+ childOptions.key
5281
+ ]);
5282
+ var value = switchAST;
5283
+ if (switchAST.type === "value" && ((_switchAST_children = switchAST.children) === null || _switchAST_children === void 0 ? void 0 : _switchAST_children.length) === 1 && switchAST.value === void 0) {
5284
+ var firstChild = switchAST.children[0];
5285
+ path = _to_consumable_array(path).concat(_to_consumable_array(firstChild.path));
5286
+ value = firstChild.value;
5287
+ }
5288
+ return [
5289
+ {
5290
+ path: path,
5291
+ value: value
5292
+ }
5293
+ ];
5409
5294
  }
5410
- return switchAST !== null && switchAST !== void 0 ? switchAST : null;
5295
+ return switchAST;
5411
5296
  }
5412
5297
  });
5413
5298
  }
@@ -5434,6 +5319,93 @@ var MetricsPlugin = function() {
5434
5319
  ]);
5435
5320
  return SwitchPlugin;
5436
5321
  }();
5322
+ var MultiNodePlugin = /*#__PURE__*/ function() {
5323
+ function MultiNodePlugin() {
5324
+ _class_call_check(this, MultiNodePlugin);
5325
+ }
5326
+ _create_class(MultiNodePlugin, [
5327
+ {
5328
+ key: "applyParser",
5329
+ value: function applyParser(parser) {
5330
+ parser.hooks.parseNode.tap("multi-node", function(obj, nodeType, options, childOptions) {
5331
+ if (childOptions && !hasTemplateKey(childOptions.key) && Array.isArray(obj)) {
5332
+ var values = obj.map(function(childVal) {
5333
+ return parser.parseObject(childVal, "value", options);
5334
+ }).filter(function(child) {
5335
+ return !!child;
5336
+ });
5337
+ if (!values.length) {
5338
+ return [];
5339
+ }
5340
+ var multiNode = parser.createASTNode({
5341
+ type: "multi-node",
5342
+ override: !hasTemplateValues(childOptions.parentObj, childOptions.key),
5343
+ values: values
5344
+ }, obj);
5345
+ if (!multiNode) {
5346
+ return [];
5347
+ }
5348
+ if (multiNode.type === "multi-node") {
5349
+ multiNode.values.forEach(function(v) {
5350
+ v.parent = multiNode;
5351
+ });
5352
+ }
5353
+ return [
5354
+ {
5355
+ path: _to_consumable_array(childOptions.path).concat([
5356
+ childOptions.key
5357
+ ]),
5358
+ value: multiNode
5359
+ }
5360
+ ];
5361
+ }
5362
+ });
5363
+ }
5364
+ },
5365
+ {
5366
+ key: "apply",
5367
+ value: function apply(view) {
5368
+ view.hooks.parser.tap("multi-node", this.applyParser.bind(this));
5369
+ }
5370
+ }
5371
+ ]);
5372
+ return MultiNodePlugin;
5373
+ }();
5374
+ var AssetPlugin = /*#__PURE__*/ function() {
5375
+ function AssetPlugin() {
5376
+ _class_call_check(this, AssetPlugin);
5377
+ }
5378
+ _create_class(AssetPlugin, [
5379
+ {
5380
+ key: "applyParser",
5381
+ value: function applyParser(parser) {
5382
+ parser.hooks.parseNode.tap("asset", function(obj, nodeType, options, childOptions) {
5383
+ if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && typeof obj === "object") {
5384
+ var assetAST = parser.parseObject(obj, "asset", options);
5385
+ if (!assetAST) {
5386
+ return [];
5387
+ }
5388
+ return [
5389
+ {
5390
+ path: _to_consumable_array(childOptions.path).concat([
5391
+ childOptions.key
5392
+ ]),
5393
+ value: assetAST
5394
+ }
5395
+ ];
5396
+ }
5397
+ });
5398
+ }
5399
+ },
5400
+ {
5401
+ key: "apply",
5402
+ value: function apply(view) {
5403
+ view.hooks.parser.tap("asset", this.applyParser.bind(this));
5404
+ }
5405
+ }
5406
+ ]);
5407
+ return AssetPlugin;
5408
+ }();
5437
5409
  var FlowInstance = /*#__PURE__*/ function() {
5438
5410
  function FlowInstance(id, flow, options) {
5439
5411
  _class_call_check(this, FlowInstance);
@@ -7136,12 +7108,14 @@ var MetricsPlugin = function() {
7136
7108
  player.hooks.viewController.tap(this.name, function(viewController) {
7137
7109
  viewController.hooks.view.tap(_this.name, function(view) {
7138
7110
  var pluginOptions = toNodeResolveOptions(view.resolverOptions);
7111
+ new AssetPlugin().apply(view);
7139
7112
  new SwitchPlugin(pluginOptions).apply(view);
7140
7113
  new ApplicabilityPlugin().apply(view);
7141
7114
  new StringResolverPlugin().apply(view);
7142
7115
  var templatePlugin = new TemplatePlugin(pluginOptions);
7143
7116
  templatePlugin.apply(view);
7144
7117
  view.hooks.onTemplatePluginCreated.call(templatePlugin);
7118
+ new MultiNodePlugin().apply(view);
7145
7119
  });
7146
7120
  });
7147
7121
  }