-
-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Export a decoupled Sass importer #874
feat: Export a decoupled Sass importer #874
Conversation
Codecov Report
@@ Coverage Diff @@
## master #874 +/- ##
==========================================
+ Coverage 97.94% 98.06% +0.11%
==========================================
Files 4 4
Lines 195 207 +12
Branches 65 67 +2
==========================================
+ Hits 191 203 +12
Misses 4 4
Continue to review full report at Codecov.
|
7005704
to
b7a455e
Compare
f0ae609
to
18bb883
Compare
This will be used by `vue-jest` and potentially other projects, to write a Jest transform that can adequately mimic `sass-loader`'s behaviour. Closes webpack-contrib#873
As discussed in code review, this is more the responsibility of the consumer, as `sass-loader/dist/utils.js` already exports all the necessary functionality.
18bb883
to
c649db0
Compare
We can reduce our API surface slightly by not considering `getSassImplementation` as a public function, and instead using to determine defaults from within the only public function in `utils.js`: `getWebpackResolver()`.
Because `getWebpackResolver` is now part of `utils.js`' public API, we should test it separately so that we have some protection against its API changing drastically from potential future refactors.
93176d3
to
18106c3
Compare
@evilebottnawi I had been ignoring the broken build because the only regression in code coverage was due to two parameters being made optional, and not calling them specifically without arguments gets reported as missing branch coverage. But I realize now that you were probably waiting on me to fix the build. So I've added some tests to test the |
Using `getSassImplementation()` inside the resolver factory is not a good idea not only because it means it will be called twice for normal usage of the loader, but also because consumers of `getWebpackResolver` are almost certainly also calling Sass itself, meaning they'll need to use `getSassImplementation()` anyway to make sure they're using the same implementation as the resolver thinks is being used.
try { | ||
result = await resolve(context, possibleRequests[0]); | ||
return await resolve(context, possibleRequests[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need await
for return
, just remove await
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I don't await
the promise, the try ... catch
block will never catch any promise rejections, so a lot of tests fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do refactor in future ()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for delay, hope we don't break something
I will not changelog it, because it is internal |
This PR contains a:
Motivation / Use-Case
See #873