less 2.6.1 → 2.7.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.
Files changed (135) hide show
  1. package/.travis.yml +3 -2
  2. package/CHANGELOG.md +26 -1
  3. package/Gruntfile.js +2 -3
  4. package/README.md +1 -1
  5. package/appveyor.yml +1 -0
  6. package/bin/lessc +47 -23
  7. package/dist/less.js +678 -374
  8. package/dist/less.min.js +9 -13
  9. package/lib/less/environment/abstract-file-manager.js +2 -2
  10. package/lib/less/functions/color.js +1 -1
  11. package/lib/less/index.js +1 -1
  12. package/lib/less/parser/parser-input.js +2 -2
  13. package/lib/less/parser/parser.js +45 -13
  14. package/lib/less/tree/anonymous.js +1 -1
  15. package/lib/less/tree/call.js +7 -4
  16. package/lib/less/tree/comment.js +2 -0
  17. package/lib/less/tree/directive.js +1 -0
  18. package/lib/less/tree/extend.js +1 -0
  19. package/lib/less/tree/import.js +1 -0
  20. package/lib/less/tree/media.js +1 -0
  21. package/lib/less/tree/mixin-call.js +1 -0
  22. package/lib/less/tree/mixin-definition.js +1 -0
  23. package/lib/less/tree/rule.js +1 -0
  24. package/lib/less/tree/ruleset-call.js +1 -0
  25. package/lib/less/tree/ruleset.js +1 -0
  26. package/lib/less/visitors/extend-visitor.js +5 -5
  27. package/lib/less/visitors/to-css-visitor.js +20 -10
  28. package/lib/less-browser/index.js +48 -25
  29. package/lib/less-node/file-manager.js +1 -1
  30. package/lib/less-node/lessc-helper.js +2 -2
  31. package/lib/source-map/source-map-0.1.31.js +1 -1
  32. package/package.json +25 -18
  33. package/test/browser/common.js +29 -8
  34. package/test/browser/less/console-errors/test-error.txt +1 -1
  35. package/test/browser/less.js +13 -17
  36. package/test/browser/runner-production-options.js +1 -1
  37. package/test/css/no-strict-math/no-sm-operations.css +3 -0
  38. package/test/css/operations.css +1 -1
  39. package/test/css/plugin.css +5 -0
  40. package/test/less/comments.less +1 -1
  41. package/test/less/errors/detached-ruleset-3.txt +1 -1
  42. package/test/less/errors/functions-1.less +2 -0
  43. package/test/less/errors/functions-1.txt +3 -0
  44. package/test/less/errors/functions-10-keyword.less +2 -0
  45. package/test/less/errors/functions-10-keyword.txt +3 -0
  46. package/test/less/errors/functions-11-operation.less +2 -0
  47. package/test/less/errors/functions-11-operation.txt +3 -0
  48. package/test/less/errors/functions-12-quoted.less +2 -0
  49. package/test/less/errors/functions-12-quoted.txt +3 -0
  50. package/test/less/errors/functions-13-selector.less +2 -0
  51. package/test/less/errors/functions-13-selector.txt +3 -0
  52. package/test/less/errors/functions-14-url.less +2 -0
  53. package/test/less/errors/functions-14-url.txt +3 -0
  54. package/test/less/errors/functions-15-value.less +2 -0
  55. package/test/less/errors/functions-15-value.txt +3 -0
  56. package/test/less/errors/functions-2-alpha.less +2 -0
  57. package/test/less/errors/functions-2-alpha.txt +3 -0
  58. package/test/less/errors/functions-3-assignment.less +2 -0
  59. package/test/less/errors/functions-3-assignment.txt +3 -0
  60. package/test/less/errors/functions-4-call.less +2 -0
  61. package/test/less/errors/functions-4-call.txt +3 -0
  62. package/test/less/errors/functions-5-color-2.less +1 -0
  63. package/test/less/errors/functions-5-color-2.txt +2 -0
  64. package/test/less/errors/functions-5-color.less +2 -0
  65. package/test/less/errors/functions-5-color.txt +3 -0
  66. package/test/less/errors/functions-6-condition.less +2 -0
  67. package/test/less/errors/functions-6-condition.txt +3 -0
  68. package/test/less/errors/functions-7-dimension.less +2 -0
  69. package/test/less/errors/functions-7-dimension.txt +3 -0
  70. package/test/less/errors/functions-8-element.less +2 -0
  71. package/test/less/errors/functions-8-element.txt +3 -0
  72. package/test/less/errors/functions-9-expression.less +2 -0
  73. package/test/less/errors/functions-9-expression.txt +3 -0
  74. package/test/less/errors/property-in-root.txt +1 -1
  75. package/test/less/errors/property-in-root2.txt +1 -1
  76. package/test/less/errors/property-in-root3.txt +1 -1
  77. package/test/less/errors/root-func-undefined-1.less +1 -0
  78. package/test/less/errors/root-func-undefined-1.txt +2 -0
  79. package/test/less/errors/root-func-undefined-2.less +2 -0
  80. package/test/less/errors/root-func-undefined-2.txt +3 -0
  81. package/test/less/extend-chaining.less +1 -1
  82. package/test/less/merge.less +4 -4
  83. package/test/less/mixins-guards.less +1 -1
  84. package/test/less/no-strict-math/no-sm-operations.less +4 -1
  85. package/test/less/operations.less +1 -1
  86. package/test/less/plugin/plugin-tree-nodes.js +80 -0
  87. package/test/less/plugin.less +8 -0
  88. package/test/less-bom/comments.less +1 -1
  89. package/test/less-bom/errors/detached-ruleset-3.txt +1 -1
  90. package/test/less-bom/errors/functions-1.less +2 -0
  91. package/test/less-bom/errors/functions-1.txt +3 -0
  92. package/test/less-bom/errors/functions-10-keyword.less +2 -0
  93. package/test/less-bom/errors/functions-10-keyword.txt +3 -0
  94. package/test/less-bom/errors/functions-11-operation.less +2 -0
  95. package/test/less-bom/errors/functions-11-operation.txt +3 -0
  96. package/test/less-bom/errors/functions-12-quoted.less +2 -0
  97. package/test/less-bom/errors/functions-12-quoted.txt +3 -0
  98. package/test/less-bom/errors/functions-13-selector.less +2 -0
  99. package/test/less-bom/errors/functions-13-selector.txt +3 -0
  100. package/test/less-bom/errors/functions-14-url.less +2 -0
  101. package/test/less-bom/errors/functions-14-url.txt +3 -0
  102. package/test/less-bom/errors/functions-15-value.less +2 -0
  103. package/test/less-bom/errors/functions-15-value.txt +3 -0
  104. package/test/less-bom/errors/functions-2-alpha.less +2 -0
  105. package/test/less-bom/errors/functions-2-alpha.txt +3 -0
  106. package/test/less-bom/errors/functions-3-assignment.less +2 -0
  107. package/test/less-bom/errors/functions-3-assignment.txt +3 -0
  108. package/test/less-bom/errors/functions-4-call.less +2 -0
  109. package/test/less-bom/errors/functions-4-call.txt +3 -0
  110. package/test/less-bom/errors/functions-5-color-2.less +1 -0
  111. package/test/less-bom/errors/functions-5-color-2.txt +2 -0
  112. package/test/less-bom/errors/functions-5-color.less +2 -0
  113. package/test/less-bom/errors/functions-5-color.txt +3 -0
  114. package/test/less-bom/errors/functions-6-condition.less +2 -0
  115. package/test/less-bom/errors/functions-6-condition.txt +3 -0
  116. package/test/less-bom/errors/functions-7-dimension.less +2 -0
  117. package/test/less-bom/errors/functions-7-dimension.txt +3 -0
  118. package/test/less-bom/errors/functions-8-element.less +2 -0
  119. package/test/less-bom/errors/functions-8-element.txt +3 -0
  120. package/test/less-bom/errors/functions-9-expression.less +2 -0
  121. package/test/less-bom/errors/functions-9-expression.txt +3 -0
  122. package/test/less-bom/errors/property-in-root.txt +1 -1
  123. package/test/less-bom/errors/property-in-root2.txt +1 -1
  124. package/test/less-bom/errors/property-in-root3.txt +1 -1
  125. package/test/less-bom/errors/root-func-undefined-1.less +1 -0
  126. package/test/less-bom/errors/root-func-undefined-1.txt +2 -0
  127. package/test/less-bom/errors/root-func-undefined-2.less +2 -0
  128. package/test/less-bom/errors/root-func-undefined-2.txt +3 -0
  129. package/test/less-bom/extend-chaining.less +1 -1
  130. package/test/less-bom/merge.less +4 -4
  131. package/test/less-bom/mixins-guards.less +1 -1
  132. package/test/less-bom/no-strict-math/no-sm-operations.less +4 -1
  133. package/test/less-bom/operations.less +1 -1
  134. package/test/less-bom/plugin/plugin-tree-nodes.js +80 -0
  135. package/test/less-bom/plugin.less +8 -0
