marko 6.0.9 → 6.0.10

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.
@@ -1790,7 +1790,7 @@ var branchIdKey = Symbol();
1790
1790
  function withBranchId(branchId, cb) {
1791
1791
  return withContext(branchIdKey, branchId, cb);
1792
1792
  }
1793
- function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1793
+ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1794
1794
  const resumeBranch = serializeBranch !== 0;
1795
1795
  const resumeMarker = serializeMarker !== 0;
1796
1796
  if (resumeBranch) {
@@ -1818,16 +1818,18 @@ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serialize
1818
1818
  } else {
1819
1819
  forOf(list, cb);
1820
1820
  }
1821
- if (resumeMarker) {
1822
- $chunk.writeHTML(
1823
- $chunk.boundary.state.mark(
1824
- "]" /* BranchEnd */,
1825
- scopeId + " " + accessor
1826
- )
1827
- );
1828
- }
1821
+ writeBranchEnd(
1822
+ scopeId,
1823
+ accessor,
1824
+ resumeMarker,
1825
+ parentEndTag,
1826
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1827
+ "]" /* BranchEnd */,
1828
+ scopeId + " " + accessor
1829
+ )
1830
+ );
1829
1831
  }
1830
- function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1832
+ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1831
1833
  const resumeBranch = serializeBranch !== 0;
1832
1834
  const resumeMarker = serializeMarker !== 0;
1833
1835
  let branchIds = "";
@@ -1851,16 +1853,18 @@ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch,
1851
1853
  } else {
1852
1854
  forOf(list, cb);
1853
1855
  }
1854
- if (resumeMarker) {
1855
- $chunk.writeHTML(
1856
- $chunk.boundary.state.mark(
1857
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1858
- scopeId + " " + accessor + branchIds
1859
- )
1860
- );
1861
- }
1856
+ writeBranchEnd(
1857
+ scopeId,
1858
+ accessor,
1859
+ resumeMarker,
1860
+ parentEndTag,
1861
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1862
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1863
+ scopeId + " " + accessor + branchIds
1864
+ )
1865
+ );
1862
1866
  }
1863
- function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1867
+ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1864
1868
  const resumeBranch = serializeBranch !== 0;
1865
1869
  const resumeMarker = serializeMarker !== 0;
1866
1870
  if (resumeBranch) {
@@ -1887,16 +1891,18 @@ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeM
1887
1891
  } else {
1888
1892
  forIn(obj, cb);
1889
1893
  }
1890
- if (resumeMarker) {
1891
- $chunk.writeHTML(
1892
- $chunk.boundary.state.mark(
1893
- "]" /* BranchEnd */,
1894
- scopeId + " " + accessor
1895
- )
1896
- );
1897
- }
1894
+ writeBranchEnd(
1895
+ scopeId,
1896
+ accessor,
1897
+ resumeMarker,
1898
+ parentEndTag,
1899
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1900
+ "]" /* BranchEnd */,
1901
+ scopeId + " " + accessor
1902
+ )
1903
+ );
1898
1904
  }
1899
- function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1905
+ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1900
1906
  const resumeBranch = serializeBranch !== 0;
1901
1907
  const resumeMarker = serializeMarker !== 0;
1902
1908
  let branchIds = "";
@@ -1920,16 +1926,18 @@ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch,
1920
1926
  } else {
1921
1927
  forIn(obj, cb);
1922
1928
  }
1923
- if (resumeMarker) {
1924
- $chunk.writeHTML(
1925
- $chunk.boundary.state.mark(
1926
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1927
- scopeId + " " + accessor + branchIds
1928
- )
1929
- );
1930
- }
1929
+ writeBranchEnd(
1930
+ scopeId,
1931
+ accessor,
1932
+ resumeMarker,
1933
+ parentEndTag,
1934
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1935
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1936
+ scopeId + " " + accessor + branchIds
1937
+ )
1938
+ );
1931
1939
  }
1932
- function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1940
+ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1933
1941
  const resumeBranch = serializeBranch !== 0;
1934
1942
  const resumeMarker = serializeMarker !== 0;
1935
1943
  if (resumeBranch) {
@@ -1956,16 +1964,18 @@ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
1956
1964
  } else {
1957
1965
  forTo(to, from, step, cb);
1958
1966
  }
1959
- if (resumeMarker) {
1960
- $chunk.writeHTML(
1961
- $chunk.boundary.state.mark(
1962
- "]" /* BranchEnd */,
1963
- scopeId + " " + accessor
1964
- )
1965
- );
1966
- }
1967
+ writeBranchEnd(
1968
+ scopeId,
1969
+ accessor,
1970
+ resumeMarker,
1971
+ parentEndTag,
1972
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1973
+ "]" /* BranchEnd */,
1974
+ scopeId + " " + accessor
1975
+ )
1976
+ );
1967
1977
  }
1968
- function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1978
+ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1969
1979
  const resumeBranch = serializeBranch !== 0;
1970
1980
  const resumeMarker = serializeMarker !== 0;
1971
1981
  let branchIds = "";
@@ -1989,16 +1999,18 @@ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serial
1989
1999
  } else {
1990
2000
  forTo(to, from, step, cb);
1991
2001
  }
