Handle urls in import path by making vfs not panic on Url paths#2685
Merged
sheetalkamat merged 3 commits intomainfrom Feb 4, 2026
Merged
Handle urls in import path by making vfs not panic on Url paths#2685sheetalkamat merged 3 commits intomainfrom
sheetalkamat merged 3 commits intomainfrom
Conversation
jakebailey
reviewed
Feb 4, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a panic that occurred when the VFS (Virtual File System) encountered URL paths like "https://deno.land/std@0.208.0/path/mod.ts". The TypeScript compiler's module resolver would crash when trying to resolve imports with absolute URLs because the VFS implementation expected only file system paths.
Changes:
- Modified VFS path handling to recognize and gracefully handle URL paths by detecting negative root lengths and returning the correct positive length
- Updated
iovfs.RootForto returnnilfor URL roots instead of attempting to create invalid sub-filesystems - Added compiler tests and integration tests to verify URL imports don't cause crashes
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/vfs/internal/internal.go | Fixed RootLength to handle negative values (URLs) by using bitwise NOT operation to convert to positive length |
| internal/vfs/iovfs/iofs.go | Added URL detection in RootFor to return nil instead of panicking when trying to create sub-filesystem for URLs |
| testdata/tests/cases/compiler/importUrl.ts | Minimal test case with a URL import to verify no crash occurs |
| testdata/tests/cases/compiler/importUrlNodeModulesExist.ts | Test case with URL import and existing node_modules to verify resolution behavior |
| internal/project/untitled_test.go | Integration test that verifies URL imports work in untitled files without crashing |
| testdata/baselines/reference/compiler/*.{types,symbols,js,trace.json} | Baseline files showing expected behavior: URLs are skipped during module resolution |
jakebailey
approved these changes
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1905