Skip to content

Preserve declaration sources in JavaScript keyframes - #20710

Open
darrenfdes wants to merge 2 commits into
tailwindlabs:mainfrom
darrenfdes:fix/merged-keyframe-sources
Open

darrenfdes wants to merge 2 commits into
tailwindlabs:mainfrom
darrenfdes:fix/merged-keyframe-sources

Conversation

@darrenfdes

Copy link
Copy Markdown

Summary

When a JavaScript config defines keyframes, @tailwindcss/postcss emits their declarations without source locations in development. Vite then logs its missing from warning.

Preserve each property's source through config merging and CSS-in-JS conversion. If a second config extends an animation, declarations retained from the first config keep their original source file. This also preserves the directory Vite uses to resolve their relative asset URLs.

Related to #20452. Supersedes #20709.

Test plan

  • Added PostCSS regressions for separate configs and for configs in different directories extending the same animation. The latter checks retained declarations, an overridden declaration, added declarations, and fallback value arrays.
  • pnpm exec vitest run --hideSkippedTests — 5,917 passed, 1 skipped across 84 files.
  • After consolidating source recording into config resolution, pnpm exec vitest run packages/tailwindcss/src/compat packages/@tailwindcss-postcss/src --hideSkippedTests — 213 passed.
  • Verified a Vite 8.2.0 dev transform reproduces the warning before the fix. With the fix, it emits the configured keyframes without the warning and preserves /asset.svg when another config extends the animation from a nested directory.
  • Prettier checks for changed files, git diff --check, and node scripts/changelog.mjs check pass.
  • TypeScript checks report the same 22 existing diagnostics as the base, with no added diagnostics. Local validation uses the published macOS Oxide 4.3.5 binding. Rust and browser test suites were not run locally.

@darrenfdes
darrenfdes requested a review from a team as a code owner November 12, 2026 07:13
@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Reviews (7) · Last reviewed commit: "Preserve individual declaration sources ..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eb959500-ae4c-44bf-a467-51be18c8b53a
Commits

Reviewing files that changed from the base of the PR and between 6e56111 and 55af614.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Config resolution now tracks source locations for keyframe values and extensions. The compatibility hooks pass this source map into keyframe conversion. Generated AST nodes and keyframe rules receive source locations. PostCSS tests cover keyframes from JavaScript configs and merged keyframe declarations from imported CSS and config extensions.

Merge Risk: Minimal · previous review 6e561

This change preserves source locations for keyframes defined in JavaScript configs, which should remove the Vite missing from warning. No merge-blocking risk was identified in the supplied context.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: declaration source locations for JavaScript keyframes are now preserved. The raw summary confirms config resolution, keyframe merging, and CSS-in-JS conversion changes…
Description check Passed The description states the problem (missing source locations for JavaScript config keyframes causing Vite's missing 'from' warning), the fix (preserving per-property sources through config merging and…
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.
Full details: Title check

Explanation

The title names the main change: declaration source locations for JavaScript keyframes are now preserved. The raw summary confirms config resolution, keyframe merging, and CSS-in-JS conversion changes that serve this goal.

Full details: Description check

Explanation

The description states the problem (missing source locations for JavaScript config keyframes causing Vite's missing 'from' warning), the fix (preserving per-property sources through config merging and CSS-in-JS conversion), and a test plan. This matches the changeset.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 033f094d-2211-4967-a442-447ad80752ff
Commits

Reviewing files that changed from the base of the PR and between b08bf83 and 6e56111.

Files selected for processing: 6

  • .changelog/postcss-keyframe-sources.md
  • packages/@tailwindcss-postcss/src/index.test.ts
  • packages/tailwindcss/src/compat/apply-compat-hooks.ts
  • packages/tailwindcss/src/compat/apply-keyframes-to-theme.ts
  • packages/tailwindcss/src/compat/config/resolve-config.ts
  • packages/tailwindcss/src/compat/plugin-api.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@RobinMalfait
RobinMalfait self-requested a review November 16, 2026 21:27
@RobinMalfait RobinMalfait self-assigned this Nov 16, 2026
@RobinMalfait
RobinMalfait force-pushed the fix/merged-keyframe-sources branch from 6e56111 to 55af614 Compare November 16, 2026 21:29
@RobinMalfait

Copy link
Copy Markdown
Contributor

I rebased this PR on the latest main and force pushed it.

Sent by an AI assistant on behalf of @RobinMalfait.

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.

2 participants