1992
- if (resumeMarker) {
1993
- $chunk.writeHTML(
1994
- $chunk.boundary.state.mark(
1995
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1996
- scopeId + " " + accessor + branchIds
1997
- )
1998
- );
1999
- }
2002
+ writeBranchEnd(
2003
+ scopeId,
2004
+ accessor,
2005
+ resumeMarker,
2006
+ parentEndTag,
2007
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
2008
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
2009
+ scopeId + " " + accessor + branchIds
2010
+ )
2011
+ );
2000
2012
  }
2001
- function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker) {
2013
+ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
2002
2014
  const resumeBranch = serializeBranch !== 0;
2003
2015
  const resumeMarker = serializeMarker !== 0;
2004
2016
  const branchId = peekNextScopeId();
@@ -2015,16 +2027,18 @@ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMark
2015
2027
  ["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
2016
2028
  });
2017
2029
  }
2018
- if (resumeMarker) {
2019
- $chunk.writeHTML(
2020
- $chunk.boundary.state.mark(
2021
- "]" /* BranchEnd */,
2022
- scopeId + " " + accessor
2023
- )
2024
- );
2025
- }
2030
+ writeBranchEnd(
2031
+ scopeId,
2032
+ accessor,
2033
+ resumeMarker,
2034
+ parentEndTag,
2035
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
2036
+ "]" /* BranchEnd */,
2037
+ scopeId + " " + accessor
2038
+ )
2039
+ );
2026
2040
  }
2027
- function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
2041
+ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
2028
2042
  const resumeBranch = serializeBranch !== 0;
2029
2043
  const resumeMarker = serializeMarker !== 0;
2030
2044
  const branchId = peekNextScopeId();
@@ -2036,13 +2050,27 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, ser
2036
2050
  ["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
2037
2051
  });
2038
2052
  }
2053
+ writeBranchEnd(
2054
+ scopeId,
2055
+ accessor,
2056
+ resumeMarker,
2057
+ parentEndTag,
2058
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
2059
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
2060
+ scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
2061
+ )
2062
+ );
2063
+ }
2064
+ function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
2065
+ const endTag = parentEndTag || "";
2039
2066
  if (resumeMarker) {
2040
- $chunk.writeHTML(
2041
- $chunk.boundary.state.mark(
2042
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
2043
- scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
2044
- )
2045
- );
2067
+ if (mark) {
2068
+ $chunk.writeHTML(mark + endTag);
2069
+ } else {
2070
+ $chunk.writeHTML(endTag + markResumeNode(scopeId, accessor));
2071
+ }
2072
+ } else {
2073
+ $chunk.writeHTML(endTag);
2046
2074
  }
2047
2075
  }
2048
2076
  var writeScope = (scopeId, partialScope) => {
@@ -1705,7 +1705,7 @@ var branchIdKey = Symbol();
1705
1705
  function withBranchId(branchId, cb) {
1706
1706
  return withContext(branchIdKey, branchId, cb);
1707
1707
  }
1708
- function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1708
+ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1709
1709
  const resumeBranch = serializeBranch !== 0;
1710
1710
  const resumeMarker = serializeMarker !== 0;
1711
1711
  if (resumeBranch) {
@@ -1733,16 +1733,18 @@ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serialize
1733
1733
  } else {
1734
1734
  forOf(list, cb);
1735
1735
  }
1736
- if (resumeMarker) {
1737
- $chunk.writeHTML(
1738
- $chunk.boundary.state.mark(
1739
- "]" /* BranchEnd */,
1740
- scopeId + " " + accessor
1741
- )
1742
- );
1743
- }
1736
+ writeBranchEnd(
1737
+ scopeId,
1738
+ accessor,
1739
+ resumeMarker,
1740
+ parentEndTag,
1741
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1742
+ "]" /* BranchEnd */,
1743
+ scopeId + " " + accessor
1744
+ )
1745
+ );
1744
1746
  }
1745
- function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1747
+ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1746
1748
  const resumeBranch = serializeBranch !== 0;
1747
1749
  const resumeMarker = serializeMarker !== 0;
1748
1750
  let branchIds = "";
@@ -1766,16 +1768,18 @@ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch,
1766
1768
  } else {
1767
1769
  forOf(list, cb);
1768
1770
  }
1769
- if (resumeMarker) {
1770
- $chunk.writeHTML(
1771
- $chunk.boundary.state.mark(
1772
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1773
- scopeId + " " + accessor + branchIds
1774
- )
1775
- );
1776
- }
1771
+ writeBranchEnd(
1772
+ scopeId,
1773
+ accessor,
1774
+ resumeMarker,
1775
+ parentEndTag,
1776
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1777
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1778
+ scopeId + " " + accessor + branchIds
1779
+ )
1780
+ );
1777
1781
  }
1778
- function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1782
+ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1779
1783
  const resumeBranch = serializeBranch !== 0;
1780
1784
  const resumeMarker = serializeMarker !== 0;
1781
1785
  if (resumeBranch) {
@@ -1802,16 +1806,18 @@ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeM
1802
1806
  } else {
1803
1807
  forIn(obj, cb);
1804
1808
  }
1805
- if (resumeMarker) {
1806
- $chunk.writeHTML(
1807
- $chunk.boundary.state.mark(
1808
- "]" /* BranchEnd */,
1809
- scopeId + " " + accessor
1810
- )
1811
- );
1812
- }
1809
+ writeBranchEnd(
1810
+ scopeId,
1811
+ accessor,
1812
+ resumeMarker,
1813
+ parentEndTag,
1814
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1815
+ "]" /* BranchEnd */,
1816
+ scopeId + " " + accessor
1817
+ )
1818
+ );
1813
1819
  }
