Skip to content

CLI: Emit comment when source maps are saved to files#19447

Merged
thecrypticace merged 7 commits intomainfrom
fix/missing-source-map-comment-for-files
Dec 18, 2025
Merged

CLI: Emit comment when source maps are saved to files#19447
thecrypticace merged 7 commits intomainfrom
fix/missing-source-map-comment-for-files

Conversation

@thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Dec 15, 2025

@thecrypticace thecrypticace marked this pull request as ready for review December 15, 2025 19:27
@thecrypticace thecrypticace requested a review from a team as a code owner December 15, 2025 19:27
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 15, 2025

Walkthrough

Added a comment(url: string): string method to the SourceMap interface and its toSourceMap implementation. The CLI build command now appends a /*# sourceMappingURL=... */ comment to generated CSS when writing a file-based source map, computing the relative path from the CSS output to the map file. Tests were updated to expect the source map output ending with this multiline comment. No other control-flow changes outside the file-map branch were introduced.

Pre-merge checks

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: emitting a comment when source maps are saved to files, which is reflected across all modified files.
Description check ✅ Passed The description provides a reference link to the GitHub issue discussion that motivated this change, relating directly to the implementation of source map comment emission.

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 075f234 and e0c81cd.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 52e91db and 1aa51d6.

📒 Files selected for processing (3)
  • integrations/cli/index.test.ts (6 hunks)
  • packages/@tailwindcss-cli/src/commands/build/index.ts (1 hunks)
  • packages/@tailwindcss-node/src/source-maps.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/@tailwindcss-node/src/source-maps.ts (1)
packages/tailwindcss/src/ast.ts (1)
  • comment (104-109)
🔇 Additional comments (3)
packages/@tailwindcss-node/src/source-maps.ts (1)

9-9: LGTM! Clean API extension.

The new comment method properly exposes the source map URL comment generation logic, and the refactoring of the inline getter to use this helper is well done.

Also applies to: 48-58

packages/@tailwindcss-cli/src/commands/build/index.ts (1)

185-195: LGTM! Correctly implements source map URL comment emission.

The logic properly computes the relative path from the CSS output location to the map file, with appropriate fallback to process.cwd() when writing to stdout. The path.relative() call handles cross-platform path concerns automatically.

integrations/cli/index.test.ts (1)

755-755: LGTM! Test expectations correctly updated.

The updated expectations properly reflect the new source map URL comment being appended to the generated CSS with the double newline prefix (}\n\n/*# sou...).

Also applies to: 821-821, 1124-1124, 1196-1196, 1296-1296

@thecrypticace thecrypticace merged commit 219e019 into main Dec 18, 2025
7 checks passed
@thecrypticace thecrypticace deleted the fix/missing-source-map-comment-for-files branch December 18, 2025 20:02
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