Skip to content

Commit 2eaa4ad

Browse files
committed
feature #758 Feat/sass loader 8 (Kocal, weaverryan)
This PR was merged into the master branch. Discussion ---------- Feat/sass loader 8 Fixes weird test issue for #736 - I'm trying to see if I can debug the "lowest" test failure. It appears the problem is with Webpack > 4.22 and Vue < 2.5.0. Commits ------- fb24ca7 Vue 2.5.0 as minimum 9911316 build(deps): upgrade webpack version to ^4.36.0 960481f feat: upgrade sass-loader support to ^8
2 parents 77008f2 + fb24ca7 commit 2eaa4ad

File tree

6 files changed

+46
-34
lines changed

6 files changed

+46
-34
lines changed

lib/loaders/sass.js

Lines changed: 4 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"style-loader": "^1.1.3",
4747
"terser-webpack-plugin": "^1.1.0",
4848
"tmp": "^0.2.1",
49-
"webpack": "^4.22.0",
49+
"webpack": "^4.36.0",
5050
"webpack-cli": "^3.0.0",
5151
"webpack-dev-server": "^3.1.14",
5252
"webpack-manifest-plugin": "^2.0.2",
@@ -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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 10 additions & 8 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ acorn@^5.5.3:
12331233
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e"
12341234
integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==
12351235

1236-
acorn@^6.0.1, acorn@^6.4.1:
1236+
acorn@^6.0.1, acorn@^6.2.1:
12371237
version "6.4.1"
12381238
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474"
12391239
integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==
@@ -5254,7 +5254,7 @@ [email protected]:
52545254
emojis-list "^2.0.0"
52555255
json5 "^1.0.1"
52565256

5257-
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:
5257+
loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0:
52585258
version "1.4.0"
52595259
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613"
52605260
integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==
@@ -7518,15 +7518,15 @@ [email protected]:
75187518
scss-tokenizer "^0.2.3"
75197519
yargs "^13.3.2"
75207520

7521-
sass-loader@^7.0.1:
7522-
version "7.3.1"
7523-
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-7.3.1.tgz#a5bf68a04bcea1c13ff842d747150f7ab7d0d23f"
7524-
integrity sha512-tuU7+zm0pTCynKYHpdqaPpe+MMTQ76I9TPZ7i4/5dZsigE350shQWe5EZNl5dBidM49TPET75tNqRbcsUZWeNA==
7521+
sass-loader@^8.0.0:
7522+
version "8.0.2"
7523+
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-8.0.2.tgz#debecd8c3ce243c76454f2e8290482150380090d"
7524+
integrity sha512-7o4dbSK8/Ol2KflEmSco4jTjQoV988bM82P9CZdmo9hR3RLnvNc0ufMNdMrB0caq38JQ/FgF4/7RcbcfKzxoFQ==
75257525
dependencies:
75267526
clone-deep "^4.0.1"
7527-
loader-utils "^1.0.1"
7528-
neo-async "^2.5.0"
7529-
pify "^4.0.1"
7527+
loader-utils "^1.2.3"
7528+
neo-async "^2.6.1"
7529+
schema-utils "^2.6.1"
75307530
semver "^6.3.0"
75317531

75327532
sass@^1.17.0:
@@ -7550,14 +7550,22 @@ schema-utils@^1.0.0:
75507550
ajv-errors "^1.0.0"
75517551
ajv-keywords "^3.1.0"
75527552

7553-
schema-utils@^2.6.5, schema-utils@^2.6.6:
7553+
schema-utils@^2.6.1, schema-utils@^2.6.6:
75547554
version "2.6.6"
75557555
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.6.tgz#299fe6bd4a3365dc23d99fd446caff8f1d6c330c"
75567556
integrity sha512-wHutF/WPSbIi9x6ctjGGk2Hvl0VOz5l3EKEuKbjPlB30mKZUzb9A5k9yEXRX3pwyqVLPvpfZZEllaFq/M718hA==
75577557
dependencies:
75587558
ajv "^6.12.0"
75597559
ajv-keywords "^3.4.1"
75607560

7561+
schema-utils@^2.6.5:
7562+
version "2.6.5"
7563+
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.5.tgz#c758f0a7e624263073d396e29cd40aa101152d8a"
7564+
integrity sha512-5KXuwKziQrTVHh8j/Uxz+QUbxkaLW9X/86NBlx/gnKgtsZA2GIVMUn17qWhRFwF8jdYb3Dig5hRO/W5mZqy6SQ==
7565+
dependencies:
7566+
ajv "^6.12.0"
7567+
ajv-keywords "^3.4.1"
7568+
75617569
scss-tokenizer@^0.2.3:
75627570
version "0.2.3"
75637571
resolved "https://registry.yarnpkg.com/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz#8eb06db9a9723333824d3f5530641149847ce5d1"
@@ -8808,7 +8816,7 @@ w3c-hr-time@^1.0.1:
88088816
dependencies:
88098817
browser-process-hrtime "^1.0.0"
88108818

8811-
watchpack@^1.6.1:
8819+
watchpack@^1.6.0:
88128820
version "1.6.1"
88138821
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.1.tgz#280da0a8718592174010c078c7585a74cd8cd0e2"
88148822
integrity sha512-+IF9hfUFOrYOOaKyfaI7h7dquUIOgyEMoQMLA7OP5FxegKA2+XdXThAZ9TU2kucfhDH7rfMHs1oPYziVGWRnZA==
@@ -8931,16 +8939,16 @@ webpack-sources@^1.1.0, webpack-sources@^1.3.0, webpack-sources@^1.4.0, webpack-
89318939
source-list-map "^2.0.0"
89328940
source-map "~0.6.1"
89338941

8934-
webpack@^4.22.0:
8935-
version "4.43.0"
8936-
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.43.0.tgz#c48547b11d563224c561dad1172c8aa0b8a678e6"
8937-
integrity sha512-GW1LjnPipFW2Y78OOab8NJlCflB7EFskMih2AHdvjbpKMeDJqEgSx24cXXXiPS65+WSwVyxtDsJH6jGX2czy+g==
8942+
webpack@^4.36.0:
8943+
version "4.42.1"
8944+
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.42.1.tgz#ae707baf091f5ca3ef9c38b884287cfe8f1983ef"
8945+
integrity sha512-SGfYMigqEfdGchGhFFJ9KyRpQKnipvEvjc1TwrXEPCM6H5Wywu10ka8o3KGrMzSMxMQKt8aCHUFh5DaQ9UmyRg==
89388946
dependencies:
89398947
"@webassemblyjs/ast" "1.9.0"
89408948
"@webassemblyjs/helper-module-context" "1.9.0"
89418949
"@webassemblyjs/wasm-edit" "1.9.0"
89428950
"@webassemblyjs/wasm-parser" "1.9.0"
8943-
acorn "^6.4.1"
8951+
acorn "^6.2.1"
89448952
ajv "^6.10.2"
89458953
ajv-keywords "^3.4.1"
89468954
chrome-trace-event "^1.0.2"
@@ -8957,7 +8965,7 @@ webpack@^4.22.0:
89578965
schema-utils "^1.0.0"
89588966
tapable "^1.1.3"
89598967
terser-webpack-plugin "^1.4.3"
8960-
watchpack "^1.6.1"
8968+
watchpack "^1.6.0"
89618969
webpack-sources "^1.4.1"
89628970

89638971
websocket-driver@>=0.5.1:

0 commit comments

Comments
 (0)