less 4.4.0 → 4.4.2

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.
@@ -1730,8 +1730,14 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
1730
1730
  var e;
1731
1731
  var p;
1732
1732
  var rangeP;
1733
+ var spacing = false;
1733
1734
  parserInput.save();
1734
1735
  do {
1736
+ parserInput.save();
1737
+ if (parserInput.$re(/^[0-9a-z-]*\s+\(/)) {
1738
+ spacing = true;
1739
+ }
1740
+ parserInput.restore();
1735
1741
  e = entities.declarationCall.bind(this)() || entities.keyword() || entities.variable() || entities.mixinLookup();
1736
1742
  if (e) {
1737
1743
  nodes.push(e);
@@ -1759,9 +1765,14 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
1759
1765
  }
1760
1766
  else if (p && e) {
1761
1767
  nodes.push(new (tree_1.default.Paren)(new (tree_1.default.Declaration)(p, e, null, null, parserInput.i + currentIndex, fileInfo, true)));
1768
+ if (!spacing) {
1769
+ nodes[nodes.length - 1].noSpacing = true;
1770
+ }
1771
+ spacing = false;
1762
1772
  }
1763
1773
  else if (e) {
1764
1774
  nodes.push(new (tree_1.default.Paren)(e));
1775
+ spacing = false;
1765
1776
  }
1766
1777
  else {
1767
1778
  error('badly formed media feature definition');
@@ -1788,6 +1799,9 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
1788
1799
  if (!parserInput.$char(',')) {
1789
1800
  break;
1790
1801
  }
1802
+ else if (!features[features.length - 1].noSpacing) {
1803
+ features[features.length - 1].noSpacing = false;
1804
+ }
1791
1805
  }
1792
1806
  else {
1793
1807
  e = entities.variable() || entities.mixinLookup();
@@ -1796,6 +1810,9 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
1796
1810
  if (!parserInput.$char(',')) {
1797
1811
  break;
1798
1812
  }
1813
+ else if (!features[features.length - 1].noSpacing) {
1814
+ features[features.length - 1].noSpacing = false;
1815
+ }
1799
1816
  }
1800
1817
  }
1801
1818
  } while (e);
@@ -1883,6 +1900,48 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
1883
1900
  return null;
1884
1901
  }
1885
1902
  },
1903
+ atruleUnknown: function (value, name, hasBlock) {
1904
+ value = this.permissiveValue(/^[{;]/);
1905
+ hasBlock = (parserInput.currentChar() === '{');
1906
+ if (!value) {
1907
+ if (!hasBlock && parserInput.currentChar() !== ';') {
1908
+ error(''.concat(name, ' rule is missing block or ending semi-colon'));
1909
+ }
1910
+ }
1911
+ else if (!value.value) {
1912
+ value = null;
1913
+ }
1914
+ return [value, hasBlock];
1915
+ },
1916
+ atruleBlock: function (rules, value, isRooted, isKeywordList) {
1917
+ rules = this.blockRuleset();
1918
+ parserInput.save();
1919
+ if (!rules && !isRooted) {
1920
+ value = this.entity();
1921
+ rules = this.blockRuleset();
1922
+ }
1923
+ if (!rules && !isRooted) {
1924
+ parserInput.restore();
1925
+ var e = [];
1926
+ value = this.entity();
1927
+ while (parserInput.$char(',')) {
1928
+ e.push(value);
1929
+ value = this.entity();
1930
+ }
1931
+ if (value && e.length > 0) {
1932
+ e.push(value);
1933
+ value = e;
1934
+ isKeywordList = true;
1935
+ }
1936
+ else {
1937
+ rules = this.blockRuleset();
1938
+ }
1939
+ }
1940
+ else {
1941
+ parserInput.forget();
1942
+ }
1943
+ return [rules, value, isKeywordList];
1944
+ },
1886
1945
  //
1887
1946
  // A CSS AtRule
1888
1947
  //
@@ -1958,43 +2017,27 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
1958
2017
  }
1959
2018
  }
1960
2019
  else if (hasUnknown) {
1961
- value = this.permissiveValue(/^[{;]/);
1962
- hasBlock = (parserInput.currentChar() === '{');
1963
- if (!value) {
1964
- if (!hasBlock && parserInput.currentChar() !== ';') {
1965
- error("".concat(name, " rule is missing block or ending semi-colon"));
1966
- }
1967
- }
1968
- else if (!value.value) {
1969
- value = null;
1970
- }
2020
+ var unknownPackage = this.atruleUnknown(value, name, hasBlock);
2021
+ value = unknownPackage[0];
2022
+ hasBlock = unknownPackage[1];
1971
2023
  }
1972
2024
  if (hasBlock) {
1973
- rules = this.blockRuleset();
1974
- parserInput.save();
1975
- if (!rules && !isRooted) {
1976
- value = this.entity();
1977
- rules = this.blockRuleset();
1978
- }
1979
- if (!rules && !isRooted) {
2025
+ var blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList);
2026
+ rules = blockPackage[0];
2027
+ value = blockPackage[1];
2028
+ isKeywordList = blockPackage[2];
2029
+ if (!rules && !hasUnknown) {
1980
2030
  parserInput.restore();
1981
- var e = [];
1982
- value = this.entity();
1983
- while (parserInput.$char(',')) {
1984
- e.push(value);
1985
- value = this.entity();
1986
- }
1987
- if (value && e.length > 0) {
1988
- e.push(value);
1989
- value = e;
1990
- isKeywordList = true;
2031
+ name = parserInput.$re(/^@[a-z-]+/);
2032
+ var unknownPackage = this.atruleUnknown(value, name, hasBlock);
2033
+ value = unknownPackage[0];
2034
+ hasBlock = unknownPackage[1];
2035
+ if (hasBlock) {
2036
+ blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList);
2037
+ rules = blockPackage[0];
2038
+ value = blockPackage[1];
2039
+ isKeywordList = blockPackage[2];
1991
2040
  }
1992
- else {
1993
- rules = this.blockRuleset();
1994
- }
1995
- }
1996
- else {
1997
- parserInput.forget();
1998
2041
  }
1999
2042
  }
2000
2043
  if (rules || isKeywordList || (!hasBlock && value && parserInput.$char(';'))) {