fix(core): exclude dot-directories and node_modules from studio composition discovery and lint (#1385)

Projects that vendor tooling assets under dot-directories ended up with
every example/preset HTML inside them listed and preview-rendered in the
comps sidebar, and the studio Lint badge inflated with findings from
files that are not part of the video. walkDir only skipped three exact
names (.thumbnails, node_modules, .git), so any other dot-directory
(.hyperframes/, .cache/, ...) was walked.

Add an isInHiddenOrVendorDir helper that rejects paths with a
dot-directory or node_modules segment and apply it to composition
discovery and the studio lint route. The file tree is deliberately left
unfiltered - this only gates discovery.

Fixes #1384
This commit is contained in:
Leonel Rivas
2026-06-12 17:51:03 -07:00
committed by GitHub
parent aec3c3b58c
commit b952dc9ce0
5 changed files with 154 additions and 4 deletions
@@ -9,6 +9,18 @@ export function isSafePath(base: string, resolved: string): boolean {
const IGNORE_DIRS = new Set([".hyperframes", ".thumbnails", "node_modules", ".git"]);
/**
* True when any directory segment of a relative path is a dot-directory or
* node_modules. Projects that vendor tooling assets under dot-directories
* (.hyperframes/, .cache/, …) ship example/preset HTML that must not surface
* as project compositions or studio lint targets (#1384). The file tree is
* deliberately not filtered — this only gates discovery.
*/
export function isInHiddenOrVendorDir(relPath: string): boolean {
const segments = relPath.split("/");
return segments.slice(0, -1).some((seg) => seg.startsWith(".") || seg === "node_modules");
}
/** Recursively walk a directory and return relative file paths. */
export function walkDir(dir: string, prefix = ""): string[] {
const files: string[] = [];