Comparing version 4.1.2 to 4.1.3
@@ -264,2 +264,3 @@ "use strict"; | ||
`node ../bin/lessc --clean-css="--s1 --advanced" ../${lessFolder}/_main/lazy-eval.less ../tmp/lazy-eval.css`, | ||
`node ../bin/lessc --source-map=lazy-eval.css.map --autoprefix ../${lessFolder}/_main/lazy-eval.less ../tmp/lazy-eval.css`, | ||
"cd ..", | ||
@@ -266,0 +267,0 @@ // Test multiple plugins |
@@ -14,2 +14,5 @@ "use strict"; | ||
function addDataAttr(options, tag) { | ||
if (!tag) { | ||
return; | ||
} // in case of tag is null or undefined | ||
for (var opt in tag.dataset) { | ||
@@ -16,0 +19,0 @@ if (tag.dataset.hasOwnProperty(opt)) { |
@@ -14,5 +14,3 @@ "use strict"; | ||
var fragmentStart = filePath.indexOf('#'); | ||
var fragment = ''; | ||
if (fragmentStart !== -1) { | ||
fragment = filePath.slice(fragmentStart); | ||
filePath = filePath.slice(0, fragmentStart); | ||
@@ -19,0 +17,0 @@ } |
@@ -68,2 +68,3 @@ // lessc_helper.js | ||
console.log(' or --clean-css="advanced"'); | ||
console.log(' --disable-plugin-rule Disallow @plugin statements'); | ||
console.log(''); | ||
@@ -70,0 +71,0 @@ console.log('-------------------------- Deprecated ----------------'); |
@@ -5,6 +5,7 @@ "use strict"; | ||
var node_1 = tslib_1.__importDefault(require("./node")); | ||
var Attribute = function (key, op, value) { | ||
var Attribute = function (key, op, value, cif) { | ||
this.key = key; | ||
this.op = op; | ||
this.value = value; | ||
this.cif = cif; | ||
}; | ||
@@ -14,3 +15,3 @@ Attribute.prototype = Object.assign(new node_1.default(), { | ||
eval: function (context) { | ||
return new Attribute(this.key.eval ? this.key.eval(context) : this.key, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value); | ||
return new Attribute(this.key.eval ? this.key.eval(context) : this.key, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value, this.cif); | ||
}, | ||
@@ -26,2 +27,5 @@ genCSS: function (context, output) { | ||
} | ||
if (this.cif) { | ||
value = value + " " + this.cif; | ||
} | ||
return "[" + value + "]"; | ||
@@ -28,0 +32,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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; | ||
} | ||
function asComment(ctx) { | ||
return "/* line " + ctx.debugInfo.lineNumber + ", " + ctx.debugInfo.fileName + " */\n"; | ||
} | ||
function asMediaQuery(ctx) { | ||
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 = '\/'; | ||
} | ||
return result; | ||
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 || '') + asMediaQuery(ctx); | ||
break; | ||
} | ||
} | ||
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 "@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; | ||
}()); | ||
return result; | ||
} | ||
exports.default = debugInfo; | ||
//# sourceMappingURL=debug-info.js.map |
@@ -8,4 +8,2 @@ "use strict"; | ||
var dimension_1 = tslib_1.__importDefault(require("./dimension")); | ||
var Constants = tslib_1.__importStar(require("../constants")); | ||
var MATH = Constants.Math; | ||
var Expression = function (value, noSpacing) { | ||
@@ -12,0 +10,0 @@ this.value = value; |
{ | ||
"name": "less", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"description": "Leaner CSS", | ||
@@ -53,3 +53,3 @@ "homepage": "http://lesscss.org", | ||
"mime": "^1.4.1", | ||
"needle": "^2.5.2", | ||
"needle": "^3.1.0", | ||
"source-map": "~0.6.0" | ||
@@ -56,0 +56,0 @@ }, |
@@ -31,3 +31,4 @@ var lessTest = require('./less-test'), | ||
lessTester.testErrors, null], | ||
[{math: 'strict', strictUnits: true, javascriptEnabled: true}, 'js-type-errors/', | ||
lessTester.testTypeErrors, null], | ||
[{math: 'strict', strictUnits: true, javascriptEnabled: false}, 'no-js-errors/', | ||
@@ -91,2 +92,3 @@ lessTester.testErrors, null], | ||
lessTester.testNoOptions(); | ||
lessTester.testDisablePluginRule(); | ||
lessTester.testJSImport(); | ||
@@ -93,0 +95,0 @@ lessTester.finished(); |
/* jshint latedef: nofunc */ | ||
var semver = require('semver'); | ||
var logger = require('../lib/less/logger').default; | ||
@@ -229,2 +229,27 @@ | ||
// To fix ci fail about error format change in upstream v8 project | ||
// https://github.com/v8/v8/commit/c0fd89c3c089e888c4f4e8582e56db7066fa779b | ||
// Node 16.9.0+ include this change via https://github.com/nodejs/node/pull/39947 | ||
function testTypeErrors(name, err, compiledLess, doReplacements, sourcemap, baseFolder) { | ||
const fileSuffix = semver.gte(process.version, 'v16.9.0') ? '-2.txt' : '.txt'; | ||
fs.readFile(path.join(baseFolder, name) + fileSuffix, 'utf8', function (e, expectedErr) { | ||
process.stdout.write('- ' + path.join(baseFolder, name) + ': '); | ||
expectedErr = doReplacements(expectedErr, baseFolder, err && err.filename); | ||
if (!err) { | ||
if (compiledLess) { | ||
fail('No Error', 'red'); | ||
} else { | ||
fail('No Error, No Output'); | ||
} | ||
} else { | ||
var errMessage = err.toString(); | ||
if (errMessage === expectedErr) { | ||
ok('OK'); | ||
} else { | ||
difference('FAIL', expectedErr, errMessage); | ||
} | ||
} | ||
}); | ||
} | ||
// https://github.com/less/less.js/issues/3112 | ||
@@ -542,2 +567,19 @@ function testJSImport() { | ||
function testDisablePluginRule() { | ||
less.render( | ||
'@plugin "../../plugin/some_plugin";', | ||
{disablePluginRule: true}, | ||
function(err) { | ||
// TODO: Need a better way of identifing exactly which error is thrown. Checking | ||
// text like this tends to be rather brittle. | ||
const EXPECTED = '@plugin statements are not allowed when disablePluginRule is set to true'; | ||
if (!err || String(err).indexOf(EXPECTED) < 0) { | ||
fail('ERROR: Expected "' + EXPECTED + '" error'); | ||
return; | ||
} | ||
ok(stylize('OK\n', 'green')); | ||
} | ||
); | ||
} | ||
return { | ||
@@ -548,2 +590,3 @@ runTestSet: runTestSet, | ||
testErrors: testErrors, | ||
testTypeErrors: testTypeErrors, | ||
testSourcemap: testSourcemap, | ||
@@ -555,2 +598,3 @@ testSourcemapWithoutUrlAnnotation: testSourcemapWithoutUrlAnnotation, | ||
testNoOptions: testNoOptions, | ||
testDisablePluginRule: testDisablePluginRule, | ||
testJSImport: testJSImport, | ||
@@ -557,0 +601,0 @@ finished: 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 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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2782784
26463