Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.0.0-pre.1 to 3.0.0-pre.2

test/sourcemaps/maps/import-map.map

4

lib/less/environment/abstract-plugin-loader.js

@@ -55,4 +55,4 @@ var functionRegistry = require("../functions/function-registry"),

try {
loader = new Function("module", "require", "functions", "tree", "fileInfo", "less", contents);
pluginObj = loader(localModule, this.require, registry, this.less.tree, fileInfo, this.less);
loader = new Function("module", "require", "functions", "tree", "fileInfo", contents);
pluginObj = loader(localModule, this.require, registry, this.less.tree, fileInfo);

@@ -59,0 +59,0 @@ if (!pluginObj) {

@@ -14,4 +14,4 @@ var Expression = require("../tree/expression");

};
functionCaller.prototype.call = function(args) {
// This code is terrible and should be replaced as per this issue...

@@ -18,0 +18,0 @@ // https://github.com/less/less.js/issues/2477

@@ -5,5 +5,5 @@ var Node = require("./node");

this.value = value;
this.index = index;
this._index = index;
this._fileInfo = currentFileInfo;
this.mapLines = mapLines;
this.currentFileInfo = currentFileInfo;
this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike;

@@ -16,3 +16,3 @@ this.allowRoot = true;

Anonymous.prototype.eval = function () {
return new Anonymous(this.value, this.index, this.currentFileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo());
return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo());
};

@@ -26,4 +26,4 @@ Anonymous.prototype.compare = function (other) {

Anonymous.prototype.genCSS = function (context, output) {
output.add(this.value, this.currentFileInfo, this.index, this.mapLines);
output.add(this.value, this._fileInfo, this._index, this.mapLines);
};
module.exports = Anonymous;

@@ -15,3 +15,3 @@ var Node = require("./node"),

this.rules = [rules];
this.rules[0].selectors = (new Selector([], null, null, this.index, currentFileInfo)).createEmptySelectors();
this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors();
}

@@ -21,5 +21,6 @@ for (i = 0; i < this.rules.length; i++) {

}
this.setParent(this.rules, this);
}
this.index = index;
this.currentFileInfo = currentFileInfo;
this._index = index;
this._fileInfo = currentFileInfo;
this.debugInfo = debugInfo;

@@ -50,3 +51,3 @@ this.isRooted = isRooted || false;

var value = this.value, rules = this.rules;
output.add(this.name, this.currentFileInfo, this.index);
output.add(this.name, this.fileInfo(), this.getIndex());
if (value) {

@@ -86,3 +87,3 @@ output.add(' ');

return new AtRule(this.name, value, rules,
this.index, this.currentFileInfo, this.debugInfo, this.isRooted, this.visibilityInfo());
this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo());
};

@@ -89,0 +90,0 @@ AtRule.prototype.variable = function (name) {

@@ -9,4 +9,4 @@ var Node = require("./node"),

this.args = args;
this.index = index;
this.currentFileInfo = currentFileInfo;
this._index = index;
this._fileInfo = currentFileInfo;
};

@@ -33,4 +33,4 @@ Call.prototype = new Node();