1814
- function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1820
+ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1815
1821
  const resumeBranch = serializeBranch !== 0;
1816
1822
  const resumeMarker = serializeMarker !== 0;
1817
1823
  let branchIds = "";
@@ -1835,16 +1841,18 @@ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch,
1835
1841
  } else {
1836
1842
  forIn(obj, cb);
1837
1843
  }
1838
- if (resumeMarker) {
1839
- $chunk.writeHTML(
1840
- $chunk.boundary.state.mark(
1841
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1842
- scopeId + " " + accessor + branchIds
1843
- )
1844
- );
1845
- }
1844
+ writeBranchEnd(
1845
+ scopeId,
1846
+ accessor,
1847
+ resumeMarker,
1848
+ parentEndTag,
1849
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1850
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1851
+ scopeId + " " + accessor + branchIds
1852
+ )
1853
+ );
1846
1854
  }
1847
- function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1855
+ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1848
1856
  const resumeBranch = serializeBranch !== 0;
1849
1857
  const resumeMarker = serializeMarker !== 0;
1850
1858
  if (resumeBranch) {
@@ -1871,16 +1879,18 @@ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
1871
1879
  } else {
1872
1880
  forTo(to, from, step, cb);
1873
1881
  }
1874
- if (resumeMarker) {
1875
- $chunk.writeHTML(
1876
- $chunk.boundary.state.mark(
1877
- "]" /* BranchEnd */,
1878
- scopeId + " " + accessor
1879
- )
1880
- );
1881
- }
1882
+ writeBranchEnd(
1883
+ scopeId,
1884
+ accessor,
1885
+ resumeMarker,
1886
+ parentEndTag,
1887
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1888
+ "]" /* BranchEnd */,
1889
+ scopeId + " " + accessor
1890
+ )
1891
+ );
1882
1892
  }
1883
- function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1893
+ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1884
1894
  const resumeBranch = serializeBranch !== 0;
1885
1895
  const resumeMarker = serializeMarker !== 0;
1886
1896
  let branchIds = "";
@@ -1904,16 +1914,18 @@ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serial
1904
1914
  } else {
1905
1915
  forTo(to, from, step, cb);
1906
1916
  }
1907
- if (resumeMarker) {
1908
- $chunk.writeHTML(
1909
- $chunk.boundary.state.mark(
1910
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1911
- scopeId + " " + accessor + branchIds
1912
- )
1913
- );
1914
- }
1917
+ writeBranchEnd(
1918
+ scopeId,
1919
+ accessor,
1920
+ resumeMarker,
1921
+ parentEndTag,
1922
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1923
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1924
+ scopeId + " " + accessor + branchIds
1925
+ )
1926
+ );
1915
1927
  }
1916
- function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker) {
1928
+ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1917
1929
  const resumeBranch = serializeBranch !== 0;
1918
1930
  const resumeMarker = serializeMarker !== 0;
1919
1931
  const branchId = peekNextScopeId();
@@ -1930,16 +1942,18 @@ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMark
1930
1942
  ["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1931
1943
  });
1932
1944
  }
1933
- if (resumeMarker) {
1934
- $chunk.writeHTML(
1935
- $chunk.boundary.state.mark(
1936
- "]" /* BranchEnd */,
1937
- scopeId + " " + accessor
1938
- )
1939
- );
1940
- }
1945
+ writeBranchEnd(
1946
+ scopeId,
1947
+ accessor,
1948
+ resumeMarker,
1949
+ parentEndTag,
1950
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1951
+ "]" /* BranchEnd */,
1952
+ scopeId + " " + accessor
1953
+ )
1954
+ );
1941
1955
  }
1942
- function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1956
+ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1943
1957
  const resumeBranch = serializeBranch !== 0;
1944
1958
  const resumeMarker = serializeMarker !== 0;
1945
1959
  const branchId = peekNextScopeId();
@@ -1951,13 +1965,27 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, ser
1951
1965
  ["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1952
1966
  });
1953
1967
  }
1968
+ writeBranchEnd(
1969
+ scopeId,
1970
+ accessor,
1971
+ resumeMarker,
1972
+ parentEndTag,
1973
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1974
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1975
+ scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
1976
+ )
1977
+ );
1978
+ }
1979
+ function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
1980
+ const endTag = parentEndTag || "";
1954
1981
  if (resumeMarker) {
1955
- $chunk.writeHTML(
1956
- $chunk.boundary.state.mark(
1957
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1958
- scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
1959
- )
1960
- );
1982
+ if (mark) {
1983
+ $chunk.writeHTML(mark + endTag);
1984
+ } else {
1985
+ $chunk.writeHTML(endTag + markResumeNode(scopeId, accessor));
1986
+ }
1987
+ } else {
1988
+ $chunk.writeHTML(endTag);
1961
1989
  }
1962
1990
  }
1963
1991
  var writeScope = (scopeId, partialScope) => {
@@ -35,14 +35,14 @@ export declare function hoist(scopeId: number, id?: string): {
35
35
  };
36
36
  export declare function resumeClosestBranch(scopeId: number): void;
37
37
  export declare function withBranchId<T>(branchId: number, cb: () => T): T;
38
- export declare function resumeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1): void;
39
- export declare function resumeSingleNodeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, onlyChildInParent?: 1): void;
40
- export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1): void;
41
- export declare function resumeSingleNodeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, onlyChildInParent?: 1): void;
42
- export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1): void;
43
- export declare function resumeSingleNodeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, onlyChildInParent?: 1): void;
44
- export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1): void;
45
- export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, onlyChildInParent?: 1): void;
38
+ export declare function resumeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
39
+ export declare function resumeSingleNodeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
40
+ export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
41
+ export declare function resumeSingleNodeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
42
+ export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
43
+ export declare function resumeSingleNodeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
44
+ export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
45
+ export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string): void;
46
46
  declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
