🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

less

Package Overview
Dependencies
Maintainers
5
Versions
148
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
4.6.7
to
4.7.0
+3
-3
lib/less-node/environment.js

@@ -11,3 +11,3 @@ import { createRequire } from 'module';

}
};
}

@@ -23,5 +23,5 @@ export default {

const mimeModule = require('mime');
return mimeModule ? mimeModule.lookup(filename) : "application/octet-stream";
return mimeModule ? mimeModule.lookup(filename) : 'application/octet-stream';
} catch (e) {
return "application/octet-stream";
return 'application/octet-stream';
}

@@ -28,0 +28,0 @@ },

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

import { readFileSync } from 'fs';
import { createRequire } from 'module';

@@ -36,8 +37,26 @@ import Dimension from '../less/tree/dimension.js';

const sizeOf = require('image-size');
return sizeOf ? sizeOf(fileSync.filename) : {width: 0, height: 0};
let probe;
try {
probe = require('probe-image-size/sync');
} catch (_) {
return { width: 0, height: 0 };
}
const size = probe(readFileSync(fileSync.filename));
if (!size) {
throw {
type: 'File',
message: `Unrecognised image format for '${filePath}'`
};
}
return {
width: size.width,
height: size.height
};
}
const imageFunctions = {
'image-size': function(filePathNode) {
'image-size': function (filePathNode) {
const size = imageSize(this, filePathNode);

@@ -49,7 +68,7 @@ return new Expression([

},
'image-width': function(filePathNode) {
'image-width': function (filePathNode) {
const size = imageSize(this, filePathNode);
return new Dimension(size.width, 'px');
},
'image-height': function(filePathNode) {
'image-height': function (filePathNode) {
const size = imageSize(this, filePathNode);

@@ -61,2 +80,2 @@ return new Dimension(size.height, 'px');

functionRegistry.addMultiple(imageFunctions);
};
};

@@ -20,6 +20,9 @@ /**

'variable-in-unknown-value': {
description: '@[ident] in custom property values is treated as literal text.'
description: '@variable in custom property values is treated as literal text.'
},
'variable-in-at-rule-prelude': {
description: 'A bare @variable in an at-rule prelude (e.g. @media @foo) is deprecated. Use @{variable} interpolation instead.'
},
'property-in-unknown-value': {
description: '$[ident] in custom property values is treated as literal text.'
description: '$property in custom property values is treated as literal text.'
},

@@ -26,0 +29,0 @@ 'js-eval': {

@@ -207,4 +207,13 @@ export default () => {

* until matching token (outside of blocks)
*
* @param {string|RegExp} tok - stop token
* @param {boolean} [detectBareVar] - when set, also record the position of the
* first bare `@variable` reference (not `@{interpolation}`) that appears at
* PAREN depth 0 — i.e. a structural reference, not a declaration value inside
* `(...)`. Reuses this single pass (which already skips strings/comments) so
* callers don't re-scan the text. Exposed as `.bareVarIndex` on the returned
* group array (or null). `[...]`/`{...}` do NOT shield a reference — only
* `(...)` (a declaration-value group) does.
*/
parserInput.$parseUntil = tok => {
parserInput.$parseUntil = (tok, detectBareVar) => {
let quote = '';

@@ -214,2 +223,4 @@ let returnVal = null;

let blockDepth = 0;
let parenDepth = 0;
let bareVarIndex = null;
const blockStack = [];

@@ -254,2 +265,8 @@ const parseGroups = [];

}
if (detectBareVar && bareVarIndex === null && nextChar === '@' && parenDepth === 0) {
// A bare `@ident` (not `@{interpolation}`) outside any `(...)` —
// a structural reference. Strings/comments are already skipped above.
const after = input.charAt(i + 1);
if (after && /[-\w]/.test(after)) { bareVarIndex = i; }
}
switch (nextChar) {

@@ -290,2 +307,3 @@ case '\\':

blockDepth++;
parenDepth++;
break;

@@ -302,2 +320,3 @@ case '[':

blockDepth--;
if (nextChar === ')' && parenDepth > 0) { parenDepth--; }
} else {

@@ -318,2 +337,3 @@ // move the parser to the error and return expected

if (Array.isArray(returnVal)) { returnVal.bareVarIndex = bareVarIndex; }
return returnVal ? returnVal : null;

@@ -320,0 +340,0 @@ }

@@ -148,12 +148,12 @@ // @ts-check

path => {
path = /** @type {Node[]} */ (path).map(
path = /** @type {Node[]} */ (path).map(
/** @param {Node & { toCSS?: Function }} fragment */
fragment => fragment.toCSS ? fragment : new Anonymous(/** @type {string} */ (/** @type {unknown} */ (fragment))));
fragment => fragment.toCSS ? fragment : new Anonymous(/** @type {string} */ (/** @type {unknown} */ (fragment))));
for (i = /** @type {Node[]} */ (path).length - 1; i > 0; i--) {
for (i = /** @type {Node[]} */ (path).length - 1; i > 0; i--) {
/** @type {Node[]} */ (path).splice(i, 0, new Anonymous('and'));
}
}
return new Expression(/** @type {Node[]} */ (path));
}));
return new Expression(/** @type {Node[]} */ (path));
}));
self.setParent(self.features, self);

@@ -160,0 +160,0 @@

{
"name": "less",
"version": "4.6.7",
"version": "4.7.0",
"description": "Leaner CSS",

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

"graceful-fs": "^4.1.2",
"image-size": "~0.5.0",
"probe-image-size": "^7.2.3",
"make-dir": "^5.1.0",

@@ -76,0 +76,0 @@ "mime": "^1.4.1",

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

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

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

Sorry, the diff of this file is 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