Fix source map generation during when watching files on the CLI#19373
Fix source map generation during when watching files on the CLI#19373thecrypticace merged 5 commits intomainfrom
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.
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.
|
@thecrypticace It tried the |
|
If you run it with |
This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | [@tailwindcss/postcss](https://tailwindcss.com) ([source](https://github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/@tailwindcss-postcss)) | [`4.1.17` -> `4.1.18`](https://renovatebot.com/diffs/npm/@tailwindcss%2fpostcss/4.1.17/4.1.18) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>tailwindlabs/tailwindcss (@​tailwindcss/postcss)</summary> ### [`v4.1.18`](https://github.com/tailwindlabs/tailwindcss/blob/HEAD/CHANGELOG.md#4118---2025-12-11) [Compare Source](tailwindlabs/tailwindcss@v4.1.17...v4.1.18) ##### Fixed - Ensure validation of `source(…)` happens relative to the file it is in ([#​19274](tailwindlabs/tailwindcss#19274)) - Include filename and line numbers in CSS parse errors ([#​19282](tailwindlabs/tailwindcss#19282)) - Skip comments in Ruby files when checking for class names ([#​19243](tailwindlabs/tailwindcss#19243)) - Skip over arbitrary property utilities with a top-level `!` in the value ([#​19243](tailwindlabs/tailwindcss#19243)) - Support environment API in `@tailwindcss/vite` ([#​18970](tailwindlabs/tailwindcss#18970)) - Preserve case of theme keys from JS configs and plugins ([#​19337](tailwindlabs/tailwindcss#19337)) - Write source maps correctly on the CLI when using `--watch` ([#​19373](tailwindlabs/tailwindcss#19373)) - Handle special defaults (like `ringColor.DEFAULT`) in JS configs ([#​19348](tailwindlabs/tailwindcss#19348)) - Improve backwards compatibility for `content` theme key from JS configs ([#​19381](tailwindlabs/tailwindcss#19381)) - Upgrade: Handle `future` and `experimental` config keys ([#​19344](tailwindlabs/tailwindcss#19344)) - Try to canonicalize any arbitrary utility to a bare value ([#​19379](tailwindlabs/tailwindcss#19379)) - Validate candidates similarly to Oxide ([#​19397](tailwindlabs/tailwindcss#19397)) - Canonicalization: combine `text-*` and `leading-*` classes ([#​19396](tailwindlabs/tailwindcss#19396)) - Correctly handle duplicate CLI arguments ([#​19416](tailwindlabs/tailwindcss#19416)) - Don’t emit color-mix fallback rules inside `@keyframes` ([#​19419](tailwindlabs/tailwindcss#19419)) - CLI: Don't hang when output is `/dev/stdout` ([#​19421](tailwindlabs/tailwindcss#19421)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4xNC4yIiwidXBkYXRlZEluVmVyIjoiNDIuMTQuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Reviewed-on: https://git.csmpro.ru/csmpro/mapban/pulls/74 Co-authored-by: Renovate Bot <renovate@csmpro.ru> Co-committed-by: Renovate Bot <renovate@csmpro.ru>
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.