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.
package/dist/less.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Less - Leaner CSS v4.4.0
2
+ * Less - Leaner CSS v4.4.1
3
3
  * http://lesscss.org
4
4
  *
5
5
  * Copyright (c) 2009-2025, Alexis Sellier <self@cloudhead.net>
@@ -908,7 +908,11 @@
908
908
  output.add(')');
909
909
  },
910
910
  eval: function (context) {
911
- return new Paren(this.value.eval(context));
911
+ var paren = new Paren(this.value.eval(context));
912
+ if (this.noSpacing) {
913
+ paren.noSpacing = true;
914
+ }
915
+ return paren;
912
916
  }
913
917
  });
914
918
 
@@ -5010,8 +5014,14 @@
5010
5014
  var e;
5011
5015
  var p;
5012
5016
  var rangeP;
5017
+ var spacing = false;
5013
5018
  parserInput.save();
5014
5019
  do {
5020
+ parserInput.save();
5021
+ if (parserInput.$re(/^[0-9a-z-]*\s+\(/)) {
5022
+ spacing = true;
5023
+ }
5024
+ parserInput.restore();
5015
5025
  e = entities.declarationCall.bind(this)() || entities.keyword() || entities.variable() || entities.mixinLookup();
5016
5026
  if (e) {
5017
5027
  nodes.push(e);
@@ -5039,9 +5049,14 @@
5039
5049
  }
5040
5050
  else if (p && e) {
5041
5051
  nodes.push(new (tree.Paren)(new (tree.Declaration)(p, e, null, null, parserInput.i + currentIndex, fileInfo, true)));
5052
+ if (!spacing) {
5053
+ nodes[nodes.length - 1].noSpacing = true;
5054
+ }
5055
+ spacing = false;
5042
5056
  }
5043
5057
  else if (e) {
5044
5058
  nodes.push(new (tree.Paren)(e));
5059
+ spacing = false;
5045
5060
  }
5046
5061
  else {
5047
5062
  error('badly formed media feature definition');
@@ -5163,6 +5178,48 @@
5163
5178
  return null;
5164
5179
  }
5165
5180
  },
5181
+ atruleUnknown: function (value, name, hasBlock) {
5182
+ value = this.permissiveValue(/^[{;]/);
5183
+ hasBlock = (parserInput.currentChar() === '{');
5184
+ if (!value) {
5185
+ if (!hasBlock && parserInput.currentChar() !== ';') {
5186
+ error(''.concat(name, ' rule is missing block or ending semi-colon'));
5187
+ }
5188
+ }
5189
+ else if (!value.value) {
5190
+ value = null;
5191
+ }
5192
+ return [value, hasBlock];
5193
+ },
5194
+ atruleBlock: function (rules, value, isRooted, isKeywordList) {
5195
+ rules = this.blockRuleset();
5196
+ parserInput.save();
5197
+ if (!rules && !isRooted) {
5198
+ value = this.entity();
5199
+ rules = this.blockRuleset();
5200
+ }
5201
+ if (!rules && !isRooted) {
5202
+ parserInput.restore();
5203
+ var e = [];
5204
+ value = this.entity();
5205
+ while (parserInput.$char(',')) {
5206
+ e.push(value);
5207
+ value = this.entity();
5208
+ }
5209
+ if (value && e.length > 0) {
5210
+ e.push(value);
5211
+ value = e;
5212
+ isKeywordList = true;
5213
+ }
5214
+ else {
5215
+ rules = this.blockRuleset();
5216
+ }
5217
+ }
5218
+ else {
5219
+ parserInput.forget();
5220
+ }
5221
+ return [rules, value, isKeywordList];
5222
+ },
5166
5223
  //
5167
5224
  // A CSS AtRule
5168
5225
  //
@@ -5238,43 +5295,27 @@
5238
5295
  }
5239
5296
  }
