@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
package/dist/compiler.cjs.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
|
**/
|
|
@@ -319,12 +319,12 @@ function emitChildBinding(node, context) {
|
|
|
319
319
|
}
|
|
320
320
|
function emitAttrBinding(target, binding, context) {
|
|
321
321
|
const name = normalizeAttrName(binding.name);
|
|
322
|
-
if (name === "class") return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindClass"), [_babel_types.identifier(target.ref.name),
|
|
323
|
-
if (name === "style") return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindStyle"), [_babel_types.identifier(target.ref.name),
|
|
322
|
+
if (name === "class") return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindClass"), [_babel_types.identifier(target.ref.name), emitGetter(binding.expr)]));
|
|
323
|
+
if (name === "style") return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindStyle"), [_babel_types.identifier(target.ref.name), emitGetter(binding.expr)]));
|
|
324
324
|
return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindAttr"), [
|
|
325
325
|
_babel_types.identifier(target.ref.name),
|
|
326
326
|
_babel_types.stringLiteral(name),
|
|
327
|
-
|
|
327
|
+
emitGetter(binding.expr)
|
|
328
328
|
]));
|
|
329
329
|
}
|
|
330
330
|
function normalizeAttrName(name) {
|
|
@@ -349,9 +349,13 @@ function emitPropBinding(target, binding, context) {
|
|
|
349
349
|
return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindProp"), [
|
|
350
350
|
_babel_types.identifier(target.ref.name),
|
|
351
351
|
_babel_types.stringLiteral(binding.name),
|
|
352
|
-
|
|
352
|
+
emitGetter(binding.expr)
|
|
353
353
|
]));
|
|
354
354
|
}
|
|
355
|
+
function emitGetter(expr) {
|
|
356
|
+
if (_babel_types.isArrowFunctionExpression(expr) || _babel_types.isFunctionExpression(expr)) return expr;
|
|
357
|
+
return _babel_types.arrowFunctionExpression([], expr);
|
|
358
|
+
}
|
|
355
359
|
function emitRefBinding(target, binding, context) {
|
|
356
360
|
return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindRef"), [_babel_types.identifier(target.ref.name), binding.expr]));
|
|
357
361
|
}
|
|
@@ -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
|
**/
|
|
@@ -319,12 +319,12 @@ function emitChildBinding(node, context) {
|
|
|
319
319
|
}
|
|
320
320
|
function emitAttrBinding(target, binding, context) {
|
|
321
321
|
const name = normalizeAttrName(binding.name);
|
|
322
|
-
if (name === "class") return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindClass"), [_babel_types.identifier(target.ref.name),
|
|
323
|
-
if (name === "style") return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindStyle"), [_babel_types.identifier(target.ref.name),
|
|
322
|
+
if (name === "class") return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindClass"), [_babel_types.identifier(target.ref.name), emitGetter(binding.expr)]));
|
|
323
|
+
if (name === "style") return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindStyle"), [_babel_types.identifier(target.ref.name), emitGetter(binding.expr)]));
|
|
324
324
|
return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindAttr"), [
|
|
325
325
|
_babel_types.identifier(target.ref.name),
|
|
326
326
|
_babel_types.stringLiteral(name),
|
|
327
|
-
|
|
327
|
+
emitGetter(binding.expr)
|
|
328
328
|
]));
|
|
329
329
|
}
|
|
330
330
|
function normalizeAttrName(name) {
|
|
@@ -349,9 +349,13 @@ function emitPropBinding(target, binding, context) {
|
|
|
349
349
|
return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindProp"), [
|
|
350
350
|
_babel_types.identifier(target.ref.name),
|
|
351
351
|
_babel_types.stringLiteral(binding.name),
|
|
352
|
-
|
|
352
|
+
emitGetter(binding.expr)
|
|
353
353
|
]));
|
|
354
354
|
}
|
|
355
|
+
function emitGetter(expr) {
|
|
356
|
+
if (_babel_types.isArrowFunctionExpression(expr) || _babel_types.isFunctionExpression(expr)) return expr;
|
|
357
|
+
return _babel_types.arrowFunctionExpression([], expr);
|
|
358
|
+
}
|
|
355
359
|
function emitRefBinding(target, binding, context) {
|
|
356
360
|
return _babel_types.expressionStatement(_babel_types.callExpression(context.importRuntime("bindRef"), [_babel_types.identifier(target.ref.name), binding.expr]));
|
|
357
361
|
}
|
|
@@ -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
|
**/
|
|
@@ -14422,12 +14422,12 @@ function emitChildBinding(node, context) {
|
|
|
14422
14422
|
}
|
|
14423
14423
|
function emitAttrBinding(target, binding, context) {
|
|
14424
14424
|
const name = normalizeAttrName(binding.name);
|
|
14425
|
-
if (name === "class") return import_lib$1.expressionStatement(import_lib$1.callExpression(context.importRuntime("bindClass"), [import_lib$1.identifier(target.ref.name),
|
|
14426
|
-
if (name === "style") return import_lib$1.expressionStatement(import_lib$1.callExpression(context.importRuntime("bindStyle"), [import_lib$1.identifier(target.ref.name),
|
|
14425
|
+
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)]));
|
|
14426
|
+
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)]));
|
|
14427
14427
|
return import_lib$1.expressionStatement(import_lib$1.callExpression(context.importRuntime("bindAttr"), [
|
|
14428
14428
|
import_lib$1.identifier(target.ref.name),
|
|
14429
14429
|
import_lib$1.stringLiteral(name),
|
|
14430
|
-
|
|
14430
|
+
emitGetter(binding.expr)
|
|
14431
14431
|
]));
|
|
14432
14432
|
}
|
|
14433
14433
|
function normalizeAttrName(name) {
|
|
@@ -14452,9 +14452,13 @@ function emitPropBinding(target, binding, context) {
|
|
|
14452
14452
|
return import_lib$1.expressionStatement(import_lib$1.callExpression(context.importRuntime("bindProp"), [
|
|
14453
14453
|
import_lib$1.identifier(target.ref.name),
|
|
14454
14454
|
import_lib$1.stringLiteral(binding.name),
|
|
14455
|
-
|
|
14455
|
+
emitGetter(binding.expr)
|
|
14456
14456
|
]));
|
|
14457
14457
|
}
|
|
14458
|
+
function emitGetter(expr) {
|
|
14459
|
+
if (import_lib$1.isArrowFunctionExpression(expr) || import_lib$1.isFunctionExpression(expr)) return expr;
|
|
14460
|
+
return import_lib$1.arrowFunctionExpression([], expr);
|
|
14461
|
+
}
|
|
14458
14462
|
function emitRefBinding(target, binding, context) {
|
|
14459
14463
|
return import_lib$1.expressionStatement(import_lib$1.callExpression(context.importRuntime("bindRef"), [import_lib$1.identifier(target.ref.name), binding.expr]));
|
|
14460
14464
|
}
|
|
@@ -14918,7 +14922,7 @@ var CompilerError = class extends Error {
|
|
|
14918
14922
|
}
|
|
14919
14923
|
};
|
|
14920
14924
|
//#endregion
|
|
14921
|
-
//#region \0@oxc-project+runtime@0.
|
|
14925
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
|
|
14922
14926
|
function _typeof(o) {
|
|
14923
14927
|
"@babel/helpers - typeof";
|
|
14924
14928
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -14928,7 +14932,7 @@ function _typeof(o) {
|
|
|
14928
14932
|
}, _typeof(o);
|
|
14929
14933
|
}
|
|
14930
14934
|
//#endregion
|
|
14931
|
-
//#region \0@oxc-project+runtime@0.
|
|
14935
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
|
|
14932
14936
|
function toPrimitive(t, r) {
|
|
14933
14937
|
if ("object" != _typeof(t) || !t) return t;
|
|
14934
14938
|
var e = t[Symbol.toPrimitive];
|
|
@@ -14940,13 +14944,13 @@ function toPrimitive(t, r) {
|
|
|
14940
14944
|
return ("string" === r ? String : Number)(t);
|
|
14941
14945
|
}
|
|
14942
14946
|
//#endregion
|
|
14943
|
-
//#region \0@oxc-project+runtime@0.
|
|
14947
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
|
|
14944
14948
|
function toPropertyKey(t) {
|
|
14945
14949
|
var i = toPrimitive(t, "string");
|
|
14946
14950
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
14947
14951
|
}
|
|
14948
14952
|
//#endregion
|
|
14949
|
-
//#region \0@oxc-project+runtime@0.
|
|
14953
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
|
|
14950
14954
|
function _defineProperty(e, r, t) {
|
|
14951
14955
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
14952
14956
|
value: t,
|
|
@@ -14956,7 +14960,7 @@ function _defineProperty(e, r, t) {
|
|
|
14956
14960
|
}) : e[r] = t, e;
|
|
14957
14961
|
}
|
|
14958
14962
|
//#endregion
|
|
14959
|
-
//#region \0@oxc-project+runtime@0.
|
|
14963
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/objectSpread2.js
|
|
14960
14964
|
function ownKeys(e, r) {
|
|
14961
14965
|
var t = Object.keys(e);
|
|
14962
14966
|
if (Object.getOwnPropertySymbols) {
|