"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/less/dist/less.js" between
less.js-4.1.2.tar.gz and less.js-4.1.3.tar.gz

About: Less.js (Leaner CSS) is a CSS preprocessor (extension language) adding features that allow variables, mixins, functions and many other techniques that allow you to make CSS that is more maintainable, themable and extendable.

less.js  (less.js-4.1.2):less.js  (less.js-4.1.3)
/** /**
* Less - Leaner CSS v4.1.2 * Less - Leaner CSS v4.1.3
* http://lesscss.org * http://lesscss.org
* *
* Copyright (c) 2009-2021, Alexis Sellier <self@cloudhead.net> * Copyright (c) 2009-2022, Alexis Sellier <self@cloudhead.net>
* Licensed under the Apache-2.0 License. * Licensed under the Apache-2.0 License.
* *
* @license Apache-2.0 * @license Apache-2.0
*/ */
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.export s = factory() : typeof exports === 'object' && typeof module !== 'undefined' ? module.export s = factory() :
typeof define === 'function' && define.amd ? define(factory) : typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, g lobal.less = factory()); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, g lobal.less = factory());
}(this, (function () { 'use strict'; }(this, (function () { 'use strict';
skipping to change at line 83 skipping to change at line 83
function extractId(href) { function extractId(href) {
return href.replace(/^[a-z-]+:\/+?[^\/]+/, '') // Remove protocol & doma in return href.replace(/^[a-z-]+:\/+?[^\/]+/, '') // Remove protocol & doma in
.replace(/[\?\&]livereload=\w+/, '') // Remove LiveReload cachebuste r .replace(/[\?\&]livereload=\w+/, '') // Remove LiveReload cachebuste r
.replace(/^\//, '') // Remove root / .replace(/^\//, '') // Remove root /
.replace(/\.[a-zA-Z]+$/, '') // Remove simple extension .replace(/\.[a-zA-Z]+$/, '') // Remove simple extension
.replace(/[^\.\w-]+/g, '-') // Replace illegal characters .replace(/[^\.\w-]+/g, '-') // Replace illegal characters
.replace(/\./g, ':'); // Replace dots with colons(for valid id) .replace(/\./g, ':'); // Replace dots with colons(for valid id)
} }
function addDataAttr(options, tag) { function addDataAttr(options, tag) {
if (!tag) {
return;
} // in case of tag is null or undefined
for (var opt in tag.dataset) { for (var opt in tag.dataset) {
if (tag.dataset.hasOwnProperty(opt)) { if (tag.dataset.hasOwnProperty(opt)) {
if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootp ath' || opt === 'errorReporting') { if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootp ath' || opt === 'errorReporting') {
options[opt] = tag.dataset[opt]; options[opt] = tag.dataset[opt];
} }
else { else {
try { try {
options[opt] = JSON.parse(tag.dataset[opt]); options[opt] = JSON.parse(tag.dataset[opt]);
} }
catch (_) { } catch (_) { }
skipping to change at line 1602 skipping to change at line 1605
if (mathBypass) { if (mathBypass) {
context.math = prevMath; context.math = prevMath;
} }
} }
}, },
makeImportant: function () { makeImportant: function () {
return new Declaration(this.name, this.value, '!important', this.mer ge, this.getIndex(), this.fileInfo(), this.inline); return new Declaration(this.name, this.value, '!important', this.mer ge, this.getIndex(), this.fileInfo(), this.inline);
} }
}); });
var debugInfo = /** @class */ (function () { function asComment(ctx) {
function debugInfo(context, ctx, lineSeparator) { return "/* line " + ctx.debugInfo.lineNumber + ", " + ctx.debugInfo.file
var result = ''; Name + " */\n";
if (context.dumpLineNumbers && !context.compress) { }
switch (context.dumpLineNumbers) { function asMediaQuery(ctx) {
case 'comments': var filenameWithProtocol = ctx.debugInfo.fileName;
result = debugInfo.asComment(ctx); if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
break; filenameWithProtocol = "file://" + filenameWithProtocol;
case 'mediaquery': }
result = debugInfo.asMediaQuery(ctx); return "@media -sass-debug-info{filename{font-family:" + filenameWithPro
break; tocol.replace(/([.:\/\\])/g, function (a) {
case 'all': if (a == '\\') {
result = debugInfo.asComment(ctx) + (lineSeparator || '' a = '\/';
) + debugInfo.asMediaQuery(ctx); }
break; return "\\" + a;
} }) + "}line{font-family:\\00003" + ctx.debugInfo.lineNumber + "}}\n";
}
function debugInfo(context, ctx, lineSeparator) {
var result = '';
if (context.dumpLineNumbers && !context.compress) {
switch (context.dumpLineNumbers) {
case 'comments':
result = asComment(ctx);
break;
case 'mediaquery':
result = asMediaQuery(ctx);
break;
case 'all':
result = asComment(ctx) + (lineSeparator || '') + asMediaQue
ry(ctx);
break;
} }
return result;
} }
debugInfo.asComment = function (ctx) { return result;
return "/* line " + ctx.debugInfo.lineNumber + ", " + ctx.debugInfo. }
fileName + " */\n";
};
debugInfo.asMediaQuery = function (ctx) {
var filenameWithProtocol = ctx.debugInfo.fileName;
if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
filenameWithProtocol = "file://" + filenameWithProtocol;
}
return "@media -sass-debug-info{filename{font-family:" + filenameWit
hProtocol.replace(/([.:\/\\])/g, function (a) {
if (a == '\\') {
a = '\/';
}
return "\\" + a;
}) + "}line{font-family:\\00003" + ctx.debugInfo.lineNumber + "}}\n"
;
};
return debugInfo;
}());
var Comment = function (value, isLineComment, index, currentFileInfo) { var Comment = function (value, isLineComment, index, currentFileInfo) {
this.value = value; this.value = value;
this.isLineComment = isLineComment; this.isLineComment = isLineComment;
this._index = index; this._index = index;
this._fileInfo = currentFileInfo; this._fileInfo = currentFileInfo;
this.allowRoot = true; this.allowRoot = true;
}; };
Comment.prototype = Object.assign(new Node(), { Comment.prototype = Object.assign(new Node(), {
type: 'Comment', type: 'Comment',
skipping to change at line 3390 skipping to change at line 3390
for (var i = 0, r = void 0; i < obj.length; i++) { for (var i = 0, r = void 0; i < obj.length; i++) {
r = fun.call(obj, obj[i]); r = fun.call(obj, obj[i]);
if (r) { if (r) {
return r; return r;
} }
} }
return null; return null;
} }
}); });
var Attribute = function (key, op, value) { var Attribute = function (key, op, value, cif) {
this.key = key; this.key = key;
this.op = op; this.op = op;
this.value = value; this.value = value;
this.cif = cif;
}; };
Attribute.prototype = Object.assign(new Node(), { Attribute.prototype = Object.assign(new Node(), {
type: 'Attribute', type: 'Attribute',
eval: function (context) { eval: function (context) {
return new Attribute(this.key.eval ? this.key.eval(context) : this.k ey, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.v alue); return new Attribute(this.key.eval ? this.key.eval(context) : this.k ey, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.v alue, this.cif);
}, },
genCSS: function (context, output) { genCSS: function (context, output) {
output.add(this.toCSS(context)); output.add(this.toCSS(context));
}, },
toCSS: function (context) { toCSS: function (context) {
var value = this.key.toCSS ? this.key.toCSS(context) : this.key; var value = this.key.toCSS ? this.key.toCSS(context) : this.key;
if (this.op) { if (this.op) {
value += this.op; value += this.op;
value += (this.value.toCSS ? this.value.toCSS(context) : this.va lue); value += (this.value.toCSS ? this.value.toCSS(context) : this.va lue);
} }
if (this.cif) {
value = value + " " + this.cif;
}
return "[" + value + "]"; return "[" + value + "]";
} }
}); });
var Quoted = function (str, content, escaped, index, currentFileInfo) { var Quoted = function (str, content, escaped, index, currentFileInfo) {
this.escaped = (escaped == null) ? true : escaped; this.escaped = (escaped == null) ? true : escaped;
this.value = content || ''; this.value = content || '';
this.quote = str.charAt(0); this.quote = str.charAt(0);
this._index = index; this._index = index;
this._fileInfo = currentFileInfo; this._fileInfo = currentFileInfo;
skipping to change at line 6657 skipping to change at line 6661
fileInfo: fileInfo, fileInfo: fileInfo,
parseNode: parseNode, parseNode: parseNode,
// //
// Parse an input string into an abstract syntax tree, // Parse an input string into an abstract syntax tree,
// @param str A string containing 'less' markup // @param str A string containing 'less' markup
// @param callback call `callback` when done. // @param callback call `callback` when done.
// @param [additionalData] An optional map which can contains vars - a map (key, value) of variables to apply // @param [additionalData] An optional map which can contains vars - a map (key, value) of variables to apply
// //
parse: function (str, callback, additionalData) { parse: function (str, callback, additionalData) {
var root; var root;
var error = null; var err = null;
var globalVars; var globalVars;
var modifyVars; var modifyVars;
var ignored; var ignored;
var preText = ''; var preText = '';
// Optionally disable @plugin parsing
if (additionalData && additionalData.disablePluginRule) {
parsers.plugin = function () {
var dir = parserInput.$re(/^@plugin?\s+/);
if (dir) {
error('@plugin statements are not allowed when disab
lePluginRule is set to true');
}
};
}
globalVars = (additionalData && additionalData.globalVars) ? Par ser.serializeVars(additionalData.globalVars) + "\n" : ''; globalVars = (additionalData && additionalData.globalVars) ? Par ser.serializeVars(additionalData.globalVars) + "\n" : '';
modifyVars = (additionalData && additionalData.modifyVars) ? "\n " + Parser.serializeVars(additionalData.modifyVars) : ''; modifyVars = (additionalData && additionalData.modifyVars) ? "\n " + Parser.serializeVars(additionalData.modifyVars) : '';
if (context.pluginManager) { if (context.pluginManager) {
var preProcessors = context.pluginManager.getPreProcessors() ; var preProcessors = context.pluginManager.getPreProcessors() ;
for (var i = 0; i < preProcessors.length; i++) { for (var i = 0; i < preProcessors.length; i++) {
str = preProcessors[i].process(str, { context: context, imports: imports, fileInfo: fileInfo }); str = preProcessors[i].process(str, { context: context, imports: imports, fileInfo: fileInfo });
} }
} }
if (globalVars || (additionalData && additionalData.banner)) { if (globalVars || (additionalData && additionalData.banner)) {
preText = ((additionalData && additionalData.banner) ? addit ionalData.banner : '') + globalVars; preText = ((additionalData && additionalData.banner) ? addit ionalData.banner : '') + globalVars;
skipping to change at line 6726 skipping to change at line 6739
if (endInfo.furthestChar === '}') { if (endInfo.furthestChar === '}') {
message += '. Possibly missing opening \'{\''; message += '. Possibly missing opening \'{\'';
} }
else if (endInfo.furthestChar === ')') { else if (endInfo.furthestChar === ')') {
message += '. Possibly missing opening \'(\''; message += '. Possibly missing opening \'(\'';
} }
else if (endInfo.furthestReachedEnd) { else if (endInfo.furthestReachedEnd) {
message += '. Possibly missing something'; message += '. Possibly missing something';
} }
} }
error = new LessError({ err = new LessError({
type: 'Parse', type: 'Parse',
message: message, message: message,
index: endInfo.furthest, index: endInfo.furthest,
filename: fileInfo.filename filename: fileInfo.filename
}, imports); }, imports);
} }
var finish = function (e) { var finish = function (e) {
e = error || e || imports.error; e = err || e || imports.error;
if (e) { if (e) {
if (!(e instanceof LessError)) { if (!(e instanceof LessError)) {
e = new LessError(e, imports, fileInfo.filename); e = new LessError(e, imports, fileInfo.filename);
} }
return callback(e); return callback(e);
} }
else { else {
return callback(null, root); return callback(null, root);
} }
}; };
skipping to change at line 7811 skipping to change at line 7824
return selectors; return selectors;
}, },
attribute: function () { attribute: function () {
if (!parserInput.$char('[')) { if (!parserInput.$char('[')) {
return; return;
} }
var entities = this.entities; var entities = this.entities;
var key; var key;
var val; var val;
var op; var op;
//
// case-insensitive flag
// e.g. [attr operator value i]
//
var cif;
if (!(key = entities.variableCurly())) { if (!(key = entities.variableCurly())) {
key = expect(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\ \.)+/); key = expect(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\ \.)+/);
} }
op = parserInput.$re(/^[|~*$^]?=/); op = parserInput.$re(/^[|~*$^]?=/);
if (op) { if (op) {
val = entities.quoted() || parserInput.$re(/^[0-9]+%/) | | parserInput.$re(/^[\w-]+/) || entities.variableCurly(); val = entities.quoted() || parserInput.$re(/^[0-9]+%/) | | parserInput.$re(/^[\w-]+/) || entities.variableCurly();
if (val) {
cif = parserInput.$re(/^[iIsS]/);
}
} }
expectChar(']'); expectChar(']');
return new (tree.Attribute)(key, op, val); return new (tree.Attribute)(key, op, val, cif);
}, },
// //
// The `block` rule is used by `ruleset` and `mixin.definition`. // The `block` rule is used by `ruleset` and `mixin.definition`.
// It's a wrapper around the `primary` rule, with added `{}`. // It's a wrapper around the `primary` rule, with added `{}`.
// //
block: function () { block: function () {
var content; var content;
if (parserInput.$char('{') && (content = this.primary()) && parserInput.$char('}')) { if (parserInput.$char('{') && (content = this.primary()) && parserInput.$char('}')) {
return content; return content;
} }
skipping to change at line 8066 skipping to change at line 8087
// //
// Depending on our environment, importing is done differently: // Depending on our environment, importing is done differently:
// In the browser, it's an XHR request, in Node, it would be a // In the browser, it's an XHR request, in Node, it would be a
// file-system operation. The function used for importing is // file-system operation. The function used for importing is
// stored in `import`, which we pass to the Import constructor. // stored in `import`, which we pass to the Import constructor.
// //
'import': function () { 'import': function () {
var path; var path;
var features; var features;
var index = parserInput.i; var index = parserInput.i;
var dir = parserInput.$re(/^@import?\s+/); var dir = parserInput.$re(/^@import\s+/);
if (dir) { if (dir) {
var options = (dir ? this.importOptions() : null) || {}; var options = (dir ? this.importOptions() : null) || {};
if ((path = this.entities.quoted() || this.entities.url( ))) { if ((path = this.entities.quoted() || this.entities.url( ))) {
features = this.mediaFeatures(); features = this.mediaFeatures();
if (!parserInput.$char(';')) { if (!parserInput.$char(';')) {
parserInput.i = index; parserInput.i = index;
error('missing semi-colon or unrecognised media features on import'); error('missing semi-colon or unrecognised media features on import');
} }
features = features && new (tree.Value)(features); features = features && new (tree.Value)(features);
return new (tree.Import)(path, features, options, in dex, fileInfo); return new (tree.Import)(path, features, options, in dex, fileInfo);
skipping to change at line 8217 skipping to change at line 8238
// //
// A @plugin directive, used to import plugins dynamically. // A @plugin directive, used to import plugins dynamically.
// //
// @plugin (args) "lib"; // @plugin (args) "lib";
// //
plugin: function () { plugin: function () {
var path; var path;
var args; var args;
var options; var options;
var index = parserInput.i; var index = parserInput.i;
var dir = parserInput.$re(/^@plugin?\s+/); var dir = parserInput.$re(/^@plugin\s+/);
if (dir) { if (dir) {
args = this.pluginArgs(); args = this.pluginArgs();
if (args) { if (args) {
options = { options = {
pluginArgs: args, pluginArgs: args,
isPlugin: true isPlugin: true
}; };
} }
else { else {
options = { isPlugin: true }; options = { isPlugin: true };
skipping to change at line 10578 skipping to change at line 10599
catch (err) { catch (err) {
return callback(err); return callback(err);
} }
callback(null, result); callback(null, result);
}); });
} }
}; };
return render; return render;
} }
var version = "4.1.2"; var version = "4.1.3";
function parseNodeVersion(version) { function parseNodeVersion(version) {
var match = version.match(/^v(\d{1,2})\.(\d{1,2})\.(\d{1,2})(?:-([0-9A-Za- z-.]+))?(?:\+([0-9A-Za-z-.]+))?$/); // eslint-disable-line max-len var match = version.match(/^v(\d{1,2})\.(\d{1,2})\.(\d{1,2})(?:-([0-9A-Za- z-.]+))?(?:\+([0-9A-Za-z-.]+))?$/); // eslint-disable-line max-len
if (!match) { if (!match) {
throw new Error('Unable to parse: ' + version); throw new Error('Unable to parse: ' + version);
} }
var res = { var res = {
major: parseInt(match[1], 10), major: parseInt(match[1], 10),
minor: parseInt(match[2], 10), minor: parseInt(match[2], 10),
 End of changes. 20 change blocks. 
48 lines changed or deleted 69 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)