var args = this.args.map(function (a) { return a.eval(context); }),
result, funcCaller = new FunctionCaller(this.name, context, this.index, this.currentFileInfo);
result, funcCaller = new FunctionCaller(this.name, context, this.getIndex(), this.fileInfo());
if (funcCaller.isValid()) {

@@ -44,4 +44,4 @@ try {

(e.message ? ': ' + e.message : ''),
index: this.index,
filename: this.currentFileInfo.filename,
index: this.getIndex(),
filename: this.fileInfo().filename,
line: e.lineNumber,

@@ -53,4 +53,4 @@ column: e.columnNumber

if (result != null) {
result.index = this.index;
result.currentFileInfo = this.currentFileInfo;
result._index = this._index;
result._fileInfo = this._fileInfo;
return result;

@@ -60,6 +60,6 @@ }

return new Call(this.name, args, this.index, this.currentFileInfo);
return new Call(this.name, args, this.getIndex(), this.fileInfo());
};
Call.prototype.genCSS = function (context, output) {
output.add(this.name + "(", this.currentFileInfo, this.index);
output.add(this.name + "(", this.fileInfo(), this.getIndex());

@@ -66,0 +66,0 @@ for (var i = 0; i < this.args.length; i++) {

@@ -102,3 +102,3 @@ var Node = require("./node"),

Color.prototype.operate = function (context, op, other) {
var rgb = [];
var rgb = new Array(3);
var alpha = this.alpha * (1 - other.alpha) + other.alpha;

@@ -105,0 +105,0 @@ for (var c = 0; c < 3; c++) {

@@ -7,4 +7,4 @@ var Node = require("./node"),

this.isLineComment = isLineComment;
this.index = index;
this.currentFileInfo = currentFileInfo;
this._index = index;
this._fileInfo = currentFileInfo;
this.allowRoot = true;

@@ -16,3 +16,3 @@ };

if (this.debugInfo) {
output.add(getDebugInfo(context, this), this.currentFileInfo, this.index);
output.add(getDebugInfo(context, this), this.fileInfo(), this.getIndex());
}

@@ -19,0 +19,0 @@ output.add(this.value);

@@ -7,3 +7,3 @@ var Node = require("./node");

this.rvalue = r;
this.index = i;
this._index = i;
this.negate = negate;

@@ -10,0 +10,0 @@ };

@@ -10,4 +10,4 @@ var Node = require("./node"),

this.merge = merge;
this.index = index;
this.currentFileInfo = currentFileInfo;
this._index = index;
this._fileInfo = currentFileInfo;
this.inline = inline || false;

@@ -17,2 +17,3 @@ this.variable = (variable !== undefined) ? variable

this.allowRoot = true;
this.setParent(this.value, this);
};

@@ -32,3 +33,3 @@

Declaration.prototype.genCSS = function (context, output) {
output.add(this.name + (context.compress ? ':' : ': '), this.currentFileInfo, this.index);
output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex());
try {

@@ -38,7 +39,7 @@ this.value.genCSS(context, output);

catch(e) {
e.index = this.index;
e.filename = this.currentFileInfo.filename;
e.index = this._index;
e.filename = this._fileInfo.filename;
throw e;
}
output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? "" : ";"), this.currentFileInfo, this.index);
output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? "" : ";"), this._fileInfo, this._index);
};

@@ -64,3 +65,3 @@ Declaration.prototype.eval = function (context) {

throw { message: "Rulesets cannot be evaluated on a property.",
index: this.index, filename: this.currentFileInfo.filename };
index: this.getIndex(), filename: this.fileInfo().filename };
}

@@ -77,3 +78,3 @@ var important = this.important,

this.merge,
this.index, this.currentFileInfo, this.inline,
this.getIndex(), this.fileInfo(), this.inline,
variable);

@@ -83,4 +84,4 @@ }

if (typeof e.index !== 'number') {
e.index = this.index;
e.filename = this.currentFileInfo.filename;
e.index = this.getIndex();
e.filename = this.fileInfo().filename;
}

@@ -100,5 +101,5 @@ throw e;

this.merge,
this.index, this.currentFileInfo, this.inline);
this.getIndex(), this.fileInfo(), this.inline);
};
module.exports = Declaration;
var Node = require("./node"),
contexts = require("../contexts");
contexts = require("../contexts"),
utils = require("../utils");

@@ -7,2 +8,3 @@ var DetachedRuleset = function (ruleset, frames) {

this.frames = frames;
this.setParent(this.ruleset, this);
};

@@ -16,3 +18,3 @@ DetachedRuleset.prototype = new Node();

DetachedRuleset.prototype.eval = function (context) {
var frames = this.frames || context.frames.slice(0);
var frames = this.frames || utils.copyArray(context.frames);
return new DetachedRuleset(this.ruleset, frames);

@@ -19,0 +21,0 @@ };

@@ -13,2 +13,3 @@ var Node = require("./node"),

new Unit(unit ? [unit] : undefined);
this.setParent(this.unit, this);
};

