fix(ts-parser): normalize monorepo package paths - #203
Open
dajiaohuang wants to merge 1 commit into
Open
Conversation
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.
What type of PR is this?
fix
Check the PR title.
<type>(optional scope): <description>(Optional) Translate the PR title into Chinese.
fix(ts-parser): 统一 monorepo 包路径分隔符
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
MonorepoUtilspreviously copiedpath.relative()directly intoMonorepoPackage.path. On Windows that produces backslashes, so the existing Eden and pnpm monorepo tests receivedpackages\coreinstead of the portablepackages/corevalue used by the TypeScript UniAST mapping.This change normalizes only the relative package identity to forward slashes, matching the parser's existing path utilities.
absolutePathremains unchanged for host-native filesystem access, so filesystem behavior and public interfaces are preserved.The existing focused tests already cover the expected portable value and reproduced the defect on Windows.
Validation on Windows:
npx jest src/utils/test/monorepo.test.ts --runInBand --no-cache— 8/8 passed after the fix (2 failures before it)npm run build— passednpm run typecheck— passednpx eslint src/utils/monorepo.ts— passednpm test -- --runInBand— 9/10 suites and 174/175 tests passed; the sole remaining failure is the pre-existing integration expectation that counts two packages although merged PR fix: no record packagejson in project root path #160 intentionally added the root package, and is unrelated to path separatorsTradeoff: serialized package identities are now platform-independent while absolute paths intentionally retain native separators.
zh(optional):
将 monorepo 的相对包标识统一为正斜杠,同时保留用于文件系统访问的原生绝对路径。
(Optional) Which issue(s) this PR fixes:
Fixes #202
(optional) The PR that updates user documentation:
N/A