Skip to content

fix(bundle): preserve root output path#205

Open
Lexiie wants to merge 1 commit into
TestSprite:mainfrom
Lexiie:fix/bundle-root-out-path
Open

fix(bundle): preserve root output path#205
Lexiie wants to merge 1 commit into
TestSprite:mainfrom
Lexiie:fix/bundle-root-out-path

Conversation

@Lexiie

@Lexiie Lexiie commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

resolveBundleDir('/') currently strips the trailing slash before checking whether the path is absolute. For the filesystem root path, that turns / into an empty string, so the helper resolves it against process.cwd() instead of preserving /.

This PR keeps the root path intact while preserving the existing behavior for ordinary trailing slashes like /tmp/bundle/.

Changes

  • Only strip a trailing slash when the raw path has more than one character.
  • Add regression coverage that resolveBundleDir('/') returns /.

Verification

  • npm run format:check
  • npm run typecheck
  • npx vitest run src/lib/bundle.test.ts
  • npx eslint src/lib/bundle.ts src/lib/bundle.test.ts

Summary by CodeRabbit

  • Bug Fixes

    • Preserved the filesystem root path (/) when resolving bundle directories, avoiding it being reduced to an empty path.
    • Continued trimming trailing slashes for non-root paths as expected.
  • Tests

    • Added coverage to verify root paths remain unchanged during bundle directory resolution.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8576f3b7-ee00-48b8-9558-136dece5ba33

📥 Commits

Reviewing files that changed from the base of the PR and between 3305dfa and 40cf454.

📒 Files selected for processing (2)
  • src/lib/bundle.test.ts
  • src/lib/bundle.ts

Walkthrough

This PR fixes resolveBundleDir in bundle.ts so that trailing-slash stripping only applies when the input path length exceeds 1, preserving the root path / instead of converting it to an empty string. A test case verifies this behavior.

Changes

Root Path Fix

Layer / File(s) Summary
Trailing-slash normalization fix and test
src/lib/bundle.ts, src/lib/bundle.test.ts
resolveBundleDir strips a trailing slash only when the path length is greater than 1, preserving '/'; a new test verifies resolveBundleDir('/') returns '/' unchanged.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Suggested reviewers: ruili-testsprite, zeshi-du

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main fix: preserving the filesystem root output path.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

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