Skip to content

Commit

Permalink
Merge branch 'master' into explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmywarting authored Jan 8, 2023
2 parents 6887e4d + eefe33a commit 985268c
Show file tree
Hide file tree
Showing 32 changed files with 280 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [10, 12, 14, 17]
node: [10, 12, 14, 18]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
## Change Log

### v4.1.3 (2022-06-09)
- [#3673](https://github.com/less/less.js/pull/3673) Feat: add support for case-insensitive attribute selectors (#3673) (@iChenLei)
- [#3710](https://github.com/less/less.js/pull/3701) Feat: add `disablePluginRule` flag for render() options (#3710) (@broofa @edhgoose)
- [#3656](https://github.com/less/less.js/pull/3656) Fix [#3655](https://github.com/less/less.js/issues/3655) for param tag is null (#3658) (@langren1353)
- [#3658](https://github.com/less/less.js/pull/3658) Fix [#3646](https://github.com/less/less.js/issues/3656) forcefully change unsupported input to strings (#3658) (@gzb1128)
- [#3668](https://github.com/less/less.js/pull/3668) Fix change keyword plugin and import regexp (#3668) (@iChenLei)
- [#3613](https://github.com/less/less.js/pull/3613) Fix [#3591](https://github.com/less/less.js/issues/3591): refactor debugInfo from class to function (#3613) (@drdevlin)
- [#3716](https://github.com/less/less.js/pull/3716) Fix https failures on macOS (#3716) (@joeyparrish)

### v4.1.2 (2021-10-04)
- [#3602](https://github.com/less/less.js/pull/3602) Fix currentFileInfo and index properties on nodes (#3602) (@bjpbakker)
- [#3626](https://github.com/less/less.js/pull/3626) Fix [#3616](https://github.com/less/less.js/issues/3616) IfStatement requires double parentheses when dividing (#3626) (@iChenLei)
Expand Down Expand Up @@ -554,4 +563,4 @@
- [#169](https://github.com/less/less.js/pull/169) (fix) including .less files via absolute path with IE7 (@ldaley)
- [#189](https://github.com/less/less.js/pull/189) Google Chrome(Chromium) support for extensions (@dz0ny)
- [#247](https://github.com/less/less.js/pull/247) New "escape" function (@gilt)
- [#134](https://github.com/less/less.js/pull/134) Fixed issue (#134) where subfiles' @imports were regarding #, ? and url portions thereafter as part of the base url. (@dbergey)
- [#134](https://github.com/less/less.js/pull/134) Fixed issue (#134) where subfiles' @imports were regarding #, ? and url portions thereafter as part of the base url. (@dbergey)
109 changes: 65 additions & 44 deletions dist/less.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Less - Leaner CSS v4.1.2
* Less - Leaner CSS v4.1.3
* http://lesscss.org
*
* Copyright (c) 2009-2021, Alexis Sellier <[email protected]>
* Copyright (c) 2009-2022, Alexis Sellier <[email protected]>
* Licensed under the Apache-2.0 License.
*
* @license Apache-2.0
Expand Down Expand Up @@ -80,6 +80,9 @@
.replace(/\./g, ':'); // Replace dots with colons(for valid id)
}
function addDataAttr(options, tag) {
if (!tag) {
return;
} // in case of tag is null or undefined
for (var opt in tag.dataset) {
if (tag.dataset.hasOwnProperty(opt)) {
if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootpath' || opt === 'errorReporting') {
Expand Down Expand Up @@ -1599,41 +1602,38 @@
}
});

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;
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;
}
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 "@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 "\\" + 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;
}
}
return result;
}

var Comment = function (value, isLineComment, index, currentFileInfo) {
this.value = value;
Expand Down Expand Up @@ -3387,15 +3387,16 @@
}
});

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;
};
Attribute.prototype = Object.assign(new Node(), {
type: 'Attribute',
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);
},
genCSS: function (context, output) {
output.add(this.toCSS(context));
Expand All @@ -3406,6 +3407,9 @@
value += this.op;
value += (this.value.toCSS ? this.value.toCSS(context) : this.value);
}
if (this.cif) {
value = value + " " + this.cif;
}
return "[" + value + "]";
}
});
Expand Down Expand Up @@ -6654,11 +6658,20 @@
//
parse: function (str, callback, additionalData) {
var root;
var error = null;
var err = null;
var globalVars;
var modifyVars;
var ignored;
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 disablePluginRule is set to true');
}
};
}
globalVars = (additionalData && additionalData.globalVars) ? Parser.serializeVars(additionalData.globalVars) + "\n" : '';
modifyVars = (additionalData && additionalData.modifyVars) ? "\n" + Parser.serializeVars(additionalData.modifyVars) : '';
if (context.pluginManager) {
Expand Down Expand Up @@ -6723,15 +6736,15 @@
message += '. Possibly missing something';
}
}
error = new LessError({
err = new LessError({
type: 'Parse',
message: message,
index: endInfo.furthest,
filename: fileInfo.filename
}, imports);
}
var finish = function (e) {
e = error || e || imports.error;
e = err || e || imports.error;
if (e) {
if (!(e instanceof LessError)) {
e = new LessError(e, imports, fileInfo.filename);
Expand Down Expand Up @@ -7808,15 +7821,23 @@
var key;
var val;
var op;
//
// case-insensitive flag
// e.g. [attr operator value i]
//
var cif;
if (!(key = entities.variableCurly())) {
key = expect(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/);
}
op = parserInput.$re(/^[|~*$^]?=/);
if (op) {
val = entities.quoted() || parserInput.$re(/^[0-9]+%/) || parserInput.$re(/^[\w-]+/) || entities.variableCurly();
if (val) {
cif = parserInput.$re(/^[iIsS]/);
}
}
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`.
Expand Down Expand Up @@ -8063,7 +8084,7 @@
var path;
var features;
var index = parserInput.i;
var dir = parserInput.$re(/^@import?\s+/);
var dir = parserInput.$re(/^@import\s+/);
if (dir) {
var options = (dir ? this.importOptions() : null) || {};
if ((path = this.entities.quoted() || this.entities.url())) {
Expand Down Expand Up @@ -8214,7 +8235,7 @@
var args;
var options;
var index = parserInput.i;
var dir = parserInput.$re(/^@plugin?\s+/);
var dir = parserInput.$re(/^@plugin\s+/);
if (dir) {
args = this.pluginArgs();
if (args) {
Expand Down Expand Up @@ -10575,7 +10596,7 @@
return render;
}

var version = "4.1.2";
var version = "4.1.3";

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
Expand Down
6 changes: 3 additions & 3 deletions dist/less.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/less.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@less/root",
"private": true,
"version": "3.13.0",
"version": "4.1.3",
"description": "Less monorepo",
"homepage": "http://lesscss.org",
"scripts": {
Expand Down
21 changes: 18 additions & 3 deletions packages/less/bin/lessc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env node

/* eslint indent: [2, 2, {"SwitchCase": 1}] */

"use strict";

var path = require('path');
Expand Down Expand Up @@ -87,6 +90,12 @@ function render() {
output = path.resolve(process.cwd(), output);
}

if (options.disablePluginRule && queuePlugins.length > 0) {
console.error('--plugin and --disable-plugin-rule may not be used at the same time');
process.exitCode = 1;
return;
}

if (options.sourceMap) {
sourceMapOptions.sourceMapInputFilename = input;

Expand All @@ -113,6 +122,7 @@ function render() {
var mapDir = path.dirname(mapFilename);
var outputDir = path.dirname(output); // find the path from the map to the output file

// eslint-disable-next-line max-len
sourceMapOptions.sourceMapOutputFilename = path.join(path.relative(mapDir, outputDir), path.basename(output)); // make the sourcemap filename point to the sourcemap relative to the css file output directory

sourceMapOptions.sourceMapFilename = path.join(path.relative(outputDir, mapDir), path.basename(sourceMapOptions.sourceMapFullFilename));
Expand Down Expand Up @@ -180,8 +190,8 @@ function render() {
var filename = sourceMapOptions.sourceMapFullFilename;
ensureDirectory(filename);

//To fix https://github.com/less/less.js/issues/3646
output=output.toString();
// To fix https://github.com/less/less.js/issues/3646
output = output.toString();

fs.writeFile(filename, output, 'utf8', function (err) {
if (err) {
Expand Down Expand Up @@ -444,7 +454,8 @@ function processPluginQueue() {
break;

case 'no-js':
console.error('The "--no-js" argument is deprecated, as inline JavaScript ' + 'is disabled by default. Use "--js" to enable inline JavaScript (not recommended).');
// eslint-disable-next-line max-len
console.error('The "--no-js" argument is deprecated, as inline JavaScript is disabled by default. Use "--js" to enable inline JavaScript (not recommended).');
break;

case 'include-path':
Expand Down Expand Up @@ -629,6 +640,10 @@ function processPluginQueue() {
});
break;

case 'disable-plugin-rule':
options.disablePluginRule = true;
break;

default:
queuePlugins.push({
name: arg,
Expand Down
Loading

0 comments on commit 985268c

Please sign in to comment.