sass-loader 10.0.0-rc.0 → 10.0.3
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 +25 -0
- package/dist/index.js +7 -18
- package/dist/utils.js +40 -18
- package/package.json +25 -25
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
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
|
+
### [10.0.3](https://github.com/webpack-contrib/sass-loader/compare/v10.0.2...v10.0.3) (2020-10-09)
|
|
6
|
+
|
|
7
|
+
### Chore
|
|
8
|
+
|
|
9
|
+
* update `schema-utils`
|
|
10
|
+
|
|
11
|
+
### [10.0.2](https://github.com/webpack-contrib/sass-loader/compare/v10.0.1...v10.0.2) (2020-09-03)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* source maps generation ([#886](https://github.com/webpack-contrib/sass-loader/issues/886)) ([8327d55](https://github.com/webpack-contrib/sass-loader/commit/8327d55df9e8fc6e24d2759d7bd50174ed1ff1e4))
|
|
17
|
+
|
|
18
|
+
### [10.0.1](https://github.com/webpack-contrib/sass-loader/compare/v10.0.0...v10.0.1) (2020-08-25)
|
|
19
|
+
|
|
20
|
+
### Chore
|
|
21
|
+
|
|
22
|
+
* update deps
|
|
23
|
+
|
|
24
|
+
## [10.0.0](https://github.com/webpack-contrib/sass-loader/compare/v10.0.0-rc.0...v10.0.0) (2020-08-24)
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* handle absolute windows path in source maps
|
|
29
|
+
|
|
5
30
|
## [10.0.0-rc.0](https://github.com/webpack-contrib/sass-loader/compare/v9.0.3...v10.0.0-rc.0) (2020-08-24)
|
|
6
31
|
|
|
7
32
|
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
|
|
10
|
-
var _schemaUtils =
|
|
10
|
+
var _schemaUtils = require("schema-utils");
|
|
11
11
|
|
|
12
12
|
var _loaderUtils = require("loader-utils");
|
|
13
13
|
|
|
@@ -27,7 +27,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27
27
|
*/
|
|
28
28
|
function loader(content) {
|
|
29
29
|
const options = (0, _loaderUtils.getOptions)(this);
|
|
30
|
-
(0, _schemaUtils.
|
|
30
|
+
(0, _schemaUtils.validate)(_options.default, options, {
|
|
31
31
|
name: 'Sass Loader',
|
|
32
32
|
baseDataPath: 'options'
|
|
33
33
|
});
|
|
@@ -55,29 +55,18 @@ function loader(content) {
|
|
|
55
55
|
|
|
56
56
|
callback(new _SassError.default(error));
|
|
57
57
|
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (result.map && useSourceMap) {
|
|
62
|
-
// eslint-disable-next-line no-param-reassign
|
|
63
|
-
result.map = JSON.parse(result.map); // result.map.file is an optional property that provides the output filename.
|
|
64
|
-
// Since we don't know the final filename in the webpack build chain yet, it makes no sense to have it.
|
|
65
|
-
// eslint-disable-next-line no-param-reassign
|
|
66
|
-
|
|
67
|
-
delete result.map.file; // eslint-disable-next-line no-param-reassign
|
|
58
|
+
}
|
|
68
59
|
|
|
69
|
-
|
|
70
|
-
// This fixes an error on windows where the source-map module cannot resolve the source maps.
|
|
71
|
-
// @see https://github.com/webpack-contrib/sass-loader/issues/366#issuecomment-279460722
|
|
72
|
-
// eslint-disable-next-line no-param-reassign
|
|
60
|
+
let map = result.map ? JSON.parse(result.map) : null; // Modify source paths only for webpack, otherwise we do nothing
|
|
73
61
|
|
|
74
|
-
|
|
62
|
+
if (map && useSourceMap) {
|
|
63
|
+
map = (0, _utils.normalizeSourceMap)(map, this.rootContext);
|
|
75
64
|
}
|
|
76
65
|
|
|
77
66
|
result.stats.includedFiles.forEach(includedFile => {
|
|
78
67
|
this.addDependency(_path.default.normalize(includedFile));
|
|
79
68
|
});
|
|
80
|
-
callback(null, result.css.toString(),
|
|
69
|
+
callback(null, result.css.toString(), map);
|
|
81
70
|
});
|
|
82
71
|
}
|
|
83
72
|
|
package/dist/utils.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.getSassOptions = getSassOptions;
|
|
|
8
8
|
exports.getWebpackResolver = getWebpackResolver;
|
|
9
9
|
exports.getWebpackImporter = getWebpackImporter;
|
|
10
10
|
exports.getRenderFunctionFromSassImplementation = getRenderFunctionFromSassImplementation;
|
|
11
|
-
exports.
|
|
11
|
+
exports.normalizeSourceMap = normalizeSourceMap;
|
|
12
12
|
|
|
13
13
|
var _url = _interopRequireDefault(require("url"));
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
16
16
|
|
|
17
17
|
var _semver = _interopRequireDefault(require("semver"));
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _full = require("klona/full");
|
|
20
20
|
|
|
21
21
|
var _loaderUtils = require("loader-utils");
|
|
22
22
|
|
|
@@ -115,7 +115,7 @@ function proxyCustomImporters(importers, loaderContext) {
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
function getSassOptions(loaderContext, loaderOptions, content, implementation, useSourceMap) {
|
|
118
|
-
const options = (0,
|
|
118
|
+
const options = (0, _full.klona)(loaderOptions.sassOptions ? typeof loaderOptions.sassOptions === 'function' ? loaderOptions.sassOptions(loaderContext) || {} : loaderOptions.sassOptions : {});
|
|
119
119
|
const isDartSass = implementation.info.includes('dart-sass');
|
|
120
120
|
|
|
121
121
|
if (isDartSass) {
|
|
@@ -157,10 +157,10 @@ function getSassOptions(loaderContext, loaderOptions, content, implementation, u
|
|
|
157
157
|
// all paths in sourceMap.sources will be relative to that path.
|
|
158
158
|
// Pretty complicated... :(
|
|
159
159
|
options.sourceMap = true;
|
|
160
|
-
options.outFile = _path.default.join(loaderContext.rootContext, 'style.css.map');
|
|
161
|
-
|
|
160
|
+
options.outFile = _path.default.join(loaderContext.rootContext, 'style.css.map');
|
|
162
161
|
options.sourceMapContents = true;
|
|
163
|
-
options.omitSourceMapUrl = true;
|
|
162
|
+
options.omitSourceMapUrl = true;
|
|
163
|
+
options.sourceMapEmbed = false;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
const {
|
|
@@ -239,15 +239,19 @@ url, forWebpackResolver = false, rootContext = false) {
|
|
|
239
239
|
|
|
240
240
|
function promiseResolve(callbackResolve) {
|
|
241
241
|
return (context, request) => new Promise((resolve, reject) => {
|
|
242
|
-
callbackResolve(context, request, (
|
|
243
|
-
if (
|
|
242
|
+
callbackResolve(context, request, (error, result) => {
|
|
243
|
+
if (error) {
|
|
244
|
+
reject(error);
|
|
245
|
+
} else {
|
|
246
|
+
resolve(result);
|
|
247
|
+
}
|
|
244
248
|
});
|
|
245
249
|
});
|
|
246
250
|
}
|
|
247
251
|
|
|
248
|
-
const
|
|
252
|
+
const IS_SPECIAL_MODULE_IMPORT = /^~[^/]+$/; // `[drive_letter]:\` + `\\[server]\[sharename]\`
|
|
249
253
|
|
|
250
|
-
const
|
|
254
|
+
const IS_NATIVE_WIN32_PATH = /^[a-z]:[/\\]|^\\\\/i;
|
|
251
255
|
/**
|
|
252
256
|
* @public
|
|
253
257
|
* Create the resolve function used in the custom Sass importer.
|
|
@@ -331,11 +335,11 @@ function getWebpackResolver(resolverFactory, implementation, includePaths = [],
|
|
|
331
335
|
|
|
332
336
|
let resolutionMap = [];
|
|
333
337
|
const needEmulateSassResolver = // `sass` doesn't support module import
|
|
334
|
-
!
|
|
338
|
+
!IS_SPECIAL_MODULE_IMPORT.test(request) && // We need improve absolute paths handling.
|
|
335
339
|
// Absolute paths should be resolved:
|
|
336
340
|
// - Server-relative URLs - `<context>/path/to/file.ext` (where `<context>` is root context)
|
|
337
341
|
// - Absolute path - `/full/path/to/file.ext` or `C:\\full\path\to\file.ext`
|
|
338
|
-
!isFileScheme && !originalRequest.startsWith('/') && !
|
|
342
|
+
!isFileScheme && !originalRequest.startsWith('/') && !IS_NATIVE_WIN32_PATH.test(originalRequest);
|
|
339
343
|
|
|
340
344
|
if (includePaths.length > 0 && needEmulateSassResolver) {
|
|
341
345
|
// The order of import precedence is as follows:
|
|
@@ -435,15 +439,33 @@ function getURLType(source) {
|
|
|
435
439
|
return 'path-absolute';
|
|
436
440
|
}
|
|
437
441
|
|
|
442
|
+
if (IS_NATIVE_WIN32_PATH.test(source)) {
|
|
443
|
+
return 'path-absolute';
|
|
444
|
+
}
|
|
445
|
+
|
|
438
446
|
return ABSOLUTE_SCHEME.test(source) ? 'absolute' : 'path-relative';
|
|
439
447
|
}
|
|
440
448
|
|
|
441
|
-
function
|
|
442
|
-
const
|
|
449
|
+
function normalizeSourceMap(map, rootContext) {
|
|
450
|
+
const newMap = map; // result.map.file is an optional property that provides the output filename.
|
|
451
|
+
// Since we don't know the final filename in the webpack build chain yet, it makes no sense to have it.
|
|
452
|
+
// eslint-disable-next-line no-param-reassign
|
|
443
453
|
|
|
444
|
-
|
|
445
|
-
return _path.default.resolve(sourceRoot, _path.default.normalize(source));
|
|
446
|
-
}
|
|
454
|
+
delete newMap.file; // eslint-disable-next-line no-param-reassign
|
|
447
455
|
|
|
448
|
-
|
|
456
|
+
newMap.sourceRoot = ''; // node-sass returns POSIX paths, that's why we need to transform them back to native paths.
|
|
457
|
+
// This fixes an error on windows where the source-map module cannot resolve the source maps.
|
|
458
|
+
// @see https://github.com/webpack-contrib/sass-loader/issues/366#issuecomment-279460722
|
|
459
|
+
// eslint-disable-next-line no-param-reassign
|
|
460
|
+
|
|
461
|
+
newMap.sources = newMap.sources.map(source => {
|
|
462
|
+
const sourceType = getURLType(source); // Do no touch `scheme-relative`, `path-absolute` and `absolute` types
|
|
463
|
+
|
|
464
|
+
if (sourceType === 'path-relative') {
|
|
465
|
+
return _path.default.resolve(rootContext, _path.default.normalize(source));
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
return source;
|
|
469
|
+
});
|
|
470
|
+
return newMap;
|
|
449
471
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sass-loader",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.3",
|
|
4
4
|
"description": "Sass loader for webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/sass-loader",
|
|
@@ -56,46 +56,46 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"klona": "^
|
|
59
|
+
"klona": "^2.0.4",
|
|
60
60
|
"loader-utils": "^2.0.0",
|
|
61
61
|
"neo-async": "^2.6.2",
|
|
62
|
-
"schema-utils": "^
|
|
62
|
+
"schema-utils": "^3.0.0",
|
|
63
63
|
"semver": "^7.3.2"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@babel/cli": "^7.
|
|
67
|
-
"@babel/core": "^7.11.
|
|
68
|
-
"@babel/preset-env": "^7.11.
|
|
69
|
-
"@commitlint/cli": "^
|
|
70
|
-
"@commitlint/config-conventional": "^
|
|
66
|
+
"@babel/cli": "^7.11.6",
|
|
67
|
+
"@babel/core": "^7.11.6",
|
|
68
|
+
"@babel/preset-env": "^7.11.5",
|
|
69
|
+
"@commitlint/cli": "^11.0.0",
|
|
70
|
+
"@commitlint/config-conventional": "^11.0.0",
|
|
71
71
|
"@webpack-contrib/defaults": "^6.3.0",
|
|
72
72
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
73
|
-
"babel-jest": "^26.
|
|
74
|
-
"bootstrap": "^4.5.
|
|
73
|
+
"babel-jest": "^26.5.2",
|
|
74
|
+
"bootstrap": "^4.5.2",
|
|
75
75
|
"bootstrap-sass": "^3.4.1",
|
|
76
76
|
"cross-env": "^7.0.2",
|
|
77
|
-
"css-loader": "^4.
|
|
78
|
-
"del": "^
|
|
77
|
+
"css-loader": "^4.3.0",
|
|
78
|
+
"del": "^6.0.0",
|
|
79
79
|
"del-cli": "^3.0.1",
|
|
80
|
-
"enhanced-resolve": "^
|
|
81
|
-
"eslint": "^7.
|
|
82
|
-
"eslint-config-prettier": "^6.
|
|
83
|
-
"eslint-plugin-import": "^2.
|
|
80
|
+
"enhanced-resolve": "^5.2.0",
|
|
81
|
+
"eslint": "^7.10.0",
|
|
82
|
+
"eslint-config-prettier": "^6.12.0",
|
|
83
|
+
"eslint-plugin-import": "^2.22.1",
|
|
84
84
|
"fibers": "^5.0.0",
|
|
85
|
-
"file-loader": "^6.
|
|
85
|
+
"file-loader": "^6.1.0",
|
|
86
86
|
"foundation-sites": "^6.6.3",
|
|
87
|
-
"husky": "^4.
|
|
88
|
-
"jest": "^26.
|
|
89
|
-
"lint-staged": "^10.
|
|
87
|
+
"husky": "^4.3.0",
|
|
88
|
+
"jest": "^26.5.2",
|
|
89
|
+
"lint-staged": "^10.4.0",
|
|
90
90
|
"material-components-web": "^7.0.0",
|
|
91
91
|
"memfs": "^3.2.0",
|
|
92
92
|
"node-sass": "^4.14.1",
|
|
93
93
|
"npm-run-all": "^4.1.5",
|
|
94
|
-
"prettier": "^2.
|
|
95
|
-
"sass": "^1.
|
|
96
|
-
"standard-version": "^
|
|
97
|
-
"style-loader": "^
|
|
98
|
-
"webpack": "^4.44.
|
|
94
|
+
"prettier": "^2.1.2",
|
|
95
|
+
"sass": "^1.27.0",
|
|
96
|
+
"standard-version": "^9.0.0",
|
|
97
|
+
"style-loader": "^2.0.0",
|
|
98
|
+
"webpack": "^4.44.2"
|
|
99
99
|
},
|
|
100
100
|
"keywords": [
|
|
101
101
|
"sass",
|