// src/actions/package/compile/inputs.ts
import chalk from "chalk";
import { glob } from "glob";
var getAllInputs = (srcDir, verbose = false) => {
  return [...glob.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
    const result = file.slice(Math.max(0, srcDir.length + 1));
    if (verbose) {
      console.log(chalk.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
    }
    return result;
  }), ...glob.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
    const result = file.slice(Math.max(0, srcDir.length + 1));
    if (verbose) {
      console.log(chalk.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
    }
    return result;
  })];
};

// src/actions/package/compile/buildEntries.ts
var isSpecOrStory = (entry) => {
  return entry.includes(".spec.") || entry.includes(".stories.") || entry.startsWith("spec/") || entry.includes("/spec/") || entry.startsWith("stories/") || entry.includes("/stories/") || entry === "spec.ts" || entry.endsWith("/spec.ts") || entry === "stories.ts" || entry.endsWith("/stories.ts");
};
var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories = true, verbose = false) => {
  let entries;
  switch (entryMode) {
    case "platform": {
      entries = ["index-node.ts", "index-browser.ts"];
      break;
    }
    case "all": {
      entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !isSpecOrStory(entry)) : getAllInputs(srcDir)).filter((entry) => !entry.endsWith(".d.ts"));
      break;
    }
    case "custom": {
      entries = [];
      break;
    }
    default: {
      entries = ["index.ts"];
      break;
    }
  }
  if (typeof options !== "boolean" && Array.isArray(options?.entry)) {
    entries.push(...options.entry);
  }
  if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`);
  return entries;
};
export {
  buildEntries
};
//# sourceMappingURL=buildEntries.mjs.map