Socket
Socket
Sign inDemoInstall

less

Package Overview
Dependencies
Maintainers
5
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

less - npm Package Compare versions

Comparing version 3.5.0-beta.2 to 3.5.0-beta.3

.eslintignore

5

Gruntfile.js

@@ -193,3 +193,6 @@ 'use strict';

'cd lib',
'node ../bin/lessc --clean-css="--s1 --advanced" ../test/less/lazy-eval.less ../tmp/lazy-eval.css'
'node ../bin/lessc --clean-css="--s1 --advanced" ../test/less/lazy-eval.less ../tmp/lazy-eval.css',
'cd ..',
// Test multiple plugins
'node bin/lessc --plugin=clean-css="--s1 --advanced" --plugin=autoprefix="ie 11,Edge >= 13,Chrome >= 47,Firefox >= 45,iOS >= 9.2,Safari >= 9" test/less/lazy-eval.less tmp/lazy-eval.css'
].join(' && ')

@@ -196,0 +199,0 @@ },

3

lib/less-browser/cache.js

@@ -32,2 +32,3 @@ // Cache system is a bit outdated and could do with work

modifyVars = modifyVars || {};
vars = vars || "{}"; // if not set, treat as the JSON representation of an empty object

@@ -37,3 +38,3 @@ if (timestamp && webInfo.lastModified &&

new Date(timestamp).valueOf()) &&
(!modifyVars && !vars || JSON.stringify(modifyVars) === vars)) {
JSON.stringify(modifyVars) === vars) {
// Use local copy

@@ -40,0 +41,0 @@ return css;

@@ -11,4 +11,3 @@ // TODO: Add tests for browser @plugin

this.less = less;
// shim for browser require?
this.require = require;
// Should we shim this.require for browser? Probably not?
};

@@ -15,0 +14,0 @@

@@ -10,4 +10,3 @@ var path = require('path'),

