@xaendar/compiler 0.7.21 → 0.7.23

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.
@@ -891,7 +891,7 @@ var Generator = class {
891
891
  generatedCode.push(...indent(["return context;"]), "}");
892
892
  for (const [key, fnData] of this._nodeToProcess.entries()) {
893
893
  const { node, parentNode, context, precode, anchor } = fnData.fn;
894
- generatedCode.push(`\n${key} (${fnData.args?.join(", ")}) {`, ...indent(["const context = new Context(this, parentContext);"]));
894
+ generatedCode.push(`\n${key}(${fnData.args?.join(", ")}) {`, ...indent(["const context = new Context(this, parentContext);"]));
895
895
  if (precode) generatedCode.push(indent(precode));
896
896
  generatedCode.push(...indent([...node.children.map((child, i) => {
897
897
  const result = this._processNode(child, parentNode, i.toString(), context, anchor ?? null);
@@ -2921,8 +2921,13 @@ function typeCheckElement(node, parentNode, index, context) {
2921
2921
  } else return `${resolvedParameter}`;
2922
2922
  }).join(", ");
2923
2923
  const beginning = parsedEventParameter ? "($event)" : "()";
2924
- retVal.code.push(`const ${nodeName}_${name} = ${beginning} => root.${handler}(${mappedParameters})`);
2924
+ retVal.code.push(`const ${nodeName}_${name} = ${beginning} => root.${handler}(${mappedParameters});`);
2925
2925
  });
2926
+ if (node.children.length) retVal.functionsToProcess.set(`${nodeName}Children`, { fn: {
2927
+ node,
2928
+ parentNode,
2929
+ context
2930
+ } });
2926
2931
  return retVal;
2927
2932
  }
2928
2933
  //#endregion
@@ -2958,11 +2963,11 @@ function typeCheckFor(node, parentNode, index, compilerContext) {
2958
2963
  },
2959
2964
  args: [`${itemsName}: typeof ${iterableExpr}`, `${counterName}: number`]
2960
2965
  });
2961
- retVal.code.push(`const ${forKey}_${itemsName} = ${iterableExpr}`);
2966
+ retVal.code.push(`const ${forKey}_${itemsName} = ${iterableExpr};`);
2962
2967
  retVal.code.push(`const ${forKey}_${node.itemAlias} = ${resolveExpression(node.trackExpression, forContext, {
2963
2968
  skipResolution: true,
2964
2969
  resolver: `${iterableExpr}`
2965
- })}`);
2970
+ })};`);
2966
2971
  return retVal;
2967
2972
  }
2968
2973
  /**
@@ -3046,7 +3051,7 @@ function typeCheckSwitch(node, parentNode, index, compilerContext) {
3046
3051
  //#endregion
3047
3052
  //#region ../packages/compiler/src/type-checker/states/type-check-text-and-interpolation.state.ts
3048
3053
  function typeCheckTextAndInterpolation(node, parentNode, index, compilerContext) {
3049
- return { code: [`const ${getTextIdentifier("text", parentNode.identifier, index)} = ${node.type === ASTNodeType.Text ? node.value : resolveExpression(node.expression, compilerContext, { resolver: "root" })};`] };
3054
+ return { code: [`const ${getTextIdentifier("text", parentNode.identifier, index)} = ${node.type === ASTNodeType.Text ? `'${node.value}'` : resolveExpression(node.expression, compilerContext, { resolver: "root" })};`] };
3050
3055
  }
3051
3056
  //#endregion
3052
3057
  //#region ../packages/compiler/src/type-checker/type-checker.ts
@@ -3083,7 +3088,7 @@ var TypeChecker = class {
3083
3088
  generatedCode.push("}");
3084
3089
  for (const [key, fnData] of this._nodeToProcess.entries()) {
3085
3090
  const { node, parentNode, precode, context } = fnData.fn;
3086
- generatedCode.push(`\nfunction ${key} (${fnData.args?.join(", ") ?? ""}): void {`);
3091
+ generatedCode.push(`\nfunction ${key}(${fnData.args?.join(", ") ?? ""}): void {`);
3087
3092
  if (precode) generatedCode.push(indent(precode));
3088
3093
  generatedCode.push(...indent([...node.children.map((child, i) => {
3089
3094
  const result = this._processNode(child, parentNode, i.toString(), context);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaendar/compiler",
3
- "version": "0.7.21",
3
+ "version": "0.7.23",
4
4
  "description": "A library for transpiling Xaendar Templates into JavaScript code",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -16,8 +16,8 @@
16
16
  }
17
17
  },
18
18
  "dependencies": {
19
- "@xaendar/common": "0.7.21",
20
- "@xaendar/types": "0.7.21",
19
+ "@xaendar/common": "0.7.23",
20
+ "@xaendar/types": "0.7.23",
21
21
  "typescript": "^6.0.3"
22
22
  }
23
23
  }