@zeus-js/compiler 0.1.0-beta.2 → 0.1.0-beta.4
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.
- package/dist/compiler.cjs.js +9 -5
- package/dist/compiler.cjs.prod.js +9 -5
- package/dist/compiler.esm-browser.js +14 -10
- package/dist/compiler.esm-browser.prod.js +4 -4
- package/dist/compiler.esm-bundler.js +14 -10
- package/dist/compiler.global.js +14 -10
- package/dist/compiler.global.prod.js +4 -4
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* compiler v0.1.0-beta.
|
|
2
|
+
* compiler v0.1.0-beta.4
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -292,12 +292,12 @@ function emitChildBinding(node, context) {
|
|
|
292
292
|
}
|
|
293
293
|
function emitAttrBinding(target, binding, context) {
|
|
294
294
|
const name = normalizeAttrName(binding.name);
|
|
295
|
-
if (name === "class") return t.expressionStatement(t.callExpression(context.importRuntime("bindClass"), [t.identifier(target.ref.name),
|
|
296
|
-
if (name === "style") return t.expressionStatement(t.callExpression(context.importRuntime("bindStyle"), [t.identifier(target.ref.name),
|
|
295
|
+
if (name === "class") return t.expressionStatement(t.callExpression(context.importRuntime("bindClass"), [t.identifier(target.ref.name), emitGetter(binding.expr)]));
|
|
296
|
+
if (name === "style") return t.expressionStatement(t.callExpression(context.importRuntime("bindStyle"), [t.identifier(target.ref.name), emitGetter(binding.expr)]));
|
|
297
297
|
return t.expressionStatement(t.callExpression(context.importRuntime("bindAttr"), [
|
|
298
298
|
t.identifier(target.ref.name),
|
|
299
299
|
t.stringLiteral(name),
|
|
300
|
-
|
|
300
|
+
emitGetter(binding.expr)
|
|
301
301
|
]));
|
|
302
302
|
}
|
|
303
303
|
function normalizeAttrName(name) {
|
|
@@ -322,9 +322,13 @@ function emitPropBinding(target, binding, context) {
|
|
|
322
322
|
return t.expressionStatement(t.callExpression(context.importRuntime("bindProp"), [
|
|
323
323
|
t.identifier(target.ref.name),
|
|
324
324
|
t.stringLiteral(binding.name),
|
|
325
|
-
|
|
325
|
+
emitGetter(binding.expr)
|
|
326
326
|
]));
|
|
327
327
|
}
|
|
328
|
+
function emitGetter(expr) {
|
|
329
|
+
if (t.isArrowFunctionExpression(expr) || t.isFunctionExpression(expr)) return expr;
|
|
330
|
+
return t.arrowFunctionExpression([], expr);
|
|
331
|
+
}
|
|
328
332
|
function emitRefBinding(target, binding, context) {
|
|
329
333
|
return t.expressionStatement(t.callExpression(context.importRuntime("bindRef"), [t.identifier(target.ref.name), binding.expr]));
|
|
330
334
|
}
|
|
@@ -788,7 +792,7 @@ var CompilerError = class extends Error {
|
|
|
788
792
|
}
|
|
789
793
|
};
|
|
790
794
|
//#endregion
|
|
791
|
-
//#region \0@oxc-project+runtime@0.
|
|
795
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
|
|
792
796
|
function _typeof(o) {
|
|
793
797
|
"@babel/helpers - typeof";
|
|
794
798
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -798,7 +802,7 @@ function _typeof(o) {
|
|
|
798
802
|
}, _typeof(o);
|
|
799
803
|
}
|
|
800
804
|
//#endregion
|
|
801
|
-
//#region \0@oxc-project+runtime@0.
|
|
805
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
|
|
802
806
|
function toPrimitive(t, r) {
|
|
803
807
|
if ("object" != _typeof(t) || !t) return t;
|
|
804
808
|
var e = t[Symbol.toPrimitive];
|
|
@@ -810,13 +814,13 @@ function toPrimitive(t, r) {
|
|
|
810
814
|
return ("string" === r ? String : Number)(t);
|
|
811
815
|
}
|
|
812
816
|
//#endregion
|
|
813
|
-
//#region \0@oxc-project+runtime@0.
|
|
817
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
|
|
814
818
|
function toPropertyKey(t) {
|
|
815
819
|
var i = toPrimitive(t, "string");
|
|
816
820
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
817
821
|
}
|
|
818
822
|
//#endregion
|
|
819
|
-
//#region \0@oxc-project+runtime@0.
|
|
823
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
|
|
820
824
|
function _defineProperty(e, r, t) {
|
|
821
825
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
822
826
|
value: t,
|
|
@@ -826,7 +830,7 @@ function _defineProperty(e, r, t) {
|
|
|
826
830
|
}) : e[r] = t, e;
|
|
827
831
|
}
|
|
828
832
|
//#endregion
|
|
829
|
-
//#region \0@oxc-project+runtime@0.
|
|
833
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/objectSpread2.js
|
|
830
834
|
function ownKeys(e, r) {
|
|
831
835
|
var t = Object.keys(e);
|
|
832
836
|
if (Object.getOwnPropertySymbols) {
|
package/dist/compiler.global.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* compiler v0.1.0-beta.
|
|
2
|
+
* compiler v0.1.0-beta.4
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -14427,12 +14427,12 @@ var ZeusCompiler = (function(exports) {
|
|
|
14427
14427
|
}
|
|
14428
14428
|
function emitAttrBinding(target, binding, context) {
|
|
14429
14429
|
const name = normalizeAttrName(binding.name);
|
|
14430
|
-
if (name === "class") return import_lib$1.expressionStatement(import_lib$1.callExpression(context.importRuntime("bindClass"), [import_lib$1.identifier(target.ref.name),
|
|
14431
|
-
if (name === "style") return import_lib$1.expressionStatement(import_lib$1.callExpression(context.importRuntime("bindStyle"), [import_lib$1.identifier(target.ref.name),
|
|
14430
|
+
if (name === "class") return import_lib$1.expressionStatement(import_lib$1.callExpression(context.importRuntime("bindClass"), [import_lib$1.identifier(target.ref.name), emitGetter(binding.expr)]));
|
|
14431
|
+
if (name === "style") return import_lib$1.expressionStatement(import_lib$1.callExpression(context.importRuntime("bindStyle"), [import_lib$1.identifier(target.ref.name), emitGetter(binding.expr)]));
|
|
14432
14432
|
return import_lib$1.expressionStatement(import_lib$1.callExpression(context.importRuntime("bindAttr"), [
|
|
14433
14433
|
import_lib$1.identifier(target.ref.name),
|
|
14434
14434
|
import_lib$1.stringLiteral(name),
|
|
14435
|
-
|
|
14435
|
+
emitGetter(binding.expr)
|
|
14436
14436
|
]));
|
|
14437
14437
|
}
|
|
14438
14438
|
function normalizeAttrName(name) {
|
|
@@ -14457,9 +14457,13 @@ var ZeusCompiler = (function(exports) {
|
|
|
14457
14457
|
return import_lib$1.expressionStatement(import_lib$1.callExpression(context.importRuntime("bindProp"), [
|
|
14458
14458
|
import_lib$1.identifier(target.ref.name),
|
|
14459
14459
|
import_lib$1.stringLiteral(binding.name),
|
|
14460
|
-
|
|
14460
|
+
emitGetter(binding.expr)
|
|
14461
14461
|
]));
|
|
14462
14462
|
}
|
|
14463
|
+
function emitGetter(expr) {
|
|
14464
|
+
if (import_lib$1.isArrowFunctionExpression(expr) || import_lib$1.isFunctionExpression(expr)) return expr;
|
|
14465
|
+
return import_lib$1.arrowFunctionExpression([], expr);
|
|
14466
|
+
}
|
|
14463
14467
|
function emitRefBinding(target, binding, context) {
|
|
14464
14468
|
return import_lib$1.expressionStatement(import_lib$1.callExpression(context.importRuntime("bindRef"), [import_lib$1.identifier(target.ref.name), binding.expr]));
|
|
14465
14469
|
}
|
|
@@ -14923,7 +14927,7 @@ var ZeusCompiler = (function(exports) {
|
|
|
14923
14927
|
}
|
|
14924
14928
|
};
|
|
14925
14929
|
//#endregion
|
|
14926
|
-
//#region \0@oxc-project+runtime@0.
|
|
14930
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
|
|
14927
14931
|
function _typeof(o) {
|
|
14928
14932
|
"@babel/helpers - typeof";
|
|
14929
14933
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -14933,7 +14937,7 @@ var ZeusCompiler = (function(exports) {
|
|
|
14933
14937
|
}, _typeof(o);
|
|
14934
14938
|
}
|
|
14935
14939
|
//#endregion
|
|
14936
|
-
//#region \0@oxc-project+runtime@0.
|
|
14940
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
|
|
14937
14941
|
function toPrimitive(t, r) {
|
|
14938
14942
|
if ("object" != _typeof(t) || !t) return t;
|
|
14939
14943
|
var e = t[Symbol.toPrimitive];
|
|
@@ -14945,13 +14949,13 @@ var ZeusCompiler = (function(exports) {
|
|
|
14945
14949
|
return ("string" === r ? String : Number)(t);
|
|
14946
14950
|
}
|
|
14947
14951
|
//#endregion
|
|
14948
|
-
//#region \0@oxc-project+runtime@0.
|
|
14952
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
|
|
14949
14953
|
function toPropertyKey(t) {
|
|
14950
14954
|
var i = toPrimitive(t, "string");
|
|
14951
14955
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
14952
14956
|
}
|
|
14953
14957
|
//#endregion
|
|
14954
|
-
//#region \0@oxc-project+runtime@0.
|
|
14958
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
|
|
14955
14959
|
function _defineProperty(e, r, t) {
|
|
14956
14960
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
14957
14961
|
value: t,
|
|
@@ -14961,7 +14965,7 @@ var ZeusCompiler = (function(exports) {
|
|
|
14961
14965
|
}) : e[r] = t, e;
|
|
14962
14966
|
}
|
|
14963
14967
|
//#endregion
|
|
14964
|
-
//#region \0@oxc-project+runtime@0.
|
|
14968
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/objectSpread2.js
|
|
14965
14969
|
function ownKeys(e, r) {
|
|
14966
14970
|
var t = Object.keys(e);
|
|
14967
14971
|
if (Object.getOwnPropertySymbols) {
|