@constela/server 14.0.5 → 15.0.0

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -18
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/renderer.ts
2
- import { isCookieInitialExpr, callChartHelper } from "@constela/core";
2
+ import { isCookieInitialExpr, callGlobalFunction } from "@constela/core";
3
3
 
4
4
  // src/markdown.ts
5
5
  import { marked } from "marked";
@@ -504,19 +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
- }) ?? [];
511
507
  if (callExpr.target === null) {
512
- const result = callChartHelper(callExpr.method, args);
513
- if (result !== void 0) {
514
- return result;
515
- }
516
- return void 0;
508
+ const globalArgs = callExpr.args?.map((arg) => {
509
+ if (arg.expr === "lambda") return arg;
510
+ return evaluate(arg, ctx);
511
+ }) ?? [];
512
+ return callGlobalFunction(callExpr.method, globalArgs);
517
513
  }
518
514
  const target = evaluate(callExpr.target, ctx);
519
515
  if (target == null) return void 0;
516
+ const args = callExpr.args?.map((arg) => {
517
+ if (arg.expr === "lambda") return arg;
518
+ return evaluate(arg, ctx);
519
+ }) ?? [];
520
520
  if (Array.isArray(target)) {
521
521
  return callArrayMethod(target, callExpr.method, args, ctx, callExpr.args);
522
522
  }
@@ -808,14 +808,7 @@ async function renderLocalState(node, ctx) {
808
808
  for (const [name, field] of Object.entries(node.state)) {
809
809
  const initial = field.initial;
810
810
  if (initial && typeof initial === "object" && "expr" in initial) {
811
- const evalCtx = {
812
- ...ctx,
813
- locals: {
814
- ...ctx.locals,
815
- ...localStateValues
816
- }
817
- };
818
- localStateValues[name] = evaluate(initial, evalCtx);
811
+ localStateValues[name] = evaluate(initial, ctx);
819
812
  } else {
820
813
  localStateValues[name] = initial;
821
814
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/server",
3
- "version": "14.0.5",
3
+ "version": "15.0.0",
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.10",
19
- "@constela/core": "^0.18.4"
18
+ "@constela/compiler": "^0.15.13",
19
+ "@constela/core": "^0.19.0"
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.10",
33
- "@constela/core": "0.18.4"
32
+ "@constela/core": "0.19.0",
33
+ "@constela/compiler": "0.15.13"
34
34
  },
35
35
  "engines": {
36
36
  "node": ">=20.0.0"