5240
5297
  else if (hasUnknown) {
5241
- value = this.permissiveValue(/^[{;]/);
5242
- hasBlock = (parserInput.currentChar() === '{');
5243
- if (!value) {
5244
- if (!hasBlock && parserInput.currentChar() !== ';') {
5245
- error("".concat(name, " rule is missing block or ending semi-colon"));
5246
- }
5247
- }
5248
- else if (!value.value) {
5249
- value = null;
5250
- }
5298
+ var unknownPackage = this.atruleUnknown(value, name, hasBlock);
5299
+ value = unknownPackage[0];
5300
+ hasBlock = unknownPackage[1];
5251
5301
  }
5252
5302
  if (hasBlock) {
5253
- rules = this.blockRuleset();
5254
- parserInput.save();
5255
- if (!rules && !isRooted) {
5256
- value = this.entity();
5257
- rules = this.blockRuleset();
5258
- }
5259
- if (!rules && !isRooted) {
5303
+ var blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList);
5304
+ rules = blockPackage[0];
5305
+ value = blockPackage[1];
5306
+ isKeywordList = blockPackage[2];
5307
+ if (!rules && !hasUnknown) {
5260
5308
  parserInput.restore();
5261
- var e = [];
5262
- value = this.entity();
5263
- while (parserInput.$char(',')) {
5264
- e.push(value);
5265
- value = this.entity();
5309
+ name = parserInput.$re(/^@[a-z-]+/);
5310
+ var unknownPackage = this.atruleUnknown(value, name, hasBlock);
5311
+ value = unknownPackage[0];
5312
+ hasBlock = unknownPackage[1];
5313
+ if (hasBlock) {
5314
+ blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList);
5315
+ rules = blockPackage[0];
5316
+ value = blockPackage[1];
5317
+ isKeywordList = blockPackage[2];
5266
5318
  }
5267
- if (value && e.length > 0) {
5268
- e.push(value);
5269
- value = e;
5270
- isKeywordList = true;
5271
- }
5272
- else {
5273
- rules = this.blockRuleset();
5274
- }
5275
- }
5276
- else {
5277
- parserInput.forget();
5278
5319
  }
5279
5320
  }
5280
5321
  if (rules || isKeywordList || (!hasBlock && value && parserInput.$char(';'))) {
@@ -7119,7 +7160,26 @@
7119
7160
  this.rules = visitor.visitArray(this.rules);
7120
7161
  }
7121
7162
  },
7163
+ evalFunction: function () {
7164
+ if (!this.features || !Array.isArray(this.features.value) || this.features.value.length < 1) {
7165
+ return;
7166
+ }
7167
+ var exprValues = this.features.value;
7168
+ var expr, paren;
7169
+ for (var index = 0; index < exprValues.length; ++index) {
7170
+ expr = exprValues[index];
7171
+ if (expr.type === 'Keyword' && index + 1 < exprValues.length) {
7172
+ paren = exprValues[index + 1];
7173
+ if (paren.type === 'Paren' && paren.noSpacing) {
7174
+ exprValues[index] = new Expression([expr, paren]);
7175
+ exprValues.splice(index + 1, 1);
7176
+ exprValues[index].noSpacing = true;
7177
+ }
7178
+ }
7179
+ }
7180
+ },
7122
7181
  evalTop: function (context) {
7182
+ this.evalFunction();
7123
7183
  var result = this;
7124
7184
  // Render all dependent Media blocks.
7125
7185
  if (context.mediaBlocks.length > 1) {
@@ -7134,6 +7194,7 @@
7134
7194
  return result;
7135
7195
  },
7136
7196
  evalNested: function (context) {
7197
+ this.evalFunction();
7137
7198
  var i;
7138
7199
  var value;
7139
7200
  var path = context.mediaPath.concat([this]);
@@ -11128,7 +11189,7 @@
11128
11189
  return render;
11129
11190
  }
11130
11191
 
11131
- var version = "4.4.0";
11192
+ var version = "4.4.1";
11132
11193
 
11133
11194
  function parseNodeVersion(version) {
11134
11195
  var match = version.match(/^v(\d{1,2})\.(\d{1,2})\.(\d{1,2})(?:-([0-9A-Za-z-.]+))?(?:\+([0-9A-Za-z-.]+))?$/); // eslint-disable-line max-len