@constela/server 14.0.3 → 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 -6
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/renderer.ts
|
|
2
|
-
import { isCookieInitialExpr } from "@constela/core";
|
|
2
|
+
import { isCookieInitialExpr, callChartHelper } from "@constela/core";
|
|
3
3
|
|
|
4
4
|
// src/markdown.ts
|
|
5
5
|
import { marked } from "marked";
|
|
@@ -504,15 +504,19 @@ function evaluate(expr, ctx) {
|
|
|
504
504
|
}
|
|
505
505
|
case "call": {
|
|
506
506
|
const callExpr = expr;
|
|
507
|
+
const args = callExpr.args?.map((arg) => {
|
|
508
|
+
if (arg.expr === "lambda") return arg;
|
|
509
|
+
return evaluate(arg, ctx);
|
|
510
|
+
}) ?? [];
|
|
507
511
|
if (callExpr.target === null) {
|
|
512
|
+
const result = callChartHelper(callExpr.method, args);
|
|
513
|
+
if (result !== void 0) {
|
|
514
|
+
return result;
|
|
515
|
+
}
|
|
508
516
|
return void 0;
|
|
509
517
|
}
|
|
510
518
|
const target = evaluate(callExpr.target, ctx);
|
|
511
519
|
if (target == null) return void 0;
|
|
512
|
-
const args = callExpr.args?.map((arg) => {
|
|
513
|
-
if (arg.expr === "lambda") return arg;
|
|
514
|
-
return evaluate(arg, ctx);
|
|
515
|
-
}) ?? [];
|
|
516
520
|
if (Array.isArray(target)) {
|
|
517
521
|
return callArrayMethod(target, callExpr.method, args, ctx, callExpr.args);
|
|
518
522
|
}
|
|
@@ -804,7 +808,14 @@ async function renderLocalState(node, ctx) {
|
|
|
804
808
|
for (const [name, field] of Object.entries(node.state)) {
|
|
805
809
|
const initial = field.initial;
|
|
806
810
|
if (initial && typeof initial === "object" && "expr" in initial) {
|
|
807
|
-
|
|
811
|
+
const evalCtx = {
|
|
812
|
+
...ctx,
|
|
813
|
+
locals: {
|
|
814
|
+
...ctx.locals,
|
|
815
|
+
...localStateValues
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
localStateValues[name] = evaluate(initial, evalCtx);
|
|
808
819
|
} else {
|
|
809
820
|
localStateValues[name] = initial;
|
|
810
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"
|