@@ -15,0 +16,0 @@

@@ -5,3 +5,3 @@ var Node = require("./node"),

var Element = function (combinator, value, index, currentFileInfo, info) {
var Element = function (combinator, value, index, currentFileInfo, visibilityInfo) {
this.combinator = combinator instanceof Combinator ?

@@ -17,5 +17,6 @@ combinator : new Combinator(combinator);

}
this.index = index;
this.currentFileInfo = currentFileInfo;
this.copyVisibilityInfo(info);
this._index = index;
this._fileInfo = currentFileInfo;
this.copyVisibilityInfo(visibilityInfo);
this.setParent(this.combinator, this);
};

@@ -34,4 +35,4 @@ Element.prototype = new Node();

this.value.eval ? this.value.eval(context) : this.value,
this.index,
this.currentFileInfo, this.visibilityInfo());
this.getIndex(),
this.fileInfo(), this.visibilityInfo());
};

@@ -41,7 +42,7 @@ Element.prototype.clone = function () {

this.value,
this.index,
this.currentFileInfo, this.visibilityInfo());
this.getIndex(),
this.fileInfo(), this.visibilityInfo());
};
Element.prototype.genCSS = function (context, output) {
output.add(this.toCSS(context), this.currentFileInfo, this.index);
output.add(this.toCSS(context), this.fileInfo(), this.getIndex());
};

@@ -48,0 +49,0 @@ Element.prototype.toCSS = function (context) {

@@ -7,6 +7,6 @@ var Node = require("./node"),

this.option = option;
this.index = index;
this.object_id = Extend.next_id++;
this.parent_ids = [this.object_id];
this.currentFileInfo = currentFileInfo || {};
this._index = index;
this._fileInfo = currentFileInfo;
this.copyVisibilityInfo(visibilityInfo);

@@ -25,2 +25,3 @@ this.allowRoot = true;

}
this.setParent(this.selector, this);
};

@@ -35,6 +36,6 @@ Extend.next_id = 0;

Extend.prototype.eval = function (context) {
return new Extend(this.selector.eval(context), this.option, this.index, this.currentFileInfo, this.visibilityInfo());
return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());
};
Extend.prototype.clone = function (context) {
return new Extend(this.selector, this.option, this.index, this.currentFileInfo, this.visibilityInfo());
return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());
};

@@ -41,0 +42,0 @@ //it concatenates (joins) all selectors in selector array

@@ -6,3 +6,4 @@ var Node = require("./node"),

Ruleset = require("./ruleset"),
Anonymous = require("./anonymous");
Anonymous = require("./anonymous"),
utils = require("../utils");

@@ -23,6 +24,6 @@ //

this.options = options;
this.index = index;
this._index = index;
this._fileInfo = currentFileInfo;
this.path = path;
this.features = features;
this.currentFileInfo = currentFileInfo;
this.allowRoot = true;

@@ -39,2 +40,4 @@

this.copyVisibilityInfo(visibilityInfo);
this.setParent(this.features, this);
this.setParent(this.path, this);
};

@@ -63,4 +66,4 @@

