// src/actions/deplint/isTerminalPackage.ts
import fs from "fs";
var EXPORT_META_KEYS = /* @__PURE__ */ new Set([".", "./package.json", "./README.md"]);
function exportsLookCliOnly(exports) {
  if (exports === void 0) return true;
  if (typeof exports === "string") return true;
  return Object.keys(exports).every((k) => EXPORT_META_KEYS.has(k));
}
function isTerminalPackage(location) {
  try {
    const pkg = JSON.parse(
      fs.readFileSync(`${location}/package.json`, "utf8")
    );
    if (pkg.private === true) return true;
    if (pkg.xy?.commands?.deplint?.terminal === true) return true;
    const hasBin = pkg.bin !== void 0;
    const hasNoLegacyEntries = !pkg.main && !pkg.module;
    if (hasBin && hasNoLegacyEntries && exportsLookCliOnly(pkg.exports)) {
      return true;
    }
    return false;
  } catch {
    return false;
  }
}
export {
  isTerminalPackage
};
//# sourceMappingURL=isTerminalPackage.mjs.map