Skip to content

Conversation

Copy link

Copilot AI commented Aug 28, 2025

Enables DefinitelyTyped packages to include nested package.json files to control module type of subfolders.

Problem

Some DefinitelyTyped packages need to include nested package.json files in subfolders to control module resolution behavior. For example, a package might need an ESM subfolder with its own package.json containing "type": "module":

types/ltx/
├── package.json          # Main package metadata
├── index.d.ts           # Main declarations
└── esm/
    ├── package.json     # Controls module type for this subfolder
    └── index.d.ts       # ESM-specific declarations

Previously, only TypeScript declaration files (.d.ts) were included when generating packages, so these nested package.json files were excluded from the published packages.

Solution

Modified the getFiles() function in packages/definitions-parser/src/lib/definition-parser.ts to include nested package.json files while preserving all existing behavior:

  • ✅ Still includes all TypeScript declaration files (.d.ts, .cts.d.ts, .mts.d.ts)
  • ✅ Now includes nested package.json files (subfolder/package.json)
  • ✅ Excludes root package.json (handled separately by the publisher)
  • ✅ No breaking changes to existing packages

Testing

Added comprehensive test coverage:

  • Unit test verifying nested package.json files are included in getFiles() output
  • Integration test confirming the publisher correctly copies these files to output packages
  • Manual verification with realistic directory structure

The 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.net

If 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.

Copilot AI changed the title [WIP] Some DefinitelyTyped packages may need to include a nested package.json file to control the module type of subfolders, e.g. - DefinitelyTyped/types/ltx/package.json - main package.json for typings package Support nested package.json files in DefinitelyTyped packages Aug 28, 2025
Copilot AI requested a review from andrewbranch August 28, 2025 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants