Skip to content

Commit 6986f3e

Browse files
authored
Release v4.1.3 (#3722)
1 parent c24f52c commit 6986f3e

File tree

8 files changed

+140
-98
lines changed

8 files changed

+140
-98
lines changed

dist/less.js

+65-44
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
2-
* Less - Leaner CSS v4.1.2
2+
* Less - Leaner CSS v4.1.3
33
* http://lesscss.org
44
*
5-
* Copyright (c) 2009-2021, Alexis Sellier <self@cloudhead.net>
5+
* Copyright (c) 2009-2022, Alexis Sellier <self@cloudhead.net>
66
* Licensed under the Apache-2.0 License.
77
*
88
* @license Apache-2.0
@@ -80,6 +80,9 @@
8080
.replace(/\./g, ':'); // Replace dots with colons(for valid id)
8181
}
8282
function addDataAttr(options, tag) {
83+
if (!tag) {
84+
return;
85+
} // in case of tag is null or undefined
8386
for (var opt in tag.dataset) {
8487
if (tag.dataset.hasOwnProperty(opt)) {
8588
if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootpath' || opt === 'errorReporting') {
@@ -1599,41 +1602,38 @@
15991602
}
16001603
});
16011604

1602-
var debugInfo = /** @class */ (function () {
1603-
function debugInfo(context, ctx, lineSeparator) {
1604-
var result = '';
1605-
if (context.dumpLineNumbers && !context.compress) {
1606-
switch (context.dumpLineNumbers) {
1607-
case 'comments':
1608-
result = debugInfo.asComment(ctx);
1609-
break;
1610-
case 'mediaquery':
1611-
result = debugInfo.asMediaQuery(ctx);
1612-
break;
1613-
case 'all':
1614-
result = debugInfo.asComment(ctx) + (lineSeparator || '') + debugInfo.asMediaQuery(ctx);
1615-
break;
1616-
}
1617-
}
1618-
return result;
1605+
function asComment(ctx) {
1606+
return "/* line " + ctx.debugInfo.lineNumber + ", " + ctx.debugInfo.fileName + " */\n";
1607+
}
1608+
function asMediaQuery(ctx) {
1609+
var filenameWithProtocol = ctx.debugInfo.fileName;
1610+
if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
1611+
filenameWithProtocol = "file://" + filenameWithProtocol;
16191612
}
1620-
debugInfo.asComment = function (ctx) {
1621-
return "/* line " + ctx.debugInfo.lineNumber + ", " + ctx.debugInfo.fileName + " */\n";
1622-
};
1623-
debugInfo.asMediaQuery = function (ctx) {
1624-
var filenameWithProtocol = ctx.debugInfo.fileName;
1625-
if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
1626-
filenameWithProtocol = "file://" + filenameWithProtocol;
1613+
return "@media -sass-debug-info{filename{font-family:" + filenameWithProtocol.replace(/([.:\/\\])/g, function (a) {
1614+
if (a == '\\') {
1615+
a = '\/';
16271616
}
1628-
return "@media -sass-debug-info{filename{font-family:" + filenameWithProtocol.replace(/([.:\/\\])/g, function (a) {
1629-
if (a == '\\') {
1630-
a = '\/';
1631-
}
1632-
return "\\" + a;
1633-
}) + "}line{font-family:\\00003" + ctx.debugInfo.lineNumber + "}}\n";
1634-
};
1635-
return debugInfo;
1636-
}());
1617+
return "\\" + a;
1618+
}) + "}line{font-family:\\00003" + ctx.debugInfo.lineNumber + "}}\n";
1619+
}
1620+
function debugInfo(context, ctx, lineSeparator) {
1621+
var result = '';
1622+
if (context.dumpLineNumbers && !context.compress) {
1623+
switch (context.dumpLineNumbers) {
1624+
case 'comments':
1625+
result = asComment(ctx);
1626+
break;
1627+
case 'mediaquery':
1628+
result = asMediaQuery(ctx);
1629+
break;
1630+
case 'all':
1631+
result = asComment(ctx) + (lineSeparator || '') + asMediaQuery(ctx);
1632+
break;
1633+
}
1634+
}
1635+
return result;
1636+
}
16371637

16381638
var Comment = function (value, isLineComment, index, currentFileInfo) {
16391639
this.value = value;
@@ -3387,15 +3387,16 @@
33873387
}
33883388
});
33893389

