fix(workspace-plugin): normalize path separators for Windows in generate-api - #36657
Open
MOHAMMED WASIM KHAN (wasim-builds) wants to merge 1 commit into
Conversation
MOHAMMED WASIM KHAN (wasim-builds)
requested a review
from a team
as a code owner
August 30, 2026 11:29
Dmytro Kirpa (dmytrokirpa)
requested review from
Martin Hochel (Hotell)
and
a balanced review from Copilot
August 31, 2026 13:32
Copilot started reviewing on behalf of
Dmytro Kirpa (dmytrokirpa)
August 31, 2026 13:35
View session
Comment on lines
+358
to
+361
| const resolveSpy = jest.spyOn(path, 'resolve').mockImplementation((...args) => { | ||
| const posixPath = path.posix.resolve(...args); | ||
| return posixPath.replace(/\//g, '\\'); | ||
| }); |
| configDir, | ||
| primaryMainEntryTemplate.replace(/<unscopedPackageName>/g, unscopedPackageName), | ||
| ); | ||
| ).replace(/\\/g, '/'); |
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.
Previous Behavior
In
tools/workspace-plugin/src/executors/generate-api/lib/utils.ts,resolveDeclarationBaseresolves the primary main entry template usingpath.resolve(...). On Windows systems,path.resolvereturns backslash-separated paths (\), which causesresolvedPrimaryEntry.endsWith('/index.d.ts')to evaluate tofalse. As a result, export subpath API rollup generation is silently skipped on Windows environments.New Behavior
Normalize
resolvedPrimaryEntrywith.replace(/\\/g, '/')so that the POSIX/index.d.tssuffix check and slice work consistently across all platforms (including Windows). Added a unit test inexecutor.spec.tscovering path resolution with Windows-style backslashes.Related Issue(s)
generate-apisilently skips every export-subpath rollup on Windows #36654