@constela/compiler 0.11.3 → 0.12.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.
- package/dist/index.d.ts +13 -0
- package/dist/index.js +22 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -66,6 +66,19 @@ interface CompiledRouteDefinition {
|
|
|
66
66
|
layout?: string;
|
|
67
67
|
layoutParams?: Record<string, Expression>;
|
|
68
68
|
meta?: Record<string, CompiledExpression>;
|
|
69
|
+
/** Canonical URL for SEO */
|
|
70
|
+
canonical?: CompiledExpression;
|
|
71
|
+
/** JSON-LD structured data for SEO */
|
|
72
|
+
jsonLd?: CompiledJsonLdDefinition;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Compiled JSON-LD structured data definition
|
|
76
|
+
*/
|
|
77
|
+
interface CompiledJsonLdDefinition {
|
|
78
|
+
/** Schema.org type (e.g., "Article", "WebPage", "Organization") */
|
|
79
|
+
type: string;
|
|
80
|
+
/** Compiled properties for the JSON-LD object */
|
|
81
|
+
properties: Record<string, CompiledExpression>;
|
|
69
82
|
}
|
|
70
83
|
interface CompiledLifecycleHooks {
|
|
71
84
|
onMount?: string;
|
package/dist/index.js
CHANGED
|
@@ -1253,7 +1253,15 @@ function transformEventHandler(handler, ctx) {
|
|
|
1253
1253
|
action: handler.action
|
|
1254
1254
|
};
|
|
1255
1255
|
if (handler.payload) {
|
|
1256
|
-
|
|
1256
|
+
if ("expr" in handler.payload) {
|
|
1257
|
+
result.payload = transformExpression(handler.payload, ctx);
|
|
1258
|
+
} else {
|
|
1259
|
+
const objectPayload = {};
|
|
1260
|
+
for (const [key, value] of Object.entries(handler.payload)) {
|
|
1261
|
+
objectPayload[key] = transformExpression(value, ctx);
|
|
1262
|
+
}
|
|
1263
|
+
result.payload = objectPayload;
|
|
1264
|
+
}
|
|
1257
1265
|
}
|
|
1258
1266
|
if (handler.debounce !== void 0) {
|
|
1259
1267
|
result.debounce = handler.debounce;
|
|
@@ -1735,6 +1743,19 @@ function transformRouteDefinition(route, ctx) {
|
|
|
1735
1743
|
compiled.meta[key] = transformExpression(value, ctx);
|
|
1736
1744
|
}
|
|
1737
1745
|
}
|
|
1746
|
+
if (route.canonical) {
|
|
1747
|
+
compiled.canonical = transformExpression(route.canonical, ctx);
|
|
1748
|
+
}
|
|
1749
|
+
if (route.jsonLd) {
|
|
1750
|
+
const compiledProperties = {};
|
|
1751
|
+
for (const [key, value] of Object.entries(route.jsonLd.properties)) {
|
|
1752
|
+
compiledProperties[key] = transformExpression(value, ctx);
|
|
1753
|
+
}
|
|
1754
|
+
compiled.jsonLd = {
|
|
1755
|
+
type: route.jsonLd.type,
|
|
1756
|
+
properties: compiledProperties
|
|
1757
|
+
};
|
|
1758
|
+
}
|
|
1738
1759
|
return compiled;
|
|
1739
1760
|
}
|
|
1740
1761
|
function transformLifecycleHooks(lifecycle) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constela/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Compiler for Constela UI framework - AST to Program transformation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@constela/core": "0.
|
|
18
|
+
"@constela/core": "0.13.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^20.10.0",
|