Repository navigation
Conversation
Ports the Yarn Plug'n'Play (PnP) support developed on guyllian.gomez/yarn-pnp in typescript-go into this repo's layout, adding a pnp resolver and vfs overlay so tsc/lsp can resolve modules through .pnp.cjs/.pnp.data.json manifests without node_modules. - internal/pnp: parses PnP manifests and resolves package/dependency locations - internal/vfs/pnpvfs: read-through vfs.FS overlay that exposes zip-packed dependencies (zip:/path/to.zip/inner/path) as regular files - module resolver, autoimport, and project/session wiring to plug the PnP resolver and vfs into the existing module resolution and LSP pipelines - new compiler/fourslash test fixtures and baselines under tsc/testdata covering PnP resolution scenarios - packages/vscode-typescript/src/client.ts: register the "zip" URI scheme in the LSP client's documentSelector so the extension attaches to files served from zip-packed PnP dependencies Ported and squashed from the original branch history to reconcile with divergent upstream refactors (module rename to github.com/microsoft/TypeScript/tsc, auto-import infrastructure rewrite) that landed in this repo's main before this port. Original work also includes contributions from valentinmelusson (fix package IDs for Yarn PnP submodule imports) and gun-yu (add pnp error handling and test). Co-Authored-By: valentinmelusson <valentin.melusson@datadoghq.com> Co-Authored-By: gun-yu <163322737+gun-yu@users.noreply.github.com>
…ests Co-Authored-By: ejc3 <ejc3@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Select the closest PnP manifest for each importer and project, cache scoped APIs, and reset the cache when manifests change. Watch each project’s manifest and preserve earlier snapshots during refresh. Add regression tests for nested resolution, type roots, importability, manifest refresh, and root-workspace language service behavior. Validation: full hereby validate, PnP race tests, both Meteox typechecks, and root-workspace LSP diagnostics and manifest watches.
Resolving the PnP diagnostics conflict during the rebase rewrote the file with LF line endings, which showed the whole file as changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Rebases the Yarn PnP commits from
snovaderonto upstream microsoft/TypeScript@2f9fd09a10 (microsoft#63915, source phase imports) so meteox can useimport sourcefor Wasm. The build from this branch,7.1.0-dev.snovader.sha8c92e4a70c, is vendored in snovader/meteox#1242.mainis fast-forwarded to 2f9fd09, so this diff is exactly the rebased PnP commits. Don't merge this intomain: land it by resettingsnovaderto this branch, and keepmainas the upstream base.Why this base
Rebasing onto
v7.1-betaconflicted in 44 files, because upstream reworked the compiler hosts and module resolution after 2026-10-02. Theimport sourcecommit itself has no later fixes upstream, and it conflicted in 7 files.Conflicts
In the first commit, both sides were kept:
module/resolver.go: the PnP lookup for peer dependencies now falls back to upstream's newresolvePathForModule.project/session.go: upstream's new session fields and thepnpApifield, plus bothDefaultLibraryPath()andPnpApi().diagnostics/diagnosticMessages.json: upstream's 18111–18115 messages plus the PnP messages; the generated files are regenerated.ls/lsconv/converters_test.go: the PnPzip://cases plus upstream's newuntitled:encoding.module/resolver_test.go: now an internal test package upstream, so the PnP stub and test are re-applied without themodule.qualifier.Adaptations
Upstream changes that git merged silently but that broke the PnP code:
candidateDirectory:loadModuleFromSpecificNodeModulesDirectoryImplnow computes it, since the PnP resolver calls that function directly.tryGetModuleNameAsNodeModule: the PnP copy,tryGetModuleNameAsPnpPackage, gets the same change (currentPartsand the newpackageBaseRootIndexargument).projectReferenceDtsFakingHostlost itshostfield upstream: it's back, soPnpApi()still delegates.api.Session,apiBuildSystemandproject.SnapshotHostimplementPnpApi(), delegating the same way theirFS()does.NewCompilerHostcall sites in upstream's tests pass the extrapnpApiargument."Adapt PnP support to current compiler APIs" became empty and is dropped. Its changes are in the first commit, which has to compile on the new base.
The last commit restores CRLF line endings in
diagnosticMessages.json, which my conflict resolution had converted to LF. The vendored build is from 8c92e4a, the commit before it, and the build output is the same.Tests
go build ./tsc/...andgo vet ./tsc/...: cleango test ./tsc/...: 67/67 packages passed, includingpnp,module,modulespecifiers,compiler,projectandapinpx hereby typescript:build --forRelease --setPrerelease dev.snovader.sha8c92e4a70c: succeededyarn typecheckreports 0 errors, the Node-native Vitest projects pass, and thesdks/typescripttypecheck, tests and build pass🤖 Generated with Claude Code