From 065c0f2356d7277964e6b0b7000c2bd164356c04 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Mon, 17 May 2021 21:13:26 -0700 Subject: [PATCH] Add a fromImport fields to CanonicalizeRequest and FileImportRequest (#61) See sass/sass#3055 See webpack-contrib/sass-loader#905 --- CHANGELOG.md | 5 +++++ embedded_sass.proto | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89f585b..50702a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.0.0-beta.9 + +* Added `CanonicalizeRequest.fromImport` and `FileImportRequest.fromImport` + fields to allow importers to correctly handle import-only files. + ## 1.0.0-beta.8 * Added fields to support requesting and sending formatted errors and logs. diff --git a/embedded_sass.proto b/embedded_sass.proto index c3694ab..cbfd616 100644 --- a/embedded_sass.proto +++ b/embedded_sass.proto @@ -432,6 +432,16 @@ message OutboundMessage { // each importer in order until one returns something other than `null`. // That is the result of the import. string url = 4; + + /// Whether this request comes from an `@import` rule. + /// + /// When evaluating `@import` rules, URLs should canonicalize to an + /// [import-only file] if one exists for the URL being canonicalized. + /// Otherwise, canonicalization should be identical for `@import` and `@use` + /// rules. + /// + /// [import-only file]: https://sass-lang.com/documentation/at-rules/import#import-only-files + bool fromImport = 5; } // A request for a custom importer to load the contents of a stylesheet. @@ -468,6 +478,16 @@ message OutboundMessage { // The (non-canonicalized) URL of the import. string url = 4; + + /// Whether this request comes from an `@import` rule. + /// + /// When evaluating `@import` rules, filesystem importers should load an + /// [import-only file] if one exists for the URL being canonicalized. + /// Otherwise, canonicalization should be identical for `@import` and `@use` + /// rules. + /// + /// [import-only file]: https://sass-lang.com/documentation/at-rules/import#import-only-files + bool fromImport = 5; } // A request to invoke a custom Sass function and return its result.