@xaendar/compiler 0.5.3 → 0.5.5

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.
@@ -1,4 +1,4 @@
1
- import { Stack, indent } from "@xaendar/common";
1
+ import { Stack, assertIsValidElementName, indent } from "@xaendar/common";
2
2
  import ts from "typescript";
3
3
  //#region ../packages/compiler/src/lexer/types/lexer-state.enum.ts
4
4
  /**
@@ -2219,8 +2219,10 @@ function processConstDeclaration(node, _nodeName, _parentNode, context) {
2219
2219
  */
2220
2220
  function processElement(node, nodeName, parentNode, context) {
2221
2221
  const childrenContext = new Context([], context);
2222
+ const tagName = node.tagName;
2223
+ if (!assertIsValidElementName(tagName)) process.exit(1);
2222
2224
  return [
2223
- `const ${nodeName} = document.createElement("${node.tagName}");`,
2225
+ `const ${nodeName} = document.createElement("${tagName}");`,
2224
2226
  ...node.attributes?.map((attr) => {
2225
2227
  const value = attr.value;
2226
2228
  return typeof value === "string" ? `${nodeName}.setAttribute('${attr.name}', ${value});` : `unwatchFns.push(effect(() => ${nodeName}.setAttribute('${attr.name}', ${resolveExpression(value.expression, context)})));`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaendar/compiler",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
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.5.3",
20
- "@xaendar/types": "0.5.3",
19
+ "@xaendar/common": "0.5.5",
20
+ "@xaendar/types": "0.5.5",
21
21
  "typescript": "^6.0.3"
22
22
  }
23
23
  }