less-loader 4.1.0 → 5.0.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 +26 -0
- package/README.md +226 -179
- package/dist/cjs.js +1 -1
- package/dist/createWebpackLessPlugin.js +62 -84
- package/dist/formatLessError.js +14 -16
- package/dist/getOptions.js +17 -11
- package/dist/index.js +14 -20
- package/dist/processResult.js +21 -15
- package/dist/removeSourceMappingUrl.js +3 -3
- package/package.json +59 -54
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
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="5.0.0"></a>
|
|
6
|
+
# [5.0.0](https://github.com/webpack-contrib/less-loader/compare/v4.1.0...v5.0.0) (2019-04-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* webpack watching does not recover after broken less is fixed ([#289](https://github.com/webpack-contrib/less-loader/issues/289)) ([f41d12e](https://github.com/webpack-contrib/less-loader/commit/f41d12e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Chores
|
|
15
|
+
|
|
16
|
+
* remove old bits mentioning webpack < 4 and node < 6 ([#286](https://github.com/webpack-contrib/less-loader/issues/286)) ([012eb8f](https://github.com/webpack-contrib/less-loader/commit/012eb8f))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Code Refactoring
|
|
20
|
+
|
|
21
|
+
* remove deprecated compress option ([#283](https://github.com/webpack-contrib/less-loader/issues/283)) ([3d6e9e9](https://github.com/webpack-contrib/less-loader/commit/3d6e9e9))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### BREAKING CHANGES
|
|
25
|
+
|
|
26
|
+
* remove deprecated compress option.
|
|
27
|
+
* drop support for node < 6.9 and webpack < 4
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
5
31
|
<a name="4.1.0"></a>
|
|
6
32
|
# [4.1.0](https://github.com/webpack-contrib/less-loader/compare/v4.0.6...v4.1.0) (2018-03-09)
|
|
7
33
|
|
package/README.md
CHANGED
|
@@ -1,279 +1,326 @@
|
|
|
1
|
-
[![npm][npm]][npm-url]
|
|
2
|
-
[![node][node]][node-url]
|
|
3
|
-
[![npm-stats][npm-stats]][npm-url]
|
|
4
|
-
[![deps][deps]][deps-url]
|
|
5
|
-
[![travis][travis]][travis-url]
|
|
6
|
-
[![appveyor][appveyor]][appveyor-url]
|
|
7
|
-
[![coverage][coverage]][coverage-url]
|
|
8
|
-
[![chat][chat]][chat-url]
|
|
9
|
-
|
|
10
1
|
<div align="center">
|
|
11
|
-
<img width="200" height="200"
|
|
12
|
-
src="https://cdn.worldvectorlogo.com/logos/less-63.svg">
|
|
13
2
|
<a href="https://github.com/webpack/webpack">
|
|
14
|
-
<img width="200" height="200"
|
|
15
|
-
src="https://webpack.js.org/assets/icon-square-big.svg">
|
|
3
|
+
<img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg">
|
|
16
4
|
</a>
|
|
17
5
|
</div>
|
|
18
6
|
|
|
19
|
-
|
|
7
|
+
[![npm][npm]][npm-url]
|
|
8
|
+
[![node][node]][node-url]
|
|
9
|
+
[![deps][deps]][deps-url]
|
|
10
|
+
[![tests][tests]][tests-url]
|
|
11
|
+
[![cover][cover]][cover-url]
|
|
12
|
+
[![chat][chat]][chat-url]
|
|
13
|
+
[![size][size]][size-url]
|
|
20
14
|
|
|
21
|
-
|
|
15
|
+
# less-loader
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
A Less loader for webpack. Compiles Less to CSS.
|
|
24
18
|
|
|
19
|
+
## Getting Started
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
To begin, you'll need to install `less-loader`:
|
|
27
22
|
|
|
28
|
-
```
|
|
29
|
-
npm install --save-dev
|
|
23
|
+
```console
|
|
24
|
+
$ npm install less-loader --save-dev
|
|
30
25
|
```
|
|
31
26
|
|
|
32
|
-
|
|
27
|
+
Then add the loader to your `webpack` config. For example:
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Chain the `less-loader` with the [`css-loader`](https://github.com/webpack-contrib/css-loader) and the [`style-loader`](https://github.com/webpack-contrib/style-loader) to immediately apply all styles to the DOM.
|
|
29
|
+
**webpack.config.js**
|
|
37
30
|
|
|
38
31
|
```js
|
|
39
|
-
// webpack.config.js
|
|
40
32
|
module.exports = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}, {
|
|
50
|
-
loader: "less-loader" // compiles Less to CSS
|
|
51
|
-
}]
|
|
52
|
-
}]
|
|
53
|
-
}
|
|
33
|
+
module: {
|
|
34
|
+
rules: [
|
|
35
|
+
{
|
|
36
|
+
test: /\.less$/,
|
|
37
|
+
loader: 'less-loader', // compiles Less to CSS
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
54
41
|
};
|
|
55
42
|
```
|
|
56
43
|
|
|
57
|
-
|
|
44
|
+
And run `webpack` via your preferred method.
|
|
45
|
+
|
|
46
|
+
The `less-loader` requires [less](https://github.com/less/less.js) as [`peerDependency`](https://docs.npmjs.com/files/package.json#peerdependencies).
|
|
47
|
+
Thus you are able to control the versions accurately.
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
Chain the `less-loader` with the
|
|
52
|
+
[`css-loader`](https://github.com/webpack-contrib/css-loader) and the
|
|
53
|
+
[`style-loader`](https://github.com/webpack-contrib/style-loader) to immediately
|
|
54
|
+
apply all styles to the DOM.
|
|
55
|
+
|
|
56
|
+
**webpack.config.js**
|
|
58
57
|
|
|
59
58
|
```js
|
|
60
|
-
// webpack.config.js
|
|
61
59
|
module.exports = {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
module: {
|
|
61
|
+
rules: [
|
|
62
|
+
{
|
|
63
|
+
test: /\.less$/,
|
|
64
|
+
use: [
|
|
65
|
+
{
|
|
66
|
+
loader: 'style-loader', // creates style nodes from JS strings
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
loader: 'css-loader', // translates CSS into CommonJS
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
loader: 'less-loader', // compiles Less to CSS
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
78
|
};
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
You can pass any Less specific options to the `less-loader` via [loader options](https://webpack.js.org/configuration/module/#rule-options-rule-query).
|
|
82
|
+
See the [Less documentation](http://lesscss.org/usage/#command-line-usage-options)
|
|
83
|
+
for all available options in dash-case. Since we're passing these options to
|
|
84
|
+
Less programmatically, you need to pass them in camelCase here:
|
|
84
85
|
|
|
85
|
-
|
|
86
|
+
**webpack.config.js**
|
|
86
87
|
|
|
87
88
|
```js
|
|
88
|
-
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
89
|
-
|
|
90
|
-
const extractLess = new ExtractTextPlugin({
|
|
91
|
-
filename: "[name].[contenthash].css",
|
|
92
|
-
disable: process.env.NODE_ENV === "development"
|
|
93
|
-
});
|
|
94
|
-
|
|
95
89
|
module.exports = {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
90
|
+
module: {
|
|
91
|
+
rules: [
|
|
92
|
+
{
|
|
93
|
+
test: /\.less$/,
|
|
94
|
+
use: [
|
|
95
|
+
{
|
|
96
|
+
loader: 'style-loader',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
loader: 'css-loader',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
loader: 'less-loader',
|
|
103
|
+
options: {
|
|
104
|
+
strictMath: true,
|
|
105
|
+
noIeCompat: true,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
},
|
|
114
112
|
};
|
|
115
113
|
```
|
|
116
114
|
|
|
117
|
-
|
|
115
|
+
Unfortunately, Less doesn't map all options 1-by-1 to camelCase. When in doubt,
|
|
116
|
+
[check their executable](https://github.com/less/less.js/blob/3.x/bin/lessc)
|
|
117
|
+
and search for the dash-case option.
|
|
118
|
+
|
|
119
|
+
### In production
|
|
120
|
+
|
|
121
|
+
Usually, it's recommended to extract the style sheets into a dedicated file in
|
|
122
|
+
production using the
|
|
123
|
+
[MiniCssExtractPlugin](https://github.com/webpack-contrib/mini-css-extract-plugin).
|
|
124
|
+
This way your styles are not dependent on JavaScript.
|
|
118
125
|
|
|
119
126
|
### Imports
|
|
120
127
|
|
|
121
|
-
Starting with `less-loader` 4, you can now choose between Less' builtin resolver
|
|
128
|
+
Starting with `less-loader` 4, you can now choose between Less' builtin resolver
|
|
129
|
+
and webpack's resolver. By default, webpack's resolver is used.
|
|
122
130
|
|
|
123
131
|
#### webpack resolver
|
|
124
132
|
|
|
125
|
-
webpack provides an
|
|
133
|
+
webpack provides an
|
|
134
|
+
[advanced mechanism to resolve files](https://webpack.js.org/configuration/resolve/).
|
|
135
|
+
The `less-loader` applies a Less plugin that passes all queries to the webpack
|
|
136
|
+
resolver. Thus you can import your Less modules from `node_modules`. Just
|
|
137
|
+
prepend them with a `~` which tells webpack to look up the
|
|
138
|
+
[`modules`](https://webpack.js.org/configuration/resolve/#resolve-modules).
|
|
126
139
|
|
|
127
140
|
```css
|
|
128
|
-
@import
|
|
141
|
+
@import '~bootstrap/less/bootstrap';
|
|
129
142
|
```
|
|
130
143
|
|
|
131
|
-
It's important to only prepend it with `~`, because `~/` resolves to the
|
|
144
|
+
It's important to only prepend it with `~`, because `~/` resolves to the
|
|
145
|
+
home-directory. webpack needs to distinguish between `bootstrap` and
|
|
146
|
+
`~bootstrap`, because CSS and Less files have no special syntax for importing
|
|
147
|
+
relative files. Writing `@import "file"` is the same as `@import "./file";`
|
|
132
148
|
|
|
133
149
|
##### Non-Less imports
|
|
134
150
|
|
|
135
|
-
Using webpack's resolver, you can import any file type. You just need a loader
|
|
151
|
+
Using webpack's resolver, you can import any file type. You just need a loader
|
|
152
|
+
that exports valid Less code. Often, you will also want to set the `issuer`
|
|
153
|
+
condition to ensure that this rule is only applied on imports originating from
|
|
154
|
+
Less files:
|
|
136
155
|
|
|
137
156
|
```js
|
|
138
157
|
// webpack.config.js
|
|
139
158
|
module.exports = {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
159
|
+
module: {
|
|
160
|
+
rules: [
|
|
161
|
+
{
|
|
162
|
+
test: /\.js$/,
|
|
163
|
+
issuer: /\.less$/,
|
|
164
|
+
use: [
|
|
165
|
+
{
|
|
166
|
+
loader: 'js-to-less-loader',
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
},
|
|
150
172
|
};
|
|
151
173
|
```
|
|
152
174
|
|
|
153
175
|
#### Less resolver
|
|
154
176
|
|
|
155
|
-
If you specify the `paths` option, the `less-loader` will not use webpack's
|
|
177
|
+
If you specify the `paths` option, the `less-loader` will not use webpack's
|
|
178
|
+
resolver. Modules, that can't be resolved in the local folder, will be searched
|
|
179
|
+
in the given `paths`. This is Less' default behavior. `paths` should be an array
|
|
180
|
+
with absolute paths:
|
|
181
|
+
|
|
182
|
+
**webpack.config.js**
|
|
156
183
|
|
|
157
184
|
```js
|
|
158
|
-
// webpack.config.js
|
|
159
185
|
module.exports = {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
186
|
+
module: {
|
|
187
|
+
rules: [
|
|
188
|
+
{
|
|
189
|
+
test: /\.less$/,
|
|
190
|
+
use: [
|
|
191
|
+
{
|
|
192
|
+
loader: 'style-loader',
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
loader: 'css-loader',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
loader: 'less-loader',
|
|
199
|
+
options: {
|
|
200
|
+
paths: [path.resolve(__dirname, 'node_modules')],
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
},
|
|
177
207
|
};
|
|
178
208
|
```
|
|
179
209
|
|
|
180
|
-
In this case, all webpack features like importing non-Less files or aliasing
|
|
210
|
+
In this case, all webpack features like importing non-Less files or aliasing
|
|
211
|
+
won't work of course.
|
|
181
212
|
|
|
182
213
|
### Plugins
|
|
183
214
|
|
|
184
|
-
In order to use [plugins](http://lesscss.org/usage/#plugins), simply set the
|
|
215
|
+
In order to use [plugins](http://lesscss.org/usage/#plugins), simply set the
|
|
216
|
+
`plugins` option like this:
|
|
185
217
|
|
|
186
218
|
```js
|
|
187
219
|
// webpack.config.js
|
|
188
|
-
const CleanCSSPlugin = require(
|
|
220
|
+
const CleanCSSPlugin = require('less-plugin-clean-css');
|
|
189
221
|
|
|
190
222
|
module.exports = {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
223
|
+
...
|
|
224
|
+
{
|
|
225
|
+
loader: 'less-loader', options: {
|
|
226
|
+
plugins: [
|
|
227
|
+
new CleanCSSPlugin({ advanced: true })
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
}]
|
|
231
|
+
...
|
|
200
232
|
};
|
|
201
233
|
```
|
|
202
234
|
|
|
203
235
|
### Extracting style sheets
|
|
204
236
|
|
|
205
|
-
Bundling CSS with webpack has some nice advantages like referencing images and
|
|
237
|
+
Bundling CSS with webpack has some nice advantages like referencing images and
|
|
238
|
+
fonts with hashed urls or
|
|
239
|
+
[hot module replacement](https://webpack.js.org/concepts/hot-module-replacement/)
|
|
240
|
+
in development. In production, on the other hand, it's not a good idea to apply
|
|
241
|
+
your style sheets depending on JS execution. Rendering may be delayed or even a
|
|
242
|
+
[FOUC](https://en.wikipedia.org/wiki/Flash_of_unstyled_content) might be visible.
|
|
243
|
+
Thus it's often still better to have them as separate files in your final
|
|
244
|
+
production build.
|
|
206
245
|
|
|
207
246
|
There are two possibilities to extract a style sheet from the bundle:
|
|
208
247
|
|
|
209
|
-
- [`extract-loader`](https://github.com/peerigon/extract-loader) (simpler, but
|
|
210
|
-
|
|
248
|
+
- [`extract-loader`](https://github.com/peerigon/extract-loader) (simpler, but
|
|
249
|
+
specialized on the css-loader's output)
|
|
250
|
+
- [MiniCssExtractPlugin](https://github.com/webpack-contrib/mini-css-extract-plugin)
|
|
251
|
+
(more complex, but works in all use-cases)
|
|
211
252
|
|
|
212
253
|
### Source maps
|
|
213
254
|
|
|
214
|
-
To enable CSS source maps, you'll need to pass the `sourceMap` option to the
|
|
255
|
+
To enable CSS source maps, you'll need to pass the `sourceMap` option to the
|
|
256
|
+
`less-loader` _and_ the `css-loader`. Your `webpack.config.js` should look
|
|
257
|
+
like this:
|
|
258
|
+
|
|
259
|
+
**webpack.config.js**
|
|
215
260
|
|
|
216
261
|
```javascript
|
|
217
262
|
module.exports = {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
263
|
+
module: {
|
|
264
|
+
rules: [
|
|
265
|
+
{
|
|
266
|
+
test: /\.less$/,
|
|
267
|
+
use: [
|
|
268
|
+
{
|
|
269
|
+
loader: 'style-loader',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
loader: 'css-loader',
|
|
273
|
+
options: {
|
|
274
|
+
sourceMap: true,
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
loader: 'less-loader',
|
|
279
|
+
options: {
|
|
280
|
+
sourceMap: true,
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
},
|
|
285
|
+
],
|
|
286
|
+
},
|
|
235
287
|
};
|
|
236
288
|
```
|
|
237
289
|
|
|
238
290
|
Also checkout the [sourceMaps example](https://github.com/webpack-contrib/less-loader/tree/master/examples/sourceMaps).
|
|
239
291
|
|
|
240
|
-
If you want to edit the original Less files inside Chrome,
|
|
292
|
+
If you want to edit the original Less files inside Chrome,
|
|
293
|
+
[there's a good blog post](https://medium.com/@toolmantim/getting-started-with-css-sourcemaps-and-in-browser-sass-editing-b4daab987fb0).
|
|
294
|
+
The blog post is about Sass but it also works for Less.
|
|
241
295
|
|
|
242
296
|
### CSS modules gotcha
|
|
243
297
|
|
|
244
|
-
There is a known problem with Less and
|
|
298
|
+
There is a known problem with Less and
|
|
299
|
+
[CSS modules](https://github.com/css-modules/css-modules) regarding relative
|
|
300
|
+
file paths in `url(...)` statements.
|
|
301
|
+
[See this issue for an explanation](https://github.com/webpack-contrib/less-loader/issues/109#issuecomment-253797335).
|
|
245
302
|
|
|
246
|
-
|
|
303
|
+
## Contributing
|
|
247
304
|
|
|
248
|
-
|
|
249
|
-
<tr>
|
|
250
|
-
<td align="center">
|
|
251
|
-
<a href="https://github.com/jhnns"><img width="150" height="150" src="https://github.com/jhnns.png?s=150"></a>
|
|
252
|
-
<br>
|
|
253
|
-
<a href="https://github.com/jhnns">Johannes Ewald</a>
|
|
254
|
-
</td>
|
|
255
|
-
<tr>
|
|
256
|
-
</table>
|
|
305
|
+
Please take a moment to read our contributing guidelines if you haven't yet done so.
|
|
257
306
|
|
|
307
|
+
[CONTRIBUTING](./.github/CONTRIBUTING.md)
|
|
308
|
+
|
|
309
|
+
## License
|
|
310
|
+
|
|
311
|
+
[MIT](./LICENSE)
|
|
258
312
|
|
|
259
313
|
[npm]: https://img.shields.io/npm/v/less-loader.svg
|
|
260
|
-
[npm-stats]: https://img.shields.io/npm/dm/less-loader.svg
|
|
261
314
|
[npm-url]: https://npmjs.com/package/less-loader
|
|
262
|
-
|
|
263
315
|
[node]: https://img.shields.io/node/v/less-loader.svg
|
|
264
316
|
[node-url]: https://nodejs.org
|
|
265
|
-
|
|
266
317
|
[deps]: https://david-dm.org/webpack-contrib/less-loader.svg
|
|
267
318
|
[deps-url]: https://david-dm.org/webpack-contrib/less-loader
|
|
268
|
-
|
|
269
|
-
[
|
|
270
|
-
[
|
|
271
|
-
|
|
272
|
-
[
|
|
273
|
-
[
|
|
274
|
-
|
|
275
|
-
[
|
|
276
|
-
[coverage-url]: https://codecov.io/gh/webpack-contrib/less-loader
|
|
277
|
-
|
|
278
|
-
[chat]: https://badges.gitter.im/webpack-contrib/webpack.svg
|
|
279
|
-
[chat-url]: https://gitter.im/webpack-contrib/webpack
|
|
319
|
+
[tests]: https://dev.azure.com/webpack-contrib/less-loader/_apis/build/status/webpack-contrib.less-loader?branchName=master
|
|
320
|
+
[tests-url]: https://dev.azure.com/webpack-contrib/less-loader/_build/latest?definitionId=2&branchName=master
|
|
321
|
+
[cover]: https://codecov.io/gh/webpack-contrib/less-loader/branch/master/graph/badge.svg
|
|
322
|
+
[cover-url]: https://codecov.io/gh/webpack-contrib/less-loader
|
|
323
|
+
[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
|
|
324
|
+
[chat-url]: https://gitter.im/webpack/webpack
|
|
325
|
+
[size]: https://packagephobia.now.sh/badge?p=less-loader
|
|
326
|
+
[size-url]: https://packagephobia.now.sh/result?p=less-loader
|
package/dist/cjs.js
CHANGED
|
@@ -1,35 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
/* eslint-disable class-methods-use-this */
|
|
4
|
+
const less = require('less');
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
const loaderUtils = require('loader-utils');
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
const pify = require('pify');
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
var less = require('less');
|
|
13
|
-
var loaderUtils = require('loader-utils');
|
|
14
|
-
var pify = require('pify');
|
|
10
|
+
const stringifyLoader = require.resolve('./stringifyLoader.js');
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var isLessCompatible = /\.(le|c)ss$/;
|
|
19
|
-
|
|
20
|
-
// Less automatically adds a .less file extension if no extension was given.
|
|
12
|
+
const trailingSlash = /[/\\]$/;
|
|
13
|
+
const isLessCompatible = /\.(le|c)ss$/; // Less automatically adds a .less file extension if no extension was given.
|
|
21
14
|
// This is problematic if there is a module request like @import "~some-module";
|
|
22
15
|
// because in this case Less will call our file manager with `~some-module.less`.
|
|
23
16
|
// Since dots in module names are highly discouraged, we can safely assume that
|
|
24
17
|
// this is an error and we need to remove the .less extension again.
|
|
25
18
|
// However, we must not match something like @import "~some-module/file.less";
|
|
26
|
-
var matchMalformedModuleFilename = /(~[^/\\]+)\.less$/;
|
|
27
19
|
|
|
28
|
-
// This somewhat changed in Less 3.x. Now the file name comes without the
|
|
20
|
+
const matchMalformedModuleFilename = /(~[^/\\]+)\.less$/; // This somewhat changed in Less 3.x. Now the file name comes without the
|
|
29
21
|
// automatically added extension whereas the extension is passed in as `options.ext`.
|
|
30
22
|
// So, if the file name matches this regexp, we simply ignore the proposed extension.
|
|
31
|
-
var isModuleName = /^~[^/\\]+$/;
|
|
32
23
|
|
|
24
|
+
const isModuleName = /^~[^/\\]+$/;
|
|
33
25
|
/**
|
|
34
26
|
* Creates a Less plugin that uses webpack's resolving engine that is provided by the loaderContext.
|
|
35
27
|
*
|
|
@@ -37,85 +29,71 @@ var isModuleName = /^~[^/\\]+$/;
|
|
|
37
29
|
* @param {string=} root
|
|
38
30
|
* @returns {LessPlugin}
|
|
39
31
|
*/
|
|
40
|
-
function createWebpackLessPlugin(loaderContext) {
|
|
41
|
-
var fs = loaderContext.fs;
|
|
42
32
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
33
|
+
function createWebpackLessPlugin(loaderContext) {
|
|
34
|
+
const {
|
|
35
|
+
fs
|
|
36
|
+
} = loaderContext;
|
|
37
|
+
const resolve = pify(loaderContext.resolve.bind(loaderContext));
|
|
38
|
+
const loadModule = pify(loaderContext.loadModule.bind(loaderContext));
|
|
39
|
+
const readFile = pify(fs.readFile.bind(fs));
|
|
40
|
+
|
|
41
|
+
class WebpackFileManager extends less.FileManager {
|
|
42
|
+
supports() {
|
|
43
|
+
// Our WebpackFileManager handles all the files
|
|
44
|
+
return true;
|
|
45
|
+
} // Sync resolving is used at least by the `data-uri` function.
|
|
46
|
+
// This file manager doesn't know how to do it, so let's delegate it
|
|
47
|
+
// to the default file manager of Less.
|
|
48
|
+
// We could probably use loaderContext.resolveSync, but it's deprecated,
|
|
49
|
+
// see https://webpack.js.org/api/loaders/#this-resolvesync
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
supportsSync() {
|
|
53
|
+
return false;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
value: function supports() {
|
|
59
|
-
// Our WebpackFileManager handles all the files
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
56
|
+
loadFile(filename, currentDirectory, options) {
|
|
57
|
+
let url;
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// We could probably use loaderContext.resolveSync, but it's deprecated,
|
|
67
|
-
// see https://webpack.js.org/api/loaders/#this-resolvesync
|
|
68
|
-
|
|
69
|
-
}, {
|
|
70
|
-
key: 'supportsSync',
|
|
71
|
-
value: function supportsSync() {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
}, {
|
|
75
|
-
key: 'loadFile',
|
|
76
|
-
value: function loadFile(filename, currentDirectory, options) {
|
|
77
|
-
var url = void 0;
|
|
78
|
-
if (less.version[0] >= 3) {
|
|
79
|
-
if (options.ext && !isModuleName.test(filename)) {
|
|
80
|
-
url = this.tryAppendExtension(filename, options.ext);
|
|
81
|
-
} else {
|
|
82
|
-
url = filename;
|
|
83
|
-
}
|
|
59
|
+
if (less.version[0] >= 3) {
|
|
60
|
+
if (options.ext && !isModuleName.test(filename)) {
|
|
61
|
+
url = this.tryAppendExtension(filename, options.ext);
|
|
84
62
|
} else {
|
|
85
|
-
url = filename
|
|
63
|
+
url = filename;
|
|
86
64
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var context = currentDirectory.replace(trailingSlash, '');
|
|
90
|
-
var resolvedFilename = void 0;
|
|
91
|
-
|
|
92
|
-
return resolve(context, moduleRequest).then(function (f) {
|
|
93
|
-
resolvedFilename = f;
|
|
94
|
-
loaderContext.addDependency(resolvedFilename);
|
|
95
|
-
|
|
96
|
-
if (isLessCompatible.test(resolvedFilename)) {
|
|
97
|
-
return readFile(resolvedFilename).then(function (contents) {
|
|
98
|
-
return contents.toString('utf8');
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return loadModule([stringifyLoader, resolvedFilename].join('!')).then(JSON.parse);
|
|
103
|
-
}).then(function (contents) {
|
|
104
|
-
return {
|
|
105
|
-
contents,
|
|
106
|
-
filename: resolvedFilename
|
|
107
|
-
};
|
|
108
|
-
});
|
|
65
|
+
} else {
|
|
66
|
+
url = filename.replace(matchMalformedModuleFilename, '$1');
|
|
109
67
|
}
|
|
110
|
-
}]);
|
|
111
68
|
|
|
112
|
-
|
|
113
|
-
|
|
69
|
+
const moduleRequest = loaderUtils.urlToRequest(url, url.charAt(0) === '/' ? '' : null); // Less is giving us trailing slashes, but the context should have no trailing slash
|
|
70
|
+
|
|
71
|
+
const context = currentDirectory.replace(trailingSlash, '');
|
|
72
|
+
let resolvedFilename;
|
|
73
|
+
return resolve(context, moduleRequest).then(f => {
|
|
74
|
+
resolvedFilename = f;
|
|
75
|
+
loaderContext.addDependency(resolvedFilename);
|
|
76
|
+
|
|
77
|
+
if (isLessCompatible.test(resolvedFilename)) {
|
|
78
|
+
return readFile(resolvedFilename).then(contents => contents.toString('utf8'));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return loadModule([stringifyLoader, resolvedFilename].join('!')).then(JSON.parse);
|
|
82
|
+
}).then(contents => {
|
|
83
|
+
return {
|
|
84
|
+
contents,
|
|
85
|
+
filename: resolvedFilename
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
}
|
|
114
91
|
|
|
115
92
|
return {
|
|
116
93
|
install(lessInstance, pluginManager) {
|
|
117
94
|
pluginManager.addFileManager(new WebpackFileManager());
|
|
118
95
|
},
|
|
96
|
+
|
|
119
97
|
minVersion: [2, 1, 1]
|
|
120
98
|
};
|
|
121
99
|
}
|
package/dist/formatLessError.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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); } }
|
|
4
|
-
|
|
5
|
-
var os = require('os');
|
|
1
|
+
"use strict";
|
|
6
2
|
|
|
3
|
+
const os = require('os');
|
|
7
4
|
/**
|
|
8
5
|
* Tries to get an excerpt of the file where the error happened.
|
|
9
6
|
* Uses err.line and err.column.
|
|
@@ -13,24 +10,24 @@ var os = require('os');
|
|
|
13
10
|
* @param {LessError} err
|
|
14
11
|
* @returns {Array<string>}
|
|
15
12
|
*/
|
|
13
|
+
|
|
14
|
+
|
|
16
15
|
function getFileExcerptIfPossible(lessErr) {
|
|
17
16
|
try {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const excerpt = lessErr.extract.slice(0, 2);
|
|
18
|
+
const column = Math.max(lessErr.column - 1, 0);
|
|
20
19
|
|
|
21
20
|
if (typeof excerpt[0] === 'undefined') {
|
|
22
21
|
excerpt.shift();
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
excerpt.push(`${new Array(column).join(' ')}^`);
|
|
26
|
-
|
|
27
25
|
return excerpt;
|
|
28
26
|
} catch (unexpectedErr) {
|
|
29
27
|
// If anything goes wrong here, we don't want any errors to be reported to the user
|
|
30
28
|
return [];
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
/**
|
|
35
32
|
* Beautifies the error message from Less.
|
|
36
33
|
*
|
|
@@ -46,17 +43,18 @@ function getFileExcerptIfPossible(lessErr) {
|
|
|
46
43
|
* @param {Array<string>} lessErr.extract - e.g. [' .my-style {', ' .undefined-mixin;', ' display: block;']
|
|
47
44
|
* @returns {LessError}
|
|
48
45
|
*/
|
|
46
|
+
|
|
47
|
+
|
|
49
48
|
function formatLessError(err) {
|
|
50
49
|
/* eslint-disable no-param-reassign */
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// Instruct webpack to hide the JS stack from the console
|
|
50
|
+
const msg = err.message; // Instruct webpack to hide the JS stack from the console
|
|
54
51
|
// Usually you're only interested in the SASS stack in this case.
|
|
55
|
-
err.hideStack = true;
|
|
56
|
-
|
|
57
|
-
err.message = [os.EOL].concat(_toConsumableArray(getFileExcerptIfPossible(err)), [msg.charAt(0).toUpperCase() + msg.slice(1), ` in ${err.filename} (line ${err.line}, column ${err.column})`]).join(os.EOL);
|
|
58
52
|
|
|
53
|
+
err.hideStack = true;
|
|
54
|
+
err.message = [os.EOL, ...getFileExcerptIfPossible(err), msg.charAt(0).toUpperCase() + msg.slice(1), ` in ${err.filename} (line ${err.line}, column ${err.column})`].join(os.EOL);
|
|
59
55
|
return err;
|
|
60
|
-
}
|
|
56
|
+
}
|
|
57
|
+
/* eslint-enable no-param-reassign */
|
|
58
|
+
|
|
61
59
|
|
|
62
60
|
module.exports = formatLessError;
|
package/dist/getOptions.js
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var clone = require('clone');
|
|
5
|
-
var createWebpackLessPlugin = require('./createWebpackLessPlugin');
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
|
6
4
|
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
const loaderUtils = require('loader-utils');
|
|
8
|
+
|
|
9
|
+
const clone = require('clone');
|
|
10
|
+
|
|
11
|
+
const createWebpackLessPlugin = require('./createWebpackLessPlugin');
|
|
7
12
|
/**
|
|
8
13
|
* Retrieves the options from the loaderContext, makes a deep copy of it and normalizes it for further consumption.
|
|
9
14
|
*
|
|
10
15
|
* @param {LoaderContext} loaderContext
|
|
11
16
|
*/
|
|
17
|
+
|
|
18
|
+
|
|
12
19
|
function getOptions(loaderContext) {
|
|
13
|
-
|
|
20
|
+
const options = _objectSpread({
|
|
14
21
|
plugins: [],
|
|
15
|
-
relativeUrls: true
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
relativeUrls: true
|
|
23
|
+
}, clone(loaderUtils.getOptions(loaderContext))); // We need to set the filename because otherwise our WebpackFileManager will receive an undefined path for the entry
|
|
24
|
+
|
|
18
25
|
|
|
19
|
-
|
|
20
|
-
options.filename = loaderContext.resource;
|
|
26
|
+
options.filename = loaderContext.resource; // When no paths are given, we use the webpack resolver
|
|
21
27
|
|
|
22
|
-
// When no paths are given, we use the webpack resolver
|
|
23
28
|
if ('paths' in options === false) {
|
|
24
29
|
// It's safe to mutate the array now because it has already been cloned
|
|
25
30
|
options.plugins.push(createWebpackLessPlugin(loaderContext));
|
|
@@ -29,6 +34,7 @@ function getOptions(loaderContext) {
|
|
|
29
34
|
if (typeof options.sourceMap === 'boolean') {
|
|
30
35
|
options.sourceMap = {};
|
|
31
36
|
}
|
|
37
|
+
|
|
32
38
|
if ('outputSourceFiles' in options.sourceMap === false) {
|
|
33
39
|
// Include source files as `sourceContents` as sane default since this makes source maps "just work" in most cases
|
|
34
40
|
options.sourceMap.outputSourceFiles = true;
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.default = void 0;
|
|
6
7
|
|
|
7
|
-
var _less = require(
|
|
8
|
+
var _less = _interopRequireDefault(require("less"));
|
|
8
9
|
|
|
9
|
-
var
|
|
10
|
+
var _pify = _interopRequireDefault(require("pify"));
|
|
10
11
|
|
|
11
|
-
var
|
|
12
|
+
var _processResult = _interopRequireDefault(require("./processResult"));
|
|
12
13
|
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
var _processResult = require('./processResult');
|
|
16
|
-
|
|
17
|
-
var _processResult2 = _interopRequireDefault(_processResult);
|
|
18
|
-
|
|
19
|
-
var _getOptions = require('./getOptions');
|
|
20
|
-
|
|
21
|
-
var _getOptions2 = _interopRequireDefault(_getOptions);
|
|
14
|
+
var _getOptions = _interopRequireDefault(require("./getOptions"));
|
|
22
15
|
|
|
23
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
17
|
|
|
25
|
-
|
|
18
|
+
const render = (0, _pify.default)(_less.default.render.bind(_less.default));
|
|
26
19
|
|
|
27
20
|
function lessLoader(source) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
const loaderContext = this;
|
|
22
|
+
const options = (0, _getOptions.default)(loaderContext);
|
|
23
|
+
const done = loaderContext.async();
|
|
24
|
+
const isSync = typeof done !== 'function';
|
|
32
25
|
|
|
33
26
|
if (isSync) {
|
|
34
27
|
throw new Error('Synchronous compilation is not supported anymore. See https://github.com/webpack-contrib/less-loader/issues/84');
|
|
35
28
|
}
|
|
36
29
|
|
|
37
|
-
(0,
|
|
30
|
+
(0, _processResult.default)(loaderContext, render(source, options));
|
|
38
31
|
}
|
|
39
32
|
|
|
40
|
-
|
|
33
|
+
var _default = lessLoader;
|
|
34
|
+
exports.default = _default;
|
package/dist/processResult.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var formatLessError = require('./formatLessError');
|
|
3
|
+
const removeSourceMappingUrl = require('./removeSourceMappingUrl');
|
|
5
4
|
|
|
5
|
+
const formatLessError = require('./formatLessError');
|
|
6
6
|
/**
|
|
7
7
|
* Removes the sourceMappingURL from the generated CSS, parses the source map and calls the next loader.
|
|
8
8
|
*
|
|
9
9
|
* @param {loaderContext} loaderContext
|
|
10
10
|
* @param {Promise<LessResult>} resultPromise
|
|
11
11
|
*/
|
|
12
|
-
function processResult(loaderContext, resultPromise) {
|
|
13
|
-
var callback = loaderContext.callback;
|
|
14
|
-
|
|
15
12
|
|
|
16
|
-
resultPromise.then(function (_ref) {
|
|
17
|
-
var css = _ref.css,
|
|
18
|
-
map = _ref.map,
|
|
19
|
-
imports = _ref.imports;
|
|
20
13
|
|
|
14
|
+
function processResult(loaderContext, resultPromise) {
|
|
15
|
+
const {
|
|
16
|
+
callback
|
|
17
|
+
} = loaderContext;
|
|
18
|
+
resultPromise.then(({
|
|
19
|
+
css,
|
|
20
|
+
map,
|
|
21
|
+
imports
|
|
22
|
+
}) => {
|
|
21
23
|
imports.forEach(loaderContext.addDependency, loaderContext);
|
|
22
24
|
return {
|
|
23
25
|
// Removing the sourceMappingURL comment.
|
|
@@ -25,12 +27,16 @@ function processResult(loaderContext, resultPromise) {
|
|
|
25
27
|
css: removeSourceMappingUrl(css),
|
|
26
28
|
map: typeof map === 'string' ? JSON.parse(map) : map
|
|
27
29
|
};
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
map = _ref2.map;
|
|
30
|
+
}, lessError => {
|
|
31
|
+
if (lessError.filename) {
|
|
32
|
+
loaderContext.addDependency(lessError.filename);
|
|
33
|
+
}
|
|
33
34
|
|
|
35
|
+
throw formatLessError(lessError);
|
|
36
|
+
}).then(({
|
|
37
|
+
css,
|
|
38
|
+
map
|
|
39
|
+
}) => {
|
|
34
40
|
callback(null, css, map);
|
|
35
41
|
}, callback);
|
|
36
42
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var matchSourceMappingUrl = /\/\*# sourceMappingURL=[^*]+\*\//;
|
|
1
|
+
"use strict";
|
|
4
2
|
|
|
3
|
+
const matchSourceMappingUrl = /\/\*# sourceMappingURL=[^*]+\*\//;
|
|
5
4
|
/**
|
|
6
5
|
* Removes the sourceMappingURL comment. This is necessary because the less-loader
|
|
7
6
|
* does not know where the final source map will be located. Thus, we remove every
|
|
@@ -12,6 +11,7 @@ var matchSourceMappingUrl = /\/\*# sourceMappingURL=[^*]+\*\//;
|
|
|
12
11
|
* @param {string} content
|
|
13
12
|
* @returns {string}
|
|
14
13
|
*/
|
|
14
|
+
|
|
15
15
|
function removeSourceMappingUrl(content) {
|
|
16
16
|
return content.replace(matchSourceMappingUrl, '');
|
|
17
17
|
}
|
package/package.json
CHANGED
|
@@ -1,76 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "less-loader",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"description": "Less loader for webpack. Compiles Less to CSS.",
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"description": "A Less loader for webpack. Compiles Less to CSS.",
|
|
6
5
|
"license": "MIT",
|
|
6
|
+
"repository": "webpack-contrib/less-loader",
|
|
7
|
+
"author": "Johannes Ewald @jhnns",
|
|
8
|
+
"homepage": "https://github.com/webpack-contrib/less-loader",
|
|
9
|
+
"bugs": "https://github.com/webpack-contrib/less-loader/issues",
|
|
10
|
+
"main": "dist/cjs.js",
|
|
7
11
|
"engines": {
|
|
8
|
-
"node": ">= 4.8
|
|
12
|
+
"node": ">= 4.8.0"
|
|
9
13
|
},
|
|
10
|
-
"main": "dist/cjs.js",
|
|
11
|
-
"files": [
|
|
12
|
-
"dist"
|
|
13
|
-
],
|
|
14
14
|
"scripts": {
|
|
15
15
|
"start": "npm run build -- -w",
|
|
16
|
+
"prebuild": "npm run clean",
|
|
16
17
|
"build": "cross-env NODE_ENV=production babel src -d dist --ignore 'src/**/*.test.js' --copy-files",
|
|
18
|
+
"build:fixtures": "babel-node test/helpers/createSpec.js",
|
|
17
19
|
"clean": "del-cli dist",
|
|
18
|
-
"
|
|
20
|
+
"commitlint": "commitlint --from=master",
|
|
19
21
|
"lint": "eslint --cache src test",
|
|
20
|
-
"pretest": "npm run create-spec",
|
|
21
|
-
"test": "jest",
|
|
22
|
-
"posttest": "npm run lint",
|
|
23
|
-
"lint-staged": "lint-staged",
|
|
24
|
-
"prebuild": "npm run clean",
|
|
25
22
|
"prepare": "npm run build",
|
|
26
23
|
"release": "standard-version",
|
|
27
|
-
"security": "
|
|
28
|
-
"test:
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"appveyor:test": "npm run test",
|
|
24
|
+
"security": "npm audit",
|
|
25
|
+
"test:only": "cross-env NODE_ENV=test npm run build:fixtures && jest",
|
|
26
|
+
"test:watch": "cross-env NODE_ENV=test npm run build:fixtures && jest --watch",
|
|
27
|
+
"test:coverage": "cross-env NODE_ENV=test npm run build:fixtures && jest --collectCoverageFrom='src/**/*.js' --coverage",
|
|
28
|
+
"pretest": "npm run lint",
|
|
29
|
+
"test": "cross-env NODE_ENV=test npm run test:coverage",
|
|
34
30
|
"defaults": "webpack-defaults"
|
|
35
31
|
},
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
"pify": "^3.0.0"
|
|
40
|
-
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
],
|
|
41
35
|
"peerDependencies": {
|
|
42
36
|
"less": "^2.3.1 || ^3.0.0",
|
|
43
37
|
"webpack": "^2.0.0 || ^3.0.0 || ^4.0.0"
|
|
44
38
|
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"clone": "^2.1.1",
|
|
41
|
+
"loader-utils": "^1.1.0",
|
|
42
|
+
"pify": "^4.0.1"
|
|
43
|
+
},
|
|
45
44
|
"devDependencies": {
|
|
46
|
-
"babel
|
|
47
|
-
"babel
|
|
48
|
-
"babel
|
|
49
|
-
"babel-
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"eslint": "^3.
|
|
54
|
-
"
|
|
55
|
-
"
|
|
45
|
+
"@babel/cli": "^7.4.4",
|
|
46
|
+
"@babel/core": "^7.4.4",
|
|
47
|
+
"@babel/node": "^7.2.2",
|
|
48
|
+
"@babel/preset-env": "^7.4.4",
|
|
49
|
+
"@commitlint/cli": "^7.5.2",
|
|
50
|
+
"@commitlint/config-conventional": "^7.5.0",
|
|
51
|
+
"@webpack-contrib/defaults": "^4.0.1",
|
|
52
|
+
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
53
|
+
"babel-jest": "^24.7.1",
|
|
54
|
+
"commitlint-azure-pipelines-cli": "^1.0.1",
|
|
55
|
+
"cross-env": "^5.2.0",
|
|
56
|
+
"del": "^4.1.1",
|
|
57
|
+
"del-cli": "^1.1.0",
|
|
58
|
+
"eslint": "^5.16.0",
|
|
59
|
+
"eslint-plugin-import": "^2.17.2",
|
|
60
|
+
"eslint-plugin-prettier": "^3.0.1",
|
|
61
|
+
"husky": "^2.1.0",
|
|
56
62
|
"inspect-loader": "^1.0.0",
|
|
57
|
-
"jest": "^
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"webpack
|
|
63
|
+
"jest": "^24.7.1",
|
|
64
|
+
"jest-junit": "^6.3.0",
|
|
65
|
+
"less": "^3.9.0",
|
|
66
|
+
"lint-staged": "^8.1.5",
|
|
67
|
+
"memory-fs": "^0.4.1",
|
|
68
|
+
"prettier": "^1.17.0",
|
|
69
|
+
"standard-version": "^5.0.2",
|
|
70
|
+
"webpack": "^4.30.0"
|
|
65
71
|
},
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
72
|
+
"keywords": [
|
|
73
|
+
"webpack",
|
|
74
|
+
"loader",
|
|
75
|
+
"less",
|
|
76
|
+
"lesscss",
|
|
77
|
+
"less.js",
|
|
78
|
+
"css",
|
|
79
|
+
"preprocessor"
|
|
80
|
+
]
|
|
76
81
|
}
|