sass-loader 10.0.1 → 10.0.5

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,33 @@
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.5](https://github.com/webpack-contrib/sass-loader/compare/v10.0.4...v10.0.5) (2020-11-02)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * support node-sass v5.0.0 ([#899](https://github.com/webpack-contrib/sass-loader/issues/899)) ([c3e279f](https://github.com/webpack-contrib/sass-loader/commit/c3e279fb4668fce4c597a6c8cd1d0f2ff8bc95e5))
11
+
12
+ ### [10.0.4](https://github.com/webpack-contrib/sass-loader/compare/v10.0.3...v10.0.4) (2020-10-22)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * 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))
18
+
19
+ ### [10.0.3](https://github.com/webpack-contrib/sass-loader/compare/v10.0.2...v10.0.3) (2020-10-09)
20
+
21
+ ### Chore
22
+
23
+ * update `schema-utils`
24
+
25
+ ### [10.0.2](https://github.com/webpack-contrib/sass-loader/compare/v10.0.1...v10.0.2) (2020-09-03)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * source maps generation ([#886](https://github.com/webpack-contrib/sass-loader/issues/886)) ([8327d55](https://github.com/webpack-contrib/sass-loader/commit/8327d55df9e8fc6e24d2759d7bd50174ed1ff1e4))
31
+
5
32
  ### [10.0.1](https://github.com/webpack-contrib/sass-loader/compare/v10.0.0...v10.0.1) (2020-08-25)
6
33
 
7
34
  ### Chore
package/README.md CHANGED
@@ -148,7 +148,7 @@ Example where the `sass-loader` loader uses the `node-sass` implementation:
148
148
  {
149
149
  "devDependencies": {
150
150
  "sass-loader": "^7.2.0",
151
- "node-sass": "^4.0.0"
151
+ "node-sass": "^5.0.0"
152
152
  }
153
153
  }
154
154
  ```
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
 
@@ -80,8 +80,8 @@ function getSassImplementation(implementation) {
80
80
 
81
81
  return resolvedImplementation;
82
82
  } else if (implementationName === 'node-sass') {
83
- if (!_semver.default.satisfies(version, '^4.0.0')) {
84
- throw new Error(`Node Sass version ${version} is incompatible with ^4.0.0.`);
83
+ if (!_semver.default.satisfies(version, '^4.0.0 || ^5.0.0')) {
84
+ throw new Error(`Node Sass version ${version} is incompatible with ^4.0.0 || ^5.0.0.`);
85
85
  }
86
86
 
87
87
  return resolvedImplementation;
@@ -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.1",
3
+ "version": "10.0.5",
4
4
  "description": "Sass loader for webpack",
5
5
  "license": "MIT",
6
6
  "repository": "webpack-contrib/sass-loader",
@@ -40,7 +40,7 @@
40
40
  ],
41
41
  "peerDependencies": {
42
42
  "webpack": "^4.36.0 || ^5.0.0",
43
- "node-sass": "^4.0.0",
43
+ "node-sass": "^4.0.0 || ^5.0.0",
44
44
  "sass": "^1.3.0",
45
45
  "fibers": ">= 3.1.0"
46
46
  },
@@ -56,46 +56,46 @@
56
56
  }
57
57
  },
58
58
  "dependencies": {
59
- "klona": "^2.0.3",
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.4",
68
- "@babel/preset-env": "^7.11.0",
69
- "@commitlint/cli": "^10.0.0",
70
- "@commitlint/config-conventional": "^10.0.0",
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.3.0",
74
- "bootstrap": "^4.5.2",
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.2",
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.7.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.4.2",
89
- "lint-staged": "^10.2.12",
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
- "node-sass": "^4.14.1",
92
+ "node-sass": "^5.0.0",
93
93
  "npm-run-all": "^4.1.5",
94
- "prettier": "^2.1.0",
95
- "sass": "^1.26.10",
94
+ "prettier": "^2.1.2",
95
+ "sass": "^1.27.0",
96
96
  "standard-version": "^9.0.0",
97
- "style-loader": "^1.2.1",
98
- "webpack": "^4.44.1"
97
+ "style-loader": "^2.0.0",
98
+ "webpack": "^5.2.0"
99
99
  },
100
100
  "keywords": [
101
101
  "sass",