Import.prototype.genCSS = function (context, output) {
if (this.css && this.path.currentFileInfo.reference === undefined) {
output.add("@import ", this.currentFileInfo, this.index);
if (this.css && this.path._fileInfo.reference === undefined) {
output.add("@import ", this._fileInfo, this._index);
this.path.genCSS(context, output);

@@ -96,7 +99,7 @@ if (this.features) {

return new Import(path.eval(context), this.features, this.options, this.index, this.currentFileInfo, this.visibilityInfo());
return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo());
};
Import.prototype.evalPath = function (context) {
var path = this.path.eval(context);
var rootpath = this.currentFileInfo && this.currentFileInfo.rootpath;
var rootpath = this._fileInfo && this._fileInfo.rootpath;

@@ -157,3 +160,3 @@ if (!(path instanceof URL)) {

filename: this.importedFilename,
reference: this.path.currentFileInfo && this.path.currentFileInfo.reference
reference: this.path._fileInfo && this.path._fileInfo.reference
}, true, true);

@@ -163,3 +166,3 @@

} else if (this.css) {
var newImport = new Import(this.evalPath(context), features, this.options, this.index);
var newImport = new Import(this.evalPath(context), features, this.options, this._index);
if (!newImport.css && this.error) {

@@ -170,3 +173,3 @@ throw this.error;

} else {
ruleset = new Ruleset(null, this.root.rules.slice(0));
ruleset = new Ruleset(null, utils.copyArray(this.root.rules));
ruleset.evalImports(context);

@@ -173,0 +176,0 @@

@@ -9,4 +9,4 @@ var JsEvalNode = require("./js-eval-node"),

this.expression = string;
this.index = index;
this.currentFileInfo = currentFileInfo;
this._index = index;
this._fileInfo = currentFileInfo;
};

@@ -21,3 +21,3 @@ JavaScript.prototype = new JsEvalNode();

} else if (typeof result === 'string') {
return new Quoted('"' + result + '"', result, this.escaped, this.index);
return new Quoted('"' + result + '"', result, this.escaped, this._index);
} else if (Array.isArray(result)) {

@@ -24,0 +24,0 @@ return new Anonymous(result.join(', '));

@@ -15,8 +15,8 @@ var Node = require("./node"),

throw { message: "Inline JavaScript is not enabled. Is it set in your options?",
filename: this.currentFileInfo.filename,
index: this.index };
filename: this.fileInfo().filename,
index: this.getIndex() };
}
expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) {
return that.jsify(new Variable('@' + name, that.index, that.currentFileInfo).eval(context));
return that.jsify(new Variable('@' + name, that.getIndex(), that.fileInfo()).eval(context));
});

@@ -28,4 +28,4 @@

throw { message: "JavaScript evaluation error: " + e.message + " from `" + expression + "`" ,
filename: this.currentFileInfo.filename,
index: this.index };
filename: this.fileInfo().filename,
index: this.getIndex() };
}

@@ -50,4 +50,4 @@

throw { message: "JavaScript evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" ,
filename: this.currentFileInfo.filename,
index: this.index };
filename: this.fileInfo().filename,
index: this.getIndex() };
}

@@ -54,0 +54,0 @@ return result;

@@ -6,9 +6,10 @@ var Ruleset = require("./ruleset"),

Expression = require("./expression"),
AtRule = require("./atrule");
AtRule = require("./atrule"),
utils = require("../utils");
var Media = function (value, features, index, currentFileInfo, visibilityInfo) {
this.index = index;
this.currentFileInfo = currentFileInfo;
this._index = index;
this._fileInfo = currentFileInfo;
var selectors = (new Selector([], null, null, this.index, this.currentFileInfo)).createEmptySelectors();
var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors();

@@ -20,2 +21,5 @@ this.features = new Value(features);

this.allowRoot = true;
this.setParent(selectors, this);
this.setParent(this.features, this);
this.setParent(this.rules, this);
};

@@ -34,3 +38,3 @@ Media.prototype = new AtRule();

Media.prototype.genCSS = function (context, output) {
output.add('@media ', this.currentFileInfo, this.index);
output.add('@media ', this._fileInfo, this._index);
this.features.genCSS(context, output);

@@ -45,3 +49,3 @@ this.outputRuleset(context, output, this.rules);

var media = new Media(null, [], this.index, this.currentFileInfo, this.visibilityInfo());
var media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo());
if (this.debugInfo) {

@@ -83,6 +87,7 @@ this.rules[0].debugInfo = this.debugInfo;

if (context.mediaBlocks.length > 1) {
var selectors = (new Selector([], null, null, this.index, this.currentFileInfo)).createEmptySelectors();
var selectors = (new Selector([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors();
result = new Ruleset(selectors, context.mediaBlocks);
result.multiMedia = true;
result.copyVisibilityInfo(this.visibilityInfo());
this.setParent(result, this);
}

@@ -124,2 +129,3 @@

}));
this.setParent(this.features, this);

@@ -149,4 +155,5 @@ // Fake a tree-node that doesn't output anything.

}
this.rules = [new Ruleset(selectors.slice(0), [this.rules[0]])];
this.rules = [new Ruleset(utils.copyArray(selectors), [this.rules[0]])];
this.setParent(this.rules, this);
};
module.exports = Media;

