-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Fix source map generation during when watching files on the CLI #19373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughReplaces direct casting of Pre-merge checks✅ Passed checks (4 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (3)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
CHANGELOG.md(1 hunks)integrations/cli/index.test.ts(1 hunks)packages/@tailwindcss-cli/src/commands/build/index.ts(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/@tailwindcss-cli/src/commands/build/index.ts (1)
packages/@tailwindcss-node/src/source-maps.ts (1)
toSourceMap(44-59)
🪛 GitHub Check: Linux / cli
integrations/cli/index.test.ts
[failure] 1145-1145: cli/index.test.ts > Standalone CLI > watch mode + separate source maps
AssertionError: expected { source: null, …(2) } to match object { source: null, …(2) }
- Expected
-
Received
{
- "generated": "}
- .underli...",
- "generated": "}...",
"original": "(none)",
"source": null,
}
❯ cli/index.test.ts:1145:28
❯ utils.ts:453:14
[failure] 919-919: cli/index.test.ts > Standalone CLI > watch mode + inline source maps
AssertionError: expected { source: null, …(2) } to match object { source: null, …(2) }
- Expected
-
Received
{
- "generated": "}
- .underli...",
- "generated": "}...",
"original": "(none)",
"source": null,
}
❯ cli/index.test.ts:919:28
❯ utils.ts:453:14
[failure] 919-919: cli/index.test.ts > Standalone CLI > watch mode + inline source maps
AssertionError: expected { source: null, …(2) } to match object { source: null, …(2) }
- Expected
-
Received
{
- "generated": "}
- .underli...",
- "generated": "}...",
"original": "(none)",
"source": null,
}
❯ cli/index.test.ts:919:28
❯ utils.ts:453:14
[failure] 919-919: cli/index.test.ts > Standalone CLI > watch mode + inline source maps
AssertionError: expected { source: null, …(2) } to match object { source: null, …(2) }
- Expected
-
Received
{
- "generated": "}
- .underli...",
- "generated": "}...",
"original": "(none)",
"source": null,
}
❯ cli/index.test.ts:919:28
❯ utils.ts:453:14
[failure] 1145-1145: cli/index.test.ts > CLI > watch mode + separate source maps
AssertionError: expected { source: null, …(2) } to match object { source: null, …(2) }
- Expected
-
Received
{
- "generated": "}
- .underli...",
- "generated": "}...",
"original": "(none)",
"source": null,
}
❯ cli/index.test.ts:1145:28
❯ utils.ts:453:14
[failure] 1145-1145: cli/index.test.ts > CLI > watch mode + separate source maps
AssertionError: expected { source: null, …(2) } to match object { source: null, …(2) }
- Expected
-
Received
{
- "generated": "}
- .underli...",
- "generated": "}...",
"original": "(none)",
"source": null,
}
❯ cli/index.test.ts:1145:28
❯ utils.ts:453:14
[failure] 1145-1145: cli/index.test.ts > CLI > watch mode + separate source maps
AssertionError: expected { source: null, …(2) } to match object { source: null, …(2) }
- Expected
-
Received
{
- "generated": "}
- .underli...",
- "generated": "}...",
"original": "(none)",
"source": null,
}
❯ cli/index.test.ts:1145:28
❯ utils.ts:453:14
[failure] 919-919: cli/index.test.ts > CLI > watch mode + inline source maps
AssertionError: expected { source: null, …(2) } to match object { source: null, …(2) }
- Expected
-
Received
{
- "generated": "}
- .underli...",
- "generated": "}...",
"original": "(none)",
"source": null,
}
❯ cli/index.test.ts:919:28
❯ utils.ts:453:14
[failure] 919-919: cli/index.test.ts > CLI > watch mode + inline source maps
AssertionError: expected { source: null, …(2) } to match object { source: null, …(2) }
- Expected
-
Received
{
- "generated": "}
- .underli...",
- "generated": "}...",
"original": "(none)",
"source": null,
}
❯ cli/index.test.ts:919:28
❯ utils.ts:453:14
[failure] 919-919: cli/index.test.ts > CLI > watch mode + inline source maps
AssertionError: expected { source: null, …(2) } to match object { source: null, …(2) }
- Expected
-
Received
{
- "generated": "}
- .underli...",
- "generated": "}...",
"original": "(none)",
"source": null,
}
❯ cli/index.test.ts:919:28
❯ utils.ts:453:14
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Linux / upgrade
- GitHub Check: Linux
🔇 Additional comments (2)
packages/@tailwindcss-cli/src/commands/build/index.ts (2)
324-325: UsetoSourceMapin watch rebuilds for consistent map handlingWrapping
compiler.buildSourceMap()withtoSourceMap(…)in both full and incremental watch rebuilds aligns the watch paths with the expectations ofwrite(…)(raw+inline) and with the initial-build behavior. This should prevent malformed or undefined map data from being appended inline or written to files during--watchrebuilds.Also applies to: 349-350
392-395: ConsistenttoSourceMapusage for initial build source mapsUsing
toSourceMap(compiler.buildSourceMap())insidehandleErrorfor the initial build ensures the source map always conforms to theSourceMapshape expected downstream, and keeps error handling behavior unchanged.
Fixes #19362
We were overwriting the source map with the "decoded" map returned by the compiler but didn't wrap it in the helper intended to help inline vs file maps. This resulted in two issues:
undefinedbeing appended to the CSS file when using--mapundefinedbeing passed towriteFile(…)when using--map <file>This PR fixes both.