Skip to content

core(maintenance)#1654

Merged
SutuSebastian merged 16 commits intomainfrom
core/maintenance
Feb 9, 2026
Merged

core(maintenance)#1654
SutuSebastian merged 16 commits intomainfrom
core/maintenance

Conversation

@SutuSebastian
Copy link
Collaborator

@SutuSebastian SutuSebastian commented Feb 5, 2026

General

  • bump Bun version to 1.3.8
  • upgrade apps/storybook packages
  • upgrade root packages

create-flowbite-react

Description

Change bundler

Changes

  • migrate tsup to tsdown

flowbite-react

Description

Shrink final bundle size from 42 MB to 8.38 MB

Changes

  • drop AST parsers in favor of oxc-parser
  • update packages
  • update plugin/modernjs to the new API

before

Screenshot 2026-02-05 at 12 02 11

after

Screenshot 2026-02-05 at 12 02 03

Summary by CodeRabbit

  • Chores

    • Substantially reduced bundle size (42 MB → 8.38 MB) for faster downloads and load times
    • Upgraded build tooling, developer tooling, and devDependencies for improved stability and compatibility
    • Migrated and modernized internal build/config tooling and CLI utilities for more reliable project workflows
  • Tests

    • Expanded and strengthened test coverage for CLI transformers and metadata extraction
  • Documentation

    • Updated changelog and release notes with before/after visuals and migration details

SutuSebastian and others added 8 commits February 1, 2026 14:56
* shrink bundle size:
- use `oxc-parser` for AST parsing
- remove previous AST related packages
- remove unused packages
- update some packages

* add tests for `compound-components` transformer

* use oxc-parser types

* infer types

* move `removeReactImport` to it's own file, add tests

* dedupe tests

* enhance `addToConfig` to inline/multiline detection and indentation

* infer types
@SutuSebastian SutuSebastian self-assigned this Feb 5, 2026
@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2026

🦋 Changeset detected

Latest commit: 6fd74ad

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
flowbite-react Patch
create-flowbite-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Feb 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flowbite-react Ready Ready Preview, Comment Feb 9, 2026 9:28am
flowbite-react-storybook Ready Ready Preview, Comment Feb 9, 2026 9:28am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

This PR migrates CLI and tooling AST work from recast/acorn/Bun transpilation to oxc-parser with Visitor-based traversals, replaces tsup with tsdown for the CLI build, updates multiple dependencies (Storybook, Bun, toolchain libs), refactors several CLI utilities (add-to-config, compound-components, generate-metadata, update-build-config), and adds/remove shared helpers (removeReactImport), plus many test additions and formatting tweaks across UI components.

Changes

Cohort / File(s) Summary
Changelogs
/.changeset/khaki-rooms-film.md, /.changeset/social-papayas-ring.md
Added patch release notes describing bundle-size reduction, oxc-parser migration, and tsup→tsdown migration.
CI / Root config
.github/actions/setup/action.yml, package.json
Bumped Bun version in GH Action and root packageManager; multiple root devDependency bumps (prettier, turbo, etc.).
Apps: Storybook & Web
apps/storybook/package.json, apps/web/package.json
Storybook and related devDependencies upgraded; autoprefixer/postcss/vite versions updated.
CLI build tool
packages/cli/package.json, packages/cli/tsdown.config.ts
Replaced tsup with tsdown; updated build/dev scripts and config (dts: false).
UI package deps
packages/ui/package.json
Added oxc-parser, magic-string, package-manager-detector; removed older AST libs; broad toolchain dependency bumps and tailwind-merge aliasing changes.
Rollup / rslib change
packages/ui/rollup.config.js
Switched from build() to createRslib() flow and updated bundler configuration calls.
Metadata generation
packages/ui/scripts/generate-metadata.ts, .../generate-metadata.test.ts
Replaced Bun transpile/ACORN with oxc-parser + Visitor; updated extractClassList/extractDependencyList logic and expanded TS-focused tests.
Setup/init CLI
packages/ui/src/cli/commands/setup-init.ts
Switched parser to parseSync (oxc); removed local React-import stripper in favor of shared removeReactImport.
Compound components transformer
packages/ui/src/cli/transformers/compound-components.ts, .../compound-components.test.ts
Reimplemented with oxc-parser + Visitor + MagicString; new import/specifier tracking and comprehensive tests for many mapping/edge cases.
Config utilities
packages/ui/src/cli/utils/add-to-config.ts, .../add-to-config.test.ts
Full rewrite to use oxc-parser + Visitor + MagicString; added builders export and ValueGenerator type; array-style and indentation-aware insertion; expanded tests.
React import utility
packages/ui/src/cli/utils/remove-react-import.ts, .../remove-react-import.test.ts
New exported removeReactImport(parseResult) utility and comprehensive tests covering many import shapes and TSX scenarios.
Build config updater
packages/ui/src/cli/utils/update-build-config.ts
Rewrote to use oxc-parser + Visitor; ensures plugin import/insertion into Bun.build/build calls; MagicString-based edits.
Helper updates
packages/ui/src/helpers/drag-scroll.tsx, packages/ui/src/helpers/tailwind-merge.ts, packages/ui/src/plugin/modernjs.ts
Replaced classnames→twMerge in drag-scroll; changed tailwind-merge imports to npm specifiers (note: conditional logic inversion introduced); modernjs plugin API updated to register api.onBeforeBuild/onBeforeDev.
Component formatting
packages/ui/src/components/...
Numerous whitespace/line-wrap formatting changes across many component prop/interface declarations; no semantic API changes.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as CLI command
  participant Parser as oxc-parser
  participant Visitor as AST Visitor
  participant MS as MagicString
  participant FS as File I/O

  CLI->>Parser: parseSync(fileContent)
  Parser-->>CLI: ParseResult (program, errors)
  CLI->>Visitor: visitor.visit(program)
  Visitor-->>CLI: Collected changes (imports, replacements, insertions)
  CLI->>MS: apply replacements/insertions with locations
  MS-->>FS: generate updated content
  FS-->>CLI: write file / return transformed content
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

:\rocket: enhancement

Suggested reviewers

  • rluders

"🐰 I hopped through ASTs, keen and spry,
oxC took over where old parsers lie,
MagicString stitched each gentle change,
from tsup to tsdown we bounded the range,
a small bundle leap—let carrots fly! 🥕"

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'core(maintenance)' is vague and generic, using non-descriptive terms that don't convey meaningful information about the changeset's primary objectives. Consider using a more specific title that highlights the main change, such as 'core: migrate AST parsers to oxc and reduce bundle size' or 'core: drop legacy parsers and modernize build toolchain'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch core/maintenance

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
packages/ui/src/cli/transformers/compound-components.ts (1)

222-240: Minor: parameter name s shadows the outer MagicString variable.

The arrow function parameters named s on lines 223, 224, 229, 235, 237 shadow the MagicString instance s declared on Line 215. Not a bug (arrow params have their own scope), but it could cause confusion during future edits.

♻️ Suggested rename
-      const existingSpecifierTexts = finalImportInfo.specifiers.map((s) => s.originalText);
-      const existingNames = new Set(finalImportInfo.specifiers.map((s) => s.name));
+      const existingSpecifierTexts = finalImportInfo.specifiers.map((spec) => spec.originalText);
+      const existingNames = new Set(finalImportInfo.specifiers.map((spec) => spec.name));

And similarly for the other occurrences on lines 229, 235, 237.


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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/ui/src/helpers/tailwind-merge.ts (1)

18-18: ⚠️ Potential issue | 🔴 Critical

Bug: version-to-import mapping is inverted.

When version === 3, this selects extendTailwindMerge_v2 (from tailwind-merge@2), and vice versa. This means Tailwind CSS v3 users get the v2 merge logic, and v2 users get the v3 merge logic — producing incorrect class merging behavior for all users.

🐛 Proposed fix
-  const twMergeFn = (version === 3 ? extendTailwindMerge_v2 : extendTailwindMerge_v3)({
+  const twMergeFn = (version === 3 ? extendTailwindMerge_v3 : extendTailwindMerge_v2)({
🤖 Fix all issues with AI agents
In `@packages/ui/src/cli/transformers/compound-components.ts`:
- Around line 209-221: The rewrite of import specifiers currently discards
aliases by rebuilding the specifier list from names; update the logic around
newImportsToAdd/finalImportInfo so existing specifiers use their original source
text (use content.slice(specifier.start, specifier.end) from the stored
finalImportInfo.specifiers) while only appending newly added identifiers by
name; then build allSpecifiers from the preserved original specifier texts plus
the new import names before joining and calling
s.overwrite(finalImportInfo.specifiersStart, finalImportInfo.specifiersEnd,
newSpecifiersText), preserving multiline formatting logic as-is.
- Around line 136-166: The code overwrites flowbiteImportInfo for each matching
ImportDeclaration so only the last import receives new specifiers; update the
logic in importVisitor.ImportDeclaration to collect multiple import metadata
(e.g., change flowbiteImportInfo to an array like flowbiteImportInfos) or pick a
deterministic target import (prefer the base "flowbite-react" import over
"flowbite-react/components/...") when multiple matches exist, push each
specifier into flowbiteImportSpecifiers and also record/specify which
flowbiteImportInfo should receive new specifiers (or merge specifiers into the
preferred import entry); adjust later code that writes the rewritten import to
use the chosen flowbiteImportInfo entry (or consolidated entry) so all added
specifiers are inserted into the correct ImportDeclaration.
🧹 Nitpick comments (7)
packages/ui/src/cli/utils/remove-react-import.ts (1)

6-25: specifiers[0] check only matches default-import-only statements.

The filter checks only specifiers[0]?.local?.name === "React", so a combined import like import React, { useState } from "react" would have the entire declaration removed (losing named imports). This is fine for the current usage in setup-init.ts where the generated content is controlled, but worth noting if this utility is intended to be general-purpose.

packages/ui/src/cli/utils/add-plugin.test.ts (1)

197-203: Consider verifying plugin insertion order in the multi-plugin test.

Other tests (lines 92, 111, 130, 152) use regex to verify that flowbiteReact() is appended after existing plugins. This test only checks presence via [\s\S]*flowbiteReact\(\)[\s\S]*, not ordering relative to tsConfigPaths, vitePluginRequire, or vuePlugin.

packages/ui/scripts/generate-metadata.ts (1)

90-92: Consider logging parse errors instead of silently returning empty.

Both extractClassList and extractDependencyList return [] on parse errors with no diagnostic output. If a theme or component file has a syntax error, this silently produces incomplete metadata. A console.warn with the file context would help debugging build issues.

💡 Proposed diagnostic logging
  if (result.errors.length > 0) {
+   console.warn(`Failed to parse content, skipping. Errors: ${result.errors.map(e => e.message).join(", ")}`);
    return [];
  }
packages/ui/src/cli/transformers/compound-components.test.ts (1)

904-1076: Consider adding a test for multiple flowbite-react import declarations.

The edge cases section is solid, but there's no test for a file that has both import { Accordion } from "flowbite-react" and import { Modal } from "flowbite-react/components/Modal" simultaneously. This would exercise the "last import wins" behavior flagged in the transformer review.

packages/ui/src/cli/utils/update-build-config.ts (2)

162-167: Hardcoded 8-space indentation when inserting plugins property.

Line 164 uses ",\n plugins: [${pluginName}]" (8 spaces), which won't match files using 2-space, 4-space, or tab indentation. Compare with add-to-config.ts which has detectIndentUnit for this purpose.

💡 Suggestion: reuse indent detection
+  const indent = detectIndentUnit(content);
   if (finalBuildOptions.hasProperties && finalBuildOptions.lastPropertyEnd) {
-      s.appendLeft(finalBuildOptions.lastPropertyEnd, `,\n        plugins: [${pluginName}]`);
+      // Detect indentation from existing properties
+      const beforeObj = content.slice(Math.max(0, finalBuildOptions.objectStart), finalBuildOptions.lastPropertyEnd);
+      const indentMatch = beforeObj.match(/\n([ \t]+)[^\n]*$/);
+      const propIndent = indentMatch ? indentMatch[1] : '        ';
+      s.appendLeft(finalBuildOptions.lastPropertyEnd, `,\n${propIndent}plugins: [${pluginName}]`);
   } else {
       s.appendLeft(finalBuildOptions.objectStart + 1, ` plugins: [${pluginName}] `);
   }

57-61: Silent error handling differs from compound-components.ts.

compound-components.ts logs console.warn(...) on parse errors, but this function silently returns the original content. Minor inconsistency — consider adding a console.warn for debuggability.

packages/ui/src/cli/utils/add-to-config.ts (1)

449-508: Indent detection heuristic filters out indentation > 4 characters.

Line 464 discards indentation strings longer than 4 characters. In files that are heavily nested (e.g., most lines at 6+ spaces), the 2-space base indent may appear infrequently and the heuristic could fall back to a wrong unit. This is unlikely for typical config files, but worth keeping in mind.

…rvation and improved import handling

- add tests for new functionality including import sorting and alias retention
@SutuSebastian SutuSebastian merged commit 98852dc into main Feb 9, 2026
8 checks passed
@SutuSebastian SutuSebastian deleted the core/maintenance branch February 9, 2026 10:30
@github-actions github-actions bot mentioned this pull request Feb 9, 2026
4 tasks
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