@zeus-js/compiler 0.0.2 → 0.1.0-beta.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * compiler v0.0.2
2
+ * compiler v0.1.0-beta.0
3
3
  * (c) 2026 baicie
4
4
  * Released under the MIT License.
5
5
  **/
@@ -7,7 +7,7 @@ import { declare } from "@babel/helper-plugin-utils";
7
7
  import syntaxJsx from "@babel/plugin-syntax-jsx";
8
8
  import { extend } from "@zeus-js/shared";
9
9
  import * as t from "@babel/types";
10
- //#region packages/compiler/src/codegen/support/imports.ts
10
+ //#region packages/core/compiler/src/codegen/support/imports.ts
11
11
  /**
12
12
  * Runtime helpers registration and program injection.
13
13
  *
@@ -65,7 +65,7 @@ function getProgramPath(path) {
65
65
  return path.scope.getProgramParent().path;
66
66
  }
67
67
  //#endregion
68
- //#region packages/compiler/src/codegen/support/templates.ts
68
+ //#region packages/core/compiler/src/codegen/support/templates.ts
69
69
  /**
70
70
  * Template registration, scope data management, and program injection.
71
71
  *
@@ -109,7 +109,7 @@ function appendTemplates(path) {
109
109
  path.node.body.unshift(t.variableDeclaration("var", declarators));
110
110
  }
111
111
  //#endregion
112
- //#region packages/compiler/src/codegen/support/events.ts
112
+ //#region packages/core/compiler/src/codegen/support/events.ts
113
113
  /**
114
114
  * Event registration and delegation.
115
115
  *
@@ -139,7 +139,7 @@ function appendEvents(path) {
139
139
  path.node.body.push(t.expressionStatement(t.callExpression(registerImportMethod(path, "delegateEvents", getRendererConfig(path, "dom").moduleName), [t.arrayExpression(Array.from(events).map((eventName) => t.stringLiteral(eventName)))])));
140
140
  }
141
141
  //#endregion
142
- //#region packages/compiler/src/config/index.ts
142
+ //#region packages/core/compiler/src/config/index.ts
143
143
  const DEFAULT_OPTIONS = {
144
144
  moduleName: DEFAULT_RENDERER_MODULE,
145
145
  generate: "dom",
@@ -167,7 +167,7 @@ function resolveConfig(options) {
167
167
  return extend(DEFAULT_OPTIONS, options);
168
168
  }
169
169
  //#endregion
170
- //#region packages/compiler/src/utils/constant.ts
170
+ //#region packages/core/compiler/src/utils/constant.ts
171
171
  const VoidElements = [
172
172
  "area",
173
173
  "base",
@@ -187,7 +187,7 @@ const VoidElements = [
187
187
  "wbr"
188
188
  ];
189
189
  //#endregion
190
- //#region packages/compiler/src/utils/html.ts
190
+ //#region packages/core/compiler/src/utils/html.ts
191
191
  function escapeHTML(value, attr = false) {
192
192
  let result = value.replace(/&/g, "&");
193
193
  if (attr) return result.replace(/"/g, """).replace(/>/g, ">");
@@ -206,14 +206,14 @@ function isRawTextElement(tagName) {
206
206
  return rawTextElements.has(tagName);
207
207
  }
208
208
  //#endregion
209
- //#region packages/compiler/src/utils/metadata.ts
209
+ //#region packages/core/compiler/src/utils/metadata.ts
210
210
  function setZeusMetadata(state, config) {
211
211
  const metadata = state.file.metadata;
212
212
  metadata.zeus = extend({}, metadata.zeus, { config });
213
213
  return metadata.zeus;
214
214
  }
215
215
  //#endregion
216
- //#region packages/compiler/src/program.ts
216
+ //#region packages/core/compiler/src/program.ts
217
217
  /**
218
218
  * Program visitor — entry and exit point for the entire transform pass.
219
219
  *
@@ -240,7 +240,7 @@ function createProgramVisitor(config) {
240
240
  };
241
241
  }
242
242
  //#endregion
243
- //#region packages/compiler/src/codegen/dom/emitBinding.ts
243
+ //#region packages/core/compiler/src/codegen/dom/emitBinding.ts
244
244
  function emitBindings(node, context) {
245
245
  const statements = [];
246
246
  for (const attr of node.attrs) {
@@ -363,7 +363,7 @@ function emitMarkerMount(node, context, mountCall) {
363
363
  return [t.expressionStatement(mountCall)];
364
364
  }
365
365
  //#endregion
366
- //#region packages/compiler/src/codegen/dom/emitDomPath.ts
366
+ //#region packages/core/compiler/src/codegen/dom/emitDomPath.ts
367
367
  function emitPhysicalDomPath(path) {
368
368
  switch (path.kind) {
369
369
  case "Root": throw new Error("Root path is emitted from template clone directly");
@@ -373,7 +373,7 @@ function emitPhysicalDomPath(path) {
373
373
  }
374
374
  }
375
375
  //#endregion
376
- //#region packages/compiler/src/passes/collectTemplates.ts
376
+ //#region packages/core/compiler/src/passes/collectTemplates.ts
377
377
  function collectTemplates(node, context) {
378
378
  if (node.kind === "Element") {
379
379
  context.registerTemplate(renderTemplateHTML(node), node.flags.isSVG);
@@ -414,7 +414,7 @@ function renderChildTemplate(node) {
414
414
  case "Show":
415
415
  case "For":
416
416
  case "Slot": return "<!>";
417
- case "Host": return node.children.map(renderChildTemplate).join("");
417
+ case "Host": return node.child ? renderChildTemplate(node.child) : "";
418
418
  case "Fragment": return node.children.map(renderChildTemplate).join("");
419
419
  }
420
420
  }
@@ -422,7 +422,7 @@ function escapeAttr(value) {
422
422
  return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
423
423
  }
424
424
  //#endregion
425
- //#region packages/compiler/src/codegen/dom/emitTemplate.ts
425
+ //#region packages/core/compiler/src/codegen/dom/emitTemplate.ts
426
426
  function emitTemplateClone(node, context) {
427
427
  const html = renderTemplateHTML(node);
428
428
  const template = context.registerTemplate(html, node.flags.isSVG);
@@ -430,7 +430,7 @@ function emitTemplateClone(node, context) {
430
430
  return t.memberExpression(templateCall, t.identifier("firstChild"));
431
431
  }
432
432
  //#endregion
433
- //#region packages/compiler/src/codegen/dom/emitElement.ts
433
+ //#region packages/core/compiler/src/codegen/dom/emitElement.ts
434
434
  function emitElement(node, context) {
435
435
  if (!hasRuntimeWork(node)) return emitTemplateClone(node, context);
436
436
  const statements = [
@@ -470,7 +470,7 @@ function collectRefNode(node, map) {
470
470
  for (const child of node.children) collectRefNode(child, map);
471
471
  return;
472
472
  case "Host":
473
- for (const child of node.children) collectRefNode(child, map);
473
+ if (node.child) collectRefNode(node.child, map);
474
474
  return;
475
475
  default: return;
476
476
  }
@@ -492,7 +492,7 @@ function collectRequiredDomRefDeclaration(node, statements, context, refNodeMap,
492
492
  for (const child of node.children) collectRequiredDomRefDeclaration(child, statements, context, refNodeMap, declared);
493
493
  return;
494
494
  case "Host":
495
- for (const child of node.children) collectRequiredDomRefDeclaration(child, statements, context, refNodeMap, declared);
495
+ if (node.child) collectRequiredDomRefDeclaration(node.child, statements, context, refNodeMap, declared);
496
496
  return;
497
497
  default: return;
498
498
  }
@@ -539,11 +539,18 @@ function needsDomRefDeclaration(node) {
539
539
  case "Slot": return true;
540
540
  case "Element": return needsDomRefDeclaration(child);
541
541
  case "Fragment": return child.children.some((inner) => inner.kind === "Element" ? needsDomRefDeclaration(inner) : inner.kind !== "Text");
542
- case "Host": return child.children.some((inner) => inner.kind === "Element" ? needsDomRefDeclaration(inner) : inner.kind !== "Text");
542
+ case "Host": return child.child ? innerKind(child.child) : false;
543
543
  default: return false;
544
544
  }
545
545
  });
546
546
  }
547
+ function innerKind(node) {
548
+ switch (node.kind) {
549
+ case "Element": return needsDomRefDeclaration(node);
550
+ case "Text": return false;
551
+ default: return true;
552
+ }
553
+ }
547
554
  function hasRuntimeWork(node) {
548
555
  return node.attrs.some((attr) => attr.kind === "AttrBinding" || attr.kind === "PropBinding" || attr.kind === "EventBinding" || attr.kind === "RefBinding") || node.children.some(hasChildRuntimeWork);
549
556
  }
@@ -555,18 +562,18 @@ function hasChildRuntimeWork(node) {
555
562
  case "For":
556
563
  case "Slot": return true;
557
564
  case "Element": return hasRuntimeWork(node);
558
- case "Fragment":
559
- case "Host": return node.children.some(hasChildRuntimeWork);
565
+ case "Fragment": return node.children.some(hasChildRuntimeWork);
566
+ case "Host": return node.child ? hasChildRuntimeWork(node.child) : false;
560
567
  default: return false;
561
568
  }
562
569
  }
563
570
  //#endregion
564
- //#region packages/compiler/src/codegen/dom/emitFragment.ts
571
+ //#region packages/core/compiler/src/codegen/dom/emitFragment.ts
565
572
  function emitFragment(node, context) {
566
573
  return t.arrayExpression(node.children.map((child) => emitDOM(child, context)));
567
574
  }
568
575
  //#endregion
569
- //#region packages/compiler/src/codegen/dom/emitNodeExpression.ts
576
+ //#region packages/core/compiler/src/codegen/dom/emitNodeExpression.ts
570
577
  function emitNodeExpression(node, context) {
571
578
  switch (node.kind) {
572
579
  case "Text": return t.stringLiteral(node.value);
@@ -582,13 +589,13 @@ function emitNodeExpression(node, context) {
582
589
  }
583
590
  }
584
591
  //#endregion
585
- //#region packages/compiler/src/codegen/dom/emitComponent.ts
592
+ //#region packages/core/compiler/src/codegen/dom/emitComponent.ts
586
593
  function emitComponent(node, context) {
587
594
  const props = t.objectExpression(node.props.map((prop) => emitComponentProp(prop, context)));
588
595
  return t.callExpression(context.importRuntime("createComponent"), [node.callee, props]);
589
596
  }
590
597
  function emitComponentProp(prop, context) {
591
- const key = createObjectKey(prop.name);
598
+ const key = createObjectKey$1(prop.name);
592
599
  if (Array.isArray(prop.value)) return t.objectMethod("get", key, [], t.blockStatement([t.returnStatement(emitChildrenProp(prop.value, context))]));
593
600
  if (isStaticPropValue(prop.value)) return t.objectProperty(key, prop.value);
594
601
  return t.objectMethod("get", key, [], t.blockStatement([t.returnStatement(prop.value)]));
@@ -601,11 +608,11 @@ function emitChildrenProp(children, context) {
601
608
  function isStaticPropValue(value) {
602
609
  return t.isStringLiteral(value) || t.isNumericLiteral(value) || t.isBooleanLiteral(value) || t.isNullLiteral(value);
603
610
  }
604
- function createObjectKey(key) {
611
+ function createObjectKey$1(key) {
605
612
  return t.isValidIdentifier(key) ? t.identifier(key) : t.stringLiteral(key);
606
613
  }
607
614
  //#endregion
608
- //#region packages/compiler/src/codegen/dom/emitBuiltin.ts
615
+ //#region packages/core/compiler/src/codegen/dom/emitBuiltin.ts
609
616
  function emitShow(node, context) {
610
617
  const props = [t.objectProperty(t.identifier("when"), node.when), t.objectProperty(t.identifier("children"), t.arrowFunctionExpression([], emitChildrenProp(node.children, context)))];
611
618
  if (node.fallback) props.push(t.objectProperty(t.identifier("fallback"), Array.isArray(node.fallback) ? t.arrowFunctionExpression([], emitChildrenProp(node.fallback, context)) : node.fallback));
@@ -644,7 +651,29 @@ function emitMountFor(node, context) {
644
651
  ]);
645
652
  }
646
653
  function emitHost(node, context) {
647
- return emitChildrenProp(node.children, context);
654
+ const props = buildHostProps(node, context);
655
+ const hostCall = t.callExpression(context.importRuntime("Host"), [t.objectExpression(props)]);
656
+ if (!node.child) return hostCall;
657
+ const childExpr = emitNodeExpression(node.child, context);
658
+ return t.callExpression(t.arrowFunctionExpression([], t.blockStatement([t.expressionStatement(hostCall), t.returnStatement(childExpr)])), []);
659
+ }
660
+ function buildHostProps(node, context) {
661
+ const props = [];
662
+ for (const attr of node.attrs) {
663
+ const key = createObjectKey(attr.name);
664
+ if (isStaticValue(attr.expr) || isGetterExpression(attr.expr)) props.push(t.objectProperty(key, attr.expr));
665
+ else props.push(t.objectProperty(key, t.arrowFunctionExpression([], attr.expr)));
666
+ }
667
+ return props;
668
+ }
669
+ function isStaticValue(expr) {
670
+ return t.isStringLiteral(expr) || t.isNumericLiteral(expr) || t.isBooleanLiteral(expr) || t.isNullLiteral(expr);
671
+ }
672
+ function isGetterExpression(expr) {
673
+ return t.isArrowFunctionExpression(expr) || t.isFunctionExpression(expr);
674
+ }
675
+ function createObjectKey(name) {
676
+ return t.isValidIdentifier(name) ? t.identifier(name) : t.stringLiteral(name);
648
677
  }
649
678
  function emitSlot(node, context) {
650
679
  return t.callExpression(context.importRuntime("createSlot"), [node.name ? t.stringLiteral(node.name) : t.identifier("undefined"), node.fallback.length > 0 ? t.arrowFunctionExpression([], emitChildrenProp(node.fallback, context)) : t.identifier("undefined")]);
@@ -653,7 +682,7 @@ function emitMarkerIdentifier(node) {
653
682
  return t.identifier(node.ref.name);
654
683
  }
655
684
  //#endregion
656
- //#region packages/compiler/src/codegen/dom/index.ts
685
+ //#region packages/core/compiler/src/codegen/dom/index.ts
657
686
  function emitDOM(node, context) {
658
687
  switch (node.kind) {
659
688
  case "Element": return emitElement(node, context);
@@ -668,7 +697,7 @@ function emitDOM(node, context) {
668
697
  }
669
698
  }
670
699
  //#endregion
671
- //#region packages/compiler/src/context/CompilerContext.ts
700
+ //#region packages/core/compiler/src/context/CompilerContext.ts
672
701
  var CompilerContext = class {
673
702
  constructor(options, programPath) {
674
703
  this.options = options;
@@ -731,7 +760,7 @@ function getCompilerContext(path, options) {
731
760
  return new CompilerContext(options, path.scope.getProgramParent().path);
732
761
  }
733
762
  //#endregion
734
- //#region packages/compiler/src/diagnostics/codes.ts
763
+ //#region packages/core/compiler/src/diagnostics/codes.ts
735
764
  const CompilerErrorCode = {
736
765
  UNSUPPORTED_SPREAD_ATTRIBUTE: "ZEUS_UNSUPPORTED_SPREAD_ATTRIBUTE",
737
766
  UNSUPPORTED_SPREAD_CHILD: "ZEUS_UNSUPPORTED_SPREAD_CHILD",
@@ -745,7 +774,7 @@ const CompilerErrorCode = {
745
774
  INVALID_REF_USAGE: "ZEUS_INVALID_REF_USAGE"
746
775
  };
747
776
  //#endregion
748
- //#region packages/compiler/src/diagnostics/CompilerError.ts
777
+ //#region packages/core/compiler/src/diagnostics/CompilerError.ts
749
778
  var CompilerError = class extends Error {
750
779
  constructor(options) {
751
780
  var _options$path;
@@ -820,7 +849,7 @@ function _objectSpread2(e) {
820
849
  return e;
821
850
  }
822
851
  //#endregion
823
- //#region packages/compiler/src/ir/semanticBuilders.ts
852
+ //#region packages/core/compiler/src/ir/semanticBuilders.ts
824
853
  let nextId = 0;
825
854
  function id() {
826
855
  return nextId++;
@@ -937,11 +966,12 @@ function forIR(input) {
937
966
  body: input.body
938
967
  };
939
968
  }
940
- function hostIR(children) {
969
+ function hostIR(input) {
941
970
  return {
942
971
  id: id(),
943
972
  kind: "Host",
944
- children
973
+ attrs: input.attrs,
974
+ child: input.child
945
975
  };
946
976
  }
947
977
  function slotIR(input) {
@@ -955,7 +985,7 @@ function slotIR(input) {
955
985
  };
956
986
  }
957
987
  //#endregion
958
- //#region packages/compiler/src/parse/jsx.ts
988
+ //#region packages/core/compiler/src/parse/jsx.ts
959
989
  /**
960
990
  * JSX AST parsing utilities.
961
991
  *
@@ -982,7 +1012,7 @@ function toEventName(name) {
982
1012
  return name.slice(2).toLowerCase();
983
1013
  }
984
1014
  //#endregion
985
- //#region packages/compiler/src/lower/lowerAttribute.ts
1015
+ //#region packages/core/compiler/src/lower/lowerAttribute.ts
986
1016
  function lowerAttribute(path, _context) {
987
1017
  if (path.isJSXSpreadAttribute() || t.isJSXSpreadAttribute(path.node)) throw new CompilerError({
988
1018
  code: CompilerErrorCode.UNSUPPORTED_SPREAD_ATTRIBUTE,
@@ -1026,7 +1056,7 @@ function lowerAttribute(path, _context) {
1026
1056
  return null;
1027
1057
  }
1028
1058
  //#endregion
1029
- //#region packages/compiler/src/lower/lowerChildren.ts
1059
+ //#region packages/core/compiler/src/lower/lowerChildren.ts
1030
1060
  function lowerChildren(children, context) {
1031
1061
  const result = [];
1032
1062
  for (const child of children) {
@@ -1049,7 +1079,12 @@ function lowerChildren(children, context) {
1049
1079
  return result;
1050
1080
  }
1051
1081
  //#endregion
1052
- //#region packages/compiler/src/lower/lowerBuiltin.ts
1082
+ //#region packages/core/compiler/src/lower/lowerBuiltin.ts
1083
+ const HOST_SKIP_PROPS = new Set([
1084
+ "key",
1085
+ "__slot",
1086
+ "__anchor"
1087
+ ]);
1053
1088
  function isBuiltinTag(tagName) {
1054
1089
  return tagName === "Show" || tagName === "For" || tagName === "Host" || tagName === "Slot";
1055
1090
  }
@@ -1063,7 +1098,7 @@ function lowerBuiltin(path, context) {
1063
1098
  switch (tagName.name) {
1064
1099
  case "Show": return lowerShow(path, context);
1065
1100
  case "For": return lowerFor(path, context);
1066
- case "Host": return hostIR(lowerChildren(path.get("children"), context));
1101
+ case "Host": return lowerHost(path, context);
1067
1102
  case "Slot": return lowerSlot(path, context);
1068
1103
  default: throw new CompilerError({
1069
1104
  code: CompilerErrorCode.INVALID_BUILTIN_USAGE,
@@ -1173,8 +1208,73 @@ function getBuiltinName(path) {
1173
1208
  const name = path.node.openingElement.name;
1174
1209
  return t.isJSXIdentifier(name) ? name.name : "Builtin";
1175
1210
  }
1211
+ function isEventLikeProp(key) {
1212
+ return /^on[A-Z]/.test(key) || key.startsWith("on:");
1213
+ }
1214
+ function normalizeHostAttrName(name) {
1215
+ switch (name) {
1216
+ case "className": return "class";
1217
+ case "htmlFor": return "for";
1218
+ case "tabIndex": return "tabindex";
1219
+ case "readOnly": return "readonly";
1220
+ default: return name;
1221
+ }
1222
+ }
1223
+ function lowerHost(path, context) {
1224
+ const attrs = [];
1225
+ const rawChildren = lowerChildren(path.get("children"), context);
1226
+ for (const attrPath of path.get("openingElement").get("attributes")) {
1227
+ const node = attrPath.node;
1228
+ if (t.isJSXSpreadAttribute(node)) throw new CompilerError({
1229
+ code: CompilerErrorCode.UNSUPPORTED_COMPONENT_PROP,
1230
+ message: "Spread props are not supported on Host in Phase 1.",
1231
+ path: attrPath
1232
+ });
1233
+ if (!attrPath.isJSXAttribute()) continue;
1234
+ const name = getJSXAttrName(node.name);
1235
+ if (HOST_SKIP_PROPS.has(name)) continue;
1236
+ if (name === "children") continue;
1237
+ if (name === "ref") {
1238
+ const value = attrPath.get("value");
1239
+ if (value.isJSXExpressionContainer()) {
1240
+ const expr = value.get("expression");
1241
+ if (expr.isExpression()) attrs.push({
1242
+ id: id(),
1243
+ kind: "HostAttr",
1244
+ name: "ref",
1245
+ expr: expr.node
1246
+ });
1247
+ }
1248
+ continue;
1249
+ }
1250
+ if (isEventLikeProp(name)) continue;
1251
+ const value = node.value;
1252
+ if (!value) attrs.push({
1253
+ id: id(),
1254
+ kind: "HostAttr",
1255
+ name: normalizeHostAttrName(name),
1256
+ expr: t.booleanLiteral(true)
1257
+ });
1258
+ else if (t.isStringLiteral(value)) attrs.push({
1259
+ id: id(),
1260
+ kind: "HostAttr",
1261
+ name: normalizeHostAttrName(name),
1262
+ expr: t.stringLiteral(value.value)
1263
+ });
1264
+ else if (t.isJSXExpressionContainer(value) && !t.isJSXEmptyExpression(value.expression)) attrs.push({
1265
+ id: id(),
1266
+ kind: "HostAttr",
1267
+ name: normalizeHostAttrName(name),
1268
+ expr: value.expression
1269
+ });
1270
+ }
1271
+ return hostIR({
1272
+ attrs,
1273
+ child: rawChildren.length === 0 ? void 0 : rawChildren.length === 1 ? rawChildren[0] : fragmentIR(rawChildren)
1274
+ });
1275
+ }
1176
1276
  //#endregion
1177
- //#region packages/compiler/src/lower/lowerComponent.ts
1277
+ //#region packages/core/compiler/src/lower/lowerComponent.ts
1178
1278
  function lowerComponent(path, context) {
1179
1279
  const tag = convertComponentIdentifier(path.node.openingElement.name);
1180
1280
  const props = [];
@@ -1238,7 +1338,7 @@ function convertComponentIdentifier(node) {
1238
1338
  return node;
1239
1339
  }
1240
1340
  //#endregion
1241
- //#region packages/compiler/src/lower/lowerElement.ts
1341
+ //#region packages/core/compiler/src/lower/lowerElement.ts
1242
1342
  function lowerElement(path, context) {
1243
1343
  const tagName = getTagName(path.node);
1244
1344
  if (isBuiltinTag(tagName)) return lowerBuiltin(path, context);
@@ -1256,19 +1356,19 @@ function lowerElement(path, context) {
1256
1356
  });
1257
1357
  }
1258
1358
  //#endregion
1259
- //#region packages/compiler/src/lower/lowerFragment.ts
1359
+ //#region packages/core/compiler/src/lower/lowerFragment.ts
1260
1360
  function lowerFragment(path, context) {
1261
1361
  return fragmentIR(lowerChildren(path.get("children"), context));
1262
1362
  }
1263
1363
  //#endregion
1264
- //#region packages/compiler/src/lower/lowerJSX.ts
1364
+ //#region packages/core/compiler/src/lower/lowerJSX.ts
1265
1365
  function lowerJSX(path, context) {
1266
1366
  if (path.isJSXElement()) return lowerElement(path, context);
1267
1367
  if (path.isJSXFragment()) return lowerFragment(path, context);
1268
1368
  throw new Error("Unsupported JSX node");
1269
1369
  }
1270
1370
  //#endregion
1271
- //#region packages/compiler/src/passes/normalizeChildren.ts
1371
+ //#region packages/core/compiler/src/passes/normalizeChildren.ts
1272
1372
  function normalizeChildren(node) {
1273
1373
  visit$2(node);
1274
1374
  return node;
@@ -1277,13 +1377,15 @@ function visit$2(node) {
1277
1377
  switch (node.kind) {
1278
1378
  case "Element":
1279
1379
  case "Fragment":
1280
- case "Host":
1281
1380
  node.children = node.children.filter((child) => {
1282
1381
  if (child.kind === "Text") return child.value.length > 0;
1283
1382
  return true;
1284
1383
  });
1285
1384
  for (const child of node.children) visit$2(child);
1286
1385
  return;
1386
+ case "Host":
1387
+ if (node.child) visit$2(node.child);
1388
+ return;
1287
1389
  case "Component":
1288
1390
  for (const prop of node.props) {
1289
1391
  if (!Array.isArray(prop.value)) continue;
@@ -1319,7 +1421,7 @@ function visit$2(node) {
1319
1421
  }
1320
1422
  }
1321
1423
  //#endregion
1322
- //#region packages/compiler/src/passes/assignDomPaths.ts
1424
+ //#region packages/core/compiler/src/passes/assignDomPaths.ts
1323
1425
  function assignDomPaths(node) {
1324
1426
  visitNode$1(node);
1325
1427
  return node;
@@ -1347,7 +1449,7 @@ function visitNode$1(node, parent) {
1347
1449
  for (const child of node.body) visitNode$1(child);
1348
1450
  return;
1349
1451
  case "Host":
1350
- for (const child of node.children) visitNode$1(child, parent);
1452
+ if (node.child) visitNode$1(node.child, parent);
1351
1453
  return;
1352
1454
  case "Slot":
1353
1455
  for (const child of node.fallback) visitNode$1(child);
@@ -1410,7 +1512,7 @@ function isMarkerTemplateNode(node) {
1410
1512
  return node.kind === "DynamicText" || node.kind === "Component" || node.kind === "Show" || node.kind === "For" || node.kind === "Slot";
1411
1513
  }
1412
1514
  //#endregion
1413
- //#region packages/compiler/src/passes/assignPhysicalDomPaths.ts
1515
+ //#region packages/core/compiler/src/passes/assignPhysicalDomPaths.ts
1414
1516
  function assignPhysicalDomPaths(node) {
1415
1517
  visitNode(node);
1416
1518
  return node;
@@ -1425,7 +1527,7 @@ function visitNode(node, parent) {
1425
1527
  for (const child of node.children) visitNode(child, parent);
1426
1528
  return;
1427
1529
  case "Host":
1428
- for (const child of node.children) visitNode(child, parent);
1530
+ if (node.child) visitNode(node.child, parent);
1429
1531
  return;
1430
1532
  case "Show":
1431
1533
  for (const child of node.children) visitNode(child);
@@ -1511,12 +1613,12 @@ function appendPhysicalChild(result, node) {
1511
1613
  for (const child of node.children) appendPhysicalChild(result, child);
1512
1614
  return;
1513
1615
  case "Host":
1514
- for (const child of node.children) appendPhysicalChild(result, child);
1616
+ if (node.child) appendPhysicalChild(result, node.child);
1515
1617
  return;
1516
1618
  }
1517
1619
  }
1518
1620
  //#endregion
1519
- //#region packages/compiler/src/passes/validateBuiltins.ts
1621
+ //#region packages/core/compiler/src/passes/validateBuiltins.ts
1520
1622
  function validateBuiltins(node) {
1521
1623
  visit$1(node, {
1522
1624
  insideHost: false,
@@ -1530,7 +1632,7 @@ function visit$1(node, state) {
1530
1632
  code: CompilerErrorCode.INVALID_BUILTIN_USAGE,
1531
1633
  message: "<Host> can only be used as a root host boundary."
1532
1634
  });
1533
- for (const child of node.children) visit$1(child, {
1635
+ if (node.child) visit$1(node.child, {
1534
1636
  insideHost: true,
1535
1637
  root: false
1536
1638
  });
@@ -1562,7 +1664,7 @@ function visit$1(node, state) {
1562
1664
  }
1563
1665
  }
1564
1666
  //#endregion
1565
- //#region packages/compiler/src/passes/analyzeBindings.ts
1667
+ //#region packages/core/compiler/src/passes/analyzeBindings.ts
1566
1668
  function analyzeBindings(node) {
1567
1669
  const analysis = {
1568
1670
  dynamicText: 0,
@@ -1593,9 +1695,11 @@ function visit(node, analysis) {
1593
1695
  }
1594
1696
  return;
1595
1697
  case "Fragment":
1596
- case "Host":
1597
1698
  for (const child of node.children) visit(child, analysis);
1598
1699
  return;
1700
+ case "Host":
1701
+ if (node.child) visit(node.child, analysis);
1702
+ return;
1599
1703
  case "Slot":
1600
1704
  for (const child of node.fallback) visit(child, analysis);
1601
1705
  return;
@@ -1610,7 +1714,7 @@ function visit(node, analysis) {
1610
1714
  }
1611
1715
  }
1612
1716
  //#endregion
1613
- //#region packages/compiler/src/transform/index.ts
1717
+ //#region packages/core/compiler/src/transform/index.ts
1614
1718
  function transformJSX(path, state, config) {
1615
1719
  if (state.get("skip")) return;
1616
1720
  if (!path.isJSXElement() && !path.isJSXFragment()) return;
@@ -1625,7 +1729,7 @@ function transformJSX(path, state, config) {
1625
1729
  path.replaceWith(emitDOM(ir, context));
1626
1730
  }
1627
1731
  //#endregion
1628
- //#region packages/compiler/src/visitor.ts
1732
+ //#region packages/core/compiler/src/visitor.ts
1629
1733
  function createVisitor(config) {
1630
1734
  return {
1631
1735
  JSXElement(path, state) {
@@ -1638,7 +1742,7 @@ function createVisitor(config) {
1638
1742
  };
1639
1743
  }
1640
1744
  //#endregion
1641
- //#region packages/compiler/src/index.ts
1745
+ //#region packages/core/compiler/src/index.ts
1642
1746
  var src_default = declare((api, options) => {
1643
1747
  api.assertVersion(7);
1644
1748
  return {