less
Advanced tools
Comparing version 4.0.1-alpha.2 to 4.1.0
@@ -246,5 +246,2 @@ "use strict"; | ||
}, | ||
benchmarkbrowser: { | ||
command: "node test/browser/generator/runner.js benchmark" | ||
}, | ||
opts: { | ||
@@ -290,3 +287,3 @@ // test running with all current options (using `opts` since `options` means something already) | ||
"test/**/*.js", | ||
"lib/less*/**/*.js", | ||
"src/less*/**/*.js", | ||
"!test/less/errors/plugin/plugin-error.js" | ||
@@ -421,13 +418,6 @@ ], | ||
// Run benchmark | ||
grunt.registerTask("benchmark-node", [ | ||
grunt.registerTask("benchmark", [ | ||
"shell:testcjs", | ||
"shell:benchmark" | ||
]); | ||
// Run all browser tests | ||
grunt.registerTask("benchmark", [ | ||
"browsertest-lessjs", | ||
"connect", | ||
"shell:benchmarkbrowser" | ||
]); | ||
}; |
@@ -18,3 +18,3 @@ "use strict"; | ||
try { | ||
request = require('native-request'); | ||
request = require('needle'); | ||
} | ||
@@ -32,15 +32,19 @@ catch (e) { | ||
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" }); | ||
request.get(hackUrlStr, { follow_max: 5 }, function (err, resp, body) { | ||
if (err || resp.statusCode >= 400) { | ||
var message = resp.statusCode === 404 | ||
? "resource '" + urlStr + "' was not found\n" | ||
: "resource '" + urlStr + "' gave this Error:\n " + (err || resp.statusMessage || resp.statusCode) + "\n"; | ||
reject({ type: 'File', message: message }); | ||
return; | ||
} | ||
if (error) { | ||
reject({ type: 'File', message: "resource '" + urlStr + "' gave this Error:\n " + error + "\n" }); | ||
if (resp.statusCode >= 300) { | ||
reject({ type: 'File', message: "resource '" + urlStr + "' caused too many redirects" }); | ||
return; | ||
} | ||
body = body.toString('utf8'); | ||
if (!body) { | ||
logger_1.default.warn("Warning: Empty body (HTTP " + status + ") returned by \"" + urlStr + "\""); | ||
logger_1.default.warn("Warning: Empty body (HTTP " + resp.statusCode + ") returned by \"" + urlStr + "\""); | ||
} | ||
fulfill({ contents: body, filename: urlStr }); | ||
fulfill({ contents: body || '', filename: urlStr }); | ||
}); | ||
@@ -47,0 +51,0 @@ }); |
@@ -7,3 +7,4 @@ "use strict"; | ||
PARENS_DIVISION: 1, | ||
PARENS: 2, | ||
PARENS: 2 | ||
// removed - STRICT_LEGACY: 3 | ||
}; | ||
@@ -10,0 +11,0 @@ exports.RewriteUrls = { |
@@ -18,3 +18,13 @@ "use strict"; | ||
If.evalArgs = false; | ||
exports.default = { boolean: boolean, 'if': If }; | ||
function isdefined(context, variable) { | ||
try { | ||
variable.eval(context); | ||
return keyword_1.default.True; | ||
} | ||
catch (e) { | ||
return keyword_1.default.False; | ||
} | ||
} | ||
isdefined.evalArgs = false; | ||
exports.default = { isdefined: isdefined, boolean: boolean, 'if': If }; | ||
//# sourceMappingURL=boolean.js.map |
@@ -24,2 +24,4 @@ "use strict"; | ||
var render_1 = tslib_1.__importDefault(require("./render")); | ||
var package_json_1 = require("../../package.json"); | ||
var parse_node_version_1 = tslib_1.__importDefault(require("parse-node-version")); | ||
function default_1(environment, fileManagers) { | ||
@@ -34,4 +36,5 @@ var sourceMapOutput, sourceMapBuilder, parseTree, importManager; | ||
var parse = parse_1.default(environment, parseTree, importManager); | ||
var v = parse_node_version_1.default("v" + package_json_1.version); | ||
var initial = { | ||
version: [4, 0, 0], | ||
version: [v.major, v.minor, v.patch], | ||
data: data_1.default, | ||
@@ -38,0 +41,0 @@ tree: tree_1.default, |
@@ -64,4 +64,8 @@ "use strict"; | ||
} | ||
// ignore empty content | ||
/** | ||
* ignore empty content, or failsafe | ||
* if contents map is incorrect | ||
*/ | ||
if (inputSource === undefined) { | ||
this._css.push(chunk); | ||
return; | ||
@@ -68,0 +72,0 @@ } |
@@ -74,3 +74,4 @@ "use strict"; | ||
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() + "'.")); | ||
} | ||
@@ -77,0 +78,0 @@ value = this._operate(context, op, this.value, other.value); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* The reason why Node is a class and other nodes simply do not extend | ||
* from Node (since we're transpiling) is due to this issue: | ||
* | ||
* https://github.com/less/less.js/issues/3434 | ||
*/ | ||
var Node = /** @class */ (function () { | ||
@@ -4,0 +10,0 @@ function Node() { |
@@ -7,2 +7,3 @@ "use strict"; | ||
var Constants = tslib_1.__importStar(require("./constants")); | ||
var copy_anything_1 = require("copy-anything"); | ||
function getLocation(index, inputStream) { | ||
@@ -48,5 +49,5 @@ var n = index + 1; | ||
newObj = {}; | ||
var defaults_1 = tslib_1.__assign({}, obj1); | ||
var defaults_1 = copy_anything_1.copy(obj1); | ||
newObj._defaults = defaults_1; | ||
var cloned = obj2 ? tslib_1.__assign({}, obj2) : {}; | ||
var cloned = obj2 ? copy_anything_1.copy(obj2) : {}; | ||
Object.assign(newObj, defaults_1, cloned); | ||
@@ -53,0 +54,0 @@ } |
{ | ||
"name": "less", | ||
"version": "4.0.1-alpha.2+b2049010", | ||
"version": "4.1.0", | ||
"description": "Leaner CSS", | ||
@@ -53,8 +53,11 @@ "homepage": "http://lesscss.org", | ||
"mime": "^1.4.1", | ||
"native-request": "^1.0.5", | ||
"needle": "^2.5.2", | ||
"source-map": "~0.6.0" | ||
}, | ||
"devDependencies": { | ||
"@less/test-data": "^4.0.0", | ||
"@less/test-data": "^4.1.0", | ||
"@less/test-import-module": "^4.0.0", | ||
"@rollup/plugin-commonjs": "^17.0.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^11.0.0", | ||
"@typescript-eslint/eslint-plugin": "^3.3.0", | ||
@@ -65,3 +68,2 @@ "@typescript-eslint/parser": "^3.3.0", | ||
"chai": "^4.2.0", | ||
"copy-anything": "^2.0.1", | ||
"diff": "^3.2.0", | ||
@@ -87,2 +89,3 @@ "eslint": "^6.8.0", | ||
"mocha-teamcity-reporter": "^3.0.0", | ||
"nock": "^11.8.2", | ||
"npm-run-all": "^4.1.5", | ||
@@ -94,7 +97,5 @@ "performance-now": "^0.2.0", | ||
"resolve": "^1.17.0", | ||
"rollup": "^1.17.0", | ||
"rollup-plugin-commonjs": "^10.0.1", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup": "^2.34.1", | ||
"rollup-plugin-terser": "^5.1.1", | ||
"rollup-plugin-typescript2": "^0.24.3", | ||
"rollup-plugin-typescript2": "^0.29.0", | ||
"semver": "^6.3.0", | ||
@@ -104,3 +105,3 @@ "shx": "^0.3.2", | ||
"ts-node": "^8.4.1", | ||
"typescript": "^3.6.3", | ||
"typescript": "^4.1.3", | ||
"uikit": "2.27.4" | ||
@@ -136,5 +137,6 @@ }, | ||
"dependencies": { | ||
"copy-anything": "^2.0.1", | ||
"parse-node-version": "^1.0.1", | ||
"tslib": "^1.10.0" | ||
}, | ||
"gitHead": "b2049010b387ae69abf4e656a415b1affb2e89d7" | ||
} | ||
} |
var lessTest = require('./less-test'), | ||
lessTester = lessTest(), | ||
path = require('path'), | ||
stylize = require('../lib/less-node/lessc-helper').stylize; | ||
stylize = require('../lib/less-node/lessc-helper').stylize, | ||
nock = require('nock'); | ||
@@ -42,3 +43,3 @@ console.log('\n' + stylize('Less', 'underline') + '\n'); | ||
[{math: 'strict', compress: true}, 'compression/'], | ||
[{math: 0, strictUnits: true}, 'units/strict/'], | ||
@@ -92,1 +93,18 @@ [{math: 0, strictUnits: false}, 'units/no-strict/'], | ||
lessTester.finished(); | ||
(() => { | ||
// Create new tester, since tests are not independent and tests | ||
// above modify tester in a way that breaks remote imports. | ||
lessTester = lessTest(); | ||
var scope = nock('https://example.com') | ||
.get('/redirect.less').query(true) | ||
.reply(301, null, { location: '/target.less' }) | ||
.get('/target.less').query(true) | ||
.reply(200); | ||
lessTester.runTestSet( | ||
{}, | ||
'import-redirect/', | ||
lessTester.testImportRedirect(scope) | ||
); | ||
lessTester.finished(); | ||
})(); |
/* jshint latedef: nofunc */ | ||
var logger = require('../lib/less/logger').default; | ||
var isVerbose = process.env.npm_config_loglevel !== 'concise'; | ||
logger.addListener({ | ||
info(msg) { | ||
if (isVerbose) { | ||
process.stdout.write(msg + '\n'); | ||
} | ||
}, | ||
warn(msg) { | ||
process.stdout.write(msg + '\n'); | ||
}, | ||
erro(msg) { | ||
process.stdout.write(msg + '\n'); | ||
} | ||
}); | ||
module.exports = function() { | ||
@@ -17,4 +35,2 @@ var path = require('path'), | ||
var isVerbose = process.env.npm_config_loglevel !== 'concise'; | ||
var testFolder = path.dirname(require.resolve('@less/test-data')); | ||
@@ -31,16 +47,2 @@ var lessFolder = path.join(testFolder, 'less'); | ||
less.logger.addListener({ | ||
info: function(msg) { | ||
if (isVerbose) { | ||
process.stdout.write(msg + '\n'); | ||
} | ||
}, | ||
warn: function(msg) { | ||
process.stdout.write(msg + '\n'); | ||
}, | ||
error: function(msg) { | ||
process.stdout.write(msg + '\n'); | ||
} | ||
}); | ||
var queueList = [], | ||
@@ -524,2 +526,19 @@ queueRunning = false; | ||
function testImportRedirect(nockScope) { | ||
return (name, err, css, doReplacements, sourcemap, baseFolder) => { | ||
process.stdout.write('- ' + path.join(baseFolder, name) + ': '); | ||
if (err) { | ||
fail('FAIL: ' + (err && err.message)); | ||
return; | ||
} | ||
const expected = 'h1 {\n color: red;\n}\n'; | ||
if (css !== expected) { | ||
difference('FAIL', expected, css); | ||
return; | ||
} | ||
nockScope.done(); | ||
ok('OK'); | ||
}; | ||
} | ||
return { | ||
@@ -533,2 +552,3 @@ runTestSet: runTestSet, | ||
testImports: testImports, | ||
testImportRedirect: testImportRedirect, | ||
testEmptySourcemap: testEmptySourcemap, | ||
@@ -535,0 +555,0 @@ testNoOptions: testNoOptions, |
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 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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2770525
26178
0
17
46
317
+ Addedcopy-anything@^2.0.1
+ Addedparse-node-version@^1.0.1
+ Addedcopy-anything@2.0.6(transitive)
+ Addeddebug@3.2.7(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedis-what@3.14.1(transitive)
+ Addedms@2.1.3(transitive)
+ Addedneedle@2.9.1(transitive)
+ Addedparse-node-version@1.0.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsax@1.3.0(transitive)
- Removednative-request@1.1.0(transitive)