storybook-addon-sdc 0.15.1 → 0.15.2
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/preset.js +32 -6
- package/package.json +1 -1
package/dist/preset.js
CHANGED
|
@@ -254,7 +254,6 @@ import { readdirSync, existsSync } from "fs";
|
|
|
254
254
|
import { basename, join, resolve, sep as sep2, relative as relative2 } from "path";
|
|
255
255
|
import { cwd as cwd2 } from "process";
|
|
256
256
|
import { normalizePath } from "vite";
|
|
257
|
-
var getSubdirectories = (baseDir) => readdirSync(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join(baseDir, entry.name));
|
|
258
257
|
var getProjectName = (p) => {
|
|
259
258
|
const fullPath = resolve(p);
|
|
260
259
|
const parts = fullPath.split(sep2);
|
|
@@ -264,13 +263,40 @@ var getProjectName = (p) => {
|
|
|
264
263
|
}
|
|
265
264
|
return parts[i - 1];
|
|
266
265
|
};
|
|
266
|
+
var getAllSubdirectoriesRecursive = (baseDir) => {
|
|
267
|
+
const result = [];
|
|
268
|
+
const scan = (dir) => {
|
|
269
|
+
try {
|
|
270
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
271
|
+
for (const entry of entries) {
|
|
272
|
+
if (entry.isDirectory()) {
|
|
273
|
+
const fullPath = join(dir, entry.name);
|
|
274
|
+
result.push(fullPath);
|
|
275
|
+
scan(fullPath);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
} catch (error) {
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
scan(baseDir);
|
|
282
|
+
return result;
|
|
283
|
+
};
|
|
267
284
|
var resolveComponentPath = (namespace, component, namespaces) => {
|
|
268
285
|
const baseDir = namespaces.findPath(namespace);
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
);
|
|
273
|
-
|
|
286
|
+
if (!baseDir) return void 0;
|
|
287
|
+
const componentFileName = `${component}.component.yml`;
|
|
288
|
+
const directPath = join(baseDir, "components", component, componentFileName);
|
|
289
|
+
if (existsSync(directPath)) return directPath;
|
|
290
|
+
const componentsDir = join(baseDir, "components");
|
|
291
|
+
const directories = [
|
|
292
|
+
componentsDir,
|
|
293
|
+
...getAllSubdirectoriesRecursive(componentsDir)
|
|
294
|
+
];
|
|
295
|
+
for (const dir of directories) {
|
|
296
|
+
const possiblePath = join(dir, component, componentFileName);
|
|
297
|
+
if (existsSync(possiblePath)) return possiblePath;
|
|
298
|
+
}
|
|
299
|
+
return void 0;
|
|
274
300
|
};
|
|
275
301
|
var Namespaces = class {
|
|
276
302
|
namespaces;
|