@zeus-js/compiler 0.1.0-beta.0 → 0.1.0-beta.2

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-beta.0
2
+ * compiler v0.1.0-beta.2
3
3
  * (c) 2026 baicie
4
4
  * Released under the MIT License.
5
5
  **/
@@ -30,8 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  }) : target, mod));
31
31
  //#endregion
32
32
  let _babel_helper_plugin_utils = require("@babel/helper-plugin-utils");
33
- let _babel_plugin_syntax_jsx = require("@babel/plugin-syntax-jsx");
34
- _babel_plugin_syntax_jsx = __toESM(_babel_plugin_syntax_jsx);
35
33
  let _zeus_js_shared = require("@zeus-js/shared");
36
34
  let _babel_types = require("@babel/types");
37
35
  _babel_types = __toESM(_babel_types);
@@ -667,8 +665,8 @@ function emitFor(node, context) {
667
665
  function emitMountFor(node, context) {
668
666
  var _node$by;
669
667
  const params = [node.item];
670
- const path = node.domPath;
671
668
  if (node.index) params.push(node.index);
669
+ const path = node.domPath;
672
670
  if (!path || path.kind !== "Marker") throw new Error("For DOM path is not assigned");
673
671
  return _babel_types.callExpression(context.importRuntime("mountFor"), [
674
672
  _babel_types.identifier(path.parent.name),
@@ -680,9 +678,10 @@ function emitMountFor(node, context) {
680
678
  }
681
679
  function emitHost(node, context) {
682
680
  const props = buildHostProps(node, context);
683
- const hostCall = _babel_types.callExpression(context.importRuntime("Host"), [_babel_types.objectExpression(props)]);
684
- if (!node.child) return hostCall;
681
+ const hostIdent = context.importRuntime("Host");
682
+ if (!node.child) return _babel_types.callExpression(hostIdent, [_babel_types.objectExpression(props)]);
685
683
  const childExpr = emitNodeExpression(node.child, context);
684
+ const hostCall = _babel_types.callExpression(hostIdent, [_babel_types.objectExpression(props)]);
686
685
  return _babel_types.callExpression(_babel_types.arrowFunctionExpression([], _babel_types.blockStatement([_babel_types.expressionStatement(hostCall), _babel_types.returnStatement(childExpr)])), []);
687
686
  }
688
687
  function buildHostProps(node, context) {
@@ -1726,11 +1725,18 @@ function createVisitor(config) {
1726
1725
  }
1727
1726
  //#endregion
1728
1727
  //#region packages/core/compiler/src/index.ts
1728
+ function hasParserPlugin(plugins, name) {
1729
+ return plugins.some((plugin) => (Array.isArray(plugin) ? plugin[0] : plugin) === name);
1730
+ }
1729
1731
  var src_default = (0, _babel_helper_plugin_utils.declare)((api, options) => {
1730
1732
  api.assertVersion(7);
1731
1733
  return {
1732
1734
  name: "babel-plugin-zeus-compiler",
1733
- inherits: _babel_plugin_syntax_jsx.default,
1735
+ manipulateOptions(_opts, parserOpts) {
1736
+ var _parserOpts$plugins;
1737
+ (_parserOpts$plugins = parserOpts.plugins) !== null && _parserOpts$plugins !== void 0 || (parserOpts.plugins = []);
1738
+ if (!hasParserPlugin(parserOpts.plugins, "jsx")) parserOpts.plugins.push("jsx");
1739
+ },
1734
1740
  visitor: createVisitor(resolveConfig(options))
1735
1741
  };
1736
1742
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * compiler v0.1.0-beta.0
2
+ * compiler v0.1.0-beta.2
3
3
  * (c) 2026 baicie
4
4
  * Released under the MIT License.
5
5
  **/
@@ -30,8 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  }) : target, mod));
31
31
  //#endregion
32
32
  let _babel_helper_plugin_utils = require("@babel/helper-plugin-utils");
33
- let _babel_plugin_syntax_jsx = require("@babel/plugin-syntax-jsx");
34
- _babel_plugin_syntax_jsx = __toESM(_babel_plugin_syntax_jsx);
35
33
  let _zeus_js_shared = require("@zeus-js/shared");
36
34
  let _babel_types = require("@babel/types");
37
35
  _babel_types = __toESM(_babel_types);
@@ -667,8 +665,8 @@ function emitFor(node, context) {
667
665
  function emitMountFor(node, context) {
668
666
  var _node$by;
669
667
  const params = [node.item];
670
- const path = node.domPath;
671
668
  if (node.index) params.push(node.index);
669
+ const path = node.domPath;
672
670
  if (!path || path.kind !== "Marker") throw new Error("For DOM path is not assigned");
673
671
  return _babel_types.callExpression(context.importRuntime("mountFor"), [
674
672
  _babel_types.identifier(path.parent.name),
@@ -680,9 +678,10 @@ function emitMountFor(node, context) {
680
678
  }
681
679
  function emitHost(node, context) {
682
680
  const props = buildHostProps(node, context);
683
- const hostCall = _babel_types.callExpression(context.importRuntime("Host"), [_babel_types.objectExpression(props)]);
684
- if (!node.child) return hostCall;
681
+ const hostIdent = context.importRuntime("Host");
682
+ if (!node.child) return _babel_types.callExpression(hostIdent, [_babel_types.objectExpression(props)]);
685
683
  const childExpr = emitNodeExpression(node.child, context);
684
+ const hostCall = _babel_types.callExpression(hostIdent, [_babel_types.objectExpression(props)]);
686
685
  return _babel_types.callExpression(_babel_types.arrowFunctionExpression([], _babel_types.blockStatement([_babel_types.expressionStatement(hostCall), _babel_types.returnStatement(childExpr)])), []);
687
686
  }
688
687
  function buildHostProps(node, context) {
@@ -1726,11 +1725,18 @@ function createVisitor(config) {
1726
1725
  }
1727
1726
  //#endregion
1728
1727
  //#region packages/core/compiler/src/index.ts
1728
+ function hasParserPlugin(plugins, name) {
1729
+ return plugins.some((plugin) => (Array.isArray(plugin) ? plugin[0] : plugin) === name);
1730
+ }
1729
1731
  var src_default = (0, _babel_helper_plugin_utils.declare)((api, options) => {
1730
1732
  api.assertVersion(7);
1731
1733
  return {
1732
1734
  name: "babel-plugin-zeus-compiler",
1733
- inherits: _babel_plugin_syntax_jsx.default,
1735
+ manipulateOptions(_opts, parserOpts) {
1736
+ var _parserOpts$plugins;
1737
+ (_parserOpts$plugins = parserOpts.plugins) !== null && _parserOpts$plugins !== void 0 || (parserOpts.plugins = []);
1738
+ if (!hasParserPlugin(parserOpts.plugins, "jsx")) parserOpts.plugins.push("jsx");
1739
+ },
1734
1740
  visitor: createVisitor(resolveConfig(options))
1735
1741
  };
1736
1742
  });