Socket
Socket
Sign inDemoInstall

less

Package Overview
Dependencies
Maintainers
7
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.12.0 to 3.12.1-alpha.13

test/test-es6.ts

9

Gruntfile.js

@@ -193,5 +193,6 @@ "use strict";

const nodeVersion = semver.major(process.versions.node);
const tsNodeRuntime = path.resolve(path.join('node_modules', '.bin', 'ts-node'));
let scriptRuntime = 'node';
if (nodeVersion < 8) {
scriptRuntime = path.resolve(path.join('node_modules', '.bin', 'ts-node'));
scriptRuntime = tsNodeRuntime;
}

@@ -232,3 +233,6 @@

test: {
command: "node test/index.js"
command: [
tsNodeRuntime + " test/test-es6.ts",
"node test/index.js"
].join(' && ')
},

@@ -252,2 +256,3 @@ generatebrowser: {

// CURRENT OPTIONS
`node bin/lessc --ie-compat ${lessFolder}/_main/lazy-eval.less tmp/lazy-eval.css`,
// --math

@@ -254,0 +259,0 @@ `node bin/lessc --math=always ${lessFolder}/_main/lazy-eval.less tmp/lazy-eval.css`,

@@ -10,20 +10,16 @@ "use strict";

var less_1 = __importDefault(require("../less"));
var less = less_1.default(environment_1.default, [new file_manager_1.default(), new url_file_manager_1.default()]);
var lessc_helper_1 = __importDefault(require("./lessc-helper"));
var plugin_loader_1 = __importDefault(require("./plugin-loader"));
var fs_1 = __importDefault(require("./fs"));
var default_options_1 = __importDefault(require("../less/default-options"));
var image_size_1 = __importDefault(require("./image-size"));
var less = less_1.default(environment_1.default, [new file_manager_1.default(), new url_file_manager_1.default()]);
// allow people to create less with their own environment
less.createFromEnvironment = less_1.default;
less.lesscHelper = lessc_helper_1.default;
less.PluginLoader = plugin_loader_1.default;
less.fs = fs_1.default;
less.PluginLoader = require('./plugin-loader').default;
less.fs = require('./fs').default;
less.FileManager = file_manager_1.default;
less.UrlFileManager = url_file_manager_1.default;
// Set up options
less.options = default_options_1.default();
less.options = require('../less/default-options').default();
// provide image-size functionality
image_size_1.default(less.environment);
require('./image-size').default(less.environment);
exports.default = less;
//# sourceMappingURL=index.js.map

@@ -47,8 +47,9 @@ "use strict";

var urlStr = isUrlRe.test(filename) ? filename : url_1.default.resolve(currentDirectory, filename);
var urlObj = url_1.default.parse(urlStr);
if (!urlObj.protocol) {
urlObj.protocol = 'http';
urlStr = urlObj.format();
}
request.get({ uri: urlStr, strictSSL: !options.insecure }, function (error, res, body) {
/** native-request currently has a bug */
var hackUrlStr = urlStr.indexOf('?') === -1 ? urlStr + '?' : urlStr;
request.get(hackUrlStr, function (error, body, status) {
if (status === 404) {
reject({ type: 'File', message: "resource '" + urlStr + "' was not found\n" });
return;
}
if (error) {

@@ -58,8 +59,4 @@ reject({ type: 'File', message: "resource '" + urlStr + "' gave this Error:\n " + error + "\n" });

}
if (res && res.statusCode === 404) {
reject({ type: 'File', message: "resource '" + urlStr + "' was not found\n" });
return;
}
if (!body) {
logger_1.default.warn("Warning: Empty body (HTTP " + res.statusCode + ") returned by \"" + urlStr + "\"");
logger_1.default.warn("Warning: Empty body (HTTP " + status + ") returned by \"" + urlStr + "\"");
}

@@ -66,0 +63,0 @@ fulfill({ contents: body, filename: urlStr });

@@ -8,3 +8,2 @@ "use strict";

PARENS: 2,
STRICT_LEGACY: 3
};

@@ -11,0 +10,0 @@ exports.RewriteUrls = {

@@ -65,2 +65,3 @@ "use strict";

'compress',
'ieCompat',
'math',

@@ -76,2 +77,87 @@ 'strictUnits',

];
contexts.Eval = function (options, frames) {
copyFromOriginal(options, this, evalCopyProperties);
if (typeof this.paths === 'string') {
this.paths = [this.paths];
}
this.frames = frames || [];
this.importantScope = this.importantScope || [];
};
contexts.Eval.prototype.enterCalc = function () {
if (!this.calcStack) {
this.calcStack = [];
}
this.calcStack.push(true);
this.inCalc = true;
};
contexts.Eval.prototype.exitCalc = function () {
this.calcStack.pop();
if (!this.calcStack.length) {
this.inCalc = false;
}
};
contexts.Eval.prototype.inParenthesis = function () {
if (!this.parensStack) {
this.parensStack = [];
}
this.parensStack.push(true);
};
contexts.Eval.prototype.outOfParenthesis = function () {
this.parensStack.pop();
};
contexts.Eval.prototype.inCalc = false;
contexts.Eval.prototype.mathOn = true;
contexts.Eval.prototype.isMathOn = function (op) {
if (!this.mathOn) {
return false;
}
if (op === '/' && this.math !== Constants.Math.ALWAYS && (!this.parensStack || !this.parensStack.length)) {
return false;
}
if (this.math > Constants.Math.PARENS_DIVISION) {
return this.parensStack && this.parensStack.length;
}
return true;
};
contexts.Eval.prototype.pathRequiresRewrite = function (path) {
var isRelative = this.rewriteUrls === Constants.RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative;
return isRelative(path);
};
contexts.Eval.prototype.rewritePath = function (path, rootpath) {
var newPath;
rootpath = rootpath || '';
newPath = this.normalizePath(rootpath + path);
// If a path was explicit relative and the rootpath was not an absolute path
// we must ensure that the new path is also explicit relative.
if (isPathLocalRelative(path) &&
isPathRelative(rootpath) &&
isPathLocalRelative(newPath) === false) {
newPath = "./" + newPath;
}
return newPath;
};
contexts.Eval.prototype.normalizePath = function (path) {
var segments = path.split('/').reverse();
var segment;
path = [];
while (segments.length !== 0) {
segment = segments.pop();
switch (segment) {
case '.':
break;
case '..':
if ((path.length === 0) || (path[path.length - 1] === '..')) {
path.push(segment);
}
else {
path.pop();
}
break;
default:
path.push(segment);
break;
}
}
return path.join('/');
};
function isPathRelative(path) {

@@ -83,92 +169,3 @@ return !/^(?:[a-z-]+:|\/|#)/i.test(path);

}
contexts.Eval = /** @class */ (function () {
function Eval(options, frames) {
copyFromOriginal(options, this, evalCopyProperties);
if (typeof this.paths === 'string') {
this.paths = [this.paths];
}
this.frames = frames || [];
this.importantScope = this.importantScope || [];
this.inCalc = false;
this.mathOn = true;
}
Eval.prototype.enterCalc = function () {
if (!this.calcStack) {
this.calcStack = [];
}
this.calcStack.push(true);
this.inCalc = true;
};
Eval.prototype.exitCalc = function () {
this.calcStack.pop();
if (!this.calcStack.length) {
this.inCalc = false;
}
};
Eval.prototype.inParenthesis = function () {
if (!this.parensStack) {
this.parensStack = [];
}
this.parensStack.push(true);
};
;
Eval.prototype.outOfParenthesis = function () {
this.parensStack.pop();
};
;
Eval.prototype.isMathOn = function (op) {
if (!this.mathOn) {
return false;
}
if (op === '/' && this.math !== Constants.Math.ALWAYS && (!this.parensStack || !this.parensStack.length)) {
return false;
}
if (this.math > Constants.Math.PARENS_DIVISION) {
return this.parensStack && this.parensStack.length;
}
return true;
};
Eval.prototype.pathRequiresRewrite = function (path) {
var isRelative = this.rewriteUrls === Constants.RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative;
return isRelative(path);
};
Eval.prototype.rewritePath = function (path, rootpath) {
var newPath;
rootpath = rootpath || '';
newPath = this.normalizePath(rootpath + path);
// If a path was explicit relative and the rootpath was not an absolute path
// we must ensure that the new path is also explicit relative.
if (isPathLocalRelative(path) &&
isPathRelative(rootpath) &&
isPathLocalRelative(newPath) === false) {
newPath = "./" + newPath;
}
return newPath;
};
Eval.prototype.normalizePath = function (path) {
var segments = path.split('/').reverse();
var segment;
path = [];
while (segments.length !== 0) {
segment = segments.pop();
switch (segment) {
case '.':
break;
case '..':
if ((path.length === 0) || (path[path.length - 1] === '..')) {
path.push(segment);
}
else {
path.pop();
}
break;
default:
path.push(segment);
break;
}
}
return path.join('/');
};
return Eval;
}());
// todo - do the same for the toCSS ?
//# sourceMappingURL=contexts.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Export a new default each time
exports.default = (function () { return ({
/* Inline Javascript - @plugin still allowed */
javascriptEnabled: false,
/* Outputs a makefile import dependency list to stdout. */
depends: false,
/* (DEPRECATED) Compress using less built-in compression.
* This does an okay job but does not utilise all the tricks of
* dedicated css compression. */
compress: false,
/* Runs the less parser and just reports errors without any output. */
lint: false,
/* Sets available include paths.
* If the file in an @import rule does not exist at that exact location,
* less will look for it at the location(s) passed to this option.
* You might use this for instance to specify a path to a library which
* you want to be referenced simply and relatively in the less files. */
paths: [],
/* color output in the terminal */
color: true,
/* The strictImports controls whether the compiler will allow an @import inside of either
* @media blocks or (a later addition) other selector blocks.
* See: https://github.com/less/less.js/issues/656 */
strictImports: false,
/* Allow Imports from Insecure HTTPS Hosts */
insecure: false,
/* Allows you to add a path to every generated import and url in your css.
* This does not affect less import statements that are processed, just ones
* that are left in the output css. */
rootpath: '',
/* By default URLs are kept as-is, so if you import a file in a sub-directory
* that references an image, exactly the same URL will be output in the css.
* This option allows you to re-write URL's in imported files so that the
* URL is always relative to the base imported file */
rewriteUrls: false,
/* How to process math
* 0 always - eagerly try to solve all operations
* 1 parens-division - require parens for division "/"
* 2 parens | strict - require parens for all operations
* 3 strict-legacy - legacy strict behavior (super-strict)
*/
math: 0,
/* Without this option, less attempts to guess at the output unit when it does maths. */
strictUnits: false,
/* Effectively the declaration is put at the top of your base Less file,
* meaning it can be used but it also can be overridden if this variable
* is defined in the file. */
globalVars: null,
/* As opposed to the global variable option, this puts the declaration at the
* end of your base file, meaning it will override anything defined in your Less file. */
modifyVars: null,
/* This option allows you to specify a argument to go on to every URL. */
urlArgs: ''
}); });
function default_1() {
return {
/* Inline Javascript - @plugin still allowed */
javascriptEnabled: false,
/* Outputs a makefile import dependency list to stdout. */
depends: false,
/* (DEPRECATED) Compress using less built-in compression.
* This does an okay job but does not utilise all the tricks of
* dedicated css compression. */
compress: false,
/* Runs the less parser and just reports errors without any output. */
lint: false,
/* Sets available include paths.
* If the file in an @import rule does not exist at that exact location,
* less will look for it at the location(s) passed to this option.
* You might use this for instance to specify a path to a library which
* you want to be referenced simply and relatively in the less files. */
paths: [],
/* color output in the terminal */
color: true,
/* The strictImports controls whether the compiler will allow an @import inside of either
* @media blocks or (a later addition) other selector blocks.
* See: https://github.com/less/less.js/issues/656 */
strictImports: false,
/* Allow Imports from Insecure HTTPS Hosts */
insecure: false,
/* Allows you to add a path to every generated import and url in your css.
* This does not affect less import statements that are processed, just ones
* that are left in the output css. */
rootpath: '',
/* By default URLs are kept as-is, so if you import a file in a sub-directory
* that references an image, exactly the same URL will be output in the css.
* This option allows you to re-write URL's in imported files so that the
* URL is always relative to the base imported file */
rewriteUrls: false,
/* How to process math
* 0 always - eagerly try to solve all operations
* 1 parens-division - require parens for division "/"
* 2 parens | strict - require parens for all operations
* 3 strict-legacy - legacy strict behavior (super-strict)
*/
math: 1,
/* Without this option, less attempts to guess at the output unit when it does maths. */
strictUnits: false,
/* Effectively the declaration is put at the top of your base Less file,
* meaning it can be used but it also can be overridden if this variable
* is defined in the file. */
globalVars: null,
/* As opposed to the global variable option, this puts the declaration at the
* end of your base file, meaning it will override anything defined in your Less file. */
modifyVars: null,
/* This option allows you to specify a argument to go on to every URL. */
urlArgs: ''
};
}
exports.default = default_1;
;
//# sourceMappingURL=default-options.js.map

@@ -26,5 +26,8 @@ "use strict";

};
;
AbstractFileManager.prototype.supportsSync = function () { return false; };
AbstractFileManager.prototype.alwaysMakePathsAbsolute = function () { return false; };
AbstractFileManager.prototype.supportsSync = function () {
return false;
};
AbstractFileManager.prototype.alwaysMakePathsAbsolute = function () {
return false;
};
AbstractFileManager.prototype.isPathAbsolute = function (filename) {

@@ -40,3 +43,2 @@ return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename);

};
;
AbstractFileManager.prototype.pathDiff = function (url, baseUrl) {

@@ -70,3 +72,2 @@ // diff between two paths to create a relative path

};
;
// helper function, not part of API

@@ -121,3 +122,2 @@ AbstractFileManager.prototype.extractUrlParts = function (url, baseUrl) {

};
;
return AbstractFileManager;

@@ -124,0 +124,0 @@ }());

@@ -11,12 +11,8 @@ "use strict";

// Implemented by Node.js plugin loader
this.require = function () { return null; };
this.require = function () {
return null;
};
}
AbstractPluginLoader.prototype.evalPlugin = function (contents, context, imports, pluginOptions, fileInfo) {
var loader;
var registry;
var pluginObj;
var localModule;
var pluginManager;
var filename;
var result;
var loader, registry, pluginObj, localModule, pluginManager, filename, result;
pluginManager = context.pluginManager;

@@ -23,0 +19,0 @@ if (fileInfo) {

@@ -11,4 +11,4 @@ "use strict";

var logger_1 = __importDefault(require("../logger"));
var environment = /** @class */ (function () {
function environment(externalEnvironment, fileManagers) {
var Environment = /** @class */ (function () {
function Environment(externalEnvironment, fileManagers) {
this.fileManagers = fileManagers || [];

@@ -30,3 +30,3 @@ externalEnvironment = externalEnvironment || {};

}
environment.prototype.getFileManager = function (filename, currentDirectory, options, environment, isSync) {
Environment.prototype.getFileManager = function (filename, currentDirectory, options, environment, isSync) {
if (!filename) {

@@ -50,11 +50,11 @@ logger_1.default.warn('getFileManager called with no filename.. Please report this issue. continuing.');

};
environment.prototype.addFileManager = function (fileManager) {
Environment.prototype.addFileManager = function (fileManager) {
this.fileManagers.push(fileManager);
};
environment.prototype.clearFileManagers = function () {
Environment.prototype.clearFileManagers = function () {
this.fileManagers = [];
};
return environment;
return Environment;
}());
exports.default = environment;
exports.default = Environment;
//# sourceMappingURL=environment.js.map

@@ -10,2 +10,4 @@ "use strict";

var anonymous_1 = __importDefault(require("../tree/anonymous"));
var expression_1 = __importDefault(require("../tree/expression"));
var operation_1 = __importDefault(require("../tree/operation"));
var colorFunctions;

@@ -68,3 +70,23 @@ function clamp(val) {

rgb: function (r, g, b) {
var color = colorFunctions.rgba(r, g, b, 1.0);
var a = 1;
/**
* Comma-less syntax
* e.g. rgb(0 128 255 / 50%)
*/
if (r instanceof expression_1.default) {
var val = r.value;
r = val[0];
g = val[1];
b = val[2];
/**
* @todo - should this be normalized in
* function caller? Or parsed differently?
*/
if (b instanceof operation_1.default) {
var op = b;
b = op.operands[0];
a = op.operands[1];
}
}
var color = colorFunctions.rgba(r, g, b, a);
if (color) {

@@ -93,3 +115,15 @@ color.value = 'rgb';

hsl: function (h, s, l) {
var color = colorFunctions.hsla(h, s, l, 1.0);
var a = 1;
if (h instanceof expression_1.default) {
var val = h.value;
h = val[0];
s = val[1];
l = val[2];
if (l instanceof operation_1.default) {
var op = l;
l = op.operands[0];
a = op.operands[1];
}
}
var color = colorFunctions.hsla(h, s, l, a);
if (color) {

@@ -96,0 +130,0 @@ color.value = 'hsl';

@@ -27,2 +27,5 @@ "use strict";

var _this = this;
if (!(Array.isArray(args))) {
args = [args];
}
var evalArgs = this.func.evalArgs;

@@ -32,29 +35,19 @@ if (evalArgs !== false) {

}
var commentFilter = function (item) { return !(item.type === 'Comment'); };
// This code is terrible and should be replaced as per this issue...
// https://github.com/less/less.js/issues/2477
if (Array.isArray(args)) {
args = args.filter(function (item) {
if (item.type === 'Comment') {
return false;
args = args
.filter(commentFilter)
.map(function (item) {
if (item.type === 'Expression') {
var subNodes = item.value.filter(commentFilter);
if (subNodes.length === 1) {
return subNodes[0];
}
return true;
})
.map(function (item) {
if (item.type === 'Expression') {
var subNodes = item.value.filter(function (item) {
if (item.type === 'Comment') {
return false;
}
return true;
});
if (subNodes.length === 1) {
return subNodes[0];
}
else {
return new expression_1.default(subNodes);
}
else {
return new expression_1.default(subNodes);
}
return item;
});
}
}
return item;
});
if (evalArgs === false) {

@@ -61,0 +54,0 @@ return this.func.apply(this, __spreadArrays([this.context], args));

@@ -7,2 +7,3 @@ "use strict";

var comment_1 = __importDefault(require("../tree/comment"));
var node_1 = __importDefault(require("../tree/node"));
var dimension_1 = __importDefault(require("../tree/dimension"));

@@ -15,2 +16,3 @@ var declaration_1 = __importDefault(require("../tree/declaration"));

var quoted_1 = __importDefault(require("../tree/quoted"));
var value_1 = __importDefault(require("../tree/value"));
var getItemsFromNode = function (node) {

@@ -27,2 +29,12 @@ // handle non-array values as an array of length 1

},
'~': function () {
var expr = [];
for (var _i = 0; _i < arguments.length; _i++) {
expr[_i] = arguments[_i];
}
if (expr.length === 1) {
return expr[0];
}
return new value_1.default(expr);
},
extract: function (values, index) {

@@ -66,24 +78,31 @@ // (1-based index)

each: function (list, rs) {
var _this = this;
var rules = [];
var newRules;
var iterator;
var tryEval = function (val) {
if (val instanceof node_1.default) {
return val.eval(_this.context);
}
return val;
};
if (list.value && !(list instanceof quoted_1.default)) {
if (Array.isArray(list.value)) {
iterator = list.value;
iterator = list.value.map(tryEval);
}
else {
iterator = [list.value];
iterator = [tryEval(list.value)];
}
}
else if (list.ruleset) {
iterator = list.ruleset.rules;
iterator = tryEval(list.ruleset).rules;
}
else if (list.rules) {
iterator = list.rules;
iterator = list.rules.map(tryEval);
}
else if (Array.isArray(list)) {
iterator = list;
iterator = list.map(tryEval);
}
else {
iterator = [list];
iterator = [tryEval(list)];
}

@@ -90,0 +109,0 @@ var valueName = '@value';

@@ -65,3 +65,6 @@ "use strict";

}
return minMax(true, args);
try {
return minMax(true, args);
}
catch (e) { }
},

@@ -73,3 +76,6 @@ max: function () {

}
return minMax(false, args);
try {
return minMax(false, args);
}
catch (e) { }
},

@@ -76,0 +82,0 @@ convert: function (val, unit) {

@@ -30,3 +30,3 @@ "use strict";

var logger_1 = __importDefault(require("./logger"));
exports.default = (function (environment) {
function default_1(environment) {
// FileInfo = {

@@ -52,3 +52,3 @@ // 'rewriteUrls' - option - whether to adjust URL's to be relative

this.queue = []; // Files which haven't been imported yet
this.files = []; // List of files imported
this.files = {}; // Holds the imported parse trees.
}

@@ -64,4 +64,3 @@ /**

ImportManager.prototype.push = function (path, tryAppendExtension, currentFileInfo, importOptions, callback) {
var importManager = this;
var pluginLoader = this.context.pluginManager.Loader;
var importManager = this, pluginLoader = this.context.pluginManager.Loader;
this.queue.push(path);

@@ -76,5 +75,7 @@ var fileParsedFunc = function (e, root, fullPath) {

else {
var files = importManager.files;
if (files.indexOf(fullPath) === -1) {
files.push(fullPath);
// Inline imports aren't cached here.
// If we start to cache them, please make sure they won't conflict with non-inline imports of the
// same name as they used to do before this comment and the condition below have been added.
if (!importManager.files[fullPath] && !importOptions.inline) {
importManager.files[fullPath] = { root: root, options: importOptions };
}

@@ -137,5 +138,14 @@ if (e && !importManager.error) {

else {
new parser_1.default(newEnv, importManager, newFileInfo).parse(contents, function (e, root) {
fileParsedFunc(e, root, resolvedFilename);
});
// import (multiple) parse trees apparently get altered and can't be cached.
// TODO: investigate why this is
if (importManager.files[resolvedFilename]
&& !importManager.files[resolvedFilename].options.multiple
&& !importOptions.multiple) {
fileParsedFunc(null, importManager.files[resolvedFilename].root, resolvedFilename);
}
else {
new parser_1.default(newEnv, importManager, newFileInfo).parse(contents, function (e, root) {
fileParsedFunc(e, root, resolvedFilename);
});
}
}

@@ -188,3 +198,5 @@ };

return ImportManager;
});
}
exports.default = default_1;
;
//# sourceMappingURL=import-manager.js.map

@@ -21,9 +21,2 @@ "use strict";

};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -33,5 +26,5 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
var environment_1 = __importDefault(require("./environment/environment"));
var data_1 = __importDefault(require("./data"));
var tree_1 = __importDefault(require("./tree"));
var environment_1 = __importDefault(require("./environment/environment"));
var abstract_file_manager_1 = __importDefault(require("./environment/abstract-file-manager"));

@@ -43,2 +36,7 @@ var abstract_plugin_loader_1 = __importDefault(require("./environment/abstract-plugin-loader"));

var contexts_1 = __importDefault(require("./contexts"));
var less_error_1 = __importDefault(require("./less-error"));
var transform_tree_1 = __importDefault(require("./transform-tree"));
var utils = __importStar(require("./utils"));
var plugin_manager_1 = __importDefault(require("./plugin-manager"));
var logger_1 = __importDefault(require("./logger"));
var source_map_output_1 = __importDefault(require("./source-map-output"));

@@ -48,31 +46,15 @@ var source_map_builder_1 = __importDefault(require("./source-map-builder"));

var import_manager_1 = __importDefault(require("./import-manager"));
var parse_1 = __importDefault(require("./parse"));
var render_1 = __importDefault(require("./render"));
var parse_1 = __importDefault(require("./parse"));
var less_error_1 = __importDefault(require("./less-error"));
var transform_tree_1 = __importDefault(require("./transform-tree"));
var utils = __importStar(require("./utils"));
var plugin_manager_1 = __importDefault(require("./plugin-manager"));
var logger_1 = __importDefault(require("./logger"));
exports.default = (function (environment, fileManagers) {
/**
* @todo
* This original code could be improved quite a bit.
* Many classes / modules currently add side-effects / mutations to passed in objects,
* which makes it hard to refactor and reason about.
*/
function default_1(environment, fileManagers) {
var sourceMapOutput, sourceMapBuilder, parseTree, importManager;
environment = new environment_1.default(environment, fileManagers);
var SourceMapOutput = source_map_output_1.default(environment);
var SourceMapBuilder = source_map_builder_1.default(SourceMapOutput, environment);
var ParseTree = parse_tree_1.default(SourceMapBuilder);
var ImportManager = import_manager_1.default(environment);
var render = render_1.default(environment, ParseTree, ImportManager);
var parse = parse_1.default(environment, ParseTree, ImportManager);
var functions = functions_1.default(environment);
/**
* @todo
* This root properties / methods need to be organized.
* It's not clear what should / must be public and why.
*/
sourceMapOutput = source_map_output_1.default(environment);
sourceMapBuilder = source_map_builder_1.default(sourceMapOutput, environment);
parseTree = parse_tree_1.default(sourceMapBuilder);
importManager = import_manager_1.default(environment);
var render = render_1.default(environment, parseTree, importManager);
var parse = parse_1.default(environment, parseTree, importManager);
var initial = {
version: [3, 12, 0],
version: [4, 0, 0],
data: data_1.default,

@@ -86,8 +68,8 @@ tree: tree_1.default,

Parser: parser_1.default,
functions: functions,
functions: functions_1.default(environment),
contexts: contexts_1.default,
SourceMapOutput: SourceMapOutput,
SourceMapBuilder: SourceMapBuilder,
ParseTree: ParseTree,
ImportManager: ImportManager,
SourceMapOutput: sourceMapOutput,
SourceMapBuilder: sourceMapBuilder,
ParseTree: parseTree,
ImportManager: importManager,
render: render,

@@ -102,9 +84,9 @@ parse: parse,

// Create a public API
var ctor = function (t) { return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return new (t.bind.apply(t, __spreadArrays([void 0], args)))();
}; };
var ctor = function (t) {
return function () {
var obj = Object.create(t.prototype);
t.apply(obj, Array.prototype.slice.call(arguments, 0));
return obj;
};
};
var t;

@@ -126,4 +108,14 @@ var api = Object.create(initial);

}
/**
* Some of the functions assume a `this` context of the API object,
* which causes it to fail when wrapped for ES6 imports.
*
* An assumed `this` should be removed in the future.
*/
initial.parse = initial.parse.bind(api);
initial.render = initial.render.bind(api);
return api;
});
}
exports.default = default_1;
;
//# sourceMappingURL=index.js.map

@@ -46,3 +46,3 @@ "use strict";

*/
var LessError = function LessError(e, fileContentMap, currentFilename) {
var LessError = function (e, fileContentMap, currentFilename) {
Error.call(this);

@@ -80,4 +80,4 @@ var filename = e.filename || currentFilename;

var match = e.stack.match(anonymousFunc);
var line_1 = parseInt(match[2]);
lineAdjust = 1 - line_1;
var line = parseInt(match[2]);
lineAdjust = 1 - line;
}

@@ -119,3 +119,3 @@ if (found) {

LessError.prototype.toString = function (options) {
if (options === void 0) { options = {}; }
options = options || {};
var message = '';

@@ -122,0 +122,0 @@ var extract = this.extract || [];

@@ -9,3 +9,3 @@ "use strict";

var logger_1 = __importDefault(require("./logger"));
exports.default = (function (SourceMapBuilder) {
function default_1(SourceMapBuilder) {
var ParseTree = /** @class */ (function () {

@@ -58,4 +58,8 @@ function ParseTree(root, imports) {

}
var rootFilename = this.imports.rootFilename;
result.imports = this.imports.files.filter(function (file) { return file !== rootFilename; });
result.imports = [];
for (var file in this.imports.files) {
if (this.imports.files.hasOwnProperty(file) && file !== this.imports.rootFilename) {
result.imports.push(file);
}
}
return result;

@@ -66,3 +70,5 @@ };

return ParseTree;
});
}
exports.default = default_1;
;
//# sourceMappingURL=parse-tree.js.map

@@ -25,3 +25,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var PromiseConstructor;
var contexts_1 = __importDefault(require("./contexts"));

@@ -32,3 +31,3 @@ var parser_1 = __importDefault(require("./parser/parser"));

var utils = __importStar(require("./utils"));
exports.default = (function (environment, ParseTree, ImportManager) {
function default_1(environment, ParseTree, ImportManager) {
var parse = function (input, options, callback) {

@@ -86,4 +85,3 @@ if (typeof options === 'function') {

options.plugins.forEach(function (plugin) {
var evalResult;
var contents;
var evalResult, contents;
if (plugin.fileContent) {

@@ -111,3 +109,5 @@ contents = plugin.fileContent.replace(/^\uFEFF/, '');

return parse;
});
}
exports.default = default_1;
;
//# sourceMappingURL=parse.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Split the input into chunks.
exports.default = (function (input, fail) {
function default_1(input, fail) {
var len = input.length;

@@ -146,3 +146,5 @@ var level = 0;

return chunks;
});
}
exports.default = default_1;
;
//# sourceMappingURL=chunker.js.map

@@ -149,3 +149,3 @@ "use strict";

var pm;
function PluginManagerFactory(less, newFactory) {
var PluginManagerFactory = function (less, newFactory) {
if (newFactory || !pm) {

@@ -155,6 +155,5 @@ pm = new PluginManager(less);

return pm;
}
;
};
//
exports.default = PluginManagerFactory;
//# sourceMappingURL=plugin-manager.js.map

@@ -22,5 +22,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var PromiseConstructor;
var utils = __importStar(require("./utils"));
exports.default = (function (environment, ParseTree, ImportManager) {
function default_1(environment, ParseTree, ImportManager) {
var render = function (input, options, callback) {

@@ -65,3 +64,5 @@ if (typeof options === 'function') {

return render;
});
}
exports.default = default_1;
;
//# sourceMappingURL=render.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (SourceMapOutput, environment) {
function default_1(SourceMapOutput, environment) {
var SourceMapBuilder = /** @class */ (function () {

@@ -71,3 +71,5 @@ function SourceMapBuilder(options) {

return SourceMapBuilder;
});
}
exports.default = default_1;
;
//# sourceMappingURL=source-map-builder.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (environment) {
function default_1(environment) {
var SourceMapOutput = /** @class */ (function () {

@@ -51,7 +51,3 @@ function SourceMapOutput(options) {

}
var lines;
var sourceLines;
var columns;
var sourceColumns;
var i;
var lines, sourceLines, columns, sourceColumns, i;
if (fileInfo && fileInfo.filename) {

@@ -136,3 +132,5 @@ var inputSource = this._contentsMap[fileInfo.filename];

return SourceMapOutput;
});
}
exports.default = default_1;
;
//# sourceMappingURL=source-map-output.js.map

@@ -9,4 +9,4 @@ "use strict";

var tree_1 = __importDefault(require("./tree"));
exports.default = (function (root, options) {
if (options === void 0) { options = {}; }
function default_1(root, options) {
options = options || {};
var evaldRoot;

@@ -93,3 +93,5 @@ var variables = options.variables;

return evaldRoot;
});
}
exports.default = default_1;
;
//# sourceMappingURL=transform-tree.js.map

@@ -52,4 +52,3 @@ "use strict";

AtRule.prototype.accept = function (visitor) {
var value = this.value;
var rules = this.rules;
var value = this.value, rules = this.rules;
if (rules) {

@@ -69,4 +68,3 @@ this.rules = visitor.visitArray(rules);

AtRule.prototype.genCSS = function (context, output) {
var value = this.value;
var rules = this.rules;
var value = this.value, rules = this.rules;
output.add(this.name, this.fileInfo(), this.getIndex());

@@ -85,6 +83,3 @@ if (value) {

AtRule.prototype.eval = function (context) {
var mediaPathBackup;
var mediaBlocksBackup;
var value = this.value;
var rules = this.rules;
var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules;
// media stored inside other atrule should not bubble over it

@@ -117,9 +112,5 @@ // backpup media bubbling information

AtRule.prototype.find = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (this.rules) {
// assuming that there is only one rule at this point - that is how parser constructs the rule
return ruleset_1.default.prototype.find.apply(this.rules[0], args);
return ruleset_1.default.prototype.find.apply(this.rules[0], arguments);
}

@@ -148,4 +139,3 @@ };

// Non-compressed
var tabSetStr = "\n" + Array(context.tabLevel).join(' ');
var tabRuleStr = tabSetStr + " ";
var tabSetStr = "\n" + Array(context.tabLevel).join(' '), tabRuleStr = tabSetStr + " ";
if (!ruleCnt) {

@@ -152,0 +142,0 @@ output.add(" {" + tabSetStr + "}");

@@ -81,3 +81,3 @@ "use strict";

type: e.type || 'Runtime',
message: "error evaluating function `" + this.name + "`" + (e.message ? ": " + e.message : ''),
message: "Error evaluating function `" + this.name + "`" + (e.message ? ": " + e.message : ''),
index: this.getIndex(),

@@ -89,17 +89,17 @@ filename: this.fileInfo().filename,

}
if (result !== null && result !== undefined) {
// Results that that are not nodes are cast as Anonymous nodes
// Falsy values or booleans are returned as empty nodes
if (!(result instanceof node_1.default)) {
if (!result || result === true) {
result = new anonymous_1.default(null);
}
else {
result = new anonymous_1.default(result.toString());
}
}
if (result !== null && result !== undefined) {
// Results that that are not nodes are cast as Anonymous nodes
// Falsy values or booleans are returned as empty nodes
if (!(result instanceof node_1.default)) {
if (!result || result === true) {
result = new anonymous_1.default(null);
}
result._index = this._index;
result._fileInfo = this._fileInfo;
return result;
else {
result = new anonymous_1.default(result.toString());
}
}
result._index = this._index;
result._fileInfo = this._fileInfo;
return result;
}

@@ -106,0 +106,0 @@ var args = this.args.map(function (a) { return a.eval(context); });

@@ -67,5 +67,3 @@ "use strict";

Color.prototype.luma = function () {
var r = this.rgb[0] / 255;
var g = this.rgb[1] / 255;
var b = this.rgb[2] / 255;
var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255;
r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4);

@@ -114,3 +112,5 @@ g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4);

case 'rgba':
args = this.rgb.map(function (c) { return clamp(Math.round(c), 255); }).concat(clamp(alpha, 1));
args = this.rgb.map(function (c) {
return clamp(Math.round(c), 255);
}).concat(clamp(alpha, 1));
break;

@@ -159,8 +159,4 @@ case 'hsla':

Color.prototype.toHSL = function () {
var r = this.rgb[0] / 255;
var g = this.rgb[1] / 255;
var b = this.rgb[2] / 255;
var a = this.alpha;
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h;

@@ -192,8 +188,4 @@ var s;

Color.prototype.toHSV = function () {
var r = this.rgb[0] / 255;
var g = this.rgb[1] / 255;
var b = this.rgb[2] / 255;
var a = this.alpha;
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h;

@@ -238,2 +230,16 @@ var s;

};
Color.fromKeyword = function (keyword) {
var c;
var key = keyword.toLowerCase();
if (colors_1.default.hasOwnProperty(key)) {
c = new Color(colors_1.default[key].slice(1));
}
else if (key === 'transparent') {
c = new Color([0, 0, 0], 0);
}
if (c) {
c.value = keyword;
return c;
}
};
return Color;

@@ -251,17 +257,3 @@ }(node_1.default));

}
Color.fromKeyword = function (keyword) {
var c;
var key = keyword.toLowerCase();
if (colors_1.default.hasOwnProperty(key)) {
c = new Color(colors_1.default[key].slice(1));
}
else if (key === 'transparent') {
c = new Color([0, 0, 0], 0);
}
if (c) {
c.value = keyword;
return c;
}
};
exports.default = Color;
//# sourceMappingURL=color.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var debugInfo = function (context, ctx, lineSeparator) {
var result = '';
if (context.dumpLineNumbers && !context.compress) {
switch (context.dumpLineNumbers) {
case 'comments':
result = debugInfo.asComment(ctx);
break;
case 'mediaquery':
result = debugInfo.asMediaQuery(ctx);
break;
case 'all':
result = debugInfo.asComment(ctx) + (lineSeparator || '') + debugInfo.asMediaQuery(ctx);
break;
var debugInfo = /** @class */ (function () {
function debugInfo(context, ctx, lineSeparator) {
var result = '';
if (context.dumpLineNumbers && !context.compress) {
switch (context.dumpLineNumbers) {
case 'comments':
result = debugInfo.asComment(ctx);
break;
case 'mediaquery':
result = debugInfo.asMediaQuery(ctx);
break;
case 'all':
result = debugInfo.asComment(ctx) + (lineSeparator || '') + debugInfo.asMediaQuery(ctx);
break;
}
}
return result;
}
return result;
};
debugInfo.asComment = function (ctx) { return ctx.debugInfo ? "/* line " + ctx.debugInfo.lineNumber + ", " + ctx.debugInfo.fileName + " */\n" : ''; };
debugInfo.asMediaQuery = function (ctx) {
if (!ctx.debugInfo) {
return '';
}
var filenameWithProtocol = ctx.debugInfo.fileName;
if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
filenameWithProtocol = "file://" + filenameWithProtocol;
}
return "@media -sass-debug-info{filename{font-family:" + filenameWithProtocol.replace(/([.:\/\\])/g, function (a) {
if (a == '\\') {
a = '\/';
debugInfo.asComment = function (ctx) {
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 "\\" + a;
}) + "}line{font-family:\\00003" + ctx.debugInfo.lineNumber + "}}\n";
};
return "@media -sass-debug-info{filename{font-family:" + filenameWithProtocol.replace(/([.:\/\\])/g, function (a) {
if (a == '\\') {
a = '\/';
}
return "\\" + a;
}) + "}line{font-family:\\00003" + ctx.debugInfo.lineNumber + "}}\n";
};
return debugInfo;
}());
exports.default = debugInfo;
//# sourceMappingURL=debug-info.js.map

@@ -74,7 +74,3 @@ "use strict";

Declaration.prototype.eval = function (context) {
var mathBypass = false;
var prevMath;
var name = this.name;
var evaldValue;
var variable = this.variable;
var mathBypass = false, prevMath, name = this.name, evaldValue, variable = this.variable;
if (typeof name !== 'string') {

@@ -81,0 +77,0 @@ // expand 'primitive' name directly to get

@@ -77,4 +77,3 @@ "use strict";

/* jshint noempty:false */
var value = this._operate(context, op, this.value, other.value);
var unit = this.unit.clone();
var value = this._operate(context, op, this.value, other.value), unit = this.unit.clone();
if (op === '+' || op === '-') {

@@ -93,4 +92,3 @@ if (unit.numerator.length === 0 && unit.denominator.length === 0) {

if (context.strictUnits && other.unit.toString() !== unit.toString()) {
throw new Error("Incompatible units. Change the units or use the unit function. " +
("Bad units: '" + unit.toString() + "' and '" + other.unit.toString() + "'."));
throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '" + unit.toString() + "' and '" + other.unit.toString() + "'.");
}

@@ -113,4 +111,3 @@ value = this._operate(context, op, this.value, other.value);

Dimension.prototype.compare = function (other) {
var a;
var b;
var a, b;
if (!(other instanceof Dimension)) {

@@ -117,0 +114,0 @@ return undefined;

@@ -61,3 +61,3 @@ "use strict";

Element.prototype.toCSS = function (context) {
if (context === void 0) { context = {}; }
context = context || {};
var value = this.value;

@@ -64,0 +64,0 @@ var firstSelector = context.firstSelector;

@@ -61,4 +61,3 @@ "use strict";

var mathOn = context.isMathOn();
var inParenthesis = this.parens &&
(context.math !== MATH.STRICT_LEGACY || !this.parensInOp);
var inParenthesis = this.parens;
var doubleParen = false;

@@ -103,3 +102,5 @@ if (inParenthesis) {

Expression.prototype.throwAwayComments = function () {
this.value = this.value.filter(function (v) { return !(v instanceof comment_1.default); });
this.value = this.value.filter(function (v) {
return !(v instanceof comment_1.default);
});
};

@@ -106,0 +107,0 @@ return Expression;

@@ -57,5 +57,3 @@ "use strict";

Extend.prototype.findSelfSelectors = function (selectors) {
var selfElements = [];
var i;
var selectorElements;
var selfElements = [], i, selectorElements;
for (i = 0; i < selectors.length; i++) {

@@ -62,0 +60,0 @@ selectorElements = selectors[i].elements;

@@ -6,3 +6,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var tree = Object.create(null);
var node_1 = __importDefault(require("./node"));

@@ -9,0 +8,0 @@ var color_1 = __importDefault(require("./color"));

@@ -35,3 +35,5 @@ "use strict";

}
expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) { return that.jsify(new variable_1.default("@" + name, that.getIndex(), that.fileInfo()).eval(context)); });
expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) {
return that.jsify(new variable_1.default("@" + name, that.getIndex(), that.fileInfo()).eval(context));
});
try {

@@ -38,0 +40,0 @@ expression = new Function("return (" + expression + ")");

@@ -71,5 +71,3 @@ "use strict";

function calcDefGroup(mixin, mixinPath) {
var f;
var p;
var namespace;
var f, p, namespace;
for (f = 0; f < 2; f++) {

@@ -185,4 +183,3 @@ conditionResult[f] = true;

MixinCall.prototype._setVisibilityToReplacement = function (replacement) {
var i;
var rule;
var i, rule;
if (this.blocksVisibility()) {

@@ -189,0 +186,0 @@ for (i = 0; i < replacement.length; i++) {

@@ -34,6 +34,3 @@ "use strict";

NamespaceValue.prototype.eval = function (context) {
var i;
var j;
var name;
var rules = this.value.eval(context);
var i, j, name, rules = this.value.eval(context);
for (i = 0; i < this.lookups.length; i++) {

@@ -40,0 +37,0 @@ name = this.lookups[i];

@@ -37,5 +37,3 @@ "use strict";

};
Node.prototype.isRulesetLike = function () {
return false;
};
Node.prototype.isRulesetLike = function () { return false; };
Node.prototype.toCSS = function (context) {

@@ -73,2 +71,40 @@ var strs = [];

};
Node.compare = function (a, b) {
/* returns:
-1: a < b
0: a = b
1: a > b
and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */
if ((a.compare) &&
// for "symmetric results" force toCSS-based comparison
// of Quoted or Anonymous if either value is one of those
!(b.type === 'Quoted' || b.type === 'Anonymous')) {
return a.compare(b);
}
else if (b.compare) {
return -b.compare(a);
}
else if (a.type !== b.type) {
return undefined;
}
a = a.value;
b = b.value;
if (!Array.isArray(a)) {
return a === b ? 0 : undefined;
}
if (a.length !== b.length) {
return undefined;
}
for (var i = 0; i < a.length; i++) {
if (Node.compare(a[i], b[i]) !== 0) {
return undefined;
}
}
return 0;
};
Node.numericCompare = function (a, b) {
return a < b ? -1
: a === b ? 0
: a > b ? 1 : undefined;
};
// Returns true if this node represents root of ast imported by reference

@@ -125,39 +161,3 @@ Node.prototype.blocksVisibility = function () {

}());
Node.compare = function (a, b) {
/* returns:
-1: a < b
0: a = b
1: a > b
and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */
if ((a.compare) &&
// for "symmetric results" force toCSS-based comparison
// of Quoted or Anonymous if either value is one of those
!(b.type === 'Quoted' || b.type === 'Anonymous')) {
return a.compare(b);
}
else if (b.compare) {
return -b.compare(a);
}
else if (a.type !== b.type) {
return undefined;
}
a = a.value;
b = b.value;
if (!Array.isArray(a)) {
return a === b ? 0 : undefined;
}
if (a.length !== b.length) {
return undefined;
}
for (var i = 0; i < a.length; i++) {
if (Node.compare(a[i], b[i]) !== 0) {
return undefined;
}
}
return 0;
};
Node.numericCompare = function (a, b) { return a < b ? -1
: a === b ? 0
: a > b ? 1 : undefined; };
exports.default = Node;
//# sourceMappingURL=node.js.map

@@ -56,5 +56,3 @@ "use strict";

Operation.prototype.eval = function (context) {
var a = this.operands[0].eval(context);
var b = this.operands[1].eval(context);
var op;
var a = this.operands[0].eval(context), b = this.operands[1].eval(context), op;
if (context.isMathOn(this.op)) {

@@ -61,0 +59,0 @@ op = this.op === './' ? '/' : this.op;

@@ -67,5 +67,3 @@ "use strict";

}
Ruleset.prototype.isRulesetLike = function () {
return true;
};
Ruleset.prototype.isRulesetLike = function () { return true; };
Ruleset.prototype.accept = function (visitor) {

@@ -153,3 +151,3 @@ if (this.paths) {

return function_registry_1.default;
})(context.frames).inherit();
}(context.frames)).inherit();
// push the current ruleset to the frames stack

@@ -418,3 +416,3 @@ var ctxFrames = context.frames;

Ruleset.prototype.find = function (selector, self, filter) {
if (self === void 0) { self = this; }
self = self || this;
var rules = [];

@@ -558,4 +556,3 @@ var match;

function createParenthesis(elementsToPak, originalElement) {
var replacementParen;
var j;
var replacementParen, j;
if (elementsToPak.length === 0) {

@@ -574,4 +571,3 @@ replacementParen = new paren_1.default(elementsToPak[0]);

function createSelector(containedElement, originalElement) {
var element;
var selector;
var element, selector;
element = new element_1.default(null, containedElement, originalElement.isVariable, originalElement._index, originalElement._fileInfo);

@@ -585,5 +581,3 @@ selector = new selector_1.default([element]);

function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) {
var newSelectorPath;
var lastSelector;
var newJoinedSelector;
var newSelectorPath, lastSelector, newJoinedSelector;
// our new selector path

@@ -623,3 +617,5 @@ newSelectorPath = [];

var restOfPath = addPath.slice(1);
restOfPath = restOfPath.map(function (selector) { return selector.createDerived(selector.elements, []); });
restOfPath = restOfPath.map(function (selector) {
return selector.createDerived(selector.elements, []);
});
newSelectorPath = newSelectorPath.concat(restOfPath);

@@ -641,4 +637,3 @@ }

function mergeElementsOnToSelectors(elements, selectors) {
var i;
var sel;
var i, sel;
if (elements.length === 0) {

@@ -675,13 +670,3 @@ return;

//
var i;
var j;
var k;
var currentElements;
var newSelectors;
var selectorsMultiplied;
var sel;
var el;
var hadParentSelector = false;
var length;
var lastSelector;
var i, j, k, currentElements, newSelectors, selectorsMultiplied, sel, el, hadParentSelector = false, length, lastSelector;
function findNestedSelector(element) {

@@ -786,5 +771,3 @@ var maybeSelector;

// joinSelector code follows
var i;
var newPaths;
var hadParentSelector;
var i, newPaths, hadParentSelector;
newPaths = [];

@@ -791,0 +774,0 @@ hadParentSelector = replaceParentSelector(newPaths, context, selector);

@@ -73,4 +73,3 @@ "use strict";

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

@@ -102,3 +101,5 @@ return sels;

}
var elements = this.elements.map(function (v) { return v.combinator.value + (v.value.value || v.value); }).join('').match(/[,&#\*\.\w-]([\w-]|(\\.))*/g);
var elements = this.elements.map(function (v) {
return v.combinator.value + (v.value.value || v.value);
}).join('').match(/[,&#\*\.\w-]([\w-]|(\\.))*/g);
if (elements) {

@@ -129,4 +130,3 @@ if (elements[0] === '&') {

Selector.prototype.genCSS = function (context, output) {
var i;
var element;
var i, element;
if ((!context || !context.firstSelector) && this.elements[0].combinator.value === '') {

@@ -133,0 +133,0 @@ output.add(' ', this.fileInfo(), this.getIndex());

@@ -72,4 +72,3 @@ "use strict";

Unit.prototype.toString = function () {
var i;
var returnStr = this.numerator.join('*');
var i, returnStr = this.numerator.join('*');
for (i = 0; i < this.denominator.length; i++) {

@@ -76,0 +75,0 @@ returnStr += "/" + this.denominator[i];

@@ -45,3 +45,5 @@ "use strict";

else {
return new Value(this.value.map(function (v) { return v.eval(context); }));
return new Value(this.value.map(function (v) {
return v.eval(context);
}));
}

@@ -48,0 +50,0 @@ };

@@ -31,4 +31,3 @@ "use strict";

Variable.prototype.eval = function (context) {
var variable;
var name = this.name;
var variable, name = this.name;
if (name.indexOf('@@') === 0) {

@@ -35,0 +34,0 @@ name = "@" + new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value;

@@ -90,3 +90,3 @@ "use strict";

if (opts.strictMath) {
opts.math = Constants.Math.STRICT_LEGACY;
opts.math = Constants.Math.PARENS;
}

@@ -109,4 +109,4 @@ // Back compat with changed relativeUrls option

break;
case 'strict-legacy':
opts.math = Constants.Math.STRICT_LEGACY;
default:
opts.math = Constants.Math.PARENS;
}

@@ -113,0 +113,0 @@ }

@@ -57,4 +57,3 @@ "use strict";

// get &:extend(.a); rules which apply to all selectors in this ruleset
var rules = rulesetNode.rules;
var ruleCnt = rules ? rules.length : 0;
var rules = rulesetNode.rules, ruleCnt = rules ? rules.length : 0;
for (i = 0; i < ruleCnt; i++) {

@@ -70,9 +69,9 @@ if (rulesetNode.rules[i] instanceof tree_1.default.Extend) {

for (i = 0; i < paths.length; i++) {
var selectorPath = paths[i];
var selector = selectorPath[selectorPath.length - 1];
var selExtendList = selector.extendList;
var selectorPath = paths[i], selector = selectorPath[selectorPath.length - 1], selExtendList = selector.extendList;
extendList = selExtendList ? utils.copyArray(selExtendList).concat(allSelectorsExtendList)
: allSelectorsExtendList;
if (extendList) {
extendList = extendList.map(function (allSelectorsExtend) { return allSelectorsExtend.clone(); });
extendList = extendList.map(function (allSelectorsExtend) {
return allSelectorsExtend.clone();
});
}

@@ -132,3 +131,5 @@ for (j = 0; j < extendList.length; j++) {

var indices = this.extendIndices;
extendList.filter(function (extend) { return !extend.hasFoundMatches && extend.parent_ids.length == 1; }).forEach(function (extend) {
extendList.filter(function (extend) {
return !extend.hasFoundMatches && extend.parent_ids.length == 1;
}).forEach(function (extend) {
var selector = '_unknown_';

@@ -388,10 +389,3 @@ try {

// for a set of matches, replace each match with the replacement selector
var currentSelectorPathIndex = 0;
var currentSelectorPathElementIndex = 0;
var path = [];
var matchIndex;
var selector;
var firstElement;
var match;
var newElements;
var currentSelectorPathIndex = 0, currentSelectorPathElementIndex = 0, path = [], matchIndex, selector, firstElement, match, newElements;
for (matchIndex = 0; matchIndex < matches.length; matchIndex++) {

@@ -398,0 +392,0 @@ match = matches[matchIndex];

@@ -11,4 +11,3 @@ "use strict";

ImportSequencer.prototype.addImport = function (callback) {
var importSequencer = this;
var importItem = {
var importSequencer = this, importItem = {
callback: callback,

@@ -20,7 +19,3 @@ args: null,

return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
importItem.args = Array.prototype.slice.call(args, 0);
importItem.args = Array.prototype.slice.call(arguments, 0);
importItem.isReady = true;

@@ -27,0 +22,0 @@ importSequencer.tryRun();

@@ -101,4 +101,3 @@ "use strict";

}
var onImported = this.onImported.bind(this, evaldImportNode, context);
var sequencedOnImported = this._sequencer.addImport(onImported);
var onImported = this.onImported.bind(this, evaldImportNode, context), sequencedOnImported = this._sequencer.addImport(onImported);
this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(), evaldImportNode.options, sequencedOnImported);

@@ -121,7 +120,3 @@ }

}
var importVisitor = this;
var inlineCSS = importNode.options.inline;
var isPlugin = importNode.options.isPlugin;
var isOptional = importNode.options.optional;
var duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;
var importVisitor = this, inlineCSS = importNode.options.inline, isPlugin = importNode.options.isPlugin, isOptional = importNode.options.optional, duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;
if (!context.importMultiple) {

@@ -128,0 +123,0 @@ if (duplicateImport) {

@@ -182,3 +182,3 @@ "use strict";

if (ruleNode instanceof tree_1.default.Call) {
throw { message: "Function '" + ruleNode.name + "' is undefined", index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename };
throw { message: "Function '" + ruleNode.name + "' did not return a root node", index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename };
}

@@ -185,0 +185,0 @@ if (ruleNode.type && !ruleNode.allowRoot) {

@@ -14,4 +14,3 @@ "use strict";

// add .typeIndex to tree node types for lookup table
var key;
var child;
var key, child;
for (key in parent) {

@@ -126,8 +125,3 @@ /* eslint guard-for-in: 0 */

}
var cnt;
var i;
var item;
var nestedCnt;
var j;
var nestedItem;
var cnt, i, item, nestedCnt, j, nestedItem;
for (i = 0, cnt = arr.length; i < cnt; i++) {

@@ -134,0 +128,0 @@ item = arr[i];

{
"name": "less",
"version": "3.12.0",
"version": "3.12.1-alpha.13+ed734098",
"description": "Leaner CSS",

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

"devDependencies": {
"@less/test-data": "^3.12.0",
"@less/test-data": "^3.12.2",
"@less/test-import-module": "^3.12.0",

@@ -134,3 +134,3 @@ "@typescript-eslint/eslint-plugin": "^3.3.0",

},
"gitHead": "e4f755112198b758a3b22252a9f4f290b4f81df9"
"gitHead": "ed7340982be9404298c8713cf00f12b8a5ae78c3"
}

@@ -1,4 +0,4 @@

RuntimeError: error evaluating function `image-height`: Image size functions are not supported in browser version of less in image-height-error.less on line 2, column 11:
RuntimeError: Error evaluating function `image-height`: Image size functions are not supported in browser version of less in image-height-error.less on line 2, column 11:
1 .test-height{
2 height: image-height("../data/image.jpg")
3 }

@@ -1,4 +0,4 @@

RuntimeError: error evaluating function `image-size`: Image size functions are not supported in browser version of less in image-size-error.less on line 2, column 9:
RuntimeError: Error evaluating function `image-size`: Image size functions are not supported in browser version of less in image-size-error.less on line 2, column 9:
1 .test-size{
2 size: image-size("../data/image.jpg")
3 }

@@ -1,4 +0,4 @@

RuntimeError: error evaluating function `image-width`: Image size functions are not supported in browser version of less in image-width-error.less on line 2, column 10:
RuntimeError: Error evaluating function `image-width`: Image size functions are not supported in browser version of less in image-width-error.less on line 2, column 10:
1 .test-width{
2 width: image-width("../data/image.jpg")
3 }

@@ -17,5 +17,2 @@ var lessTest = require('./less-test'),

[{
math: 'strict-legacy'
}, 'math/strict-legacy/'],
[{
math: 'parens'

@@ -26,2 +23,5 @@ }, 'math/strict/'],

}, 'math/parens-division/'],
[{
math: 'always'
}, 'math/always/'],
// Use legacy strictMath: true here to demonstrate it still works

@@ -44,4 +44,6 @@ [{strictMath: true, strictUnits: true, javascriptEnabled: true}, '../errors/eval/',

[{math: 'strict', compress: true}, 'compression/'],
[{math: 0, strictUnits: true}, 'strict-units/'],
[{}, 'legacy/'],
[{math: 0, strictUnits: true}, 'units/strict/'],
[{math: 0, strictUnits: false}, 'units/no-strict/'],
[{math: 'strict', strictUnits: true, sourceMap: true, globalVars: true }, 'sourcemaps/',

@@ -80,4 +82,3 @@ lessTester.testSourcemap, null, null,

[{plugin: 'test/plugins/filemanager/'}, 'filemanagerPlugin/'],
[{}, 'no-strict-math/'],
[{}, '3rd-party/'],
[{math: 0}, '3rd-party/'],
[{ processImports: false }, 'process-imports/']

@@ -90,5 +91,5 @@ ];

lessTester.testSyncronous({syncImport: true}, '_main/plugin');
lessTester.testSyncronous({syncImport: true}, 'math/strict-legacy/css');
lessTester.testSyncronous({syncImport: true}, 'math/strict/css');
lessTester.testNoOptions();
lessTester.testJSImport();
lessTester.finished();

Sorry, the diff of this file is not supported yet

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

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

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 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

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

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

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

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