feat(css): extract CSS pipeline into @tsdown/css package#790
Merged
Conversation
✅ 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: |
Split the CSS pipeline into two tiers: - Main package (tsdown): basic CSS support with built-in plugin - @tsdown/css: advanced CSS features (Lightning CSS, preprocessors, syntax lowering) Key changes: - Extract shared post-processing hooks (createCssPostHooks) and pure CSS chunk handling into tsdown/css export path - Create @tsdown/css package with Lightning CSS integration, preprocessor support (Sass/Less/Stylus), and CSS syntax lowering via css.target option - Auto-detect @tsdown/css and use advanced plugin when available - Add css.minify and css.target options to CssOptions - Remove CSS source map code (aligning with Vite which doesn't support CSS source maps in build mode) - Add comprehensive CSS tests
d5cb7bd to
fc5a75a
Compare
Member
Author
tsdown CSS vs Vite Lib Mode CSS Feature Comparison(Reposting in English — please ignore the previous Chinese comment) Implemented
Missing Features
SummaryCore CSS features (extraction, splitting, minification, syntax lowering, preprocessors, @import inlining) are aligned with Vite lib mode. The main missing high-priority features are CSS Modules and PostCSS support. |
@tsdown/css package
2 tasks
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
Split the CSS pipeline into two tiers for better modularity and optional advanced features:
tsdown): Provides basic CSS support via a built-in plugin that reads CSS files and emits them as assets. Shared utilities (createCssPostHooks,removePureCssChunks) are exported fromtsdown/css.@tsdown/csspackage: Advanced CSS features including Lightning CSS integration, preprocessor support (Sass/Less/Stylus), CSS syntax lowering viacss.target, andcss.minify.Key changes:
tsdown/cssexport path@tsdown/csspackage with Lightning CSSbundleAsync/transform, preprocessor compilation, and target-based syntax lowering@tsdown/cssand use advanced plugin when installed, fall back to built-in basic plugin otherwisecss.minifyandcss.targetoptions toCssOptionsLinked Issues
relate #472
Additional context
CSS source map support was intentionally omitted — Vite does not emit CSS source maps during build (see vitejs/vite#2830), so we align with that behavior.