Skip to content

Commit 283b1b4

Browse files
authored
Fixes #3574 (#3575)
* Fixes #3574 * Bump version and dist files
1 parent 5423802 commit 283b1b4

14 files changed

+236
-54
lines changed

dist/less.js

+108-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Less - Leaner CSS v3.13.0
2+
* Less - Leaner CSS v3.13.1
33
* http://lesscss.org
44
*
55
* Copyright (c) 2009-2020, Alexis Sellier <[email protected]>
@@ -217,18 +217,6 @@
217217
function __() { this.constructor = d; }
218218
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
219219
}
220-
var __assign = function () {
221-
__assign = Object.assign || function __assign(t) {
222-
for (var s, i = 1, n = arguments.length; i < n; i++) {
223-
s = arguments[i];
224-
for (var p in s)
225-
if (Object.prototype.hasOwnProperty.call(s, p))
226-
t[p] = s[p];
227-
}
228-
return t;
229-
};
230-
return __assign.apply(this, arguments);
231-
};
232220
function __spreadArrays() {
233221
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
234222
s += arguments[i].length;
@@ -914,6 +902,105 @@
914902
ALL: 2
915903
};
916904

905+
/**
906+
* Returns the object type of the given payload
907+
*
908+
* @param {*} payload
909+
* @returns {string}
910+
*/
911+
function getType(payload) {
912+
return Object.prototype.toString.call(payload).slice(8, -1);
913+
}
914+
/**
915+
* Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
916+
*
917+
* @param {*} payload
918+
* @returns {payload is Record<string, any>}
919+
*/
920+
function isPlainObject(payload) {
921+
if (getType(payload) !== 'Object')
922+
return false;
923+
return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype;
924+
}
925+
/**
926+
* Returns whether the payload is an array
927+
*
928+
* @param {any} payload
929+
* @returns {payload is any[]}
930+
*/
931+
function isArray(payload) {
932+
return getType(payload) === 'Array';
933+
}
934+
935+
/*! *****************************************************************************
936+
Copyright (c) Microsoft Corporation. All rights reserved.
937+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
938+
this file except in compliance with the License. You may obtain a copy of the
939+
License at http://www.apache.org/licenses/LICENSE-2.0
940+
941+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
942+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
943+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
944+
MERCHANTABLITY OR NON-INFRINGEMENT.
945+
946+
See the Apache Version 2.0 License for specific language governing permissions
947+
and limitations under the License.
948+
***************************************************************************** */
949+
function __spreadArrays$1() {
950+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
951+
s += arguments[i].length;
952+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
953+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
954+
r[k] = a[j];
955+
return r;
956+
}
957+
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
958+
var propType = {}.propertyIsEnumerable.call(originalObject, key)
959+
? 'enumerable'
960+
: 'nonenumerable';
961+
if (propType === 'enumerable')
962+
carry[key] = newVal;
963+
if (includeNonenumerable && propType === 'nonenumerable') {
964+
Object.defineProperty(carry, key, {
965+
value: newVal,
966+
enumerable: false,
967+
writable: true,
968+
configurable: true,
969+
});
970+
}
971+
}
972+
/**
973+
* Copy (clone) an object and all its props recursively to get rid of any prop referenced of the original object. Arrays are also cloned, however objects inside arrays are still linked.
974+
*
975+
* @export
976+
* @template T
977+
* @param {T} target Target can be anything
978+
* @param {Options} [options={}] Options can be `props` or `nonenumerable`
979+
* @returns {T} the target with replaced values
980+
* @export
981+
*/
982+
function copy(target, options) {
983+
if (options === void 0) {
984+
options = {};
985+
}
986+
if (isArray(target))
987+
return target.map(function (i) { return copy(i, options); });
988+
if (!isPlainObject(target))
989+
return target;
990+
var props = Object.getOwnPropertyNames(target);
991+
var symbols = Object.getOwnPropertySymbols(target);
992+
return __spreadArrays$1(props, symbols).reduce(function (carry, key) {
993+
if (isArray(options.props) && !options.props.includes(key)) {
994+
return carry;
995+
}
996+
var val = target[key];
997+
var newVal = copy(val, options);
998+
assignProp(carry, key, newVal, target, options.nonenumerable);
999+
return carry;
1000+
}, {});
1001+
}
1002+
1003+
/* jshint proto: true */
9171004
function getLocation(index, inputStream) {
9181005
var n = index + 1;
9191006
var line = null;
@@ -951,9 +1038,9 @@
9511038
var newObj = obj2 || {};
9521039
if (!obj2._defaults) {
9531040
newObj = {};
954-
var defaults_1 = __assign({}, obj1);
1041+
var defaults_1 = copy(obj1);
9551042
newObj._defaults = defaults_1;
956-
var cloned = obj2 ? __assign({}, obj2) : {};
1043+
var cloned = obj2 ? copy(obj2) : {};
9571044
Object.assign(newObj, defaults_1, cloned);
9581045
}
9591046
return newObj;
@@ -9699,8 +9786,12 @@
96999786
// adjust the source
97009787
inputSource = inputSource.slice(this._contentsIgnoredCharsMap[fileInfo.filename]);
97019788
}
9702-
// ignore empty content
9789+
/**
9790+
* ignore empty content, or failsafe
9791+
* if contents map is incorrect
9792+
*/
97039793
if (inputSource === undefined) {
9794+
this._css.push(chunk);
97049795
return;
97059796
}
97069797
inputSource = inputSource.substring(0, index);
@@ -10444,7 +10535,7 @@
1044410535
* It's not clear what should / must be public and why.
1044510536
*/
1044610537
var initial = {
10447-
version: [3, 13, 0],
10538+
version: [3, 13, 1],
1044810539
data: data,
1044910540
tree: tree,
1045010541
Environment: environment,

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

+108-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Less - Leaner CSS v3.13.0
2+
* Less - Leaner CSS v3.13.1
33
* http://lesscss.org
44
*
55
* Copyright (c) 2009-2020, Alexis Sellier <[email protected]>
@@ -217,18 +217,6 @@
217217
function __() { this.constructor = d; }
218218
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
219219
}
220-
var __assign = function () {
221-
__assign = Object.assign || function __assign(t) {
222-
for (var s, i = 1, n = arguments.length; i < n; i++) {
223-
s = arguments[i];
224-
for (var p in s)
225-
if (Object.prototype.hasOwnProperty.call(s, p))
226-
t[p] = s[p];
227-
}
228-
return t;
229-
};
230-
return __assign.apply(this, arguments);
231-
};
232220
function __spreadArrays() {
233221
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
234222
s += arguments[i].length;
@@ -914,6 +902,105 @@
914902
ALL: 2
915903
};
916904