47
47
  export { writeScope };
48
48
  export declare function writeExistingScope(scopeId: number): ScopeInternals;
package/dist/html.js CHANGED
@@ -1172,7 +1172,7 @@ var branchIdKey = Symbol();
1172
1172
  function withBranchId(branchId, cb) {
1173
1173
  return withContext(branchIdKey, branchId, cb);
1174
1174
  }
1175
- function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1175
+ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1176
1176
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
1177
1177
  if (resumeBranch) {
1178
1178
  let loopScopes = /* @__PURE__ */ new Map();
@@ -1191,14 +1191,18 @@ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serialize
1191
1191
  });
1192
1192
  } else
1193
1193
  forOf(list, cb);
1194
- resumeMarker && $chunk.writeHTML(
1195
- $chunk.boundary.state.mark(
1194
+ writeBranchEnd(
1195
+ scopeId,
1196
+ accessor,
1197
+ resumeMarker,
1198
+ parentEndTag,
1199
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1196
1200
  "]" /* BranchEnd */,
1197
1201
  scopeId + " " + accessor
1198
1202
  )
1199
1203
  );
1200
1204
  }
1201
- function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1205
+ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1202
1206
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
1203
1207
  if (resumeBranch) {
1204
1208
  let loopScopes = /* @__PURE__ */ new Map();
@@ -1212,14 +1216,18 @@ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch,
1212
1216
  });
1213
1217
  } else
1214
1218
  forOf(list, cb);
1215
- resumeMarker && $chunk.writeHTML(
1216
- $chunk.boundary.state.mark(
1217
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1219
+ writeBranchEnd(
1220
+ scopeId,
1221
+ accessor,
1222
+ resumeMarker,
1223
+ parentEndTag,
1224
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1225
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1218
1226
  scopeId + " " + accessor + branchIds
1219
1227
  )
1220
1228
  );
1221
1229
  }
1222
- function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1230
+ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1223
1231
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
1224
1232
  if (resumeBranch) {
1225
1233
  let loopScopes = /* @__PURE__ */ new Map(), sep = "";
@@ -1235,14 +1243,18 @@ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeM
1235
1243
  });
1236
1244
  } else
1237
1245
  forIn(obj, cb);
1238
- resumeMarker && $chunk.writeHTML(
1239
- $chunk.boundary.state.mark(
1246
+ writeBranchEnd(
1247
+ scopeId,
1248
+ accessor,
1249
+ resumeMarker,
1250
+ parentEndTag,
1251
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1240
1252
  "]" /* BranchEnd */,
1241
1253
  scopeId + " " + accessor
1242
1254
  )
1243
1255
  );
1244
1256
  }
1245
- function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1257
+ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1246
1258
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
1247
1259
  if (resumeBranch) {
1248
1260
  let loopScopes = /* @__PURE__ */ new Map();
@@ -1256,14 +1268,18 @@ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch,
1256
1268
  });
1257
1269
  } else
1258
1270
  forIn(obj, cb);
1259
- resumeMarker && $chunk.writeHTML(
1260
- $chunk.boundary.state.mark(
1261
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1271
+ writeBranchEnd(
1272
+ scopeId,
1273
+ accessor,
1274
+ resumeMarker,
1275
+ parentEndTag,
1276
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1277
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1262
1278
  scopeId + " " + accessor + branchIds
1263
1279
  )
1264
1280
  );
1265
1281
  }
1266
- function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1282
+ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1267
1283
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
1268
1284
  if (resumeBranch) {
1269
1285
  let loopScopes = /* @__PURE__ */ new Map(), sep = "";
@@ -1279,14 +1295,18 @@ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
1279
1295
  });
1280
1296
  } else
1281
1297
  forTo(to, from, step, cb);
1282
- resumeMarker && $chunk.writeHTML(
1283
- $chunk.boundary.state.mark(
1298
+ writeBranchEnd(
1299
+ scopeId,
1300
+ accessor,
1301
+ resumeMarker,
1302
+ parentEndTag,
1303
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1284
1304
  "]" /* BranchEnd */,
1285
1305
  scopeId + " " + accessor
1286
1306
  )
1287
1307
  );
1288
1308
  }
1289
- function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1309
+ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1290
1310
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
1291
1311
  if (resumeBranch) {
1292
1312
  let loopScopes = /* @__PURE__ */ new Map();
@@ -1300,14 +1320,18 @@ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serial
1300
1320
  });
1301
1321
  } else
1302
1322
  forTo(to, from, step, cb);
1303
- resumeMarker && $chunk.writeHTML(
1304
- $chunk.boundary.state.mark(
1305
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1323
+ writeBranchEnd(
1324
+ scopeId,
1325
+ accessor,
1326
+ resumeMarker,
1327
+ parentEndTag,
1328
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1329
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1306
1330
  scopeId + " " + accessor + branchIds
1307
1331
  )
1308
1332
  );
1309
1333
  }
