fix(third-party-dts-extractor): correctly sets the source of the pack… #3467
+49
−9
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.
Description
Issue:
The third-party-extractor package currently resolves the package folder based on the location of the entry file, which can lead to incorrect handling of type declarations. Specifically, when a package has its entry file in a subdirectory (e.g.,
./lib/
) with a nestedpackage.json
, the extractor incorrectly identifies this subdirectory as the package root. This becomes problematic if the type declarations are located in a different directory (e.g.,./types/
) as specified in the rootpackage.json
'stypes
attribute. As a result, the type declarations are not copied correctly, leading to potential issues in type resolution.Solution:
This PR modifies the third-party-extractor to prioritize the root
package.json
'stypes
attribute when determining the location of type declarations. If the rootpackage.json
explicitly specifies a types directory, the extractor will now copy the type declarations from the correct location, regardless of where the entry file is located. This ensures that type declarations are accurately resolved and included, aligning with the package's intended structure.Impact:
This change improves the reliability of type declaration handling for packages with nested entry points and separate type directories, ensuring that the correct types are always included in the extracted output.
Related Issue
Types of changes
Checklist