less 3.10.3 → 3.11.3
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/.github/FUNDING.yml +12 -0
- package/CHANGELOG.md +509 -711
- package/CONTRIBUTING.md +2 -2
- package/Gruntfile.js +42 -212
- package/README.md +31 -3
- package/bin/lessc +10538 -13511
- package/dist/less.cjs.js +10078 -12936
- package/dist/less.js +10670 -13462
- package/dist/less.min.js +3 -3
- package/dist/less.min.js.map +1 -1
- package/lib/less/contexts.js +1 -1
- package/lib/less/environment/abstract-file-manager.js +1 -1
- package/lib/less/import-manager.js +7 -20
- package/lib/less/index.js +1 -1
- package/lib/less/less-error.js +22 -2
- package/lib/less/parse-tree.js +2 -6
- package/lib/less/parser/parser.js +10 -10
- package/lib/less/tree/debug-info.js +2 -1
- package/lib/less/tree/namespace-value.js +1 -2
- package/lib/less/visitors/visitor.js +10 -2
- package/lib/less-node/file-manager.js +19 -49
- package/lib/lessc.js +3 -22
- package/package.json +21 -16
- package/test/browser/common.js +11 -49
- package/test/browser/generator/benchmark.config.js +50 -0
- package/test/browser/generator/generate.js +78 -0
- package/test/browser/generator/runner.config.js +180 -0
- package/test/browser/generator/runner.js +2 -0
- package/test/browser/generator/template.js +83 -0
- package/test/browser/runner-browser-options.js +0 -6
- package/test/browser/runner-browser-spec.js +1 -1
- package/test/browser/runner-main-spec.js +1 -1
- package/test/browser/runner-modify-vars-spec.js +1 -1
- package/test/browser/runner-production-spec.js +1 -1
- package/test/css/calc.css +9 -0
- package/test/css/comments.css +1 -1
- package/test/css/css-3.css +5 -5
- package/test/css/css-guards.css +1 -1
- package/test/css/debug/linenumbers-all.css +5 -5
- package/test/css/debug/linenumbers-comments.css +5 -5
- package/test/css/debug/linenumbers-mediaquery.css +5 -5
- package/test/css/extend-chaining.css +3 -3
- package/test/css/extend-media.css +1 -1
- package/test/css/extend-nest.css +1 -1
- package/test/css/filemanagerPlugin/filemanager.css +1 -1
- package/test/css/functions-each.css +1 -1
- package/test/css/import-once.css +2 -2
- package/test/css/import-reference-issues.css +1 -1
- package/test/css/import-reference.css +6 -6
- package/test/css/import.css +1 -1
- package/test/css/javascript.css +1 -1
- package/test/css/legacy/legacy.css +1 -1
- package/test/css/math/parens-division/mixins-args.css +1 -1
- package/test/css/math/parens-division/parens.css +1 -1
- package/test/css/math/strict/mixins-args.css +1 -1
- package/test/css/math/strict/parens.css +1 -1
- package/test/css/math/strict-legacy/mixins-args.css +1 -1
- package/test/css/math/strict-legacy/parens.css +1 -1
- package/test/css/media.css +14 -14
- package/test/css/merge.css +10 -10
- package/test/css/mixins-guards.css +6 -6
- package/test/css/mixins.css +2 -2
- package/test/css/namespacing/namespacing-3.css +16 -1
- package/test/css/namespacing/namespacing-4.css +1 -1
- package/test/css/namespacing/namespacing-functions.css +6 -0
- package/test/css/no-strict-math/mixins-guards.css +1 -1
- package/test/css/permissive-parse.css +1 -1
- package/test/css/plugin.css +9 -9
- package/test/css/postProcessorPlugin/postProcessor.css +2 -2
- package/test/css/preProcessorPlugin/preProcessor.css +1 -1
- package/test/css/selectors.css +2 -2
- package/test/css/variables.css +1 -1
- package/test/css/visitorPlugin/visitor.css +1 -1
- package/test/index.js +6 -0
- package/test/less/calc.less +17 -1
- package/test/less/comments.less +1 -1
- package/test/less/css-3.less +5 -5
- package/test/less/css-guards.less +2 -2
- package/test/less/debug/import/test.less +2 -2
- package/test/less/debug/linenumbers.less +3 -3
- package/test/less/errors/color-func-invalid-color.less +1 -1
- package/test/less/errors/color-func-invalid-color.txt +1 -1
- package/test/less/errors/invalid-color-with-comment.less +1 -0
- package/test/less/errors/invalid-color-with-comment.txt +2 -0
- package/test/less/errors/plugin-1.txt +2 -2
- package/test/less/errors/plugin-2.txt +1 -2
- package/test/less/errors/plugin-3.txt +1 -2
- package/test/less/errors/property-ie5-hack.less +1 -1
- package/test/less/extend-chaining.less +3 -3
- package/test/less/extend-media.less +1 -1
- package/test/less/extend-nest.less +1 -1
- package/test/less/filemanagerPlugin/filemanager.less +1 -1
- package/test/less/functions-each.less +1 -1
- package/test/less/import/import-reference.less +1 -1
- package/test/less/import/import-test-f.less +1 -1
- package/test/less/import/json/index.json +11 -0
- package/test/less/import/json/index.less +1 -0
- package/test/less/import-reference-issues/global-scope-import.less +2 -2
- package/test/less/import-reference-issues/global-scope-nested.less +1 -1
- package/test/less/import-reference-issues.less +2 -2
- package/test/less/import-reference.less +1 -1
- package/test/less/javascript.less +1 -1
- package/test/less/legacy/legacy.less +1 -1
- package/test/less/math/parens-division/mixins-args.less +4 -4
- package/test/less/math/parens-division/parens.less +1 -1
- package/test/less/math/strict/mixins-args.less +4 -4
- package/test/less/math/strict/parens.less +1 -1
- package/test/less/math/strict-legacy/mixins-args.less +4 -4
- package/test/less/math/strict-legacy/parens.less +1 -1
- package/test/less/media.less +9 -9
- package/test/less/merge.less +10 -10
- package/test/less/mixins-guards.less +8 -8
- package/test/less/mixins-important.less +3 -3
- package/test/less/mixins.less +2 -2
- package/test/less/namespacing/namespacing-3.less +25 -2
- package/test/less/namespacing/namespacing-4.less +1 -1
- package/test/less/namespacing/namespacing-5.less +2 -2
- package/test/less/namespacing/namespacing-functions.less +26 -0
- package/test/less/no-strict-math/mixins-guards.less +2 -2
- package/test/less/permissive-parse.less +1 -1
- package/test/less/plugin.less +9 -9
- package/test/less/postProcessorPlugin/postProcessor.less +2 -2
- package/test/less/preProcessorPlugin/preProcessor.less +1 -1
- package/test/less/selectors.less +1 -1
- package/test/less/sourcemaps/imported.css +1 -1
- package/test/less/variables.less +1 -1
- package/test/less/visitorPlugin/visitor.less +1 -1
- package/test/less-test.js +45 -11
- package/test/less.js +11 -0
- package/test/sourcemaps/custom-props.json +1 -1
- package/.DS_Store +0 -0
- package/test/.DS_Store +0 -0
- package/test/browser/less.min.js +0 -11
- package/test/browser/less.min.js.map +0 -1
- package/test/browser/onload.js +0 -13
- package/test/browser/test-runner-template.tmpl +0 -105
- package/test/browser/vendor/boot.js +0 -148
- package/test/browser/vendor/jasmine-jsreporter.js +0 -391
- package/test/browser/vendor/promise.js +0 -2
- package/test/css/.DS_Store +0 -0
- package/test/css/math/.DS_Store +0 -0
- package/test/less/.DS_Store +0 -0
- package/test/less/math/.DS_Store +0 -0
package/lib/less/contexts.js
CHANGED
|
@@ -26,7 +26,7 @@ export default environment => {
|
|
|
26
26
|
this.context = context;
|
|
27
27
|
// Deprecated? Unused outside of here, could be useful.
|
|
28
28
|
this.queue = []; // Files which haven't been imported yet
|
|
29
|
-
this.files =
|
|
29
|
+
this.files = []; // List of files imported
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -52,11 +52,9 @@ export default environment => {
|
|
|
52
52
|
logger.info(`The file ${fullPath} was skipped because it was not found and the import was marked optional.`);
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (!importManager.files[fullPath] && !importOptions.inline) {
|
|
59
|
-
importManager.files[fullPath] = { root, options: importOptions };
|
|
55
|
+
const files = importManager.files
|
|
56
|
+
if (files.indexOf(fullPath) === -1) {
|
|
57
|
+
files.push(fullPath)
|
|
60
58
|
}
|
|
61
59
|
if (e && !importManager.error) { importManager.error = e; }
|
|
62
60
|
callback(e, root, importedEqualsRoot, fullPath);
|
|
@@ -122,20 +120,9 @@ export default environment => {
|
|
|
122
120
|
} else if (importOptions.inline) {
|
|
123
121
|
fileParsedFunc(null, contents, resolvedFilename);
|
|
124
122
|
} else {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (importManager.files[resolvedFilename]
|
|
129
|
-
&& !importManager.files[resolvedFilename].options.multiple
|
|
130
|
-
&& !importOptions.multiple) {
|
|
131
|
-
|
|
132
|
-
fileParsedFunc(null, importManager.files[resolvedFilename].root, resolvedFilename);
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
new Parser(newEnv, importManager, newFileInfo).parse(contents, (e, root) => {
|
|
136
|
-
fileParsedFunc(e, root, resolvedFilename);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
123
|
+
new Parser(newEnv, importManager, newFileInfo).parse(contents, (e, root) => {
|
|
124
|
+
fileParsedFunc(e, root, resolvedFilename);
|
|
125
|
+
});
|
|
139
126
|
}
|
|
140
127
|
};
|
|
141
128
|
let promise;
|
package/lib/less/index.js
CHANGED
package/lib/less/less-error.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as utils from './utils';
|
|
2
|
+
|
|
3
|
+
const anonymousFunc = /(<anonymous>|Function):(\d+):(\d+)/;
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* This is a centralized class of any error that could be thrown internally (mostly by the parser).
|
|
4
7
|
* Besides standard .message it keeps some additional data like a path to the file where the error
|
|
@@ -44,11 +47,28 @@ const LessError = function LessError(e, fileContentMap, currentFilename) {
|
|
|
44
47
|
this.column = col;
|
|
45
48
|
|
|
46
49
|
if (!this.line && this.stack) {
|
|
47
|
-
const found = this.stack.match(
|
|
50
|
+
const found = this.stack.match(anonymousFunc);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* We have to figure out how this environment stringifies anonymous functions
|
|
54
|
+
* so we can correctly map plugin errors.
|
|
55
|
+
*
|
|
56
|
+
* Note, in Node 8, the output of anonymous funcs varied based on parameters
|
|
57
|
+
* being present or not, so we inject dummy params.
|
|
58
|
+
*/
|
|
59
|
+
const func = new Function('a', 'throw new Error()');
|
|
60
|
+
let lineAdjust = 0;
|
|
61
|
+
try {
|
|
62
|
+
func();
|
|
63
|
+
} catch (e) {
|
|
64
|
+
const match = e.stack.match(anonymousFunc);
|
|
65
|
+
const line = parseInt(match[2]);
|
|
66
|
+
lineAdjust = 1 - line;
|
|
67
|
+
}
|
|
48
68
|
|
|
49
69
|
if (found) {
|
|
50
70
|
if (found[2]) {
|
|
51
|
-
this.line = parseInt(found[2])
|
|
71
|
+
this.line = parseInt(found[2]) + lineAdjust;
|
|
52
72
|
}
|
|
53
73
|
if (found[3]) {
|
|
54
74
|
this.column = parseInt(found[3]);
|
package/lib/less/parse-tree.js
CHANGED
|
@@ -52,12 +52,8 @@ export default SourceMapBuilder => {
|
|
|
52
52
|
result.map = sourceMapBuilder.getExternalSourceMap();
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (this.imports.files.hasOwnProperty(file) && file !== this.imports.rootFilename) {
|
|
58
|
-
result.imports.push(file);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
55
|
+
const rootFilename = this.imports.rootFilename
|
|
56
|
+
result.imports = this.imports.files.filter(file => file !== rootFilename);
|
|
61
57
|
return result;
|
|
62
58
|
}
|
|
63
59
|
}
|
|
@@ -327,8 +327,8 @@ const Parser = function Parser(context, imports, fileInfo) {
|
|
|
327
327
|
continue;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
node = mixin.definition() || this.declaration() ||
|
|
331
|
-
|
|
330
|
+
node = mixin.definition() || this.declaration() || mixin.call(false, false) ||
|
|
331
|
+
this.ruleset() || this.variableCall() || this.entities.call() || this.atrule();
|
|
332
332
|
if (node) {
|
|
333
333
|
root.push(node);
|
|
334
334
|
} else {
|
|
@@ -766,7 +766,6 @@ const Parser = function Parser(context, imports, fileInfo) {
|
|
|
766
766
|
//
|
|
767
767
|
variableCall: function (parsedName) {
|
|
768
768
|
let lookups;
|
|
769
|
-
let important;
|
|
770
769
|
const i = parserInput.i;
|
|
771
770
|
const inValue = !!parsedName;
|
|
772
771
|
let name = parsedName;
|
|
@@ -787,10 +786,6 @@ const Parser = function Parser(context, imports, fileInfo) {
|
|
|
787
786
|
name = name[1];
|
|
788
787
|
}
|
|
789
788
|
|
|
790
|
-
if (lookups && parsers.important()) {
|
|
791
|
-
important = true;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
789
|
const call = new tree.VariableCall(name, i, fileInfo);
|
|
795
790
|
if (!inValue && parsers.end()) {
|
|
796
791
|
parserInput.forget();
|
|
@@ -798,7 +793,7 @@ const Parser = function Parser(context, imports, fileInfo) {
|
|
|
798
793
|
}
|
|
799
794
|
else {
|
|
800
795
|
parserInput.forget();
|
|
801
|
-
return new tree.NamespaceValue(call, lookups,
|
|
796
|
+
return new tree.NamespaceValue(call, lookups, i, fileInfo);
|
|
802
797
|
}
|
|
803
798
|
}
|
|
804
799
|
|
|
@@ -927,7 +922,7 @@ const Parser = function Parser(context, imports, fileInfo) {
|
|
|
927
922
|
parserInput.forget();
|
|
928
923
|
const mixin = new(tree.mixin.Call)(elements, args, index, fileInfo, !lookups && important);
|
|
929
924
|
if (lookups) {
|
|
930
|
-
return new tree.NamespaceValue(mixin, lookups
|
|
925
|
+
return new tree.NamespaceValue(mixin, lookups);
|
|
931
926
|
}
|
|
932
927
|
else {
|
|
933
928
|
return mixin;
|
|
@@ -1159,7 +1154,7 @@ const Parser = function Parser(context, imports, fileInfo) {
|
|
|
1159
1154
|
parserInput.restore();
|
|
1160
1155
|
}
|
|
1161
1156
|
} else {
|
|
1162
|
-
parserInput.
|
|
1157
|
+
parserInput.restore();
|
|
1163
1158
|
}
|
|
1164
1159
|
},
|
|
1165
1160
|
|
|
@@ -2326,6 +2321,11 @@ const Parser = function Parser(context, imports, fileInfo) {
|
|
|
2326
2321
|
continue;
|
|
2327
2322
|
}
|
|
2328
2323
|
e = this.addition() || this.entity();
|
|
2324
|
+
|
|
2325
|
+
if (e instanceof tree.Comment) {
|
|
2326
|
+
e = null;
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
2329
|
if (e) {
|
|
2330
2330
|
entities.push(e);
|
|
2331
2331
|
// operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here
|
|
@@ -16,9 +16,10 @@ const debugInfo = (context, ctx, lineSeparator) => {
|
|
|
16
16
|
return result;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
debugInfo.asComment = ctx => `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\n
|
|
19
|
+
debugInfo.asComment = ctx => ctx.debugInfo ? `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\n` : '';
|
|
20
20
|
|
|
21
21
|
debugInfo.asMediaQuery = ctx => {
|
|
22
|
+
if (!ctx.debugInfo) { return ''; }
|
|
22
23
|
let filenameWithProtocol = ctx.debugInfo.fileName;
|
|
23
24
|
if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
|
|
24
25
|
filenameWithProtocol = `file://${filenameWithProtocol}`;
|
|
@@ -4,12 +4,11 @@ import Ruleset from './ruleset';
|
|
|
4
4
|
import Selector from './selector';
|
|
5
5
|
|
|
6
6
|
class NamespaceValue extends Node {
|
|
7
|
-
constructor(ruleCall, lookups,
|
|
7
|
+
constructor(ruleCall, lookups, index, fileInfo) {
|
|
8
8
|
super();
|
|
9
9
|
|
|
10
10
|
this.value = ruleCall;
|
|
11
11
|
this.lookups = lookups;
|
|
12
|
-
this.important = important;
|
|
13
12
|
this._index = index;
|
|
14
13
|
this._fileInfo = fileInfo;
|
|
15
14
|
}
|
|
@@ -80,8 +80,16 @@ class Visitor {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
if (visitArgs.visitDeeper && node
|
|
84
|
-
node.
|
|
83
|
+
if (visitArgs.visitDeeper && node) {
|
|
84
|
+
if (node.length) {
|
|
85
|
+
for (var i = 0, cnt = node.length; i < cnt; i++) {
|
|
86
|
+
if (node[i].accept) {
|
|
87
|
+
node[i].accept(this);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
} else if (node.accept) {
|
|
91
|
+
node.accept(this);
|
|
92
|
+
}
|
|
85
93
|
}
|
|
86
94
|
|
|
87
95
|
if (funcOut != _noop) {
|
|
@@ -3,17 +3,11 @@ import fs from './fs';
|
|
|
3
3
|
import AbstractFileManager from '../less/environment/abstract-file-manager.js';
|
|
4
4
|
|
|
5
5
|
class FileManager extends AbstractFileManager {
|
|
6
|
-
|
|
7
|
-
super();
|
|
8
|
-
|
|
9
|
-
this.contents = {};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
supports(filename, currentDirectory, options, environment) {
|
|
6
|
+
supports() {
|
|
13
7
|
return true;
|
|
14
8
|
}
|
|
15
9
|
|
|
16
|
-
supportsSync(
|
|
10
|
+
supportsSync() {
|
|
17
11
|
return true;
|
|
18
12
|
}
|
|
19
13
|
|
|
@@ -107,55 +101,31 @@ class FileManager extends AbstractFileManager {
|
|
|
107
101
|
fullFilename = extFilename;
|
|
108
102
|
}
|
|
109
103
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
|
|
105
|
+
const readFileArgs = [fullFilename];
|
|
106
|
+
if (!options.rawBuffer) {
|
|
107
|
+
readFileArgs.push('utf-8');
|
|
108
|
+
}
|
|
109
|
+
if (options.syncImport) {
|
|
114
110
|
try {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
fulfill({ contents: self.contents[fullFilename].data, filename: fullFilename});
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
modified = true;
|
|
121
|
-
}
|
|
111
|
+
const data = fs.readFileSync.apply(this, readFileArgs);
|
|
112
|
+
fulfill({ contents: data, filename: fullFilename});
|
|
122
113
|
}
|
|
123
114
|
catch (e) {
|
|
124
|
-
|
|
115
|
+
filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename);
|
|
116
|
+
return tryPrefix(j + 1);
|
|
125
117
|
}
|
|
126
118
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
readFileArgs.push('utf-8');
|
|
131
|
-
}
|
|
132
|
-
if (options.syncImport) {
|
|
133
|
-
try {
|
|
134
|
-
const data = fs.readFileSync.apply(this, readFileArgs);
|
|
135
|
-
var stat = fs.statSync.apply(this, [fullFilename]);
|
|
136
|
-
self.contents[fullFilename] = { data, mtime: stat.mtime };
|
|
137
|
-
fulfill({ contents: data, filename: fullFilename});
|
|
138
|
-
}
|
|
139
|
-
catch (e) {
|
|
119
|
+
else {
|
|
120
|
+
readFileArgs.push(function(e, data) {
|
|
121
|
+
if (e) {
|
|
140
122
|
filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename);
|
|
141
123
|
return tryPrefix(j + 1);
|
|
142
124
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (e) {
|
|
147
|
-
filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename);
|
|
148
|
-
return tryPrefix(j + 1);
|
|
149
|
-
}
|
|
150
|
-
const stat = fs.statSync.apply(this, [fullFilename]);
|
|
151
|
-
self.contents[fullFilename] = { data, mtime: stat.mtime };
|
|
152
|
-
fulfill({ contents: data, filename: fullFilename});
|
|
153
|
-
});
|
|
154
|
-
fs.readFile.apply(this, readFileArgs);
|
|
155
|
-
}
|
|
156
|
-
|
|
125
|
+
fulfill({ contents: data, filename: fullFilename});
|
|
126
|
+
});
|
|
127
|
+
fs.readFile.apply(this, readFileArgs);
|
|
157
128
|
}
|
|
158
|
-
|
|
159
129
|
}
|
|
160
130
|
else {
|
|
161
131
|
tryPathIndex(i + 1);
|
|
@@ -174,4 +144,4 @@ class FileManager extends AbstractFileManager {
|
|
|
174
144
|
}
|
|
175
145
|
}
|
|
176
146
|
|
|
177
|
-
export default FileManager;
|
|
147
|
+
export default FileManager;
|
package/lib/lessc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import path from 'path';
|
|
1
|
+
import * as path from 'path';
|
|
2
2
|
import fs from './less-node/fs';
|
|
3
|
-
import os from 'os';
|
|
3
|
+
import * as os from 'os';
|
|
4
4
|
import * as utils from './less/utils';
|
|
5
5
|
import * as Constants from './less/constants';
|
|
6
6
|
let errno;
|
|
@@ -28,25 +28,6 @@ options.reUsePluginManager = true;
|
|
|
28
28
|
const sourceMapOptions = {};
|
|
29
29
|
let continueProcessing = true;
|
|
30
30
|
|
|
31
|
-
// Calling process.exit does not flush stdout always. Instead of exiting the process, we set the process' exitCode,
|
|
32
|
-
// close all handles and wait for the event loop to exit the process.
|
|
33
|
-
// @see https://github.com/nodejs/node/issues/6409
|
|
34
|
-
// Unfortunately, node 0.10.x does not support setting process.exitCode, so we need to call reallyExit() explicitly.
|
|
35
|
-
// @see https://nodejs.org/api/process.html#process_process_exitcode
|
|
36
|
-
// Additionally we also need to make sure that uncaughtExceptions are never swallowed.
|
|
37
|
-
// @see https://github.com/less/less.js/issues/2881
|
|
38
|
-
// This code can safely be removed if node 0.10.x is not supported anymore.
|
|
39
|
-
process.on('exit', () => { process.reallyExit(process.exitCode); });
|
|
40
|
-
process.on('uncaughtException', err => {
|
|
41
|
-
console.error(err);
|
|
42
|
-
process.exitCode = 1;
|
|
43
|
-
});
|
|
44
|
-
// This code will still be required because otherwise rejected promises would not be reported to the user
|
|
45
|
-
process.on('unhandledRejection', err => {
|
|
46
|
-
console.error(err);
|
|
47
|
-
process.exitCode = 1;
|
|
48
|
-
});
|
|
49
|
-
|
|
50
31
|
const checkArgFunc = (arg, option) => {
|
|
51
32
|
if (!option) {
|
|
52
33
|
console.error(`${arg} option requires a parameter`);
|
|
@@ -154,7 +135,7 @@ function render() {
|
|
|
154
135
|
const existsSync = fs.existsSync || path.existsSync;
|
|
155
136
|
if (!existsSync(dir)) {
|
|
156
137
|
if (mkdirp === undefined) {
|
|
157
|
-
try {mkdirp = require('
|
|
138
|
+
try {mkdirp = require('make-dir');}
|
|
158
139
|
catch (e) { mkdirp = null; }
|
|
159
140
|
}
|
|
160
141
|
cmd = mkdirp && mkdirp.sync || fs.mkdirSync;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "less",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.3",
|
|
4
4
|
"description": "Leaner CSS",
|
|
5
5
|
"homepage": "http://lesscss.org",
|
|
6
6
|
"author": {
|
|
@@ -36,55 +36,59 @@
|
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"test": "grunt test",
|
|
39
|
-
"grunt": "grunt"
|
|
39
|
+
"grunt": "grunt",
|
|
40
|
+
"changelog": "github-changes -o less -r less.js -a --only-pulls --use-commit-body -m \"(YYYY-MM-DD)\""
|
|
40
41
|
},
|
|
41
42
|
"optionalDependencies": {
|
|
42
43
|
"errno": "^0.1.1",
|
|
43
44
|
"graceful-fs": "^4.1.2",
|
|
44
45
|
"image-size": "~0.5.0",
|
|
46
|
+
"make-dir": "^2.1.0",
|
|
45
47
|
"mime": "^1.4.1",
|
|
46
|
-
"mkdirp": "^0.5.0",
|
|
47
48
|
"promise": "^7.1.1",
|
|
48
49
|
"request": "^2.83.0",
|
|
49
50
|
"source-map": "~0.6.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
55
|
-
"@babel/preset-env": "^7.5.5",
|
|
56
|
-
"@typescript-eslint/eslint-plugin": "^1.13.0",
|
|
57
|
-
"@typescript-eslint/parser": "^1.13.0",
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^2.3.3",
|
|
54
|
+
"@typescript-eslint/parser": "^2.3.3",
|
|
55
|
+
"benny": "^3.6.12",
|
|
58
56
|
"bootstrap-less-port": "0.3.0",
|
|
57
|
+
"chai": "^4.2.0",
|
|
59
58
|
"diff": "^3.2.0",
|
|
59
|
+
"fs-extra": "^8.1.0",
|
|
60
60
|
"git-rev": "^0.2.1",
|
|
61
|
+
"github-changes": "^1.1.2",
|
|
62
|
+
"globby": "^10.0.1",
|
|
61
63
|
"grunt": "^1.0.4",
|
|
62
64
|
"grunt-cli": "^1.3.2",
|
|
63
65
|
"grunt-contrib-clean": "^1.0.0",
|
|
64
66
|
"grunt-contrib-connect": "^1.0.2",
|
|
65
|
-
"grunt-contrib-jasmine": "^1.2.0",
|
|
66
67
|
"grunt-eslint": "^21.1.0",
|
|
67
|
-
"grunt-saucelabs": "^9.0.
|
|
68
|
+
"grunt-saucelabs": "^9.0.1",
|
|
68
69
|
"grunt-shell": "^1.3.0",
|
|
70
|
+
"html-template-tag": "^3.2.0",
|
|
69
71
|
"import-module": "file:test/import-module",
|
|
70
72
|
"jit-grunt": "^0.10.0",
|
|
71
73
|
"less-plugin-autoprefix": "^1.5.1",
|
|
72
74
|
"less-plugin-clean-css": "^1.5.1",
|
|
73
75
|
"minimist": "^1.2.0",
|
|
76
|
+
"mocha": "^6.2.1",
|
|
77
|
+
"mocha-headless-chrome": "^2.0.3",
|
|
78
|
+
"mocha-teamcity-reporter": "^3.0.0",
|
|
74
79
|
"performance-now": "^0.2.0",
|
|
75
|
-
"phantomjs-polyfill-object-assign": "0.0.2",
|
|
76
|
-
"phantomjs-prebuilt": "^2.1.16",
|
|
77
80
|
"phin": "^2.2.3",
|
|
78
81
|
"promise": "^7.1.1",
|
|
79
82
|
"read-glob": "^3.0.0",
|
|
80
83
|
"rollup": "^1.17.0",
|
|
81
|
-
"rollup-plugin-babel": "^4.3.3",
|
|
82
84
|
"rollup-plugin-commonjs": "^10.0.1",
|
|
83
85
|
"rollup-plugin-node-resolve": "^5.2.0",
|
|
84
86
|
"rollup-plugin-terser": "^5.1.1",
|
|
87
|
+
"rollup-plugin-typescript2": "^0.24.3",
|
|
85
88
|
"semver": "^6.3.0",
|
|
86
89
|
"time-grunt": "^1.3.0",
|
|
87
|
-
"
|
|
90
|
+
"ts-node": "^8.4.1",
|
|
91
|
+
"typescript": "^3.6.3",
|
|
88
92
|
"uikit": "2.27.4"
|
|
89
93
|
},
|
|
90
94
|
"keywords": [
|
|
@@ -115,6 +119,7 @@
|
|
|
115
119
|
"rawcurrent": "https://raw.github.com/less/less.js/v",
|
|
116
120
|
"sourcearchive": "https://github.com/less/less.js/archive/v",
|
|
117
121
|
"dependencies": {
|
|
118
|
-
"clone": "^2.1.2"
|
|
122
|
+
"clone": "^2.1.2",
|
|
123
|
+
"tslib": "^1.10.0"
|
|
119
124
|
}
|
|
120
125
|
}
|
package/test/browser/common.js
CHANGED
|
@@ -1,44 +1,3 @@
|
|
|
1
|
-
/* Add js reporter for sauce */
|
|
2
|
-
jasmine.getEnv().addReporter(new jasmine.JSReporter2());
|
|
3
|
-
jasmine.getEnv().defaultTimeoutInterval = 3000;
|
|
4
|
-
|
|
5
|
-
// From https://github.com/axemclion/grunt-saucelabs/issues/109#issuecomment-166767282
|
|
6
|
-
// (function () {
|
|
7
|
-
// var oldJSReport = window.jasmine.getJSReport;
|
|
8
|
-
// window.jasmine.getJSReport = function () {
|
|
9
|
-
// var results = oldJSReport();
|
|
10
|
-
// if (results) {
|
|
11
|
-
// return {
|
|
12
|
-
// durationSec: results.durationSec,
|
|
13
|
-
// suites: removePassingTests(results.suites),
|
|
14
|
-
// passed: results.passed
|
|
15
|
-
// };
|
|
16
|
-
// } else {
|
|
17
|
-
// return null;
|
|
18
|
-
// }
|
|
19
|
-
// };
|
|
20
|
-
|
|
21
|
-
// function removePassingTests (suites) {
|
|
22
|
-
// return suites.filter(specFailed)
|
|
23
|
-
// .map(mapSuite);
|
|
24
|
-
// }
|
|
25
|
-
|
|
26
|
-
// function mapSuite (suite) {
|
|
27
|
-
// var result = {};
|
|
28
|
-
// for (var s in suite) {
|
|
29
|
-
// result[s] = suite[s];
|
|
30
|
-
// }
|
|
31
|
-
// result.specs = suite.specs.filter(specFailed);
|
|
32
|
-
// result.suites = removePassingTests(suite.suites);
|
|
33
|
-
// return result;
|
|
34
|
-
// }
|
|
35
|
-
|
|
36
|
-
// function specFailed (item) {
|
|
37
|
-
// return !item.passed;
|
|
38
|
-
// }
|
|
39
|
-
// })();
|
|
40
|
-
/* record log messages for testing */
|
|
41
|
-
|
|
42
1
|
var logMessages = [];
|
|
43
2
|
window.less = window.less || {};
|
|
44
3
|
|
|
@@ -140,13 +99,15 @@ testSheet = function (sheet) {
|
|
|
140
99
|
window.navigator.userAgent.indexOf('Trident/') >= 0) {
|
|
141
100
|
text = ieFormat(text);
|
|
142
101
|
}
|
|
143
|
-
expect(lessOutput).
|
|
102
|
+
expect(lessOutput).to.equal(text);
|
|
144
103
|
done();
|
|
104
|
+
})
|
|
105
|
+
.catch(function(err) {
|
|
106
|
+
done(err);
|
|
145
107
|
});
|
|
146
108
|
})
|
|
147
109
|
.catch(function(err) {
|
|
148
|
-
|
|
149
|
-
done();
|
|
110
|
+
done(err);
|
|
150
111
|
});
|
|
151
112
|
});
|
|
152
113
|
};
|
|
@@ -213,11 +174,14 @@ testErrorSheet = function (sheet) {
|
|
|
213
174
|
.replace(/\{node\}[\s\S]*\{\/node\}/g, '')
|
|
214
175
|
.replace(/\n$/, '')
|
|
215
176
|
.trim();
|
|
216
|
-
expect(actualErrorMsg).
|
|
177
|
+
expect(actualErrorMsg).to.equal(errorTxt);
|
|
217
178
|
if (errorTxt == actualErrorMsg) {
|
|
218
179
|
actualErrorElement.style.display = 'none';
|
|
219
180
|
}
|
|
220
181
|
done();
|
|
182
|
+
})
|
|
183
|
+
.catch(function (err) {
|
|
184
|
+
done(err);
|
|
221
185
|
});
|
|
222
186
|
});
|
|
223
187
|
});
|
|
@@ -234,7 +198,7 @@ testErrorSheetConsole = function (sheet) {
|
|
|
234
198
|
.replace(/\nStack Trace\n[\s\S]*/, '');
|
|
235
199
|
|
|
236
200
|
describe('the error', function () {
|
|
237
|
-
expect(actualErrorElement).
|
|
201
|
+
expect(actualErrorElement).to.be.null;
|
|
238
202
|
});
|
|
239
203
|
|
|
240
204
|
errorFile
|
|
@@ -246,7 +210,7 @@ testErrorSheetConsole = function (sheet) {
|
|
|
246
210
|
.replace(/\{404status\}/g, ' (404)')
|
|
247
211
|
.replace(/\{node\}.*\{\/node\}/g, '')
|
|
248
212
|
.trim();
|
|
249
|
-
expect(actualErrorMsg).
|
|
213
|
+
expect(actualErrorMsg).to.equal(errorTxt);
|
|
250
214
|
done();
|
|
251
215
|
});
|
|
252
216
|
});
|
|
@@ -264,5 +228,3 @@ loadFile = function (href) {
|
|
|
264
228
|
request.send(null);
|
|
265
229
|
});
|
|
266
230
|
};
|
|
267
|
-
|
|
268
|
-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
module.exports = {
|
|
3
|
+
current: {
|
|
4
|
+
// src is used to build list of less files to compile
|
|
5
|
+
src: [
|
|
6
|
+
"benchmark/benchmark.less"
|
|
7
|
+
],
|
|
8
|
+
options: {
|
|
9
|
+
helpers: "benchmark/browseroptions.js",
|
|
10
|
+
specs: "benchmark/browserspec.js",
|
|
11
|
+
outfile: "tmp/browser/test-runner-benchmark-current.html"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
v3_10_3: {
|
|
15
|
+
// src is used to build list of less files to compile
|
|
16
|
+
src: [
|
|
17
|
+
"benchmark/benchmark.less"
|
|
18
|
+
],
|
|
19
|
+
options: {
|
|
20
|
+
helpers: "benchmark/browseroptions.js",
|
|
21
|
+
specs: "benchmark/browserspec.js",
|
|
22
|
+
outfile: "tmp/browser/test-runner-benchmark-v3_10_3.html",
|
|
23
|
+
less: "https://cdnjs.cloudflare.com/ajax/libs/less.js/3.10.3/less.min.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
v3_9_0: {
|
|
27
|
+
// src is used to build list of less files to compile
|
|
28
|
+
src: [
|
|
29
|
+
"benchmark/benchmark.less"
|
|
30
|
+
],
|
|
31
|
+
options: {
|
|
32
|
+
helpers: "benchmark/browseroptions.js",
|
|
33
|
+
specs: "benchmark/browserspec.js",
|
|
34
|
+
outfile: "tmp/browser/test-runner-benchmark-v3_9_0.html",
|
|
35
|
+
less: "https://cdnjs.cloudflare.com/ajax/libs/less.js/3.9.0/less.min.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
v2_7_3: {
|
|
39
|
+
// src is used to build list of less files to compile
|
|
40
|
+
src: [
|
|
41
|
+
"benchmark/benchmark.less"
|
|
42
|
+
],
|
|
43
|
+
options: {
|
|
44
|
+
helpers: "benchmark/browseroptions.js",
|
|
45
|
+
specs: "benchmark/browserspec.js",
|
|
46
|
+
outfile: "tmp/browser/test-runner-benchmark-v2_7_3.html",
|
|
47
|
+
less: "https://cdnjs.cloudflare.com/ajax/libs/less.js/2.7.3/less.min.js"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|