1310
- function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker) {
1334
+ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1311
1335
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId();
1312
1336
  resumeMarker && resumeBranch && $chunk.writeHTML(
1313
1337
  $chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
@@ -1316,25 +1340,37 @@ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMark
1316
1340
  resumeBranch && branchIndex !== void 0 && writeScope(scopeId, {
1317
1341
  ["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
1318
1342
  ["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1319
- }), resumeMarker && $chunk.writeHTML(
1320
- $chunk.boundary.state.mark(
1343
+ }), writeBranchEnd(
1344
+ scopeId,
1345
+ accessor,
1346
+ resumeMarker,
1347
+ parentEndTag,
1348
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1321
1349
  "]" /* BranchEnd */,
1322
1350
  scopeId + " " + accessor
1323
1351
  )
1324
1352
  );
1325
1353
  }
1326
- function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1354
+ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1327
1355
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId(), branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
1328
1356
  shouldWriteBranch && writeScope(scopeId, {
1329
1357
  ["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
1330
1358
  ["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1331
- }), resumeMarker && $chunk.writeHTML(
1332
- $chunk.boundary.state.mark(
1333
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1359
+ }), writeBranchEnd(
1360
+ scopeId,
1361
+ accessor,
1362
+ resumeMarker,
1363
+ parentEndTag,
1364
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1365
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1334
1366
  scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
1335
1367
  )
1336
1368
  );
1337
1369
  }
1370
+ function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
1371
+ let endTag = parentEndTag || "";
1372
+ resumeMarker ? mark ? $chunk.writeHTML(mark + endTag) : $chunk.writeHTML(endTag + markResumeNode(scopeId, accessor)) : $chunk.writeHTML(endTag);
1373
+ }
1338
1374
  var writeScope = (scopeId, partialScope) => {
1339
1375
  let { state } = $chunk.boundary, { scopes } = state, scope = scopes.get(scopeId);
1340
1376
  return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.writeScopes = { [scopeId]: scope }, scope;
package/dist/html.mjs CHANGED
@@ -1090,7 +1090,7 @@ var branchIdKey = Symbol();
1090
1090
  function withBranchId(branchId, cb) {
1091
1091
  return withContext(branchIdKey, branchId, cb);
1092
1092
  }
1093
- function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1093
+ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1094
1094
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
1095
1095
  if (resumeBranch) {
1096
1096
  let loopScopes = /* @__PURE__ */ new Map();
@@ -1109,14 +1109,18 @@ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serialize
1109
1109
  });
1110
1110
  } else
1111
1111
  forOf(list, cb);
1112
- resumeMarker && $chunk.writeHTML(
1113
- $chunk.boundary.state.mark(
1112
+ writeBranchEnd(
1113
+ scopeId,
1114
+ accessor,
1115
+ resumeMarker,
1116
+ parentEndTag,
1117
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1114
1118
  "]" /* BranchEnd */,
1115
1119
  scopeId + " " + accessor
1116
1120
  )
1117
1121
  );
1118
1122
  }
1119
- function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1123
+ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1120
1124
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
1121
1125
  if (resumeBranch) {
1122
1126
  let loopScopes = /* @__PURE__ */ new Map();
@@ -1130,14 +1134,18 @@ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch,
1130
1134
  });
1131
1135
  } else
1132
1136
  forOf(list, cb);
1133
- resumeMarker && $chunk.writeHTML(
1134
- $chunk.boundary.state.mark(
1135
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1137
+ writeBranchEnd(
1138
+ scopeId,
1139
+ accessor,
1140
+ resumeMarker,
1141
+ parentEndTag,
1142
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1143
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1136
1144
  scopeId + " " + accessor + branchIds
1137
1145
  )
1138
1146
  );
1139
1147
  }
1140
- function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1148
+ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1141
1149
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
1142
1150
  if (resumeBranch) {
1143
1151
  let loopScopes = /* @__PURE__ */ new Map(), sep = "";
@@ -1153,14 +1161,18 @@ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeM
1153
1161
  });
1154
1162
  } else
1155
1163
  forIn(obj, cb);
1156
- resumeMarker && $chunk.writeHTML(
1157
- $chunk.boundary.state.mark(
1164
+ writeBranchEnd(
1165
+ scopeId,
1166
+ accessor,
1167
+ resumeMarker,
1168
+ parentEndTag,
1169
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1158
1170
  "]" /* BranchEnd */,
1159
1171
  scopeId + " " + accessor
1160
1172
  )
1161
1173
  );
1162
1174
  }
1163
- function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1175
+ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1164
1176
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
1165
1177
  if (resumeBranch) {
1166
1178
  let loopScopes = /* @__PURE__ */ new Map();
@@ -1174,14 +1186,18 @@ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch,
1174
1186
  });
1175
1187
  } else
1176
1188
  forIn(obj, cb);
1177
- resumeMarker && $chunk.writeHTML(
1178
- $chunk.boundary.state.mark(
1179
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1189
+ writeBranchEnd(
1190
+ scopeId,
1191
+ accessor,
1192
+ resumeMarker,
1193
+ parentEndTag,
1194
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1195
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1180
1196
  scopeId + " " + accessor + branchIds
1181
1197
  )
1182
1198
  );
1183
1199
  }
1184
- function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
1200
+ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1185
1201
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
1186
1202
  if (resumeBranch) {
1187
1203
  let loopScopes = /* @__PURE__ */ new Map(), sep = "";
@@ -1197,14 +1213,18 @@ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
1197
1213
  });
1198
1214
  } else
1199
1215
  forTo(to, from, step, cb);
