Area
workspace-plugin (package)
Environment
OS: Windows 11
node v22.12.0
@fluentui/workspace-plugin (in-repo tools/workspace-plugin)
Current Behavior
tools/workspace-plugin/src/executors/generate-api/lib/utils.ts, in getExportSubpathConfigs:
const resolvedPrimaryEntry = resolve(
configDir,
primaryMainEntryTemplate.replace(/<unscopedPackageName>/g, unscopedPackageName),
);
const indexDtsSuffix = '/index.d.ts';
if (!resolvedPrimaryEntry.endsWith(indexDtsSuffix)) {
// …skip
}
path.resolve emits backslash-separated paths on Windows, so resolvedPrimaryEntry never ends
with the hard-coded posix suffix '/index.d.ts'. The guard therefore fires for every project and
every export-subpath API rollup is skipped, silently, on Windows machines. Linux CI is
unaffected, which is why the behaviour has not surfaced there.
Concretely: on a Windows checkout, generate-api for
@fluentui/react-headless-components-preview emits 0 subpath rollups where it should emit 56.
A contributor on Windows therefore cannot regenerate the etc/*.api.md files their change requires,
and — worse — a run that produces nothing looks the same as a run that had nothing to produce.
Expected Behavior
Subpath rollups are generated on every supported development platform, and a path that cannot be
matched raises rather than silently skipping.
Reproduction
On Windows, run generate-api for any package that declares export subpaths (e.g.
@fluentui/react-headless-components-preview) and compare the emitted rollups against a Linux run.
Steps to reproduce
- On a Windows checkout, run the
generate-api executor for a package with exports subpaths.
- Observe that no per-subpath
.d.ts rollup or etc/*.api.md is produced.
- Instrument
resolvedPrimaryEntry — it is backslash-separated and fails the '/index.d.ts' check.
Discovery context
Found while scaffolding a new package with a large export-subpath surface on a Windows checkout,
during work on a styling layer over @fluentui/react-headless-components-preview. The package's
API reports came back empty, and tracing that led here. Nothing about the finding is specific to
that work: any Windows contributor touching a package with subpath exports hits it.
Proposed fix
Normalize to posix separators before the suffix check:
const resolvedPrimaryEntry = resolve(
configDir,
primaryMainEntryTemplate.replace(/<unscopedPackageName>/g, unscopedPackageName),
).replace(/\\/g, '/');
One expression, with a comment recording why (so it survives a future tidy). 56 headless rollups
emit locally after the change; CI output is unchanged, since it was already correct there.
A working implementation is included in PR #[WINDMOD-PR-NUMBER] (part of commit d826380ae5);
happy to split it into a standalone PR against this issue — it is independent of everything else in
that PR.
Suggested severity
Medium - Has workaround (regenerate API reports on Linux/WSL or let CI do it).
Products/sites affected
Local development on Windows for any package with export subpaths.
Are you willing to submit a PR to fix?
yes
Area
workspace-plugin (package)
Environment
Current Behavior
tools/workspace-plugin/src/executors/generate-api/lib/utils.ts, ingetExportSubpathConfigs:path.resolveemits backslash-separated paths on Windows, soresolvedPrimaryEntrynever endswith the hard-coded posix suffix
'/index.d.ts'. The guard therefore fires for every project andevery export-subpath API rollup is skipped, silently, on Windows machines. Linux CI is
unaffected, which is why the behaviour has not surfaced there.
Concretely: on a Windows checkout,
generate-apifor@fluentui/react-headless-components-previewemits 0 subpath rollups where it should emit 56.A contributor on Windows therefore cannot regenerate the
etc/*.api.mdfiles their change requires,and — worse — a run that produces nothing looks the same as a run that had nothing to produce.
Expected Behavior
Subpath rollups are generated on every supported development platform, and a path that cannot be
matched raises rather than silently skipping.
Reproduction
On Windows, run
generate-apifor any package that declares export subpaths (e.g.@fluentui/react-headless-components-preview) and compare the emitted rollups against a Linux run.Steps to reproduce
generate-apiexecutor for a package withexportssubpaths..d.tsrollup oretc/*.api.mdis produced.resolvedPrimaryEntry— it is backslash-separated and fails the'/index.d.ts'check.Discovery context
Found while scaffolding a new package with a large export-subpath surface on a Windows checkout,
during work on a styling layer over
@fluentui/react-headless-components-preview. The package'sAPI reports came back empty, and tracing that led here. Nothing about the finding is specific to
that work: any Windows contributor touching a package with subpath exports hits it.
Proposed fix
Normalize to posix separators before the suffix check:
One expression, with a comment recording why (so it survives a future tidy). 56 headless rollups
emit locally after the change; CI output is unchanged, since it was already correct there.
A working implementation is included in PR #[WINDMOD-PR-NUMBER] (part of commit
d826380ae5);happy to split it into a standalone PR against this issue — it is independent of everything else in
that PR.
Suggested severity
Medium - Has workaround (regenerate API reports on Linux/WSL or let CI do it).
Products/sites affected
Local development on Windows for any package with export subpaths.
Are you willing to submit a PR to fix?
yes