package/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: node_js
2
2
  node_js:
3
- - "4.2.0"
4
- - "4.0.0"
3
+ - "6"
4
+ - "4"
5
5
  - "0.12"
6
6
  - "0.10"
7
7
  install:
@@ -9,6 +9,7 @@ install:
9
9
  - npm install
10
10
  env:
11
11
  global:
12
+ - PHANTOMJS_CDNURL=http://cnpmjs.org/downloads
12
13
  - secure: TrNVruWYaUK5ALga1y7wRY+MLjWJECUSCsBmKW5EUmIevOUxqHWu7M89FANKxstEeFRRAGH3QJbloRxnzIgh0U0ah5npE9XA1bYXGO5khoXeIyk7pNRfjIo8aEnJH1Vp8vWA6J6ovxdJ7lCFKEGvGKxGde50knVl7KFVVULlX2U=
13
14
  - secure: Rzh+CEI7YRvvVkOruPE8Z0dkU0s13V6b6cpqbN72vxbJl/Jm5PUZkjTFJdkWJrW3ErhCKX6EC7XdGvrclqEA9WAqKzrecqCJYqTnw4MwqiAj6F9wqE/BqhoWg4xPxm0MK/7eJMvLCgjNpe+gc1CaeFJZkLSNWn6nOFke+vVlf9Q=
