Conversation
akzhy
commented
Feb 16, 2026
Owner
- Add sourcemap support
- Show better CSS error and warning
- Bug fixes
…for getting unused_classnames with exact line and column numbers using rope
…, add UnusedCss struct
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ttern Co-authored-by: akzhy <20243910+akzhy@users.noreply.github.com>
Fix error handling to use captured error value instead of consuming Result twice
Improve dx
… and update class name processing
- Use classname matcher for finding classnaes - Fix Style tag and other CSS issues
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces beta release changes for FlairJS, adding sourcemap support for CSS, improved error/warning messages, and several bug fixes. The changes include two breaking API modifications that are well-documented in the changelogs.
Changes:
- Added CSS sourcemap generation with proper file location reporting for errors and unused classnames
- Improved CSS error messages with detailed file locations and human-readable descriptions
- Enhanced unused classname detection with accurate line/column reporting via sourcemaps
- Breaking change:
TransformOutputnow always returns a value with asuccessproperty instead of returningnull - Breaking change:
cssPreprocessorfunction signature changed to acceptCssDataobject instead of plain string - Updated dependencies: rolldown 1.0.0-beta.37 → 1.0.0-rc.4, @changesets/cli ^2.29.7 → ^2.29.8
- Removed Rolldown-based build configuration in favor of direct NAPI bindings
- Performance improvements through pre-compiled regex matchers for classname detection
Reviewed changes
Copilot reviewed 46 out of 48 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Updated rolldown version to 1.0.0-rc.4 |
| pnpm-lock.yaml | Updated lock file with new dependencies including sourcemap libraries |
| packages/core/src/utils.rs | New utility module with CSS error mapping and line/column tracking |
| packages/core/src/transform.rs | Updated transform logic with sourcemap support and unused classname detection |
| packages/core/src/parse_css.rs | Added sourcemap generation during CSS parsing with proper offset tracking |
| packages/core/src/update_attribute.rs | Added consumed classnames tracking and pre-compiled regex matchers |
| packages/core/src/style_tag.rs | Enhanced to track CSS source locations for better error reporting |
| packages/core/src/flair_property.rs | Added line/column tracking for flair property CSS |
| packages/core/Cargo.toml | Added new dependencies: data-encoding, lazy_static, parcel_sourcemap, sourcemap, smallvec |
| packages/shared/src/transform.ts | Updated to handle new CssData type and log unused classnames |
| packages/shared/src/plugin-core.ts | Updated cssPreprocessor signature |
| packages/vite-plugin/src/index.ts | Updated to use result.success check and CssData type |
| packages/rollup-plugin/src/index.ts | Updated to use result.success check and CssData type |
| packages/webpack-loader/src/index.ts | Updated to use result.success check and CssData type |
| packages/parcel-transformer/src/index.ts | Updated to use result.success check and CssData type |
| packages/core/index.d.ts | Added CssData and UnusedCss interfaces, updated TransformOutput |
| packages/core/package.json | Updated main/types to point to index.js/d.ts, removed Rolldown build scripts |
| packages/core/test/index.spec.ts | Added test for unused classname detection |
| .github/workflows/*.yml | Removed build:core-js step from CI workflows |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
packages/core/test/index.spec.ts:45
- Inconsistent null check handling. Line 43-45 checks
if (!result)and throws an error, but line 30 in the previous test directly usesresult.codewithout this check. SinceTransformOutputnow always returns a value (as indicated by the breaking change), these null checks are unnecessary and should be removed for consistency across all tests.
if (!result) {
throw new Error('transformCode returned null or undefined')
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.