less 4.6.7 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/less-node.cjs +296 -64
- package/dist/less.cjs +271 -58
- package/dist/less.js +271 -58
- package/dist/less.min.js +2 -2
- package/dist/less.min.js.map +1 -1
- package/lib/less/deprecation.js +17 -2
- package/lib/less/parser/parser-input.js +21 -1
- package/lib/less/parser/parser.js +210 -29
- package/lib/less/tree/mixin-definition.js +30 -18
- package/lib/less/tree/nested-at-rule.js +6 -6
- package/lib/less-node/environment.js +3 -3
- package/lib/less-node/image-size.js +25 -6
- package/package.json +2 -2
|
@@ -8,7 +8,7 @@ class SourceMapGeneratorFallback {
|
|
|
8
8
|
toJSON(){
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
14
|
encodeBase64: function encodeBase64(str) {
|
|
@@ -19,9 +19,9 @@ export default {
|
|
|
19
19
|
mimeLookup: function (filename) {
|
|
20
20
|
try {
|
|
21
21
|
const mimeModule = require('mime');
|
|
22
|
-
return mimeModule ? mimeModule.lookup(filename) :
|
|
22
|
+
return mimeModule ? mimeModule.lookup(filename) : 'application/octet-stream';
|
|
23
23
|
} catch (e) {
|
|
24
|
-
return
|
|
24
|
+
return 'application/octet-stream';
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
charsetLookup: function (mime) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
1
2
|
import { createRequire } from 'module';
|
|
2
3
|
import Dimension from '../less/tree/dimension.js';
|
|
3
4
|
import Expression from '../less/tree/expression.js';
|
|
@@ -33,27 +34,45 @@ export default environment => {
|
|
|
33
34
|
throw fileSync.error;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
let probe;
|
|
38
|
+
try {
|
|
39
|
+
probe = require('probe-image-size/sync');
|
|
40
|
+
} catch (_) {
|
|
41
|
+
return { width: 0, height: 0 };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const size = probe(readFileSync(fileSync.filename));
|
|
45
|
+
|
|
46
|
+
if (!size) {
|
|
47
|
+
throw {
|
|
48
|
+
type: 'File',
|
|
49
|
+
message: `Unrecognised image format for '${filePath}'`
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
width: size.width,
|
|
55
|
+
height: size.height
|
|
56
|
+
};
|
|
38
57
|
}
|
|
39
58
|
|
|
40
59
|
const imageFunctions = {
|
|
41
|
-
'image-size': function(filePathNode) {
|
|
60
|
+
'image-size': function (filePathNode) {
|
|
42
61
|
const size = imageSize(this, filePathNode);
|
|
43
62
|
return new Expression([
|
|
44
63
|
new Dimension(size.width, 'px'),
|
|
45
64
|
new Dimension(size.height, 'px')
|
|
46
65
|
]);
|
|
47
66
|
},
|
|
48
|
-
'image-width': function(filePathNode) {
|
|
67
|
+
'image-width': function (filePathNode) {
|
|
49
68
|
const size = imageSize(this, filePathNode);
|
|
50
69
|
return new Dimension(size.width, 'px');
|
|
51
70
|
},
|
|
52
|
-
'image-height': function(filePathNode) {
|
|
71
|
+
'image-height': function (filePathNode) {
|
|
53
72
|
const size = imageSize(this, filePathNode);
|
|
54
73
|
return new Dimension(size.height, 'px');
|
|
55
74
|
}
|
|
56
75
|
};
|
|
57
76
|
|
|
58
77
|
functionRegistry.addMultiple(imageFunctions);
|
|
59
|
-
};
|
|
78
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "less",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "Leaner CSS",
|
|
5
5
|
"homepage": "http://lesscss.org",
|
|
6
6
|
"author": {
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"optionalDependencies": {
|
|
71
71
|
"errno": "^0.1.1",
|
|
72
72
|
"graceful-fs": "^4.1.2",
|
|
73
|
-
"image-size": "
|
|
73
|
+
"probe-image-size": "^7.2.3",
|
|
74
74
|
"make-dir": "^5.1.0",
|
|
75
75
|
"mime": "^1.4.1",
|
|
76
76
|
"needle": "^3.1.0",
|