14
15
  sudo: false
package/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ # 2.7.2
2
+
3
+ 2017-01-04
4
+
5
+ - Revert changes to contrast() function in 2.7.0
6
+
7
+ # 2.7.1 HOTFIX
8
+
9
+ 2016-05-09
10
+
11
+ - Revert commit 470af20 (source map performance) which broke source maps
12
+
13
+ # 2.7.0
14
+
15
+ 2016-05-07
16
+
17
+ - Fixes for contrast() function
18
+ - Allow root functions for plugins
19
+ - Allow semi-colon separators in functions
20
+ - Performance improvements for source maps
21
+ - Fix "blank page" issue in browser
22
+ - Compatibility fixes for Node 6.x
23
+ - Fix AST to include single-line comments
24
+ - Fix reversion for "color-like" words (outputting color values)
25
+
1
26
  # 2.6.1
2
27
 
3
28
  2016-03-04
@@ -141,7 +166,7 @@
141
166
  - Improved keyword and anonymous usage with the replace function
142
167
  - Added `getCSSAppendage` to sourcemap builder to avoid duplication in plugins
143
168
  - Fix problem with plugins when used with the promises version of render
144
- - If the render callback throws an exception it now propogates instead of calling the callback again with an error
169
+ - If the render callback throws an exception it now propagates instead of calling the callback again with an error
145
170
 
146
171
  # 2.1.0
147
172
 