@@ -9,6 +9,7 @@ var Node = require("./node"),

this.arguments = args || [];
this.index = index;
this.currentFileInfo = currentFileInfo;
this._index = index;
this._fileInfo = currentFileInfo;
this.important = important;
this.allowRoot = true;
this.setParent(this.selector, this);
};

@@ -121,3 +122,3 @@ MixinCall.prototype = new Node();

message: 'Ambiguous use of `default()` found when matching for `' + this.format(args) + '`',
index: this.index, filename: this.currentFileInfo.filename };
index: this.getIndex(), filename: this.fileInfo().filename };
}

@@ -140,3 +141,3 @@ }

} catch (e) {
throw { message: e.message, index: this.index, filename: this.currentFileInfo.filename, stack: e.stack };
throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack };
}

@@ -154,7 +155,7 @@ }

message: 'No matching definition was found for `' + this.format(args) + '`',
index: this.index, filename: this.currentFileInfo.filename };
index: this.getIndex(), filename: this.fileInfo().filename };
} else {
throw { type: 'Name',
message: this.selector.toCSS().trim() + " is undefined",
index: this.index, filename: this.currentFileInfo.filename };
index: this.getIndex(), filename: this.fileInfo().filename };
}

@@ -161,0 +162,0 @@ };

@@ -6,7 +6,8 @@ var Selector = require("./selector"),

Expression = require("./expression"),
contexts = require("../contexts");
contexts = require("../contexts"),
utils = require("../utils");
var Definition = function (name, params, rules, condition, variadic, frames, visibilityInfo) {
this.name = name;
this.selectors = [new Selector([new Element(null, name, this.index, this.currentFileInfo)])];
this.selectors = [new Selector([new Element(null, name, this._index, this._fileInfo)])];
this.params = params;

@@ -49,3 +50,3 @@ this.condition = condition;

varargs, arg,
params = this.params.slice(0),
params = utils.copyArray(this.params),
i, j, val, name, isNamedFound, argIndex, argsLength = 0;

@@ -59,3 +60,3 @@

if (args) {
args = args.slice(0);
args = utils.copyArray(args);
argsLength = args.length;

@@ -138,3 +139,3 @@

Definition.prototype.eval = function (context) {
return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || context.frames.slice(0));
return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || utils.copyArray(context.frames));
};

@@ -149,3 +150,3 @@ Definition.prototype.evalCall = function (context, args, important) {

rules = this.rules.slice(0);
rules = utils.copyArray(this.rules);

@@ -152,0 +153,0 @@ ruleset = new Ruleset(null, rules);

var Node = function() {
this.parent = null;
this.visibilityBlocks = undefined;
this.nodeVisible = undefined;
var self = this;
Object.defineProperty(this, "currentFileInfo", {
get: function() { return self.fileInfo(); }
});
Object.defineProperty(this, "index", {
get: function() { return self.getIndex(); }
});
};
Node.prototype.setParent = function(nodes, parent) {
function set(node) {
if (node && node instanceof Node) {
node.parent = parent;
}
}
if (Array.isArray(nodes)) {
nodes.forEach(set);
}
else {
set(nodes);
}
};
Node.prototype.getIndex = function() {
return this._index || (this.parent && this.parent.getIndex()) || 0;
};
Node.prototype.fileInfo = function() {
return this._fileInfo || (this.parent && this.parent.fileInfo()) || {};
};
Node.prototype.toCSS = function (context) {

@@ -4,0 +35,0 @@ var strs = [];

@@ -9,4 +9,4 @@ var Node = require("./node"),

this.quote = str.charAt(0);
this.index = index;
this.currentFileInfo = currentFileInfo;
this._index = index;
this._fileInfo = currentFileInfo;
};

@@ -17,3 +17,3 @@ Quoted.prototype = new JsEvalNode();

if (!this.escaped) {
output.add(this.quote, this.currentFileInfo, this.index);
output.add(this.quote, this.fileInfo(), this.getIndex());
}

@@ -34,3 +34,3 @@ output.add(this.value);

var interpolationReplacement = function (_, name) {
var v = new Variable('@' + name, that.index, that.currentFileInfo).eval(context, true);
var v = new Variable('@' + name, that.getIndex(), that.fileInfo()).eval(context, true);
return (v instanceof Quoted) ? v.value : v.toCSS();

@@ -48,3 +48,3 @@ };

value = iterativeReplace(value, /@\{([\w-]+)\}/g, interpolationReplacement);
return new Quoted(this.quote + value + this.quote, value, this.escaped, this.index, this.currentFileInfo);
return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo());
};

