less 4.2.1 → 4.3.0
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/Gruntfile.js +0 -2
- package/LICENSE +177 -0
- package/bin/lessc +30 -23
- package/dist/less.js +731 -495
- package/dist/less.min.js +3 -3
- package/dist/less.min.js.map +1 -1
- package/lib/less/contexts.js +2 -1
- package/lib/less/contexts.js.map +1 -1
- package/lib/less/less-error.js +12 -8
- package/lib/less/less-error.js.map +1 -1
- package/lib/less/parser/parser.js +112 -22
- package/lib/less/parser/parser.js.map +1 -1
- package/lib/less/tree/atrule.js +121 -33
- package/lib/less/tree/atrule.js.map +1 -1
- package/lib/less/tree/extend.js +1 -0
- package/lib/less/tree/extend.js.map +1 -1
- package/lib/less/tree/nested-at-rule.js +4 -0
- package/lib/less/tree/nested-at-rule.js.map +1 -1
- package/lib/less/tree/query-in-parens.js +32 -1
- package/lib/less/tree/query-in-parens.js.map +1 -1
- package/lib/less/tree/quoted.js +4 -4
- package/lib/less/tree/quoted.js.map +1 -1
- package/lib/less/visitors/extend-visitor.js +6 -1
- package/lib/less/visitors/extend-visitor.js.map +1 -1
- package/lib/less/visitors/import-visitor.js +14 -1
- package/lib/less/visitors/import-visitor.js.map +1 -1
- package/lib/less/visitors/join-selector-visitor.js +4 -1
- package/lib/less/visitors/join-selector-visitor.js.map +1 -1
- package/lib/less-node/lessc-helper.js +1 -0
- package/lib/less-node/lessc-helper.js.map +1 -1
- package/package.json +138 -140
- package/test/browser/generator/generate.js +2 -2
- package/test/less-test.js +3 -1
- package/test/mocha-playwright/runner.js +210 -0
package/package.json
CHANGED
|
@@ -1,140 +1,138 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"gitHead": "1df9072ee9ebdadc791bf35dfb1dbc3ef9f1948f"
|
|
140
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "less",
|
|
3
|
+
"version": "4.3.0",
|
|
4
|
+
"description": "Leaner CSS",
|
|
5
|
+
"homepage": "http://lesscss.org",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Alexis Sellier",
|
|
8
|
+
"email": "self@cloudhead.net"
|
|
9
|
+
},
|
|
10
|
+
"contributors": [
|
|
11
|
+
"The Core Less Team"
|
|
12
|
+
],
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/less/less.js/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/less/less.js.git"
|
|
19
|
+
},
|
|
20
|
+
"master": {
|
|
21
|
+
"url": "https://github.com/less/less.js/blob/master/",
|
|
22
|
+
"raw": "https://raw.githubusercontent.com/less/less.js/master/"
|
|
23
|
+
},
|
|
24
|
+
"license": "Apache-2.0",
|
|
25
|
+
"bin": {
|
|
26
|
+
"lessc": "./bin/lessc"
|
|
27
|
+
},
|
|
28
|
+
"main": "index",
|
|
29
|
+
"module": "./lib/less-node/index",
|
|
30
|
+
"directories": {
|
|
31
|
+
"test": "./test"
|
|
32
|
+
},
|
|
33
|
+
"browser": "./dist/less.js",
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=14"
|
|
36
|
+
},
|
|
37
|
+
"optionalDependencies": {
|
|
38
|
+
"errno": "^0.1.1",
|
|
39
|
+
"graceful-fs": "^4.1.2",
|
|
40
|
+
"image-size": "~0.5.0",
|
|
41
|
+
"make-dir": "^2.1.0",
|
|
42
|
+
"mime": "^1.4.1",
|
|
43
|
+
"needle": "^3.1.0",
|
|
44
|
+
"source-map": "~0.6.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@rollup/plugin-commonjs": "^17.0.0",
|
|
48
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
49
|
+
"@rollup/plugin-node-resolve": "^11.0.0",
|
|
50
|
+
"@typescript-eslint/eslint-plugin": "^4.28.0",
|
|
51
|
+
"@typescript-eslint/parser": "^4.28.0",
|
|
52
|
+
"benny": "^3.6.12",
|
|
53
|
+
"bootstrap-less-port": "0.3.0",
|
|
54
|
+
"chai": "^4.2.0",
|
|
55
|
+
"cross-env": "^7.0.3",
|
|
56
|
+
"diff": "^3.2.0",
|
|
57
|
+
"eslint": "^7.29.0",
|
|
58
|
+
"fs-extra": "^8.1.0",
|
|
59
|
+
"git-rev": "^0.2.1",
|
|
60
|
+
"globby": "^10.0.1",
|
|
61
|
+
"grunt": "^1.0.4",
|
|
62
|
+
"grunt-cli": "^1.3.2",
|
|
63
|
+
"grunt-contrib-clean": "^1.0.0",
|
|
64
|
+
"grunt-contrib-connect": "^1.0.2",
|
|
65
|
+
"grunt-eslint": "^23.0.0",
|
|
66
|
+
"grunt-saucelabs": "^9.0.1",
|
|
67
|
+
"grunt-shell": "^1.3.0",
|
|
68
|
+
"html-template-tag": "^3.2.0",
|
|
69
|
+
"jit-grunt": "^0.10.0",
|
|
70
|
+
"less-plugin-autoprefix": "^1.5.1",
|
|
71
|
+
"less-plugin-clean-css": "^1.6.0",
|
|
72
|
+
"minimist": "^1.2.0",
|
|
73
|
+
"mocha": "^6.2.1",
|
|
74
|
+
"playwright": "1.50.1",
|
|
75
|
+
"mocha-teamcity-reporter": "^3.0.0",
|
|
76
|
+
"nock": "^11.8.2",
|
|
77
|
+
"npm-run-all": "^4.1.5",
|
|
78
|
+
"performance-now": "^0.2.0",
|
|
79
|
+
"phin": "^2.2.3",
|
|
80
|
+
"promise": "^7.1.1",
|
|
81
|
+
"read-glob": "^3.0.0",
|
|
82
|
+
"resolve": "^1.17.0",
|
|
83
|
+
"rollup": "^2.52.2",
|
|
84
|
+
"rollup-plugin-terser": "^5.1.1",
|
|
85
|
+
"rollup-plugin-typescript2": "^0.29.0",
|
|
86
|
+
"semver": "^6.3.0",
|
|
87
|
+
"shx": "^0.3.2",
|
|
88
|
+
"time-grunt": "^1.3.0",
|
|
89
|
+
"ts-node": "^10.9.1",
|
|
90
|
+
"typescript": "^4.3.4",
|
|
91
|
+
"uikit": "2.27.4",
|
|
92
|
+
"@less/test-data": "4.3.0",
|
|
93
|
+
"@less/test-import-module": "4.0.0"
|
|
94
|
+
},
|
|
95
|
+
"keywords": [
|
|
96
|
+
"compile less",
|
|
97
|
+
"css nesting",
|
|
98
|
+
"css variable",
|
|
99
|
+
"css",
|
|
100
|
+
"gradients css",
|
|
101
|
+
"gradients css3",
|
|
102
|
+
"less compiler",
|
|
103
|
+
"less css",
|
|
104
|
+
"less mixins",
|
|
105
|
+
"less",
|
|
106
|
+
"less.js",
|
|
107
|
+
"lesscss",
|
|
108
|
+
"mixins",
|
|
109
|
+
"nested css",
|
|
110
|
+
"parser",
|
|
111
|
+
"preprocessor",
|
|
112
|
+
"bootstrap css",
|
|
113
|
+
"bootstrap less",
|
|
114
|
+
"style",
|
|
115
|
+
"styles",
|
|
116
|
+
"stylesheet",
|
|
117
|
+
"variables in css",
|
|
118
|
+
"css less"
|
|
119
|
+
],
|
|
120
|
+
"rawcurrent": "https://raw.github.com/less/less.js/v",
|
|
121
|
+
"sourcearchive": "https://github.com/less/less.js/archive/v",
|
|
122
|
+
"dependencies": {
|
|
123
|
+
"copy-anything": "^2.0.1",
|
|
124
|
+
"parse-node-version": "^1.0.1",
|
|
125
|
+
"tslib": "^2.3.0"
|
|
126
|
+
},
|
|
127
|
+
"gitHead": "1df9072ee9ebdadc791bf35dfb1dbc3ef9f1948f",
|
|
128
|
+
"scripts": {
|
|
129
|
+
"test": "grunt test",
|
|
130
|
+
"grunt": "grunt",
|
|
131
|
+
"lint": "eslint '**/*.{ts,js}'",
|
|
132
|
+
"lint:fix": "eslint '**/*.{ts,js}' --fix",
|
|
133
|
+
"build": "npm-run-all clean compile",
|
|
134
|
+
"clean": "shx rm -rf ./lib tsconfig.tsbuildinfo",
|
|
135
|
+
"compile": "tsc -p tsconfig.build.json",
|
|
136
|
+
"dev": "tsc -p tsconfig.build.json -w"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -3,7 +3,7 @@ let config
|
|
|
3
3
|
const fs = require('fs-extra')
|
|
4
4
|
const path = require('path')
|
|
5
5
|
const globby = require('globby')
|
|
6
|
-
const { runner } = require('mocha-
|
|
6
|
+
const { runner } = require('../../mocha-playwright/runner')
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
if (process.argv[2]) {
|
|
@@ -57,7 +57,7 @@ Object.entries(config).forEach(entry => {
|
|
|
57
57
|
return runner({
|
|
58
58
|
file,
|
|
59
59
|
timeout: 3500,
|
|
60
|
-
args: ['disable-web-security']
|
|
60
|
+
args: ['disable-web-security', 'no-sandbox', 'disable-setuid-sandbox'],
|
|
61
61
|
})
|
|
62
62
|
})
|
|
63
63
|
})
|
package/test/less-test.js
CHANGED
|
@@ -12,7 +12,7 @@ logger.addListener({
|
|
|
12
12
|
warn(msg) {
|
|
13
13
|
process.stdout.write(msg + '\n');
|
|
14
14
|
},
|
|
15
|
-
|
|
15
|
+
error(msg) {
|
|
16
16
|
process.stdout.write(msg + '\n');
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -366,6 +366,8 @@ module.exports = function() {
|
|
|
366
366
|
|
|
367
367
|
var options = clone(originalOptions);
|
|
368
368
|
|
|
369
|
+
options.stylize = stylize;
|
|
370
|
+
|
|
369
371
|
var name = getBasename(file);
|
|
370
372
|
|
|
371
373
|
if (oneTestOnly && name !== oneTestOnly) {
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const util = require('util');
|
|
5
|
+
const { chromium } = require('playwright');
|
|
6
|
+
const TIMEOUT_MILLISECONDS = 60000;
|
|
7
|
+
|
|
8
|
+
function initMocha(reporter) {
|
|
9
|
+
|
|
10
|
+
console.log = (console => {
|
|
11
|
+
const log = console.log.bind(console);
|
|
12
|
+
return (...args) => args.length ? log(...args) : log('');
|
|
13
|
+
})(console);
|
|
14
|
+
|
|
15
|
+
function shimMochaInstance(m) {
|
|
16
|
+
|
|
17
|
+
const originalReporter = m.reporter.bind(m);
|
|
18
|
+
let reporterIsChanged = false;
|
|
19
|
+
|
|
20
|
+
m.reporter = (...args) => {
|
|
21
|
+
reporterIsChanged = true;
|
|
22
|
+
originalReporter(...args);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const run = m.run.bind(m);
|
|
26
|
+
|
|
27
|
+
m.run = () => {
|
|
28
|
+
const all = [], pending = [], failures = [], passes = [];
|
|
29
|
+
|
|
30
|
+
function error(err) {
|
|
31
|
+
if (!err) return {};
|
|
32
|
+
|
|
33
|
+
let res = {};
|
|
34
|
+
Object.getOwnPropertyNames(err).forEach(key => res[key] = err[key]);
|
|
35
|
+
return res;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function clean(test) {
|
|
39
|
+
return {
|
|
40
|
+
title: test.title,
|
|
41
|
+
fullTitle: test.fullTitle(),
|
|
42
|
+
duration: test.duration,
|
|
43
|
+
err: error(test.err)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function result(stats) {
|
|
48
|
+
return {
|
|
49
|
+
result: {
|
|
50
|
+
stats: {
|
|
51
|
+
tests: all.length,
|
|
52
|
+
passes: passes.length,
|
|
53
|
+
pending: pending.length,
|
|
54
|
+
failures: failures.length,
|
|
55
|
+
start: stats.start.toISOString(),
|
|
56
|
+
end: stats.end.toISOString(),
|
|
57
|
+
duration: stats.duration
|
|
58
|
+
},
|
|
59
|
+
tests: all.map(clean),
|
|
60
|
+
pending: pending.map(clean),
|
|
61
|
+
failures: failures.map(clean),
|
|
62
|
+
passes: passes.map(clean)
|
|
63
|
+
},
|
|
64
|
+
coverage: window.__coverage__
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function setResult() {
|
|
69
|
+
!window.__mochaResult__ && (window.__mochaResult__ = result(this.stats));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
!reporterIsChanged && m.setup({
|
|
73
|
+
reporter: Mocha.reporters[reporter] || Mocha.reporters.spec
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const runner = run(() => setTimeout(() => setResult.call(runner), 0))
|
|
77
|
+
.on('pass', test => { passes.push(test); all.push(test); })
|
|
78
|
+
.on('fail', test => { failures.push(test); all.push(test); })
|
|
79
|
+
.on('pending', test => { pending.push(test); all.push(test); })
|
|
80
|
+
.on('end', setResult);
|
|
81
|
+
|
|
82
|
+
return runner;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function shimMochaProcess(M) {
|
|
87
|
+
// Mocha needs a process.stdout.write in order to change the cursor position.
|
|
88
|
+
!M.process && (M.process = {});
|
|
89
|
+
!M.process.stdout && (M.process.stdout = {});
|
|
90
|
+
|
|
91
|
+
M.process.stdout.write = data => console.log('stdout:', data);
|
|
92
|
+
M.reporters.Base.useColors = true;
|
|
93
|
+
M.reporters.none = function None(runner) {
|
|
94
|
+
M.reporters.Base.call(this, runner);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
Object.defineProperty(window, 'mocha', {
|
|
99
|
+
get: function() { return undefined },
|
|
100
|
+
set: function(m) {
|
|
101
|
+
shimMochaInstance(m);
|
|
102
|
+
delete window.mocha;
|
|
103
|
+
window.mocha = m
|
|
104
|
+
},
|
|
105
|
+
configurable: true
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
Object.defineProperty(window, 'Mocha', {
|
|
109
|
+
get: function() { return undefined },
|
|
110
|
+
set: function(m) {
|
|
111
|
+
shimMochaProcess(m);
|
|
112
|
+
delete window.Mocha;
|
|
113
|
+
window.Mocha = m;
|
|
114
|
+
},
|
|
115
|
+
configurable: true
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function configureViewport(width, height, page) {
|
|
120
|
+
if (!width && !height) return page;
|
|
121
|
+
|
|
122
|
+
let viewport = page.viewport();
|
|
123
|
+
width && (viewport.width = width);
|
|
124
|
+
height && (viewport.height = height);
|
|
125
|
+
|
|
126
|
+
return page.setViewport(viewport).then(() => page);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function handleConsole(msg) {
|
|
130
|
+
const args = msg.args() || [];
|
|
131
|
+
|
|
132
|
+
Promise.all(args.map(a => a.jsonValue().catch(error => {
|
|
133
|
+
console.warn('Failed to retrieve JSON value from argument:', error);
|
|
134
|
+
return '';
|
|
135
|
+
})))
|
|
136
|
+
.then(args => {
|
|
137
|
+
// process stdout stub
|
|
138
|
+
let isStdout = args[0] === 'stdout:';
|
|
139
|
+
isStdout && (args = args.slice(1));
|
|
140
|
+
|
|
141
|
+
let msg = util.format(...args);
|
|
142
|
+
!isStdout && msg && (msg += '\n');
|
|
143
|
+
process.stdout.write(msg);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function prepareUrl(filePath) {
|
|
148
|
+
if (/^[a-zA-Z]+:\/\//.test(filePath)) {
|
|
149
|
+
// path is URL
|
|
150
|
+
return filePath;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// local path
|
|
154
|
+
let resolvedPath = path.resolve(filePath);
|
|
155
|
+
return `file://${resolvedPath}`;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
exports.runner = function ({ file, reporter, timeout, width, height, args, executablePath, visible, polling }) {
|
|
159
|
+
return new Promise(resolve => {
|
|
160
|
+
|
|
161
|
+
// validate options
|
|
162
|
+
if (!file) {
|
|
163
|
+
throw new Error('Test page path is required.');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
args = [].concat(args || []).map(arg => '--' + arg);
|
|
167
|
+
!timeout && (timeout = TIMEOUT_MILLISECONDS);
|
|
168
|
+
/^\d+$/.test(polling) && (polling = parseInt(polling));
|
|
169
|
+
|
|
170
|
+
const url = prepareUrl(file);
|
|
171
|
+
|
|
172
|
+
const options = {
|
|
173
|
+
ignoreHTTPSErrors: true,
|
|
174
|
+
headless: !visible,
|
|
175
|
+
executablePath,
|
|
176
|
+
args
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const result = chromium.launch(options)
|
|
180
|
+
.then(browser => browser.newContext()
|
|
181
|
+
.then(context => context.newPage()
|
|
182
|
+
.then(page => {
|
|
183
|
+
if (width || height) {
|
|
184
|
+
return page.setViewportSize({ width: width || 800, height: height || 600 }).then(() => page);
|
|
185
|
+
}
|
|
186
|
+
return page;
|
|
187
|
+
})
|
|
188
|
+
.then(page => {
|
|
189
|
+
page.on('console', handleConsole);
|
|
190
|
+
page.on('dialog', dialog => dialog.dismiss());
|
|
191
|
+
page.on('pageerror', err => console.error(err));
|
|
192
|
+
|
|
193
|
+
return page.addInitScript(initMocha, reporter)
|
|
194
|
+
.then(() => page.goto(url))
|
|
195
|
+
.then(() => page.waitForFunction(() => window.__mochaResult__, { timeout, polling }))
|
|
196
|
+
.then(() => page.evaluate(() => window.__mochaResult__))
|
|
197
|
+
.then(result => {
|
|
198
|
+
if (!result) {
|
|
199
|
+
throw new Error('Mocha results not found after waiting. The tests may not have run correctly.');
|
|
200
|
+
}
|
|
201
|
+
// Close browser before resolving result
|
|
202
|
+
return browser.close().then(() => result);
|
|
203
|
+
});
|
|
204
|
+
})
|
|
205
|
+
)
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
resolve(result);
|
|
209
|
+
});
|
|
210
|
+
};
|