package/Gruntfile.js CHANGED
@@ -14,18 +14,17 @@ module.exports = function (grunt) {
14
14
  build: grunt.file.readYAML('build/build.yml'),
15
15
  pkg: grunt.file.readJSON('package.json'),
16
16
  meta: {
17
- license: '<%= _.pluck(pkg.licenses, "type").join(", ") %>',
18
17
  copyright: 'Copyright (c) 2009-<%= grunt.template.today("yyyy") %>',
19
18
  banner: '/*!\n' +
20
19
  ' * Less - <%= pkg.description %> v<%= pkg.version %>\n' +
21
20
  ' * http://lesscss.org\n' +
22
21
  ' *\n' +
23
22
  ' * <%= meta.copyright %>, <%= pkg.author.name %> <<%= pkg.author.email %>>\n' +
24
- ' * Licensed under the <%= meta.license %> License.\n' +
23
+ ' * Licensed under the <%= pkg.license %> License.\n' +
25
24
  ' *\n' +
26
25
  ' */\n\n' +
27
26
  ' /**' +
28
- ' * @license <%= meta.license %>\n' +
27
+ ' * @license <%= pkg.license %>\n' +
29
28
  ' */\n\n'
30
29
  },
31
30
 
package/README.md CHANGED
@@ -51,6 +51,6 @@ Copyright (c) 2009-2016 [Alexis Sellier](http://cloudhead.io) & The Core Less Te
51
51
  Licensed under the [Apache License](LICENSE).
52
52
 
53
53
 
54
- [so]: http://stackoverflow.com/questions/tagged/twitter-bootstrap+less "StackOverflow.com"
54
+ [so]: http://stackoverflow.com/questions/tagged/less "StackOverflow.com"
55
55
  [issues]: https://github.com/less/less.js/issues "GitHub Issues for Less.js"
56
56
  [download]: https://github.com/less/less.js/zipball/master "Download Less.js"
package/appveyor.yml CHANGED
@@ -4,6 +4,7 @@ environment:
4
4
  - nodejs_version: "0.10"
5
5
  - nodejs_version: "0.12"
6
6
  - nodejs_version: "4"
7
+ - nodejs_version: "6"
7
8
 
8
9
  # Install scripts. (runs after repo cloning)
9
10
  install:
package/bin/lessc CHANGED
@@ -40,18 +40,32 @@ var silent = false,
40
40
  plugins: plugins
41
41
  };
42
42
  var sourceMapOptions = {};
43
- var continueProcessing = true,
44
- currentErrorcode;
45
-
46
- // calling process.exit does not flush stdout always
47
- // so use this to set the exit code
48
- process.on('exit', function() { process.reallyExit(currentErrorcode); });
43
+ var continueProcessing = true;
44
+
45
+ // Calling process.exit does not flush stdout always. Instead of exiting the process, we set the process' exitCode,
46
+ // close all handles and wait for the event loop to exit the process.
47
+ // @see https://github.com/nodejs/node/issues/6409
48
+ // Unfortunately, node 0.10.x does not support setting process.exitCode, so we need to call reallyExit() explicitly.
49
+ // @see https://nodejs.org/api/process.html#process_process_exitcode
50
+ // Additionally we also need to make sure that uncaughtExceptions are never swallowed.
51
+ // @see https://github.com/less/less.js/issues/2881
52
+ // This code can safely be removed if node 0.10.x is not supported anymore.
53
+ process.on("exit", function() { process.reallyExit(process.exitCode); });
54
+ process.on("uncaughtException", function(err) {
55
+ console.error(err);
56
+ process.exitCode = 1;
57
+ });
58
+ // This code will still be required because otherwise rejected promises would not be reported to the user
59
+ process.on("unhandledRejection", function(err) {
60
+ console.error(err);
61
+ process.exitCode = 1;
62
+ });
49
63
 
50
64
  var checkArgFunc = function(arg, option) {
51
65
  if (!option) {
52
66
  console.error(arg + " option requires a parameter");
53
67
  continueProcessing = false;
54
- currentErrorcode = 1;
68
+ process.exitCode = 1;
55
69
  return false;
56
70
  }
57
71
  return true;
@@ -62,7 +76,7 @@ var checkBooleanArg = function(arg) {
62
76
  if (!onOff) {
63
77
  console.error(" unable to parse " + arg + " as a boolean. use one of on/t/true/y/yes/off/f/false/n/no");
64
78
  continueProcessing = false;
65
- currentErrorcode = 1;
79
+ process.exitCode = 1;
66
80
  return false;
67
81
  }
68
82
  return Boolean(onOff[2]);
@@ -252,7 +266,7 @@ function printUsage() {
252
266
  } else {
253
267
  console.error("Unable to load plugin " + name +
254
268
  " please make sure that it is installed under or at the same level as less");
255
- currentErrorcode = 1;
269
+ process.exitCode = 1;
256
270
  }
257
271
  break;
258
272
  default:
@@ -263,7 +277,7 @@ function printUsage() {
263
277
  console.error("Unable to interpret argument " + arg +
264
278
  " - if it is a plugin (less-plugin-" + arg + "), make sure that it is installed under or at" +
265
279
  " the same level as less");
266
- currentErrorcode = 1;
280
+ process.exitCode = 1;
267
281
  }
268
282
  break;
269
283
  }
@@ -288,15 +302,20 @@ function printUsage() {
288
302
  sourceMapOptions.sourceMapInputFilename = input;
289
303
  if (!sourceMapOptions.sourceMapFullFilename) {
290
304
  if (!output && !sourceMapFileInline) {
291
- console.log("the sourcemap option only has an optional filename if the css filename is given");
292
- console.log("consider adding --source-map-map-inline which embeds the sourcemap into the css");
305
+ console.error("the sourcemap option only has an optional filename if the css filename is given");
306
+ console.error("consider adding --source-map-map-inline which embeds the sourcemap into the css");
307
+ process.exitCode = 1;
293
308
  return;
294
309
  }
295
310
  // its in the same directory, so always just the basename
296
- sourceMapOptions.sourceMapOutputFilename = path.basename(output);
297
- sourceMapOptions.sourceMapFullFilename = output + ".map";
311
+ if (output) {
312
+ sourceMapOptions.sourceMapOutputFilename = path.basename(output);
313
+ sourceMapOptions.sourceMapFullFilename = output + ".map";
314
+ }
298
315
  // its in the same directory, so always just the basename
299
- sourceMapOptions.sourceMapFilename = path.basename(sourceMapOptions.sourceMapFullFilename);
316
+ if ('sourceMapFullFilename' in sourceMapOptions) {
317
+ sourceMapOptions.sourceMapFilename = path.basename(sourceMapOptions.sourceMapFullFilename);
318
+ }
300
319
  } else if (options.sourceMap && !sourceMapFileInline) {
301
320
  var mapFilename = path.resolve(process.cwd(), sourceMapOptions.sourceMapFullFilename),
302
321
  mapDir = path.dirname(mapFilename),
@@ -316,8 +335,8 @@ function printUsage() {
316
335
  }
317
336
 
318
337
  if (sourceMapOptions.sourceMapRootpath === undefined) {
319
- var pathToMap = path.dirname(sourceMapFileInline ? output : sourceMapOptions.sourceMapFullFilename),
320
- pathToInput = path.dirname(sourceMapOptions.sourceMapInputFilename);
338
+ var pathToMap = path.dirname((sourceMapFileInline ? output : sourceMapOptions.sourceMapFullFilename) || '.'),
339
+ pathToInput = path.dirname(sourceMapOptions.sourceMapInputFilename || '.');
321
340
  sourceMapOptions.sourceMapRootpath = path.relative(pathToMap, pathToInput);
322
341
  }
323
342
 
@@ -325,7 +344,7 @@ function printUsage() {
325
344
  console.error("lessc: no input files");
326
345
  console.error("");
327
346
  printUsage();
328
- currentErrorcode = 1;
347
+ process.exitCode = 1;
329
348
  return;
330
349
  }
331
350
 
@@ -345,7 +364,8 @@ function printUsage() {
345
364
 
346
365
  if (options.depends) {
347
366
  if (!outputbase) {
348
- console.log("option --depends requires an output path to be specified");
367
+ console.error("option --depends requires an output path to be specified");
368
+ process.exitCode = 1;
349
369
  return;
350
370
  }
351
371
  process.stdout.write(outputbase + ": ");
@@ -366,6 +386,7 @@ function printUsage() {
366
386
  }
367
387
  console.error('lessc: failed to create file ' + filename);
368
388
  console.error(description);
389
+ process.exitCode = 1;
369
390
  } else {
370
391
  less.logger.info('lessc: wrote ' + filename);
371
392
  }
@@ -383,7 +404,9 @@ function printUsage() {
383
404
  };
384
405
 
385
406
  var writeOutput = function(output, result, onSuccess) {
386
- if (output) {
407
+ if (options.depends) {
408
+ onSuccess();
409
+ } else if (output) {
387
410
  ensureDirectory(output);
388
411
  fs.writeFile(output, result.css, {encoding: 'utf8'}, function (err) {
389
412
  if (err) {
@@ -395,6 +418,7 @@ function printUsage() {
395
418
  }
396
419
  console.error('lessc: failed to create file ' + output);
397
420
  console.error(description);
421
+ process.exitCode = 1;
398
422
  } else {
399
423
  less.logger.info('lessc: wrote ' + output);
400
424
  onSuccess();
@@ -419,7 +443,7 @@ function printUsage() {
419
443
  var parseLessFile = function (e, data) {
420
444
  if (e) {
421
445
  console.error("lessc: " + e.message);
422
- currentErrorcode = 1;
446
+ process.exitCode = 1;
423
447
  return;
424
448
  }
425
449
 
@@ -466,7 +490,7 @@ function printUsage() {
466
490
  },
467
491
  function(err) {
468
492
  less.writeError(err, options);
469
- currentErrorcode = 1;
493
+ process.exitCode = 1;
470
494
  });
471
495
  };
472
496
 
@@ -485,4 +509,4 @@ function printUsage() {
485
509
  parseLessFile(false, buffer);
486
510
  });
487
511
  }
488
- })();
512
+ })();