@@ -51,0 +51,0 @@ Quoted.prototype.compare = function (other) {

@@ -9,3 +9,4 @@ var Node = require("./node"),

defaultFunc = require("../functions/default"),
getDebugInfo = require("./debug-info");
getDebugInfo = require("./debug-info"),
utils = require("../utils");

@@ -19,2 +20,5 @@ var Ruleset = function (selectors, rules, strictImports, visibilityInfo) {

this.allowRoot = true;
this.setParent(this.selectors, this);
this.setParent(this.rules, this);
};

@@ -40,3 +44,3 @@ Ruleset.prototype = new Node();

if (thisSelectors && (selCnt = thisSelectors.length)) {
selectors = [];
selectors = new Array(selCnt);
defaultFunc.error({

@@ -48,3 +52,3 @@ type: "Syntax",

selector = thisSelectors[i].eval(context);
selectors.push(selector);
selectors[i] = selector;
if (selector.evaldCondition) {

@@ -59,3 +63,3 @@ hasOnePassingSelector = true;

var rules = this.rules ? this.rules.slice(0) : null,
var rules = this.rules ? utils.copyArray(this.rules) : null,
ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo()),

@@ -289,2 +293,3 @@ rule, subRule;

}
this.setParent(rule, this);
};

@@ -462,5 +467,5 @@ Ruleset.prototype.find = function (selector, self, filter) {

} else {
var insideParent = [];
var insideParent = new Array(elementsToPak.length);
for (j = 0; j < elementsToPak.length; j++) {
insideParent.push(new Element(null, elementsToPak[j], originalElement.index, originalElement.currentFileInfo));
insideParent[j] = new Element(null, elementsToPak[j], originalElement._index, originalElement._fileInfo);
}

@@ -474,3 +479,3 @@ replacementParen = new Paren(new Selector(insideParent));

var element, selector;
element = new Element(null, containedElement, originalElement.index, originalElement.currentFileInfo);
element = new Element(null, containedElement, originalElement._index, originalElement._fileInfo);
selector = new Selector([element]);

@@ -491,5 +496,5 @@ return selector;

if (beginningPath.length > 0) {
newSelectorPath = beginningPath.slice(0);
newSelectorPath = utils.copyArray(beginningPath);
lastSelector = newSelectorPath.pop();
newJoinedSelector = originalSelector.createDerived(lastSelector.elements.slice(0));
newJoinedSelector = originalSelector.createDerived(utils.copyArray(lastSelector.elements));
}

@@ -510,3 +515,3 @@ else {

// join the elements so far with the first part of the parent
newJoinedSelector.elements.push(new Element(combinator, parentEl.value, replacedElement.index, replacedElement.currentFileInfo));
newJoinedSelector.elements.push(new Element(combinator, parentEl.value, replacedElement._index, replacedElement._fileInfo));
newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1));

@@ -648,3 +653,3 @@ }

if (sel.length > 0) {
sel[0].elements.push(new Element(el.combinator, '', el.index, el.currentFileInfo));
sel[0].elements.push(new Element(el.combinator, '', el._index, el._fileInfo));
}

@@ -681,3 +686,2 @@ selectorsMultiplied.push(sel);

newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList);
//newSelectors[i][length - 1].copyVisibilityInfo(inSelector.visibilityInfo());
}

