less 4.6.5 → 4.6.6

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Less - Leaner CSS v4.6.5
2
+ * Less - Leaner CSS v4.6.6
3
3
  * http://lesscss.org
4
4
  *
5
5
  * Copyright (c) 2009-2026, Alexis Sellier <self@cloudhead.net>
@@ -3045,7 +3045,9 @@ function asMediaQuery(ctx) {
3045
3045
  */
3046
3046
  function debugInfo(context, ctx, lineSeparator) {
3047
3047
  let result = '';
3048
- if (context.dumpLineNumbers && !context.compress) {
3048
+ // Some nodes never receive a debugInfo during parsing (e.g. the implicit
3049
+ // ruleset of a nested @supports/@document), so there is no line to emit.
3050
+ if (context.dumpLineNumbers && !context.compress && ctx.debugInfo) {
3049
3051
  switch (context.dumpLineNumbers) {
3050
3052
  case 'comments':
3051
3053
  result = asComment(ctx);
@@ -6384,15 +6386,21 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
6384
6386
  let p;
6385
6387
  let rangeP;
6386
6388
  let spacing = false;
6389
+ const cssKeyword = () => {
6390
+ const k = parserInput.$re(/^(?:--|-?(?:[_a-zA-Z0-9]|[^\0-\x7F]|\\[0-9a-fA-F]{1,6}\s?|\\[^\n\r\f0-9a-fA-F]))(?:[-_a-zA-Z0-9]|[^\0-\x7F]|\\[0-9a-fA-F]{1,6}\s?|\\[^\n\r\f0-9a-fA-F])*/);
6391
+ if (k) {
6392
+ return tree.Color.fromKeyword(k) || new(tree.Keyword)(k);
6393
+ }
6394
+ };
6387
6395
  parserInput.save();
6388
6396
  do {
6389
6397
  parserInput.save();
6390
- if (parserInput.$re(/^[0-9a-z-]*\s+\(/)) {
6398
+ if (parserInput.$re(/^(?:--|-?(?:[_a-zA-Z0-9]|[^\0-\x7F]|\\[0-9a-fA-F]{1,6}\s?|\\[^\n\r\f0-9a-fA-F]))(?:[-_a-zA-Z0-9]|[^\0-\x7F]|\\[0-9a-fA-F]{1,6}\s?|\\[^\n\r\f0-9a-fA-F])*\s+\(/)) {
6391
6399
  spacing = true;
6392
6400
  }
6393
6401
  parserInput.restore();
6394
6402
 
6395
- e = entities.declarationCall.bind(this)() || entities.keyword() || entities.variable() || entities.mixinLookup();
6403
+ e = entities.declarationCall.bind(this)() || cssKeyword() || entities.keyword() || entities.variable() || entities.mixinLookup();
6396
6404
  if (e) {
6397
6405
  nodes.push(e);
6398
6406
  if (e.type === 'Variable' ||
@@ -6429,7 +6437,11 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
6429
6437
  }
6430
6438
  if (closed) {
6431
6439
  if (p && !e) {
6432
- nodes.push(new (tree.Paren)(new (tree.QueryInParens)(p.op, p.lvalue, p.rvalue, rangeP ? rangeP.op : null, rangeP ? rangeP.rvalue : null, p._index)));
6440
+ const paren = new (tree.Paren)(new (tree.QueryInParens)(p.op, p.lvalue, p.rvalue, rangeP ? rangeP.op : null, rangeP ? rangeP.rvalue : null, p._index));
6441
+ if (!spacing) {
6442
+ paren.noSpacing = true;
6443
+ }
6444
+ nodes.push(paren);
6433
6445
  e = p;
6434
6446
  } else if (p && e) {
6435
6447
  nodes.push(new (tree.Paren)(new (tree.Declaration)(p, e, null, null, parserInput.i + currentIndex, fileInfo, true)));
@@ -6438,7 +6450,11 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
6438
6450
  }
6439
6451
  spacing = false;
6440
6452
  } else if (e) {
6441
- nodes.push(new(tree.Paren)(e));
6453
+ const paren = new(tree.Paren)(e);
6454
+ if (!spacing) {
6455
+ paren.noSpacing = true;
6456
+ }
6457
+ nodes.push(paren);
6442
6458
  spacing = false;
6443
6459
  } else {
6444
6460
  error('badly formed media feature definition');
@@ -6451,7 +6467,14 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
6451
6467
 
6452
6468
  parserInput.forget();
6453
6469
  if (nodes.length > 0) {
6454
- return new(tree.Expression)(nodes);
6470
+ const expression = new(tree.Expression)(nodes);
6471
+ if (nodes.length === 2
6472
+ && (nodes[0].type === 'Keyword' || nodes[0].type === 'Variable')
6473
+ && nodes[1].type === 'Paren'
6474
+ && nodes[1].noSpacing) {
6475
+ expression.noSpacing = true;
6476
+ }
6477
+ return expression;
6455
6478
  }
6456
6479
  },
6457
6480
 
@@ -6792,10 +6815,10 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
6792
6815
  parserInput.save();
6793
6816
 
6794
6817
  // hsl or rgb or lch operand
6795
- const match = parserInput.$re(/^[lchrgbs]\s+/);
6818
+ const match = parserInput.$re(/^([lchrgbs])(?=\s|[,/*)]|$)/);
6796
6819
  if (match) {
6797
6820
  parserInput.forget();
6798
- return new tree.Keyword(match[0]);
6821
+ return new tree.Keyword(match[1]);
6799
6822
  }
6800
6823
 
6801
6824
  parserInput.restore();
@@ -14067,7 +14090,7 @@ var imageSize = environment => {
14067
14090
  };
14068
14091
 
14069
14092
  createRequire();
14070
- const version = "4.6.5";
14093
+ const version = "4.6.6";
14071
14094
 
14072
14095
  const less = createFromEnvironment(environment, [new FileManager(), new UrlFileManager()], version);
14073
14096
 
package/dist/less.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Less - Leaner CSS v4.6.5
2
+ * Less - Leaner CSS v4.6.6
3
3
  * http://lesscss.org
4
4
  *
5
5
  * Copyright (c) 2009-2026, Alexis Sellier <self@cloudhead.net>
@@ -2878,7 +2878,9 @@
2878
2878
  */
2879
2879
  function debugInfo(context, ctx, lineSeparator) {
2880
2880
  let result = '';
2881
- if (context.dumpLineNumbers && !context.compress) {
2881
+ // Some nodes never receive a debugInfo during parsing (e.g. the implicit
2882
+ // ruleset of a nested @supports/@document), so there is no line to emit.
2883
+ if (context.dumpLineNumbers && !context.compress && ctx.debugInfo) {
2882
2884
  switch (context.dumpLineNumbers) {
2883
2885
  case 'comments':
2884
2886
  result = asComment(ctx);
@@ -6217,15 +6219,21 @@
6217
6219
  let p;
6218
6220
  let rangeP;
6219
6221
  let spacing = false;
6222
+ const cssKeyword = () => {
6223
+ const k = parserInput.$re(/^(?:--|-?(?:[_a-zA-Z0-9]|[^\0-\x7F]|\\[0-9a-fA-F]{1,6}\s?|\\[^\n\r\f0-9a-fA-F]))(?:[-_a-zA-Z0-9]|[^\0-\x7F]|\\[0-9a-fA-F]{1,6}\s?|\\[^\n\r\f0-9a-fA-F])*/);
6224
+ if (k) {
6225
+ return tree.Color.fromKeyword(k) || new(tree.Keyword)(k);
6226
+ }
6227
+ };
6220
6228
  parserInput.save();
6221
6229
  do {
6222
6230
  parserInput.save();
6223
- if (parserInput.$re(/^[0-9a-z-]*\s+\(/)) {
6231
+ if (parserInput.$re(/^(?:--|-?(?:[_a-zA-Z0-9]|[^\0-\x7F]|\\[0-9a-fA-F]{1,6}\s?|\\[^\n\r\f0-9a-fA-F]))(?:[-_a-zA-Z0-9]|[^\0-\x7F]|\\[0-9a-fA-F]{1,6}\s?|\\[^\n\r\f0-9a-fA-F])*\s+\(/)) {
6224
6232
  spacing = true;
6225
6233
  }
6226
6234
  parserInput.restore();
6227
6235
 
6228
- e = entities.declarationCall.bind(this)() || entities.keyword() || entities.variable() || entities.mixinLookup();
6236
+ e = entities.declarationCall.bind(this)() || cssKeyword() || entities.keyword() || entities.variable() || entities.mixinLookup();
6229
6237
  if (e) {
6230
6238
  nodes.push(e);
6231
6239
  if (e.type === 'Variable' ||
@@ -6262,7 +6270,11 @@
6262
6270
  }
6263
6271
  if (closed) {
6264
6272
  if (p && !e) {
6265
- nodes.push(new (tree.Paren)(new (tree.QueryInParens)(p.op, p.lvalue, p.rvalue, rangeP ? rangeP.op : null, rangeP ? rangeP.rvalue : null, p._index)));
6273
+ const paren = new (tree.Paren)(new (tree.QueryInParens)(p.op, p.lvalue, p.rvalue, rangeP ? rangeP.op : null, rangeP ? rangeP.rvalue : null, p._index));
6274
+ if (!spacing) {
6275
+ paren.noSpacing = true;
6276
+ }
6277
+ nodes.push(paren);
6266
6278
  e = p;
6267
6279
  } else if (p && e) {
6268
6280
  nodes.push(new (tree.Paren)(new (tree.Declaration)(p, e, null, null, parserInput.i + currentIndex, fileInfo, true)));
@@ -6271,7 +6283,11 @@
6271
6283
  }
6272
6284
  spacing = false;
6273
6285
  } else if (e) {
6274
- nodes.push(new(tree.Paren)(e));
6286
+ const paren = new(tree.Paren)(e);
6287
+ if (!spacing) {
6288
+ paren.noSpacing = true;
6289
+ }
6290
+ nodes.push(paren);
6275
6291
  spacing = false;
6276
6292
  } else {
6277
6293
  error('badly formed media feature definition');
@@ -6284,7 +6300,14 @@
6284
6300
 
6285
6301
  parserInput.forget();
6286
6302
  if (nodes.length > 0) {
6287
- return new(tree.Expression)(nodes);
6303
+ const expression = new(tree.Expression)(nodes);
6304
+ if (nodes.length === 2
6305
+ && (nodes[0].type === 'Keyword' || nodes[0].type === 'Variable')
6306
+ && nodes[1].type === 'Paren'
6307
+ && nodes[1].noSpacing) {
6308
+ expression.noSpacing = true;
6309
+ }
6310
+ return expression;
6288
6311
  }
6289
6312
  },
6290
6313
 
@@ -6625,10 +6648,10 @@
6625
6648
  parserInput.save();
6626
6649
 
6627
6650
  // hsl or rgb or lch operand
6628
- const match = parserInput.$re(/^[lchrgbs]\s+/);
6651
+ const match = parserInput.$re(/^([lchrgbs])(?=\s|[,/*)]|$)/);
6629
6652
  if (match) {
6630
6653
  parserInput.forget();
6631
- return new tree.Keyword(match[0]);
6654
+ return new tree.Keyword(match[1]);
6632
6655
  }
6633
6656
 
6634
6657
  parserInput.restore();
@@ -14152,7 +14175,7 @@
14152
14175
  };
14153
14176
 
14154
14177
  var name = "less";
14155
- var version = "4.6.5";
14178
+ var version = "4.6.6";
14156
14179
  var description = "Leaner CSS";
14157
14180
  var homepage = "http://lesscss.org";
14158
14181
  var author = {
package/dist/less.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Less - Leaner CSS v4.6.5
2
+ * Less - Leaner CSS v4.6.6
3
3
  * http://lesscss.org
4
4
  *
5
5
  * Copyright (c) 2009-2026, Alexis Sellier <self@cloudhead.net>
@@ -2878,7 +2878,9 @@
2878
2878
  */
2879
2879
  function debugInfo(context, ctx, lineSeparator) {
2880
2880
  let result = '';
2881
- if (context.dumpLineNumbers && !context.compress) {
2881
+ // Some nodes never receive a debugInfo during parsing (e.g. the implicit
2882
+ // ruleset of a nested @supports/@document), so there is no line to emit.
2883
+ if (context.dumpLineNumbers && !context.compress && ctx.debugInfo) {
2882
2884
  switch (context.dumpLineNumbers) {
2883
2885
  case 'comments':
2884
2886
  result = asComment(ctx);
@@ -6217,15 +6219,21 @@
6217
6219
  let p;
6218
6220
  let rangeP;
6219
6221
  let spacing = false;
6222
+ const cssKeyword = () => {
6223
+ const k = parserInput.$re(/^(?:--|-?(?:[_a-zA-Z0-9]|[^\0-\x7F]|\\[0-9a-fA-F]{1,6}\s?|\\[^\n\r\f0-9a-fA-F]))(?:[-_a-zA-Z0-9]|[^\0-\x7F]|\\[0-9a-fA-F]{1,6}\s?|\\[^\n\r\f0-9a-fA-F])*/);
6224
+ if (k) {
6225
+ return tree.Color.fromKeyword(k) || new(tree.Keyword)(k);
6226
+ }
6227
+ };
6220
6228
  parserInput.save();
6221
6229
  do {
6222
6230
  parserInput.save();
6223
- if (parserInput.$re(/^[0-9a-z-]*\s+\(/)) {
6231
+ if (parserInput.$re(/^(?:--|-?(?:[_a-zA-Z0-9]|[^\0-\x7F]|\\[0-9a-fA-F]{1,6}\s?|\\[^\n\r\f0-9a-fA-F]))(?:[-_a-zA-Z0-9]|[^\0-\x7F]|\\[0-9a-fA-F]{1,6}\s?|\\[^\n\r\f0-9a-fA-F])*\s+\(/)) {
6224
6232
  spacing = true;
6225
6233
  }
6226
6234
  parserInput.restore();
6227
6235
 
6228
- e = entities.declarationCall.bind(this)() || entities.keyword() || entities.variable() || entities.mixinLookup();
6236
+ e = entities.declarationCall.bind(this)() || cssKeyword() || entities.keyword() || entities.variable() || entities.mixinLookup();
6229
6237
  if (e) {
6230
6238
  nodes.push(e);
6231
6239
  if (e.type === 'Variable' ||
@@ -6262,7 +6270,11 @@
6262
6270
  }
6263
6271
  if (closed) {
6264
6272
  if (p && !e) {
6265
- nodes.push(new (tree.Paren)(new (tree.QueryInParens)(p.op, p.lvalue, p.rvalue, rangeP ? rangeP.op : null, rangeP ? rangeP.rvalue : null, p._index)));
6273
+ const paren = new (tree.Paren)(new (tree.QueryInParens)(p.op, p.lvalue, p.rvalue, rangeP ? rangeP.op : null, rangeP ? rangeP.rvalue : null, p._index));
6274
+ if (!spacing) {
6275
+ paren.noSpacing = true;
6276
+ }
6277
+ nodes.push(paren);
6266
6278
  e = p;
6267
6279
  } else if (p && e) {
6268
6280
  nodes.push(new (tree.Paren)(new (tree.Declaration)(p, e, null, null, parserInput.i + currentIndex, fileInfo, true)));
@@ -6271,7 +6283,11 @@
6271
6283
  }
6272
6284
  spacing = false;
6273
6285
  } else if (e) {
6274
- nodes.push(new(tree.Paren)(e));
6286
+ const paren = new(tree.Paren)(e);
6287
+ if (!spacing) {
6288
+ paren.noSpacing = true;
6289
+ }
6290
+ nodes.push(paren);
6275
6291
  spacing = false;
6276
6292
  } else {
6277
6293
  error('badly formed media feature definition');
@@ -6284,7 +6300,14 @@
6284
6300
 
6285
6301
  parserInput.forget();
6286
6302
  if (nodes.length > 0) {
6287
- return new(tree.Expression)(nodes);
6303
+ const expression = new(tree.Expression)(nodes);
6304
+ if (nodes.length === 2
6305
+ && (nodes[0].type === 'Keyword' || nodes[0].type === 'Variable')
6306
+ && nodes[1].type === 'Paren'
6307
+ && nodes[1].noSpacing) {
6308
+ expression.noSpacing = true;
6309
+ }
6310
+ return expression;
6288
6311
  }
6289
6312
  },
6290
6313
 
@@ -6625,10 +6648,10 @@
6625
6648
  parserInput.save();
6626
6649
 
6627
6650
  // hsl or rgb or lch operand
6628
- const match = parserInput.$re(/^[lchrgbs]\s+/);
6651
+ const match = parserInput.$re(/^([lchrgbs])(?=\s|[,/*)]|$)/);
6629
6652
  if (match) {
6630
6653
  parserInput.forget();
6631
- return new tree.Keyword(match[0]);
6654
+ return new tree.Keyword(match[1]);
6632
6655
  }
6633
6656
 
6634
6657
  parserInput.restore();
@@ -14152,7 +14175,7 @@
14152
14175
  };
14153
14176
 
14154
14177
  var name = "less";
14155
- var version = "4.6.5";
14178
+ var version = "4.6.6";
14156
14179
  var description = "Leaner CSS";
14157
14180
  var homepage = "http://lesscss.org";
14158
14181
  var author = {