Skip to content

Commit

Permalink
Automatically handle absolute URLs for FileImporters
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Oct 6, 2021
1 parent 4c85589 commit a29cbcf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/src/importer/node_to_dart/async_file.dart
Expand Up @@ -30,7 +30,8 @@ class NodeToDartAsyncFileImporter extends AsyncImporter {
NodeToDartAsyncFileImporter(this._findFileUrl);

FutureOr<Uri?> canonicalize(Uri url) async {
if (url.scheme != 'file' && url.scheme != '') return null;
if (url.scheme == 'file') return _filesystemImporter.canonicalize(url);
if (url.scheme != '') return null;

var result = _findFileUrl(
url.toString(), CanonicalizeOptions(fromImport: fromImport));
Expand Down
3 changes: 2 additions & 1 deletion lib/src/importer/node_to_dart/file.dart
Expand Up @@ -27,7 +27,8 @@ class NodeToDartFileImporter extends Importer {
NodeToDartFileImporter(this._findFileUrl);

Uri? canonicalize(Uri url) {
if (url.scheme != 'file' && url.scheme != '') return null;
if (url.scheme == 'file') return _filesystemImporter.canonicalize(url);
if (url.scheme != '') return null;

var result = _findFileUrl(
url.toString(), CanonicalizeOptions(fromImport: fromImport));
Expand Down

0 comments on commit a29cbcf

Please sign in to comment.