less 3.0.0 → 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/.project ADDED
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>less.js</name>
4
+ <comment>Project less.js created by Buildship.</comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ </buildSpec>
14
+ <natures>
15
+ <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16
+ </natures>
17
+ </projectDescription>
@@ -0,0 +1,2 @@
1
+ #Wed Feb 14 13:51:01 PST 2018
2
+ connection.project.dir=
@@ -0,0 +1,14 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "type": "node",
9
+ "request": "launch",
10
+ "name": "Launch Program",
11
+ "program": "${workspaceFolder}/index"
12
+ }
13
+ ]
14
+ }
package/Gruntfile.js CHANGED
@@ -4,7 +4,7 @@ module.exports = function (grunt) {
4
4
 
5
5
 
6
6
  grunt.option('stack', true)
7
-
7
+
8
8
  // Report the elapsed execution time of tasks.
9
9
  require('time-grunt')(grunt);
10
10
 
@@ -67,19 +67,19 @@ module.exports = function (grunt) {
67
67
  platform: 'Linux'
68
68
  }
69
69
  ];
70
-
70
+
71
71
  var sauceJobs = {};
72
72
 
73
73
  var browserTests = [ "filemanager-plugin",
74
74
  "visitor-plugin",
75
- "global-vars",
76
- "modify-vars",
77
- "production",
75
+ "global-vars",
76
+ "modify-vars",
77
+ "production",
78
78
  "rootpath-relative",
79
- "rootpath",
80
- "relative-urls",
81
- "browser",
82
- "no-js-errors",
79
+ "rootpath",
80
+ "relative-urls",
81
+ "browser",
82
+ "no-js-errors",
83
83
  "legacy"
84
84
  ];
85
85
 
@@ -116,7 +116,7 @@ module.exports = function (grunt) {
116
116
  // test. Passing undefined does not alter the test result. Please note that this
117
117
  // only affects the grunt task's result. You have to explicitly update the Sauce
118
118
  // Labs job's status via its REST API, if you want so.
119
-
119
+
120
120
  // This should be the encrypted value in Travis
121
121
  var user = process.env.SAUCE_USERNAME;
122
122
  var pass = process.env.SAUCE_ACCESS_KEY;
@@ -142,7 +142,7 @@ module.exports = function (grunt) {
142
142
  }
143
143
  });
144
144
  });
145
-
145
+
146
146
  }
147
147
  }
148
148
  };
