sass-loader 13.3.3 → 14.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/README.md +1 -80
- package/dist/index.js +1 -1
- package/dist/utils.js +1 -27
- package/package.json +18 -22
package/README.md
CHANGED
|
@@ -249,85 +249,6 @@ module.exports = {
|
|
|
249
249
|
};
|
|
250
250
|
```
|
|
251
251
|
|
|
252
|
-
Note that when using `sass` (`Dart Sass`), **synchronous compilation is twice as fast as asynchronous compilation** by default, due to the overhead of asynchronous callbacks.
|
|
253
|
-
To avoid this overhead, you can use the [fibers](https://www.npmjs.com/package/fibers) package to call asynchronous importers from the synchronous code path.
|
|
254
|
-
|
|
255
|
-
We automatically inject the [`fibers`](https://github.com/laverdet/node-fibers) package (setup `sassOptions.fiber`) for `Node.js` less v16.0.0 if is possible (i.e. you need install the [`fibers`](https://github.com/laverdet/node-fibers) package).
|
|
256
|
-
|
|
257
|
-
> **Warning**
|
|
258
|
-
>
|
|
259
|
-
> Fibers is not compatible with `Node.js` v16.0.0 or later. Unfortunately, v8 commit [dacc2fee0f](https://github.com/v8/v8/commit/dacc2fee0f815823782a7e432c79c2a7767a4765) is a breaking change and workarounds are non-trivial. ([see introduction to readme](https://github.com/laverdet/node-fibers)).
|
|
260
|
-
|
|
261
|
-
**package.json**
|
|
262
|
-
|
|
263
|
-
```json
|
|
264
|
-
{
|
|
265
|
-
"devDependencies": {
|
|
266
|
-
"sass-loader": "^7.2.0",
|
|
267
|
-
"sass": "^1.22.10",
|
|
268
|
-
"fibers": "^4.0.1"
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
You can disable automatically injecting the [`fibers`](https://github.com/laverdet/node-fibers) package by passing a `false` value for the `sassOptions.fiber` option.
|
|
274
|
-
|
|
275
|
-
**webpack.config.js**
|
|
276
|
-
|
|
277
|
-
```js
|
|
278
|
-
module.exports = {
|
|
279
|
-
module: {
|
|
280
|
-
rules: [
|
|
281
|
-
{
|
|
282
|
-
test: /\.s[ac]ss$/i,
|
|
283
|
-
use: [
|
|
284
|
-
"style-loader",
|
|
285
|
-
"css-loader",
|
|
286
|
-
{
|
|
287
|
-
loader: "sass-loader",
|
|
288
|
-
options: {
|
|
289
|
-
implementation: require("sass"),
|
|
290
|
-
sassOptions: {
|
|
291
|
-
fiber: false,
|
|
292
|
-
},
|
|
293
|
-
},
|
|
294
|
-
},
|
|
295
|
-
],
|
|
296
|
-
},
|
|
297
|
-
],
|
|
298
|
-
},
|
|
299
|
-
};
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
You can also pass the `fiber` value using this code:
|
|
303
|
-
|
|
304
|
-
**webpack.config.js**
|
|
305
|
-
|
|
306
|
-
```js
|
|
307
|
-
module.exports = {
|
|
308
|
-
module: {
|
|
309
|
-
rules: [
|
|
310
|
-
{
|
|
311
|
-
test: /\.s[ac]ss$/i,
|
|
312
|
-
use: [
|
|
313
|
-
"style-loader",
|
|
314
|
-
"css-loader",
|
|
315
|
-
{
|
|
316
|
-
loader: "sass-loader",
|
|
317
|
-
options: {
|
|
318
|
-
implementation: require("sass"),
|
|
319
|
-
sassOptions: {
|
|
320
|
-
fiber: require("fibers"),
|
|
321
|
-
},
|
|
322
|
-
},
|
|
323
|
-
},
|
|
324
|
-
],
|
|
325
|
-
},
|
|
326
|
-
],
|
|
327
|
-
},
|
|
328
|
-
};
|
|
329
|
-
```
|
|
330
|
-
|
|
331
252
|
### `sassOptions`
|
|
332
253
|
|
|
333
254
|
Type:
|
|
@@ -338,7 +259,7 @@ type sassOptions =
|
|
|
338
259
|
| ((
|
|
339
260
|
content: string | Buffer,
|
|
340
261
|
loaderContext: LoaderContext,
|
|
341
|
-
meta: any
|
|
262
|
+
meta: any,
|
|
342
263
|
) => import("sass").LegacyOptions<"async">);
|
|
343
264
|
```
|
|
344
265
|
|
package/dist/index.js
CHANGED
|
@@ -74,7 +74,7 @@ async function loader(content) {
|
|
|
74
74
|
|
|
75
75
|
// Modern API
|
|
76
76
|
if (typeof result.loadedUrls !== "undefined") {
|
|
77
|
-
result.loadedUrls.filter(
|
|
77
|
+
result.loadedUrls.filter(loadedUrl => loadedUrl.protocol === "file:").forEach(includedFile => {
|
|
78
78
|
const normalizedIncludedFile = _url.default.fileURLToPath(includedFile);
|
|
79
79
|
|
|
80
80
|
// Custom `importer` can return only `contents` so includedFile will be relative
|
package/dist/utils.js
CHANGED
|
@@ -10,7 +10,6 @@ exports.getSassImplementation = getSassImplementation;
|
|
|
10
10
|
exports.getSassOptions = getSassOptions;
|
|
11
11
|
exports.getWebpackImporter = getWebpackImporter;
|
|
12
12
|
exports.getWebpackResolver = getWebpackResolver;
|
|
13
|
-
exports.isSupportedFibers = isSupportedFibers;
|
|
14
13
|
exports.normalizeSourceMap = normalizeSourceMap;
|
|
15
14
|
var _url = _interopRequireDefault(require("url"));
|
|
16
15
|
var _path = _interopRequireDefault(require("path"));
|
|
@@ -89,10 +88,6 @@ function proxyCustomImporters(importers, loaderContext) {
|
|
|
89
88
|
return importer.apply(self, args);
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
|
-
function isSupportedFibers() {
|
|
93
|
-
const [nodeVersion] = process.versions.node.split(".");
|
|
94
|
-
return Number(nodeVersion) < 16;
|
|
95
|
-
}
|
|
96
91
|
|
|
97
92
|
/**
|
|
98
93
|
* Derives the sass options from the loader context and normalizes its values with sane defaults.
|
|
@@ -179,28 +174,6 @@ async function getSassOptions(loaderContext, loaderOptions, content, implementat
|
|
|
179
174
|
sassOptions.importers = sassOptions.importers ? Array.isArray(sassOptions.importers) ? sassOptions.importers.slice() : [sassOptions.importers] : [];
|
|
180
175
|
} else {
|
|
181
176
|
sassOptions.file = resourcePath;
|
|
182
|
-
const isDartSass = implementation.info.includes("dart-sass");
|
|
183
|
-
if (isDartSass && isSupportedFibers()) {
|
|
184
|
-
const shouldTryToResolveFibers = !sassOptions.fiber && sassOptions.fiber !== false;
|
|
185
|
-
if (shouldTryToResolveFibers) {
|
|
186
|
-
let fibers;
|
|
187
|
-
try {
|
|
188
|
-
fibers = require.resolve("fibers");
|
|
189
|
-
} catch (_error) {
|
|
190
|
-
// Nothing
|
|
191
|
-
}
|
|
192
|
-
if (fibers) {
|
|
193
|
-
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
194
|
-
sassOptions.fiber = require(fibers);
|
|
195
|
-
}
|
|
196
|
-
} else if (sassOptions.fiber === false) {
|
|
197
|
-
// Don't pass the `fiber` option for `sass` (`Dart Sass`)
|
|
198
|
-
delete sassOptions.fiber;
|
|
199
|
-
}
|
|
200
|
-
} else {
|
|
201
|
-
// Don't pass the `fiber` option for `node-sass`
|
|
202
|
-
delete sassOptions.fiber;
|
|
203
|
-
}
|
|
204
177
|
|
|
205
178
|
// opt.outputStyle
|
|
206
179
|
if (!sassOptions.outputStyle && isProductionLikeMode(loaderContext)) {
|
|
@@ -233,6 +206,7 @@ async function getSassOptions(loaderContext, loaderOptions, content, implementat
|
|
|
233
206
|
|
|
234
207
|
// Regression on the `sass-embedded` side
|
|
235
208
|
if (loaderOptions.webpackImporter === false && sassOptions.importer.length === 0) {
|
|
209
|
+
// eslint-disable-next-line no-undefined
|
|
236
210
|
sassOptions.importer = undefined;
|
|
237
211
|
}
|
|
238
212
|
sassOptions.includePaths = [].concat(process.cwd()).concat(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sass-loader",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "Sass loader for webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/sass-loader",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"main": "dist/cjs.js",
|
|
15
15
|
"engines": {
|
|
16
|
-
"node": ">=
|
|
16
|
+
"node": ">= 18.12.0"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"start": "npm run build -- -w",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"dist"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"fibers": ">= 3.1.0",
|
|
46
45
|
"node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
|
|
47
46
|
"sass": "^1.3.0",
|
|
48
47
|
"sass-embedded": "*",
|
|
@@ -57,51 +56,48 @@
|
|
|
57
56
|
},
|
|
58
57
|
"sass-embedded": {
|
|
59
58
|
"optional": true
|
|
60
|
-
},
|
|
61
|
-
"fibers": {
|
|
62
|
-
"optional": true
|
|
63
59
|
}
|
|
64
60
|
},
|
|
65
61
|
"dependencies": {
|
|
66
62
|
"neo-async": "^2.6.2"
|
|
67
63
|
},
|
|
68
64
|
"devDependencies": {
|
|
69
|
-
"@babel/cli": "^7.
|
|
70
|
-
"@babel/core": "^7.
|
|
71
|
-
"@babel/preset-env": "^7.
|
|
72
|
-
"@commitlint/cli": "^
|
|
73
|
-
"@commitlint/config-conventional": "^
|
|
65
|
+
"@babel/cli": "^7.23.4",
|
|
66
|
+
"@babel/core": "^7.23.7",
|
|
67
|
+
"@babel/preset-env": "^7.23.8",
|
|
68
|
+
"@commitlint/cli": "^18.4.4",
|
|
69
|
+
"@commitlint/config-conventional": "^18.4.4",
|
|
74
70
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
75
71
|
"babel-jest": "^29.6.2",
|
|
76
72
|
"bootstrap-sass": "^3.4.1",
|
|
77
73
|
"bootstrap-v4": "npm:bootstrap@^4.5.3",
|
|
78
74
|
"bootstrap-v5": "npm:bootstrap@^5.0.1",
|
|
79
75
|
"cross-env": "^7.0.3",
|
|
80
|
-
"cspell": "^
|
|
81
|
-
"css-loader": "^6.
|
|
76
|
+
"cspell": "^8.3.2",
|
|
77
|
+
"css-loader": "^6.9.0",
|
|
82
78
|
"del": "^6.1.1",
|
|
83
|
-
"del-cli": "^
|
|
79
|
+
"del-cli": "^5.1.0",
|
|
84
80
|
"enhanced-resolve": "^5.15.0",
|
|
85
81
|
"eslint": "^8.46.0",
|
|
86
|
-
"eslint-config-prettier": "^
|
|
82
|
+
"eslint-config-prettier": "^9.1.0",
|
|
87
83
|
"eslint-plugin-import": "^2.28.0",
|
|
88
84
|
"file-loader": "^6.2.0",
|
|
89
85
|
"foundation-sites": "^6.7.5",
|
|
90
86
|
"husky": "^8.0.3",
|
|
91
87
|
"jest": "^29.6.2",
|
|
92
88
|
"jest-environment-node-single-context": "^29.1.0",
|
|
93
|
-
"lint-staged": "^
|
|
89
|
+
"lint-staged": "^15.2.0",
|
|
94
90
|
"material-components-web": "^9.0.0",
|
|
95
|
-
"memfs": "^
|
|
96
|
-
"node-sass": "^
|
|
91
|
+
"memfs": "^4.6.0",
|
|
92
|
+
"node-sass": "^9.0.0",
|
|
97
93
|
"node-sass-glob-importer": "^5.3.2",
|
|
98
94
|
"npm-run-all": "^4.1.5",
|
|
99
|
-
"prettier": "^2.
|
|
100
|
-
"sass": "^1.
|
|
101
|
-
"sass-embedded": "^1.
|
|
95
|
+
"prettier": "^3.2.2",
|
|
96
|
+
"sass": "^1.69.7",
|
|
97
|
+
"sass-embedded": "^1.69.7",
|
|
102
98
|
"semver": "^7.5.4",
|
|
103
99
|
"standard-version": "^9.3.1",
|
|
104
|
-
"style-loader": "^3.3.
|
|
100
|
+
"style-loader": "^3.3.4",
|
|
105
101
|
"webpack": "^5.88.2"
|
|
106
102
|
},
|
|
107
103
|
"keywords": [
|