@zeus-js/compiler 0.1.0-beta.3 → 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 +9 -5
- package/dist/compiler.esm-browser.prod.js +4 -4
- package/dist/compiler.esm-bundler.js +9 -5
- package/dist/compiler.global.js +9 -5
- package/dist/compiler.global.prod.js +4 -4
- package/package.json +2 -2
|
@@ -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
|
}
|
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
|
}
|