less 4.4.0 → 4.4.1

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');
@@ -1883,6 +1894,48 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
1883
1894
  return null;
1884
1895
  }
1885
1896
  },
1897
+ atruleUnknown: function (value, name, hasBlock) {
1898
+ value = this.permissiveValue(/^[{;]/);
1899
+ hasBlock = (parserInput.currentChar() === '{');
1900
+ if (!value) {
1901
+ if (!hasBlock && parserInput.currentChar() !== ';') {
1902
+ error(''.concat(name, ' rule is missing block or ending semi-colon'));
1903
+ }
1904
+ }
1905
+ else if (!value.value) {
1906
+ value = null;
1907
+ }
1908
+ return [value, hasBlock];
1909
+ },
1910
+ atruleBlock: function (rules, value, isRooted, isKeywordList) {
1911
+ rules = this.blockRuleset();
1912
+ parserInput.save();
1913
+ if (!rules && !isRooted) {
1914
+ value = this.entity();
1915
+ rules = this.blockRuleset();
1916
+ }
1917
+ if (!rules && !isRooted) {
1918
+ parserInput.restore();
1919
+ var e = [];
1920
+ value = this.entity();
1921
+ while (parserInput.$char(',')) {
1922
+ e.push(value);
1923
+ value = this.entity();
1924
+ }
1925
+ if (value && e.length > 0) {
1926
+ e.push(value);
1927
+ value = e;
1928
+ isKeywordList = true;
1929
+ }
1930
+ else {
1931
+ rules = this.blockRuleset();
1932
+ }
1933
+ }
1934
+ else {
1935
+ parserInput.forget();
1936
+ }
1937
+ return [rules, value, isKeywordList];
1938
+ },
1886
1939
  //
1887
1940
  // A CSS AtRule
1888
1941
  //
@@ -1958,43 +2011,27 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
1958
2011
  }
1959
2012
  }
1960
2013
  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
- }
2014
+ var unknownPackage = this.atruleUnknown(value, name, hasBlock);
2015
+ value = unknownPackage[0];
2016
+ hasBlock = unknownPackage[1];
1971
2017
  }
1972
2018
  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) {
2019
+ var blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList);
2020
+ rules = blockPackage[0];
2021
+ value = blockPackage[1];
2022
+ isKeywordList = blockPackage[2];
2023
+ if (!rules && !hasUnknown) {
1980
2024
  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;
2025
+ name = parserInput.$re(/^@[a-z-]+/);
2026
+ var unknownPackage = this.atruleUnknown(value, name, hasBlock);
2027
+ value = unknownPackage[0];
2028
+ hasBlock = unknownPackage[1];
2029
+ if (hasBlock) {
2030
+ blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList);
2031
+ rules = blockPackage[0];
2032
+ value = blockPackage[1];
2033
+ isKeywordList = blockPackage[2];
1991
2034
  }
1992
- else {
1993
- rules = this.blockRuleset();
1994
- }
1995
- }
1996
- else {
1997
- parserInput.forget();
1998
2035
  }
1999
2036
  }
2000
2037
  if (rules || isKeywordList || (!hasBlock && value && parserInput.$char(';'))) {