@vertz/ui-compiler 0.2.11 → 0.2.12

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 +5 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1781,6 +1781,7 @@ class SignalTransformer {
1781
1781
  }
1782
1782
  }
1783
1783
  function transformDeclarations(source, bodyNode, signals) {
1784
+ const seenNames = new Map;
1784
1785
  for (const stmt of bodyNode.getChildSyntaxList()?.getChildren() ?? []) {
1785
1786
  if (!stmt.isKind(SyntaxKind11.VariableStatement))
1786
1787
  continue;
@@ -1798,8 +1799,11 @@ function transformDeclarations(source, bodyNode, signals) {
1798
1799
  if (letKeyword) {
1799
1800
  source.overwrite(letKeyword.getStart(), letKeyword.getEnd(), "const");
1800
1801
  }
1802
+ const count = seenNames.get(name) ?? 0;
1803
+ seenNames.set(name, count + 1);
1804
+ const hmrKey = count === 0 ? name : `${name}$${count}`;
1801
1805
  source.appendLeft(init.getStart(), "signal(");
1802
- source.appendRight(init.getEnd(), ")");
1806
+ source.appendRight(init.getEnd(), `, '${hmrKey}')`);
1803
1807
  }
1804
1808
  }
1805
1809
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertz/ui-compiler",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Vertz UI compiler — SSR and build-time optimizations",