less 4.1.0 → 4.1.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/.eslintignore +2 -1
- package/.eslintrc.json +70 -2
- package/Gruntfile.js +7 -11
- package/bin/lessc +19 -1
- package/dist/less.js +232 -146
- package/dist/less.min.js +3 -3
- package/dist/less.min.js.map +1 -1
- package/lib/less/functions/function-caller.js +5 -1
- package/lib/less/functions/function-caller.js.map +1 -1
- package/lib/less/functions/types.js +2 -1
- package/lib/less/functions/types.js.map +1 -1
- package/lib/less/parser/parser.js +24 -6
- package/lib/less/parser/parser.js.map +1 -1
- package/lib/less/tree/attribute.js +6 -2
- package/lib/less/tree/attribute.js.map +1 -1
- package/lib/less/tree/debug-info.js +30 -33
- package/lib/less/tree/debug-info.js.map +1 -1
- package/lib/less/tree/dimension.js +2 -1
- package/lib/less/tree/dimension.js.map +1 -1
- package/lib/less/tree/expression.js +0 -2
- package/lib/less/tree/expression.js.map +1 -1
- package/lib/less/tree/index.js +34 -7
- package/lib/less/tree/index.js.map +1 -1
- package/lib/less/tree/js-eval-node.js +4 -2
- package/lib/less/tree/js-eval-node.js.map +1 -1
- package/lib/less/tree/mixin-call.js +9 -3
- package/lib/less/tree/mixin-call.js.map +1 -1
- package/lib/less/tree/namespace-value.js +6 -2
- package/lib/less/tree/namespace-value.js.map +1 -1
- package/lib/less/tree/node.js +14 -7
- package/lib/less/tree/node.js.map +1 -1
- package/lib/less/tree/operation.js +3 -2
- package/lib/less/tree/operation.js.map +1 -1
- package/lib/less/tree/property.js +6 -2
- package/lib/less/tree/property.js.map +1 -1
- package/lib/less/tree/variable.js +6 -2
- package/lib/less/tree/variable.js.map +1 -1
- package/lib/less/visitors/to-css-visitor.js +4 -2
- package/lib/less/visitors/to-css-visitor.js.map +1 -1
- package/lib/less-browser/utils.js +3 -0
- package/lib/less-browser/utils.js.map +1 -1
- package/lib/less-node/image-size.js +0 -2
- package/lib/less-node/image-size.js.map +1 -1
- package/lib/less-node/index.js.map +1 -1
- package/lib/less-node/lessc-helper.js +1 -0
- package/lib/less-node/lessc-helper.js.map +1 -1
- package/lib/less-node/url-file-manager.js +3 -3
- package/lib/less-node/url-file-manager.js.map +1 -1
- package/package.json +11 -10
- package/test/index.js +3 -1
- package/test/less-test.js +45 -1
- package/tsconfig.json +5 -0
package/.eslintignore
CHANGED
package/.eslintrc.json
CHANGED
|
@@ -1,3 +1,71 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
2
|
+
"parser": "@typescript-eslint/parser",
|
|
3
|
+
"parserOptions": {
|
|
4
|
+
"ecmaVersion": 2018,
|
|
5
|
+
"sourceType": "module"
|
|
6
|
+
},
|
|
7
|
+
"plugins": ["@typescript-eslint"],
|
|
8
|
+
"env": {
|
|
9
|
+
"browser": true,
|
|
10
|
+
"node": true
|
|
11
|
+
},
|
|
12
|
+
"globals": {},
|
|
13
|
+
"rules": {
|
|
14
|
+
"no-eval": 2,
|
|
15
|
+
"no-use-before-define": [
|
|
16
|
+
2,
|
|
17
|
+
{
|
|
18
|
+
"functions": false
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"no-undef": 0,
|
|
22
|
+
"no-unused-vars": 1,
|
|
23
|
+
"no-caller": 2,
|
|
24
|
+
"no-eq-null": 1,
|
|
25
|
+
"guard-for-in": 2,
|
|
26
|
+
"no-implicit-coercion": [
|
|
27
|
+
2,
|
|
28
|
+
{
|
|
29
|
+
"boolean": false,
|
|
30
|
+
"string": true,
|
|
31
|
+
"number": true
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"no-with": 2,
|
|
35
|
+
"no-mixed-spaces-and-tabs": 2,
|
|
36
|
+
"no-multiple-empty-lines": 2,
|
|
37
|
+
"dot-location": [2, "property"],
|
|
38
|
+
"operator-linebreak": [0, "after"],
|
|
39
|
+
"keyword-spacing": [2, {}],
|
|
40
|
+
"space-unary-ops": [
|
|
41
|
+
2,
|
|
42
|
+
{
|
|
43
|
+
"words": false,
|
|
44
|
+
"nonwords": false
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"no-spaced-func": 2,
|
|
48
|
+
"space-before-function-paren": [
|
|
49
|
+
1,
|
|
50
|
+
{
|
|
51
|
+
"anonymous": "ignore",
|
|
52
|
+
"named": "never"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"comma-dangle": [2, "never"],
|
|
56
|
+
"no-trailing-spaces": 0,
|
|
57
|
+
"max-len": [2, 160],
|
|
58
|
+
"comma-style": [2, "last"],
|
|
59
|
+
"curly": [2, "all"],
|
|
60
|
+
"space-infix-ops": 2,
|
|
61
|
+
"spaced-comment": 1,
|
|
62
|
+
"space-before-blocks": [2, "always"],
|
|
63
|
+
"indent": [
|
|
64
|
+
2,
|
|
65
|
+
4,
|
|
66
|
+
{
|
|
67
|
+
"SwitchCase": 1
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
}
|
package/Gruntfile.js
CHANGED
|
@@ -12,7 +12,6 @@ module.exports = function(grunt) {
|
|
|
12
12
|
// Report the elapsed execution time of tasks.
|
|
13
13
|
require("time-grunt")(grunt);
|
|
14
14
|
|
|
15
|
-
var COMPRESS_FOR_TESTS = false;
|
|
16
15
|
var git = require("git-rev");
|
|
17
16
|
|
|
18
17
|
// Sauce Labs browser
|
|
@@ -184,17 +183,11 @@ module.exports = function(grunt) {
|
|
|
184
183
|
// Make the SauceLabs jobs
|
|
185
184
|
["all"].concat(browserTests).map(makeJob);
|
|
186
185
|
|
|
187
|
-
var semver = require('semver');
|
|
188
186
|
var path = require('path');
|
|
189
187
|
|
|
190
188
|
// Handle async / await in Rollup build for tests
|
|
191
|
-
// Remove this when Node 6 is no longer supported for the build/test process
|
|
192
|
-
const nodeVersion = semver.major(process.versions.node);
|
|
193
189
|
const tsNodeRuntime = path.resolve(path.join('node_modules', '.bin', 'ts-node'));
|
|
194
|
-
|
|
195
|
-
if (nodeVersion < 8) {
|
|
196
|
-
scriptRuntime = tsNodeRuntime;
|
|
197
|
-
}
|
|
190
|
+
const crossEnv = path.resolve(path.join('node_modules', '.bin', 'cross-env'));
|
|
198
191
|
|
|
199
192
|
// Project configuration.
|
|
200
193
|
grunt.initConfig({
|
|
@@ -209,7 +202,7 @@ module.exports = function(grunt) {
|
|
|
209
202
|
build: {
|
|
210
203
|
command: [
|
|
211
204
|
/** Browser runtime */
|
|
212
|
-
|
|
205
|
+
"node build/rollup.js --dist",
|
|
213
206
|
/** Copy to repo root */
|
|
214
207
|
"npm run copy:root",
|
|
215
208
|
/** Node.js runtime */
|
|
@@ -219,17 +212,19 @@ module.exports = function(grunt) {
|
|
|
219
212
|
testbuild: {
|
|
220
213
|
command: [
|
|
221
214
|
"npm run build",
|
|
222
|
-
|
|
215
|
+
"node build/rollup.js --browser --out=./tmp/browser/less.min.js"
|
|
223
216
|
].join(" && ")
|
|
224
217
|
},
|
|
225
218
|
testcjs: {
|
|
226
219
|
command: "npm run build"
|
|
227
220
|
},
|
|
228
221
|
testbrowser: {
|
|
229
|
-
command:
|
|
222
|
+
command: "node build/rollup.js --browser --out=./tmp/browser/less.min.js"
|
|
230
223
|
},
|
|
231
224
|
test: {
|
|
232
225
|
command: [
|
|
226
|
+
// https://github.com/TypeStrong/ts-node/issues/693#issuecomment-848907036
|
|
227
|
+
crossEnv + " TS_NODE_SCOPE=true",
|
|
233
228
|
tsNodeRuntime + " test/test-es6.ts",
|
|
234
229
|
"node test/index.js"
|
|
235
230
|
].join(' && ')
|
|
@@ -266,6 +261,7 @@ module.exports = function(grunt) {
|
|
|
266
261
|
`node bin/lessc --clean-css="--s1 --advanced" ${lessFolder}/_main/lazy-eval.less tmp/lazy-eval.css`,
|
|
267
262
|
"cd lib",
|
|
268
263
|
`node ../bin/lessc --clean-css="--s1 --advanced" ../${lessFolder}/_main/lazy-eval.less ../tmp/lazy-eval.css`,
|
|
264
|
+
`node ../bin/lessc --source-map=lazy-eval.css.map --autoprefix ../${lessFolder}/_main/lazy-eval.less ../tmp/lazy-eval.css`,
|
|
269
265
|
"cd ..",
|
|
270
266
|
// Test multiple plugins
|
|
271
267
|
`node bin/lessc --plugin=clean-css="--s1 --advanced" --plugin=autoprefix="ie 11,Edge >= 13,Chrome >= 47,Firefox >= 45,iOS >= 9.2,Safari >= 9" ${lessFolder}/_main/lazy-eval.less tmp/lazy-eval.css`
|
package/bin/lessc
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/* eslint indent: [2, 2, {"SwitchCase": 1}] */
|
|
4
|
+
|
|
2
5
|
"use strict";
|
|
3
6
|
|
|
4
7
|
var path = require('path');
|
|
@@ -87,6 +90,12 @@ function render() {
|
|
|
87
90
|
output = path.resolve(process.cwd(), output);
|
|
88
91
|
}
|
|
89
92
|
|
|
93
|
+
if (options.disablePluginRule && queuePlugins.length > 0) {
|
|
94
|
+
console.error('--plugin and --disable-plugin-rule may not be used at the same time');
|
|
95
|
+
process.exitCode = 1;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
90
99
|
if (options.sourceMap) {
|
|
91
100
|
sourceMapOptions.sourceMapInputFilename = input;
|
|
92
101
|
|
|
@@ -113,6 +122,7 @@ function render() {
|
|
|
113
122
|
var mapDir = path.dirname(mapFilename);
|
|
114
123
|
var outputDir = path.dirname(output); // find the path from the map to the output file
|
|
115
124
|
|
|
125
|
+
// eslint-disable-next-line max-len
|
|
116
126
|
sourceMapOptions.sourceMapOutputFilename = path.join(path.relative(mapDir, outputDir), path.basename(output)); // make the sourcemap filename point to the sourcemap relative to the css file output directory
|
|
117
127
|
|
|
118
128
|
sourceMapOptions.sourceMapFilename = path.join(path.relative(outputDir, mapDir), path.basename(sourceMapOptions.sourceMapFullFilename));
|
|
@@ -180,6 +190,9 @@ function render() {
|
|
|
180
190
|
var filename = sourceMapOptions.sourceMapFullFilename;
|
|
181
191
|
ensureDirectory(filename);
|
|
182
192
|
|
|
193
|
+
// To fix https://github.com/less/less.js/issues/3646
|
|
194
|
+
output = output.toString();
|
|
195
|
+
|
|
183
196
|
fs.writeFile(filename, output, 'utf8', function (err) {
|
|
184
197
|
if (err) {
|
|
185
198
|
var description = 'Error: ';
|
|
@@ -441,7 +454,8 @@ function processPluginQueue() {
|
|
|
441
454
|
break;
|
|
442
455
|
|
|
443
456
|
case 'no-js':
|
|
444
|
-
|
|
457
|
+
// eslint-disable-next-line max-len
|
|
458
|
+
console.error('The "--no-js" argument is deprecated, as inline JavaScript is disabled by default. Use "--js" to enable inline JavaScript (not recommended).');
|
|
445
459
|
break;
|
|
446
460
|
|
|
447
461
|
case 'include-path':
|
|
@@ -626,6 +640,10 @@ function processPluginQueue() {
|
|
|
626
640
|
});
|
|
627
641
|
break;
|
|
628
642
|
|
|
643
|
+
case 'disable-plugin-rule':
|
|
644
|
+
options.disablePluginRule = true;
|
|
645
|
+
break;
|
|
646
|
+
|
|
629
647
|
default:
|
|
630
648
|
queuePlugins.push({
|
|
631
649
|
name: arg,
|