@@ -174,7 +174,7 @@ module.exports = function (grunt) {
174
174
 
175
175
  shell: {
176
176
  options: {
177
- stdout: true,
177
+ stdout: true,
178
178
  failOnError: true,
179
179
  execOptions: {
180
180
  maxBuffer: Infinity
@@ -186,6 +186,9 @@ module.exports = function (grunt) {
186
186
  benchmark: {
187
187
  command: 'node benchmark/index.js'
188
188
  },
189
+ plugin: {
190
+ command: 'node bin/lessc --clean-css="--s1 --advanced" test/less/lazy-eval.less tmp/lazy-eval.css'
191
+ },
189
192
  "sourcemap-test": {
190
193
  command: [
191
194
  'node bin/lessc --source-map=test/sourcemaps/maps/import-map.map test/less/import.less test/sourcemaps/import.css',
@@ -258,10 +261,10 @@ module.exports = function (grunt) {
258
261
  },
259
262
 
260
263
  eslint: {
261
- target: ["Gruntfile.js",
262
- "test/**/*.js",
263
- "lib/less*/**/*.js",
264
- "bin/lessc",
264
+ target: ["Gruntfile.js",
265
+ "test/**/*.js",
266
+ "lib/less*/**/*.js",
267
+ "bin/lessc",
265
268
  "!test/browser/jasmine-jsreporter.js",
266
269
  "!test/less/errors/plugin/plugin-error.js"
267
270
  ],
@@ -289,11 +292,11 @@ module.exports = function (grunt) {
289
292
  // src is used to build list of less files to compile
290
293
  src: [
291
294
  'test/less/*.less',
292
- // Don't test NPM import, obviously
295
+ // Don't test NPM import, obviously
293
296
  '!test/less/plugin-module.less',
294
297
  '!test/less/import-module.less',
295
- '!test/less/javascript.less',
296
- '!test/less/urls.less',
298
+ '!test/less/javascript.less',
299
+ '!test/less/urls.less',
297
300
  '!test/less/empty.less'
298
301
  ],
299
302
  options: {
@@ -422,7 +425,7 @@ module.exports = function (grunt) {
422
425
  specs: 'test/browser/runner-filemanagerPlugin.js',
423
426
  outfile: 'tmp/browser/test-runner-filemanager-plugin.html'
424
427
  }
425
- }
428
+ }
426
429
  },
427
430
 
428
431
  'saucelabs-jasmine': sauceJobs,
@@ -519,6 +522,7 @@ module.exports = function (grunt) {
519
522
  'clean',
520
523
  'eslint',
521
524
  'shell:test',
525
+ 'shell:plugin',
522
526
  'browsertest'
523
527
  ];
524
528
 
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![npm version](https://badge.fury.io/js/less.svg)](http://badge.fury.io/js/less) [![Build Status](https://travis-ci.org/less/less.js.svg?branch=master)](https://travis-ci.org/less/less.js) [![Build status](https://ci.appveyor.com/api/projects/status/bx2qspy3qbuxpl9q/branch/3.x?svg=true)](https://ci.appveyor.com/project/lukeapage/less-js/branch/3.x) [![Dependencies](https://david-dm.org/less/less.js.svg)](https://david-dm.org/less/less.js) [![devDependency Status](https://david-dm.org/less/less.js/dev-status.svg)](https://david-dm.org/less/less.js#info=devDependencies) [![optionalDependency Status](https://david-dm.org/less/less.js/optional-status.svg)](https://david-dm.org/less/less.js#info=optionalDependencies) [![Twitter Follow](https://img.shields.io/twitter/follow/lesstocss.svg?style=flat-square)](https://twitter.com/lesstocss) [![Join the chat at https://gitter.im/less/less.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/less/less.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) <sup>Chat with Less.js users</sup>
1
+ [![npm version](https://badge.fury.io/js/less.svg)](http://badge.fury.io/js/less) [![Build Status](https://travis-ci.org/less/less.js.svg?branch=master)](https://travis-ci.org/less/less.js) [![Build status](https://ci.appveyor.com/api/projects/status/bx2qspy3qbuxpl9q/branch/master?svg=true)](https://ci.appveyor.com/project/lukeapage/less-js/branch/master) [![Dependencies](https://david-dm.org/less/less.js.svg)](https://david-dm.org/less/less.js) [![devDependency Status](https://david-dm.org/less/less.js/dev-status.svg)](https://david-dm.org/less/less.js#info=devDependencies) [![optionalDependency Status](https://david-dm.org/less/less.js/optional-status.svg)](https://david-dm.org/less/less.js#info=optionalDependencies) [![Twitter Follow](https://img.shields.io/twitter/follow/lesstocss.svg?style=flat-square)](https://twitter.com/lesstocss) [![Join the chat at https://gitter.im/less/less.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/less/less.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) <sup>Chat with Less.js users</sup>
2
2
 
3
3
  [![Sauce Test Status](https://saucelabs.com/browser-matrix/less.svg)](https://saucelabs.com/u/less)
4
4
 
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,7 +14,8 @@ try {
13
14
  }
14
15
 
15
16
  var less = require('../lib/less-node'),
16
- pluginLoader = new less.PluginLoader(less),
17
+ pluginManager = new less.PluginManager(less),
18
+ fileManager = new less.FileManager(),
17
19
  plugins = [],
18
20
  queuePlugins = [],
19
21
  args = process.argv.slice(1),
@@ -22,6 +24,7 @@ var less = require('../lib/less-node'),
22
24
  options = less.options;
23
25
 
24
26
  options.plugins = plugins;
27
+ options.reUsePluginManager = true;
25
28
 
26
29
  var sourceMapOptions = {};
27
30
  var continueProcessing = true;
@@ -75,7 +78,7 @@ var sourceMapFileInline = false;
75
78
 
76
79
  function printUsage() {
77
80
  less.lesscHelper.printUsage();
78
- pluginLoader.printUsage(plugins);
81
+ pluginManager.Loader.printUsage(plugins);
79
82
  continueProcessing = false;
80
83
  }
81
84
  function render() {
@@ -137,6 +140,7 @@ function render() {
137
140
  sourceMapOptions.sourceMapRootpath = path.relative(pathToMap, pathToInput);
138
141
  }
139
142
 
143
+
140
144
  if (!input) {
141
145
  console.error("lessc: no input files");
142
146
  console.error("");
@@ -328,18 +332,18 @@ function processPluginQueue() {
328
332
  }
329
333
  }
330
334
  queuePlugins.forEach(function(queue) {
331
- pluginLoader.tryLoadPlugin(queue.name, function(err, data) {
332
- if (err) {
333
- pluginError(queue.name);
334
- }
335
- else {
335
+ var context = utils.clone(options);
336
+ pluginManager.Loader.loadPlugin(queue.name, process.cwd(), context, less.environment, fileManager)
337
+ .then(function(data) {
336
338
  pluginFinished({
337
339
  fileContent: data.contents,
338
340
  filename: data.filename,
339
341
  options: queue.options
340
342
  });
341
- }
342
- });
343
+ })
344
+ .catch(function() {
345
+ pluginError(queue.name);
346
+ });
343
347
  });
344
348
  }
345
349
 
@@ -414,7 +418,7 @@ function processPluginQueue() {
414
418
  options.javascriptEnabled = true;
415
419
  break;
416
420
  case 'no-js':
417
- console.error('The "--no-js" argument is deprecated, as inline JavaScript ' +
421
+ console.error('The "--no-js" argument is deprecated, as inline JavaScript ' +
418
422
  'is disabled by default. Use "--js" to enable inline JavaScript (not recommended).');
419
423
  break;
420
424
  case 'include-path':
package/dist/less.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Less - Leaner CSS v3.0.0
2
+ * Less - Leaner CSS v3.0.1
3
3
  * http://lesscss.org
4
4
  *
5
5
  * Copyright (c) 2009-2018, Alexis Sellier <self@cloudhead.net>
@@ -895,7 +895,7 @@ PluginLoader.prototype.loadPlugin = function(filename, basePath, context, enviro
895
895
  return new Promise(function(fulfill, reject) {
896
896
  fileManager.loadFile(filename, basePath, context, environment)
897
897
  .then(fulfill).catch(reject);
898
- });
898
+ });
899
899
  };
900
900
 
901
901
  module.exports = PluginLoader;
@@ -1473,7 +1473,7 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports,
1473
1473
  fileInfo: fileInfo
1474
1474
  };
1475
1475
  registry = functionRegistry.create();
1476
-
1476
+
1477
1477
  var registerPlugin = function(obj) {
1478
1478
  pluginObj = obj;
1479
1479
  };
@@ -1484,7 +1484,7 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports,
1484
1484
  } catch (e) {
1485
1485
  return new this.less.LessError(e, imports, filename);
1486
1486
  }
1487
-
1487
+
1488
1488
  if (!pluginObj) {
1489
1489
  pluginObj = localModule.exports;
1490
1490
  }
@@ -1509,7 +1509,7 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports,
1509
1509
  e.message = 'Error during @plugin call';
1510
1510
  return new this.less.LessError(e, imports, filename);
1511
1511
  }
1512
-
1512
+
1513
1513
  }
1514
1514
  else {
1515
1515
  return new this.less.LessError({ message: "Not a valid plugin" });
@@ -1586,6 +1586,11 @@ module.exports = AbstractPluginLoader;
1586
1586
 
1587
1587
 
1588
1588
  },{"../functions/function-registry":26,"../less-error":36}],19:[function(require,module,exports){
1589
+ /**
1590
+ * @todo Document why this abstraction exists, and the relationship between
1591
+ * environment, file managers, and plugin manager
1592
+ */
1593
+
1589
1594
  var logger = require("../logger");
1590
1595
  var environment = function(externalEnvironment, fileManagers) {
1591
1596
  this.fileManagers = fileManagers || [];
@@ -2838,7 +2843,7 @@ module.exports = function(environment, fileManagers) {
2838
2843
  var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
2839
2844
 
2840
2845
  var initial = {
2841
- version: [3, 0, 0],
2846
+ version: [3, 0, 1],
2842
2847
  data: require('./data'),
2843
2848
  tree: require('./tree'),
2844
2849
  Environment: (Environment = require("./environment/environment")),
@@ -2911,10 +2916,10 @@ var utils = require('./utils');
2911
2916
  * @prop {string[]} extract
2912
2917
  *
2913
2918
  * @param {Object} e - An error object to wrap around or just a descriptive object
2914
- * @param {Object} importManager - An instance of ImportManager (see import-manager.js)
2919
+ * @param {Object} fileContentMap - An object with file contents in 'contents' property (like importManager) @todo - move to fileManager?
2915
2920
  * @param {string} [currentFilename]
2916
2921
  */
2917
- var LessError = module.exports = function LessError(e, importManager, currentFilename) {
2922
+ var LessError = module.exports = function LessError(e, fileContentMap, currentFilename) {
2918
2923
  Error.call(this);
2919
2924
 
2920
2925
  var filename = e.filename || currentFilename;
@@ -2922,13 +2927,13 @@ var LessError = module.exports = function LessError(e, importManager, currentFil
2922
2927
  this.message = e.message;
2923
2928
  this.stack = e.stack;
2924
2929
 
2925
- if (importManager && filename) {
2926
- var input = importManager.contents[filename],
2930
+ if (fileContentMap && filename) {
2931
+ var input = fileContentMap.contents[filename],
2927
2932
  loc = utils.getLocation(e.index, input),
2928
2933
  line = loc.line,
2929
2934
  col = loc.column,
2930
2935
  callLine = e.call && utils.getLocation(e.call, input).line,
2931
- lines = input.split('\n');
2936
+ lines = input ? input.split('\n') : '';
2932
2937
 
2933
2938
  this.type = e.type || 'Syntax';
2934
2939
  this.filename = filename;
@@ -2951,7 +2956,7 @@ var LessError = module.exports = function LessError(e, importManager, currentFil
2951
2956
 
2952
2957
  this.callLine = callLine + 1;
2953
2958
  this.callExtract = lines[callLine];
2954
-
2959
+
2955
2960
  this.extract = [
2956
2961
  lines[this.line - 2],
2957
2962
  lines[this.line - 1],
@@ -3167,7 +3172,7 @@ module.exports = function(environment, ParseTree, ImportManager) {
3167
3172
  } else {
3168
3173
  var context,
3169
3174
  rootFileInfo,
3170
- pluginManager = new PluginManager(this, true);
3175
+ pluginManager = new PluginManager(this, !options.reUsePluginManager);
3171
3176
 
3172
3177
  options.pluginManager = pluginManager;
3173
3178
 
@@ -3213,7 +3218,7 @@ module.exports = function(environment, ParseTree, ImportManager) {
3213
3218
  }
3214
3219
  });
3215
3220
  }
3216
-
3221
+
3217
3222
  new Parser(context, imports, rootFileInfo)
3218
3223
  .parse(input, function (e, root) {
3219
3224
  if (e) { return callback(e); }
@@ -5755,7 +5760,7 @@ PluginManager.prototype.getFileManagers = function() {
5755
5760
  return this.fileManagers;
5756
5761
  };
5757
5762
 
5758
- //
5763
+ //
5759
5764
  module.exports = PluginManagerFactory;
5760
5765
 
5761
5766
  },{}],44:[function(require,module,exports){