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.
What's the problem this PR addresses?
The current SDK files had to run within a part of the dependency tree in order to be able to access the original files (for example, the ESLint SDK was doing a
require('eslint')
). This started to cause issues with the new vscode-eslint version, which usesNODE_PATH
in order to detect the path of the ESLint API.How did you fix it?
The PnP loader is told to use the native resolution when resolving from locations inside the SDK files (this means that calling
require('eslint', {paths:['.vscode/pnpify']})
will now go into the classic resolution and thus properly supportNODE_PATH
).The SDK files now get the path of the modules they need to resolve by running a resolution on behalf of the project root (rather than themselves, since they're now considered as being outside of the dependency tree, cf previous point).
The PnP ignore mechanism has been revamped and now accepts a list of glob patterns instead of a single regex. The paths are compared relative to the project root instead of being checked against the absolute path of the issuer.
Even if the issuer is covered by an ignore rule, the request will still go to the PnP resolver if it can be proved to belong to a package inside the dependency tree (which only happens if the requested module is an absolute path). This is because the native resolver otherwise cannot load files from within zip archives (the native resolver doesn't use the
fs
extensions, and instead uses its own native binding ofstat
).