-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid relying on buggy import order in the legacy importer (#245)
Historically, the legacy importer shim has strongly assumed that all calls to `canonicalize()` would doubled: once as a URL resolved relative to the current importer, and again as a URL passed to the importers list. However, this relies on buggy, non-spec-compliant behavior in Dart Sass: absolute URLs should never be passed to the current importer, only to the global list of importers. This change avoids relying on that behavior by instead disambiguating relative loads using a custom URL protocol prefix. All canonical URLs passed to Dart Sass now have the prefix `legacy-importer-` added to the beginning. This allows us to disambiguate relative loads, and ignore them for non-`file:` URLs, since relative loads and _only_ relative loads will have schemes beginning with `legacy-importer-`. To avoid regressing the developer experience, we then strip these prefixes from all URLs before they're passed to any developer-facing APIs or displayed to the user.
- Loading branch information
Showing
4 changed files
with
167 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.