// src/actions/dead/deprecation.ts
import ts from "typescript";
function getLeadingRanges(sourceFile, node) {
  const ranges = [
    ...ts.getLeadingCommentRanges(sourceFile.text, node.pos) ?? [],
    ...ts.getLeadingCommentRanges(sourceFile.text, node.getFullStart()) ?? []
  ];
  const seen = /* @__PURE__ */ new Set();
  return ranges.filter((range) => {
    if (seen.has(range.pos)) return false;
    seen.add(range.pos);
    return true;
  });
}
function hasDeprecatedTag(sourceFile, node) {
  for (const range of getLeadingRanges(sourceFile, node)) {
    const text = sourceFile.text.slice(range.pos, range.pos + range.end - range.pos);
    if (/@deprecated\b/.test(text)) return true;
  }
  const jsDocs = ts.getJSDocCommentsAndTags(node);
  return jsDocs.some((doc) => {
    if (!ts.isJSDoc(doc)) return false;
    return doc.tags?.some((tag) => tag.tagName.text === "deprecated") === true;
  });
}
export {
  hasDeprecatedTag
};
//# sourceMappingURL=deprecation.mjs.map
