Skip to content

Commit

Permalink
Pass containingUrl to embedded host legacy API
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Jul 27, 2024
1 parent 36a4503 commit 642a92a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/src/embedded/compilation_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ final class CompilationDispatcher {
return sass.FilesystemImporter(importer.path);

case InboundMessage_CompileRequest_Importer_Importer.importerId:
return HostImporter(
this, importer.importerId, importer.nonCanonicalScheme);
return HostImporter(this, importer.importerId,
importer.nonCanonicalScheme, importer.invertNonCanonicalScheme);

case InboundMessage_CompileRequest_Importer_Importer.fileImporterId:
_checkNoNonCanonicalScheme(importer);
Expand Down
11 changes: 7 additions & 4 deletions lib/src/embedded/importer/host.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ final class HostImporter extends ImporterBase {
/// [canonicalize].
final Set<String> _nonCanonicalSchemes;

HostImporter(
super.dispatcher, this._importerId, Iterable<String> nonCanonicalSchemes)
final bool _invertNonCanonicalScheme;

HostImporter(super.dispatcher, this._importerId,
Iterable<String> nonCanonicalSchemes, this._invertNonCanonicalScheme)
: _nonCanonicalSchemes = Set.unmodifiable(nonCanonicalSchemes) {
for (var scheme in _nonCanonicalSchemes) {
if (isValidUrlScheme(scheme)) continue;
Expand Down Expand Up @@ -67,8 +69,9 @@ final class HostImporter extends ImporterBase {
};
}

bool isNonCanonicalScheme(String scheme) =>
_nonCanonicalSchemes.contains(scheme);
bool isNonCanonicalScheme(String scheme) => _invertNonCanonicalScheme
? !_nonCanonicalSchemes.contains(scheme)
: _nonCanonicalSchemes.contains(scheme);

String toString() => "HostImporter";
}

0 comments on commit 642a92a

Please sign in to comment.