sass-loader 10.0.0 → 10.0.4

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 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
+ ### [10.0.4](https://github.com/webpack-contrib/sass-loader/compare/v10.0.3...v10.0.4) (2020-10-22)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * compatibility with the filesystem cache ([#896](https://github.com/webpack-contrib/sass-loader/issues/896)) ([e31f9b6](https://github.com/webpack-contrib/sass-loader/commit/e31f9b682f62e957fd2075582c3cf6cf0daf6b52))
11
+
12
+ ### [10.0.3](https://github.com/webpack-contrib/sass-loader/compare/v10.0.2...v10.0.3) (2020-10-09)
13
+
14
+ ### Chore
15
+
16
+ * update `schema-utils`
17
+
18
+ ### [10.0.2](https://github.com/webpack-contrib/sass-loader/compare/v10.0.1...v10.0.2) (2020-09-03)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * source maps generation ([#886](https://github.com/webpack-contrib/sass-loader/issues/886)) ([8327d55](https://github.com/webpack-contrib/sass-loader/commit/8327d55df9e8fc6e24d2759d7bd50174ed1ff1e4))
24
+
25
+ ### [10.0.1](https://github.com/webpack-contrib/sass-loader/compare/v10.0.0...v10.0.1) (2020-08-25)
26
+
27
+ ### Chore
28
+
29
+ * update deps
30
+
5
31
  ## [10.0.0](https://github.com/webpack-contrib/sass-loader/compare/v10.0.0-rc.0...v10.0.0) (2020-08-24)
6
32
 
7
33
  ### Bug Fixes
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 = _interopRequireDefault(require("schema-utils"));
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.default)(_options.default, options, {
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
- } // Modify source paths only for webpack, otherwise we do nothing
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
- result.sourceRoot = ''; // node-sass returns POSIX paths, that's why we need to transform them back to native paths.
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
- result.map.sources = result.map.sources.map(source => (0, _utils.absolutifySourceMapSource)(this.rootContext, source));
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(), result.map);
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.absolutifySourceMapSource = absolutifySourceMapSource;
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 _klona = _interopRequireDefault(require("klona"));
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, _klona.default)(loaderOptions.sassOptions ? typeof loaderOptions.sassOptions === 'function' ? loaderOptions.sassOptions(loaderContext) || {} : loaderOptions.sassOptions : {});
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,8 +157,7 @@ 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'); // options.sourceMapRoot = process.cwd();
161
-
160
+ options.outFile = _path.default.join(loaderContext.rootContext, 'style.css.map');
162
161
  options.sourceMapContents = true;
163
162
  options.omitSourceMapUrl = true;
164
163
  options.sourceMapEmbed = false;
@@ -279,11 +278,18 @@ function getWebpackResolver(resolverFactory, implementation, includePaths = [],
279
278
  }
280
279
 
281
280
  const [{
282
- resolve,
283
- context,
284
281
  possibleRequests
285
282
  }] = resolutionMap;
286
283
 
