Skip to content

fix(build-tools): nested exports support#26440

Open
jason-ha wants to merge 2 commits intomicrosoft:mainfrom
jason-ha:tools/type-test-flexibility
Open

fix(build-tools): nested exports support#26440
jason-ha wants to merge 2 commits intomicrosoft:mainfrom
jason-ha:tools/type-test-flexibility

Conversation

@jason-ha
Copy link
Contributor

@jason-ha jason-ha commented Feb 13, 2026

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". Example change:

-import type * as old from "@fluidframework/core-interfaces-previous/internal";
+import type * as old from "@fluidframework/core-interfaces-previous/legacy";

-import type * as current from "../../index.js";
+import type * as current from "@fluidframework/core-interfaces/legacy";

Generated headers for entrypoints, node10Entrypoints, and typetests may now call out arguments passed in addition to the basic flub command.

AB#59480

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".
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ApiLevel enums
  • Modified generate typetests to 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

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.

1 participant