1200
- resumeMarker && $chunk.writeHTML(
1201
- $chunk.boundary.state.mark(
1216
+ writeBranchEnd(
1217
+ scopeId,
1218
+ accessor,
1219
+ resumeMarker,
1220
+ parentEndTag,
1221
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1202
1222
  "]" /* BranchEnd */,
1203
1223
  scopeId + " " + accessor
1204
1224
  )
1205
1225
  );
1206
1226
  }
1207
- function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1227
+ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1208
1228
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
1209
1229
  if (resumeBranch) {
1210
1230
  let loopScopes = /* @__PURE__ */ new Map();
@@ -1218,14 +1238,18 @@ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serial
1218
1238
  });
1219
1239
  } else
1220
1240
  forTo(to, from, step, cb);
1221
- resumeMarker && $chunk.writeHTML(
1222
- $chunk.boundary.state.mark(
1223
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1241
+ writeBranchEnd(
1242
+ scopeId,
1243
+ accessor,
1244
+ resumeMarker,
1245
+ parentEndTag,
1246
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1247
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1224
1248
  scopeId + " " + accessor + branchIds
1225
1249
  )
1226
1250
  );
1227
1251
  }
1228
- function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker) {
1252
+ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1229
1253
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId();
1230
1254
  resumeMarker && resumeBranch && $chunk.writeHTML(
1231
1255
  $chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
@@ -1234,25 +1258,37 @@ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMark
1234
1258
  resumeBranch && branchIndex !== void 0 && writeScope(scopeId, {
1235
1259
  ["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
1236
1260
  ["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1237
- }), resumeMarker && $chunk.writeHTML(
1238
- $chunk.boundary.state.mark(
1261
+ }), writeBranchEnd(
1262
+ scopeId,
1263
+ accessor,
1264
+ resumeMarker,
1265
+ parentEndTag,
1266
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1239
1267
  "]" /* BranchEnd */,
1240
1268
  scopeId + " " + accessor
1241
1269
  )
1242
1270
  );
1243
1271
  }
1244
- function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
1272
+ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag) {
1245
1273
  let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId(), branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
1246
1274
  shouldWriteBranch && writeScope(scopeId, {
1247
1275
  ["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
1248
1276
  ["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1249
- }), resumeMarker && $chunk.writeHTML(
1250
- $chunk.boundary.state.mark(
1251
- onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1277
+ }), writeBranchEnd(
1278
+ scopeId,
1279
+ accessor,
1280
+ resumeMarker,
1281
+ parentEndTag,
1282
+ resumeMarker && (!parentEndTag || resumeBranch) && $chunk.boundary.state.mark(
1283
+ parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1252
1284
  scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
1253
1285
  )
1254
1286
  );
1255
1287
  }
1288
+ function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
1289
+ let endTag = parentEndTag || "";
1290
+ resumeMarker ? mark ? $chunk.writeHTML(mark + endTag) : $chunk.writeHTML(endTag + markResumeNode(scopeId, accessor)) : $chunk.writeHTML(endTag);
1291
+ }
1256
1292
  var writeScope = (scopeId, partialScope) => {
1257
1293
  let { state } = $chunk.boundary, { scopes } = state, scope = scopes.get(scopeId);
1258
1294
  return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.writeScopes = { [scopeId]: scope }, scope;
@@ -5752,7 +5752,7 @@ var import_babel_utils24 = require("@marko/compiler/babel-utils");
5752
5752
  var import_compiler31 = require("@marko/compiler");
5753
5753
  var import_babel_utils23 = require("@marko/compiler/babel-utils");
5754
5754
  var kNativeTagBinding = Symbol("native tag binding");
5755
- var kSkipMark = Symbol("skip native tag mark");
5755
+ var kSkipEndTag = Symbol("skip native tag mark");
5756
5756
  var kGetterId = Symbol("node getter id");
5757
5757
  var htmlSelectArgs = /* @__PURE__ */ new WeakMap();
5758
5758
  var native_tag_default = {
@@ -6059,7 +6059,9 @@ var native_tag_default = {
6059
6059
  flushInto(tag);
6060
6060
  }
6061
6061
  if (selectArgs) {
6062
- writeTo(tag)`</${tag.node.name}>`;
6062
+ if (!tagExtra[kSkipEndTag]) {
6063
+ writeTo(tag)`</${tag.node.name}>`;
6064
+ }
6063
6065
  flushInto(tag);
6064
6066
  tag.insertBefore(
6065
6067
  import_compiler31.types.expressionStatement(
@@ -6079,8 +6081,8 @@ var native_tag_default = {
6079
6081
  } else {
6080
6082
  tag.insertBefore(tag.node.body.body).forEach((child) => child.skip());
6081
6083
  }
6082
- const markerSerializeReason = nodeBinding && !tagExtra[kSkipMark] && getBindingSerializeReason(tagSection, nodeBinding);
6083
- if (!openTagOnly && !selectArgs) {
6084
+ const markerSerializeReason = !tagExtra[kSkipEndTag] && nodeBinding && getBindingSerializeReason(tagSection, nodeBinding);
6085
+ if (!tagExtra[kSkipEndTag] && !openTagOnly && !selectArgs) {
6084
6086
  writeTo(
6085
6087
  tag,
6086
6088
  !markerSerializeReason && (tagName === "html" || tagName === "body")
@@ -6593,19 +6595,16 @@ function buildUndefined() {
6593
6595
  // src/translator/util/is-only-child-in-parent.ts
6594
6596
  var kOnlyChildInParent = Symbol("only child in parent");
6595
6597
  var kNodeRef = Symbol("potential only child node ref");
6596
- function isOnlyChildInParent(tag, branchSize = 1) {
6598
+ function getOnlyChildParentTagName(tag, branchSize = 1) {
6597
6599
  const extra = tag.node.extra;
6598
6600
  if (extra[kOnlyChildInParent] !== void 0) {
6599
6601
  return extra[kOnlyChildInParent];
6600
6602
  }
6601
6603
  const parentTag = getParentTag(tag);
6602
- if (parentTag && (0, import_babel_utils24.getTagDef)(parentTag)?.html) {
6603
- return extra[kOnlyChildInParent] = tag.parent.body.length === branchSize;
6604
- }
6605
- return extra[kOnlyChildInParent] = false;
6604
+ return extra[kOnlyChildInParent] = parentTag && (0, import_babel_utils24.getTagDef)(parentTag)?.html && parentTag.node.name.type === "StringLiteral" && tag.parent.body.length === branchSize ? parentTag.node.name.value : false;
6606
6605
  }
6607
6606
  function getOptimizedOnlyChildNodeBinding(tag, section, branchSize = 1) {
6608
- if (isOnlyChildInParent(tag, branchSize)) {
6607
+ if (getOnlyChildParentTagName(tag, branchSize)) {
6609
6608
  const parentTag = getParentTag(tag).node;
6610
6609
  const parentTagName = parentTag.name?.value;
6611
6610
  return (parentTag.extra ??= {})[kNativeTagBinding] ??= createBinding(
@@ -6685,7 +6684,7 @@ var for_default = {
6685
6684
  return;
6686
6685
  }
6687
6686
  setSectionParentIsOwner(bodySection, true);
6688
- if (!isOnlyChildInParent(tag)) {
6687
+ if (!getOnlyChildParentTagName(tag)) {
6689
6688
  visit(tag, 37 /* Replace */);
6690
6689
  enterShallow(tag);
6691
6690
  }
@@ -6697,7 +6696,7 @@ var for_default = {
6697
6696
  const tagSection = getSection(tag);
6698
6697
  const bodySection = getSectionForBody(tagBody);
6699
6698
  const { node } = tag;
6700
- const onlyChildInParentOptimization = isOnlyChildInParent(tag);
6699
+ const onlyChildParentTagName = getOnlyChildParentTagName(tag);
6701
6700
  const nodeBinding = getOptimizedOnlyChildNodeBinding(tag, tagSection);
6702
6701
  const forAttrs = getKnownAttrValues(node);
6703
6702
  const forType = getForType(node);
@@ -6721,12 +6720,10 @@ var for_default = {
6721
6720
  import_compiler33.types.arrowFunctionExpression(params, import_compiler33.types.blockStatement(bodyStatements))
6722
6721
  );
6723
6722
  if (branchSerializeReason) {
6724
- if (markerSerializeReason && onlyChildInParentOptimization) {
6725
- getParentTag(tag).node.extra[kSkipMark] = true;
6726
- }
6723
+ const skipParentEnd = onlyChildParentTagName && markerSerializeReason;
6727
6724
  const markerSerializeArg = getSerializeGuard(
6728
6725
  markerSerializeReason,
6729
- !onlyChildInParentOptimization
6726
+ !skipParentEnd
6730
6727
  );
6731
6728
  forTagArgs.push(
6732
6729
  forAttrs.by || import_compiler33.types.numericLiteral(0),
@@ -6735,8 +6732,9 @@ var for_default = {
6735
6732
  getSerializeGuard(branchSerializeReason, !markerSerializeArg),
6736
6733
  markerSerializeArg
6737
6734
  );
6738
- if (onlyChildInParentOptimization) {
6739
- forTagArgs.push(import_compiler33.types.numericLiteral(1));
6735
+ if (skipParentEnd) {
6736
+ getParentTag(tag).node.extra[kSkipEndTag] = true;
6737
+ forTagArgs.push(import_compiler33.types.stringLiteral(`</${onlyChildParentTagName}>`));
6740
6738
  }
6741
6739
  }
6742
6740
  statements.push(
@@ -6757,7 +6755,7 @@ var for_default = {
6757
6755
  return;
6758
6756
  }
6759
6757
  setSectionParentIsOwner(bodySection, true);
6760
- if (!isOnlyChildInParent(tag)) {
6758
+ if (!getOnlyChildParentTagName(tag)) {
6761
6759
  visit(tag, 37 /* Replace */);
6762
6760
  enterShallow(tag);
6763
6761
  }
@@ -8547,7 +8545,7 @@ var IfTag = {
8547
8545
  if (tag.node.body.attributeTags) return;
8548
8546
  const tagBody = tag.get("body");
8549
8547
  const bodySection = getSectionForBody(tagBody);
8550
- if (isRoot(tag) && !isOnlyChildInParent(tag)) {
8548
+ if (isRoot(tag) && !getOnlyChildParentTagName(tag)) {
8551
8549
  visit(tag, 37 /* Replace */);
8552
8550
  enterShallow(tag);
8553
8551
  }
@@ -8574,7 +8572,7 @@ var IfTag = {
8574
8572
  ifTag,
8575
8573
  ifTagSection
8576
8574
  );
8577
- const onlyChildInParentOptimization = isOnlyChildInParent(ifTag);
8575
+ const onlyChildParentTagName = getOnlyChildParentTagName(ifTag);
8578
8576
  const markerSerializeReason = getBindingSerializeReason(
8579
8577
  ifTagSection,
8580
8578
  nodeBinding
@@ -8623,51 +8621,32 @@ var IfTag = {
8623
8621
  branchTag.remove();
8624
8622
  }
8625
8623
  if (branchSerializeReasons) {
8626
- if (onlyChildInParentOptimization && markerSerializeReason) {
8627
- getParentTag(ifTag).node.extra[kSkipMark] = true;
8624
+ const skipParentEnd = onlyChildParentTagName && markerSerializeReason;
8625
+ if (skipParentEnd) {
8626
+ getParentTag(ifTag).node.extra[kSkipEndTag] = true;
8628
8627
  }
8628
+ const markerSerializeArg = getSerializeGuard(
8629
+ markerSerializeReason,
8630
+ !skipParentEnd
8631
+ );
8629
8632
  const cbNode = import_compiler42.types.arrowFunctionExpression(
8630
8633
  [],
8631
8634
  import_compiler42.types.blockStatement([statement])
8632
8635
  );
8633
- if (singleNodeOptimization) {
8634
- const markerSerializeArg = getSerializeGuard(
8635
- markerSerializeReason,
8636
- !onlyChildInParentOptimization
8637
- );
8638
- statement = import_compiler42.types.expressionStatement(
8639
- callRuntime(
8640
- "resumeSingleNodeConditional",
8641
- cbNode,
8642
- getScopeIdIdentifier(ifTagSection),
8643
- getScopeAccessorLiteral(nodeBinding),
8644
- getSerializeGuardForAny(
8645
- branchSerializeReasons,
8646
- !markerSerializeArg
8647
- ),
8648
- markerSerializeArg,
8649
- onlyChildInParentOptimization && import_compiler42.types.numericLiteral(1)
8650
- )
8651
- );
8652
- } else {
8653
- const markerSerializeArg = getSerializeGuard(
8654
- markerSerializeReason,
8655
- true
8656
- );
8657
- statement = import_compiler42.types.expressionStatement(
8658
- callRuntime(
8659
- "resumeConditional",
8660
- cbNode,
8661
- getScopeIdIdentifier(ifTagSection),
8662
- getScopeAccessorLiteral(nodeBinding),
8663
- getSerializeGuardForAny(
8664
- branchSerializeReasons,
8665
- !markerSerializeArg
8666
- ),
8667
- markerSerializeArg
8668
- )
8669
- );
8670
- }
8636
+ statement = import_compiler42.types.expressionStatement(
8637
+ callRuntime(
8638
+ singleNodeOptimization ? "resumeSingleNodeConditional" : "resumeConditional",
8639
+ cbNode,
8640
+ getScopeIdIdentifier(ifTagSection),
8641
+ getScopeAccessorLiteral(nodeBinding),
8642
+ getSerializeGuardForAny(
8643
+ branchSerializeReasons,
8644
+ !markerSerializeArg
8645
+ ),
8646
+ markerSerializeArg,
8647
+ skipParentEnd && import_compiler42.types.stringLiteral(`</${onlyChildParentTagName}>`)
8648
+ )
8649
+ );
8671
8650
  }
8672
8651
  nextTag.insertBefore(statement);
8673
8652
  }
@@ -8681,7 +8660,7 @@ var IfTag = {
8681
8660
  if (bodySection) {
8682
8661
  setSectionParentIsOwner(bodySection, true);
8683
8662
  }
8684
- if (isRoot(tag) && !isOnlyChildInParent(tag)) {
8663
+ if (isRoot(tag) && !getOnlyChildParentTagName(tag)) {
8685
8664
  visit(tag, 37 /* Replace */);
8686
8665
  enterShallow(tag);
8687
8666
  }
@@ -5,10 +5,10 @@ declare const kOnlyChildInParent: unique symbol;
5
5
  declare const kNodeRef: unique symbol;
6
6
  declare module "@marko/compiler/dist/types" {
7
7
  interface NodeExtra {
8
- [kOnlyChildInParent]?: boolean;
8
+ [kOnlyChildInParent]?: false | string;
9
9
  [kNodeRef]?: Binding;
10
10
  }
11
11
  }
12
- export declare function isOnlyChildInParent(tag: t.NodePath<t.MarkoTag>, branchSize?: number): boolean;
12
+ export declare function getOnlyChildParentTagName(tag: t.NodePath<t.MarkoTag>, branchSize?: number): string | false;
13
13
  export declare function getOptimizedOnlyChildNodeBinding(tag: t.NodePath<t.MarkoTag>, section: Section, branchSize?: number): Binding;
14
14
  export {};
@@ -1,12 +1,12 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import { type Binding } from "../../util/references";
3
3
  export declare const kNativeTagBinding: unique symbol;
4
- export declare const kSkipMark: unique symbol;
4
+ export declare const kSkipEndTag: unique symbol;
5
5
  declare const kGetterId: unique symbol;
6
6
  declare module "@marko/compiler/dist/types" {
7
7
  interface NodeExtra {
8
8
  [kNativeTagBinding]?: Binding;
9
- [kSkipMark]?: true;
9
+ [kSkipEndTag]?: true;
10
10
  [kGetterId]?: string;
11
11
  }
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.9",
3
+ "version": "6.0.10",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",