less-loader 6.1.3 → 6.2.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/CHANGELOG.md +7 -0
- package/dist/utils.js +8 -15
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [6.2.0](https://github.com/webpack-contrib/less-loader/compare/v6.1.3...v6.2.0) (2020-07-03)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* support condition names from `package.json` ([#369](https://github.com/webpack-contrib/less-loader/issues/369)) ([671395d](https://github.com/webpack-contrib/less-loader/commit/671395d6a82425ba4408d1329d8cbfa07dfd9153))
|
|
11
|
+
|
|
5
12
|
### [6.1.3](https://github.com/webpack-contrib/less-loader/compare/v6.1.2...v6.1.3) (2020-06-29)
|
|
6
13
|
|
|
7
14
|
|
package/dist/utils.js
CHANGED
|
@@ -22,7 +22,7 @@ const trailingSlash = /[/\\]$/; // This somewhat changed in Less 3.x. Now the fi
|
|
|
22
22
|
// automatically added extension whereas the extension is passed in as `options.ext`.
|
|
23
23
|
// So, if the file name matches this regexp, we simply ignore the proposed extension.
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const isModuleImport = /^~([^/]+|[^/]+\/|@[^/]+[/][^/]+|@[^/]+\/?|@[^/]+[/][^/]+\/)$/; // `[drive_letter]:\` + `\\[server]\[sharename]\`
|
|
26
26
|
|
|
27
27
|
const isNativeWin32Path = /^[a-zA-Z]:[/\\]|^\\\\/i;
|
|
28
28
|
/**
|
|
@@ -34,6 +34,7 @@ const isNativeWin32Path = /^[a-zA-Z]:[/\\]|^\\\\/i;
|
|
|
34
34
|
|
|
35
35
|
function createWebpackLessPlugin(loaderContext) {
|
|
36
36
|
const resolve = loaderContext.getResolve({
|
|
37
|
+
conditionNames: ['less', 'style'],
|
|
37
38
|
mainFields: ['less', 'style', 'main', '...'],
|
|
38
39
|
mainFiles: ['index', '...'],
|
|
39
40
|
extensions: ['.less', '.css']
|
|
@@ -61,20 +62,12 @@ function createWebpackLessPlugin(loaderContext) {
|
|
|
61
62
|
return false;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return this.tryAppendExtension(filename, options.ext);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return filename;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async resolveFilename(filename, currentDirectory, options) {
|
|
73
|
-
const url = this.getUrl(filename, options);
|
|
74
|
-
const request = (0, _loaderUtils.urlToRequest)(url, url.charAt(0) === '/' ? loaderContext.rootContext : null); // Less is giving us trailing slashes, but the context should have no trailing slash
|
|
75
|
-
|
|
65
|
+
async resolveFilename(filename, currentDirectory) {
|
|
66
|
+
// Less is giving us trailing slashes, but the context should have no trailing slash
|
|
76
67
|
const context = currentDirectory.replace(trailingSlash, '');
|
|
77
|
-
|
|
68
|
+
const request = (0, _loaderUtils.urlToRequest)(filename, // eslint-disable-next-line no-undefined
|
|
69
|
+
filename.charAt(0) === '/' ? loaderContext.rootContext : undefined);
|
|
70
|
+
return this.resolveRequests(context, [...new Set([request, filename])]);
|
|
78
71
|
}
|
|
79
72
|
|
|
80
73
|
resolveRequests(context, possibleRequests) {
|
|
@@ -99,7 +92,7 @@ function createWebpackLessPlugin(loaderContext) {
|
|
|
99
92
|
let result;
|
|
100
93
|
|
|
101
94
|
try {
|
|
102
|
-
if (
|
|
95
|
+
if (isModuleImport.test(filename)) {
|
|
103
96
|
const error = new Error();
|
|
104
97
|
error.type = 'Next';
|
|
105
98
|
throw error;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "less-loader",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "A Less loader for webpack. Compiles Less to CSS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/less-loader",
|
|
@@ -47,24 +47,24 @@
|
|
|
47
47
|
"schema-utils": "^2.7.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@babel/cli": "^7.10.
|
|
51
|
-
"@babel/core": "^7.10.
|
|
52
|
-
"@babel/preset-env": "^7.10.
|
|
50
|
+
"@babel/cli": "^7.10.4",
|
|
51
|
+
"@babel/core": "^7.10.4",
|
|
52
|
+
"@babel/preset-env": "^7.10.4",
|
|
53
53
|
"@commitlint/cli": "^9.0.1",
|
|
54
54
|
"@commitlint/config-conventional": "^9.0.1",
|
|
55
55
|
"@webpack-contrib/defaults": "^6.3.0",
|
|
56
56
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
57
|
-
"babel-jest": "^26.0
|
|
57
|
+
"babel-jest": "^26.1.0",
|
|
58
58
|
"cross-env": "^7.0.2",
|
|
59
59
|
"del": "^5.1.0",
|
|
60
60
|
"del-cli": "^3.0.1",
|
|
61
|
-
"eslint": "^7.3.
|
|
61
|
+
"eslint": "^7.3.1",
|
|
62
62
|
"eslint-config-prettier": "^6.11.0",
|
|
63
|
-
"eslint-plugin-import": "^2.
|
|
63
|
+
"eslint-plugin-import": "^2.22.0",
|
|
64
64
|
"eslint-plugin-prettier": "^3.1.4",
|
|
65
65
|
"husky": "^4.2.5",
|
|
66
66
|
"inspect-loader": "^1.0.0",
|
|
67
|
-
"jest": "^26.0
|
|
67
|
+
"jest": "^26.1.0",
|
|
68
68
|
"lint-staged": "^10.2.11",
|
|
69
69
|
"memfs": "^3.2.0",
|
|
70
70
|
"npm-run-all": "^4.1.5",
|