284
+ if (possibleRequests.length === 0) {
285
+ return Promise.reject();
286
+ }
287
+
288
+ const [{
289
+ resolve,
290
+ context
291
+ }] = resolutionMap;
292
+
287
293
  try {
288
294
  return await resolve(context, possibleRequests[0]);
289
295
  } catch (_ignoreError) {
@@ -447,12 +453,26 @@ function getURLType(source) {
447
453
  return ABSOLUTE_SCHEME.test(source) ? 'absolute' : 'path-relative';
448
454
  }
449
455
 
450
- function absolutifySourceMapSource(sourceRoot, source) {
451
- const sourceType = getURLType(source); // Do no touch `scheme-relative`, `path-absolute` and `absolute` types
456
+ function normalizeSourceMap(map, rootContext) {
457
+ const newMap = map; // result.map.file is an optional property that provides the output filename.
458
+ // Since we don't know the final filename in the webpack build chain yet, it makes no sense to have it.
459
+ // eslint-disable-next-line no-param-reassign
452
460
 
453
- if (sourceType === 'path-relative') {
454
- return _path.default.resolve(sourceRoot, _path.default.normalize(source));
455
- }
461
+ delete newMap.file; // eslint-disable-next-line no-param-reassign
462
+
463
+ newMap.sourceRoot = ''; // node-sass returns POSIX paths, that's why we need to transform them back to native paths.
464
+ // This fixes an error on windows where the source-map module cannot resolve the source maps.
465
+ // @see https://github.com/webpack-contrib/sass-loader/issues/366#issuecomment-279460722
466
+ // eslint-disable-next-line no-param-reassign
467
+
468
+ newMap.sources = newMap.sources.map(source => {
469
+ const sourceType = getURLType(source); // Do no touch `scheme-relative`, `path-absolute` and `absolute` types
456
470
 
457
- return source;
471
+ if (sourceType === 'path-relative') {
472
+ return _path.default.resolve(rootContext, _path.default.normalize(source));
473
+ }
474
+
475
+ return source;
476
+ });
477
+ return newMap;
458
478
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sass-loader",
3
- "version": "10.0.0",
3
+ "version": "10.0.4",
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": "^1.1.2",
59
+ "klona": "^2.0.4",
60
60
  "loader-utils": "^2.0.0",
61
61
  "neo-async": "^2.6.2",
62
- "schema-utils": "^2.7.0",
62
+ "schema-utils": "^3.0.0",
63
63
  "semver": "^7.3.2"
64
64
  },
65
65
  "devDependencies": {
66
- "@babel/cli": "^7.10.5",
67
- "@babel/core": "^7.11.0",
68
- "@babel/preset-env": "^7.11.0",
69
- "@commitlint/cli": "^9.1.1",
70
- "@commitlint/config-conventional": "^9.1.1",
66
+ "@babel/cli": "^7.12.1",
67
+ "@babel/core": "^7.12.3",
68
+ "@babel/preset-env": "^7.12.1",
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.2.2",
74
- "bootstrap": "^4.5.1",
73
+ "babel-jest": "^26.6.0",
74
+ "bootstrap": "^4.5.3",
75
75
  "bootstrap-sass": "^3.4.1",
76
76
  "cross-env": "^7.0.2",
77
- "css-loader": "^4.2.0",
78
- "del": "^5.1.0",
77
+ "css-loader": "^5.0.0",
78
+ "del": "^6.0.0",
79
79
  "del-cli": "^3.0.1",
80
- "enhanced-resolve": "^4.3.0",
81
- "eslint": "^7.6.0",
82
- "eslint-config-prettier": "^6.11.0",
83
- "eslint-plugin-import": "^2.21.2",
80
+ "enhanced-resolve": "^5.3.0",
81
+ "eslint": "^7.10.0",
82
+ "eslint-config-prettier": "^6.14.0",
83
+ "eslint-plugin-import": "^2.22.1",
84
84
  "fibers": "^5.0.0",
85
- "file-loader": "^6.0.0",
85
+ "file-loader": "^6.1.0",
86
86
  "foundation-sites": "^6.6.3",
87
- "husky": "^4.2.5",
88
- "jest": "^26.2.2",
89
- "lint-staged": "^10.2.11",
87
+ "husky": "^4.3.0",
88
+ "jest": "^26.6.0",
89
+ "lint-staged": "^10.4.2",
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.0.5",
95
- "sass": "^1.26.10",
96
- "standard-version": "^8.0.2",
97
- "style-loader": "^1.2.1",
98
- "webpack": "^4.44.1"
94
+ "prettier": "^2.1.2",
95
+ "sass": "^1.27.0",
96
+ "standard-version": "^9.0.0",
97
+ "style-loader": "^2.0.0",
98
+ "webpack": "^5.2.0"
99
99
  },
100
100
  "keywords": [
101
101
  "sass",