Support nested package.json files in DefinitelyTyped packages #1194
+0
−0
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.
Enables DefinitelyTyped packages to include nested
package.jsonfiles to control module type of subfolders.Problem
Some DefinitelyTyped packages need to include nested
package.jsonfiles in subfolders to control module resolution behavior. For example, a package might need an ESM subfolder with its ownpackage.jsoncontaining"type": "module":Previously, only TypeScript declaration files (
.d.ts) were included when generating packages, so these nestedpackage.jsonfiles were excluded from the published packages.Solution
Modified the
getFiles()function inpackages/definitions-parser/src/lib/definition-parser.tsto include nestedpackage.jsonfiles while preserving all existing behavior:.d.ts,.cts.d.ts,.mts.d.ts)package.jsonfiles (subfolder/package.json)package.json(handled separately by the publisher)Testing
Added comprehensive test coverage:
package.jsonfiles are included ingetFiles()outputThe change is minimal and surgical - only 3 lines modified in the core function to add the new file inclusion logic.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
functionscdn.azureedge.netIf you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.