Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: FileResolver should not handle URL parsing #34

Merged
merged 1 commit into from
Nov 10, 2024

Conversation

fvsch
Copy link
Owner

@fvsch fvsch commented Nov 10, 2024

The responsibilities of the FileResolver class were a bit too wide. It should not be responsible for parsing URLs to extract a path. Instead it should only know about a root path, and get queries for local paths:

// before:
const { status, urlPath, file } = await resolver.find(url);

// after:
const urlPath = extractUrlPath(url);
const localPath = decodeURIComponent(urlPath);
const { status, file } = await resolver.find(localPath);

@fvsch fvsch force-pushed the fvsch/no-urls-in-resolver branch from d75e24f to 3e060f2 Compare November 10, 2024 22:48
@fvsch fvsch merged commit bedc9a7 into main Nov 10, 2024
1 check passed
@fvsch fvsch deleted the fvsch/no-urls-in-resolver branch November 10, 2024 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant