@srcroot/ui 1.0.5 → 1.0.9
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/dist/index.js +25 -8
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -971,11 +971,9 @@ var ComponentAdder = class {
|
|
|
971
971
|
return "unknown";
|
|
972
972
|
}
|
|
973
973
|
transformForVite(name, content) {
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
content = content.replace(/import\s*\{[^}]*\}\s*from\s*["']@\/components\/ui\/slot["'];?\r?\n?/g, 'import { Slot } from "./slot"\n');
|
|
978
|
-
const allComponents = [
|
|
974
|
+
const lines = content.split("\n");
|
|
975
|
+
const result = [];
|
|
976
|
+
const componentNames = [
|
|
979
977
|
"accordion",
|
|
980
978
|
"alert-dialog",
|
|
981
979
|
"alert",
|
|
@@ -1045,10 +1043,29 @@ var ComponentAdder = class {
|
|
|
1045
1043
|
"tooltip",
|
|
1046
1044
|
"whatsapp"
|
|
1047
1045
|
];
|
|
1048
|
-
for (const
|
|
1049
|
-
|
|
1046
|
+
for (const line of lines) {
|
|
1047
|
+
if (line.includes('"use client"') || line.includes("'use client'")) continue;
|
|
1048
|
+
if (line.includes('from "next-themes"') || line.includes("from 'next-themes'")) continue;
|
|
1049
|
+
if (line.includes('from "@/lib/utils"') || line.includes("from '@/lib/utils")) {
|
|
1050
|
+
result.push(line.replace(/@\/lib\/utils/, "../../lib/utils"));
|
|
1051
|
+
continue;
|
|
1052
|
+
}
|
|
1053
|
+
if (line.includes('from "@/components/ui/slot"') || line.includes("from '@/components/ui/slot")) {
|
|
1054
|
+
result.push(line.replace(/@\/components\/ui\/slot/, "./slot"));
|
|
1055
|
+
continue;
|
|
1056
|
+
}
|
|
1057
|
+
let matched = false;
|
|
1058
|
+
for (const comp of componentNames) {
|
|
1059
|
+
if (line.includes(`@/components/ui/${comp}"`) || line.includes(`'@/components/ui/${comp}'`)) {
|
|
1060
|
+
result.push(line.replace(`@/components/ui/${comp}`, `./${comp}`));
|
|
1061
|
+
matched = true;
|
|
1062
|
+
break;
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
if (matched) continue;
|
|
1066
|
+
result.push(line);
|
|
1050
1067
|
}
|
|
1051
|
-
return
|
|
1068
|
+
return result.join("\n").trim();
|
|
1052
1069
|
}
|
|
1053
1070
|
async add(components) {
|
|
1054
1071
|
if (this.framework === "vite") {
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srcroot/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "A UI library with polymorphic, accessible React components",
|
|
5
|
+
"readme": "README.md",
|
|
5
6
|
"author": "Shifaul Islam",
|
|
6
7
|
"license": "MIT",
|
|
7
8
|
"type": "module",
|
|
8
9
|
"bin": {
|
|
9
|
-
"srcroot-ui": "
|
|
10
|
+
"srcroot-ui": "dist/index.js"
|
|
10
11
|
},
|
|
11
12
|
"scripts": {
|
|
12
13
|
"build": "tsup",
|