3390-
var Attribute = function (key, op, value) {
3390+
var Attribute = function (key, op, value, cif) {
33913391
this.key = key;
33923392
this.op = op;
33933393
this.value = value;
3394+
this.cif = cif;
33943395
};
33953396
Attribute.prototype = Object.assign(new Node(), {
33963397
type: 'Attribute',
33973398
eval: function (context) {
3398-
return new Attribute(this.key.eval ? this.key.eval(context) : this.key, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value);
3399+
return new Attribute(this.key.eval ? this.key.eval(context) : this.key, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value, this.cif);
33993400
},
34003401
genCSS: function (context, output) {
34013402
output.add(this.toCSS(context));
@@ -3406,6 +3407,9 @@
34063407
value += this.op;
34073408
value += (this.value.toCSS ? this.value.toCSS(context) : this.value);
34083409
}
3410+
if (this.cif) {
3411+
value = value + " " + this.cif;
3412+
}
34093413
return "[" + value + "]";
34103414
}
34113415
});
@@ -6654,11 +6658,20 @@
66546658
//
66556659
parse: function (str, callback, additionalData) {
66566660
var root;
6657-
var error = null;
6661+
var err = null;
66586662
var globalVars;
66596663
var modifyVars;
66606664
var ignored;
66616665
var preText = '';
6666+
// Optionally disable @plugin parsing
6667+
if (additionalData && additionalData.disablePluginRule) {
6668+
parsers.plugin = function () {
6669+
var dir = parserInput.$re(/^@plugin?\s+/);
6670+
if (dir) {
6671+
error('@plugin statements are not allowed when disablePluginRule is set to true');
6672+
}
6673+
};
6674+
}
66626675
globalVars = (additionalData && additionalData.globalVars) ? Parser.serializeVars(additionalData.globalVars) + "\n" : '';
66636676
modifyVars = (additionalData && additionalData.modifyVars) ? "\n" + Parser.serializeVars(additionalData.modifyVars) : '';
66646677
if (context.pluginManager) {
@@ -6723,15 +6736,15 @@
67236736
message += '. Possibly missing something';
67246737
}
67256738
}
6726-
error = new LessError({
6739+
err = new LessError({
67276740
type: 'Parse',
67286741
message: message,
67296742
index: endInfo.furthest,
67306743
filename: fileInfo.filename
67316744
}, imports);
67326745
}
67336746
var finish = function (e) {
6734-
e = error || e || imports.error;
6747+
e = err || e || imports.error;
67356748
if (e) {
67366749
if (!(e instanceof LessError)) {
67376750
e = new LessError(e, imports, fileInfo.filename);
@@ -7808,15 +7821,23 @@
78087821
var key;
78097822
var val;
78107823
var op;
7824+
//
7825+
// case-insensitive flag
7826+
// e.g. [attr operator value i]
7827+
//
7828+
var cif;
78117829
if (!(key = entities.variableCurly())) {
78127830
key = expect(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/);
78137831
}
78147832
op = parserInput.$re(/^[|~*$^]?=/);
78157833
if (op) {
78167834
val = entities.quoted() || parserInput.$re(/^[0-9]+%/) || parserInput.$re(/^[\w-]+/) || entities.variableCurly();
7835+
if (val) {
7836+
cif = parserInput.$re(/^[iIsS]/);
7837+
}
78177838
}
78187839
expectChar(']');
7819-
return new (tree.Attribute)(key, op, val);
7840+
return new (tree.Attribute)(key, op, val, cif);
78207841
},
78217842
//
78227843
// The `block` rule is used by `ruleset` and `mixin.definition`.
@@ -8063,7 +8084,7 @@
80638084
var path;
80648085
var features;
80658086
var index = parserInput.i;
8066-
var dir = parserInput.$re(/^@import?\s+/);
8087+
var dir = parserInput.$re(/^@import\s+/);
80678088
if (dir) {
80688089
var options = (dir ? this.importOptions() : null) || {};
80698090
if ((path = this.entities.quoted() || this.entities.url())) {
@@ -8214,7 +8235,7 @@
82148235
var args;
82158236
var options;
82168237
var index = parserInput.i;
8217-
var dir = parserInput.$re(/^@plugin?\s+/);
8238+
var dir = parserInput.$re(/^@plugin\s+/);
82188239
if (dir) {
82198240
args = this.pluginArgs();
82208241
if (args) {
@@ -10575,7 +10596,7 @@
1057510596
return render;
1057610597
}
1057710598

10578-
var version = "4.1.2";
10599+
var version = "4.1.3";
1057910600

1058010601
function parseNodeVersion(version) {
1058110602
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

dist/less.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/less.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@less/root",
33
"private": true,
4-
"version": "3.13.0",
4+
"version": "4.1.3",
55
"description": "Less monorepo",
66
"homepage": "http://lesscss.org",
77
"scripts": {

0 commit comments

Comments
 (0)