@getcoherent/cli 0.2.3 → 0.2.4

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -9
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -6530,36 +6530,41 @@ ${fixed}`;
6530
6530
  } catch {
6531
6531
  }
6532
6532
  if (lucideExports2) {
6533
- const importedNames = new Set(
6533
+ const allImportedNames = /* @__PURE__ */ new Set();
6534
+ for (const m of fixed.matchAll(/import\s*\{([^}]+)\}\s*from/g)) {
6535
+ m[1].split(",").map((s) => s.trim()).filter(Boolean).forEach((n) => allImportedNames.add(n));
6536
+ }
6537
+ for (const m of fixed.matchAll(/import\s+([A-Z]\w+)\s+from/g)) {
6538
+ allImportedNames.add(m[1]);
6539
+ }
6540
+ const lucideImported = new Set(
6534
6541
  lucideImportMatch2[1].split(",").map((s) => s.trim()).filter(Boolean)
6535
6542
  );
6536
- const jsxIconRefs = [...fixed.matchAll(/<([A-Z][a-zA-Z]*(?:Icon)?)\s/g)].map((m) => m[1]);
6537
- const htmlElements = /* @__PURE__ */ new Set(["Link", "Fragment", "Suspense", "Image"]);
6543
+ const jsxIconRefs = [...new Set([...fixed.matchAll(/<([A-Z][a-zA-Z]*Icon)\s/g)].map((m) => m[1]))];
6538
6544
  const missing = [];
6539
6545
  for (const ref of jsxIconRefs) {
6540
- if (importedNames.has(ref) || htmlElements.has(ref)) continue;
6546
+ if (allImportedNames.has(ref)) continue;
6541
6547
  if (fixed.includes(`function ${ref}`) || fixed.includes(`const ${ref}`)) continue;
6542
- if (/^import\s.*\b${ref}\b/m.test(fixed)) continue;
6543
6548
  const baseName = ref.replace(/Icon$/, "");
6544
6549
  if (lucideExports2.has(ref)) {
6545
6550
  missing.push(ref);
6546
- importedNames.add(ref);
6551
+ lucideImported.add(ref);
6547
6552
  } else if (lucideExports2.has(baseName)) {
6548
6553
  const re = new RegExp(`\\b${ref}\\b`, "g");
6549
6554
  fixed = fixed.replace(re, baseName);
6550
6555
  missing.push(baseName);
6551
- importedNames.add(baseName);
6556
+ lucideImported.add(baseName);
6552
6557
  fixes.push(`renamed ${ref} \u2192 ${baseName} (lucide-react)`);
6553
6558
  } else {
6554
6559
  const fallback = "Circle";
6555
6560
  const re = new RegExp(`\\b${ref}\\b`, "g");
6556
6561
  fixed = fixed.replace(re, fallback);
6557
- importedNames.add(fallback);
6562
+ lucideImported.add(fallback);
6558
6563
  fixes.push(`unknown icon ${ref} \u2192 ${fallback}`);
6559
6564
  }
6560
6565
  }
6561
6566
  if (missing.length > 0) {
6562
- const allNames = [...importedNames];
6567
+ const allNames = [...lucideImported];
6563
6568
  const origLine = lucideImportMatch2[0];
6564
6569
  fixed = fixed.replace(origLine, `import { ${allNames.join(", ")} } from "lucide-react"`);
6565
6570
  fixes.push(`added missing lucide imports: ${missing.join(", ")}`);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.2.3",
6
+ "version": "0.2.4",
7
7
  "description": "CLI interface for Coherent Design Method",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "ora": "^7.0.1",
44
44
  "prompts": "^2.4.2",
45
45
  "zod": "^3.22.4",
46
- "@getcoherent/core": "0.2.3"
46
+ "@getcoherent/core": "0.2.4"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^20.11.0",