Skip to content

Commit 960481f

Browse files
Kocalweaverryan
authored andcommitted
feat: upgrade sass-loader support to ^8
1 parent 77cb1fa commit 960481f

File tree

6 files changed

+37
-25
lines changed

6 files changed

+37
-25
lines changed

lib/loaders/sass.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ module.exports = {
4242
const config = Object.assign({}, {
4343
// needed by the resolve-url-loader
4444
sourceMap: (true === webpackConfig.sassOptions.resolveUrlLoader) || webpackConfig.useSourceMaps,
45-
// CSS minification is handled with mini-css-extract-plugin
46-
outputStyle: 'expanded'
45+
sassOptions: {
46+
// CSS minification is handled with mini-css-extract-plugin
47+
outputStyle: 'expanded'
48+
}
4749
});
4850

4951
sassLoaders.push({

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"preact": "^8.2.1",
8686
"preact-compat": "^3.17.0",
8787
"sass": "^1.17.0",
88-
"sass-loader": "^7.0.1",
88+
"sass-loader": "^8.0.0",
8989
"sinon": "^2.3.4",
9090
"strip-ansi": "^6.0.0",
9191
"stylus": "^0.54.5",

test/WebpackConfig.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ describe('WebpackConfig object', () => {
844844

845845
it('Pass options callback', () => {
846846
const config = createConfig();
847-
const callback = (sassOptions) => {};
847+
const callback = (options) => {};
848848
config.enableSassLoader(callback);
849849

850850
expect(config.sassLoaderOptionsCallback).to.equal(callback);

test/loaders/sass.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,20 @@ describe('loaders/sass', () => {
111111
sinon.stub(cssLoader, 'getLoaders')
112112
.callsFake(() => []);
113113

114-
config.enableSassLoader(function(sassOptions) {
115-
sassOptions.custom_optiona = 'baz';
116-
sassOptions.other_option = true;
114+
config.enableSassLoader(function(options) {
115+
options.sassOptions.custom_option = 'baz';
116+
options.sassOptions.other_option = true;
117117
});
118118

119119
const actualLoaders = sassLoader.getLoaders(config);
120120

121121
expect(actualLoaders[1].options).to.deep.equals({
122122
sourceMap: true,
123-
outputStyle: 'expanded',
124-
custom_optiona: 'baz',
125-
other_option: true
123+
sassOptions: {
124+
outputStyle: 'expanded',
125+
custom_option: 'baz',
126+
other_option: true
127+
}
126128
});
127129
cssLoader.getLoaders.restore();
128130
});
@@ -134,8 +136,8 @@ describe('loaders/sass', () => {
134136
sinon.stub(cssLoader, 'getLoaders')
135137
.callsFake(() => []);
136138

137-
config.enableSassLoader(function(sassOptions) {
138-
sassOptions.custom_option = 'baz';
139+
config.enableSassLoader(function(options) {
140+
options.custom_option = 'baz';
139141

140142
// This should override the original config
141143
return { foo: true };

test/package-helper.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ describe('package-helper', () => {
123123
describe('The getInvalidPackageVersionRecommendations correctly checks installed versions', () => {
124124
it('Check package that *is* the correct version', () => {
125125
const versionProblems = packageHelper.getInvalidPackageVersionRecommendations([
126-
{ name: 'sass-loader', version: '^7.0.1' },
126+
{ name: 'sass-loader', version: '^8.0.0' },
127127
{ name: 'preact', version: '^8.1.0' }
128128
]);
129129

@@ -132,17 +132,17 @@ describe('package-helper', () => {
132132

133133
it('Check package with a version too low', () => {
134134
const versionProblems = packageHelper.getInvalidPackageVersionRecommendations([
135-
{ name: 'sass-loader', version: '^8.0.1' },
135+
{ name: 'sass-loader', version: '^9.0.0' },
136136
{ name: 'preact', version: '9.0.0' }
137137
]);
138138

139139
expect(versionProblems).to.have.length(2);
140140
expect(versionProblems[0]).to.contain('is too old');
141141
});
142142

143-
it('Check package with a version too low', () => {
143+
it('Check package with a version too new', () => {
144144
const versionProblems = packageHelper.getInvalidPackageVersionRecommendations([
145-
{ name: 'sass-loader', version: '^6.9.11' },
145+
{ name: 'sass-loader', version: '^7.0.1' },
146146
{ name: 'preact', version: '7.0.0' }
147147
]);
148148

yarn.lock

+17-9
Original file line numberDiff line numberDiff line change
@@ -5255,7 +5255,7 @@ [email protected]:
52555255
emojis-list "^2.0.0"
52565256
json5 "^1.0.1"
52575257

5258-
loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0:
5258+
loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0:
52595259
version "1.4.0"
52605260
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613"
52615261
integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==
@@ -7514,15 +7514,15 @@ [email protected]:
75147514
scss-tokenizer "^0.2.3"
75157515
yargs "^13.3.2"
75167516

7517-
sass-loader@^7.0.1:
7518-
version "7.3.1"
7519-
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-7.3.1.tgz#a5bf68a04bcea1c13ff842d747150f7ab7d0d23f"
7520-
integrity sha512-tuU7+zm0pTCynKYHpdqaPpe+MMTQ76I9TPZ7i4/5dZsigE350shQWe5EZNl5dBidM49TPET75tNqRbcsUZWeNA==
7517+
sass-loader@^8.0.0:
7518+
version "8.0.2"
7519+
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-8.0.2.tgz#debecd8c3ce243c76454f2e8290482150380090d"
7520+
integrity sha512-7o4dbSK8/Ol2KflEmSco4jTjQoV988bM82P9CZdmo9hR3RLnvNc0ufMNdMrB0caq38JQ/FgF4/7RcbcfKzxoFQ==
75217521
dependencies:
75227522
clone-deep "^4.0.1"
7523-
loader-utils "^1.0.1"
7524-
neo-async "^2.5.0"
7525-
pify "^4.0.1"
7523+
loader-utils "^1.2.3"
7524+
neo-async "^2.6.1"
7525+
schema-utils "^2.6.1"
75267526
semver "^6.3.0"
75277527

75287528
sass@^1.17.0:
@@ -7546,14 +7546,22 @@ schema-utils@^1.0.0:
75467546
ajv-errors "^1.0.0"
75477547
ajv-keywords "^3.1.0"
75487548

7549-
schema-utils@^2.6.5, schema-utils@^2.6.6:
7549+
schema-utils@^2.6.1, schema-utils@^2.6.6:
75507550
version "2.6.6"
75517551
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.6.tgz#299fe6bd4a3365dc23d99fd446caff8f1d6c330c"
75527552
integrity sha512-wHutF/WPSbIi9x6ctjGGk2Hvl0VOz5l3EKEuKbjPlB30mKZUzb9A5k9yEXRX3pwyqVLPvpfZZEllaFq/M718hA==
75537553
dependencies:
75547554
ajv "^6.12.0"
75557555
ajv-keywords "^3.4.1"
75567556

7557+
schema-utils@^2.6.5:
7558+
version "2.6.5"
7559+
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.5.tgz#c758f0a7e624263073d396e29cd40aa101152d8a"
7560+
integrity sha512-5KXuwKziQrTVHh8j/Uxz+QUbxkaLW9X/86NBlx/gnKgtsZA2GIVMUn17qWhRFwF8jdYb3Dig5hRO/W5mZqy6SQ==
7561+
dependencies:
7562+
ajv "^6.12.0"
7563+
ajv-keywords "^3.4.1"
7564+
75577565
scss-tokenizer@^0.2.3:
75587566
version "0.2.3"
75597567
resolved "https://registry.yarnpkg.com/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz#8eb06db9a9723333824d3f5530641149847ce5d1"

0 commit comments

Comments
 (0)