fix(build-tools): nested exports support#26440
Open
jason-ha wants to merge 2 commits intomicrosoft:mainfrom
Open
fix(build-tools): nested exports support#26440jason-ha wants to merge 2 commits intomicrosoft:mainfrom
jason-ha wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Fix `generate node10Entrypoints` and `generate typetests` to support nested paths including `legacy/alpha`. Previously, an entrypoint of `"legacyPublic"` or `"legacyBeta"` or `"legacyAlpha"` would not find entrypoint that was actually "legacy" or "legacy/alpha". Additionally update `generate typetests` to use entrypoint for current package instead of hard coding `../../index.js`. Then other type sets like an internal protocol (once exported) can be validated version to version. To support special exports the expected tsconfig for outfile is now inspected for custom `conditions` that are used. The common one for FF test exports is "allow-ff-test-exports".
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the build-tools to properly support nested export paths like legacy/alpha in the generate node10Entrypoints and generate typetests commands. Previously, entrypoints such as "legacyPublic", "legacyBeta", or "legacyAlpha" would fail to resolve to actual paths like "legacy" or "legacy/alpha".
Changes:
- Updated type validation configuration to use string-based entrypoint specifications instead of
ApiLevelenums - Modified
generate typeteststo resolve imports using the current package's entrypoint rather than hard-coding../../index.js - Enhanced generated file headers to include the command line used for generation
- Added support for custom TypeScript conditions from tsconfig when resolving type paths
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| build-tools/packages/build-cli/src/typeValidator/typeValidatorConfig.ts | Changes entrypoint type from ApiLevel enum to string and updates default value to "legacy/alpha" |
| build-tools/packages/build-cli/src/test/library/commands/generateEntrypoints.test.ts | Adds contentHeader parameter to test cases for entrypoint generation |
| build-tools/packages/build-cli/src/library/packageExports.ts | Adds support for custom conditions and filtering of non-standard conditions for Node10 compatibility |
| build-tools/packages/build-cli/src/library/package.ts | Removes unused readTsConfig function and related imports |
| build-tools/packages/build-cli/src/library/commands/generateEntrypoints.ts | Implements command line argument formatting and passes it to generated file headers |
| build-tools/packages/build-cli/src/library/commands/base.ts | Adds commandLineArgs() helper method to format command arguments for headers |
| build-tools/packages/build-cli/src/commands/generate/typetests.ts | Updates to use string-based entrypoints, adds custom conditions support, and improves import path resolution |
| build-tools/packages/build-cli/src/commands/generate/node10Entrypoints.ts | Refactored to use shared generateNode10TypeEntrypoints function and query exports from package |
| build-tools/packages/build-cli/docs/generate.md | Updates documentation to reflect new entrypoint flag format and deprecation of level flag |
| build-tools/packages/build-cli/README.md | Updates debugging instructions to reference --entrypoint instead of --level and adds link: override documentation |
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.
Fix
generate node10Entrypointsandgenerate typeteststo support nested paths includinglegacy/alpha.Previously, an entrypoint of
"legacyPublic"or"legacyBeta"or"legacyAlpha"would not find entrypoint that was actually "legacy" or "legacy/alpha".Additionally update
generate typeteststo use entrypoint for current package instead of hard coding../../index.js. Then other type sets like an internal protocol (once exported) can be validated version to version. To support special exports the expected tsconfig for outfile is now inspected for customconditionsthat are used. The common one for FF test exports is "allow-ff-test-exports". Example change:Generated headers for entrypoints, node10Entrypoints, and typetests may now call out arguments passed in addition to the basic flub command.
AB#59480