/** * Path and glob pattern utilities for file discovery */ /** * Extracts the component name from a file path. * Used for naming compiled output files from TypeScript sources. * * @param filePath - Full path to the component file (always uses Unix-style separators from glob) * @returns Component name without the .ts extension * * @example * _extractComponentName("/Users/project/src/hero.sb.ts") // => "hero.sb" * _extractComponentName("C:/Users/project/src/card.sb.ts") // => "card.sb" */ export declare const extractComponentName: (filePath: string) => string; /** * Represents a file element with its name and path */ export interface OneFileElement { name: string; p: string; } /** * Result of comparing local and external file arrays */ export interface CompareResult { local: OneFileElement[]; external: OneFileElement[]; } /** * Request for comparing local and external file paths */ interface CompareRequest { local: string[]; external: string[]; } /** * Normalizes an array of directory segments for glob pattern usage. * Handles the glob.sync quirk where single segments don't need braces, * but multiple segments need {segment1,segment2} format. * * @param segments - Array of directory path segments * @returns Normalized string for glob pattern * * @example * normalizeDiscover({ segments: [] }) // => "" * normalizeDiscover({ segments: ["src"] }) // => "src" * normalizeDiscover({ segments: ["src", "lib"] }) // => "{src,lib}" */ export declare const normalizeDiscover: ({ segments, }: { segments: string[]; }) => string; /** * Builds a glob file pattern for discovering files with a specific extension. * Automatically handles single vs multiple directory paths. * * @param mainDirectory - The root directory to search from * @param componentDirectories - Array of subdirectories to search in * @param ext - File extension to match (without leading dot) * @returns A glob pattern string * * @example * filesPattern({ * mainDirectory: "/project", * componentDirectories: ["src"], * ext: "sb.js" * }) * // => "/project/src/**\/[^_]*.sb.js" * * filesPattern({ * mainDirectory: "/project", * componentDirectories: ["src", "lib"], * ext: "sb.js" * }) * // => "/project/{src,lib}/**\/[^_]*.sb.js" */ export declare const filesPattern: ({ mainDirectory, componentDirectories, ext, }: { mainDirectory: string; componentDirectories: string[]; ext: string; }) => string; /** * Compares local and external file path arrays. * Splits paths to extract file names, filters out duplicates from external * (preferring local files), and filters out nested node_modules. * * @param request - Object containing local and external path arrays * @returns CompareResult with processed local and external file elements * * @example * compare({ * local: ["/project/src/hero.sb.js"], * external: ["/project/node_modules/pkg/hero.sb.js", "/project/node_modules/pkg/card.sb.js"] * }) * // => { * // local: [{ name: "hero.sb.js", p: "/project/src/hero.sb.js" }], * // external: [{ name: "card.sb.js", p: "/project/node_modules/pkg/card.sb.js" }] * // } */ export declare const compare: (request: CompareRequest) => CompareResult; export {};