vibe-design-system 2.8.32 → 2.8.33

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.8.32",
3
+ "version": "2.8.33",
4
4
  "description": "Auto-generate design systems for vibe coding projects",
5
5
  "homepage": "https://vibedesign.tech",
6
6
  "repository": {
@@ -1400,7 +1400,8 @@ function buildStoryFileContent(comp) {
1400
1400
  lines.push(`const meta = {`);
1401
1401
  lines.push(` title: ${JSON.stringify(title)},`);
1402
1402
  lines.push(` component: ComponentRef,`);
1403
- lines.push(` tags: ["autodocs"],`);
1403
+ // SECTION: no props/args → autodocs tries to render React.lazy without Suspense → useRef crash
1404
+ if (profile !== "SECTION") lines.push(` tags: ["autodocs"],`);
1404
1405
 
1405
1406
  // Build argTypes from extracted TypeScript props + icon-specific overrides
1406
1407
  const argTypeEntries = [];
@@ -204,12 +204,32 @@ function injectAliases(projectRoot, specifiers) {
204
204
  }
205
205
  }
206
206
 
207
+ /** Inject resolve.dedupe into .storybook/main.* viteFinal to prevent multiple React instances.
208
+ * Multiple React instances cause "Cannot read properties of null (reading 'useRef')" at MemoryRouter. */
209
+ function injectDedupe(projectRoot) {
210
+ const mainPath = getMainPath(projectRoot);
211
+ if (!mainPath) return;
212
+ let content = fs.readFileSync(mainPath, "utf-8");
213
+ if (content.includes("dedupe")) return; // idempotent
214
+ // Match: alias block + its trailing comma + whitespace/newline + resolve closing }
215
+ // e.g. alias: { "@": path.resolve(...) },\n },
216
+ const pattern = /(\balias\s*:\s*\{[^}]*\}),(\s*\})/;
217
+ if (!pattern.test(content)) return;
218
+ content = content.replace(pattern, (_, aliasBlock, resolveClose) =>
219
+ `${aliasBlock},\n dedupe: ["react", "react-dom", "react-router-dom"],${resolveClose}`
220
+ );
221
+ fs.writeFileSync(mainPath, content, "utf-8");
222
+ console.log("[VDS] Storybook adapt: injected React dedupe into viteFinal");
223
+ }
224
+
207
225
  function main() {
208
226
  const projectRoot = PROJECT_ROOT;
209
227
  if (!fs.existsSync(path.join(projectRoot, ".storybook"))) {
210
228
  console.log("[VDS] .storybook not found; skip storybook-adapt.");
211
229
  return;
212
230
  }
231
+ // Always inject dedupe — prevents "useRef null" crashes from multiple React instances
232
+ injectDedupe(projectRoot);
213
233
  reportUnresolvedImports(projectRoot);
214
234
  const problematic = collectProblematicImports(projectRoot);
215
235
  if (problematic.size === 0) return;