@constela/server 14.0.0 → 14.0.2

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 +20 -0
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -403,6 +403,8 @@ function evaluate(expr, ctx) {
403
403
  return expr.value;
404
404
  case "state":
405
405
  return ctx.state.get(expr.name);
406
+ case "local":
407
+ return ctx.locals[expr.name];
406
408
  case "var": {
407
409
  let varName = expr.name;
408
410
  let pathParts = [];
@@ -535,6 +537,14 @@ function evaluate(expr, ctx) {
535
537
  const arrayExpr = expr;
536
538
  return arrayExpr.elements.map((elem) => evaluate(elem, ctx));
537
539
  }
540
+ case "obj": {
541
+ const objExpr = expr;
542
+ const result = {};
543
+ for (const [key, value] of Object.entries(objExpr.props)) {
544
+ result[key] = evaluate(value, ctx);
545
+ }
546
+ return result;
547
+ }
538
548
  default: {
539
549
  const _exhaustiveCheck = expr;
540
550
  throw new Error(`Unknown expression type: ${JSON.stringify(_exhaustiveCheck)}`);
@@ -1155,6 +1165,8 @@ function evaluate2(expr, ctx) {
1155
1165
  return expr.value;
1156
1166
  case "state":
1157
1167
  return ctx.state.get(expr.name);
1168
+ case "local":
1169
+ return ctx.locals[expr.name];
1158
1170
  case "var": {
1159
1171
  let varName = expr.name;
1160
1172
  let pathParts = [];
@@ -1289,6 +1301,14 @@ function evaluate2(expr, ctx) {
1289
1301
  const arrayExpr = expr;
1290
1302
  return arrayExpr.elements.map((elem) => evaluate2(elem, ctx));
1291
1303
  }
1304
+ case "obj": {
1305
+ const objExpr = expr;
1306
+ const result = {};
1307
+ for (const [key, value] of Object.entries(objExpr.props)) {
1308
+ result[key] = evaluate2(value, ctx);
1309
+ }
1310
+ return result;
1311
+ }
1292
1312
  default: {
1293
1313
  return void 0;
1294
1314
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/server",
3
- "version": "14.0.0",
3
+ "version": "14.0.2",
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.6",
19
- "@constela/core": "^0.18.0"
18
+ "@constela/compiler": "^0.15.8",
19
+ "@constela/core": "^0.18.2"
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/core": "0.18.0",
33
- "@constela/compiler": "0.15.6"
32
+ "@constela/compiler": "0.15.8",
33
+ "@constela/core": "0.18.2"
34
34
  },
35
35
  "engines": {
36
36
  "node": ">=20.0.0"