@reckona/mreact-compiler 0.0.117 → 0.0.118

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.
@@ -278,14 +278,14 @@ function emitClientBoundaryHelper(name: string): string {
278
278
  ` }`,
279
279
  ` return false;`,
280
280
  `}`,
281
- `function ${name}(name, props) {`,
281
+ `function ${name}(name, props, childrenHtml = "") {`,
282
282
  ` const _name = String(name);`,
283
283
  ` const _escapedName = _name.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");`,
284
284
  ` const _props = props ?? {};`,
285
285
  ` const _nonSerializable = ${propsHelperName}(_props);`,
286
286
  ` const _nonSerializableAttr = _nonSerializable ? ' data-mreact-client-boundary-nonserializable="true"' : "";`,
287
287
  ` const _json = (JSON.stringify(_props) ?? "{}").replaceAll("<", "\\\\u003c");`,
288
- ` return \`<template data-mreact-client-boundary="\${_escapedName}"\${_nonSerializableAttr}></template><script type="application/json" data-mreact-client-boundary-props="\${_escapedName}">\${_json}</script>\`;`,
288
+ ` return \`<template data-mreact-client-boundary="\${_escapedName}"\${_nonSerializableAttr}></template>\${childrenHtml}<script type="application/json" data-mreact-client-boundary-props="\${_escapedName}">\${_json}</script>\`;`,
289
289
  `}`,
290
290
  ].join("\n");
291
291
  }
@@ -1408,9 +1408,9 @@ function collectHtmlParts(
1408
1408
  kind: "raw-dynamic",
1409
1409
  code: `${helperName}(${stringLiteral(node.name)}, ${emitPropsObject(
1410
1410
  node.props,
1411
- node.children,
1411
+ [],
1412
1412
  escapeHelperName,
1413
- )})`,
1413
+ )}, ${emitHtmlExpressionFromChildren(node.children, escapeHelperName)})`,
1414
1414
  },
1415
1415
  ];
1416
1416
  }
@@ -524,7 +524,7 @@ function collectHtmlStatements(
524
524
  return [
525
525
  `${outVar} += ${helperName}(${stringLiteral(node.name)}, ${emitPropsObject(
526
526
  node.props,
527
- node.children,
527
+ [],
528
528
  escapeHelperName,
529
529
  escapeBatchHelperName,
530
530
  asyncComponentNames,
@@ -532,7 +532,7 @@ function collectHtmlStatements(
532
532
  contextProviderHelperName,
533
533
  contextConsumerHelperName,
534
534
  reactNodeRenderHelperName,
535
- )});`,
535
+ )}, ${emitHtmlExpressionFromChildren(node.children, escapeHelperName, escapeBatchHelperName, asyncComponentNames, dynamicAttributes, contextProviderHelperName, contextConsumerHelperName, reactNodeRenderHelperName)});`,
536
536
  ];
537
537
  }
538
538
 
@@ -803,7 +803,7 @@ function collectHtmlParts(
803
803
  return [
804
804
  `${helperName}(${stringLiteral(node.name)}, ${emitPropsObject(
805
805
  node.props,
806
- node.children,
806
+ [],
807
807
  escapeHelperName,
808
808
  escapeBatchHelperName,
809
809
  asyncComponentNames,
@@ -811,7 +811,7 @@ function collectHtmlParts(
811
811
  contextProviderHelperName,
812
812
  contextConsumerHelperName,
813
813
  reactNodeRenderHelperName,
814
- )})`,
814
+ )}, ${emitHtmlExpressionFromChildren(node.children, escapeHelperName, escapeBatchHelperName, asyncComponentNames, dynamicAttributes, contextProviderHelperName, contextConsumerHelperName, reactNodeRenderHelperName)})`,
815
815
  ];
816
816
  }
817
817
 
@@ -1632,14 +1632,14 @@ function emitClientBoundaryHelper(name: string): string {
1632
1632
  ` }`,
1633
1633
  ` return false;`,
1634
1634
  `}`,
1635
- `function ${name}(name, props) {`,
1635
+ `function ${name}(name, props, childrenHtml = "") {`,
1636
1636
  ` const _name = String(name);`,
1637
1637
  ` const _escapedName = _name.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");`,
1638
1638
  ` const _props = props ?? {};`,
1639
1639
  ` const _nonSerializable = ${propsHelperName}(_props);`,
1640
1640
  ` const _nonSerializableAttr = _nonSerializable ? ' data-mreact-client-boundary-nonserializable="true"' : "";`,
1641
1641
  ` const _json = (JSON.stringify(_props) ?? "{}").replaceAll("<", "\\\\u003c");`,
1642
- ` return \`<template data-mreact-client-boundary="\${_escapedName}"\${_nonSerializableAttr}></template><script type="application/json" data-mreact-client-boundary-props="\${_escapedName}">\${_json}</script>\`;`,
1642
+ ` return \`<template data-mreact-client-boundary="\${_escapedName}"\${_nonSerializableAttr}></template>\${childrenHtml}<script type="application/json" data-mreact-client-boundary-props="\${_escapedName}">\${_json}</script>\`;`,
1643
1643
  `}`,
1644
1644
  ].join("\n");
1645
1645
  }