vibe-design-system 2.8.38 → 2.8.39
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
|
@@ -14,9 +14,18 @@ import { fileURLToPath } from "url";
|
|
|
14
14
|
|
|
15
15
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
16
16
|
const PROJECT_ROOT = path.join(__dirname, "..");
|
|
17
|
-
const SRC_DIR = path.join(PROJECT_ROOT, "src");
|
|
18
17
|
const STORYBOOK_DIR = path.join(PROJECT_ROOT, ".storybook");
|
|
19
18
|
|
|
19
|
+
/** Projenin gerçek frontend src dizinini tespit eder (fullstack/monorepo desteği). */
|
|
20
|
+
function detectSrcDir(root) {
|
|
21
|
+
for (const candidate of ["client/src", "frontend/src", "web/src"]) {
|
|
22
|
+
if (fs.existsSync(path.join(root, candidate))) return path.join(root, candidate);
|
|
23
|
+
}
|
|
24
|
+
return path.join(root, "src");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const SRC_DIR = detectSrcDir(PROJECT_ROOT);
|
|
28
|
+
|
|
20
29
|
// ── vds.config.js loader ──────────────────────────────────────────────────────
|
|
21
30
|
function loadVdsConfig() {
|
|
22
31
|
const configPath = path.join(PROJECT_ROOT, "vds.config.js");
|
|
@@ -119,8 +128,9 @@ function detectHooksInFile(content) {
|
|
|
119
128
|
|
|
120
129
|
/** Map: relative path (src/...) -> Set of hook names */
|
|
121
130
|
function detectHooksUsedInProject(projectRoot) {
|
|
122
|
-
const srcDir =
|
|
123
|
-
const
|
|
131
|
+
const srcDir = detectSrcDir(projectRoot);
|
|
132
|
+
const srcRel = path.relative(projectRoot, srcDir).replace(/\\/g, "/");
|
|
133
|
+
const files = getAllSourceFiles(srcDir, srcDir).map((r) => path.join(srcRel, r));
|
|
124
134
|
const byFile = new Map();
|
|
125
135
|
for (const rel of files) {
|
|
126
136
|
const full = path.join(projectRoot, rel);
|
|
@@ -135,8 +145,9 @@ function detectHooksUsedInProject(projectRoot) {
|
|
|
135
145
|
|
|
136
146
|
/** Find file that exports providerName (e.g. TimerProvider). If hookName is given, prefer a file that also contains that hook (e.g. context/SidebarContext.tsx for useSidebar over ui/sidebar). */
|
|
137
147
|
function findProviderExportPath(projectRoot, providerName, hookName) {
|
|
138
|
-
const srcDir =
|
|
139
|
-
const
|
|
148
|
+
const srcDir = detectSrcDir(projectRoot);
|
|
149
|
+
const srcRel = path.relative(projectRoot, srcDir).replace(/\\/g, "/");
|
|
150
|
+
const files = getAllSourceFiles(srcDir, srcDir).map((r) => path.join(srcRel, r));
|
|
140
151
|
const exportRe = new RegExp(
|
|
141
152
|
"export\\s+(?:default\\s+)?(?:const|function|class)\\s+" + providerName + "\\b|export\\s*\\{[^}]*\\b" + providerName + "\\b[^}]*\\}"
|
|
142
153
|
);
|
|
@@ -146,7 +157,8 @@ function findProviderExportPath(projectRoot, providerName, hookName) {
|
|
|
146
157
|
try {
|
|
147
158
|
const content = fs.readFileSync(full, "utf-8");
|
|
148
159
|
if (exportRe.test(content)) {
|
|
149
|
-
|
|
160
|
+
// Strip the src prefix (could be "src", "client/src", "frontend/src", etc.)
|
|
161
|
+
const withoutExt = rel.replace(/\.(tsx?|jsx?)$/i, "").replace(new RegExp("^" + srcRel.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "\\/?"), "");
|
|
150
162
|
const pathForImport = "@/" + withoutExt;
|
|
151
163
|
const hasHook = hookName && new RegExp("\\b" + hookName + "\\b").test(content);
|
|
152
164
|
candidates.push({ pathForImport, hasHook });
|
|
@@ -190,9 +202,9 @@ function detectRouterPackage(projectRoot) {
|
|
|
190
202
|
}
|
|
191
203
|
|
|
192
204
|
function projectUsesRouterHooks(projectRoot) {
|
|
193
|
-
const srcDir =
|
|
205
|
+
const srcDir = detectSrcDir(projectRoot);
|
|
194
206
|
if (!fs.existsSync(srcDir)) return false;
|
|
195
|
-
const files = getAllSourceFiles(srcDir, srcDir).map((r) => path.join(
|
|
207
|
+
const files = getAllSourceFiles(srcDir, srcDir).map((r) => path.join(srcDir, r));
|
|
196
208
|
for (const file of files) {
|
|
197
209
|
try {
|
|
198
210
|
const content = fs.readFileSync(file, "utf-8");
|
|
@@ -206,8 +218,8 @@ function projectUsesRouterHooks(projectRoot) {
|
|
|
206
218
|
|
|
207
219
|
/** Detect if project uses react-dnd (useDrag, useDrop, or import from react-dnd). */
|
|
208
220
|
function detectReactDnd(projectRoot) {
|
|
209
|
-
const srcDir =
|
|
210
|
-
const files = getAllSourceFiles(srcDir, srcDir).map((r) => path.join(
|
|
221
|
+
const srcDir = detectSrcDir(projectRoot);
|
|
222
|
+
const files = getAllSourceFiles(srcDir, srcDir).map((r) => path.join(srcDir, r));
|
|
211
223
|
for (const full of files) {
|
|
212
224
|
try {
|
|
213
225
|
const content = fs.readFileSync(full, "utf-8");
|