@zeus-js/compiler 0.1.0 → 0.1.1-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.1.0
2
+ * compiler v0.1.1-beta.0
3
3
  * (c) 2026 baicie
4
4
  * Released under the MIT License.
5
5
  **/
@@ -5738,6 +5738,7 @@ function appendEvents(path) {
5738
5738
  }
5739
5739
  //#endregion
5740
5740
  //#region packages/core/compiler/src/config/index.ts
5741
+ const DEFAULT_SSR_RENDERER_MODULE = "@zeus-js/runtime-ssr";
5741
5742
  const DEFAULT_OPTIONS = {
5742
5743
  moduleName: DEFAULT_RENDERER_MODULE,
5743
5744
  generate: "dom",
@@ -5762,7 +5763,9 @@ const DEFAULT_OPTIONS = {
5762
5763
  * @returns The resolved compiler options.
5763
5764
  */
5764
5765
  function resolveConfig(options) {
5765
- return extend(DEFAULT_OPTIONS, options);
5766
+ const config = extend({}, DEFAULT_OPTIONS, options);
5767
+ if (config.generate === "ssr" && (options === null || options === void 0 ? void 0 : options.moduleName) === void 0) config.moduleName = DEFAULT_SSR_RENDERER_MODULE;
5768
+ return config;
5766
5769
  }
5767
5770
  //#endregion
5768
5771
  //#region packages/core/compiler/src/context/CompilerContext.ts
@@ -5957,8 +5960,10 @@ function enterProgram(config, path, state) {
5957
5960
  }
5958
5961
  function exitProgram(config, path, state) {
5959
5962
  if (state.get("skip")) return;
5960
- appendTemplates(path);
5961
- appendEvents(path);
5963
+ if (config.generate === "dom") {
5964
+ appendTemplates(path);
5965
+ if (config.delegateEvents) appendEvents(path);
5966
+ }
5962
5967
  appendImportMethods(path);
5963
5968
  }
5964
5969
  function createProgramVisitor(config) {
@@ -18319,19 +18324,18 @@ function identifierIR(name, span) {
18319
18324
  }
18320
18325
  function elementIR(input) {
18321
18326
  var _input$attrs, _input$children;
18322
- return {
18327
+ return _objectSpread2(_objectSpread2({
18323
18328
  id: id(),
18324
18329
  kind: "Element",
18325
18330
  ref: input.ref,
18326
18331
  tagName: input.tagName,
18327
18332
  attrs: (_input$attrs = input.attrs) !== null && _input$attrs !== void 0 ? _input$attrs : [],
18328
- children: (_input$children = input.children) !== null && _input$children !== void 0 ? _input$children : [],
18329
- flags: _objectSpread2({
18330
- isSVG: false,
18331
- isVoid: false,
18332
- isCustomElement: input.tagName.includes("-")
18333
- }, input.flags)
18334
- };
18333
+ children: (_input$children = input.children) !== null && _input$children !== void 0 ? _input$children : []
18334
+ }, input.span === void 0 ? {} : { span: input.span }), {}, { flags: _objectSpread2({
18335
+ isSVG: false,
18336
+ isVoid: false,
18337
+ isCustomElement: input.tagName.includes("-")
18338
+ }, input.flags) });
18335
18339
  }
18336
18340
  function textIR(value) {
18337
18341
  return {
@@ -18396,13 +18400,13 @@ function refBindingIR(expr) {
18396
18400
  };
18397
18401
  }
18398
18402
  function componentIR(input) {
18399
- return {
18403
+ return _objectSpread2({
18400
18404
  id: id(),
18401
18405
  kind: "Component",
18402
18406
  ref: input.ref,
18403
18407
  callee: input.callee,
18404
18408
  props: input.props
18405
- };
18409
+ }, input.span === void 0 ? {} : { span: input.span });
18406
18410
  }
18407
18411
  function showIR(input) {
18408
18412
  return {
@@ -18631,7 +18635,7 @@ function emitDynamicText(node, context) {
18631
18635
  ];
18632
18636
  }
18633
18637
  function emitComponentInsert(node, context) {
18634
- return emitMarkerInsert(node, context, emitComponent(node, context));
18638
+ return emitMarkerInsert(node, context, emitComponent$1(node, context));
18635
18639
  }
18636
18640
  function emitMarkerInsert(node, context, value) {
18637
18641
  if (!node.domPath || node.domPath.kind !== "Marker") return [];
@@ -18712,7 +18716,7 @@ function emitTemplateClone(node, context) {
18712
18716
  }
18713
18717
  //#endregion
18714
18718
  //#region packages/core/compiler/src/codegen/dom/emitElement.ts
18715
- function emitElement(node, context) {
18719
+ function emitElement$1(node, context) {
18716
18720
  if (!hasRuntimeWork(node)) return emitTemplateClone(node, context);
18717
18721
  return callExpression(arrowFunctionExpression([], blockStatement([
18718
18722
  variableDeclaration("const", [variableDeclarator(identifier(node.ref.name), emitTemplateClone(node, context))]),
@@ -18858,11 +18862,11 @@ function emitNodeExpression(node, context) {
18858
18862
  switch (node.kind) {
18859
18863
  case "Text": return stringLiteral(node.value);
18860
18864
  case "DynamicText": return parseExpressionIR(node.expr);
18861
- case "Element": return emitElement(node, context);
18862
- case "Component": return emitComponent(node, context);
18865
+ case "Element": return emitElement$1(node, context);
18866
+ case "Component": return emitComponent$1(node, context);
18863
18867
  case "Fragment": return emitFragment(node, context);
18864
- case "Show": return emitShow(node, context);
18865
- case "For": return emitFor(node, context);
18868
+ case "Show": return emitShow$1(node, context);
18869
+ case "For": return emitFor$1(node, context);
18866
18870
  case "Host": return emitHost(node, context);
18867
18871
  case "Slot": return emitSlot(node, context);
18868
18872
  default: return nullLiteral();
@@ -18870,15 +18874,15 @@ function emitNodeExpression(node, context) {
18870
18874
  }
18871
18875
  //#endregion
18872
18876
  //#region packages/core/compiler/src/codegen/dom/emitComponent.ts
18873
- function emitComponent(node, context) {
18874
- const props = objectExpression(node.props.map((prop) => emitComponentProp(prop, context)));
18877
+ function emitComponent$1(node, context) {
18878
+ const props = objectExpression(node.props.map((prop) => emitComponentProp$1(prop, context)));
18875
18879
  return callExpression(context.importRuntime("createComponent"), [parseExpressionIR(node.callee), props]);
18876
18880
  }
18877
- function emitComponentProp(prop, context) {
18878
- const key = createObjectKey$1(prop.name);
18881
+ function emitComponentProp$1(prop, context) {
18882
+ const key = createObjectKey$2(prop.name);
18879
18883
  if (Array.isArray(prop.value)) return objectMethod("get", key, [], blockStatement([returnStatement(emitChildrenProp(prop.value, context))]));
18880
18884
  const value = parseExpressionIR(prop.value);
18881
- if (isStaticPropValue(value)) return objectProperty(key, value);
18885
+ if (isStaticPropValue$1(value)) return objectProperty(key, value);
18882
18886
  return objectMethod("get", key, [], blockStatement([returnStatement(value)]));
18883
18887
  }
18884
18888
  function emitChildrenProp(children, context) {
@@ -18886,15 +18890,15 @@ function emitChildrenProp(children, context) {
18886
18890
  if (nodes.length === 1) return nodes[0];
18887
18891
  return arrayExpression(nodes);
18888
18892
  }
18889
- function isStaticPropValue(value) {
18893
+ function isStaticPropValue$1(value) {
18890
18894
  return isStringLiteral(value) || isNumericLiteral(value) || isBooleanLiteral(value) || isNullLiteral(value);
18891
18895
  }
18892
- function createObjectKey$1(key) {
18896
+ function createObjectKey$2(key) {
18893
18897
  return isValidIdentifier(key) ? identifier(key) : stringLiteral(key);
18894
18898
  }
18895
18899
  //#endregion
18896
18900
  //#region packages/core/compiler/src/codegen/dom/emitBuiltin.ts
18897
- function emitShow(node, context) {
18901
+ function emitShow$1(node, context) {
18898
18902
  const props = [objectProperty(identifier("when"), parseExpressionIR(node.when)), objectProperty(identifier("children"), arrowFunctionExpression([], emitChildrenProp(node.children, context)))];
18899
18903
  if (node.fallback) props.push(objectProperty(identifier("fallback"), Array.isArray(node.fallback) ? arrowFunctionExpression([], emitChildrenProp(node.fallback, context)) : parseExpressionIR(node.fallback)));
18900
18904
  return callExpression(context.importRuntime("createComponent"), [context.importRuntime("Show"), objectExpression(props)]);
@@ -18910,7 +18914,7 @@ function emitMountShow(node, context) {
18910
18914
  node.fallback ? Array.isArray(node.fallback) ? arrowFunctionExpression([], emitChildrenProp(node.fallback, context)) : arrowFunctionExpression([], parseExpressionIR(node.fallback)) : identifier("undefined")
18911
18915
  ]);
18912
18916
  }
18913
- function emitFor(node, context) {
18917
+ function emitFor$1(node, context) {
18914
18918
  const params = [identifier(node.item.name)];
18915
18919
  if (node.index) params.push(identifier(node.index.name));
18916
18920
  const props = [objectProperty(identifier("each"), parseExpressionIR(node.each)), objectProperty(identifier("children"), arrowFunctionExpression(params, emitChildrenProp(node.body, context)))];
@@ -18940,7 +18944,7 @@ function emitHost(node, context) {
18940
18944
  function buildHostProps(node, context) {
18941
18945
  const props = [];
18942
18946
  for (const attr of node.attrs) {
18943
- const key = createObjectKey(attr.name);
18947
+ const key = createObjectKey$1(attr.name);
18944
18948
  const expression = parseExpressionIR(attr.expr);
18945
18949
  if (isStaticValue(expression) || isGetterExpression(expression)) props.push(objectProperty(key, expression));
18946
18950
  else props.push(objectProperty(key, arrowFunctionExpression([], expression)));
@@ -18953,7 +18957,7 @@ function isStaticValue(expr) {
18953
18957
  function isGetterExpression(expr) {
18954
18958
  return isArrowFunctionExpression(expr) || isFunctionExpression(expr);
18955
18959
  }
18956
- function createObjectKey(name) {
18960
+ function createObjectKey$1(name) {
18957
18961
  return isValidIdentifier(name) ? identifier(name) : stringLiteral(name);
18958
18962
  }
18959
18963
  function emitSlot(node, context) {
@@ -18966,11 +18970,11 @@ function emitMarkerIdentifier(node) {
18966
18970
  //#region packages/core/compiler/src/codegen/dom/index.ts
18967
18971
  function emitDOM(node, context) {
18968
18972
  switch (node.kind) {
18969
- case "Element": return emitElement(node, context);
18973
+ case "Element": return emitElement$1(node, context);
18970
18974
  case "Fragment": return emitFragment(node, context);
18971
- case "Component": return emitComponent(node, context);
18972
- case "Show": return emitShow(node, context);
18973
- case "For": return emitFor(node, context);
18975
+ case "Component": return emitComponent$1(node, context);
18976
+ case "Show": return emitShow$1(node, context);
18977
+ case "For": return emitFor$1(node, context);
18974
18978
  case "Host": return emitHost(node, context);
18975
18979
  case "Slot": return emitSlot(node, context);
18976
18980
  case "DynamicText": return arrowFunctionExpression([], parseExpressionIR(node.expr));
@@ -18978,6 +18982,43 @@ function emitDOM(node, context) {
18978
18982
  }
18979
18983
  }
18980
18984
  //#endregion
18985
+ //#region packages/core/compiler/src/codegen/ssr/rawText.ts
18986
+ function getSSRRawTextTag(tagName) {
18987
+ const normalized = tagName.toLowerCase();
18988
+ return normalized === "script" || normalized === "style" ? normalized : void 0;
18989
+ }
18990
+ //#endregion
18991
+ //#region packages/core/compiler/src/codegen/ssr/property.ts
18992
+ const BOOLEAN_PROPERTY_ELEMENTS = {
18993
+ checked: /* @__PURE__ */ new Set(["input"]),
18994
+ disabled: /* @__PURE__ */ new Set([
18995
+ "button",
18996
+ "fieldset",
18997
+ "input",
18998
+ "optgroup",
18999
+ "option",
19000
+ "select",
19001
+ "textarea"
19002
+ ]),
19003
+ multiple: /* @__PURE__ */ new Set(["input", "select"]),
19004
+ readOnly: /* @__PURE__ */ new Set(["input", "textarea"]),
19005
+ selected: /* @__PURE__ */ new Set(["option"])
19006
+ };
19007
+ const VALUE_PROPERTY_ELEMENTS = /* @__PURE__ */ new Set([
19008
+ "button",
19009
+ "input",
19010
+ "option",
19011
+ "textarea"
19012
+ ]);
19013
+ function isSSRPropertySupported(tag, name) {
19014
+ var _BOOLEAN_PROPERTY_ELE;
19015
+ const normalizedTag = tag.toLowerCase();
19016
+ if (name === "tabIndex") return true;
19017
+ if (name === "htmlFor") return normalizedTag === "label";
19018
+ if (name === "value") return VALUE_PROPERTY_ELEMENTS.has(normalizedTag);
19019
+ return Boolean((_BOOLEAN_PROPERTY_ELE = BOOLEAN_PROPERTY_ELEMENTS[name]) === null || _BOOLEAN_PROPERTY_ELE === void 0 ? void 0 : _BOOLEAN_PROPERTY_ELE.has(normalizedTag));
19020
+ }
19021
+ //#endregion
18981
19022
  //#region packages/core/compiler/src/diagnostics/codes.ts
18982
19023
  const CompilerErrorCode = {
18983
19024
  UNSUPPORTED_SPREAD_ATTRIBUTE: "ZEUS_UNSUPPORTED_SPREAD_ATTRIBUTE",
@@ -18989,6 +19030,9 @@ const CompilerErrorCode = {
18989
19030
  INVALID_TRANSFORM_RESULT: "ZEUS_INVALID_TRANSFORM_RESULT",
18990
19031
  UNSUPPORTED_NODE: "ZEUS_UNSUPPORTED_NODE",
18991
19032
  INVALID_BUILTIN_USAGE: "ZEUS_INVALID_BUILTIN_USAGE",
19033
+ UNSUPPORTED_SSR_BUILTIN: "ZEUS_UNSUPPORTED_SSR_BUILTIN",
19034
+ UNSUPPORTED_SSR_PROPERTY: "ZEUS_UNSUPPORTED_SSR_PROPERTY",
19035
+ UNSUPPORTED_SSR_RAW_TEXT_CHILD: "ZEUS_UNSUPPORTED_SSR_RAW_TEXT_CHILD",
18992
19036
  INVALID_REF_USAGE: "ZEUS_INVALID_REF_USAGE"
18993
19037
  };
18994
19038
  //#endregion
@@ -19025,6 +19069,169 @@ var CompilerError = class extends Error {
19025
19069
  }
19026
19070
  };
19027
19071
  //#endregion
19072
+ //#region packages/core/compiler/src/codegen/ssr/validate.ts
19073
+ function assertSSRSupported(node, filename, rawTextTag) {
19074
+ if (rawTextTag && (node.kind === "Element" || node.kind === "Component")) throwUnsupportedSSRRawTextChild(node, rawTextTag, filename);
19075
+ switch (node.kind) {
19076
+ case "Host":
19077
+ case "Slot": throwUnsupportedSSRBuiltin(node, filename);
19078
+ case "Element":
19079
+ for (const attribute of node.attrs) if (attribute.kind === "PropBinding" && !isSSRPropertySupported(node.tagName, attribute.name)) throwUnsupportedSSRProperty(node, attribute, filename);
19080
+ const childRawTextTag = getSSRRawTextTag(node.tagName);
19081
+ for (const child of node.children) assertSSRSupported(child, filename, childRawTextTag);
19082
+ return;
19083
+ case "Fragment":
19084
+ for (const child of node.children) assertSSRSupported(child, filename, rawTextTag);
19085
+ return;
19086
+ case "Component":
19087
+ for (const prop of node.props) {
19088
+ if (!Array.isArray(prop.value)) continue;
19089
+ for (const child of prop.value) assertSSRSupported(child, filename);
19090
+ }
19091
+ return;
19092
+ case "Show":
19093
+ for (const child of node.children) assertSSRSupported(child, filename, rawTextTag);
19094
+ if (Array.isArray(node.fallback)) for (const child of node.fallback) assertSSRSupported(child, filename, rawTextTag);
19095
+ return;
19096
+ case "For":
19097
+ for (const child of node.body) assertSSRSupported(child, filename, rawTextTag);
19098
+ return;
19099
+ case "Text":
19100
+ case "DynamicText": return;
19101
+ }
19102
+ }
19103
+ function throwUnsupportedSSRRawTextChild(node, tag, filename) {
19104
+ throw new CompilerError({
19105
+ code: CompilerErrorCode.UNSUPPORTED_SSR_RAW_TEXT_CHILD,
19106
+ message: `${node.kind} children are not supported inside <${tag}> SSR raw text.`,
19107
+ hint: "Use text expressions, Fragment, Show, or For directly inside the raw-text element.",
19108
+ filename,
19109
+ span: node.span
19110
+ });
19111
+ }
19112
+ function throwUnsupportedSSRProperty(element, property, filename) {
19113
+ var _ref, _property$span;
19114
+ throw new CompilerError({
19115
+ code: CompilerErrorCode.UNSUPPORTED_SSR_PROPERTY,
19116
+ message: `Property "${property.name}" on <${element.tagName}> cannot be serialized by SSR codegen.`,
19117
+ hint: "Use an equivalent HTML attribute binding or move this DOM-only property update to client code.",
19118
+ filename,
19119
+ span: (_ref = (_property$span = property.span) !== null && _property$span !== void 0 ? _property$span : property.expr.span) !== null && _ref !== void 0 ? _ref : element.span
19120
+ });
19121
+ }
19122
+ function throwUnsupportedSSRBuiltin(node, filename) {
19123
+ throw new CompilerError({
19124
+ code: CompilerErrorCode.UNSUPPORTED_SSR_BUILTIN,
19125
+ message: `<${node.kind}> is not supported by SSR codegen.`,
19126
+ hint: "Render Web Components on the client; the SSR baseline supports DOM components only.",
19127
+ filename,
19128
+ span: node.span
19129
+ });
19130
+ }
19131
+ //#endregion
19132
+ //#region packages/core/compiler/src/codegen/ssr/index.ts
19133
+ function emitSSR(node, context, rawTextTag) {
19134
+ switch (node.kind) {
19135
+ case "Element": return emitElement(node, context);
19136
+ case "Fragment": return emitChildren(node.children, context, rawTextTag);
19137
+ case "Text":
19138
+ if (rawTextTag) return stringLiteral(decodeCompilerEscapedText(node.value));
19139
+ return callExpression(context.importRuntime("ssrStatic"), [stringLiteral(node.value)]);
19140
+ case "DynamicText":
19141
+ if (rawTextTag) return parseExpressionIR(node.expr);
19142
+ return callExpression(context.importRuntime("ssrText"), [parseExpressionIR(node.expr)]);
19143
+ case "Component": return emitComponent(node, context);
19144
+ case "Show": return emitShow(node, context, rawTextTag);
19145
+ case "For": return emitFor(node, context, rawTextTag);
19146
+ case "Host":
19147
+ case "Slot": return throwUnsupportedSSRBuiltin(node);
19148
+ default: return throwUnsupportedSSRNode(node);
19149
+ }
19150
+ }
19151
+ function emitShow(node, context, rawTextTag) {
19152
+ const args = [arrowFunctionExpression([], parseExpressionIR(node.when)), arrowFunctionExpression([], emitChildrenValue(node.children, context, rawTextTag))];
19153
+ if (node.fallback) {
19154
+ const fallback = Array.isArray(node.fallback) ? emitChildrenValue(node.fallback, context, rawTextTag) : parseExpressionIR(node.fallback);
19155
+ args.push(arrowFunctionExpression([], fallback));
19156
+ }
19157
+ return callExpression(context.importRuntime("ssrShow"), args);
19158
+ }
19159
+ function emitFor(node, context, rawTextTag) {
19160
+ const params = [identifier(node.item.name)];
19161
+ if (node.index) params.push(identifier(node.index.name));
19162
+ return callExpression(context.importRuntime("ssrFor"), [arrowFunctionExpression([], parseExpressionIR(node.each)), arrowFunctionExpression(params, emitChildrenValue(node.body, context, rawTextTag))]);
19163
+ }
19164
+ function emitComponent(node, context) {
19165
+ return callExpression(context.importRuntime("ssrComponent"), [parseExpressionIR(node.callee), objectExpression(node.props.map((prop) => emitComponentProp(prop, context)))]);
19166
+ }
19167
+ function emitComponentProp(prop, context) {
19168
+ const key = createObjectKey(prop.name);
19169
+ if (Array.isArray(prop.value)) return objectMethod("get", key, [], blockStatement([returnStatement(emitChildrenValue(prop.value, context))]));
19170
+ const value = parseExpressionIR(prop.value);
19171
+ if (isStaticPropValue(value)) return objectProperty(key, value);
19172
+ return objectMethod("get", key, [], blockStatement([returnStatement(value)]));
19173
+ }
19174
+ function emitElement(node, context) {
19175
+ const rawTextTag = getSSRRawTextTag(node.tagName);
19176
+ const args = [stringLiteral(node.tagName), arrayExpression(node.attrs.flatMap((attr) => {
19177
+ switch (attr.kind) {
19178
+ case "StaticAttribute":
19179
+ if (isEventAttributeName$1(attr.name)) return [];
19180
+ return [emitStaticAttribute(attr, context)];
19181
+ case "AttrBinding": return [emitAttributeBinding(attr, context)];
19182
+ case "PropBinding": return [emitPropertyBinding(attr, context)];
19183
+ default: return [];
19184
+ }
19185
+ }))];
19186
+ if (node.children.length > 0) args.push(emitChildren(node.children, context, rawTextTag));
19187
+ if (node.flags.isVoid) {
19188
+ if (node.children.length === 0) args.push(identifier("undefined"));
19189
+ args.push(booleanLiteral(true));
19190
+ }
19191
+ return callExpression(context.importRuntime("ssrElement"), args);
19192
+ }
19193
+ function emitAttributeBinding(attr, context) {
19194
+ const name = normalizeAttributeName(attr.name);
19195
+ return callExpression(context.importRuntime("ssrAttr"), [stringLiteral(name), emitBindingValue(attr.expr)]);
19196
+ }
19197
+ function emitPropertyBinding(attr, context) {
19198
+ return callExpression(context.importRuntime("ssrProp"), [stringLiteral(attr.name), emitBindingValue(attr.expr)]);
19199
+ }
19200
+ function emitBindingValue(expression) {
19201
+ const value = parseExpressionIR(expression);
19202
+ if (isArrowFunctionExpression(value) || isFunctionExpression(value)) return callExpression(value, []);
19203
+ return value;
19204
+ }
19205
+ function emitStaticAttribute(attr, context) {
19206
+ return callExpression(context.importRuntime("ssrAttr"), [stringLiteral(normalizeAttributeName(attr.name)), attr.value === true ? booleanLiteral(true) : stringLiteral(attr.value)]);
19207
+ }
19208
+ function emitChildren(children, context, rawTextTag) {
19209
+ return arrayExpression(children.map((child) => emitSSR(child, context, rawTextTag)));
19210
+ }
19211
+ function emitChildrenValue(children, context, rawTextTag) {
19212
+ if (children.length === 1) return emitSSR(children[0], context, rawTextTag);
19213
+ return emitChildren(children, context, rawTextTag);
19214
+ }
19215
+ function decodeCompilerEscapedText(value) {
19216
+ return value.replace(/&lt;/g, "<").replace(/&amp;/g, "&");
19217
+ }
19218
+ function isStaticPropValue(value) {
19219
+ return isStringLiteral(value) || isNumericLiteral(value) || isBooleanLiteral(value) || isNullLiteral(value);
19220
+ }
19221
+ function createObjectKey(name) {
19222
+ return isValidIdentifier(name) ? identifier(name) : stringLiteral(name);
19223
+ }
19224
+ function normalizeAttributeName(name) {
19225
+ return name === "className" ? "class" : name;
19226
+ }
19227
+ function isEventAttributeName$1(name) {
19228
+ return name.length > 2 && name.slice(0, 2).toLowerCase() === "on";
19229
+ }
19230
+ function throwUnsupportedSSRNode(node) {
19231
+ const kind = node.kind;
19232
+ throw new Error(`Unsupported SSR IR node: ${kind}`);
19233
+ }
19234
+ //#endregion
19028
19235
  //#region packages/core/compiler/src/adapters/babel/diagnostic.ts
19029
19236
  function createBabelCompilerError(path, options) {
19030
19237
  var _hub$file;
@@ -19097,12 +19304,15 @@ function lowerAttribute(path, _context) {
19097
19304
  if (!expression.isExpression()) return null;
19098
19305
  const expr = lowerExpressionIR(expression);
19099
19306
  if (name === "ref") return refBindingIR(expr);
19100
- if (name.startsWith("on") && name.length > 2) return eventBindingIR(toEventName(name), expr);
19307
+ if (isEventAttributeName(name)) return eventBindingIR(toEventName(name), expr);
19101
19308
  if (name.startsWith("prop:")) return propBindingIR(name.slice(5), expr);
19102
19309
  return attrBindingIR(name, expr);
19103
19310
  }
19104
19311
  return null;
19105
19312
  }
19313
+ function isEventAttributeName(name) {
19314
+ return name.length > 2 && name.slice(0, 2).toLowerCase() === "on";
19315
+ }
19106
19316
  //#endregion
19107
19317
  //#region packages/core/compiler/src/lower/lowerChildren.ts
19108
19318
  function lowerChildren(children, context) {
@@ -19369,7 +19579,8 @@ function lowerComponent(path, context) {
19369
19579
  return componentIR({
19370
19580
  ref: ref(context.uid("cmp$").name),
19371
19581
  callee: tag,
19372
- props
19582
+ props,
19583
+ span: sourceSpanFromBabelNode(path.node)
19373
19584
  });
19374
19585
  }
19375
19586
  function convertComponentIdentifier(node) {
@@ -19400,6 +19611,7 @@ function lowerElement(path, context) {
19400
19611
  tagName,
19401
19612
  attrs,
19402
19613
  children: VoidElements.includes(tagName) ? [] : lowerChildren(path.get("children"), context),
19614
+ span: sourceSpanFromBabelNode(path.node),
19403
19615
  flags: {
19404
19616
  isVoid: VoidElements.includes(tagName),
19405
19617
  isCustomElement: tagName.includes("-")
@@ -19781,13 +19993,18 @@ function transformJSX(path, state, config) {
19781
19993
  const context = getCompilerContext(path, config);
19782
19994
  const ir = lowerJSX(path, context);
19783
19995
  normalizeChildren(ir);
19996
+ if (config.generate === "ssr") assertSSRSupported(ir, state.filename);
19784
19997
  validateBuiltins(ir, {
19785
19998
  isDefineElementRenderRoot: isDefineElementRenderRoot(path),
19786
19999
  filename: state.filename
19787
20000
  });
20001
+ analyzeBindings(ir);
20002
+ if (config.generate === "ssr") {
20003
+ path.replaceWith(emitSSR(ir, context));
20004
+ return;
20005
+ }
19788
20006
  assignDomPaths(ir);
19789
20007
  assignPhysicalDomPaths(ir);
19790
- analyzeBindings(ir);
19791
20008
  collectTemplates(ir, context);
19792
20009
  path.replaceWith(emitDOM(ir, context));
19793
20010
  }