Repository navigation
fix(48431): skip node_modules probes for URI-like module names - #65723
Open
Sumit G (smg99) wants to merge 2 commits into
Open
Sumit G (smg99) wants to merge 2 commits into
Sumit G (smg99) wants to merge 2 commits into
Conversation
Extend the existing absolute-URI skip beyond resolveNodeLikeWorker so typings ATA, package-directory lookup, and type-reference resolution also avoid probing paths like node_modules/node:fs.
Sumit G (smg99)
force-pushed
the
fix/48431-skip-node-colon-fs-probes
branch
from
November 29, 2026 10:00
f12b404 to
0cdda3b
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The unconditional colon check rejects valid disk-path type references, causing existing declaration files to resolve as unresolved.
1 open issue
What changed in this PR
Addresses #48431 by extending the resolver’s existing URI-like module handling to avoid unnecessary filesystem probes for names such as node:fs.
Changes:
- Extracts the existing colon check into a shared helper.
- Adds early exits for typings-location, package-directory, type-reference, and node_modules lookups.
- Adds probe-counting tests for URI-like names and a bare
"fs"control.
| File | Description |
|---|---|
tsc/internal/module/util.go |
Adds the shared URI-like module-name helper. |
tsc/internal/module/resolver.go |
Applies URI guards to additional resolution paths. |
tsc/internal/module/node_colon_probe_test.go |
Tests skipped filesystem probes and URI-skip traces. |
Review effort: Balanced
Exclude IsExternalModuleNameRelative names from the URI early-exit in resolveTypeReferenceDirective so disk paths like ./foo:bar still resolve.
This branch has not been deployed
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 #48431
Problem
Resolving names like
node:fshistorically probed the filesystem for paths such asnode_modules/node:fs,node_modules/node:fs.d.ts, and@types/node:fs.resolveNodeLikeWorkeralready treated names containing:as absolute URIs and skippednode_modules, but other entry points still searched disk:tryResolveFromTypingsLocation)ResolvePackageDirectoryThis PR only closes those accidental holes. It does not change the existing by-design absolute-URI skip inside
resolveNodeLikeWorker.Fix
moduleNameLooksLikeAbsoluteURI(same:check as today)node_modulesancestor walk / immediate loader for defense in depthIsExternalModuleNameRelativechecksBefore / after (FS URI-like probes)
Local fixture with
/project/node_modules/node:fsand a typings location. Counts are filesystem lookups whose path containsnode:(orhttp:).ResolveModuleName("node:fs")resolveNodeLikeWorker)TypingsLocationset)/typings/node_modules/node:fs*,@types/node:fs*)ResolvePackageDirectory("node:fs")/project/node_modules/node:fsResolveTypeReferenceDirective("node:fs")…/node:fs/index.d.ts"fs"node_modules/fs/@types/fs(no URI-like paths)Tests
TestNodeColonModuleSkipsNodeModulesProbescovers the rows above and asserts the absolute-URI skip trace where tracing is enabled.Notes
Linux can host files named with
:. Matching the existingresolveNodeLikeWorkerpolicy, those names are not loaded fromnode_modules. Ambient@types/nodedeclarations fornode:fsare unchanged.Linked issue #48431 currently has no milestone (Domain: Performance only). Per CONTRIBUTING, issues without an assigned milestone are not accepting PRs; this PR is labeled
For Uncommitted Buguntil triage places the issue inBacklog(or equivalent).Checklist
Backlogmilestone (required) — blocked on triage of Don't search the file system for node: modules #48431mainbranchnpx hereby test(focused Go module-resolution tests)npx hereby lintnpx hereby check:format