@@ -705,8 +709,3 @@ }

for (i = 0; i < context.length; i++) {
//var concatenated = [];
//context[i].forEach(function(entry) {
// var newEntry = entry.createDerived(entry.elements, entry.extendList, entry.evaldCondition);
// newEntry.copyVisibilityInfo(selector.visibilityInfo());
// concatenated.push(newEntry);
//}, this);
var concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo()));

@@ -713,0 +712,0 @@

@@ -8,3 +8,4 @@ var Node = require("./node"),

this.condition = condition;
this.currentFileInfo = currentFileInfo || {};
this._index = index;
this._fileInfo = currentFileInfo;
if (!condition) {

@@ -14,2 +15,3 @@ this.evaldCondition = true;

this.copyVisibilityInfo(visibilityInfo);
this.setParent(this.elements, this);
};

@@ -32,3 +34,3 @@ Selector.prototype = new Node();

evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition;
var newSelector = new Selector(elements, extendList || this.extendList, null, this.index, this.currentFileInfo, info);
var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), info);
newSelector.evaldCondition = evaldCondition;

@@ -39,4 +41,4 @@ newSelector.mediaEmpty = this.mediaEmpty;

Selector.prototype.createEmptySelectors = function() {
var el = new Element('', '&', this.index, this.currentFileInfo),
sels = [new Selector([el], null, null, this.index, this.currentFileInfo)];
var el = new Element('', '&', this._index, this._fileInfo),
sels = [new Selector([el], null, null, this._index, this._fileInfo)];
sels[0].mediaEmpty = true;

@@ -102,3 +104,3 @@ return sels;

if ((!context || !context.firstSelector) && this.elements[0].combinator.value === "") {
output.add(' ', this.currentFileInfo, this.index);
output.add(' ', this.fileInfo(), this.getIndex());
}

@@ -105,0 +107,0 @@ if (!this._css) {

var Node = require("./node"),
unitConversions = require("../data/unit-conversions");
unitConversions = require("../data/unit-conversions"),
utils = require("../utils");
var Unit = function (numerator, denominator, backupUnit) {
this.numerator = numerator ? numerator.slice(0).sort() : [];
this.denominator = denominator ? denominator.slice(0).sort() : [];
this.numerator = numerator ? utils.copyArray(numerator).sort() : [];
this.denominator = denominator ? utils.copyArray(denominator).sort() : [];
if (backupUnit) {

@@ -17,3 +18,3 @@ this.backupUnit = backupUnit;

Unit.prototype.clone = function () {
return new Unit(this.numerator.slice(0), this.denominator.slice(0), this.backupUnit);
return new Unit(utils.copyArray(this.numerator), utils.copyArray(this.denominator), this.backupUnit);
};

@@ -20,0 +21,0 @@ Unit.prototype.genCSS = function (context, output) {

@@ -5,4 +5,4 @@ var Node = require("./node");

this.value = val;
this.currentFileInfo = currentFileInfo;
this.index = index;
this._index = index;
this._fileInfo = currentFileInfo;
this.isEvald = isEvald;

@@ -26,3 +26,3 @@ };

// Add the base path if the URL is relative
rootpath = this.currentFileInfo && this.currentFileInfo.rootpath;
rootpath = this.fileInfo() && this.fileInfo().rootpath;
if (rootpath &&

@@ -54,4 +54,4 @@ typeof val.value === "string" &&

return new URL(val, this.index, this.currentFileInfo, true);
return new URL(val, this.getIndex(), this.fileInfo(), true);
};
module.exports = URL;

@@ -5,4 +5,4 @@ var Node = require("./node");

this.name = name;
this.index = index;
this.currentFileInfo = currentFileInfo || {};
this._index = index;
this._fileInfo = currentFileInfo;
};

@@ -15,3 +15,3 @@ Variable.prototype = new Node();

if (name.indexOf('@@') === 0) {
name = '@' + new Variable(name.slice(1), this.index, this.currentFileInfo).eval(context).value;
name = '@' + new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value;
}

@@ -22,4 +22,4 @@

message: "Recursive variable definition for " + name,
filename: this.currentFileInfo.filename,
index: this.index };
filename: this.fileInfo().filename,
index: this.getIndex() };
}