905+
/**
906+
* Returns the object type of the given payload
907+
*
908+
* @param {*} payload
909+
* @returns {string}
910+
*/
911+
function getType(payload) {
912+
return Object.prototype.toString.call(payload).slice(8, -1);
913+
}
914+
/**
915+
* Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
916+
*
917+
* @param {*} payload
918+
* @returns {payload is Record<string, any>}
919+
*/
920+
function isPlainObject(payload) {
921+
if (getType(payload) !== 'Object')
922+
return false;
923+
return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype;
924+
}
925+
/**
926+
* Returns whether the payload is an array
927+
*
928+
* @param {any} payload
929+
* @returns {payload is any[]}
930+
*/
931+
function isArray(payload) {
932+
return getType(payload) === 'Array';
933+
}
934+
935+
/*! *****************************************************************************
936+
Copyright (c) Microsoft Corporation. All rights reserved.
937+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
938+
this file except in compliance with the License. You may obtain a copy of the
939+
License at http://www.apache.org/licenses/LICENSE-2.0
940+
941+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
942+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
943+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
944+
MERCHANTABLITY OR NON-INFRINGEMENT.
945+
946+
See the Apache Version 2.0 License for specific language governing permissions
947+
and limitations under the License.
948+
***************************************************************************** */
949+
function __spreadArrays$1() {
950+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
951+
s += arguments[i].length;
952+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
953+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
954+
r[k] = a[j];
955+
return r;
956+
}
957+
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
958+
var propType = {}.propertyIsEnumerable.call(originalObject, key)
959+
? 'enumerable'
960+
: 'nonenumerable';
961+
if (propType === 'enumerable')
962+
carry[key] = newVal;
963+
if (includeNonenumerable && propType === 'nonenumerable') {
964+
Object.defineProperty(carry, key, {
965+
value: newVal,
966+
enumerable: false,
967+
writable: true,
968+
configurable: true,
969+
});
970+
}
971+
}
972+
/**
973+
* Copy (clone) an object and all its props recursively to get rid of any prop referenced of the original object. Arrays are also cloned, however objects inside arrays are still linked.
974+
*
975+
* @export
976+
* @template T
977+
* @param {T} target Target can be anything
978+
* @param {Options} [options={}] Options can be `props` or `nonenumerable`
979+
* @returns {T} the target with replaced values
980+
* @export
981+
*/
982+
function copy(target, options) {
983+
if (options === void 0) {
984+
options = {};
985+
}
986+
if (isArray(target))
987+
return target.map(function (i) { return copy(i, options); });
988+
if (!isPlainObject(target))
989+
return target;
990+
var props = Object.getOwnPropertyNames(target);
991+
var symbols = Object.getOwnPropertySymbols(target);
992+
return __spreadArrays$1(props, symbols).reduce(function (carry, key) {
993+
if (isArray(options.props) && !options.props.includes(key)) {
994+
return carry;
995+
}
996+
var val = target[key];
997+
var newVal = copy(val, options);
998+
assignProp(carry, key, newVal, target, options.nonenumerable);
999+
return carry;
1000+
}, {});
1001+
}
1002+
1003+
/* jshint proto: true */
9171004
function getLocation(index, inputStream) {
9181005
var n = index + 1;
9191006
var line = null;
@@ -951,9 +1038,9 @@
9511038
var newObj = obj2 || {};
9521039
if (!obj2._defaults) {
9531040
newObj = {};
954-
var defaults_1 = __assign({}, obj1);
1041+
var defaults_1 = copy(obj1);
9551042
newObj._defaults = defaults_1;
956-
var cloned = obj2 ? __assign({}, obj2) : {};
1043+
var cloned = obj2 ? copy(obj2) : {};
9571044
Object.assign(newObj, defaults_1, cloned);
9581045
}
9591046
return newObj;
@@ -9699,8 +9786,12 @@
96999786
// adjust the source
97009787
inputSource = inputSource.slice(this._contentsIgnoredCharsMap[fileInfo.filename]);
97019788
}
9702-
// ignore empty content
9789+
/**
9790+
* ignore empty content, or failsafe
9791+
* if contents map is incorrect
9792+
*/
97039793
if (inputSource === undefined) {
9794+
this._css.push(chunk);
97049795
return;
97059796
}
97069797
inputSource = inputSource.substring(0, index);
@@ -10444,7 +10535,7 @@
1044410535
* It's not clear what should / must be public and why.
1044510536
*/
1044610537
var initial = {
10447-
version: [3, 13, 0],
10538+
version: [3, 13, 1],
1044810539
data: data,
1044910540
tree: tree,
1045010541
Environment: environment,

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/package-lock.json

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

packages/less/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "less",
3-
"version": "3.13.0",
3+
"version": "3.13.1",
44
"description": "Leaner CSS",
55
"homepage": "http://lesscss.org",
66
"author": {
@@ -61,7 +61,6 @@
6161
"benny": "^3.6.12",
6262
"bootstrap-less-port": "0.3.0",
6363
"chai": "^4.2.0",
64-
"copy-anything": "^2.0.1",
6564
"diff": "^3.2.0",
6665
"eslint": "^6.8.0",
6766
"fs-extra": "^8.1.0",
@@ -128,6 +127,7 @@
128127
"rawcurrent": "https://raw.github.com/less/less.js/v",
129128
"sourcearchive": "https://github.com/less/less.js/archive/v",
130129
"dependencies": {
130+
"copy-anything": "^2.0.1",
131131
"tslib": "^1.10.0"
132132
}
133133
}

packages/less/src/less/import-manager.js

-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ export default function(environment) {
121121
} else if (importOptions.inline) {
122122
fileParsedFunc(null, contents, resolvedFilename);
123123
} else {
124-
125124
// import (multiple) parse trees apparently get altered and can't be cached.
126125
// TODO: investigate why this is
127126
if (importManager.files[resolvedFilename]

packages/less/src/less/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default (environment, fileManagers) => {
4242
* It's not clear what should / must be public and why.
4343
*/
4444
const initial = {
45-
version: [3, 13, 0],
45+
version: [3, 13, 1],
4646
data,
4747
tree,
4848
Environment,

0 commit comments

Comments
 (0)