/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
import { DEFAULT_ENTRY, resolveEntryPaths } from "../../../../../tailwind-internal/dist/utils/entryPoints.js";
import fg from "fast-glob";
//#region ../css/dist/purger/optimized/utils/files.mjs
/*! © 2026 Yahoo, Inc. UDS CSS v0.0.0-development */
/**
* Scan a directory for JSX/TSX files
*/
const scanForFiles = async (entry) => {
	const workspaceDir = process.env.PWD ?? process.cwd();
	try {
		const fileGroups = await Promise.all(resolveEntryPaths(entry, workspaceDir, DEFAULT_ENTRY).map((entryPath) => {
			if (entryPath.kind === "file") return [entryPath.absolutePath];
			return fg("**/*.{jsx,tsx}", {
				cwd: entryPath.absolutePath,
				absolute: true,
				ignore: ["**/node_modules/**"]
			});
		}));
		return [...new Set(fileGroups.flat())];
	} catch (error) {
		throw error instanceof Error ? error : /* @__PURE__ */ new Error(`Couldn't find the entry directory: ${entry}. Please make sure it exists.`);
	}
};
//#endregion
export { scanForFiles };
