Skip to content

refactor: separate style metadata from declarations - #723

Merged
Brentlok merged 1 commit into
mainfrom
refactor/styles-metadata
Oct 13, 2026
Merged

Brentlok merged 1 commit into
mainfrom
refactor/styles-metadata

Conversation

@Brentlok

@Brentlok Brentlok commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Store CSS declarations and style metadata separately in stylesheet templates.
  • Keep emitted native style records unchanged while removing the redundant native flag.

Summary by CodeRabbit

  • Documentation
    • Clarified how stylesheet templates separate CSS declarations from conditions and cascade metadata, and how native styles are represented at runtime.
  • Refactor
    • Separated style declarations from metadata during stylesheet processing. Platform conditions are handled at build time, and native style records no longer include a runtime flag.
  • Tests
    • Updated style parsing checks for the separated declarations and metadata, including selector variants and root styles.

- Store stylesheet template metadata separately from CSS declarations
- Remove the runtime native flag after build-time platform filtering
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1e1790c8-3c76-4df5-ab81-775f5770640a
📥 Commits

Reviewing files that changed from the base of the PR and between c8c14a6 and da20268.

📒 Files selected for processing (8)
  • CONTEXT.md
  • packages/uniwind/src/bundler/css-processor/addMetaToStylesTemplate.ts
  • packages/uniwind/src/bundler/css-processor/cascade.ts
  • packages/uniwind/src/bundler/css-processor/processor.ts
  • packages/uniwind/src/bundler/css-processor/types.ts
  • packages/uniwind/src/core/types.ts
  • packages/uniwind/tests/native/styles-parsing/root-state.test.ts
  • packages/uniwind/tests/native/styles-parsing/selector-variants.test.ts
💤 Files with no reviewable changes (1)
  • packages/uniwind/src/core/types.ts

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

📝 Walkthrough

Stylesheet templates now separate declarations from metadata. Native conversion reads declarations from style and metadata from meta. The runtime Style type no longer includes a native field.

Changes: Stylesheet template separation

Layer / File(s) Summary
Define and build separated templates
packages/uniwind/src/bundler/css-processor/types.ts, packages/uniwind/src/bundler/css-processor/processor.ts, packages/uniwind/src/bundler/css-processor/cascade.ts
StyleTemplate separates declarations and metadata. The processor initializes and populates both objects, while cascade ranks are stored in metadata.
Convert templates to runtime styles
packages/uniwind/src/bundler/css-processor/addMetaToStylesTemplate.ts, packages/uniwind/src/core/types.ts, packages/uniwind/tests/native/styles-parsing/*, CONTEXT.md
Native conversion reads declarations from style and metadata from meta. The runtime Style type and documentation omit the native field. Parsing tests check the separated fields.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to da202

This refactor separates style declarations from metadata while keeping emitted native style records the same, apart from removing the redundant native flag. No concrete merge-blocking risk was identified.

Pre-merge checks · Passed 5
Passed 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 and concisely describes the main change: separating style metadata from CSS declarations in stylesheet templates.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 6…
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 docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • 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

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

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

This PR separates CSS declarations from metadata in build-time templates.

  • Build-time style templates keep declarations separate from rule metadata.

No actionable issues found. Tests and type checks were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CSS[CSS rules] --> Processor[ProcessorBuilder]
  Processor --> Declarations[style: declarations]
  Processor --> Metadata[meta: conditions and importance]
  Metadata --> Cascade[Cascade assigns ranks]
  Declarations --> Convert[Native conversion]
  Cascade --> Convert
  Convert --> Filter[Filter platforms and empty styles]
  Filter --> Runtime[Runtime Style records]
Loading

Reviews (1) · Last reviewed commit: "refactor: separate style metadata from d..." · Reviewed by Greptile

@Brentlok
Brentlok merged commit 984a3a7 into main Oct 13, 2026
3 checks passed
@Brentlok
Brentlok deleted the refactor/styles-metadata branch October 13, 2026 09:15
@github-actions

Copy link
Copy Markdown
Contributor

🚀 This pull request is included in v1.13.0. See Release v1.13.0 for release notes.

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