@@ -45,4 +45,4 @@

message: "variable " + name + " is undefined",
filename: this.currentFileInfo.filename,
index: this.index };
filename: this.fileInfo().filename,
index: this.getIndex() };
}

@@ -49,0 +49,0 @@ };

@@ -19,3 +19,12 @@ module.exports = {

};
},
copyArray: function(arr) {
var i, length = arr.length,
copy = new Array(length);
for (i = 0; i < length; i++) {
copy[i] = arr[i];
}
return copy;
}
};
var tree = require("../tree"),
Visitor = require("./visitor"),
logger = require("../logger");
logger = require("../logger"),
utils = require("../utils");

@@ -49,3 +50,3 @@ /*jshint loopfunc:true */

extendList = selExtendList ? selExtendList.slice(0).concat(allSelectorsExtendList)
extendList = selExtendList ? utils.copyArray(selExtendList).concat(allSelectorsExtendList)
: allSelectorsExtendList;

@@ -170,3 +171,3 @@

// but now we create a new extend from it
newExtend = new(tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.currentFileInfo, info);
newExtend = new(tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.fileInfo(), info);
newExtend.selfSelectors = newSelector;

@@ -389,4 +390,4 @@

replacementSelector.elements[0].value,
replacementSelector.elements[0].index,
replacementSelector.elements[0].currentFileInfo
replacementSelector.elements[0].getIndex(),
replacementSelector.elements[0].fileInfo()
);

@@ -393,0 +394,0 @@

var contexts = require("../contexts"),
Visitor = require("./visitor"),
ImportSequencer = require("./import-sequencer");
ImportSequencer = require("./import-sequencer"),
utils = require("../utils");

@@ -42,3 +43,3 @@ var ImportVisitor = function(importer, finish) {

var context = new contexts.Eval(this.context, this.context.frames.slice(0));
var context = new contexts.Eval(this.context, utils.copyArray(this.context.frames));
var importParent = context.frames[0];

@@ -62,3 +63,3 @@

} catch(e) {
if (!e.filename) { e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; }
if (!e.filename) { e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename; }
// attempt to eval properly and treat as css

@@ -89,3 +90,3 @@ importNode.css = true;

this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.currentFileInfo,
this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(),
evaldImportNode.options, sequencedOnImported);

@@ -102,3 +103,3 @@ } else {

if (!e.filename) {
e.index = importNode.index; e.filename = importNode.currentFileInfo.filename;
e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename;
}

@@ -105,0 +106,0 @@ this.error = e;

@@ -210,11 +210,11 @@ var tree = require("../tree"),

throw { message: "Properties must be inside selector blocks. They cannot be in the root",
index: ruleNode.index, filename: ruleNode.currentFileInfo && ruleNode.currentFileInfo.filename};
index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename};
}
if (ruleNode instanceof tree.Call) {
throw { message: "Function '" + ruleNode.name + "' is undefined",
index: ruleNode.index, filename: ruleNode.currentFileInfo && ruleNode.currentFileInfo.filename};
index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename};
}
if (ruleNode.type && !ruleNode.allowRoot) {
throw { message: ruleNode.type + " node returned by a function is not valid here",
index: ruleNode.index, filename: ruleNode.currentFileInfo && ruleNode.currentFileInfo.filename};
index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename};
}

@@ -221,0 +221,0 @@ }

{
"name": "less",
"version": "3.0.0-pre.1",
"version": "3.0.0-pre.2",
"description": "Leaner CSS",

@@ -5,0 +5,0 @@ "homepage": "http://lesscss.org",

functions.addMultiple({
"test-transitive" : function() {
return new tree.Anonymous( "transitive" );
var anon = new tree.Anonymous( "transitive" );
return anon;
}
});
functions.addMultiple({
"test-transitive" : function() {
return new tree.Anonymous( "transitive" );
var anon = new tree.Anonymous( "transitive" );
return anon;
}
});

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

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