@constela/server 14.0.4 → 14.0.5
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/index.js +17 -7
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -504,16 +504,19 @@ function evaluate(expr, ctx) {
|
|
|
504
504
|
}
|
|
505
505
|
case "call": {
|
|
506
506
|
const callExpr = expr;
|
|
507
|
-
if (callExpr.target === null) {
|
|
508
|
-
const args2 = callExpr.args?.map((arg) => evaluate(arg, ctx)) ?? [];
|
|
509
|
-
return callChartHelper(callExpr.method, args2);
|
|
510
|
-
}
|
|
511
|
-
const target = evaluate(callExpr.target, ctx);
|
|
512
|
-
if (target == null) return void 0;
|
|
513
507
|
const args = callExpr.args?.map((arg) => {
|
|
514
508
|
if (arg.expr === "lambda") return arg;
|
|
515
509
|
return evaluate(arg, ctx);
|
|
516
510
|
}) ?? [];
|
|
511
|
+
if (callExpr.target === null) {
|
|
512
|
+
const result = callChartHelper(callExpr.method, args);
|
|
513
|
+
if (result !== void 0) {
|
|
514
|
+
return result;
|
|
515
|
+
}
|
|
516
|
+
return void 0;
|
|
517
|
+
}
|
|
518
|
+
const target = evaluate(callExpr.target, ctx);
|
|
519
|
+
if (target == null) return void 0;
|
|
517
520
|
if (Array.isArray(target)) {
|
|
518
521
|
return callArrayMethod(target, callExpr.method, args, ctx, callExpr.args);
|
|
519
522
|
}
|
|
@@ -805,7 +808,14 @@ async function renderLocalState(node, ctx) {
|
|
|
805
808
|
for (const [name, field] of Object.entries(node.state)) {
|
|
806
809
|
const initial = field.initial;
|
|
807
810
|
if (initial && typeof initial === "object" && "expr" in initial) {
|
|
808
|
-
|
|
811
|
+
const evalCtx = {
|
|
812
|
+
...ctx,
|
|
813
|
+
locals: {
|
|
814
|
+
...ctx.locals,
|
|
815
|
+
...localStateValues
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
localStateValues[name] = evaluate(initial, evalCtx);
|
|
809
819
|
} else {
|
|
810
820
|
localStateValues[name] = initial;
|
|
811
821
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constela/server",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.5",
|
|
4
4
|
"description": "Server-side rendering for Constela UI framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@constela/compiler": "^0.15.
|
|
19
|
-
"@constela/core": "^0.18.
|
|
18
|
+
"@constela/compiler": "^0.15.10",
|
|
19
|
+
"@constela/core": "^0.18.4"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"isomorphic-dompurify": "^2.35.0",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"tsup": "^8.0.0",
|
|
30
30
|
"typescript": "^5.3.0",
|
|
31
31
|
"vitest": "^2.0.0",
|
|
32
|
-
"@constela/compiler": "0.15.
|
|
33
|
-
"@constela/core": "0.18.
|
|
32
|
+
"@constela/compiler": "0.15.10",
|
|
33
|
+
"@constela/core": "0.18.4"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=20.0.0"
|