Repository navigation
fix(css): respect Lightning CSS modules options - #1103
Merged
Merged
Conversation
Merge Lightning CSS modules options only for CSS modules, preserving tsdown naming overrides and avoiding repeated scoping during minification. Closes #1083
✅ Deploy Preview for tsdown-main ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
tsdown
create-tsdown
@tsdown/css
@tsdown/exe
tsdown-migrate
commit: |
2 of 3 tasks
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused change preserves naming precedence and module boundaries, with regression coverage for the affected paths and no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes #1083 by preserving Lightning CSS module options such as animation: false in tsdown’s CSS processing, while retaining tsdown’s naming precedence.
Changes:
- Merge Lightning CSS module options into the resolved module configuration.
- Preserve existing scoping boundaries for ordinary CSS and disabled CSS Modules.
- Add eight regression cases and snapshots covering CSS, SCSS, minification, and naming precedence.
| File | Description |
|---|---|
tests/css-modules.test.ts |
Adds eight regression cases for module options and scoping. |
tests/__snapshots__/lightningcss-css-modules-options/preserves-animation-names-with-scss-and-minify-true.snap.md |
Records preserved animation names in minified SCSS output. |
tests/__snapshots__/lightningcss-css-modules-options/preserves-animation-names-with-scss-and-minify-false.snap.md |
Records preserved animation names in unminified SCSS output. |
tests/__snapshots__/lightningcss-css-modules-options/preserves-animation-names-with-css-and-minify-true.snap.md |
Records preserved animation names in minified CSS output. |
tests/__snapshots__/lightningcss-css-modules-options/preserves-animation-names-with-css-and-minify-false.snap.md |
Records preserved animation names in unminified CSS output. |
tests/__snapshots__/lightningcss-css-modules-options/prefers-tsdown-modules-options-for-fade.snap.md |
Records global naming precedence. |
tests/__snapshots__/lightningcss-css-modules-options/prefers-tsdown-modules-options-for-custom_fade.snap.md |
Records custom naming precedence. |
tests/__snapshots__/lightningcss-css-modules-options/does-not-scope-app-module-css-with-modules-false.snap.md |
Records unscoped output when modules are disabled. |
tests/__snapshots__/lightningcss-css-modules-options/does-not-scope-app-css-with-modules-undefined.snap.md |
Records unscoped ordinary CSS output. |
packages/css/src/plugin.ts |
Merges Lightning CSS options before applying tsdown naming overrides. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
css.lightningcss.cssModuleswas overwritten by the internally resolved CSS Modules configuration, so options such asanimation: falsehad no effect. Merge these options inresolveCssModulesConfig, preserving tsdown's naming overrides and applying them only to CSS modules. Ordinary CSS and final minification do not enable module scoping.Add eight regression cases covering CSS and SCSS, minification, naming precedence, ordinary CSS, and disabled CSS Modules.
Linked Issues
Closes #1083
Additional context
Validation:
pnpm lint,pnpm typecheck, and Prettier checks passed. CSS tests: 134 passed, with 3 existing expected failures.