@player-ui/markdown-plugin 0.14.1 → 0.15.0-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.
@@ -5803,32 +5803,50 @@ var MarkdownPlugin = function() {
5803
5803
  var parseAssetMarkdownContent = // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/markdown/core/src/utils/markdownParser.ts
5804
5804
  function parseAssetMarkdownContent(param) {
5805
5805
  var asset = param.asset, mappers = param.mappers, parser = param.parser;
5806
- var children = fromMarkdown(asset.value).children;
5807
- var isMultiParagraph = children.length > 1;
5808
- if (isMultiParagraph) {
5809
- var value = children.map(function(node2) {
5810
- var transformer2 = transformers[node2.type];
5811
- return transformer2({
5812
- astNode: node2,
5813
- asset: asset,
5814
- mappers: mappers,
5815
- transformers: transformers
5816
- });
5817
- });
5818
- var collection = mappers.collection({
5806
+ var _asset_value;
5807
+ var input = (_asset_value = asset.value) !== null && _asset_value !== void 0 ? _asset_value : "";
5808
+ var children = fromMarkdown(input).children;
5809
+ if (children.length === 0) {
5810
+ var empty = mappers.text({
5819
5811
  originalAsset: asset,
5820
- value: value
5812
+ value: ""
5813
+ });
5814
+ return (parser === null || parser === void 0 ? void 0 : parser(empty, NodeType.Asset)) || null;
5815
+ }
5816
+ var value = children.map(function(node2) {
5817
+ var transformer = transformers[node2.type];
5818
+ if (!transformer) {
5819
+ if (mappers.null) {
5820
+ return mappers === null || mappers === void 0 ? void 0 : mappers.null({
5821
+ originalAsset: asset
5822
+ });
5823
+ } else {
5824
+ return null;
5825
+ }
5826
+ }
5827
+ return transformer({
5828
+ astNode: node2,
5829
+ asset: asset,
5830
+ mappers: mappers,
5831
+ transformers: transformers
5821
5832
  });
5822
- return (parser === null || parser === void 0 ? void 0 : parser(collection, NodeType.Asset)) || null;
5823
- }
5824
- var transformer = transformers[children[0].type];
5825
- var content3 = transformer({
5826
- astNode: children[0],
5827
- asset: asset,
5828
- mappers: mappers,
5829
- transformers: transformers
5833
+ }).filter(function(x) {
5834
+ return x !== null;
5830
5835
  });
5831
- return (parser === null || parser === void 0 ? void 0 : parser(content3, NodeType.Asset)) || null;
5836
+ if (value.length === 1) {
5837
+ var _value = _sliced_to_array(value, 1), first = _value[0];
5838
+ return (parser === null || parser === void 0 ? void 0 : parser(first, NodeType.Asset)) || null;
5839
+ }
5840
+ var collection = mappers.collection({
5841
+ originalAsset: asset,
5842
+ value: value
5843
+ });
5844
+ return (parser === null || parser === void 0 ? void 0 : parser(collection, NodeType.Asset)) || null;
5845
+ };
5846
+ var isMarkdownAssetNode = // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/markdown/core/src/index.ts
5847
+ function isMarkdownAssetNode(node2) {
5848
+ if (node2.type !== NodeType.Asset) return false;
5849
+ return node2.value.type === "markdown";
5832
5850
  };
5833
5851
  var __create = Object.create;
5834
5852
  var __defProp = Object.defineProperty;
@@ -15072,7 +15090,6 @@ var MarkdownPlugin = function() {
15072
15090
  heading: headingTransformer,
15073
15091
  inlineCode: inlineCodeTransformer
15074
15092
  };
15075
- // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/markdown/core/src/index.ts
15076
15093
  var MarkdownPlugin = /*#__PURE__*/ function() {
15077
15094
  function MarkdownPlugin(mappers) {
15078
15095
  _class_call_check(this, MarkdownPlugin);
@@ -15087,8 +15104,10 @@ var MarkdownPlugin = function() {
15087
15104
  player.hooks.view.tap(this.name, function(view) {
15088
15105
  view.hooks.resolver.tap(_this.name, function(resolver2) {
15089
15106
  resolver2.hooks.beforeResolve.tap(_this.name, function(node2, options) {
15090
- if ((node2 === null || node2 === void 0 ? void 0 : node2.type) === NodeType.Asset && node2.value.type === "markdown") {
15091
- var resolvedContent = resolveDataRefsInString(node2.value.value, {
15107
+ if (node2 && isMarkdownAssetNode(node2)) {
15108
+ var _node2_value_value;
15109
+ var rawValue = (_node2_value_value = node2.value.value) !== null && _node2_value_value !== void 0 ? _node2_value_value : "";
15110
+ var resolvedContent = resolveDataRefsInString(rawValue, {
15092
15111
  evaluate: options.evaluate,
15093
15112
  model: options.data.model
15094
15113
  });