Skip to content

Fix LightningCSS.bundle to report its exports and warnings - #4

Merged
marcoroth merged 1 commit into
mainfrom
bundle-exports-and-warnings
Aug 24, 2026
Merged

Fix LightningCSS.bundle to report its exports and warnings#4
marcoroth merged 1 commit into
mainfrom
bundle-exports-and-warnings

Conversation

@marcoroth

@marcoroth marcoroth commented Aug 24, 2026

Copy link
Copy Markdown
Owner

This pull request makes bundle answer the same complete result transform does. It was hardcoding exports: None and warnings: Vec::new(), so both came back empty however the bundle was compiled.

Compiling a bundle as a CSS module renamed every name it read and then reported none of them, which left the caller holding hashed class names and no way to map them back. exports was nil for a bundle where a transform of the same stylesheet answered a map.

result = LightningCSS.bundle("app/assets/stylesheets/application.css", css_modules: true)

result.exports
#=> {"application" => "_8Z4fiW_application"}

Warnings had the same shape of problem. The parser's warnings sink was never installed for a bundle, so a rule Lightning CSS kept but could not act on went unreported, and warnings? answered false for a stylesheet that had something to say. The sink is shared across every file the bundler reads, so a warning coming out of an imported file now surfaces and names the file it came from.

LightningCSS.bundle("app/assets/stylesheets/application.css").warnings.first
#=> "'deep' is not recognized as a valid pseudo-class. Did you mean '::deep' (pseudo-element) or is this a typo? at app/assets/stylesheets/layout.css:0:9"

@marcoroth
marcoroth enabled auto-merge (squash) August 24, 2026 19:27
@marcoroth
marcoroth merged commit 111e7b9 into main Aug 24, 2026
11 checks passed
@marcoroth
marcoroth deleted the bundle-exports-and-warnings branch August 24, 2026 19:30
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