This repository was archived by the owner on Jun 16, 2025. It is now read-only.
fix(sass): don't detect transitive dependencies #827
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It turns out my original reimplementation of the sass parser wasn't the most fortunate thing to do :)
TL;DR: the current implementation uses
'sass'
to actually compile sass code and its' deps. The new implementation uses regex to find@import
,@use
and@forward
at-rules and finds dependencies from import paths of these rules.The original implementation with
sass.compileString()
method contained an untested bug. After sass code was compiled, theloadedUrls
property of returned object included all the modules that entered the compilation. This included transitive dependencies, that direct dependencies of the processed sass files depended on. This was incorrect. At the same time the 'sass' compiler doesn't allow compiling a code without processing all the dependencies. There's no way to filter only "shallow"/direct depdencies fromloadedUrls
.That's why native sass compilation was replaced with custom resolution logic that parses sass/scss files as follows:
Updated fake_modules/sass and spec file test these additional scenarios: