vibe-design-system 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-design-system",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Auto-generate design systems for vibe coding projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -750,8 +750,6 @@ function extractFoundations() {
750
750
  const radius = {};
751
751
  if (cssRadiusVars.radius) radius.base = cssRadiusVars.radius;
752
752
  if (Object.keys(borderRadiusScale).length > 0) radius.borderRadius = borderRadiusScale;
753
- const foundationsColors = { ...colors };
754
- if (Object.keys(colorsDark).length > 0) foundationsColors._dark = colorsDark;
755
753
 
756
754
  // Fallback: if no typography tokens from config, extract from Google Fonts @import
757
755
  if (Object.keys(typography).length === 0 || (!typography.body && !typography.bodyFontFamily)) {
@@ -777,19 +775,33 @@ function extractFoundations() {
777
775
  }
778
776
 
779
777
  // ── FALLBACK 1: Arbitrary Tailwind values ──────────────────
780
- const srcRelFiles = getAllTsxJsxInDir(SRC_DIR);
781
- const allSourceFiles = [
782
- ...srcRelFiles.map((f) => path.join(SRC_DIR, f)),
783
- path.join(PROJECT_ROOT, "index.html"),
784
- path.join(PROJECT_ROOT, "src", "index.css"),
785
- path.join(PROJECT_ROOT, "src", "globals.css"),
786
- path.join(PROJECT_ROOT, "src", "App.css"),
787
- path.join(PROJECT_ROOT, "app", "globals.css"),
788
- ].filter((p) => fs.existsSync(p));
778
+ let allTsxFiles = [];
779
+ try {
780
+ const { globSync } = projectRequire("glob");
781
+ allTsxFiles = globSync("src/**/*.{tsx,jsx,ts,js}", {
782
+ cwd: PROJECT_ROOT,
783
+ absolute: true,
784
+ ignore: ["**/node_modules/**", "**/*.stories.*", "**/dist/**", "**/vds-output*"],
785
+ });
786
+ } catch (_) {
787
+ function walkDir(dir, list) {
788
+ if (!fs.existsSync(dir)) return;
789
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
790
+ for (const e of entries) {
791
+ const full = path.join(dir, e.name);
792
+ if (e.isDirectory()) {
793
+ if (e.name !== "node_modules" && e.name !== "dist") walkDir(full, list);
794
+ } else if (/\.(tsx|jsx|ts|js)$/i.test(e.name) && !e.name.includes(".stories.")) {
795
+ list.push(full);
796
+ }
797
+ }
798
+ }
799
+ walkDir(SRC_DIR, allTsxFiles);
800
+ }
789
801
 
790
802
  const ARBITRARY_HEX = /(?:bg|text|border|ring|fill|stroke|from|to|via)-\[#([0-9a-fA-F]{3,8})\]/g;
791
803
  const arbitraryColors = new Map();
792
- for (const file of allSourceFiles) {
804
+ for (const file of allTsxFiles) {
793
805
  try {
794
806
  const content = fs.readFileSync(file, "utf-8");
795
807
  for (const match of content.matchAll(ARBITRARY_HEX)) {
@@ -813,18 +825,23 @@ function extractFoundations() {
813
825
  const name = "arbitrary-" + hex.slice(1).toLowerCase();
814
826
  colors[name] = { value: hex, source: "arbitrary-tailwind", frequency: count };
815
827
  }
816
-
817
828
  // ── FALLBACK 2: Google Fonts URL ──────────────────────────
818
829
  const GFONTS_PATTERN = /family=([A-Za-z+]+)(?::.*?)?(?:&|$)/g;
819
- const fontFiles = allSourceFiles.filter(
820
- (f) =>
821
- f.endsWith("index.html") ||
822
- f.includes("layout.") ||
823
- f.includes("_document.") ||
824
- f.endsWith("index.css") ||
825
- f.includes("globals.css")
826
- );
827
- for (const file of fontFiles) {
830
+ const fontFileCandidates = [
831
+ ...allTsxFiles.filter(
832
+ (f) =>
833
+ f.includes("layout.") ||
834
+ f.includes("_document.") ||
835
+ f.endsWith("index.css") ||
836
+ f.includes("globals.css")
837
+ ),
838
+ path.join(PROJECT_ROOT, "index.html"),
839
+ path.join(PROJECT_ROOT, "src", "index.css"),
840
+ path.join(PROJECT_ROOT, "src", "globals.css"),
841
+ path.join(PROJECT_ROOT, "src", "App.css"),
842
+ path.join(PROJECT_ROOT, "app", "globals.css"),
843
+ ].filter((p) => fs.existsSync(p));
844
+ for (const file of fontFileCandidates) {
828
845
  try {
829
846
  const content = fs.readFileSync(file, "utf-8");
830
847
  if (!content.includes("fonts.googleapis.com")) continue;
@@ -839,6 +856,9 @@ function extractFoundations() {
839
856
  } catch (_) {}
840
857
  }
841
858
 
859
+ const foundationsColors = { ...colors };
860
+ if (Object.keys(colorsDark).length > 0) foundationsColors._dark = colorsDark;
861
+
842
862
  const twTheme = getTailwindTheme();
843
863
  const normalizeThemeObj = (obj) => {
844
864
  if (!obj || typeof obj !== "object") return {};