less-loader 4.0.2 → 4.0.6
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 +39 -0
- package/README.md +1 -1
- package/dist/cjs.js +3 -0
- package/dist/createWebpackLessPlugin.js +4 -3
- package/dist/formatLessError.js +3 -2
- package/dist/getOptions.js +13 -2
- package/dist/index.js +27 -9
- package/dist/processResult.js +3 -2
- package/dist/removeSourceMappingUrl.js +3 -2
- package/dist/stringifyLoader.js +3 -2
- package/package.json +33 -36
- package/dist/createWebpackLessPlugin.js.map +0 -1
- package/dist/formatLessError.js.map +0 -1
- package/dist/getOptions.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/processResult.js.map +0 -1
- package/dist/removeSourceMappingUrl.js.map +0 -1
- package/dist/stringifyLoader.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,45 @@
|
|
|
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
|
+
<a name="4.0.6"></a>
|
|
6
|
+
## [4.0.6](https://github.com/webpack-contrib/less-loader/compare/v4.0.5...v4.0.6) (2018-02-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **package:** add `webpack >= v4.0.0` (`peerDependencies`) ([#245](https://github.com/webpack-contrib/less-loader/issues/245)) ([011cc73](https://github.com/webpack-contrib/less-loader/commit/011cc73))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<a name="4.0.5"></a>
|
|
16
|
+
## [4.0.5](https://github.com/webpack-contrib/less-loader/compare/v4.0.4...v4.0.5) (2017-07-10)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Chore
|
|
20
|
+
|
|
21
|
+
* support `webpack@3` ([670ab18](https://github.com/webpack-contrib/less-loader/commit/670ab18))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<a name="4.0.4"></a>
|
|
25
|
+
## [4.0.4](https://github.com/webpack-contrib/less-loader/compare/v4.0.3...v4.0.4) (2017-05-30)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* resolve `[@import](https://github.com/import)` with absolute paths ([#201](https://github.com/webpack-contrib/less-loader/issues/201)) ([a3f9601](https://github.com/webpack-contrib/less-loader/commit/a3f9601)), closes [webpack-contrib/less-loader#93](https://github.com/webpack-contrib/less-loader/issues/93)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
<a name="4.0.3"></a>
|
|
35
|
+
## [4.0.3](https://github.com/webpack-contrib/less-loader/compare/v4.0.2...v4.0.3) (2017-03-30)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* sourcesContent missing in source maps ([df28035](https://github.com/webpack-contrib/less-loader/commit/df28035))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
5
44
|
<a name="4.0.2"></a>
|
|
6
45
|
## [4.0.2](https://github.com/webpack-contrib/less-loader/compare/v4.0.1...v4.0.2) (2017-03-21)
|
|
7
46
|
|
package/README.md
CHANGED
|
@@ -235,7 +235,7 @@ module.exports = {
|
|
|
235
235
|
};
|
|
236
236
|
```
|
|
237
237
|
|
|
238
|
-
Also checkout the [sourceMaps example](/examples/sourceMaps).
|
|
238
|
+
Also checkout the [sourceMaps example](https://github.com/webpack-contrib/less-loader/tree/master/examples/sourceMaps).
|
|
239
239
|
|
|
240
240
|
If you want to edit the original Less files inside Chrome, [there's a good blog post](https://medium.com/@toolmantim/getting-started-with-css-sourcemaps-and-in-browser-sass-editing-b4daab987fb0). The blog post is about Sass but it also works for Less.
|
|
241
241
|
|
package/dist/cjs.js
ADDED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
2
4
|
|
|
3
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -56,7 +58,7 @@ function createWebpackLessPlugin(loaderContext) {
|
|
|
56
58
|
value: function loadFile(filename, currentDirectory /* , options, environment */) {
|
|
57
59
|
// eslint-disable-line class-methods-use-this
|
|
58
60
|
var url = filename.replace(matchMalformedModuleFilename, '$1');
|
|
59
|
-
var moduleRequest = loaderUtils.urlToRequest(url);
|
|
61
|
+
var moduleRequest = loaderUtils.urlToRequest(url, url.charAt(0) === '/' ? '' : null);
|
|
60
62
|
// Less is giving us trailing slashes, but the context should have no trailing slash
|
|
61
63
|
var context = currentDirectory.replace(trailingSlash, '');
|
|
62
64
|
var resolvedFilename = void 0;
|
|
@@ -92,5 +94,4 @@ function createWebpackLessPlugin(loaderContext) {
|
|
|
92
94
|
};
|
|
93
95
|
}
|
|
94
96
|
|
|
95
|
-
module.exports = createWebpackLessPlugin;
|
|
96
|
-
//# sourceMappingURL=createWebpackLessPlugin.js.map
|
|
97
|
+
module.exports = createWebpackLessPlugin;
|
package/dist/formatLessError.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
2
4
|
|
|
3
5
|
var os = require('os');
|
|
@@ -57,5 +59,4 @@ function formatLessError(err) {
|
|
|
57
59
|
return err;
|
|
58
60
|
} /* eslint-enable no-param-reassign */
|
|
59
61
|
|
|
60
|
-
module.exports = formatLessError;
|
|
61
|
-
//# sourceMappingURL=formatLessError.js.map
|
|
62
|
+
module.exports = formatLessError;
|
package/dist/getOptions.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
var loaderUtils = require('loader-utils');
|
|
2
4
|
var clone = require('clone');
|
|
3
5
|
var createWebpackLessPlugin = require('./createWebpackLessPlugin');
|
|
@@ -23,8 +25,17 @@ function getOptions(loaderContext) {
|
|
|
23
25
|
options.plugins.push(createWebpackLessPlugin(loaderContext));
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
if (options.sourceMap) {
|
|
29
|
+
if (typeof options.sourceMap === 'boolean') {
|
|
30
|
+
options.sourceMap = {};
|
|
31
|
+
}
|
|
32
|
+
if ('outputSourceFiles' in options.sourceMap === false) {
|
|
33
|
+
// Include source files as `sourceContents` as sane default since this makes source maps "just work" in most cases
|
|
34
|
+
options.sourceMap.outputSourceFiles = true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
26
38
|
return options;
|
|
27
39
|
}
|
|
28
40
|
|
|
29
|
-
module.exports = getOptions;
|
|
30
|
-
//# sourceMappingURL=getOptions.js.map
|
|
41
|
+
module.exports = getOptions;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
var pify = require('pify');
|
|
3
|
-
var processResult = require('./processResult');
|
|
4
|
-
var getOptions = require('./getOptions');
|
|
1
|
+
'use strict';
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _less = require('less');
|
|
8
|
+
|
|
9
|
+
var _less2 = _interopRequireDefault(_less);
|
|
10
|
+
|
|
11
|
+
var _pify = require('pify');
|
|
12
|
+
|
|
13
|
+
var _pify2 = _interopRequireDefault(_pify);
|
|
14
|
+
|
|
15
|
+
var _processResult = require('./processResult');
|
|
16
|
+
|
|
17
|
+
var _processResult2 = _interopRequireDefault(_processResult);
|
|
18
|
+
|
|
19
|
+
var _getOptions = require('./getOptions');
|
|
20
|
+
|
|
21
|
+
var _getOptions2 = _interopRequireDefault(_getOptions);
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
|
|
25
|
+
var render = (0, _pify2.default)(_less2.default.render.bind(_less2.default));
|
|
7
26
|
|
|
8
27
|
function lessLoader(source) {
|
|
9
28
|
var loaderContext = this;
|
|
10
|
-
var options =
|
|
29
|
+
var options = (0, _getOptions2.default)(loaderContext);
|
|
11
30
|
var done = loaderContext.async();
|
|
12
31
|
var isSync = typeof done !== 'function';
|
|
13
32
|
|
|
@@ -15,8 +34,7 @@ function lessLoader(source) {
|
|
|
15
34
|
throw new Error('Synchronous compilation is not supported anymore. See https://github.com/webpack-contrib/less-loader/issues/84');
|
|
16
35
|
}
|
|
17
36
|
|
|
18
|
-
|
|
37
|
+
(0, _processResult2.default)(loaderContext, render(source, options));
|
|
19
38
|
}
|
|
20
39
|
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
40
|
+
exports.default = lessLoader;
|
package/dist/processResult.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
var removeSourceMappingUrl = require('./removeSourceMappingUrl');
|
|
2
4
|
var formatLessError = require('./formatLessError');
|
|
3
5
|
|
|
@@ -33,5 +35,4 @@ function processResult(loaderContext, resultPromise) {
|
|
|
33
35
|
}, callback);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
module.exports = processResult;
|
|
37
|
-
//# sourceMappingURL=processResult.js.map
|
|
38
|
+
module.exports = processResult;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
var matchSourceMappingUrl = /\/\*# sourceMappingURL=[^*]+\*\//;
|
|
2
4
|
|
|
3
5
|
/**
|
|
@@ -14,5 +16,4 @@ function removeSourceMappingUrl(content) {
|
|
|
14
16
|
return content.replace(matchSourceMappingUrl, '');
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
module.exports = removeSourceMappingUrl;
|
|
18
|
-
//# sourceMappingURL=removeSourceMappingUrl.js.map
|
|
19
|
+
module.exports = removeSourceMappingUrl;
|
package/dist/stringifyLoader.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* The stringifyLoader turns any content into a valid JavaScript string. This allows us to load any content
|
|
3
5
|
* with loaderContext.loadModule() without webpack complaining about non-JS modules.
|
|
@@ -9,5 +11,4 @@ function stringifyLoader(content) {
|
|
|
9
11
|
return JSON.stringify(content);
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
module.exports = stringifyLoader;
|
|
13
|
-
//# sourceMappingURL=stringifyLoader.js.map
|
|
14
|
+
module.exports = stringifyLoader;
|
package/package.json
CHANGED
|
@@ -1,76 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "less-loader",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"author": "Johannes Ewald @jhnns",
|
|
5
5
|
"description": "Less loader for webpack. Compiles Less to CSS.",
|
|
6
|
-
"
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">= 4.8 < 5.0.0 || >= 5.10"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/cjs.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
7
14
|
"scripts": {
|
|
8
15
|
"create-spec": "babel-node test/helpers/createSpec.js",
|
|
9
16
|
"pretest": "npm run create-spec",
|
|
10
17
|
"test": "jest",
|
|
11
18
|
"posttest": "npm run lint",
|
|
12
|
-
"travis:test": "
|
|
13
|
-
"appveyor:test": "npm test",
|
|
19
|
+
"travis:test": "npm run test -- --runInBand",
|
|
20
|
+
"appveyor:test": "npm run test",
|
|
14
21
|
"lint": "eslint --cache src test",
|
|
15
22
|
"webpack-defaults": "webpack-defaults",
|
|
16
|
-
"start": "
|
|
17
|
-
"build": "cross-env NODE_ENV=production babel
|
|
18
|
-
"clean:dist": "del-cli dist",
|
|
23
|
+
"start": "npm run build -- -w",
|
|
24
|
+
"build": "cross-env NODE_ENV=production babel src -d dist --ignore 'src/**/*.test.js' --copy-files",
|
|
19
25
|
"lint-staged": "lint-staged",
|
|
20
|
-
"prebuild": "
|
|
21
|
-
"
|
|
22
|
-
"release": "
|
|
26
|
+
"prebuild": "npm run clean",
|
|
27
|
+
"prepare": "npm run build",
|
|
28
|
+
"release": "standard-version",
|
|
23
29
|
"security": "nsp check",
|
|
24
|
-
"serve:dev": "nodemon $2 --exec babel-node",
|
|
25
30
|
"test:watch": "jest --watch",
|
|
26
31
|
"test:coverage": "jest --collectCoverageFrom='src/**/*.js' --coverage",
|
|
27
|
-
"
|
|
28
|
-
"travis:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"node": ">=4.3 <5.0.0 || >=5.10"
|
|
32
|
+
"pretravis:coverage": "npm run pretest",
|
|
33
|
+
"travis:coverage": "npm run test:coverage -- --runInBand",
|
|
34
|
+
"travis:lint": "npm run lint && npm run security",
|
|
35
|
+
"clean": "del-cli dist"
|
|
32
36
|
},
|
|
33
37
|
"dependencies": {
|
|
34
38
|
"clone": "^2.1.1",
|
|
35
|
-
"loader-utils": "^1.0
|
|
36
|
-
"pify": "^
|
|
39
|
+
"loader-utils": "^1.1.0",
|
|
40
|
+
"pify": "^3.0.0"
|
|
37
41
|
},
|
|
38
42
|
"peerDependencies": {
|
|
39
43
|
"less": "^2.3.1",
|
|
40
|
-
"webpack": "^2.
|
|
44
|
+
"webpack": "^2.0.0 || ^3.0.0 || ^4.0.0"
|
|
41
45
|
},
|
|
42
46
|
"devDependencies": {
|
|
43
47
|
"babel-cli": "^6.24.0",
|
|
44
|
-
"babel-jest": "^
|
|
48
|
+
"babel-jest": "^21.2.0",
|
|
45
49
|
"babel-plugin-transform-object-rest-spread": "^6.23.0",
|
|
46
50
|
"babel-polyfill": "^6.23.0",
|
|
47
|
-
"babel-preset-env": "^1.
|
|
51
|
+
"babel-preset-env": "^1.6.0",
|
|
48
52
|
"cross-env": "^3.2.4",
|
|
49
53
|
"del-cli": "^0.2.1",
|
|
50
|
-
"eslint": "^3.
|
|
51
|
-
"eslint-config-webpack": "^1.1
|
|
54
|
+
"eslint": "^3.18.0",
|
|
55
|
+
"eslint-config-webpack": "^1.2.1",
|
|
52
56
|
"eslint-plugin-import": "^2.2.0",
|
|
53
57
|
"inspect-loader": "^1.0.0",
|
|
54
|
-
"jest": "^
|
|
58
|
+
"jest": "^21.2.1",
|
|
55
59
|
"less": "^2.3.1",
|
|
56
60
|
"lint-staged": "^3.4.0",
|
|
57
61
|
"nodemon": "^1.11.0",
|
|
58
62
|
"nsp": "^2.6.3",
|
|
59
63
|
"pre-commit": "^1.2.2",
|
|
60
64
|
"standard-version": "^4.0.0",
|
|
61
|
-
"webpack": "
|
|
62
|
-
"webpack-defaults": "^
|
|
63
|
-
},
|
|
64
|
-
"repository": {
|
|
65
|
-
"type": "git",
|
|
66
|
-
"url": "git://github.com/webpack-contrib/less-loader.git"
|
|
65
|
+
"webpack": "latest",
|
|
66
|
+
"webpack-defaults": "^1.6.0"
|
|
67
67
|
},
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
"LICENSE",
|
|
72
|
-
"dist"
|
|
73
|
-
],
|
|
68
|
+
"repository": "https://github.com/webpack-contrib/less-loader.git",
|
|
69
|
+
"bugs": "https://github.com/webpack-contrib/less-loader/issues",
|
|
70
|
+
"homepage": "https://github.com/webpack-contrib/less-loader",
|
|
74
71
|
"pre-commit": "lint-staged",
|
|
75
72
|
"lint-staged": {
|
|
76
73
|
"*.js": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/createWebpackLessPlugin.js"],"names":["less","require","loaderUtils","pify","stringifyLoader","resolve","trailingSlash","isLessCompatible","matchMalformedModuleFilename","createWebpackLessPlugin","loaderContext","fs","bind","loadModule","readFile","WebpackFileManager","filename","currentDirectory","url","replace","moduleRequest","urlToRequest","context","resolvedFilename","then","f","addDependency","test","contents","toString","join","JSON","parse","FileManager","install","lessInstance","pluginManager","addFileManager","minVersion","module","exports"],"mappings":";;;;;;;;AAAA,IAAMA,OAAOC,QAAQ,MAAR,CAAb;AACA,IAAMC,cAAcD,QAAQ,cAAR,CAApB;AACA,IAAME,OAAOF,QAAQ,MAAR,CAAb;;AAEA,IAAMG,kBAAkBH,QAAQI,OAAR,CAAgB,sBAAhB,CAAxB;AACA,IAAMC,gBAAgB,QAAtB;AACA,IAAMC,mBAAmB,aAAzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,+BAA+B,mBAArC;;AAEA;;;;;;;AAOA,SAASC,uBAAT,CAAiCC,aAAjC,EAAgD;AAAA,MACtCC,EADsC,GAC/BD,aAD+B,CACtCC,EADsC;;AAE9C,MAAMN,UAAUF,KAAKO,cAAcL,OAAd,CAAsBO,IAAtB,CAA2BF,aAA3B,CAAL,CAAhB;AACA,MAAMG,aAAaV,KAAKO,cAAcG,UAAd,CAAyBD,IAAzB,CAA8BF,aAA9B,CAAL,CAAnB;AACA,MAAMI,WAAWX,KAAKQ,GAAGG,QAAH,CAAYF,IAAZ,CAAiBD,EAAjB,CAAL,CAAjB;;AAJ8C,MAMxCI,kBANwC;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA,iCAOnC,sDAAwD;AAAE;AACjE;AACA,eAAO,IAAP;AACD;AAV2C;AAAA;AAAA,+BAYnCC,QAZmC,EAYzBC,gBAZyB,CAYR,4BAZQ,EAYsB;AAAE;AAClE,YAAMC,MAAMF,SAASG,OAAT,CAAiBX,4BAAjB,EAA+C,IAA/C,CAAZ;AACA,YAAMY,gBAAgBlB,YAAYmB,YAAZ,CAAyBH,GAAzB,CAAtB;AACA;AACA,YAAMI,UAAUL,iBAAiBE,OAAjB,CAAyBb,aAAzB,EAAwC,EAAxC,CAAhB;AACA,YAAIiB,yBAAJ;;AAEA,eAAOlB,QAAQiB,OAAR,EAAiBF,aAAjB,EACJI,IADI,CACC,UAACC,CAAD,EAAO;AACXF,6BAAmBE,CAAnB;AACAf,wBAAcgB,aAAd,CAA4BH,gBAA5B;;AAEA,cAAIhB,iBAAiBoB,IAAjB,CAAsBJ,gBAAtB,CAAJ,EAA6C;AAC3C,mBAAOT,SAASS,gBAAT,EACJC,IADI,CACC;AAAA,qBAAYI,SAASC,QAAT,CAAkB,MAAlB,CAAZ;AAAA,aADD,CAAP;AAED;;AAED,iBAAOhB,WAAW,CAACT,eAAD,EAAkBmB,gBAAlB,EAAoCO,IAApC,CAAyC,GAAzC,CAAX,EACJN,IADI,CACCO,KAAKC,KADN,CAAP;AAED,SAZI,EAaJR,IAbI,CAaC,UAACI,QAAD,EAAc;AAClB,iBAAO;AACLA,oBADK;AAELZ,sBAAUO;AAFL,WAAP;AAID,SAlBI,CAAP;AAmBD;AAtC2C;;AAAA;AAAA,IAMbvB,KAAKiC,WANQ;;AAyC9C,SAAO;AACLC,YAAQC,YAAR,EAAsBC,aAAtB,EAAqC;AACnCA,oBAAcC,cAAd,CAA6B,IAAItB,kBAAJ,EAA7B;AACD,KAHI;AAILuB,gBAAY,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP;AAJP,GAAP;AAMD;;AAEDC,OAAOC,OAAP,GAAiB/B,uBAAjB","file":"createWebpackLessPlugin.js","sourcesContent":["const less = require('less');\nconst loaderUtils = require('loader-utils');\nconst pify = require('pify');\n\nconst stringifyLoader = require.resolve('./stringifyLoader.js');\nconst trailingSlash = /[/\\\\]$/;\nconst isLessCompatible = /\\.(le|c)ss$/;\n// Less automatically adds a .less file extension if no extension was given.\n// This is problematic if there is a module request like @import \"~some-module\";\n// because in this case Less will call our file manager with `~some-module.less`.\n// Since dots in module names are highly discouraged, we can safely assume that\n// this is an error and we need to remove the .less extension again.\n// However, we must not match something like @import \"~some-module/file.less\";\nconst matchMalformedModuleFilename = /(~[^/\\\\]+)\\.less$/;\n\n/**\n * Creates a Less plugin that uses webpack's resolving engine that is provided by the loaderContext.\n *\n * @param {LoaderContext} loaderContext\n * @param {string=} root\n * @returns {LessPlugin}\n */\nfunction createWebpackLessPlugin(loaderContext) {\n const { fs } = loaderContext;\n const resolve = pify(loaderContext.resolve.bind(loaderContext));\n const loadModule = pify(loaderContext.loadModule.bind(loaderContext));\n const readFile = pify(fs.readFile.bind(fs));\n\n class WebpackFileManager extends less.FileManager {\n supports(/* filename, currentDirectory, options, environment */) { // eslint-disable-line class-methods-use-this\n // Our WebpackFileManager handles all the files\n return true;\n }\n\n loadFile(filename, currentDirectory /* , options, environment */) { // eslint-disable-line class-methods-use-this\n const url = filename.replace(matchMalformedModuleFilename, '$1');\n const moduleRequest = loaderUtils.urlToRequest(url);\n // Less is giving us trailing slashes, but the context should have no trailing slash\n const context = currentDirectory.replace(trailingSlash, '');\n let resolvedFilename;\n\n return resolve(context, moduleRequest)\n .then((f) => {\n resolvedFilename = f;\n loaderContext.addDependency(resolvedFilename);\n\n if (isLessCompatible.test(resolvedFilename)) {\n return readFile(resolvedFilename)\n .then(contents => contents.toString('utf8'));\n }\n\n return loadModule([stringifyLoader, resolvedFilename].join('!'))\n .then(JSON.parse);\n })\n .then((contents) => {\n return {\n contents,\n filename: resolvedFilename,\n };\n });\n }\n }\n\n return {\n install(lessInstance, pluginManager) {\n pluginManager.addFileManager(new WebpackFileManager());\n },\n minVersion: [2, 1, 1],\n };\n}\n\nmodule.exports = createWebpackLessPlugin;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/formatLessError.js"],"names":["os","require","getFileExcerptIfPossible","lessErr","excerpt","extract","slice","column","Math","max","shift","push","Array","join","unexpectedErr","formatLessError","err","msg","message","hideStack","EOL","charAt","toUpperCase","filename","line","module","exports"],"mappings":";;AAAA,IAAMA,KAAKC,QAAQ,IAAR,CAAX;;AAEA;;;;;;;;;AASA,SAASC,wBAAT,CAAkCC,OAAlC,EAA2C;AACzC,MAAI;AACF,QAAMC,UAAUD,QAAQE,OAAR,CAAgBC,KAAhB,CAAsB,CAAtB,EAAyB,CAAzB,CAAhB;AACA,QAAMC,SAASC,KAAKC,GAAL,CAASN,QAAQI,MAAR,GAAiB,CAA1B,EAA6B,CAA7B,CAAf;;AAEA,QAAI,OAAOH,QAAQ,CAAR,CAAP,KAAsB,WAA1B,EAAuC;AACrCA,cAAQM,KAAR;AACD;;AAEDN,YAAQO,IAAR,CAAc,GAAE,IAAIC,KAAJ,CAAUL,MAAV,EAAkBM,IAAlB,CAAuB,GAAvB,CAA4B,GAA5C;;AAEA,WAAOT,OAAP;AACD,GAXD,CAWE,OAAOU,aAAP,EAAsB;AACtB;AACA,WAAO,EAAP;AACD;AACF;;AAED;;;;;;;;;;;;;;;AAeA,SAASC,eAAT,CAAyBC,GAAzB,EAA8B;AAAE;AAC9B,MAAMC,MAAMD,IAAIE,OAAhB;;AAEA;AACA;AACAF,MAAIG,SAAJ,GAAgB,IAAhB;;AAEAH,MAAIE,OAAJ,GAAc,CACZlB,GAAGoB,GADS,4BAETlB,yBAAyBc,GAAzB,CAFS,IAGZC,IAAII,MAAJ,CAAW,CAAX,EAAcC,WAAd,KAA8BL,IAAIX,KAAJ,CAAU,CAAV,CAHlB,EAIX,YAAWU,IAAIO,QAAS,UAASP,IAAIQ,IAAK,YAAWR,IAAIT,MAAO,GAJrD,GAKZM,IALY,CAKPb,GAAGoB,GALI,CAAd;;AAOA,SAAOJ,GAAP;AACD,C,CAAC;;AAEFS,OAAOC,OAAP,GAAiBX,eAAjB","file":"formatLessError.js","sourcesContent":["const os = require('os');\n\n/**\n * Tries to get an excerpt of the file where the error happened.\n * Uses err.line and err.column.\n *\n * Returns an empty string if the excerpt could not be retrieved.\n *\n * @param {LessError} err\n * @returns {Array<string>}\n */\nfunction getFileExcerptIfPossible(lessErr) {\n try {\n const excerpt = lessErr.extract.slice(0, 2);\n const column = Math.max(lessErr.column - 1, 0);\n\n if (typeof excerpt[0] === 'undefined') {\n excerpt.shift();\n }\n\n excerpt.push(`${new Array(column).join(' ')}^`);\n\n return excerpt;\n } catch (unexpectedErr) {\n // If anything goes wrong here, we don't want any errors to be reported to the user\n return [];\n }\n}\n\n/**\n * Beautifies the error message from Less.\n *\n * @param {LessError} lessErr\n * @param {string} lessErr.type - e.g. 'Name'\n * @param {string} lessErr.message - e.g. '.undefined-mixin is undefined'\n * @param {string} lessErr.filename - e.g. '/path/to/style.less'\n * @param {number} lessErr.index - e.g. 352\n * @param {number} lessErr.line - e.g. 31\n * @param {number} lessErr.callLine - e.g. NaN\n * @param {string} lessErr.callExtract - e.g. undefined\n * @param {number} lessErr.column - e.g. 6\n * @param {Array<string>} lessErr.extract - e.g. [' .my-style {', ' .undefined-mixin;', ' display: block;']\n * @returns {LessError}\n */\nfunction formatLessError(err) { /* eslint-disable no-param-reassign */\n const msg = err.message;\n\n // Instruct webpack to hide the JS stack from the console\n // Usually you're only interested in the SASS stack in this case.\n err.hideStack = true;\n\n err.message = [\n os.EOL,\n ...getFileExcerptIfPossible(err),\n msg.charAt(0).toUpperCase() + msg.slice(1),\n ` in ${err.filename} (line ${err.line}, column ${err.column})`,\n ].join(os.EOL);\n\n return err;\n} /* eslint-enable no-param-reassign */\n\nmodule.exports = formatLessError;\n"]}
|
package/dist/getOptions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/getOptions.js"],"names":["loaderUtils","require","clone","createWebpackLessPlugin","getOptions","loaderContext","options","plugins","relativeUrls","compress","Boolean","minimize","filename","resource","push","module","exports"],"mappings":"AAAA,IAAMA,cAAcC,QAAQ,cAAR,CAApB;AACA,IAAMC,QAAQD,QAAQ,OAAR,CAAd;AACA,IAAME,0BAA0BF,QAAQ,2BAAR,CAAhC;;AAEA;;;;;AAKA,SAASG,UAAT,CAAoBC,aAApB,EAAmC;AACjC,MAAMC;AACJC,aAAS,EADL;AAEJC,kBAAc,IAFV;AAGJC,cAAUC,QAAQL,cAAcM,QAAtB;AAHN,KAIDT,MAAMF,YAAYI,UAAZ,CAAuBC,aAAvB,CAAN,CAJC,CAAN;;AAOA;AACAC,UAAQM,QAAR,GAAmBP,cAAcQ,QAAjC;;AAEA;AACA,MAAI,WAAWP,OAAX,KAAuB,KAA3B,EAAkC;AAChC;AACAA,YAAQC,OAAR,CAAgBO,IAAhB,CAAqBX,wBAAwBE,aAAxB,CAArB;AACD;;AAED,SAAOC,OAAP;AACD;;AAEDS,OAAOC,OAAP,GAAiBZ,UAAjB","file":"getOptions.js","sourcesContent":["const loaderUtils = require('loader-utils');\nconst clone = require('clone');\nconst createWebpackLessPlugin = require('./createWebpackLessPlugin');\n\n/**\n * Retrieves the options from the loaderContext, makes a deep copy of it and normalizes it for further consumption.\n *\n * @param {LoaderContext} loaderContext\n */\nfunction getOptions(loaderContext) {\n const options = {\n plugins: [],\n relativeUrls: true,\n compress: Boolean(loaderContext.minimize),\n ...clone(loaderUtils.getOptions(loaderContext)),\n };\n\n // We need to set the filename because otherwise our WebpackFileManager will receive an undefined path for the entry\n options.filename = loaderContext.resource;\n\n // When no paths are given, we use the webpack resolver\n if ('paths' in options === false) {\n // It's safe to mutate the array now because it has already been cloned\n options.plugins.push(createWebpackLessPlugin(loaderContext));\n }\n\n return options;\n}\n\nmodule.exports = getOptions;\n"]}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["less","require","pify","processResult","getOptions","render","bind","lessLoader","source","loaderContext","options","done","async","isSync","Error","module","exports"],"mappings":"AAAA,IAAMA,OAAOC,QAAQ,MAAR,CAAb;AACA,IAAMC,OAAOD,QAAQ,MAAR,CAAb;AACA,IAAME,gBAAgBF,QAAQ,iBAAR,CAAtB;AACA,IAAMG,aAAaH,QAAQ,cAAR,CAAnB;;AAEA,IAAMI,SAASH,KAAKF,KAAKK,MAAL,CAAYC,IAAZ,CAAiBN,IAAjB,CAAL,CAAf;;AAEA,SAASO,UAAT,CAAoBC,MAApB,EAA4B;AAC1B,MAAMC,gBAAgB,IAAtB;AACA,MAAMC,UAAUN,WAAWK,aAAX,CAAhB;AACA,MAAME,OAAOF,cAAcG,KAAd,EAAb;AACA,MAAMC,SAAS,OAAOF,IAAP,KAAgB,UAA/B;;AAEA,MAAIE,MAAJ,EAAY;AACV,UAAM,IAAIC,KAAJ,CAAU,gHAAV,CAAN;AACD;;AAEDX,gBAAcM,aAAd,EAA6BJ,OAAOG,MAAP,EAAeE,OAAf,CAA7B;AACD;;AAEDK,OAAOC,OAAP,GAAiBT,UAAjB","file":"index.js","sourcesContent":["const less = require('less');\nconst pify = require('pify');\nconst processResult = require('./processResult');\nconst getOptions = require('./getOptions');\n\nconst render = pify(less.render.bind(less));\n\nfunction lessLoader(source) {\n const loaderContext = this;\n const options = getOptions(loaderContext);\n const done = loaderContext.async();\n const isSync = typeof done !== 'function';\n\n if (isSync) {\n throw new Error('Synchronous compilation is not supported anymore. See https://github.com/webpack-contrib/less-loader/issues/84');\n }\n\n processResult(loaderContext, render(source, options));\n}\n\nmodule.exports = lessLoader;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/processResult.js"],"names":["removeSourceMappingUrl","require","formatLessError","processResult","loaderContext","resultPromise","callback","then","css","map","imports","forEach","addDependency","JSON","parse","lessError","module","exports"],"mappings":"AAAA,IAAMA,yBAAyBC,QAAQ,0BAAR,CAA/B;AACA,IAAMC,kBAAkBD,QAAQ,mBAAR,CAAxB;;AAEA;;;;;;AAMA,SAASE,aAAT,CAAuBC,aAAvB,EAAsCC,aAAtC,EAAqD;AAAA,MAC3CC,QAD2C,GAC9BF,aAD8B,CAC3CE,QAD2C;;;AAGnDD,gBACGE,IADH,CACQ,gBAA2B;AAAA,QAAxBC,GAAwB,QAAxBA,GAAwB;AAAA,QAAnBC,GAAmB,QAAnBA,GAAmB;AAAA,QAAdC,OAAc,QAAdA,OAAc;;AAC/BA,YAAQC,OAAR,CAAgBP,cAAcQ,aAA9B,EAA6CR,aAA7C;AACA,WAAO;AACL;AACA;AACAI,WAAKR,uBAAuBQ,GAAvB,CAHA;AAILC,WAAK,OAAOA,GAAP,KAAe,QAAf,GAA0BI,KAAKC,KAAL,CAAWL,GAAX,CAA1B,GAA4CA;AAJ5C,KAAP;AAMD,GATH,EASK,UAACM,SAAD,EAAe;AAChB,UAAMb,gBAAgBa,SAAhB,CAAN;AACD,GAXH,EAYGR,IAZH,CAYQ,iBAAkB;AAAA,QAAfC,GAAe,SAAfA,GAAe;AAAA,QAAVC,GAAU,SAAVA,GAAU;;AACtBH,aAAS,IAAT,EAAeE,GAAf,EAAoBC,GAApB;AACD,GAdH,EAcKH,QAdL;AAeD;;AAEDU,OAAOC,OAAP,GAAiBd,aAAjB","file":"processResult.js","sourcesContent":["const removeSourceMappingUrl = require('./removeSourceMappingUrl');\nconst formatLessError = require('./formatLessError');\n\n/**\n * Removes the sourceMappingURL from the generated CSS, parses the source map and calls the next loader.\n *\n * @param {loaderContext} loaderContext\n * @param {Promise<LessResult>} resultPromise\n */\nfunction processResult(loaderContext, resultPromise) {\n const { callback } = loaderContext;\n\n resultPromise\n .then(({ css, map, imports }) => {\n imports.forEach(loaderContext.addDependency, loaderContext);\n return {\n // Removing the sourceMappingURL comment.\n // See removeSourceMappingUrl.js for the reasoning behind this.\n css: removeSourceMappingUrl(css),\n map: typeof map === 'string' ? JSON.parse(map) : map,\n };\n }, (lessError) => {\n throw formatLessError(lessError);\n })\n .then(({ css, map }) => {\n callback(null, css, map);\n }, callback);\n}\n\nmodule.exports = processResult;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/removeSourceMappingUrl.js"],"names":["matchSourceMappingUrl","removeSourceMappingUrl","content","replace","module","exports"],"mappings":"AAAA,IAAMA,wBAAwB,kCAA9B;;AAEA;;;;;;;;;;AAUA,SAASC,sBAAT,CAAgCC,OAAhC,EAAyC;AACvC,SAAOA,QAAQC,OAAR,CAAgBH,qBAAhB,EAAuC,EAAvC,CAAP;AACD;;AAEDI,OAAOC,OAAP,GAAiBJ,sBAAjB","file":"removeSourceMappingUrl.js","sourcesContent":["const matchSourceMappingUrl = /\\/\\*# sourceMappingURL=[^*]+\\*\\//;\n\n/**\n * Removes the sourceMappingURL comment. This is necessary because the less-loader\n * does not know where the final source map will be located. Thus, we remove every\n * reference to source maps. In a regular setup, the css-loader will embed the\n * source maps into the CommonJS module and the style-loader will translate it into\n * base64 blob urls.\n *\n * @param {string} content\n * @returns {string}\n */\nfunction removeSourceMappingUrl(content) {\n return content.replace(matchSourceMappingUrl, '');\n}\n\nmodule.exports = removeSourceMappingUrl;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/stringifyLoader.js"],"names":["stringifyLoader","content","JSON","stringify","module","exports"],"mappings":"AAAA;;;;;;;AAOA,SAASA,eAAT,CAAyBC,OAAzB,EAAkC;AAChC,SAAOC,KAAKC,SAAL,CAAeF,OAAf,CAAP;AACD;;AAEDG,OAAOC,OAAP,GAAiBL,eAAjB","file":"stringifyLoader.js","sourcesContent":["/**\n * The stringifyLoader turns any content into a valid JavaScript string. This allows us to load any content\n * with loaderContext.loadModule() without webpack complaining about non-JS modules.\n *\n * @param {string} content\n * @return {string}\n */\nfunction stringifyLoader(content) {\n return JSON.stringify(content);\n}\n\nmodule.exports = stringifyLoader;\n"]}
|