this.less = less;
this.require = require;
this.requireRelative = function(prefix) {
this.require = function(prefix) {
prefix = path.dirname(prefix);

@@ -29,3 +28,2 @@ return function(id) {

PluginLoader.prototype.loadPlugin = function(filename, basePath, context, environment, fileManager) {
var self = this;
var prefix = filename.slice(0, 1);

@@ -41,3 +39,2 @@ var explicit = prefix === '.' || prefix === '/' || filename.slice(-3).toLowerCase() === '.js';

try {
self.require = self.requireRelative(data.filename);
fulfill(data);

@@ -44,0 +41,0 @@ }

@@ -5,12 +5,8 @@ var functionRegistry = require('../functions/function-registry'),

var AbstractPluginLoader = function() {
// Implemented by Node.js plugin loader
this.require = function() {
return null;
}
};
function error(msg, type) {
throw new LessError(
{
type: type || 'Syntax',
message: msg
}
);
}
AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports, pluginOptions, fileInfo) {

@@ -23,3 +19,4 @@

pluginManager,
filename;
filename,
result;

@@ -42,3 +39,6 @@ pluginManager = context.pluginManager;

if (pluginObj) {
this.trySetOptions(pluginObj, filename, shortname, pluginOptions);
result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);
if (result) {
return result;
}
try {

@@ -50,4 +50,4 @@ if (pluginObj.use) {

catch (e) {
e.message = 'Error during @plugin call';
return new this.less.LessError(e, imports, filename);
e.message = e.message || 'Error during @plugin call';
return new LessError(e, imports, filename);
}

@@ -70,5 +70,5 @@ return pluginObj;

loader = new Function('module', 'require', 'registerPlugin', 'functions', 'tree', 'less', 'fileInfo', contents);
loader(localModule, this.require, registerPlugin, registry, this.less.tree, this.less, fileInfo);
loader(localModule, this.require(filename), registerPlugin, registry, this.less.tree, this.less, fileInfo);
} catch (e) {
return new this.less.LessError(e, imports, filename);
return new LessError(e, imports, filename);
}

@@ -81,10 +81,24 @@

if (pluginObj instanceof LessError) {
return pluginObj;
}
if (pluginObj) {
// For 2.x back-compatibility - setOptions() before install()
pluginObj.imports = imports;
pluginObj.filename = filename;
result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);
if (result) {
return result;
}
// Run on first load
pluginManager.addPlugin(pluginObj, fileInfo.filename, registry);
pluginObj.functions = registry.getLocalFunctions();
pluginObj.imports = imports;
pluginObj.filename = filename;
this.trySetOptions(pluginObj, filename, shortname, pluginOptions);
// Need to call setOptions again because the pluginObj might have functions
result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);
if (result) {
return result;
}

@@ -98,4 +112,4 @@ // Run every @plugin call

catch (e) {
e.message = 'Error during @plugin call';
return new this.less.LessError(e, imports, filename);
e.message = e.message || 'Error during @plugin call';
return new LessError(e, imports, filename);
}

@@ -105,3 +119,3 @@

else {
return new this.less.LessError({ message: 'Not a valid plugin' });
return new LessError({ message: 'Not a valid plugin' }, imports, filename);
}

@@ -114,15 +128,14 @@

AbstractPluginLoader.prototype.trySetOptions = function(plugin, filename, name, options) {
if (options) {
if (!plugin.setOptions) {
error('Options have been provided but the plugin ' + name + ' does not support any options.');
return null;
}
try {
plugin.setOptions(options);
}
catch (e) {
error('Error setting options on plugin ' + name + '\n' + e.message);
return null;
}
if (options && !plugin.setOptions) {
return new LessError({
message: 'Options have been provided but the plugin ' +
name + ' does not support any options.'
});
}
try {
plugin.setOptions && plugin.setOptions(options);
}
catch (e) {
return new LessError(e);
}
};

@@ -140,4 +153,6 @@

if (this.compareVersion(plugin.minVersion, this.less.version) < 0) {
error('Plugin ' + name + ' requires version ' + this.versionToString(plugin.minVersion));
return null;
return new LessError({
message: 'Plugin ' + name + ' requires version ' +
this.versionToString(plugin.minVersion)
});
}

@@ -144,0 +159,0 @@ }

@@ -88,3 +88,6 @@ var Keyword = require('../tree/keyword'),

return new Dimension(getItemsFromNode(values).length);
},
_SELF: function(n) {
return n;
}
});

@@ -1,2 +0,3 @@

var Node = require('./node');
var Node = require('./node'),
Call = require('./call');

@@ -33,3 +34,9 @@ var Variable = function (name, index, currentFileInfo) {

}
return v.value.eval(context);
// If in calc, wrap vars in a function call to cascade evaluate args first
if (context.inCalc) {
return (new Call('_SELF', [v.value])).eval(context);
}
else {
return v.value.eval(context);
}
}

@@ -36,0 +43,0 @@ });

{
"name": "less",
"version": "3.5.0-beta.2",
"version": "3.5.0-beta.3",
"description": "Leaner CSS",

@@ -69,2 +69,3 @@ "homepage": "http://lesscss.org",

"jit-grunt": "^0.10.0",
"less-plugin-autoprefix": "^1.5.1",
"less-plugin-clean-css": "^1.5.1",

@@ -71,0 +72,0 @@ "performance-now": "^0.2.0",

@@ -1,2 +0,2 @@

SyntaxError: Error during @plugin call in {path}plugin-error-2.js{node} on line 3, column 16:
SyntaxError: An error was here. in {path}plugin-error-2.js{node} on line 3, column 16:
2 use: function() {

@@ -3,0 +3,0 @@ 3 throw new Error('An error was here.')

@@ -11,5 +11,5 @@ functions.addMultiple({

registerPlugin({
setOptions: function(raw) {
setOptions: function(opts) {
// do nothing
}
});
});

@@ -1,2 +0,2 @@

SyntaxError: Error during @plugin call in {path}plugin-error-2.js{node} on line 3, column 16:
SyntaxError: An error was here. in {path}plugin-error-2.js{node} on line 3, column 16:
2 use: function() {

@@ -3,0 +3,0 @@ 3 throw new Error('An error was here.')

@@ -11,5 +11,5 @@ functions.addMultiple({

registerPlugin({
setOptions: function(raw) {
setOptions: function(opts) {
// do nothing
}
});
});

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc