Skip to content

fix(ts-parser): normalize monorepo package paths - #203

Merged
angrychow merged 1 commit into
cloudwego:mainfrom
dajiaohuang:fix/typescript-monorepo-paths
Aug 31, 2026
Merged

fix(ts-parser): normalize monorepo package paths#203
angrychow merged 1 commit into
cloudwego:mainfrom
dajiaohuang:fix/typescript-monorepo-paths

Conversation

@dajiaohuang

Copy link
Copy Markdown
Contributor

What type of PR is this?

fix

Check the PR title.

  • This PR title matches the format: <type>(optional scope): <description>
  • The description is user-oriented and clear enough to understand.
  • No user-documentation update is required; this makes the implementation match the documented cross-platform path format.

(Optional) Translate the PR title into Chinese.

fix(ts-parser): 统一 monorepo 包路径分隔符

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:

MonorepoUtils previously copied path.relative() directly into MonorepoPackage.path. On Windows that produces backslashes, so the existing Eden and pnpm monorepo tests received packages\core instead of the portable packages/core value used by the TypeScript UniAST mapping.

This change normalizes only the relative package identity to forward slashes, matching the parser's existing path utilities. absolutePath remains 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 — passed
  • npm run typecheck — passed
  • npx eslint src/utils/monorepo.ts — passed
  • npm 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 separators

Tradeoff: 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

@angrychow
angrychow self-requested a review August 31, 2026 12:17

@angrychow angrychow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM.

@angrychow

Copy link
Copy Markdown
Collaborator

Thank you for your contribution!

@angrychow
angrychow merged commit 5e1ebf6 into cloudwego:main Aug 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

TypeScript monorepo package paths use backslashes on Windows

2 participants