// src/actions/deplint/findFiles.ts
import fs from "fs";

// src/actions/deplint/findFilesByGlob.ts
import { globSync } from "glob";
function findFilesByGlob(cwd, pattern, ignore) {
  return globSync(pattern, {
    cwd,
    absolute: true,
    ignore,
    nodir: true
  });
}

// src/actions/deplint/findFiles.ts
var codeExtensions = "*.{ts,tsx,mts,cts,js,mjs,cjs}";
function getWorkspaceIgnores(location) {
  try {
    const raw = fs.readFileSync(`${location}/package.json`, "utf8");
    const pkg = JSON.parse(raw);
    return pkg.workspaces ?? [];
  } catch {
    return [];
  }
}
function findFiles(location) {
  const workspaceIgnores = getWorkspaceIgnores(location).map((w) => `${w}/**`);
  const ignore = ["**/node_modules/**", "dist/**", ...workspaceIgnores];
  const allFiles = findFilesByGlob(location, `./**/${codeExtensions}`, ignore);
  const distFiles = [
    ...findFilesByGlob(location, "./dist/**/*.d.ts"),
    ...findFilesByGlob(location, `./dist/**/${codeExtensions}`)
  ];
  return { allFiles, distFiles };
}
export {
  findFiles
};
//# sourceMappingURL=findFiles.mjs.map