Skip to content

Commit a4b6c85

Browse files
authored
Roll back paren requirement on mixin calls (#3588)
1 parent 7f1938e commit a4b6c85

File tree

9 files changed

+77
-57
lines changed

9 files changed

+77
-57
lines changed

dist/less.js

+26-24
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Less - Leaner CSS v4.0.0
33
* http://lesscss.org
44
*
5-
* Copyright (c) 2009-2020, Alexis Sellier <[email protected]>
5+
* Copyright (c) 2009-2021, Alexis Sellier <[email protected]>
66
* Licensed under the Apache-2.0 License.
77
*
88
* @license Apache-2.0
@@ -11,7 +11,7 @@
1111
(function (global, factory) {
1212
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
1313
typeof define === 'function' && define.amd ? define(factory) :
14-
(global = global || self, global.less = factory());
14+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.less = factory());
1515
}(this, (function () { 'use strict';
1616

1717
// Export a new default each time
@@ -992,14 +992,15 @@
992992
See the Apache Version 2.0 License for specific language governing permissions
993993
and limitations under the License.
994994
***************************************************************************** */
995+
995996
function __spreadArrays() {
996-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
997-
s += arguments[i].length;
997+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
998998
for (var r = Array(s), k = 0, i = 0; i < il; i++)
999999
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
10001000
r[k] = a[j];
10011001
return r;
10021002
}
1003+
10031004
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
10041005
var propType = {}.propertyIsEnumerable.call(originalObject, key)
10051006
? 'enumerable'
@@ -1026,9 +1027,7 @@
10261027
* @export
10271028
*/
10281029
function copy(target, options) {
1029-
if (options === void 0) {
1030-
options = {};
1031-
}
1030+
if (options === void 0) { options = {}; }
10321031
if (isArray(target))
10331032
return target.map(function (i) { return copy(i, options); });
10341033
if (!isPlainObject(target))
@@ -3046,9 +3045,9 @@
30463045
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
30473046
PERFORMANCE OF THIS SOFTWARE.
30483047
***************************************************************************** */
3048+
30493049
function __spreadArrays$1() {
3050-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
3051-
s += arguments[i].length;
3050+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
30523051
for (var r = Array(s), k = 0, i = 0; i < il; i++)
30533052
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
30543053
r[k] = a[j];
@@ -7267,9 +7266,9 @@
72677266
parserInput.restore();
72687267
return;
72697268
}
7270-
if (!lookups && !hasParens) {
7271-
// This isn't a valid mixin call
7272-
parserInput.restore('Unrecognized input. Possibly missing \'(\' in mixin call.');
7269+
if (inValue && !lookups && !hasParens) {
7270+
// This isn't a valid in-value mixin call
7271+
parserInput.restore();
72737272
return;
72747273
}
72757274
if (!inValue && parsers.important()) {
@@ -10514,19 +10513,22 @@
1051410513
var version = "4.0.0";
1051510514

1051610515
function parseNodeVersion(version) {
10517-
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
10518-
if (!match) {
10519-
throw new Error('Unable to parse: ' + version);
10520-
}
10521-
var res = {
10522-
major: parseInt(match[1], 10),
10523-
minor: parseInt(match[2], 10),
10524-
patch: parseInt(match[3], 10),
10525-
pre: match[4] || '',
10526-
build: match[5] || '',
10527-
};
10528-
return res;
10516+
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
10517+
if (!match) {
10518+
throw new Error('Unable to parse: ' + version);
10519+
}
10520+
10521+
var res = {
10522+
major: parseInt(match[1], 10),
10523+
minor: parseInt(match[2], 10),
10524+
patch: parseInt(match[3], 10),
10525+
pre: match[4] || '',
10526+
build: match[5] || '',
10527+
};
10528+
10529+
return res;
1052910530
}
10531+
1053010532
var parseNodeVersion_1 = parseNodeVersion;
1053110533

1053210534
function lessRoot (environment, fileManagers) {

dist/less.min.js

+2-2
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.

packages/less/dist/less.js

+26-24
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Less - Leaner CSS v4.0.0
33
* http://lesscss.org
44
*
5-
* Copyright (c) 2009-2020, Alexis Sellier <[email protected]>
5+
* Copyright (c) 2009-2021, Alexis Sellier <[email protected]>
66
* Licensed under the Apache-2.0 License.
77
*
88
* @license Apache-2.0
@@ -11,7 +11,7 @@
1111
(function (global, factory) {
1212
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
1313
typeof define === 'function' && define.amd ? define(factory) :
14-
(global = global || self, global.less = factory());
14+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.less = factory());
1515
}(this, (function () { 'use strict';
1616

1717
// Export a new default each time
@@ -992,14 +992,15 @@
992992
See the Apache Version 2.0 License for specific language governing permissions
993993
and limitations under the License.
994994
***************************************************************************** */
995+
995996
function __spreadArrays() {
996-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
997-
s += arguments[i].length;
997+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
998998
for (var r = Array(s), k = 0, i = 0; i < il; i++)
999999
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
10001000
r[k] = a[j];
10011001
return r;
10021002
}
1003+
10031004
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
10041005
var propType = {}.propertyIsEnumerable.call(originalObject, key)
10051006
? 'enumerable'
@@ -1026,9 +1027,7 @@
10261027
* @export
10271028
*/
10281029
function copy(target, options) {
1029-
if (options === void 0) {
1030-
options = {};
1031-
}
1030+
if (options === void 0) { options = {}; }
10321031
if (isArray(target))
10331032
return target.map(function (i) { return copy(i, options); });
10341033
if (!isPlainObject(target))
@@ -3046,9 +3045,9 @@
30463045
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
30473046
PERFORMANCE OF THIS SOFTWARE.
30483047
***************************************************************************** */
3048+
30493049
function __spreadArrays$1() {
3050-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
3051-
s += arguments[i].length;
3050+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
30523051
for (var r = Array(s), k = 0, i = 0; i < il; i++)
30533052
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
30543053
r[k] = a[j];
@@ -7267,9 +7266,9 @@
72677266
parserInput.restore();
72687267
return;
72697268
}
7270-
if (!lookups && !hasParens) {
7271-
// This isn't a valid mixin call
7272-
parserInput.restore('Unrecognized input. Possibly missing \'(\' in mixin call.');
7269+
if (inValue && !lookups && !hasParens) {
7270+
// This isn't a valid in-value mixin call
7271+
parserInput.restore();
72737272
return;
72747273
}
72757274
if (!inValue && parsers.important()) {
@@ -10514,19 +10513,22 @@
1051410513
var version = "4.0.0";
1051510514

1051610515
function parseNodeVersion(version) {
10517-
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
10518-
if (!match) {
10519-
throw new Error('Unable to parse: ' + version);
10520-
}
10521-
var res = {
10522-
major: parseInt(match[1], 10),
10523-
minor: parseInt(match[2], 10),
10524-
patch: parseInt(match[3], 10),
10525-
pre: match[4] || '',
10526-
build: match[5] || '',
10527-
};
10528-
return res;
10516+
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
10517+
if (!match) {
10518+
throw new Error('Unable to parse: ' + version);
10519+
}
10520+
10521+
var res = {
10522+
major: parseInt(match[1], 10),
10523+
minor: parseInt(match[2], 10),
10524+
patch: parseInt(match[3], 10),
10525+
pre: match[4] || '',
10526+
build: match[5] || '',
10527+
};
10528+
10529+
return res;
1052910530
}
10531+
1053010532
var parseNodeVersion_1 = parseNodeVersion;
1053110533

1053210534
function lessRoot (environment, fileManagers) {

packages/less/dist/less.min.js

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

packages/less/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.

packages/less/src/less/parser/parser.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -908,9 +908,9 @@ const Parser = function Parser(context, imports, fileInfo) {
908908
return;
909909
}
910910

911-
if (!lookups && !hasParens) {
912-
// This isn't a valid mixin call
913-
parserInput.restore('Unrecognized input. Possibly missing \'(\' in mixin call.');
911+
if (inValue && !lookups && !hasParens) {
912+
// This isn't a valid in-value mixin call
913+
parserInput.restore();
914914
return;
915915
}
916916

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#theme > .mixin {
2+
background-color: grey;
3+
}
4+
#container {
5+
color: black;
6+
background-color: grey;
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#theme {
2+
> .mixin {
3+
background-color: grey;
4+
}
5+
}
6+
#container {
7+
color: black;
8+
#theme > .mixin;
9+
}

0 commit comments

Comments
 (0)