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,24 +2916,24 @@ 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 ;
2921
2926
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 ) {
0 commit comments