Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
jathak committed Oct 15, 2024
1 parent 8322125 commit eed7555
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/src/legacy/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ export function removeLegacyImporter(string: string): string {
// syntax.
export function removeLegacyImporterFromSpan(span: SourceSpan): SourceSpan {
if (!span.url) return span;
const url = removeLegacyImporter(span.url.toString());
try {
return {...span, url: new URL(url)};
} catch (_) {
// Relative URL
return {...span, url: new URL(url, `file://${process.cwd()}`)};
}
return {
...span,
url: new URL(
removeLegacyImporter(span.url.toString()),
pathToFileURL(process.cwd())
),
};
}

// Converts [path] to a `file:` URL and adds the [legacyImporterProtocolPrefix]
Expand Down

0 comments on commit eed7555

Please sign in to comment.