less 3.0.0-pre.2 → 3.0.1
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/.eslintrc.json +88 -0
- package/.github/stale.yml +17 -0
- package/.project +17 -0
- package/.settings/org.eclipse.buildship.core.prefs +2 -0
- package/.travis.yml +22 -3
- package/.vscode/launch.json +14 -0
- package/CHANGELOG.md +27 -0
- package/Gruntfile.js +191 -86
- package/README.md +5 -7
- package/appveyor.yml +9 -10
- package/bin/lessc +37 -50
- package/dist/less.js +1357 -1269
- package/dist/less.min.js +7 -7
- package/lib/less/contexts.js +20 -16
- package/lib/less/default-options.js +65 -0
- package/lib/less/environment/abstract-file-manager.js +13 -14
- package/lib/less/environment/abstract-plugin-loader.js +45 -36
- package/lib/less/environment/environment.js +5 -0
- package/lib/less/functions/boolean.js +15 -0
- package/lib/less/functions/color.js +54 -24
- package/lib/less/functions/data-uri.js +5 -2
- package/lib/less/functions/function-registry.js +1 -1
- package/lib/less/functions/index.js +2 -1
- package/lib/less/functions/number.js +2 -2
- package/lib/less/functions/string.js +2 -2
- package/lib/less/functions/svg.js +4 -4
- package/lib/less/import-manager.js +41 -29
- package/lib/less/index.js +28 -3
- package/lib/less/less-error.js +112 -13
- package/lib/less/parse.js +18 -15
- package/lib/less/parser/parser-input.js +4 -4
- package/lib/less/parser/parser.js +208 -114
- package/lib/less/plugin-manager.js +8 -33
- package/lib/less/render.js +6 -2
- package/lib/less/source-map-builder.js +3 -0
- package/lib/less/source-map-output.js +13 -8
- package/lib/less/transform-tree.js +2 -2
- package/lib/less/tree/anonymous.js +4 -1
- package/lib/less/tree/atrule.js +7 -6
- package/lib/less/tree/call.js +25 -3
- package/lib/less/tree/color.js +2 -2
- package/lib/less/tree/debug-info.js +1 -1
- package/lib/less/tree/declaration.js +6 -5
- package/lib/less/tree/dimension.js +4 -1
- package/lib/less/tree/extend.js +2 -2
- package/lib/less/tree/import.js +17 -9
- package/lib/less/tree/index.js +3 -7
- package/lib/less/tree/js-eval-node.js +1 -1
- package/lib/less/tree/media.js +3 -14
- package/lib/less/tree/mixin-definition.js +3 -3
- package/lib/less/tree/node.js +9 -6
- package/lib/less/tree/operation.js +1 -1
- package/lib/less/tree/property.js +70 -0
- package/lib/less/tree/quoted.js +11 -10
- package/lib/less/tree/ruleset.js +115 -71
- package/lib/less/tree/selector.js +38 -23
- package/lib/less/tree/unit.js +1 -1
- package/lib/less/tree/value.js +6 -1
- package/lib/less/tree/{ruleset-call.js → variable-call.js} +5 -5
- package/lib/less/tree/variable.js +6 -6
- package/lib/less/utils.js +40 -0
- package/lib/less/visitors/extend-visitor.js +14 -14
- package/lib/less/visitors/import-visitor.js +2 -2
- package/lib/less/visitors/join-selector-visitor.js +1 -1
- package/lib/less/visitors/to-css-visitor.js +51 -84
- package/lib/less/visitors/visitor.js +15 -15
- package/lib/less-browser/bootstrap.js +21 -5
- package/lib/less-browser/cache.js +2 -2
- package/lib/less-browser/error-reporting.js +5 -5
- package/lib/less-browser/file-manager.js +27 -35
- package/lib/less-browser/index.js +12 -17
- package/lib/less-browser/plugin-loader.js +8 -45
- package/lib/less-browser/utils.js +1 -1
- package/lib/less-node/file-manager.js +99 -69
- package/lib/less-node/fs.js +1 -1
- package/lib/less-node/image-size.js +2 -2
- package/lib/less-node/index.js +7 -57
- package/lib/less-node/lessc-helper.js +38 -38
- package/lib/less-node/plugin-loader.js +18 -79
- package/lib/less-node/url-file-manager.js +1 -1
- package/lib/less-rhino/index.js +29 -44
- package/package.json +16 -9
- package/test/browser/common.js +54 -18
- package/test/browser/css/plugin/plugin.css +3 -0
- package/test/browser/jasmine-jsreporter.js +4 -4
- package/test/browser/less/plugin/plugin.js +7 -0
- package/test/browser/less/plugin/plugin.less +4 -0
- package/test/browser/less.js +11685 -13
- package/test/browser/runner-browser-options.js +6 -1
- package/test/browser/runner-filemanagerPlugin-options.js +3 -2
- package/test/browser/runner-legacy-options.js +2 -1
- package/test/browser/runner-main-options.js +0 -1
- package/test/browser/runner-modify-vars-spec.js +2 -2
- package/test/browser/test-runner-template.tmpl +38 -14
- package/test/copy-bom.js +1 -1
- package/test/css/calc.css +5 -0
- package/test/css/comments2.css +1 -1
- package/test/css/compression/compression.css +1 -1
- package/test/css/css-grid.css +11 -0
- package/test/css/debug/linenumbers-all.css +0 -1
- package/test/css/debug/linenumbers-comments.css +0 -1
- package/test/css/debug/linenumbers-mediaquery.css +0 -1
- package/test/css/functions.css +16 -3
- package/test/css/import-module.css +9 -0
- package/test/css/import.css +0 -1
- package/test/css/legacy/legacy.css +1 -1
- package/test/css/merge.css +5 -4
- package/test/css/plugin-module.css +1 -0
- package/test/css/plugin.css +20 -0
- package/test/css/property-accessors.css +49 -0
- package/test/css/{css.css → strict-math/css.css} +0 -0
- package/test/css/{mixins-args.css → strict-math/mixins-args.css} +0 -0
- package/test/css/{parens.css → strict-math/parens.css} +0 -0
- package/test/import-module/one/1.less +3 -0
- package/test/import-module/one/two/2.less +3 -0
- package/test/import-module/one/two/three/3.less +3 -0
- package/test/import-module/package.json +11 -0
- package/test/index.js +55 -49
- package/test/less/calc.less +7 -0
- package/test/less/css-grid.less +15 -0
- package/test/less/detached-rulesets.less +2 -2
- package/test/less/errors/color-invalid-hex-code.less +1 -0
- package/test/less/errors/color-invalid-hex-code.txt +1 -1
- package/test/less/errors/color-invalid-hex-code2.less +1 -0
- package/test/less/errors/color-invalid-hex-code2.txt +1 -1
- package/test/less/errors/import-missing.txt +1 -1
- package/test/less/errors/plugin/plugin-error-2.js +5 -0
- package/test/less/errors/plugin/plugin-error-3.js +5 -0
- package/test/less/errors/plugin/plugin-error.js +1 -0
- package/test/less/errors/plugin-1.less +1 -0
- package/test/less/errors/plugin-1.txt +2 -0
- package/test/less/errors/plugin-2.less +1 -0
- package/test/less/errors/plugin-2.txt +5 -0
- package/test/less/errors/plugin-3.less +1 -0
- package/test/less/errors/plugin-3.txt +5 -0
- package/test/less/functions.less +18 -0
- package/test/less/import-module.less +3 -0
- package/test/less/import.less +0 -2
- package/test/less/legacy/legacy.less +1 -1
- package/test/less/media.less +2 -2
- package/test/less/merge.less +6 -3
- package/test/less/plugin/plugin-collection.js +9 -0
- package/test/less/plugin/plugin-local.js +2 -2
- package/test/less/plugin/plugin-scope1.js +3 -0
- package/test/less/plugin/plugin-scope2.js +3 -0
- package/test/less/plugin/plugin-simple.js +7 -0
- package/test/less/plugin/plugin-tree-nodes.js +33 -31
- package/test/less/plugin-module.less +7 -0
- package/test/less/plugin.less +33 -3
- package/test/less/property-accessors.less +67 -0
- package/test/less/root-registry/file.less +1 -0
- package/test/less/root-registry/root.less +3 -0
- package/test/less/{css.less → strict-math/css.less} +0 -0
- package/test/less/{mixins-args.less → strict-math/mixins-args.less} +0 -0
- package/test/less/{parens.less → strict-math/parens.less} +0 -0
- package/test/less-bom/calc.less +7 -0
- package/test/less-bom/css-grid.less +15 -0
- package/test/less-bom/detached-rulesets.less +2 -2
- package/test/less-bom/errors/color-invalid-hex-code.less +1 -0
- package/test/less-bom/errors/color-invalid-hex-code.txt +1 -1
- package/test/less-bom/errors/color-invalid-hex-code2.less +1 -0
- package/test/less-bom/errors/color-invalid-hex-code2.txt +1 -1
- package/test/less-bom/errors/import-missing.txt +1 -1
- package/test/less-bom/errors/plugin/plugin-error-2.js +5 -0
- package/test/less-bom/errors/plugin/plugin-error-3.js +5 -0
- package/test/less-bom/errors/plugin/plugin-error.js +1 -0
- package/test/less-bom/errors/plugin-1.less +1 -0
- package/test/less-bom/errors/plugin-1.txt +2 -0
- package/test/less-bom/errors/plugin-2.less +1 -0
- package/test/less-bom/errors/plugin-2.txt +5 -0
- package/test/less-bom/errors/plugin-3.less +1 -0
- package/test/less-bom/errors/plugin-3.txt +5 -0
- package/test/less-bom/functions.less +18 -0
- package/test/less-bom/import-module.less +3 -0
- package/test/less-bom/import.less +0 -2
- package/test/less-bom/legacy/legacy.less +1 -1
- package/test/less-bom/media.less +2 -2
- package/test/less-bom/merge.less +6 -3
- package/test/less-bom/plugin/plugin-collection.js +9 -0
- package/test/less-bom/plugin/plugin-local.js +2 -2
- package/test/less-bom/plugin/plugin-scope1.js +3 -0
- package/test/less-bom/plugin/plugin-scope2.js +3 -0
- package/test/less-bom/plugin/plugin-simple.js +7 -0
- package/test/less-bom/plugin/plugin-tree-nodes.js +33 -31
- package/test/less-bom/plugin-module.less +7 -0
- package/test/less-bom/plugin.less +33 -3
- package/test/less-bom/property-accessors.less +67 -0
- package/test/less-bom/root-registry/file.less +1 -0
- package/test/less-bom/root-registry/root.less +3 -0
- package/test/less-bom/{css.less → strict-math/css.less} +0 -0
- package/test/less-bom/{mixins-args.less → strict-math/mixins-args.less} +0 -0
- package/test/less-bom/{parens.less → strict-math/parens.less} +0 -0
- package/test/less-test.js +75 -17
- package/test/modify-vars.js +1 -1
- package/test/plugins/visitor/index.js +1 -1
- package/.jscsrc +0 -73
- package/.jshintrc +0 -11
- package/lib/less/tree/alpha.js +0 -28
- package/lib/less/tree/directive.js +0 -12
- package/lib/less/tree/rule.js +0 -12
- package/test/less/errors/functions-2-alpha.less +0 -2
- package/test/less/errors/functions-2-alpha.txt +0 -3
- package/test/less-bom/errors/functions-2-alpha.less +0 -2
- package/test/less-bom/errors/functions-2-alpha.txt +0 -3
- package/test/sourcemaps/maps/import-map.map +0 -1
package/bin/lessc
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var path = require('path'),
|
|
4
4
|
fs = require('../lib/less-node/fs'),
|
|
5
5
|
os = require("os"),
|
|
6
|
+
utils = require('../lib/less/utils'),
|
|
6
7
|
errno,
|
|
7
8
|
mkdirp;
|
|
8
9
|
|
|
@@ -13,43 +14,17 @@ try {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
var less = require('../lib/less-node'),
|
|
16
|
-
|
|
17
|
+
pluginManager = new less.PluginManager(less),
|
|
18
|
+
fileManager = new less.FileManager(),
|
|
17
19
|
plugins = [],
|
|
18
20
|
queuePlugins = [],
|
|
19
21
|
args = process.argv.slice(1),
|
|
20
22
|
silent = false,
|
|
21
23
|
verbose = false,
|
|
22
|
-
options = {
|
|
23
|
-
depends: false,
|
|
24
|
-
compress: false,
|
|
25
|
-
max_line_len: -1,
|
|
26
|
-
lint: false,
|
|
27
|
-
paths: [],
|
|
28
|
-
color: true,
|
|
29
|
-
strictImports: false,
|
|
30
|
-
insecure: false,
|
|
31
|
-
rootpath: '',
|
|
32
|
-
relativeUrls: false,
|
|
33
|
-
ieCompat: true,
|
|
34
|
-
strictMath: false,
|
|
35
|
-
strictUnits: false,
|
|
36
|
-
globalVars: null,
|
|
37
|
-
modifyVars: null,
|
|
38
|
-
urlArgs: '',
|
|
39
|
-
plugins: plugins
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
if (less.options) {
|
|
43
|
-
for (var i = 0, keys = Object.keys(options); i < keys.length; i++) {
|
|
44
|
-
if (!less.options[keys[i]]) {
|
|
45
|
-
less.options[keys[i]] = options[keys[i]];
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
24
|
options = less.options;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
25
|
+
|
|
26
|
+
options.plugins = plugins;
|
|
27
|
+
options.reUsePluginManager = true;
|
|
53
28
|
|
|
54
29
|
var sourceMapOptions = {};
|
|
55
30
|
var continueProcessing = true;
|
|
@@ -103,7 +78,7 @@ var sourceMapFileInline = false;
|
|
|
103
78
|
|
|
104
79
|
function printUsage() {
|
|
105
80
|
less.lesscHelper.printUsage();
|
|
106
|
-
|
|
81
|
+
pluginManager.Loader.printUsage(plugins);
|
|
107
82
|
continueProcessing = false;
|
|
108
83
|
}
|
|
109
84
|
function render() {
|
|
@@ -133,10 +108,14 @@ function render() {
|
|
|
133
108
|
return;
|
|
134
109
|
}
|
|
135
110
|
// its in the same directory, so always just the basename
|
|
136
|
-
|
|
137
|
-
|
|
111
|
+
if (output) {
|
|
112
|
+
sourceMapOptions.sourceMapOutputFilename = path.basename(output);
|
|
113
|
+
sourceMapOptions.sourceMapFullFilename = output + ".map";
|
|
114
|
+
}
|
|
138
115
|
// its in the same directory, so always just the basename
|
|
139
|
-
|
|
116
|
+
if ('sourceMapFullFilename' in sourceMapOptions) {
|
|
117
|
+
sourceMapOptions.sourceMapFilename = path.basename(sourceMapOptions.sourceMapFullFilename);
|
|
118
|
+
}
|
|
140
119
|
} else if (options.sourceMap && !sourceMapFileInline) {
|
|
141
120
|
var mapFilename = path.resolve(process.cwd(), sourceMapOptions.sourceMapFullFilename),
|
|
142
121
|
mapDir = path.dirname(mapFilename),
|
|
@@ -156,12 +135,13 @@ function render() {
|
|
|
156
135
|
}
|
|
157
136
|
|
|
158
137
|
if (sourceMapOptions.sourceMapRootpath === undefined) {
|
|
159
|
-
var pathToMap = path.dirname(sourceMapFileInline ? output : sourceMapOptions.sourceMapFullFilename || '.'),
|
|
138
|
+
var pathToMap = path.dirname((sourceMapFileInline ? output : sourceMapOptions.sourceMapFullFilename) || '.'),
|
|
160
139
|
pathToInput = path.dirname(sourceMapOptions.sourceMapInputFilename || '.');
|
|
161
140
|
sourceMapOptions.sourceMapRootpath = path.relative(pathToMap, pathToInput);
|
|
162
141
|
}
|
|
163
142
|
|
|
164
|
-
|
|
143
|
+
|
|
144
|
+
if (!input) {
|
|
165
145
|
console.error("lessc: no input files");
|
|
166
146
|
console.error("");
|
|
167
147
|
printUsage();
|
|
@@ -176,7 +156,7 @@ function render() {
|
|
|
176
156
|
if (!existsSync(dir)) {
|
|
177
157
|
if (mkdirp === undefined) {
|
|
178
158
|
try {mkdirp = require('mkdirp');}
|
|
179
|
-
catch(e) { mkdirp = null; }
|
|
159
|
+
catch (e) { mkdirp = null; }
|
|
180
160
|
}
|
|
181
161
|
cmd = mkdirp && mkdirp.sync || fs.mkdirSync;
|
|
182
162
|
cmd(dir);
|
|
@@ -310,7 +290,11 @@ function render() {
|
|
|
310
290
|
}
|
|
311
291
|
},
|
|
312
292
|
function(err) {
|
|
313
|
-
|
|
293
|
+
if (!options.silent) {
|
|
294
|
+
console.error(err.toString({
|
|
295
|
+
stylize: options.color && less.lesscHelper.stylize
|
|
296
|
+
}));
|
|
297
|
+
}
|
|
314
298
|
process.exitCode = 1;
|
|
315
299
|
});
|
|
316
300
|
};
|
|
@@ -348,18 +332,18 @@ function processPluginQueue() {
|
|
|
348
332
|
}
|
|
349
333
|
}
|
|
350
334
|
queuePlugins.forEach(function(queue) {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
335
|
+
var context = utils.clone(options);
|
|
336
|
+
pluginManager.Loader.loadPlugin(queue.name, process.cwd(), context, less.environment, fileManager)
|
|
337
|
+
.then(function(data) {
|
|
356
338
|
pluginFinished({
|
|
357
339
|
fileContent: data.contents,
|
|
358
340
|
filename: data.filename,
|
|
359
341
|
options: queue.options
|
|
360
342
|
});
|
|
361
|
-
}
|
|
362
|
-
|
|
343
|
+
})
|
|
344
|
+
.catch(function() {
|
|
345
|
+
pluginError(queue.name);
|
|
346
|
+
});
|
|
363
347
|
});
|
|
364
348
|
}
|
|
365
349
|
|
|
@@ -427,14 +411,15 @@ function processPluginQueue() {
|
|
|
427
411
|
case 'no-color':
|
|
428
412
|
options.color = false;
|
|
429
413
|
break;
|
|
430
|
-
case '
|
|
431
|
-
options.ieCompat =
|
|
414
|
+
case 'ie-compat':
|
|
415
|
+
options.ieCompat = true;
|
|
432
416
|
break;
|
|
433
|
-
case '
|
|
417
|
+
case 'js':
|
|
434
418
|
options.javascriptEnabled = true;
|
|
435
419
|
break;
|
|
436
420
|
case 'no-js':
|
|
437
|
-
console.error('The "--no-js" argument is deprecated
|
|
421
|
+
console.error('The "--no-js" argument is deprecated, as inline JavaScript ' +
|
|
422
|
+
'is disabled by default. Use "--js" to enable inline JavaScript (not recommended).');
|
|
438
423
|
break;
|
|
439
424
|
case 'include-path':
|
|
440
425
|
if (checkArgFunc(arg, match[2])) {
|
|
@@ -470,10 +455,12 @@ function processPluginQueue() {
|
|
|
470
455
|
sourceMapOptions.sourceMapBasepath = match[2];
|
|
471
456
|
}
|
|
472
457
|
break;
|
|
458
|
+
case 'source-map-inline':
|
|
473
459
|
case 'source-map-map-inline':
|
|
474
460
|
sourceMapFileInline = true;
|
|
475
461
|
options.sourceMap = true;
|
|
476
462
|
break;
|
|
463
|
+
case 'source-map-include-source':
|
|
477
464
|
case 'source-map-less-inline':
|
|
478
465
|
sourceMapOptions.outputSourceFiles = true;
|
|
479
466
|
break;
|