@constela/compiler 0.3.3 → 0.4.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 CHANGED
@@ -89,7 +89,7 @@ interface CompiledFetchStep {
89
89
  onSuccess?: CompiledActionStep[];
90
90
  onError?: CompiledActionStep[];
91
91
  }
92
- type CompiledNode = CompiledElementNode | CompiledTextNode | CompiledIfNode | CompiledEachNode;
92
+ type CompiledNode = CompiledElementNode | CompiledTextNode | CompiledIfNode | CompiledEachNode | CompiledMarkdownNode | CompiledCodeNode;
93
93
  interface CompiledElementNode {
94
94
  kind: 'element';
95
95
  tag: string;
@@ -114,6 +114,15 @@ interface CompiledEachNode {
114
114
  key?: CompiledExpression;
115
115
  body: CompiledNode;
116
116
  }
117
+ interface CompiledMarkdownNode {
118
+ kind: 'markdown';
119
+ content: CompiledExpression;
120
+ }
121
+ interface CompiledCodeNode {
122
+ kind: 'code';
123
+ language: CompiledExpression;
124
+ content: CompiledExpression;
125
+ }
117
126
  type CompiledExpression = CompiledLitExpr | CompiledStateExpr | CompiledVarExpr | CompiledBinExpr | CompiledNotExpr | CompiledCondExpr | CompiledGetExpr;
118
127
  interface CompiledLitExpr {
119
128
  expr: 'lit';
@@ -213,4 +222,4 @@ type ValidatePassResult = ValidatePassSuccess | ValidatePassFailure;
213
222
  */
214
223
  declare function validatePass(input: unknown): ValidatePassResult;
215
224
 
216
- export { type AnalysisContext, type AnalyzePassFailure, type AnalyzePassResult, type AnalyzePassSuccess, type CompileFailure, type CompileResult, type CompileSuccess, type CompiledAction, type CompiledActionStep, type CompiledEachNode, type CompiledElementNode, type CompiledEventHandler, type CompiledExpression, type CompiledFetchStep, type CompiledIfNode, type CompiledNode, type CompiledProgram, type CompiledSetStep, type CompiledTextNode, type CompiledUpdateStep, type ValidatePassFailure, type ValidatePassResult, type ValidatePassSuccess, analyzePass, compile, transformPass, validatePass };
225
+ export { type AnalysisContext, type AnalyzePassFailure, type AnalyzePassResult, type AnalyzePassSuccess, type CompileFailure, type CompileResult, type CompileSuccess, type CompiledAction, type CompiledActionStep, type CompiledCodeNode, type CompiledEachNode, type CompiledElementNode, type CompiledEventHandler, type CompiledExpression, type CompiledFetchStep, type CompiledIfNode, type CompiledMarkdownNode, type CompiledNode, type CompiledProgram, type CompiledSetStep, type CompiledTextNode, type CompiledUpdateStep, type ValidatePassFailure, type ValidatePassResult, type ValidatePassSuccess, analyzePass, compile, transformPass, validatePass };
package/dist/index.js CHANGED
@@ -743,6 +743,17 @@ function transformViewNode(node, ctx) {
743
743
  };
744
744
  return transformViewNode(def.view, newCtx);
745
745
  }
746
+ case "markdown":
747
+ return {
748
+ kind: "markdown",
749
+ content: transformExpression(node.content, ctx)
750
+ };
751
+ case "code":
752
+ return {
753
+ kind: "code",
754
+ language: transformExpression(node.language, ctx),
755
+ content: transformExpression(node.content, ctx)
756
+ };
746
757
  case "slot": {
747
758
  if (ctx.currentChildren && ctx.currentChildren.length > 0) {
748
759
  if (ctx.currentChildren.length === 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/compiler",
3
- "version": "0.3.3",
3
+ "version": "0.4.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.3.3"
18
+ "@constela/core": "0.4.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/node": "^20.10.0",