@torpor/view 0.3.3 → 0.3.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @torpor/view
2
2
 
3
+ ## 0.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 07d8266: Fix: share var names between @head and @render
8
+
3
9
  ## 0.3.3
4
10
 
5
11
  ### Patch Changes
package/dist/compile.cjs CHANGED
@@ -1729,7 +1729,11 @@ function buildTemplate(template, map, imports, b, options) {
1729
1729
  if (/\$batch\b/.test(script)) imports.add("$batch");
1730
1730
  let currentIndex = 0;
1731
1731
  let current = template.components[0];
1732
+ let status = makeStatus(imports, map, current, options);
1733
+ let first = true;
1732
1734
  for (let chunk of template.script) if (chunk.script === "/* @params */") {
1735
+ if (!first) status = makeStatus(imports, map, current, options);
1736
+ first = false;
1733
1737
  let params = [
1734
1738
  `${current.markup ? "$parent" : "_$parent"}: ParentNode`,
1735
1739
  `${current.markup ? "$anchor" : "_$anchor"}: Node | null`,
@@ -1745,7 +1749,6 @@ function buildTemplate(template, map, imports, b, options) {
1745
1749
  b.append("");
1746
1750
  } else if (chunk.script === "/* @render */") {
1747
1751
  if (current.markup) {
1748
- let status = makeStatus(imports, map, current, options);
1749
1752
  b.append("");
1750
1753
  b.append("/* User interface */");
1751
1754
  buildFragmentText(current.markup, status, b);
@@ -1754,7 +1757,6 @@ function buildTemplate(template, map, imports, b, options) {
1754
1757
  }
1755
1758
  } else if (chunk.script === "/* @head */") {
1756
1759
  if (current.head) {
1757
- let status = makeStatus(imports, map, current, options);
1758
1760
  b.append("");
1759
1761
  b.append("/* Head */");
1760
1762
  status.inHead = true;
@@ -1765,10 +1767,7 @@ function buildTemplate(template, map, imports, b, options) {
1765
1767
  b.append("/**/ });");
1766
1768
  currentIndex += 1;
1767
1769
  current = template.components[currentIndex];
1768
- } else {
1769
- let status = makeStatus(imports, map, current, options);
1770
- addMappedText("", chunk.script, "", chunk.range, status, b);
1771
- }
1770
+ } else addMappedText("", chunk.script, "", chunk.range, status, b);
1772
1771
  }
1773
1772
  function makeStatus(imports, map, current, options) {
1774
1773
  return {